aboutsummaryrefslogtreecommitdiff
path: root/celt
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2012-05-08 13:58:57 -0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2012-05-08 13:58:57 -0400
commit9faea25d29ab18e4d67e50f58da47a5f1753d738 (patch)
tree171ddd837f3e7a0c5199a8fb0edbd9d659487ffd /celt
parent37e135677afb86a7b0136d038e534553e34e243e (diff)
downloadlibopus-9faea25d29ab18e4d67e50f58da47a5f1753d738.tar.gz
Fixes a (harmless) float overflow in the pitch search
Diffstat (limited to 'celt')
-rw-r--r--celt/pitch.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/celt/pitch.c b/celt/pitch.c
index 29e4bd12..c01ea55e 100644
--- a/celt/pitch.c
+++ b/celt/pitch.c
@@ -74,6 +74,11 @@ static void find_best_pitch(opus_val32 *xcorr, opus_val16 *y, int len,
opus_val16 num;
opus_val32 xcorr16;
xcorr16 = EXTRACT16(VSHR32(xcorr[i], xshift));
+#ifndef FIXED_POINT
+ /* Considering the range of xcorr16, this should avoid both underflows
+ and overflows (inf) when squaring xcorr16 */
+ xcorr16 *= 1e-12;
+#endif
num = MULT16_16_Q15(xcorr16,xcorr16);
if (MULT16_32_Q15(num,best_den[1]) > MULT16_32_Q15(best_num[1],Syy))
{