From patchwork Mon Mar 22 06:35:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenbin Chen X-Patchwork-Id: 26533 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 9D16444A773 for ; Mon, 22 Mar 2021 08:37:22 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 767A268A9E8; Mon, 22 Mar 2021 08:37:22 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0CBDD68A708 for ; Mon, 22 Mar 2021 08:37:14 +0200 (EET) IronPort-SDR: lnpgFl1cSetYSWUS5CHSQ13LcCWp5MkxHYHJ/slMYtFaDmz6hdN/46etl4v4x/Cw71Ej3udUWR ZDxCuwn5UB1g== X-IronPort-AV: E=McAfee;i="6000,8403,9930"; a="170172290" X-IronPort-AV: E=Sophos;i="5.81,268,1610438400"; d="scan'208";a="170172290" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2021 23:37:10 -0700 IronPort-SDR: AmmRddRzHSvsEABem/rDVUQlmrvcjs2eXnOZHmuWOygpXagxjH4Tm7IQFyuxxbo2VMUeGg8t// +cbWRma6VY7A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,268,1610438400"; d="scan'208";a="414356632" Received: from chenwenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.3]) by orsmga008.jf.intel.com with ESMTP; 21 Mar 2021 23:37:08 -0700 From: wenbin.chen@intel.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 22 Mar 2021 14:35:24 +0800 Message-Id: <20210322063524.2270692-1-wenbin.chen@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] libavcodec/qsvenc: add more ChromaFormat support for mjpeg-qsv X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Cc: "Chen,Wenbin" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: "Chen,Wenbin" ChromaForamt for mjpeg-qsv is always set to yuv420, and this will be wrong when encode other pixel format (for example yuyv422). I change this assignment 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 566a5c8552..a0fc206364 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -445,7 +445,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;