summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2012-11-02 18:47:47 -0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2012-11-02 18:47:47 -0400
commitf2729ded66feac2ca5b6acbb52137b076d29e9ef (patch)
tree9a3f6d63f262307f6b1d2fb9af65b54a0e447fb8
parentfac68ce189a768b4f18bba88d33c10b5cec11649 (diff)
downloadopus-f2729ded66feac2ca5b6acbb52137b076d29e9ef.tar.gz
Fixes a fixed-point divide-by-zero issue
-rw-r--r--celt/celt.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/celt/celt.c b/celt/celt.c
index e57cb11d..58cf88d9 100644
--- a/celt/celt.c
+++ b/celt/celt.c
@@ -372,7 +372,7 @@ static inline opus_val16 SIG2WORD16(celt_sig x)
}
#endif
- mean=EPSILON;
+ mean=0;
mem0=0;
/* Grouping by two to reduce complexity */
len/=2;
@@ -407,7 +407,7 @@ static inline opus_val16 SIG2WORD16(celt_sig x)
ratio */
/* Inverse of the mean energy in Q15+6 */
- norm = SHL32(EXTEND32(len),6+14)/SHR32(mean,1);
+ norm = SHL32(EXTEND32(len),6+14)/ADD32(EPSILON,SHR32(mean,1));
/* Compute harmonic mean discarding the unreliable boundaries
The data is smooth, so we only take 1/4th of the samples */
unmask=0;