From patchwork Wed Jul 26 07:15:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xiang, Haihao" X-Patchwork-Id: 42984 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:7528:b0:130:ccc6:6c4b with SMTP id r40csp340983pzd; Wed, 26 Jul 2023 00:16:16 -0700 (PDT) X-Google-Smtp-Source: APBJJlGv56sf0F+hWZPHT87sDE8dy/UtluEyH67Aw3nZeYAVdFBGHgdJ0DcQXBTHFbBoIcK7krKs X-Received: by 2002:a17:907:763c:b0:991:37d2:c9f0 with SMTP id jy28-20020a170907763c00b0099137d2c9f0mr985325ejc.68.1690355776156; Wed, 26 Jul 2023 00:16:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690355776; cv=none; d=google.com; s=arc-20160816; b=Eyy6LD+FASZG9nZeQFYIn5iQgC/bRncXRNQ8MDpsc5ERUVAmSvh3b3ha3vuG0BW/H4 z+IjaISnh6BXM0QibqreYM6xU13jNSb8UocSSEZd3FDgZyViTTcy9wUJFy5TAEkm/vGQ cKw1QOmsMvx68DF6UUYicScxCCh5mesv9KbW8CMn0jytkygqipnO++pyP8KYtv3mz17y ziC79Wf/mduamVFWiZrDK2X4UFy1Fxrx6PZkfYtosVaN+jRjQB4jB1XHczNPawnxcy7x 1A1U3VJI1kjsTq9wUP+bFWikMUTRYptN2YC07kZ8c8mVbL6OCft8j1w/sSPvyhyOYSpP STIg== 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=+TBVjr+Z6DEeWRljgKg4IkYGdLP2zb933lBpw2xfIc4=; fh=Tt4aWcAPplwJLYowQh9cIyedJjsIqBA8GlwfHZgTuYo=; b=awZ6Ohkp8/94csmwUeN3K41QcYG0bgTViEGAyjX/Eix1SRRT7YU9hjrXwCOwgr1yub dIfN1ov4r7Jst1yvWTnqVw1WOD4cxSVvW6KhM4fHDRdDAI0LiBOvCNBYrzR1aoyUHbs2 CyI/7quBWWcvoQRdE3kfsuwKOzvIl3bsxJfcpVpZGgUOb+MpqC0Pk8sBGq2DDaQmBD+A aoepgP45SMI5mYbZ/e3z06zlshVwb6ScLFi+RWxHQ1uW7K0kOy2ahuKc278xEC2xIIck ncE1JZqY8Otr5yfAjPORvR0iPAM/uCVOs3+sTqNdoesYzdLLmciSI6MISEOZEC5eYl4V JNXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=DCLcLz2E; 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 r16-20020a170906a21000b0099b49483268si9423591ejy.301.2023.07.26.00.16.15; Wed, 26 Jul 2023 00:16:16 -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=DCLcLz2E; 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 0937C68C90A; Wed, 26 Jul 2023 10:16:09 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 04A7768C6CD for ; Wed, 26 Jul 2023 10:16:00 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690355767; x=1721891767; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=R8U144JWrZxFWzIPY/NkXTtg67HQZdTei4yWy6+2r1I=; b=DCLcLz2EW9QyvIc+GpaO1sUtViT3UXtdwT1tBbIFZLAYsHkGB6zCdV1S txEHyPcij7ZvecHa652mdALYvDeT0la6ZwsDVD+1RZg3+8/z7+E3s6E1R 9uTt7TKNgVDN7et0qvmm/pNfQ7RvHPKPomr6Ws5ezTaglYkgO6f9AIMdx EGCDHFFvv4CVZWR5nswLoJmQNfWE6DXEc+6sH4hrPDlr/kjH0TcUphD40 ELiN2ObLwoqXs1XsGPUtA+vvky43rKYFIqBq331ZKzWdFO1c8ZWZeTXxZ EnripI4P9hjIWiWnn4KkQo5Va9OHCuaTA/vc+G5sV+m798chV3FjImVX2 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10782"; a="347551668" X-IronPort-AV: E=Sophos;i="6.01,231,1684825200"; d="scan'208";a="347551668" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jul 2023 00:15:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10782"; a="756106885" X-IronPort-AV: E=Sophos;i="6.01,231,1684825200"; d="scan'208";a="756106885" Received: from xhh-tgl64.sh.intel.com ([10.238.2.19]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jul 2023 00:15:55 -0700 From: "Xiang, Haihao" To: ffmpeg-devel@ffmpeg.org Date: Wed, 26 Jul 2023 15:15:20 +0800 Message-Id: <20230726071522.38149-2-haihao.xiang@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230726071522.38149-1-haihao.xiang@intel.com> References: <20230726071522.38149-1-haihao.xiang@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/4] lavfi/vf_vpp_qsv: take input color properties into account 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: m/yjf8UkYkjW From: Haihao Xiang Signed-off-by: Haihao Xiang --- libavfilter/vf_vpp_qsv.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index 334a86551b..bf4264efc5 100644 --- a/libavfilter/vf_vpp_qsv.c +++ b/libavfilter/vf_vpp_qsv.c @@ -58,6 +58,10 @@ typedef struct VPPContext{ mfxExtVPPRotation rotation_conf; mfxExtVPPMirroring mirroring_conf; mfxExtVPPScaling scale_conf; +#if QSV_ONEVPL + /** Video signal info attached on the input frame */ + mfxExtVideoSignalInfo invsi_conf; +#endif /** * New dimensions. Special values are: @@ -344,6 +348,37 @@ static mfxStatus get_mfx_version(const AVFilterContext *ctx, mfxVersion *mfx_ver return MFXQueryVersion(device_hwctx->session, mfx_version); } +static int vpp_set_frame_ext_params(AVFilterContext *ctx, const AVFrame *in, AVFrame *out, QSVVPPFrameParam *fp) +{ +#if QSV_ONEVPL + VPPContext *vpp = ctx->priv; + QSVVPPContext *qsvvpp = &vpp->qsv; + mfxExtVideoSignalInfo invsi_conf; + + fp->num_ext_buf = 0; + + if (!in || + !QSV_RUNTIME_VERSION_ATLEAST(qsvvpp->ver, 2, 0)) + return 0; + + memset(&invsi_conf, 0, sizeof(mfxExtVideoSignalInfo)); + invsi_conf.Header.BufferId = MFX_EXTBUFF_VIDEO_SIGNAL_INFO_IN; + invsi_conf.Header.BufferSz = sizeof(mfxExtVideoSignalInfo); + invsi_conf.VideoFullRange = (in->color_range == AVCOL_RANGE_JPEG); + invsi_conf.ColourPrimaries = (in->color_primaries == AVCOL_PRI_UNSPECIFIED) ? AVCOL_PRI_BT709 : in->color_primaries; + invsi_conf.TransferCharacteristics = (in->color_trc == AVCOL_TRC_UNSPECIFIED) ? AVCOL_TRC_BT709 : in->color_trc; + invsi_conf.MatrixCoefficients = (in->colorspace == AVCOL_SPC_UNSPECIFIED) ? AVCOL_SPC_BT709 : in->colorspace; + invsi_conf.ColourDescriptionPresent = 1; + + if (memcmp(&vpp->invsi_conf, &invsi_conf, sizeof(mfxExtVideoSignalInfo))) { + vpp->invsi_conf = invsi_conf; + fp->ext_buf[fp->num_ext_buf++] = (mfxExtBuffer*)&vpp->invsi_conf; + } +#endif + + return 0; +} + static int config_output(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->src; @@ -361,6 +396,7 @@ static int config_output(AVFilterLink *outlink) outlink->time_base = av_inv_q(vpp->framerate); param.filter_frame = NULL; + param.set_frame_ext_params = vpp_set_frame_ext_params; param.num_ext_buf = 0; param.ext_buf = ext_buf;