diff options
| author | Jens Arnold <amiconn@rockbox.org> | 2008-11-04 23:46:04 +0000 |
|---|---|---|
| committer | Jens Arnold <amiconn@rockbox.org> | 2008-11-04 23:46:04 +0000 |
| commit | 7a835ee0c64bb941f205a2eb915cf0aaf460f1bc (patch) | |
| tree | fc06dddecf13ed3e83ae2061bb1921f372b5fb75 /apps/codecs/demac/libdemac/rangecoding.h | |
| parent | 1e8be6f6b05f6cbe64ce47c8d7a7cd93cf1d1c80 (diff) | |
| download | rockbox-7a835ee0c64bb941f205a2eb915cf0aaf460f1bc.zip rockbox-7a835ee0c64bb941f205a2eb915cf0aaf460f1bc.tar.gz rockbox-7a835ee0c64bb941f205a2eb915cf0aaf460f1bc.tar.bz2 rockbox-7a835ee0c64bb941f205a2eb915cf0aaf460f1bc.tar.xz | |
Some entropy decoder tweaks. Also removed unnecessary 'tmp' variables.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19008 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/demac/libdemac/rangecoding.h')
| -rw-r--r-- | apps/codecs/demac/libdemac/rangecoding.h | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/apps/codecs/demac/libdemac/rangecoding.h b/apps/codecs/demac/libdemac/rangecoding.h index 9c26344..c96886e 100644 --- a/apps/codecs/demac/libdemac/rangecoding.h +++ b/apps/codecs/demac/libdemac/rangecoding.h @@ -62,12 +62,9 @@ static int bytebufferoffset IBSS_ATTR; static inline void skip_byte(void) { - if (bytebufferoffset) { - bytebufferoffset--; - } else { - bytebufferoffset = 3; - bytebuffer += 4; - } + bytebufferoffset--; + bytebuffer += bytebufferoffset & 4; + bytebufferoffset &= 3; } static inline int read_byte(void) @@ -122,23 +119,17 @@ static inline void range_dec_normalize(void) /* or: totf is (code_value)1<<shift */ /* returns the culmulative frequency */ static inline int range_decode_culfreq(int tot_f) -{ int tmp; - +{ range_dec_normalize(); - rc.help = rc.range / tot_f; - tmp = rc.low / rc.help; - - return tmp; + return rc.low / rc.help; } static inline int range_decode_culshift(int shift) { - int tmp; range_dec_normalize(); - rc.help = rc.range>>shift; - tmp = rc.low/rc.help; - return tmp; + rc.help = rc.range >> shift; + return rc.low / rc.help; } @@ -146,9 +137,8 @@ static inline int range_decode_culshift(int shift) /* sy_f is the interval length (frequency of the symbol) */ /* lt_f is the lower end (frequency sum of < symbols) */ static inline void range_decode_update(int sy_f, int lt_f) -{ int tmp; - tmp = rc.help * lt_f; - rc.low -= tmp; +{ + rc.low -= rc.help * lt_f; rc.range = rc.help * sy_f; } |