From patchwork Wed May 8 06:03:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xiang, Haihao" X-Patchwork-Id: 48659 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9e49:b0:1a9:cad7:3df4 with SMTP id mt9csp334558pzb; Tue, 7 May 2024 23:05:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVDZzpParKc4Fvdpbn6AwN5w+ze6ZGAbiuKc2IfB6Q99JQ6c0B8tVDtd6eInHJK66ki/z2RyGvtx5bXUrPzcmPiiOBjO4UwwrW2eg== X-Google-Smtp-Source: AGHT+IEU22vcQr8SuIjJn2mE/5s9PoMiLHIWmygfRJZB4XGMCg3+jIsfY/QJKn/Uy1ClxuMcnUaz X-Received: by 2002:a50:f68d:0:b0:570:2198:b3ca with SMTP id 4fb4d7f45d1cf-5731d9d388emr1117762a12.14.1715148322454; Tue, 07 May 2024 23:05:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715148322; cv=none; d=google.com; s=arc-20160816; b=JfsqGELwcTrPfmeoTJfUtEKjUBXpI18NLCRJMprT3pgRC0tYgc2VC/wZ8w4h9YcWqc emneuD0jL5XXpQfiQjBm2MgjDo8Uzu1iLjH21o4Jge7zcdpKalfFTuiWEd5qRSd/IMd6 Vu0TKUVQ5Hy8++KOmOG/nWAvXaQ6IgpSCTNnJ/qJS/7BGSsbjZFkXb0awj9ib+qxEzYL TBpVZmAGsLwLugQfaQF2XesXnIyNDqYzgKUlgRGTucb8+VFV4kc+fOY3xL8jY12wwAku 5hRJoD329T23j1LNWpfsAZ4YHBEQ864EINcYzt/n1jWv331lqXDFqDr3yOdonhkg64I+ oZRg== 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=Wry6My7xUBpr5HkJFj73UG3mrRY2vESS860sMw9BK/Y=; fh=1kpmTRI1sW42eNCnNMby7VLIISQBX6KJuVYxOEG0t2A=; b=bMiaoBZrEu6g0GfE6QzGcI+sdTGU8asMRia8ULBJxF62tv/e2KnleX2ILNiL916Ijy PBbi1LHO088hJ5lzF/nbkxvHu8dqDeRbOzFP6ZlMu+Fsl4CLLzHCrgcUH3qwY6ZoMxcU ceGE/wtMotutCvuKBVbrAL+DnKJiZPLHM/TBKL4SKuNpMFrj/GIv4lIb+UttMT7Pwrc/ lu4kpuR8oDHYlctVwvzwuAcvfB57Y8YsdP0/IbLxHxKvHR+RS1OB9HI5BGEW3h8ZogZW m/Sk4WXsJdjMLhDESVRNMgRB06ZkvBbuT79OKQOI2M2I4KR8ch0/GhbQ784/MFNrY/M5 Uljw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=Q2qE9PzB; 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 f23-20020a056402151700b00570091b325bsi6616708edw.28.2024.05.07.23.05.21; Tue, 07 May 2024 23:05:22 -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=Q2qE9PzB; 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 735B368D5BD; Wed, 8 May 2024 09:04:38 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 36D0A68D552 for ; Wed, 8 May 2024 09:04:31 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715148277; x=1746684277; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UGevvelseabWubLKuphvb9QQre3o00WAAq33pG+ERDo=; b=Q2qE9PzBF5EmaoD4CkDAAVcXlwpRQg8n9y1aYUxPj/akKA6oAFkIMDce zqrYWlj4Fb3zZLAAxNbHcL9DFzwIaqu96sT/tnrU8SjnQk2OYCgOJQ3YJ RTCgDik5ADnPbJ2yk7+oIFo78xFiTpc8CK5A/ieIL+RavZr9ef3TK65LX 9xTXHTZKsi+rcn/+3D3pSQ9F9xjtEck30BldvYq+8OUNKmMaE5xGjicFw o5qweLuzej8BADDn2SvUmI9KIcBr2Hovgu3f8tNnN20rfqeSx1SKbg3uE nSvAKipk+s39DvfRBksjpnuqG+r6s+5r9FRnUWVf7q3/ctw/QaA3CwW5X w==; X-CSE-ConnectionGUID: aW0zpA7ZSx6fKYy3fvO9CQ== X-CSE-MsgGUID: BPYu7kajRNa/WqptWU9FxQ== X-IronPort-AV: E=McAfee;i="6600,9927,11066"; a="10855360" X-IronPort-AV: E=Sophos;i="6.08,144,1712646000"; d="scan'208";a="10855360" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2024 23:04:25 -0700 X-CSE-ConnectionGUID: iofZvZmoTkGhXiSEcRKq7Q== X-CSE-MsgGUID: LDksYjzVRwKC3gv36VKhlw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,144,1712646000"; d="scan'208";a="28828793" Received: from unknown (HELO xhh-dg264.sh.intel.com) ([10.238.2.76]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2024 23:04:23 -0700 From: "Xiang, Haihao" To: ffmpeg-devel@ffmpeg.org Date: Wed, 8 May 2024 14:03:13 +0800 Message-Id: <20240508060316.681114-6-haihao.xiang@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240508060316.681114-1-haihao.xiang@intel.com> References: <20240508060316.681114-1-haihao.xiang@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 6/9] lavc/qsvenc: use the right info for encoding 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: 5Flhi7XxRl2j From: Haihao Xiang Signed-off-by: Haihao Xiang --- libavcodec/qsvenc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index d881c11160..3df355ce78 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -745,8 +745,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) { @@ -869,8 +870,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) {