diff options
-rw-r--r-- | sbc/sbc.c | 17 | ||||
-rw-r--r-- | sbc/sbc_math.h | 4 |
2 files changed, 7 insertions, 14 deletions
@@ -793,19 +793,12 @@ static inline void _sbc_analyze_four(const int32_t *in, int32_t *out) MULA(res, _anamatrix4[3], t[7]); out[3] = SCALE4_STAGE2(res); #else - /* some of these multiplies could be factored more but something overflows */ - /* eg replace the first two lines with MUL(s[0], _anamatrix4[0], t[0] + t[4]) */ - MUL(s[0], _anamatrix4[0], t[0]); - MULA(s[0], _anamatrix4[0], t[4]); + MUL(s[0], _anamatrix4[0], t[0] + t[4]); MUL(s[1], _anamatrix4[2], t[2]); - MUL(s[2], _anamatrix4[1], t[1]); - MULA(s[2], _anamatrix4[1], t[3]); - MULA(s[2], _anamatrix4[3], t[5]); - MULA(s[2], -_anamatrix4[3], t[7]); - MUL(s[3], _anamatrix4[3], t[1]); - MULA(s[3], _anamatrix4[3], t[3]); - MULA(s[3], -_anamatrix4[1], t[5]); - MULA(s[3], _anamatrix4[1], t[7]); + MUL(s[2], _anamatrix4[1], t[1] + t[3]); + MULA(s[2], _anamatrix4[3], t[5] + t[7]); + MUL(s[3], _anamatrix4[3], t[1] + t[3]); + MULA(s[3], _anamatrix4[1], - t[5] + t[7]); out[0] = SCALE4_STAGE2( s[0] + s[1] + s[2]); out[1] = SCALE4_STAGE2(-s[0] + s[1] + s[3]); out[2] = SCALE4_STAGE2(-s[0] + s[1] - s[3]); diff --git a/sbc/sbc_math.h b/sbc/sbc_math.h index d01799c9..e4f82bce 100644 --- a/sbc/sbc_math.h +++ b/sbc/sbc_math.h @@ -64,6 +64,6 @@ typedef long long sbc_extended_t; #define SBC_FIXED_0(val) { val = 0; } #define ADD(dst, src) { dst += src; } #define SUB(dst, src) { dst -= src; } -#define MUL(dst, a, b) { dst = (sbc_fixed_t) a * b; } -#define MULA(dst, a, b) { dst += (sbc_extended_t) a * b; } +#define MUL(dst, a, b) { dst = (sbc_fixed_t) (a) * (b); } +#define MULA(dst, a, b) { dst += (sbc_extended_t) (a) * (b); } #define DIV2(dst, src) { dst = ASR(src, 1); } |