fixes overflows in celt_iir() by doing proper saturation

This commit is contained in:
Jean-Marc Valin 2016-07-22 09:13:00 -04:00
parent 184a4767aa
commit a0bd7d3b84
4 changed files with 12 additions and 6 deletions

View file

@ -104,6 +104,9 @@
/** Shift by a and round-to-neareast 32-bit value. Result is a 16-bit value */
#define ROUND16(x,a) (EXTRACT16(PSHR32((x),(a))))
/** Shift by a and round-to-neareast 32-bit value. Result is a saturated 16-bit value */
#define SROUND16(x,a) EXTRACT16(SATURATE(PSHR32(x,a), 32767));
/** Divide by two */
#define HALF16(x) (SHR16(x,1))
#define HALF32(x) (SHR32(x,1))