diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2005-02-26 06:36:04 +0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2005-02-26 06:36:04 +0300 |
commit | 85ad569574a1a7d81c48b10e394b1ce7aaca5b7b (patch) | |
tree | 55f895388471ed46c2ce9997101ec6edb939f303 /libavcodec/golomb.h | |
parent | 21754ce65c78acf8134edbe1f60ce503c0345977 (diff) |
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
Originally committed as revision 3984 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/golomb.h')
-rw-r--r-- | libavcodec/golomb.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h index 9f89502fa6..1204a52e20 100644 --- a/libavcodec/golomb.h +++ b/libavcodec/golomb.h @@ -284,6 +284,27 @@ static inline int get_sr_golomb_flac(GetBitContext *gb, int k, int limit, int es return (v>>1) ^ -(v&1); } +/** + * read unsigned golomb rice code (shorten). + */ +static inline unsigned int get_ur_golomb_shorten(GetBitContext *gb, int k){ + return get_ur_golomb_jpegls(gb, k, INT_MAX, 0); +} + +/** + * read signed golomb rice code (shorten). + */ +static inline int get_sr_golomb_shorten(GetBitContext* gb, int k) +{ + int uvar = get_ur_golomb_jpegls(gb, k + 1, INT_MAX, 0); + if (uvar & 1) + return ~(uvar >> 1); + else + return uvar >> 1; +} + + + #ifdef TRACE static inline int get_ue(GetBitContext *s, char *file, const char *func, int line){ |