From patchwork Mon Mar 22 06:31:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenbin Chen X-Patchwork-Id: 26531 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 1924744BB54 for ; Mon, 22 Mar 2021 08:33:46 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E387A68A9EE; Mon, 22 Mar 2021 08:33:45 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5F4AB687F27 for ; Mon, 22 Mar 2021 08:33:38 +0200 (EET) IronPort-SDR: OGUOtWO4GuH8fwT9LIOoJxaCSQRzazr8NArW9DvKFU7QoOsxHV+8GtnqZKeX4vFN888tEX1W2S 8mn+GE4KOUjA== X-IronPort-AV: E=McAfee;i="6000,8403,9930"; a="169541475" X-IronPort-AV: E=Sophos;i="5.81,268,1610438400"; d="scan'208";a="169541475" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2021 23:33:36 -0700 IronPort-SDR: L5DvgPNqkd6Ny7DOt4QV+dlMplBGe7G+sf/qJRdC5Q3qZChSoGKJNWrebWOkFWpXAkK/ooYGRK fQVDPFq2el0Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,268,1610438400"; d="scan'208";a="414355795" Received: from chenwenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.3]) by orsmga008.jf.intel.com with ESMTP; 21 Mar 2021 23:33:34 -0700 From: wenbin.chen@intel.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 22 Mar 2021 14:31:50 +0800 Message-Id: <20210322063150.2269270-1-wenbin.chen@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] libavcodec/qsvdec: use the param from decodeHeader to configure surface 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" MSDK recognizes both yuv420p10 and yuv420p9 as MFX_FOURCC_P010, but param are different. When decode yuv420p9 video, ffmpeg-qsv will use yuv420p10le to configure surface which is different with param from DecoderHeader and this will lead to error. Now change it use param from decoderHeader to configure surface. Signed-off-by Wenbin Chen --- libavcodec/qsvdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index 569ccd4fba..3ab48ea7a2 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -309,13 +309,13 @@ static int alloc_frame(AVCodecContext *avctx, QSVContext *q, QSVFrame *frame) if (frame->frame->format == AV_PIX_FMT_QSV) { frame->surface = *(mfxFrameSurface1*)frame->frame->data[3]; } else { - frame->surface.Info = q->frame_info; - frame->surface.Data.PitchLow = frame->frame->linesize[0]; frame->surface.Data.Y = frame->frame->data[0]; frame->surface.Data.UV = frame->frame->data[1]; } + frame->surface.Info = q->frame_info; + if (q->frames_ctx.mids) { ret = ff_qsv_find_surface_idx(&q->frames_ctx, frame); if (ret < 0)