diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2013-05-27 02:50:13 +0400 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2013-05-27 02:54:25 +0400 |
commit | 2fe4700f761e21788dd3c23c7eca9dc0d436ef10 (patch) | |
tree | 740bb26c7a74ab961325011619eddb9c0b915197 | |
parent | faec6736cb4dc3d7cd7982f4b72378d5c0ca560c (diff) |
Skip down-sampling in deemphasis() when not needed.
-rw-r--r-- | celt/celt_decoder.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/celt/celt_decoder.c b/celt/celt_decoder.c index d5d2c57f..cfb5b36d 100644 --- a/celt/celt_decoder.c +++ b/celt/celt_decoder.c @@ -191,6 +191,7 @@ void deemphasis(celt_sig *in[], opus_val16 *pcm, int N, int C, int downsample, c { int c; int Nd; + int apply_downsampling=0; opus_val16 coef0; coef0 = coef[0]; @@ -215,8 +216,10 @@ void deemphasis(celt_sig *in[], opus_val16 *pcm, int N, int C, int downsample, c tmp = SHL32(MULT16_32_Q15(coef3, tmp), 2); scratch[j] = tmp; } + apply_downsampling=1; } else #endif + if (downsample>1) { /* Shortcut for the standard (non-custom modes) case */ for (j=0;j<N;j++) @@ -225,12 +228,24 @@ void deemphasis(celt_sig *in[], opus_val16 *pcm, int N, int C, int downsample, c m = MULT16_32_Q15(coef0, tmp); scratch[j] = tmp; } + apply_downsampling=1; + } else { + /* Shortcut for the standard (non-custom modes) case */ + for (j=0;j<N;j++) + { + celt_sig tmp = x[j] + m; + m = MULT16_32_Q15(coef0, tmp); + y[j*C] = SCALEOUT(SIG2WORD16(tmp)); + } } mem[c] = m; - /* Perform down-sampling */ - for (j=0;j<Nd;j++) - y[j*C] = SCALEOUT(SIG2WORD16(scratch[j*downsample])); + if (apply_downsampling) + { + /* Perform down-sampling */ + for (j=0;j<Nd;j++) + y[j*C] = SCALEOUT(SIG2WORD16(scratch[j*downsample])); + } } while (++c<C); } |