From: "Xiang, Haihao" <haihao.xiang-at-intel.com@ffmpeg.org> To: "ffmpeg-devel@ffmpeg.org" <ffmpeg-devel@ffmpeg.org> Subject: Re: [FFmpeg-devel] [PATCH 1/2] lavc/qsv: allow to add more parameter buffers to QSV frame Date: Wed, 29 Dec 2021 05:46:24 +0000 Message-ID: <33b7e661c5e50ca415f861288bead90695da3708.camel@intel.com> (raw) In-Reply-To: <20210323030007.590540-1-haihao.xiang@intel.com> On Tue, 2021-03-23 at 11:00 +0800, Haihao Xiang wrote: > --- > libavcodec/qsv.c | 27 +++++++++++++++++++++++++++ > libavcodec/qsv_internal.h | 8 +++++++- > libavcodec/qsvdec.c | 8 +++++--- > 3 files changed, 39 insertions(+), 4 deletions(-) > > diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c > index 6e3154e1a3..879e109092 100644 > --- a/libavcodec/qsv.c > +++ b/libavcodec/qsv.c > @@ -821,3 +821,30 @@ int ff_qsv_close_internal_session(QSVSession *qs) > #endif > return 0; > } > + > +void ff_qsv_frame_add_ext_param (AVCodecContext *avctx, QSVFrame *frame, > + mfxExtBuffer * param) > +{ > + int i; > + > + for (i = 0; i < frame->num_ext_params; i++) { > + mfxExtBuffer *ext_buffer = frame->ext_param[i]; > + > + if (ext_buffer->BufferId == param->BufferId) { > + av_log(avctx, AV_LOG_WARNING, "A buffer with the same type has > been " > + "added\n"); > + return; > + } > + } > + > + if (frame->num_ext_params < QSV_MAX_FRAME_EXT_PARAMS) { > + frame->ext_param[frame->num_ext_params] = param; > + frame->num_ext_params++; > + frame->surface.Data.NumExtParam = frame->num_ext_params; > + } else { > + av_log(avctx, AV_LOG_WARNING, "Ignore this extra buffer because do > not " > + "have enough space\n"); > + } > + > + > +} > diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h > index 6b2fbbe252..1d94d429e8 100644 > --- a/libavcodec/qsv_internal.h > +++ b/libavcodec/qsv_internal.h > @@ -52,6 +52,8 @@ > > #define QSV_MAX_ENC_PAYLOAD 2 // # of mfxEncodeCtrl payloads supported > > +#define QSV_MAX_FRAME_EXT_PARAMS 4 > + > #define QSV_VERSION_ATLEAST(MAJOR, MINOR) \ > (MFX_VERSION_MAJOR > (MAJOR) || \ > MFX_VERSION_MAJOR == (MAJOR) && MFX_VERSION_MINOR >= (MINOR)) > @@ -74,7 +76,8 @@ typedef struct QSVFrame { > mfxFrameSurface1 surface; > mfxEncodeCtrl enc_ctrl; > mfxExtDecodedFrameInfo dec_info; > - mfxExtBuffer *ext_param; > + mfxExtBuffer *ext_param[QSV_MAX_FRAME_EXT_PARAMS]; > + int num_ext_params; > > int queued; > int used; > @@ -142,4 +145,7 @@ int ff_qsv_init_session_frames(AVCodecContext *avctx, > mfxSession *session, > > int ff_qsv_find_surface_idx(QSVFramesContext *ctx, QSVFrame *frame); > > +void ff_qsv_frame_add_ext_param(AVCodecContext *avctx, QSVFrame *frame, > + mfxExtBuffer *param); > + > #endif /* AVCODEC_QSV_INTERNAL_H */ > diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c > index 5f2e641373..55cf9f35c5 100644 > --- a/libavcodec/qsvdec.c > +++ b/libavcodec/qsvdec.c > @@ -366,11 +366,13 @@ static int alloc_frame(AVCodecContext *avctx, QSVContext > *q, QSVFrame *frame) > > frame->surface.Data.MemId = &q->frames_ctx.mids[ret]; > } > - frame->surface.Data.ExtParam = &frame->ext_param; > - frame->surface.Data.NumExtParam = 1; > - frame->ext_param = (mfxExtBuffer*)&frame->dec_info; > + > + frame->surface.Data.ExtParam = frame->ext_param; > + frame->surface.Data.NumExtParam = 0; > + frame->num_ext_params = 0; > frame->dec_info.Header.BufferId = MFX_EXTBUFF_DECODED_FRAME_INFO; > frame->dec_info.Header.BufferSz = sizeof(frame->dec_info); > + ff_qsv_frame_add_ext_param(avctx, frame, (mfxExtBuffer *)&frame- > >dec_info); > > frame->used = 1; Will apply if no objection, -Haihao > _______________________________________________ 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".
parent reply other threads:[~2021-12-29 5:46 UTC|newest] Thread overview: expand[flat|nested] mbox.gz Atom feed [parent not found: <20210323030007.590540-1-haihao.xiang@intel.com>]
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=33b7e661c5e50ca415f861288bead90695da3708.camel@intel.com \ --to=haihao.xiang-at-intel.com@ffmpeg.org \ --cc=ffmpeg-devel@ffmpeg.org \ /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