ref: 096b2207baa7da051f3805300bfe43e20256c572
parent: 8ab3e80ec46e8f811c5f880890488029261dea70
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Sun Aug 21 11:53:35 EDT 2016
Make the DC rejection filter Q14 instead of Q15 This avoids an overflow on extreme signals
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -388,7 +388,7 @@
for (i=0;i<len;i++)
{
opus_val32 x, tmp, y;
- x = SHL32(EXTEND32(in[channels*i+c]), 15);
+ x = SHL32(EXTEND32(in[channels*i+c]), 14);
/* First stage */
tmp = x-hp_mem[2*c];
hp_mem[2*c] = hp_mem[2*c] + PSHR32(x - hp_mem[2*c], shift);
@@ -395,7 +395,7 @@
/* Second stage */
y = tmp - hp_mem[2*c+1];
hp_mem[2*c+1] = hp_mem[2*c+1] + PSHR32(tmp - hp_mem[2*c+1], shift);
- out[channels*i+c] = EXTRACT16(SATURATE(PSHR32(y, 15), 32767));
+ out[channels*i+c] = EXTRACT16(SATURATE(PSHR32(y, 14), 32767));
}
}
}