Remove condition in pre/de-emphasis when not building with custom modes

Should slightly improve coverage and reduce code size
This commit is contained in:
Jean-Marc Valin 2013-01-03 14:28:28 -05:00
parent ba1bd031c7
commit e368e62092
2 changed files with 34 additions and 26 deletions

View file

@ -191,10 +191,9 @@ void deemphasis(celt_sig *in[], opus_val16 *pcm, int N, int C, int downsample, c
{
int c;
int Nd;
opus_val16 coef0, coef1;
opus_val16 coef0;
coef0 = coef[0];
coef1 = coef[1];
Nd = N/downsample;
c=0; do {
int j;
@ -203,26 +202,31 @@ void deemphasis(celt_sig *in[], opus_val16 *pcm, int N, int C, int downsample, c
celt_sig m = mem[c];
x =in[c];
y = pcm+c;
/* Shortcut for the standard (non-custom modes) case */
if (coef1 == 0)
#ifdef CUSTOM_MODES
if (coef[1] != 0)
{
opus_val16 coef1 = coef[1];
opus_val16 coef3 = coef[3];
for (j=0;j<N;j++)
{
celt_sig tmp = x[j] + m;
m = MULT16_32_Q15(coef0, tmp)
- MULT16_32_Q15(coef1, x[j]);
tmp = SHL32(MULT16_32_Q15(coef3, tmp), 2);
scratch[j] = tmp;
}
} else
#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);
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(coef0, tmp)
- MULT16_32_Q15(coef1, x[j]);
tmp = SHL32(MULT16_32_Q15(coef3, tmp), 2);
scratch[j] = tmp;
}
}
#endif
mem[c] = m;
/* Perform down-sampling */

View file

@ -392,12 +392,11 @@ static void preemphasis(const opus_val16 * OPUS_RESTRICT pcmp, celt_sig * OPUS_R
int N, int CC, int upsample, const opus_val16 *coef, celt_sig *mem, int clip)
{
int i;
opus_val16 coef0, coef1;
opus_val16 coef0;
celt_sig m;
int Nu;
coef0 = coef[0];
coef1 = coef[1];
Nu = N/upsample;
@ -428,17 +427,10 @@ static void preemphasis(const opus_val16 * OPUS_RESTRICT pcmp, celt_sig * OPUS_R
}
#endif
m = *mem;
if (coef1 == 0)
#ifdef CUSTOM_MODES
if (coef[1] != 0)
{
for (i=0;i<N;i++)
{
celt_sig x;
x = SHL32(inp[i], SIG_SHIFT);
/* Apply pre-emphasis */
inp[i] = x + m;
m = - MULT16_32_Q15(coef0, x);
}
} else {
opus_val16 coef1 = coef[1];
opus_val16 coef2 = coef[2];
for (i=0;i<N;i++)
{
@ -449,7 +441,19 @@ static void preemphasis(const opus_val16 * OPUS_RESTRICT pcmp, celt_sig * OPUS_R
inp[i] = tmp + m;
m = MULT16_32_Q15(coef1, inp[i]) - MULT16_32_Q15(coef0, tmp);
}
} else
#else
{
for (i=0;i<N;i++)
{
celt_sig x;
x = SHL32(inp[i], SIG_SHIFT);
/* Apply pre-emphasis */
inp[i] = x + m;
m = - MULT16_32_Q15(coef0, x);
}
}
#endif
*mem = m;
}