From patchwork Mon Feb 21 07:28:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chen, Wenbin" X-Patchwork-Id: 34431 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6838:d078:0:0:0:0 with SMTP id x24csp3149887nkx; Sun, 20 Feb 2022 23:28:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJw25fHzUBp6DQAUIkhWzIGUzsqTEHkuf46hAIBYtAMH9QLC+klPUyBj9Vws3xWjmuzx/n+I X-Received: by 2002:a17:906:d10c:b0:6cd:4aa2:cd62 with SMTP id b12-20020a170906d10c00b006cd4aa2cd62mr14916721ejz.229.1645428529484; Sun, 20 Feb 2022 23:28:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645428529; cv=none; d=google.com; s=arc-20160816; b=0VwpygInq9kv3OV2PImJa0EzVhs+tjNR8xhsSChL/y1fpqkfzSG3AFHFz7BIaI9bbh DrlkJLxNvO2z8fuB9hKK7OuYLy9qLooNeSyufTXh3Qr+nVHogpwpXco6fjpgRV7nUl+J dHyrc+ZVCKgvAx3FF0pWZcfceRdrVqFqWliiUCXrtJX6wqaqLpCUynR8oTa0driGeXYo lkUC1n5emy+GVNhjyyqxgP8J3KUxKoY7w3lSsgG8wITc75XjAzRx12xShwjeKjIMWB2c 7r9Cw8+zb3wABqFd1JMrS33BZ5iH3q5mc+Ym+IKq2TDoead3eutPCGArPpPRPrIlvYyw P+4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=D4/X1xXVoDgRwCyyqOgz4SFBNYF3Gu91cLEpyNT2iwE=; b=HXdGzqEmAQY0ILKO9084zJSPUFEhk6BhlmkDstNfecD8FOu7C9J9SQY95+cjPyjYcJ JVkPquUOOA0YCWSwUyJsSem00g6g2FhOclB3OSPgub2djbbCc5e1oMrFaahgthE79FsN eKW4O5jXE9i0WapsP6ODRvEw9NVQ7n/FqD/N1/5C31Rdp27FPp/kbaNj/IlyY2B5yAut HjBm0Ub93IZkTR6aRswp2AgoHIimoefHr+Garsrv2lxpUcTye6LgkGAX+WT0mtO36MeR eFhsH4wT5KoburkySsN9eBzbj+O3FhoLEyKp2LR2ciSkLRN5iPQs41Bm3RcI391F8Fbz Rrnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=iz1WnsSi; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y11si10208071edj.138.2022.02.20.23.28.48; Sun, 20 Feb 2022 23:28:49 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=iz1WnsSi; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CBF7768B10D; Mon, 21 Feb 2022 09:28:44 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 86D8E68B0D3 for ; Mon, 21 Feb 2022 09:28:37 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645428522; x=1676964522; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=LzFI5tmmE2X1HOlBBVLFQYQrK7hRCsV1HjU8E3ORhNA=; b=iz1WnsSi2lsnEUn3dSJ7byknd3oJUlf/UV2rj0D8GXoj7rbcaDkK9tyo NZYj5RNaDj9yYJMJCNN6Ox2xX0K69m4mGXocDApSxEIbGi4xBwNjh/hpu CuMyAu0768eolpdTzOkAIeMDRoNCcyDoEYR9nlVXizFrJAYF2ecfzzWMe waJQm+5KAeyjDxlFg5y26/S5ej6QywU2hsOE7tFVlnZNCxFTD0rZ5tboG oM+djYpNYyyHJUDcFZIOp7wAXAN5duBnPogmwYd3l4E/oq1CkI/BoO0L8 8j0ICPL3kXcJLMLB6sYXw9cLK+mXn/E/XGBQZ71AgSHGTNVRm+zxEYRWl w==; X-IronPort-AV: E=McAfee;i="6200,9189,10264"; a="251401313" X-IronPort-AV: E=Sophos;i="5.88,385,1635231600"; d="scan'208";a="251401313" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Feb 2022 23:28:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,385,1635231600"; d="scan'208";a="547223074" Received: from wenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.110]) by orsmga008.jf.intel.com with ESMTP; 20 Feb 2022 23:28:34 -0800 From: Wenbin Chen To: ffmpeg-devel@ffmpeg.org Date: Mon, 21 Feb 2022 15:28:33 +0800 Message-Id: <20220221072833.967303-1-wenbin.chen@intel.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2] libavcodec/qsvenc: add more ChromaFormat support to mjpeg_qsv X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 9jYD8VxTTD7I ChromaForamt for mjpeg-qsv is always set to yuv420, and this will be wrong when encode other pixel format (for example yuyv422). ChromaFormat is changed to be adaptive to pix_fmt. Signed-off-by: Wenbin Chen --- libavcodec/qsvenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 07be4287b7..3d9dfb13b0 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -616,7 +616,8 @@ static int init_video_param_jpeg(AVCodecContext *avctx, QSVEncContext *q) q->param.mfx.FrameInfo.CropH = avctx->height; q->param.mfx.FrameInfo.AspectRatioW = avctx->sample_aspect_ratio.num; q->param.mfx.FrameInfo.AspectRatioH = avctx->sample_aspect_ratio.den; - q->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420; + q->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420 + + !desc->log2_chroma_w + !desc->log2_chroma_h; q->param.mfx.FrameInfo.BitDepthLuma = desc->comp[0].depth; q->param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth; q->param.mfx.FrameInfo.Shift = desc->comp[0].depth > 8;