diff options
| author | Dave Chapman <dave@dchapman.com> | 2005-11-11 19:45:36 +0000 |
|---|---|---|
| committer | Dave Chapman <dave@dchapman.com> | 2005-11-11 19:45:36 +0000 |
| commit | 2bf9be1c02d5f93c8de0842aa7c2cf1c344aacd6 (patch) | |
| tree | 27bf4c6942621a4b3bf8678626997bb72b42f68e /apps/codecs/libffmpegFLAC/golomb.h | |
| parent | 5592e37c632efb5a91685aadc9896a800f5f77af (diff) | |
| download | rockbox-2bf9be1c02d5f93c8de0842aa7c2cf1c344aacd6.zip rockbox-2bf9be1c02d5f93c8de0842aa7c2cf1c344aacd6.tar.gz rockbox-2bf9be1c02d5f93c8de0842aa7c2cf1c344aacd6.tar.bz2 rockbox-2bf9be1c02d5f93c8de0842aa7c2cf1c344aacd6.tar.xz | |
Patch #1352575 - Shorten codec from the ffmpeg project. Rockbox implementation by Mark Arigo.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7814 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libffmpegFLAC/golomb.h')
| -rw-r--r-- | apps/codecs/libffmpegFLAC/golomb.h | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/apps/codecs/libffmpegFLAC/golomb.h b/apps/codecs/libffmpegFLAC/golomb.h index 9dcbcb2..2739f38 100644 --- a/apps/codecs/libffmpegFLAC/golomb.h +++ b/apps/codecs/libffmpegFLAC/golomb.h @@ -19,9 +19,20 @@ * */ +#include <limits.h> /* From libavutil/common.h */ -extern const uint8_t ff_log2_tab[256]; +const uint8_t ff_log2_tab[256] ICONST_ATTR = { + 0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 +}; + static inline int av_log2(unsigned int v) { int n; @@ -104,3 +115,25 @@ static inline int get_sr_golomb_flac(GetBitContext *gb, int k, int limit, int es int v= get_ur_golomb_jpegls(gb, k, limit, esc_len); return (v>>1) ^ -(v&1); } + +/** + * read unsigned golomb rice code (shorten). + */ +#define get_ur_golomb_shorten(gb, k) get_ur_golomb_jpegls(gb, k, INT_MAX, 0) +/* +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; +} |