diff options
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 9c26344ec5..c96886e32b 100644 --- a/apps/codecs/demac/libdemac/rangecoding.h +++ b/apps/codecs/demac/libdemac/rangecoding.h | |||
@@ -62,12 +62,9 @@ static int bytebufferoffset IBSS_ATTR; | |||
62 | 62 | ||
63 | static inline void skip_byte(void) | 63 | static inline void skip_byte(void) |
64 | { | 64 | { |
65 | if (bytebufferoffset) { | 65 | bytebufferoffset--; |
66 | bytebufferoffset--; | 66 | bytebuffer += bytebufferoffset & 4; |
67 | } else { | 67 | bytebufferoffset &= 3; |
68 | bytebufferoffset = 3; | ||
69 | bytebuffer += 4; | ||
70 | } | ||
71 | } | 68 | } |
72 | 69 | ||
73 | static inline int read_byte(void) | 70 | static inline int read_byte(void) |
@@ -122,23 +119,17 @@ static inline void range_dec_normalize(void) | |||
122 | /* or: totf is (code_value)1<<shift */ | 119 | /* or: totf is (code_value)1<<shift */ |
123 | /* returns the culmulative frequency */ | 120 | /* returns the culmulative frequency */ |
124 | static inline int range_decode_culfreq(int tot_f) | 121 | static inline int range_decode_culfreq(int tot_f) |
125 | { int tmp; | 122 | { |
126 | |||
127 | range_dec_normalize(); | 123 | range_dec_normalize(); |
128 | |||
129 | rc.help = rc.range / tot_f; | 124 | rc.help = rc.range / tot_f; |
130 | tmp = rc.low / rc.help; | 125 | return rc.low / rc.help; |
131 | |||
132 | return tmp; | ||
133 | } | 126 | } |
134 | 127 | ||
135 | static inline int range_decode_culshift(int shift) | 128 | static inline int range_decode_culshift(int shift) |
136 | { | 129 | { |
137 | int tmp; | ||
138 | range_dec_normalize(); | 130 | range_dec_normalize(); |
139 | rc.help = rc.range>>shift; | 131 | rc.help = rc.range >> shift; |
140 | tmp = rc.low/rc.help; | 132 | return rc.low / rc.help; |
141 | return tmp; | ||
142 | } | 133 | } |
143 | 134 | ||
144 | 135 | ||
@@ -146,9 +137,8 @@ static inline int range_decode_culshift(int shift) | |||
146 | /* sy_f is the interval length (frequency of the symbol) */ | 137 | /* sy_f is the interval length (frequency of the symbol) */ |
147 | /* lt_f is the lower end (frequency sum of < symbols) */ | 138 | /* lt_f is the lower end (frequency sum of < symbols) */ |
148 | static inline void range_decode_update(int sy_f, int lt_f) | 139 | static inline void range_decode_update(int sy_f, int lt_f) |
149 | { int tmp; | 140 | { |
150 | tmp = rc.help * lt_f; | 141 | rc.low -= rc.help * lt_f; |
151 | rc.low -= tmp; | ||
152 | rc.range = rc.help * sy_f; | 142 | rc.range = rc.help * sy_f; |
153 | } | 143 | } |
154 | 144 | ||