Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2013-01-03 23:28:28 +0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2013-01-03 23:28:28 +0400
commite368e62092f7c7f511585757af9e16a374a1e048 (patch)
tree5c7167872172984a9afa274288a27d58b46466d5
parentba1bd031c778fdb7bc15d42af516744a193caa96 (diff)
Remove condition in pre/de-emphasis when not building with custom modes
Should slightly improve coverage and reduce code size
-rw-r--r--celt/celt_decoder.c24
-rw-r--r--celt/celt_encoder.c28
2 files changed, 30 insertions, 22 deletions
diff --git a/celt/celt_decoder.c b/celt/celt_decoder.c
index bfcdf415..f2a2fd80 100644
--- a/celt/celt_decoder.c
+++ b/celt/celt_decoder.c
@@ -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);
+ m = MULT16_32_Q15(coef0, tmp)
+ - MULT16_32_Q15(coef1, x[j]);
+ tmp = SHL32(MULT16_32_Q15(coef3, tmp), 2);
scratch[j] = tmp;
}
- } else {
- opus_val16 coef3 = coef[3];
+ } 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)
- - MULT16_32_Q15(coef1, x[j]);
- tmp = SHL32(MULT16_32_Q15(coef3, tmp), 2);
+ m = MULT16_32_Q15(coef0, tmp);
scratch[j] = tmp;
}
}
+#endif
mem[c] = m;
/* Perform down-sampling */
diff --git a/celt/celt_encoder.c b/celt/celt_encoder.c
index 30b6d9e5..391ef794 100644
--- a/celt/celt_encoder.c
+++ b/celt/celt_encoder.c
@@ -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;
}