diff options
author | Jun Zhao <jun.zhao@intel.com> | 2017-06-14 10:35:20 +0800 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-06-24 22:17:15 +0200 |
commit | e61abe2d73297e0b6dc1e179b717afc00c32af98 (patch) | |
tree | ae412bca09f704a37fe7593874ea886e2624b63f | |
parent | 2b7d9a1f3fa759c82aaa3569612b40d5ccb1e319 (diff) | |
download | ffmpeg-e61abe2d73297e0b6dc1e179b717afc00c32af98.tar.gz |
lavc/golobm: Add set_ue_golomb_long to support up to 2^32 -2.
add set_ue_golomb_long to support up to 2^32-2.
Reviewed-by: Mark Thompson <sw@jkqxz.net>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <jun.zhao@intel.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/golomb.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h index 1e834f9327..efb1eff8aa 100644 --- a/libavcodec/golomb.h +++ b/libavcodec/golomb.h @@ -474,6 +474,21 @@ static inline void set_ue_golomb(PutBitContext *pb, int i) } /** + * write unsigned exp golomb code. 2^32-2 at most. + */ +static inline void set_ue_golomb_long(PutBitContext *pb, uint32_t i) +{ + av_assert2(i <= (UINT32_MAX - 1)); + + if (i < 256) + put_bits(pb, ff_ue_golomb_len[i], i + 1); + else { + int e = av_log2(i + 1); + put_bits64(pb, 2 * e + 1, i + 1); + } +} + +/** * write truncated unsigned exp golomb code. */ static inline void set_te_golomb(PutBitContext *pb, int i, int range) |