ref: 84043f7cf7e00351264ee97d85333fa9a3fc8f97
parent: 223657b51b0a74e8bc0b6e15841b61c08776ee5b
author: Jean-Marc Valin <[email protected]>
date: Sun Jul 24 13:54:56 EDT 2016
Fixes a shift<0 issue in transient_analysis() Fixes a potential overflow in high-passed signal for transient detection and ensures that the shift can never go negative
--- a/celt/celt_encoder.c
+++ b/celt/celt_encoder.c
@@ -272,7 +272,7 @@
mem0 = mem1 + y - 2*x;
mem1 = x - .5f*y;
#endif
- tmp[i] = EXTRACT16(SHR32(y,2));
+ tmp[i] = SROUND16(y, 2);
/*printf("%f ", tmp[i]);*/
}
/*printf("\n");*/
@@ -283,7 +283,7 @@
/* Normalize tmp to max range */
{
int shift=0;
- shift = 14-celt_ilog2(1+celt_maxabs16(tmp, len));
+ shift = 14-celt_ilog2(MAX16(1, celt_maxabs16(tmp, len)));
if (shift!=0)
{
for (i=0;i<len;i++)