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 4/6] lavfi/qsvvpp: store a copy of the sequence parameters Date: Mon, 12 Jun 2023 16:14:46 +0800 Message-ID: <20230612081448.936570-4-haihao.xiang@intel.com> (raw) In-Reply-To: <20230612081448.936570-1-haihao.xiang@intel.com> From: Haihao Xiang <haihao.xiang@intel.com> We will postpone the vpp session initialization to when input and output frames are ready, this copy of the sequence parameters will be used to initialize vpp session. Signed-off-by: Haihao Xiang <haihao.xiang@intel.com> --- libavfilter/qsvvpp.c | 42 ++++++++++++++++++++++++++---------------- libavfilter/qsvvpp.h | 7 ++++++- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c index 8683a4f217..d168ab5d1d 100644 --- a/libavfilter/qsvvpp.c +++ b/libavfilter/qsvvpp.c @@ -767,28 +767,39 @@ int ff_qsvvpp_init(AVFilterContext *avctx, QSVVPPParam *param) goto failed; } + s->nb_seq_buffers = param->num_ext_buf; #if QSV_HAVE_OPAQUE - if (IS_OPAQUE_MEMORY(s->in_mem_mode) || IS_OPAQUE_MEMORY(s->out_mem_mode)) { - s->nb_ext_buffers = param->num_ext_buf + 1; + if (IS_OPAQUE_MEMORY(s->in_mem_mode) || IS_OPAQUE_MEMORY(s->out_mem_mode)) + s->nb_seq_buffers++; +#endif + + if (s->nb_seq_buffers) { + s->seq_buffers = av_calloc(s->nb_seq_buffers, sizeof(*s->seq_buffers)); + if (!s->seq_buffers) { + ret = AVERROR(ENOMEM); + goto failed; + } + + for (i = 0; i < param->num_ext_buf; i++) + s->seq_buffers[i] = param->ext_buf[i]; + +#if QSV_HAVE_OPAQUE + if (IS_OPAQUE_MEMORY(s->in_mem_mode) || IS_OPAQUE_MEMORY(s->out_mem_mode)) + s->seq_buffers[i] = (mfxExtBuffer *)&s->opaque_alloc; +#endif + + s->nb_ext_buffers = s->nb_seq_buffers; s->ext_buffers = av_calloc(s->nb_ext_buffers, sizeof(*s->ext_buffers)); if (!s->ext_buffers) { ret = AVERROR(ENOMEM); goto failed; } - s->ext_buffers[0] = (mfxExtBuffer *)&s->opaque_alloc; - for (i = 1; i < param->num_ext_buf; i++) - s->ext_buffers[i] = param->ext_buf[i - 1]; - s->vpp_param.ExtParam = s->ext_buffers; - s->vpp_param.NumExtParam = s->nb_ext_buffers; - } else { - s->vpp_param.NumExtParam = param->num_ext_buf; - s->vpp_param.ExtParam = param->ext_buf; + memcpy(s->ext_buffers, s->seq_buffers, s->nb_seq_buffers * sizeof(*s->seq_buffers)); } -#else - s->vpp_param.NumExtParam = param->num_ext_buf; - s->vpp_param.ExtParam = param->ext_buf; -#endif + + s->vpp_param.ExtParam = s->ext_buffers; + s->vpp_param.NumExtParam = s->nb_ext_buffers; s->got_frame = 0; @@ -861,9 +872,8 @@ int ff_qsvvpp_close(AVFilterContext *avctx) clear_frame_list(&s->out_frame_list); av_freep(&s->surface_ptrs_in); av_freep(&s->surface_ptrs_out); -#if QSV_HAVE_OPAQUE + av_freep(&s->seq_buffers); av_freep(&s->ext_buffers); -#endif av_freep(&s->frame_infos); av_fifo_freep2(&s->async_fifo); diff --git a/libavfilter/qsvvpp.h b/libavfilter/qsvvpp.h index 8851185ff3..073c89fe70 100644 --- a/libavfilter/qsvvpp.h +++ b/libavfilter/qsvvpp.h @@ -74,9 +74,14 @@ typedef struct QSVVPPContext { #if QSV_HAVE_OPAQUE /** MFXVPP extern parameters */ mfxExtOpaqueSurfaceAlloc opaque_alloc; +#endif + /** store sequence parameters */ + mfxExtBuffer **seq_buffers; + int nb_seq_buffers; + + /** store all parameters for vpp execution, including parameters per frame */ mfxExtBuffer **ext_buffers; int nb_ext_buffers; -#endif int got_frame; int async_depth; -- 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-06-12 8:16 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-06-12 8:14 [FFmpeg-devel] [PATCH 1/6] lavfi/qsvvpp: track the runtime version in vpp context Xiang, Haihao 2023-06-12 8:14 ` [FFmpeg-devel] [PATCH 2/6] lavfi/qsvvpp: copy metadata fields from src to dst Xiang, Haihao 2023-06-12 8:14 ` [FFmpeg-devel] [PATCH 3/6] lavfi/qsvvpp: check the parameters before initializing vpp session Xiang, Haihao 2023-06-12 8:14 ` Xiang, Haihao [this message] 2023-06-12 8:14 ` [FFmpeg-devel] [PATCH 5/6] lavfi/qsvvpp: postpone vpp session initialization Xiang, Haihao 2023-06-12 8:14 ` [FFmpeg-devel] [PATCH 6/6] lavfi/qsvvpp: use the right picture struct for vpp initilaization Xiang, Haihao 2023-06-19 4:46 ` [FFmpeg-devel] [PATCH 1/6] lavfi/qsvvpp: track the runtime version in vpp context Xiang, Haihao 2023-06-20 2:01 ` 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=20230612081448.936570-4-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