shithub: opus

Download patch

ref: 986e2695373f94d9572dbe08bb7cb87f01d9217b
parent: 63fb61f176463809c8ddc553a7501f10392f4719
author: Jean-Marc Valin <[email protected]>
date: Thu Jan 20 19:02:10 EST 2011

Prevents taking the log of zero in fixed-point

--- a/libcelt/pitch.c
+++ b/libcelt/pitch.c
@@ -179,7 +179,7 @@
       y_lp4[j] = y[2*j];
 
 #ifdef FIXED_POINT
-   shift = celt_ilog2(MAX16(celt_maxabs16(x_lp4, len>>2), celt_maxabs16(y_lp4, lag>>2)))-11;
+   shift = celt_ilog2(MAX16(1, MAX16(celt_maxabs16(x_lp4, len>>2), celt_maxabs16(y_lp4, lag>>2))))-11;
    if (shift>0)
    {
       for (j=0;j<len>>2;j++)