diff options
author | Mohamed Tarek <mt@rockbox.org> | 2010-07-15 05:38:09 +0000 |
---|---|---|
committer | Mohamed Tarek <mt@rockbox.org> | 2010-07-15 05:38:09 +0000 |
commit | 387af97a26105fce79e6a8726752cf183d40939e (patch) | |
tree | 25c7898bbf08963b9c7688c8937061b4b3491dec /apps/codecs/libwmapro/get_bits.h | |
parent | 5d2969c94e97c81e3eb88211b921be80b66bd691 (diff) | |
download | rockbox-387af97a26105fce79e6a8726752cf183d40939e.tar.gz rockbox-387af97a26105fce79e6a8726752cf183d40939e.zip |
Initial cleanup for libwmapro.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27425 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libwmapro/get_bits.h')
-rw-r--r-- | apps/codecs/libwmapro/get_bits.h | 52 |
1 files changed, 14 insertions, 38 deletions
diff --git a/apps/codecs/libwmapro/get_bits.h b/apps/codecs/libwmapro/get_bits.h index ecbfc6967b..84853d8b8b 100644 --- a/apps/codecs/libwmapro/get_bits.h +++ b/apps/codecs/libwmapro/get_bits.h | |||
@@ -30,10 +30,20 @@ | |||
30 | #include <stdlib.h> | 30 | #include <stdlib.h> |
31 | //#include <assert.h> | 31 | //#include <assert.h> |
32 | #include "libavutil/bswap.h" | 32 | #include "libavutil/bswap.h" |
33 | #include "libavutil/common.h" | 33 | //#include "libavutil/common.h" |
34 | #include "libavutil/intreadwrite.h" | 34 | #include "libavutil/intreadwrite.h" |
35 | #include "libavutil/log.h" | 35 | //#include "libavutil/log.h" |
36 | #include "mathops.h" | 36 | |
37 | #define av_log(...) | ||
38 | |||
39 | /* NEG_* were taken from mathops.h */ | ||
40 | #ifndef NEG_SSR32 | ||
41 | # define NEG_SSR32(a,s) ((( int32_t)(a))>>(32-(s))) | ||
42 | #endif | ||
43 | |||
44 | #ifndef NEG_USR32 | ||
45 | # define NEG_USR32(a,s) (((uint32_t)(a))>>(32-(s))) | ||
46 | #endif | ||
37 | 47 | ||
38 | #if defined(ALT_BITSTREAM_READER_LE) && !defined(ALT_BITSTREAM_READER) | 48 | #if defined(ALT_BITSTREAM_READER_LE) && !defined(ALT_BITSTREAM_READER) |
39 | # define ALT_BITSTREAM_READER | 49 | # define ALT_BITSTREAM_READER |
@@ -321,24 +331,6 @@ static inline void skip_bits_long(GetBitContext *s, int n){ | |||
321 | 331 | ||
322 | #endif | 332 | #endif |
323 | 333 | ||
324 | /** | ||
325 | * read mpeg1 dc style vlc (sign bit + mantisse with no MSB). | ||
326 | * if MSB not set it is negative | ||
327 | * @param n length in bits | ||
328 | * @author BERO | ||
329 | */ | ||
330 | static inline int get_xbits(GetBitContext *s, int n){ | ||
331 | register int sign; | ||
332 | register int32_t cache; | ||
333 | OPEN_READER(re, s) | ||
334 | UPDATE_CACHE(re, s) | ||
335 | cache = GET_CACHE(re,s); | ||
336 | sign=(~cache)>>31; | ||
337 | LAST_SKIP_BITS(re, s, n) | ||
338 | CLOSE_READER(re, s) | ||
339 | return (NEG_USR32(sign ^ cache, n) ^ sign) - sign; | ||
340 | } | ||
341 | |||
342 | static inline int get_sbits(GetBitContext *s, int n){ | 334 | static inline int get_sbits(GetBitContext *s, int n){ |
343 | register int tmp; | 335 | register int tmp; |
344 | OPEN_READER(re, s) | 336 | OPEN_READER(re, s) |
@@ -429,13 +421,6 @@ static inline unsigned int get_bits_long(GetBitContext *s, int n){ | |||
429 | } | 421 | } |
430 | 422 | ||
431 | /** | 423 | /** |
432 | * reads 0-32 bits as a signed integer. | ||
433 | */ | ||
434 | static inline int get_sbits_long(GetBitContext *s, int n) { | ||
435 | return sign_extend(get_bits_long(s, n), n); | ||
436 | } | ||
437 | |||
438 | /** | ||
439 | * shows 0-32 bits. | 424 | * shows 0-32 bits. |
440 | */ | 425 | */ |
441 | static inline unsigned int show_bits_long(GetBitContext *s, int n){ | 426 | static inline unsigned int show_bits_long(GetBitContext *s, int n){ |
@@ -446,15 +431,6 @@ static inline unsigned int show_bits_long(GetBitContext *s, int n){ | |||
446 | } | 431 | } |
447 | } | 432 | } |
448 | 433 | ||
449 | static inline int check_marker(GetBitContext *s, const char *msg) | ||
450 | { | ||
451 | int bit= get_bits1(s); | ||
452 | if(!bit) | ||
453 | av_log(NULL, AV_LOG_INFO, "Marker bit missing %s\n", msg); | ||
454 | |||
455 | return bit; | ||
456 | } | ||
457 | |||
458 | /** | 434 | /** |
459 | * init GetBitContext. | 435 | * init GetBitContext. |
460 | * @param buffer bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE bytes larger then the actual read bits | 436 | * @param buffer bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE bytes larger then the actual read bits |
@@ -594,7 +570,7 @@ void free_vlc(VLC *vlc); | |||
594 | * read the longest vlc code | 570 | * read the longest vlc code |
595 | * = (max_vlc_length + bits - 1) / bits | 571 | * = (max_vlc_length + bits - 1) / bits |
596 | */ | 572 | */ |
597 | static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2], | 573 | static inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2], |
598 | int bits, int max_depth) | 574 | int bits, int max_depth) |
599 | { | 575 | { |
600 | int code; | 576 | int code; |