[FFmpeg-cvslog] avcodec/flac_parser: add missed opportunity to check crc
ffmpeg | branch: master | Paul B Mahol | Mon Sep 5 20:16:13 2022 +0200| [0912e79376601f5620e29e448086515760982909] | committer: Paul B Mahol avcodec/flac_parser: add missed opportunity to check crc Fixes #9621 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0912e79376601f5620e29e448086515760982909 --- libavcodec/flac_parser.c | 18 -- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c index 11cd5540cf..5b3a4e6e67 100644 --- a/libavcodec/flac_parser.c +++ b/libavcodec/flac_parser.c @@ -455,7 +455,7 @@ static int check_header_mismatch(FLACParseContext *fpc, intlog_level_offset) { FLACFrameInfo *header_fi = &header->fi, *child_fi = &child->fi; -int deduction, deduction_expected = 0, i; +int check_crc, deduction, deduction_expected = 0, i; deduction = check_header_fi_mismatch(fpc, header_fi, child_fi, log_level_offset); /* Check sample and frame numbers. */ @@ -491,8 +491,22 @@ static int check_header_mismatch(FLACParseContext *fpc, "sample/frame number mismatch in adjacent frames\n"); } +if (fpc->last_fi.is_var_size == header_fi->is_var_size) { +if (fpc->last_fi.is_var_size && +fpc->last_fi.frame_or_sample_num + fpc->last_fi.blocksize == header_fi->frame_or_sample_num) { +check_crc = 0; +} else if (!fpc->last_fi.is_var_size && + fpc->last_fi.frame_or_sample_num + 1 == header_fi->frame_or_sample_num) { +check_crc = 0; +} else { +check_crc = !deduction && !deduction_expected; +} +} else { +check_crc = !deduction && !deduction_expected; +} + /* If we have suspicious headers, check the CRC between them */ -if (deduction && !deduction_expected) { +if (check_crc || (deduction && !deduction_expected)) { FLACHeaderMarker *curr; int read_len; uint8_t *buf; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/flac_parser: ensure there are more headers for scoring
ffmpeg | branch: master | Paul B Mahol | Mon Sep 5 18:12:10 2022 +0200| [5ca781598e1a7c24aec7ebada16e8ad8c5725a41] | committer: Paul B Mahol avcodec/flac_parser: ensure there are more headers for scoring Previously invalid frame may be returned, happened when seeking. Fixes #7684 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5ca781598e1a7c24aec7ebada16e8ad8c5725a41 --- libavcodec/flac_parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c index a1d9cd7f29..11cd5540cf 100644 --- a/libavcodec/flac_parser.c +++ b/libavcodec/flac_parser.c @@ -600,7 +600,7 @@ static int score_header(FLACParseContext *fpc, FLACHeaderMarker *header) static void score_sequences(FLACParseContext *fpc) { FLACHeaderMarker *curr; -int best_score = 0;//FLAC_HEADER_NOT_SCORED_YET; +int best_score = FLAC_HEADER_NOT_SCORED_YET; /* First pass to clear all old scores. */ for (curr = fpc->headers; curr; curr = curr->next) curr->max_score = FLAC_HEADER_NOT_SCORED_YET; @@ -682,7 +682,7 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx, } fpc->avctx = avctx; -if (fpc->best_header_valid) +if (fpc->best_header_valid && fpc->nb_headers_buffered >= FLAC_MIN_HEADERS) return get_best_header(fpc, poutbuf, poutbuf_size); /* If a best_header was found last call remove it with the buffer data. */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] swscale/input: Remove spec-incompliant ';'
ffmpeg | branch: master | Andreas Rheinhardt | Thu Sep 8 01:43:01 2022 +0200| [d2428d80ce4b791587a53cdb4828a84d077384f2] | committer: Andreas Rheinhardt swscale/input: Remove spec-incompliant ';' These macros are definitions, not only declarations and therefore should not contain a semicolon. Such a semicolon is actually spec-incompliant, but compilers happen to accept them. Reviewed-by: Philip Langdale Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d2428d80ce4b791587a53cdb4828a84d077384f2 --- libswscale/input.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libswscale/input.c b/libswscale/input.c index be8f3940e1..88e318e664 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -583,8 +583,8 @@ static void yvy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, con AV_WN16(dst + i * 2, AV_RL16(src + i * 4) >> shift); \ } -y21xle_wrapper(10, 6); -y21xle_wrapper(12, 4); +y21xle_wrapper(10, 6) +y21xle_wrapper(12, 4) static void bswap16Y_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused, void *opq) @@ -828,9 +828,9 @@ static void nv21ToUV_c(uint8_t *dstU, uint8_t *dstV, }\ p01x_uv_wrapper(bits, shift) -p01x_wrapper(10, 6); -p01x_wrapper(12, 4); -p01x_uv_wrapper(16, 0); +p01x_wrapper(10, 6) +p01x_wrapper(12, 4) +p01x_uv_wrapper(16, 0) #define input_pixel(pos) (isBE(origin) ? AV_RB16(pos) : AV_RL16(pos)) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/vf_showinfo: remove backspaces
ffmpeg | branch: master | Michael Niedermayer | Thu Jul 21 20:15:06 2022 +0200| [31581ae7ee6d007f2f2dcd16de5df991ba7aa1b6] | committer: Michael Niedermayer avfilter/vf_showinfo: remove backspaces They mess with storing editing and comparing the results Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=31581ae7ee6d007f2f2dcd16de5df991ba7aa1b6 --- libavfilter/vf_showinfo.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c index 2c8514fc80..9b4a9fc981 100644 --- a/libavfilter/vf_showinfo.c +++ b/libavfilter/vf_showinfo.c @@ -733,12 +733,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) av_log(ctx, AV_LOG_INFO, " %08"PRIX32, plane_checksum[plane]); av_log(ctx, AV_LOG_INFO, "] mean:["); for (plane = 0; plane < 4 && frame->data[plane] && frame->linesize[plane]; plane++) -av_log(ctx, AV_LOG_INFO, "%"PRId64" ", (sum[plane] + pixelcount[plane]/2) / pixelcount[plane]); -av_log(ctx, AV_LOG_INFO, "\b] stdev:["); +av_log(ctx, AV_LOG_INFO, "%s%"PRId64, + plane ? " ":"", + (sum[plane] + pixelcount[plane]/2) / pixelcount[plane]); +av_log(ctx, AV_LOG_INFO, "] stdev:["); for (plane = 0; plane < 4 && frame->data[plane] && frame->linesize[plane]; plane++) -av_log(ctx, AV_LOG_INFO, "%3.1f ", +av_log(ctx, AV_LOG_INFO, "%s%3.1f", + plane ? " ":"", sqrt((sum2[plane] - sum[plane]*(double)sum[plane]/pixelcount[plane])/pixelcount[plane])); -av_log(ctx, AV_LOG_INFO, "\b]"); +av_log(ctx, AV_LOG_INFO, "]"); } av_log(ctx, AV_LOG_INFO, "\n"); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/vf_scale: overwrite the width and height expressions with the original values
ffmpeg | branch: release/5.0 | James Almer | Sun Sep 4 23:43:04 2022 -0300| [068faf4f74ec51f0717a8cf5d11341dbfa807b78] | committer: James Almer avfilter/vf_scale: overwrite the width and height expressions with the original values Instead of the potentially adjusted ones. Otherwise, if config_props() is called again and if using force_original_aspect_ratio, the already adjusted values could be altered again. Example command line scale=size=1920x1000:force_original_aspect_ratio=decrease:force_divisible_by=2 user value 1920x1000 -> 1920x798 on init_dict() -> 1918x798 on frame change when eval_mode == EVAL_MODE_INIT, which after e645a1ddb9 could be at the very first frame. Signed-off-by: James Almer (cherry picked from commit d9e3cb7e73c77ccddc4d29ed5c1be3920f72c226) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=068faf4f74ec51f0717a8cf5d11341dbfa807b78 --- libavfilter/vf_scale.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index 44f85cb019..542b000730 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -488,19 +488,19 @@ static int config_props(AVFilterLink *outlink) if ((ret = scale_eval_dimensions(ctx)) < 0) goto fail; -ff_scale_adjust_dimensions(inlink, &scale->w, &scale->h, +outlink->w = scale->w; +outlink->h = scale->h; + +ff_scale_adjust_dimensions(inlink, &outlink->w, &outlink->h, scale->force_original_aspect_ratio, scale->force_divisible_by); -if (scale->w > INT_MAX || -scale->h > INT_MAX || -(scale->h * inlink->w) > INT_MAX || -(scale->w * inlink->h) > INT_MAX) +if (outlink->w > INT_MAX || +outlink->h > INT_MAX || +(outlink->h * inlink->w) > INT_MAX || +(outlink->w * inlink->h) > INT_MAX) av_log(ctx, AV_LOG_ERROR, "Rescaled value for width or height is too big.\n"); -outlink->w = scale->w; -outlink->h = scale->h; - /* TODO: make algorithm configurable */ scale->input_is_pal = desc->flags & AV_PIX_FMT_FLAG_PAL; @@ -705,9 +705,9 @@ static int scale_frame(AVFilterLink *link, AVFrame *in, AVFrame **frame_out) goto scale; if (scale->eval_mode == EVAL_MODE_INIT) { -snprintf(buf, sizeof(buf)-1, "%d", outlink->w); +snprintf(buf, sizeof(buf) - 1, "%d", scale->w); av_opt_set(scale, "w", buf, 0); -snprintf(buf, sizeof(buf)-1, "%d", outlink->h); +snprintf(buf, sizeof(buf) - 1, "%d", scale->h); av_opt_set(scale, "h", buf, 0); ret = scale_parse_expr(ctx, NULL, &scale->w_pexpr, "width", scale->w_expr); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/vf_scale: overwrite the width and height expressions with the original values
ffmpeg | branch: release/4.4 | James Almer | Sun Sep 4 23:43:04 2022 -0300| [944ee75106bea8fa843589f88d6728f568593195] | committer: James Almer avfilter/vf_scale: overwrite the width and height expressions with the original values Instead of the potentially adjusted ones. Otherwise, if config_props() is called again and if using force_original_aspect_ratio, the already adjusted values could be altered again. Example command line scale=size=1920x1000:force_original_aspect_ratio=decrease:force_divisible_by=2 user value 1920x1000 -> 1920x798 on init_dict() -> 1918x798 on frame change when eval_mode == EVAL_MODE_INIT, which after e645a1ddb9 could be at the very first frame. Signed-off-by: James Almer (cherry picked from commit d9e3cb7e73c77ccddc4d29ed5c1be3920f72c226) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=944ee75106bea8fa843589f88d6728f568593195 --- libavfilter/vf_scale.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index 3ca6ba2368..788e4bab5a 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -493,19 +493,19 @@ static int config_props(AVFilterLink *outlink) if ((ret = scale_eval_dimensions(ctx)) < 0) goto fail; -ff_scale_adjust_dimensions(inlink, &scale->w, &scale->h, +outlink->w = scale->w; +outlink->h = scale->h; + +ff_scale_adjust_dimensions(inlink, &outlink->w, &outlink->h, scale->force_original_aspect_ratio, scale->force_divisible_by); -if (scale->w > INT_MAX || -scale->h > INT_MAX || -(scale->h * inlink->w) > INT_MAX || -(scale->w * inlink->h) > INT_MAX) +if (outlink->w > INT_MAX || +outlink->h > INT_MAX || +(outlink->h * inlink->w) > INT_MAX || +(outlink->w * inlink->h) > INT_MAX) av_log(ctx, AV_LOG_ERROR, "Rescaled value for width or height is too big.\n"); -outlink->w = scale->w; -outlink->h = scale->h; - /* TODO: make algorithm configurable */ scale->input_is_pal = desc->flags & AV_PIX_FMT_FLAG_PAL; @@ -684,9 +684,9 @@ static int scale_frame(AVFilterLink *link, AVFrame *in, AVFrame **frame_out) goto scale; if (scale->eval_mode == EVAL_MODE_INIT) { -snprintf(buf, sizeof(buf)-1, "%d", outlink->w); +snprintf(buf, sizeof(buf) - 1, "%d", scale->w); av_opt_set(scale, "w", buf, 0); -snprintf(buf, sizeof(buf)-1, "%d", outlink->h); +snprintf(buf, sizeof(buf) - 1, "%d", scale->h); av_opt_set(scale, "h", buf, 0); ret = scale_parse_expr(ctx, NULL, &scale->w_pexpr, "width", scale->w_expr); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/mov: don't read duration from mvhd atom
ffmpeg | branch: master | James Almer | Mon Aug 15 20:14:42 2022 -0300| [836b8001c924deb9263b0f5b7c74ccfaab1f4fdc] | committer: James Almer avformat/mov: don't read duration from mvhd atom This duration is equal to the longest duration in all track's tkhd atoms, which may be comprised of the sum of all edit lists in each track. Empty edit lists in tracks represent start_time, and the actual media duration is stored in the mdhd atom. This change lets the generic demux code derive the longest track duration taken from mdhd atoms, so the correct duration and start_time combination will be reported. Should fix ticket #9775. Reviewed-by: zhilizhao(赵志立) Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=836b8001c924deb9263b0f5b7c74ccfaab1f4fdc --- libavformat/mov.c| 4 tests/ref/fate/gaplessenc-itunes-to-ipod-aac | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index a1bc627991..720a72f3ec 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1520,10 +1520,6 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) av_log(c->fc, AV_LOG_TRACE, "time scale = %i\n", c->time_scale); c->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration */ -// set the AVFormatContext duration because the duration of individual tracks -// may be inaccurate -if (!c->trex_data) -c->fc->duration = av_rescale(c->duration, AV_TIME_BASE, c->time_scale); avio_rb32(pb); /* preferred scale */ avio_rb16(pb); /* preferred volume */ diff --git a/tests/ref/fate/gaplessenc-itunes-to-ipod-aac b/tests/ref/fate/gaplessenc-itunes-to-ipod-aac index f967ac05bc..1f89e9af85 100644 --- a/tests/ref/fate/gaplessenc-itunes-to-ipod-aac +++ b/tests/ref/fate/gaplessenc-itunes-to-ipod-aac @@ -5,7 +5,7 @@ duration_ts=103326 [/STREAM] [FORMAT] start_time=0.00 -duration=2.344000 +duration=2.342993 [/FORMAT] packet|pts=-1024|dts=-1024|duration=1024|flags=KD|side_data| ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] libavcodec/qsvenc: Add max_frame_size reset support to qsv
ffmpeg | branch: master | Wenbin Chen | Tue Sep 6 17:22:53 2022 +0800| [c679de9be0d76e4eadc42f68421a569ff304c3e6] | committer: Haihao Xiang libavcodec/qsvenc: Add max_frame_size reset support to qsv Signed-off-by: Wenbin Chen > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c679de9be0d76e4eadc42f68421a569ff304c3e6 --- doc/encoders.texi | 4 libavcodec/qsvenc.c | 20 libavcodec/qsvenc.h | 2 ++ 3 files changed, 26 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index d2046e437d..e619827c90 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -3331,6 +3331,10 @@ Following options can be used durning qsv encoding. @item @var{b_quant_offset} Supported in h264_qsv and hevc_qsv. 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. @end table @subsection H264 options diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 941a12ffbd..b1f49e95fa 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -827,6 +827,7 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) q->extco2.ExtBRC = q->extbrc ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; if (q->max_frame_size >= 0) q->extco2.MaxFrameSize = q->max_frame_size; +q->old_max_frame_size = q->max_frame_size; if (q->int_ref_type >= 0) q->extco2.IntRefType = q->int_ref_type; if (q->int_ref_cycle_size >= 0) @@ -1678,6 +1679,24 @@ static int update_qp(AVCodecContext *avctx, QSVEncContext *q) return updated; } +static int update_max_frame_size(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_max_frame_size, q->max_frame_size); +if (!updated) +return 0; + +q->extco2.MaxFrameSize = FFMAX(0, q->max_frame_size); +av_log(avctx, AV_LOG_DEBUG, + "Reset MaxFrameSize: %d;\n", q->extco2.MaxFrameSize); + +return updated; +} + static int update_parameters(AVCodecContext *avctx, QSVEncContext *q, const AVFrame *frame) { @@ -1687,6 +1706,7 @@ static int update_parameters(AVCodecContext *avctx, QSVEncContext *q, return 0; needReset = update_qp(avctx, q); +needReset |= update_max_frame_size(avctx, q); if (!needReset) return 0; diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h index ff859f2a7e..9914351de4 100644 --- a/libavcodec/qsvenc.h +++ b/libavcodec/qsvenc.h @@ -251,6 +251,8 @@ typedef struct QSVEncContext { float old_i_quant_offset; float old_b_quant_factor; float old_b_quant_offset; +// This is used for max_frame_size reset +int old_max_frame_size; } QSVEncContext; int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] libavcodec/qsvenc: skip parameter resetting on mjpeg_qsv
ffmpeg | branch: master | Wenbin Chen | Tue Sep 6 17:22:52 2022 +0800| [04e491cdf4a67e6533dc8ae29a8de1ba6837] | committer: Haihao Xiang libavcodec/qsvenc: skip parameter resetting on mjpeg_qsv mjpeg_qsv don't support dynamic resetting, so skip it. Signed-off-by: Wenbin Chen > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=04e491cdf4a67e6533dc8ae29a8de1ba6837 --- libavcodec/qsvenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 31ff3b76ed..941a12ffbd 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -1683,7 +1683,7 @@ static int update_parameters(AVCodecContext *avctx, QSVEncContext *q, { int needReset = 0, ret = 0; -if (!frame) +if (!frame || avctx->codec_id == AV_CODEC_ID_MJPEG) return 0; needReset = update_qp(avctx, q); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] libavcodec/qsvenc: Add gop_size reset support to qsvenc
ffmpeg | branch: master | Wenbin Chen | Tue Sep 6 17:22:54 2022 +0800| [d60f657a50773ae8371585539bf484aa072bfc71] | committer: Haihao Xiang libavcodec/qsvenc: Add gop_size reset support to qsvenc Signed-off-by: Wenbin Chen > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d60f657a50773ae8371585539bf484aa072bfc71 --- doc/encoders.texi | 3 +++ libavcodec/qsvenc.c | 16 libavcodec/qsvenc.h | 2 ++ 3 files changed, 21 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index e619827c90..51178c9f5c 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -3335,6 +3335,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 b1f49e95fa..58b6284b30 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -639,6 +639,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; @@ -1697,6 +1698,20 @@ 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) { @@ -1707,6 +1722,7 @@ static int update_parameters(AVCodecContext *avctx, QSVEncContext *q, 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 9914351de4..ead790fd2c 100644 --- a/libavcodec/qsvenc.h +++ b/libavcodec/qsvenc.h @@ -253,6 +253,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-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] libavcodec/qsvenc: Add "slice" intra refresh type to qsvenc
ffmpeg | branch: master | Wenbin Chen | Tue Sep 6 17:22:55 2022 +0800| [f3ba1458b6787484978e9a8f1560dcabfefba92d] | committer: Haihao Xiang libavcodec/qsvenc: Add "slice" intra refresh type to qsvenc Add "slice" intra refresh type to h264_qsv and hevc_qsv. This type means horizontal refresh by slices without overlapping. Also update the doc. Signed-off-by: Wenbin Chen > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f3ba1458b6787484978e9a8f1560dcabfefba92d --- doc/encoders.texi| 12 libavcodec/qsvenc_h264.c | 1 + libavcodec/qsvenc_hevc.c | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/encoders.texi b/doc/encoders.texi index 51178c9f5c..333a47d2a7 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -3441,8 +3441,10 @@ Specifies intra refresh type. The major goal of intra refresh is improvement of error resilience without significant impact on encoded bitstream size caused by I frames. The SDK encoder achieves this by encoding part of each frame in refresh cycle using intra MBs. @var{none} means no refresh. @var{vertical} means -vertical refresh, by column of MBs. To enable intra refresh, B frame should be -set to 0. +vertical refresh, by column of MBs. @var{horizontal} means horizontal refresh, +by rows of MBs. @var{slice} means horizontal refresh by slices without +overlapping. In case of @var{slice}, in_ref_cycle_size is ignored. To enable +intra refresh, B frame should be set to 0. @item @var{int_ref_cycle_size} Specifies number of pictures within refresh cycle starting from 2. 0 and 1 are @@ -3641,8 +3643,10 @@ Specifies intra refresh type. The major goal of intra refresh is improvement of error resilience without significant impact on encoded bitstream size caused by I frames. The SDK encoder achieves this by encoding part of each frame in refresh cycle using intra MBs. @var{none} means no refresh. @var{vertical} means -vertical refresh, by column of MBs. To enable intra refresh, B frame should be -set to 0. +vertical refresh, by column of MBs. @var{horizontal} means horizontal refresh, +by rows of MBs. @var{slice} means horizontal refresh by slices without +overlapping. In case of @var{slice}, in_ref_cycle_size is ignored. To enable +intra refresh, B frame should be set to 0. @item @var{int_ref_cycle_size} Specifies number of pictures within refresh cycle starting from 2. 0 and 1 are diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c index 3fae8f0200..85826ae4be 100644 --- a/libavcodec/qsvenc_h264.c +++ b/libavcodec/qsvenc_h264.c @@ -140,6 +140,7 @@ static const AVOption options[] = { { "none", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, .flags = VE, "int_ref_type" }, { "vertical", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, .flags = VE, "int_ref_type" }, { "horizontal", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, .flags = VE, "int_ref_type" }, +{ "slice" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 3 }, .flags = VE, "int_ref_type" }, { "int_ref_cycle_size", "Number of frames in the intra refresh cycle", OFFSET(qsv.int_ref_cycle_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, UINT16_MAX, VE }, { "int_ref_qp_delta", "QP difference for the refresh MBs", OFFSET(qsv.int_ref_qp_delta),AV_OPT_TYPE_INT, { .i64 = INT16_MIN }, INT16_MIN, INT16_MAX, VE }, { "recovery_point_sei", "Insert recovery point SEI messages", OFFSET(qsv.recovery_point_sei), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c index 45b373d643..6ec6230999 100644 --- a/libavcodec/qsvenc_hevc.c +++ b/libavcodec/qsvenc_hevc.c @@ -271,6 +271,7 @@ static const AVOption options[] = { { "none", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, .flags = VE, "int_ref_type" }, { "vertical", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, .flags = VE, "int_ref_type" }, { "horizontal", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, .flags = VE, "int_ref_type" }, +{ "slice" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 3 }, .flags = VE, "int_ref_type" }, { "int_ref_cycle_size", "Number of frames in the intra refresh cycle", OFFSET(qsv.int_ref_cycle_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, UINT16_MAX, VE }, { "int_ref_qp_delta", "QP difference for the refresh MBs", OFFSET(qsv.int_ref_qp_delta),AV_OPT_TYPE_INT, { .i64 = INT16_MIN }, INT16_MIN, INT16_MAX, VE }, { "int_ref_cycle_dist", "Distance between the beginnings of the intra-refresh cycles in frames", OFFSET(qsv.int_ref_cycle_dist), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT16_MAX, VE }, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog
[FFmpeg-cvslog] libavcodec/qsvenc: Add intra refresh reset support to qsvenc
ffmpeg | branch: master | Wenbin Chen | Tue Sep 6 17:22:56 2022 +0800| [9155ec096b0076bf5090c22c8c2f0f67bd8ee086] | committer: Haihao Xiang libavcodec/qsvenc: Add intra refresh reset support to qsvenc Signed-off-by: Wenbin Chen > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9155ec096b0076bf5090c22c8c2f0f67bd8ee086 --- doc/encoders.texi | 7 +++ libavcodec/qsvenc.c | 33 + libavcodec/qsvenc.h | 5 + 3 files changed, 45 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 333a47d2a7..f2fef0deab 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -3338,6 +3338,13 @@ Change this value to reset qsv codec's MaxFrameSize configuration. @item @var{gop_size} Change this value to reset qsv codec's gop configuration. + +@item @var{int_ref_type} +@item @var{int_ref_cycle_size} +@item @var{int_ref_qp_delta} +@item @var{int_ref_cycle_dist} +Supported in h264_qsv and hevc_qsv. +Change these value to reset qsv codec's Intra Refresh configuration. @end table @subsection H264 options diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 58b6284b30..4ed73e7817 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -831,10 +831,13 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) q->old_max_frame_size = q->max_frame_size; if (q->int_ref_type >= 0) q->extco2.IntRefType = q->int_ref_type; +q->old_int_ref_type = q->int_ref_type; if (q->int_ref_cycle_size >= 0) q->extco2.IntRefCycleSize = q->int_ref_cycle_size; +q->old_int_ref_cycle_size = q->int_ref_cycle_size; if (q->int_ref_qp_delta != INT16_MIN) q->extco2.IntRefQPDelta = q->int_ref_qp_delta; +q->old_int_ref_qp_delta = q->int_ref_qp_delta; if (q->max_slice_size >= 0) q->extco2.MaxSliceSize = q->max_slice_size; q->extco2.DisableDeblockingIdc = q->dblk_idc; @@ -923,6 +926,7 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) } if (q->int_ref_cycle_dist >= 0) q->extco3.IntRefCycleDist = q->int_ref_cycle_dist; +q->old_int_ref_cycle_dist = q->int_ref_cycle_dist; if (q->low_delay_brc >= 0) q->extco3.LowDelayBRC = q->low_delay_brc ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; if (q->max_frame_size_i >= 0) @@ -1712,6 +1716,34 @@ static int update_gop_size(AVCodecContext *avctx, QSVEncContext *q) return updated; } +static int update_rir(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_int_ref_type, q->int_ref_type); +UPDATE_PARAM(q->old_int_ref_cycle_size, q->int_ref_cycle_size); +UPDATE_PARAM(q->old_int_ref_qp_delta, q->int_ref_qp_delta); +UPDATE_PARAM(q->old_int_ref_cycle_dist, q->int_ref_cycle_dist); +if (!updated) +return 0; + +q->extco2.IntRefType = FFMAX(0, q->int_ref_type); +q->extco2.IntRefCycleSize = FFMAX(0, q->int_ref_cycle_size); +q->extco2.IntRefQPDelta = +q->int_ref_qp_delta != INT16_MIN ? q->int_ref_qp_delta : 0; +q->extco3.IntRefCycleDist = FFMAX(0, q->int_ref_cycle_dist); +av_log(avctx, AV_LOG_DEBUG, + "Reset IntRefType: %d; IntRefCycleSize: %d; " + "IntRefQPDelta: %d; IntRefCycleDist: %d\n", + q->extco2.IntRefType, q->extco2.IntRefCycleSize, + q->extco2.IntRefQPDelta, q->extco3.IntRefCycleDist); + +return updated; +} + static int update_parameters(AVCodecContext *avctx, QSVEncContext *q, const AVFrame *frame) { @@ -1723,6 +1755,7 @@ static int update_parameters(AVCodecContext *avctx, QSVEncContext *q, needReset = update_qp(avctx, q); needReset |= update_max_frame_size(avctx, q); needReset |= update_gop_size(avctx, q); +needReset |= update_rir(avctx, q); if (!needReset) return 0; diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h index ead790fd2c..3ec8608e67 100644 --- a/libavcodec/qsvenc.h +++ b/libavcodec/qsvenc.h @@ -255,6 +255,11 @@ typedef struct QSVEncContext { int old_max_frame_size; // This is used for gop reset int old_gop_size; +// These are used for intra refresh reset +int old_int_ref_type; +int old_int_ref_cycle_size; +int old_int_ref_qp_delta; +int old_int_ref_cycle_dist; } QSVEncContext; int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] libavcodec/qsvenc: Add max/min qp reset support in qsvenc
ffmpeg | branch: master | Wenbin Chen | Tue Sep 6 17:22:57 2022 +0800| [005c7a4f61ef047726270b59c08742f9ce6f7182] | committer: Haihao Xiang libavcodec/qsvenc: Add max/min qp reset support in qsvenc Signed-off-by: Wenbin Chen > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=005c7a4f61ef047726270b59c08742f9ce6f7182 --- doc/encoders.texi | 11 libavcodec/qsvenc.c | 78 + libavcodec/qsvenc.h | 9 +++ 3 files changed, 98 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index f2fef0deab..d17e3a074b 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -3345,6 +3345,17 @@ Change this value to reset qsv codec's gop configuration. @item @var{int_ref_cycle_dist} Supported in h264_qsv and hevc_qsv. Change these value to reset qsv codec's Intra Refresh configuration. + +@item @var{qmax} +@item @var{qmin} +@item @var{max_qp_i} +@item @var{min_qp_i} +@item @var{max_qp_p} +@item @var{min_qp_p} +@item @var{max_qp_b} +@item @var{min_qp_b} +Supported in h264_qsv. +Change these value to reset qsv codec's max/min qp configuration. @end table @subsection H264 options diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 4ed73e7817..3be19e04f4 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -861,22 +861,30 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) q->extco2.MinQPI = avctx->qmin > 51 ? 51 : avctx->qmin; q->extco2.MinQPP = q->extco2.MinQPB = q->extco2.MinQPI; } +q->old_qmin = avctx->qmin; if (avctx->qmax >= 0) { q->extco2.MaxQPI = avctx->qmax > 51 ? 51 : avctx->qmax; q->extco2.MaxQPP = q->extco2.MaxQPB = q->extco2.MaxQPI; } +q->old_qmax = avctx->qmax; if (q->min_qp_i >= 0) q->extco2.MinQPI = q->min_qp_i > 51 ? 51 : q->min_qp_i; +q->old_min_qp_i = q->min_qp_i; if (q->max_qp_i >= 0) q->extco2.MaxQPI = q->max_qp_i > 51 ? 51 : q->max_qp_i; +q->old_max_qp_i = q->max_qp_i; if (q->min_qp_p >= 0) q->extco2.MinQPP = q->min_qp_p > 51 ? 51 : q->min_qp_p; +q->old_min_qp_p = q->min_qp_p; if (q->max_qp_p >= 0) q->extco2.MaxQPP = q->max_qp_p > 51 ? 51 : q->max_qp_p; +q->old_max_qp_p = q->max_qp_p; if (q->min_qp_b >= 0) q->extco2.MinQPB = q->min_qp_b > 51 ? 51 : q->min_qp_b; +q->old_min_qp_b = q->min_qp_b; if (q->max_qp_b >= 0) q->extco2.MaxQPB = q->max_qp_b > 51 ? 51 : q->max_qp_b; +q->old_max_qp_b = q->max_qp_b; if (q->mbbrc >= 0) q->extco2.MBBRC = q->mbbrc ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; @@ -1744,6 +1752,71 @@ static int update_rir(AVCodecContext *avctx, QSVEncContext *q) return updated; } +static int update_min_max_qp(AVCodecContext *avctx, QSVEncContext *q) +{ +int updated = 0; + +if (avctx->codec_id != AV_CODEC_ID_H264) +return 0; + +UPDATE_PARAM(q->old_qmax, avctx->qmin); +UPDATE_PARAM(q->old_qmax, avctx->qmin); +UPDATE_PARAM(q->old_min_qp_i, q->min_qp_i); +UPDATE_PARAM(q->old_max_qp_i, q->max_qp_i); +UPDATE_PARAM(q->old_min_qp_p, q->min_qp_p); +UPDATE_PARAM(q->old_max_qp_p, q->max_qp_p); +UPDATE_PARAM(q->old_min_qp_b, q->min_qp_b); +UPDATE_PARAM(q->old_max_qp_b, q->max_qp_b); +if (!updated) +return 0; + +if ((avctx->qmin >= 0 && avctx->qmax >= 0 && avctx->qmin > avctx->qmax) || +(q->max_qp_i >= 0 && q->min_qp_i >= 0 && q->min_qp_i > q->max_qp_i) || +(q->max_qp_p >= 0 && q->min_qp_p >= 0 && q->min_qp_p > q->max_qp_p) || +(q->max_qp_b >= 0 && q->min_qp_b >= 0 && q->min_qp_b > q->max_qp_b)) { +av_log(avctx, AV_LOG_ERROR, +"qmin and or qmax are set but invalid," +" please make sure min <= max\n"); +return AVERROR(EINVAL); +} + +q->extco2.MinQPI = 0; +q->extco2.MaxQPI = 0; +q->extco2.MinQPP = 0; +q->extco2.MaxQPP = 0; +q->extco2.MinQPB = 0; +q->extco2.MaxQPB = 0; +if (avctx->qmin >= 0) { +q->extco2.MinQPI = avctx->qmin > 51 ? 51 : avctx->qmin; +q->extco2.MinQPB = q->extco2.MinQPP = q->extco2.MinQPI; +} +if (avctx->qmax >= 0) { +q->extco2.MaxQPI = avctx->qmax > 51 ? 51 : avctx->qmax; +q->extco2.MaxQPB = q->extco2.MaxQPP = q->extco2.MaxQPI; +} +if (q->min_qp_i >= 0) +q->extco2.MinQPI = q->min_qp_i > 51 ? 51 : q->min_qp_i; +if (q->max_qp_i >= 0) +q->extco2.MaxQPI = q->max_qp_i > 51 ? 51 : q->max_qp_i; +if (q->min_qp_p >= 0) +q->extco2.MinQPP = q->min_qp_p > 51 ? 51 : q->min_qp_p; +if (q->max_qp_p >= 0) +q->extco2.MaxQPP = q->max_qp_p > 51 ? 51 : q->max_qp_p; +if (q->min_qp_b >= 0) +
[FFmpeg-cvslog] libavcodec/qsvenc: Add low_delay_brc reset support to qsvenc
ffmpeg | branch: master | Wenbin Chen | Tue Sep 6 17:22:58 2022 +0800| [a2fd553dd3079601249e56f6aa1a6fe711d0663c] | committer: Haihao Xiang libavcodec/qsvenc: Add low_delay_brc reset support to qsvenc Signed-off-by: Wenbin Chen > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a2fd553dd3079601249e56f6aa1a6fe711d0663c --- doc/encoders.texi | 4 libavcodec/qsvenc.c | 23 ++- libavcodec/qsvenc.h | 2 ++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/doc/encoders.texi b/doc/encoders.texi index d17e3a074b..ac71f50ad2 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -3356,6 +3356,10 @@ Change these value to reset qsv codec's Intra Refresh configuration. @item @var{min_qp_b} Supported in h264_qsv. Change these value to reset qsv codec's max/min qp configuration. + +@item @var{low_delay_brc} +Supported in h264_qsv and hevc_qsv. +Change this value to reset qsv codec's low_delay_brc configuration. @end table @subsection H264 options diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 3be19e04f4..84c6e292aa 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -937,6 +937,7 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) q->old_int_ref_cycle_dist = q->int_ref_cycle_dist; if (q->low_delay_brc >= 0) q->extco3.LowDelayBRC = q->low_delay_brc ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; +q->old_low_delay_brc = q->low_delay_brc; if (q->max_frame_size_i >= 0) q->extco3.MaxFrameSizeI = q->max_frame_size_i; if (q->max_frame_size_p >= 0) @@ -1817,6 +1818,26 @@ static int update_min_max_qp(AVCodecContext *avctx, QSVEncContext *q) return updated; } +static int update_low_delay_brc(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_low_delay_brc, q->low_delay_brc); +if (!updated) +return 0; + +q->extco3.LowDelayBRC = MFX_CODINGOPTION_UNKNOWN; +if (q->low_delay_brc >= 0) +q->extco3.LowDelayBRC = q->low_delay_brc ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; +av_log(avctx, AV_LOG_DEBUG, "Reset LowDelayBRC: %s\n", + print_threestate(q->extco3.LowDelayBRC)); + +return updated; +} + static int update_parameters(AVCodecContext *avctx, QSVEncContext *q, const AVFrame *frame) { @@ -1829,7 +1850,7 @@ static int update_parameters(AVCodecContext *avctx, QSVEncContext *q, needReset |= update_max_frame_size(avctx, q); needReset |= update_gop_size(avctx, q); needReset |= update_rir(avctx, q); - +needReset |= update_low_delay_brc(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 e7be10935c..f2b7ee361f 100644 --- a/libavcodec/qsvenc.h +++ b/libavcodec/qsvenc.h @@ -269,6 +269,8 @@ typedef struct QSVEncContext { int old_min_qp_p; int old_max_qp_b; int old_min_qp_b; +// This is used for low_delay_brc reset +int old_low_delay_brc; } QSVEncContext; int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".