diff options
author | Nils Wallménius <nils@rockbox.org> | 2011-06-05 13:12:51 +0000 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2011-06-05 13:12:51 +0000 |
commit | 965113ed5051d3e9e4b563b8da1f5523c5470a76 (patch) | |
tree | ea3f7922e5075a96e21fa44e4c78f8a0df56c378 /apps/codecs/libcook/cook_fixpoint.h | |
parent | 9f65f2b6adc24964ac3fe03a75616fab96769bb7 (diff) | |
download | rockbox-965113ed5051d3e9e4b563b8da1f5523c5470a76.tar.gz rockbox-965113ed5051d3e9e4b563b8da1f5523c5470a76.zip |
FS#12146: Fix libcook bugs introduced in r22055 by Sean Bartell.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29973 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libcook/cook_fixpoint.h')
-rw-r--r-- | apps/codecs/libcook/cook_fixpoint.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/apps/codecs/libcook/cook_fixpoint.h b/apps/codecs/libcook/cook_fixpoint.h index c8a17c6dc6..5c4a5d1a5a 100644 --- a/apps/codecs/libcook/cook_fixpoint.h +++ b/apps/codecs/libcook/cook_fixpoint.h | |||
@@ -36,7 +36,7 @@ | |||
36 | */ | 36 | */ |
37 | 37 | ||
38 | #ifdef ROCKBOX | 38 | #ifdef ROCKBOX |
39 | /* get definitions of MULT31, MULT31_SHIFT15, vect_add, from codelib */ | 39 | /* get definitions of MULT31, MULT31_SHIFT16, vect_add, from codelib */ |
40 | #include "codeclib_misc.h" | 40 | #include "codeclib_misc.h" |
41 | #include "codeclib.h" | 41 | #include "codeclib.h" |
42 | #endif | 42 | #endif |
@@ -68,7 +68,7 @@ static inline FIXP fixp_pow2(FIXP x, int i) | |||
68 | * @param b fix point fraction, 0 <= b < 1 | 68 | * @param b fix point fraction, 0 <= b < 1 |
69 | */ | 69 | */ |
70 | #ifdef ROCKBOX | 70 | #ifdef ROCKBOX |
71 | #define fixp_mult_su(x,y) (MULT31_SHIFT15(x,y)) | 71 | #define fixp_mult_su(x,y) (MULT31_SHIFT16(x,y)) |
72 | #else | 72 | #else |
73 | static inline FIXP fixp_mult_su(FIXP a, FIXPU b) | 73 | static inline FIXP fixp_mult_su(FIXP a, FIXPU b) |
74 | { | 74 | { |
@@ -130,18 +130,18 @@ static void scalar_dequant_math(COOKContext *q, int index, | |||
130 | int* subband_coef_sign, REAL_T *mlt_p) | 130 | int* subband_coef_sign, REAL_T *mlt_p) |
131 | { | 131 | { |
132 | /* Num. half bits to right shift */ | 132 | /* Num. half bits to right shift */ |
133 | const int s = (33 - quant_index + av_log2(q->samples_per_channel)) >> 1; | 133 | const int s = 33 - quant_index + av_log2(q->samples_per_channel); |
134 | const FIXP *table = quant_tables[s & 1][index]; | 134 | const FIXP *table = quant_tables[s & 1][index]; |
135 | FIXP f; | 135 | FIXP f; |
136 | int i; | 136 | int i; |
137 | 137 | ||
138 | 138 | ||
139 | if(s >= 32) | 139 | if(s >= 64) |
140 | memset(mlt_p, 0, sizeof(REAL_T)*SUBBAND_SIZE); | 140 | memset(mlt_p, 0, sizeof(REAL_T)*SUBBAND_SIZE); |
141 | else | 141 | else |
142 | { | 142 | { |
143 | for(i=0 ; i<SUBBAND_SIZE ; i++) { | 143 | for(i=0 ; i<SUBBAND_SIZE ; i++) { |
144 | f = (table[subband_coef_index[i]])>>s; | 144 | f = (table[subband_coef_index[i]]) >> (s >> 1); |
145 | /* noise coding if subband_coef_index[i] == 0 */ | 145 | /* noise coding if subband_coef_index[i] == 0 */ |
146 | if (((subband_coef_index[i] == 0) && cook_random(q)) || | 146 | if (((subband_coef_index[i] == 0) && cook_random(q)) || |
147 | ((subband_coef_index[i] != 0) && subband_coef_sign[i])) | 147 | ((subband_coef_index[i] != 0) && subband_coef_sign[i])) |