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>
pull/281/head
Jun Zhao 8 years ago committed by Michael Niedermayer
parent 2b7d9a1f3f
commit e61abe2d73
  1. 15
      libavcodec/golomb.h

@ -473,6 +473,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.
*/

Loading…
Cancel
Save