diff options
author | Mans Rullgard <mans@mansr.com> | 2011-10-11 16:00:21 +0100 |
---|---|---|
committer | Mans Rullgard <mans@mansr.com> | 2011-10-11 18:24:51 +0100 |
commit | fdba370f8a1bdfc22ecbdf3c7148c2f8680a4ac4 (patch) | |
tree | f908af97621bbf687b604b722a0d9f16239a02ab /libavcodec/golomb.h | |
parent | 91f4732913f657f426f2707c45b9026e12b04eb2 (diff) | |
download | ffmpeg-fdba370f8a1bdfc22ecbdf3c7148c2f8680a4ac4.tar.gz |
h264: fix HRD parameters parsing
The bit_rate_value_minus1 and cpb_size_value_minus1 elements
allow a wider range than get_ue_golomb() supports. This
adds a get_ue_golomb_long() function supporting up to 31
leading zeros, which is the maximum for these syntax
elements, and uses it in decode_hrd_parameters().
Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'libavcodec/golomb.h')
-rw-r--r-- | libavcodec/golomb.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h index 83d277f963..503aa1416a 100644 --- a/libavcodec/golomb.h +++ b/libavcodec/golomb.h @@ -75,6 +75,20 @@ static inline int get_ue_golomb(GetBitContext *gb){ } } +/** + * Read an unsigned Exp-Golomb code in the range 0 to UINT32_MAX-1. + */ +static inline unsigned get_ue_golomb_long(GetBitContext *gb) +{ + unsigned buf, log; + + buf = show_bits_long(gb, 32); + log = 31 - av_log2(buf); + skip_bits_long(gb, log); + + return get_bits_long(gb, log + 1) - 1; +} + /** * read unsigned exp golomb code, constraint to a max of 31. * the return value is undefined if the stored value exceeds 31. |