From patchwork Mon Mar 29 05:28:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenbin Chen X-Patchwork-Id: 26632 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 5CF1A44A468 for ; Mon, 29 Mar 2021 08:30:50 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3029B6880A8; Mon, 29 Mar 2021 08:30:50 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2648268065D for ; Mon, 29 Mar 2021 08:30:43 +0300 (EEST) IronPort-SDR: 0ZNxiSVEW+TCaddCCCM0mkV3LP2aCqP1dODrltIyN7o3XS+q1QQo7wu9hEOf9QfOjHzttGi2Qe +e+xd9/Lml4A== X-IronPort-AV: E=McAfee;i="6000,8403,9937"; a="179024896" X-IronPort-AV: E=Sophos;i="5.81,285,1610438400"; d="scan'208";a="179024896" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Mar 2021 22:30:40 -0700 IronPort-SDR: U5fkV9uszhWYGv2YrENuXCjxF79hGept7dJYvyEz7trWVfIPczCzygnG8lt9zWLCNFjua/zfF/ KoUy6pJjc1hw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,285,1610438400"; d="scan'208";a="377990738" Received: from chenwenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.3]) by orsmga006.jf.intel.com with ESMTP; 28 Mar 2021 22:30:39 -0700 From: wenbin.chen@intel.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 29 Mar 2021 13:28:14 +0800 Message-Id: <20210329052814.3295553-1-wenbin.chen@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH V3] libavfilter/qsvvpp: change the output frame's width and height 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" qsvvpp align the width and height with 16, and that right. But qsvvpp asign this value to frame->width and frame->height, and that may lead to error. For example, when we use qsvvpp to resize frame to 1080p, qsvvpp will align frame to 1088 and set frame->height to 1088, which is different from the height of encoder (1080) and this will be treated as resolution change. The aligend value can be kept in hw_frame_ctx as it is hardware dependent. Now I assign the out_link's w/h to output frame to overwrite the w/h got from hw_frame_ctx. Signed-off-by: Wenbin Chen --- libavfilter/qsvvpp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c index f216b3f248..70d6cb49e3 100644 --- a/libavfilter/qsvvpp.c +++ b/libavfilter/qsvvpp.c @@ -486,9 +486,6 @@ static QSVFrame *query_frame(QSVVPPContext *s, AVFilterLink *outlink) if (!out_frame->frame) return NULL; - out_frame->frame->width = outlink->w; - out_frame->frame->height = outlink->h; - ret = map_frame_to_surface(out_frame->frame, &out_frame->surface_internal); if (ret < 0) @@ -497,6 +494,8 @@ static QSVFrame *query_frame(QSVVPPContext *s, AVFilterLink *outlink) out_frame->surface = &out_frame->surface_internal; } + out_frame->frame->width = outlink->w; + out_frame->frame->height = outlink->h; out_frame->surface->Info = s->vpp_param.vpp.Out; return out_frame;