From patchwork Wed Sep 6 06:00:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xiang, Haihao" X-Patchwork-Id: 43583 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4f16:b0:149:dfde:5c0a with SMTP id gi22csp2310923pzb; Tue, 5 Sep 2023 23:02:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEMEAvCyVxKnt2KmyvGDe2x8SkJ2i1W+F0wFF+iTuskxnxk2GyRdwEOJ2+evu0DloWGM6Ue X-Received: by 2002:aa7:da52:0:b0:523:7192:6803 with SMTP id w18-20020aa7da52000000b0052371926803mr1420618eds.8.1693980135143; Tue, 05 Sep 2023 23:02:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693980135; cv=none; d=google.com; s=arc-20160816; b=edCNSRjKsjWloMMOGKrDZVuqaiQiP4RF/cBRXeqQk8yy1X4CSfUtLh6uhwDaitvaL0 r0ulcKXjuCaIW6wKXdo1rXGkXIswJetI8wK3Ie50Hxbb80L4cZ9qnzSckMZxH5AQHwHS YSYfsQ5nh4gOTm74fpB8TDq2R5lOtc6nd4idMIqXKsUZqi3GRBz/xAFk7uHAZsyQIviP AI4EBkPRWso6u5O13B1LN5WuHJSkSk2kVS376rHWjped/CIg0zL041XBq3p2HDA+UQUQ 5sdwgPURtKN3lFWfk5rrXzn/+R3QRNQ0j4HWfsI2vLnuwB9JT8o2boTg42thctwuAIdq UHpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=gNwApDcBLHuCachLQMnO0mQhD2GggXcik5Gwsx/0dwA=; fh=1kpmTRI1sW42eNCnNMby7VLIISQBX6KJuVYxOEG0t2A=; b=BKqvV7m/n6zwhPXZMFosntfjzCwts5WODwAZeoKLFMAUvzSllZvl+eI5XPRWOSugmo rcZr+6Iri4lE8fq2MTgCm8SqPan6nH0+IFNxKb4zPFusF8Ef3n6eccMTAGbeHoq3kCdt SYWOock7UcU6WNqeBYMF/OPXBpAMwQlr8utOpcN+jPDauv1n9xdjfIM/F+zPxk/B0MPB Ci0OkaktF8Y6O3BTY0KTIX+mrm2NRY89McguGEGzibRJhPzon9mTbD8CxauKETlznhzx lwufmHMTFhe5lZh3zW6c/eFrAswOoVelBiBKb3lRxfCCvjy6rg5I/3Ykj4MNsOZraUs6 msfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=WiekWmKF; 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 n13-20020aa7c44d000000b0052a4985b5afsi8802397edr.515.2023.09.05.23.02.14; Tue, 05 Sep 2023 23:02:15 -0700 (PDT) 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=WiekWmKF; 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 9576068C809; Wed, 6 Sep 2023 09:01:33 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: P7VPHjijUlXX 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) {