From: "Xiang, Haihao" <haihao.xiang-at-intel.com@ffmpeg.org> To: ffmpeg-devel@ffmpeg.org Cc: Haihao Xiang <haihao.xiang@intel.com> Subject: [FFmpeg-devel] [PATCH 2/4] lavfi/vf_vpp_qsv: take input color properties into account Date: Wed, 26 Jul 2023 15:15:20 +0800 Message-ID: <20230726071522.38149-2-haihao.xiang@intel.com> (raw) In-Reply-To: <20230726071522.38149-1-haihao.xiang@intel.com> From: Haihao Xiang <haihao.xiang@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com> --- 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; -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2023-07-26 7:16 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-07-26 7:15 [FFmpeg-devel] [PATCH 1/4] lavfi/qsvvpp: add set_frame_ext_params callback Xiang, Haihao 2023-07-26 7:15 ` Xiang, Haihao [this message] 2023-07-26 7:15 ` [FFmpeg-devel] [PATCH 3/4] lavfi/vf_vpp_qsv: set color properties for output Xiang, Haihao 2023-07-26 7:15 ` [FFmpeg-devel] [PATCH 4/4] lavfi/vf_vpp_qsv: perform conversion from HDR to SDR Xiang, Haihao 2023-07-31 7:00 ` [FFmpeg-devel] [PATCH 1/4] lavfi/qsvvpp: add set_frame_ext_params callback Xiang, Haihao
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230726071522.38149-2-haihao.xiang@intel.com \ --to=haihao.xiang-at-intel.com@ffmpeg.org \ --cc=ffmpeg-devel@ffmpeg.org \ --cc=haihao.xiang@intel.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git