From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 4CDFA46C16 for ; Wed, 6 Sep 2023 06:02:12 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5F74668C7F5; Wed, 6 Sep 2023 09:01:33 +0300 (EEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5A27D68C7B7 for ; Wed, 6 Sep 2023 09:01:21 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1693980089; x=1725516089; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YNoPbVApmzZScvCO12QdPO/mOETB8h56wZ/FFGZEw7Q=; b=WiekWmKFE+hSOnncMkhQL7EuGnLP42bvjMAntucw2Fr//it/rGf+9x7D vOkGAWWAWMocAkA9TuX6UVku7rRaxF/DDkefeCZFBcfGz3AkVlCD0qU7s fQB8InjXlUB9DvlcNllJqGi+/jAjdI49GeOdY9pIzTxt7cmO6Br7OcfCS imM/jvDvkPQce11rUF2PMi7BVnxj8gjde9/9hZbawJAClAZYRZPwmO1Vu YXcbEiTbcNmzaoJlXUDjPw/OpK+6AOHxZiJEkL6A/du7NgjcgWhNFRDL6 Ap69YEKkax44iwTfYAZK+3hS37wMb1mAlSUx4VtURv+yHmLgwaNaGjc2a Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10824"; a="374372424" X-IronPort-AV: E=Sophos;i="6.02,231,1688454000"; d="scan'208";a="374372424" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Sep 2023 23:01:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10824"; a="734919036" X-IronPort-AV: E=Sophos;i="6.02,231,1688454000"; d="scan'208";a="734919036" Received: from xhh-dg264.sh.intel.com ([10.238.2.76]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Sep 2023 23:01:14 -0700 From: "Xiang, Haihao" To: ffmpeg-devel@ffmpeg.org Date: Wed, 6 Sep 2023 14:00:45 +0800 Message-Id: <20230906060052.698620-6-haihao.xiang@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230906060052.698620-1-haihao.xiang@intel.com> References: <20230906060052.698620-1-haihao.xiang@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 06/13] lavc/qsv: set right mfxFrameInfo for frames in dynamic frame pools 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 Cc: Haihao Xiang Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Haihao Xiang Signed-off-by: Haihao Xiang --- libavcodec/qsv.c | 4 ++-- libavcodec/qsvenc.c | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index 3f4b7b8193..4ae697379f 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -839,7 +839,7 @@ static mfxStatus qsv_frame_alloc(mfxHDL pthis, mfxFrameAllocRequest *req, AVHWFramesContext *frames_ctx = (AVHWFramesContext*)ctx->hw_frames_ctx->data; AVQSVFramesContext *frames_hwctx = frames_ctx->hwctx; mfxFrameInfo *i = &req->Info; - mfxFrameInfo *i1 = &frames_hwctx->surfaces[0].Info; + mfxFrameInfo *i1 = frames_hwctx->nb_surfaces ? &frames_hwctx->surfaces[0].Info : frames_hwctx->info; if (i->Width > i1->Width || i->Height > i1->Height || i->FourCC != i1->FourCC || i->ChromaFormat != i1->ChromaFormat) { @@ -954,7 +954,7 @@ static mfxStatus qsv_frame_lock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr) if (!qsv_mid->hw_frame->hw_frames_ctx) goto fail; - qsv_mid->surf.Info = hw_frames_hwctx->surfaces[0].Info; + qsv_mid->surf.Info = hw_frames_hwctx->nb_surfaces ? hw_frames_hwctx->surfaces[0].Info : *hw_frames_hwctx->info; qsv_mid->surf.Data.MemId = qsv_mid->handle_pair; /* map the data to the system memory */ diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index b3b7475b0f..72dc33c2e4 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -717,8 +717,9 @@ static int init_video_param_jpeg(AVCodecContext *avctx, QSVEncContext *q) if (avctx->hw_frames_ctx) { AVHWFramesContext *frames_ctx = (AVHWFramesContext *)avctx->hw_frames_ctx->data; AVQSVFramesContext *frames_hwctx = frames_ctx->hwctx; - q->param.mfx.FrameInfo.Width = frames_hwctx->surfaces[0].Info.Width; - q->param.mfx.FrameInfo.Height = frames_hwctx->surfaces[0].Info.Height; + mfxFrameInfo *info = frames_hwctx->nb_surfaces ? &frames_hwctx->surfaces[0].Info : frames_hwctx->info; + q->param.mfx.FrameInfo.Width = info->Width; + q->param.mfx.FrameInfo.Height = info->Height; } if (avctx->framerate.den > 0 && avctx->framerate.num > 0) { @@ -841,8 +842,9 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) if (avctx->hw_frames_ctx) { AVHWFramesContext *frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data; AVQSVFramesContext *frames_hwctx = frames_ctx->hwctx; - q->param.mfx.FrameInfo.Width = frames_hwctx->surfaces[0].Info.Width; - q->param.mfx.FrameInfo.Height = frames_hwctx->surfaces[0].Info.Height; + mfxFrameInfo *info = frames_hwctx->nb_surfaces ? &frames_hwctx->surfaces[0].Info : frames_hwctx->info; + q->param.mfx.FrameInfo.Width = info->Width; + q->param.mfx.FrameInfo.Height = info->Height; } if (avctx->framerate.den > 0 && avctx->framerate.num > 0) { -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".