ref: c3273ed7e79045183281d1d80a6b6b86839d197d
parent: e0491e7d18038b4bcd21c290dae51dfe019977ef
author: Jean-Marc Valin <[email protected]>
date: Thu Nov 29 11:51:06 EST 2012
Fixes an overflow in the fixed-point celt_sqrt() for large values. Was causing problems with the PLC
--- a/celt/mathops.c
+++ b/celt/mathops.c
@@ -123,6 +123,8 @@
static const opus_val16 C[5] = {23175, 11561, -3011, 1699, -664};
if (x==0)
return 0;
+ else if (x>=1073741824)
+ return 32767;
k = (celt_ilog2(x)>>1)-7;
x = VSHR32(x, 2*k);
n = x-32768;