From: Wenbin Chen <wenbin.chen-at-intel.com@ffmpeg.org> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 3/3] libavcodec/qsvenc: Add pic_timing_sei reset support to qsv Date: Fri, 23 Sep 2022 10:44:12 +0800 Message-ID: <20220923024412.5671-3-wenbin.chen@intel.com> (raw) In-Reply-To: <20220923024412.5671-1-wenbin.chen@intel.com> Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> --- doc/encoders.texi | 4 ++++ libavcodec/qsvenc.c | 21 +++++++++++++++++++++ libavcodec/qsvenc.h | 2 ++ 3 files changed, 27 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 2b6412dbec..741d545ea1 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -3369,6 +3369,10 @@ Change this value to reset qsv codec's framerate configuration. @item @var{rc_initial_buffer_occupancy} @item @var{rc_max_rate} Change these value to reset qsv codec's bitrate control configuration. + +@item @var{pic_timing_sei} +Supported in h264_qsv and hevc_qsv. +Change this value to reset qsv codec's pic_timing_sei configuration. @end table @subsection H264 options diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 3371711872..c1a601f0b3 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -784,6 +784,7 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) q->extco.PicTimingSEI = q->pic_timing_sei ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_UNKNOWN; + q->old_pic_timing_sei = q->pic_timing_sei; if (q->rdo >= 0) q->extco.RateDistortionOpt = q->rdo > 0 ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; @@ -1900,6 +1901,25 @@ static int update_bitrate(AVCodecContext *avctx, QSVEncContext *q) return updated; } +static int update_pic_timing_sei(AVCodecContext *avctx, QSVEncContext *q) +{ + int updated = 0; + + if (avctx->codec_id != AV_CODEC_ID_H264 && avctx->codec_id != AV_CODEC_ID_HEVC) + return 0; + + UPDATE_PARAM(q->old_pic_timing_sei, q->pic_timing_sei); + if (!updated) + return 0; + + q->extco.PicTimingSEI = q->pic_timing_sei ? + MFX_CODINGOPTION_ON : MFX_CODINGOPTION_UNKNOWN; + av_log(avctx, AV_LOG_DEBUG, "Reset PicTimingSEI: %s\n", + print_threestate(q->extco.PicTimingSEI)); + + return updated; +} + static int update_parameters(AVCodecContext *avctx, QSVEncContext *q, const AVFrame *frame) { @@ -1915,6 +1935,7 @@ static int update_parameters(AVCodecContext *avctx, QSVEncContext *q, needReset |= update_low_delay_brc(avctx, q); needReset |= update_frame_rate(avctx, q); needReset |= update_bitrate(avctx, q); + needReset |= update_pic_timing_sei(avctx, q); ret = update_min_max_qp(avctx, q); if (ret < 0) return ret; diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h index 6e1132d2e3..486c996fc6 100644 --- a/libavcodec/qsvenc.h +++ b/libavcodec/qsvenc.h @@ -278,6 +278,8 @@ typedef struct QSVEncContext { int old_rc_buffer_size; int old_rc_initial_buffer_occupancy; int old_rc_max_rate; + // This is used for SEI Timing reset + int old_pic_timing_sei; } QSVEncContext; int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q); -- 2.32.0 _______________________________________________ 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-23 2:48 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-09-23 2:44 [FFmpeg-devel] [PATCH 1/3] libavcodec/qsvenc: Add framerate " Wenbin Chen 2022-09-23 2:44 ` [FFmpeg-devel] [PATCH 2/3] libavcodec/qsvenc: Add bitrate reset support to qsvenc Wenbin Chen 2022-09-23 2:44 ` Wenbin Chen [this message] 2022-09-27 4:15 ` [FFmpeg-devel] [PATCH 1/3] libavcodec/qsvenc: Add framerate reset support to qsv 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=20220923024412.5671-3-wenbin.chen@intel.com \ --to=wenbin.chen-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