From d83fb5a9cc2ec4b6cce938662997643da1c5ed0d Mon Sep 17 00:00:00 2001
From: Jean-Marc Valin <jean-marc.valin@octasic.com>
Date: Wed, 3 Nov 2010 16:28:25 -0400
Subject: [PATCH] Fixes a divide by zero in remove_doubling()

---
 libcelt/pitch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libcelt/pitch.c b/libcelt/pitch.c
index 109c76d4..8c1ab9ea 100644
--- a/libcelt/pitch.c
+++ b/libcelt/pitch.c
@@ -276,7 +276,7 @@ celt_word16 remove_doubling(celt_word16 *x, int maxperiod, int minperiod,
       {
          celt_word32 x2y2;
          int sh, t;
-         x2y2 = HALF32(MULT32_32_Q31(xx,yy));
+         x2y2 = 1+HALF32(MULT32_32_Q31(xx,yy));
          sh = celt_ilog2(x2y2)>>1;
          t = VSHR32(x2y2, 2*(sh-7));
          g = g0 = VSHR32(MULT16_32_Q15(celt_rsqrt_norm(t), xy),sh+1);
@@ -318,7 +318,7 @@ celt_word16 remove_doubling(celt_word16 *x, int maxperiod, int minperiod,
       {
          celt_word32 x2y2;
          int sh, t;
-         x2y2 = MULT32_32_Q31(xx,yy);
+         x2y2 = 1+MULT32_32_Q31(xx,yy);
          sh = celt_ilog2(x2y2)>>1;
          t = VSHR32(x2y2, 2*(sh-7));
          g1 = VSHR32(MULT16_32_Q15(celt_rsqrt_norm(t), xy),sh+1);
-- 
GitLab