From: "Xiang, Haihao" <haihao.xiang-at-intel.com@ffmpeg.org> To: "ffmpeg-devel@ffmpeg.org" <ffmpeg-devel@ffmpeg.org> Subject: Re: [FFmpeg-devel] [PATCH 2/6] libavcodec/qsvenc: Add gop_size reset support to qsvenc Date: Tue, 6 Sep 2022 01:53:15 +0000 Message-ID: <673108d98279a661fef6743e09f5c476522fd14e.camel@intel.com> (raw) In-Reply-To: <20220818065912.158693-2-wenbin.chen@intel.com> On Thu, 2022-08-18 at 14:59 +0800, Wenbin Chen wrote: > Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> > --- > doc/encoders.texi | 3 +++ > libavcodec/qsvenc.c | 18 +++++++++++++++++- > libavcodec/qsvenc.h | 2 ++ > 3 files changed, 22 insertions(+), 1 deletion(-) > > diff --git a/doc/encoders.texi b/doc/encoders.texi > index 69fa46f3ea..9fb63856b1 100644 > --- a/doc/encoders.texi > +++ b/doc/encoders.texi > @@ -3348,6 +3348,9 @@ Change these value to reset qsv codec's qp > configuration. > @item @var{max_frame_size} > Supported in h264_qsv and hevc_qsv. > Change this value to reset qsv codec's MaxFrameSize configuration. > + > +@item @var{gop_size} > +Change this value to reset qsv codec's gop configuration. > @end table > > @subsection H264 options > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c > index c911b81e7d..b3820e4fe0 100644 > --- a/libavcodec/qsvenc.c > +++ b/libavcodec/qsvenc.c > @@ -635,6 +635,7 @@ static int init_video_param(AVCodecContext *avctx, > QSVEncContext *q) > q->param.mfx.CodecProfile = q->profile; > q->param.mfx.TargetUsage = avctx->compression_level; > q->param.mfx.GopPicSize = FFMAX(0, avctx->gop_size); > + q->old_gop_size = avctx->gop_size; > q->param.mfx.GopRefDist = FFMAX(-1, avctx->max_b_frames) + 1; > q->param.mfx.GopOptFlag = avctx->flags & AV_CODEC_FLAG_CLOSED_GOP > ? > MFX_GOP_CLOSED : MFX_GOP_STRICT; > @@ -1692,16 +1693,31 @@ static int update_max_frame_size(AVCodecContext > *avctx, QSVEncContext *q) > return updated; > } > > +static int update_gop_size(AVCodecContext *avctx, QSVEncContext *q) > +{ > + int updated = 0; > + UPDATE_PARAM(q->old_gop_size, avctx->gop_size); > + if (!updated) > + return 0; > + > + q->param.mfx.GopPicSize = FFMAX(0, avctx->gop_size); > + av_log(avctx, AV_LOG_DEBUG, "reset GopPicSize to %d\n", > + q->param.mfx.GopPicSize); > + > + return updated; > +} > + > static int update_parameters(AVCodecContext *avctx, QSVEncContext *q, > const AVFrame *frame) > { > int needReset = 0, ret = 0; > > - if (!frame) > + if (!frame || avctx->codec_id == AV_CODEC_ID_MJPEG) > return 0; Better to fix mjpeg_qsv in a separate patch if mjpeg_qsv is not able to resetany parameter. Thanks Haihao > > needReset = update_qp(avctx, q); > needReset |= update_max_frame_size(avctx, q); > + needReset |= update_gop_size(avctx, q); > if (!needReset) > return 0; > > diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h > index c452c5b806..fdedae28dd 100644 > --- a/libavcodec/qsvenc.h > +++ b/libavcodec/qsvenc.h > @@ -237,6 +237,8 @@ typedef struct QSVEncContext { > float old_b_quant_offset; > // This is used for max_frame_size reset > int old_max_frame_size; > + // This is used for gop reset > + int old_gop_size; > } QSVEncContext; > > int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q); _______________________________________________ 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:[~2022-09-06 1:53 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-08-18 6:59 [FFmpeg-devel] [PATCH 1/6] libavcodec/qsvenc: Add max_frame_size reset support to qsv Wenbin Chen 2022-08-18 6:59 ` [FFmpeg-devel] [PATCH 2/6] libavcodec/qsvenc: Add gop_size reset support to qsvenc Wenbin Chen 2022-09-06 1:53 ` Xiang, Haihao [this message] 2022-09-06 8:44 ` Chen, Wenbin 2022-08-18 6:59 ` [FFmpeg-devel] [PATCH 3/6] libavcodec/qsvenc: Add "slice" intra refresh type " Wenbin Chen 2022-08-18 6:59 ` [FFmpeg-devel] [PATCH 4/6] libavcodec/qsvenc: Add intra refresh reset support " Wenbin Chen 2022-08-18 6:59 ` [FFmpeg-devel] [PATCH 5/6] libavcodec/qsvenc: Add max/min qp reset support in qsvenc Wenbin Chen 2022-08-18 6:59 ` [FFmpeg-devel] [PATCH 6/6] libavcodec/qsvenc: Add low_delay_brc reset support to qsvenc Wenbin Chen
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=673108d98279a661fef6743e09f5c476522fd14e.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