From patchwork Tue Nov 29 08:07:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chen, Wenbin" X-Patchwork-Id: 39532 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp284891pzb; Tue, 29 Nov 2022 00:07:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf77xr5mrLTtnlrZL4fHKr1kxri5G356UNxFy5KxOP0sKFjFqHg6c886xAiJiNE0VE0el4WK X-Received: by 2002:a17:906:7ac8:b0:7ad:c8d6:bc7f with SMTP id k8-20020a1709067ac800b007adc8d6bc7fmr46235547ejo.118.1669709241111; Tue, 29 Nov 2022 00:07:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669709241; cv=none; d=google.com; s=arc-20160816; b=mGR+oalA+UbPJZhclx55fFwXLeODc9pV8R8JpSF8V6rWl67mNO0exohBKvxzgeYzzV 94aTQiK63gCGIt2+0WzyQdj+Pxbs0u9sCRWodwaHlK4ICpYVTC+g7iNH2DPmKoMJxYhZ mcjPFMSRqDKXJO9eRsSudlKjR13buv3FIaaAJSj/nqhkDINzrnU1YKPpP8rZkKbWsqhM PB7UwUfaP55nIZimd02kI0Hp4L9iP9652FL/mPYPimjTO2OHpX1Giw6YekLAdm8TCRmM LHbAMasDEDKPssarV1C7giyiGsdpTpSQNkeY2R75tGg18i2cb6iOkCaie1imZ4PKvz6r L/EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=U2wY+OZ0vVQqhJBSXu3uDTpk7LF9xX7Qk/ILpVxVDGc=; b=bEzIPJ1ETqB6WBBMRVdJtQOmADgTNWffi7dUU0LHgYcjZM7pLRHRerDGONLWU8//TZ WPIH7SxoXd01ozIjlvgIjD+QiitI6jiJbVRuvffB6d73vq0z2fE28GmnlMGvIPeoNsIS yx4QEts98fuNQFf58ZV3uFDfFjdY3nbDl0UaVGfoymQbUvf0w+/3adCQckl6M56r7eA3 b/YvRIVBaRgN8tuywY3JADCyzdmcRAc+9BkAU734Mf6KGsq8G/vT7x5QyNXGUgI+J+xV JG4Ch8FKgaooJ15dcHn5GAN1Ndp23vrJpfU3C8baGeHhDUJwYwt6ysnxjrFKFVvF3I47 fysA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=cDFDsFfl; 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 hr14-20020a1709073f8e00b00787abcb1ce0si12662862ejc.679.2022.11.29.00.07.17; Tue, 29 Nov 2022 00:07:21 -0800 (PST) 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=cDFDsFfl; 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 2F95768A701; Tue, 29 Nov 2022 10:07:14 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D9C0968A701 for ; Tue, 29 Nov 2022 10:07:06 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669709232; x=1701245232; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=5HSOKBooX/TtXa0d85J5VxN5D6sWKhRRxs/ibkLFnQo=; b=cDFDsFflhWOGgXbnDPzWV4zGXymbgA70MUOirYHYteuZT93xvHb02SRy RPff8tliDGUX2poR3U8AKYVfO2ibZIWDcXoq3uEwZKm7wPnyP1fX0hc7d RKyjEHd8CgmcdQ1e3JpN2r2b7HCpKFCFHyMchpB87x5weQC/HuwsAUZ6K JBCg2rZ+myGUo3+/5Yo59O9V8MfUSTnDVsXPsHd2pXdZBhhJlNosfKIpk wHgR4qaqkTuCtkQCSqtGbcO1A2Zg1zAZ6a/rFAWV9iRY8ZEq5o5oXIbku Gki3xWPHyehk3r45S57ubH2xSgbEOnpsE+Q/XhjJvVgClkTowPOmc7xW1 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10545"; a="379315927" X-IronPort-AV: E=Sophos;i="5.96,202,1665471600"; d="scan'208";a="379315927" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2022 00:07:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10545"; a="643694358" X-IronPort-AV: E=Sophos;i="5.96,202,1665471600"; d="scan'208";a="643694358" Received: from wenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.4]) by orsmga002.jf.intel.com with ESMTP; 29 Nov 2022 00:07:03 -0800 From: wenbin.chen-at-intel.com@ffmpeg.org To: ffmpeg-devel@ffmpeg.org Date: Tue, 29 Nov 2022 16:07:02 +0800 Message-Id: <20221129080702.323228-1-wenbin.chen@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] libavfilter/qsvvpp: Use different alignment for YUV420P format 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: WUg4dCrhRYdm From: Wenbin Chen When process yuv420 frames, FFmpeg use same alignment on Y/U/V planes. VPL and MSDK use Y plane's pitch / 2 as U/V planes's pitch, which make U/V planes 16-bytes aligned. We need to set a separate alignment to meet runtime's behaviour. Now the commandline works fine: ffmpeg -f rawvideo -pix_fmt yuv420p -s:v 3082x1884 \ -i ./3082x1884.yuv -vf 'vpp_qsv=w=2466:h=1508' -f rawvideo \ -pix_fmt yuv420p 2466_1508.yuv Signed-off-by: Wenbin Chen --- libavfilter/qsvvpp.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c index 8428ee89ab..ad09114cb7 100644 --- a/libavfilter/qsvvpp.c +++ b/libavfilter/qsvvpp.c @@ -408,9 +408,15 @@ static QSVFrame *submit_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *p } else { /* make a copy if the input is not padded as libmfx requires */ if (picref->height & 31 || picref->linesize[0] & 31) { - qsv_frame->frame = ff_get_video_buffer(inlink, - FFALIGN(inlink->w, 32), - FFALIGN(inlink->h, 32)); + /* When process YUV420 frames, FFmpeg uses same alignment on Y/U/V + * planes. VPL and MSDK use Y plane's pitch / 2 as U/V planes's + * pitch, which makes U/V planes 16-bytes aligned. We need to set a + * separate alignment to meet runtime's behaviour. + */ + qsv_frame->frame = ff_default_get_video_buffer2(inlink, + FFALIGN(inlink->w, 32), + FFALIGN(inlink->h, 32), + 16); if (!qsv_frame->frame) return NULL;