On 31/10/17 02:37, Jun Zhao wrote: > From d1e105057e93e7c2788d6d684292db9008fbf3ac Mon Sep 17 00:00:00 2001 > From: Jun Zhao <jun.z...@intel.com> > Date: Tue, 31 Oct 2017 10:19:08 +0800 > Subject: [PATCH 2/2] lavc/vaapi_encode_h264: correct bit_rate_scale setting. > > As H264 Spec 2012 E.2.2, bit_rate_scale means the max input bit rate. > > Signed-off-by: Jun Zhao <jun.z...@intel.com> > Signed-off-by: Wang, Yi A <yi.a.w...@intel.com> > --- > libavcodec/vaapi_encode_h264.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c > index 1d43e934ef..27a810c64e 100644 > --- a/libavcodec/vaapi_encode_h264.c > +++ b/libavcodec/vaapi_encode_h264.c > @@ -406,7 +406,7 @@ static int > vaapi_encode_h264_init_sequence_params(AVCodecContext *avctx) > // Try to scale these to a sensible range so that the > // golomb encode of the value is not overlong. > hrd->bit_rate_scale = > - av_clip_uintp2(av_log2(avctx->bit_rate) - 15 - 6, 4); > + av_clip_uintp2(av_log2(FFMAX(avctx->bit_rate, > avctx->rc_max_rate)) - 15 - 6, 4); > hrd->bit_rate_value_minus1[0] = > (avctx->bit_rate >> hrd->bit_rate_scale + 6) - 1; > > -- > 2.14.1 >
Can you offer some more justification for that? I think the change is wrong: consider under what circumstances overflow/underflow occurs. - Mark _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel