From c8ce2ef3918c1c83109be015b5f51b253c1f9a58 Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin <jmvalin@jmvalin.ca> Date: Thu, 25 Oct 2012 14:44:37 -0400 Subject: [PATCH] Keeping the deemphasis coefficients in local variable to avoid aliasing issues --- celt/celt.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/celt/celt.c b/celt/celt.c index 91f7dfe1c..1c4aedbef 100644 --- a/celt/celt.c +++ b/celt/celt.c @@ -572,6 +572,10 @@ static void deemphasis(celt_sig *in[], opus_val16 *pcm, int N, int C, int downsa { int c; int Nd; + opus_val16 coef0, coef1; + + coef0 = coef[0]; + coef1 = coef[1]; Nd = N/downsample; c=0; do { int j; @@ -581,21 +585,22 @@ static void deemphasis(celt_sig *in[], opus_val16 *pcm, int N, int C, int downsa x =in[c]; y = pcm+c; /* Shortcut for the standard (non-custom modes) case */ - if (coef[1] == 0) + if (coef1 == 0) { for (j=0;j<N;j++) { celt_sig tmp = x[j] + m; - m = MULT16_32_Q15(coef[0], tmp); + m = MULT16_32_Q15(coef0, tmp); scratch[j] = tmp; } } else { + opus_val16 coef3 = coef[3]; for (j=0;j<N;j++) { celt_sig tmp = x[j] + m; - m = MULT16_32_Q15(coef[0], tmp) - - MULT16_32_Q15(coef[1], x[j]); - tmp = SHL32(MULT16_32_Q15(coef[3], tmp), 2); + m = MULT16_32_Q15(coef0, tmp) + - MULT16_32_Q15(coef1, x[j]); + tmp = SHL32(MULT16_32_Q15(coef3, tmp), 2); scratch[j] = tmp; } } -- GitLab