aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2016-09-13 00:25:07 +0100
committerMark Thompson <sw@jkqxz.net>2016-11-21 22:13:41 +0000
commit06d73d002e7f911f26ae1548b46e442a6ece9a4a (patch)
tree88c1055537b55a36b4bfd18fc7ff81e93b9af7c4 /libavcodec
parent156fbbb562f36f6dcaf363fb3029834c28519dc7 (diff)
downloadffmpeg-06d73d002e7f911f26ae1548b46e442a6ece9a4a.tar.gz
vaapi_h264: Fix HRD bit_rate/cpb_size scaling
There should be an extra offset of 6 on bit_rate_scale and of 4 on cpb_size_scale which were not accounted for here. (cherry picked from commit 3a9662af6c741f8354b1ca97642f78f5c02e2e8f)
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/vaapi_encode_h264.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
index 5bed4e493f..ef9ce9dd5a 100644
--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -861,14 +861,14 @@ 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.
mseq->bit_rate_scale =
- av_clip_uintp2(av_log2(avctx->bit_rate) - 15, 4);
+ av_clip_uintp2(av_log2(avctx->bit_rate) - 15 - 6, 4);
mseq->bit_rate_value_minus1[0] =
- (avctx->bit_rate >> mseq->bit_rate_scale) - 1;
+ (avctx->bit_rate >> mseq->bit_rate_scale + 6) - 1;
mseq->cpb_size_scale =
- av_clip_uintp2(av_log2(priv->hrd_params.hrd.buffer_size) - 15, 4);
+ av_clip_uintp2(av_log2(priv->hrd_params.hrd.buffer_size) - 15 - 4, 4);
mseq->cpb_size_value_minus1[0] =
- (priv->hrd_params.hrd.buffer_size >> mseq->cpb_size_scale) - 1;
+ (priv->hrd_params.hrd.buffer_size >> mseq->cpb_size_scale + 4) - 1;
// CBR mode isn't actually available here, despite naming.
mseq->cbr_flag[0] = 0;