Fixes a fixed-point divide-by-zero issue

This commit is contained in:
Jean-Marc Valin 2012-11-02 18:47:47 -04:00
parent fac68ce189
commit f2729ded66

View file

@ -372,7 +372,7 @@ static inline opus_val16 SIG2WORD16(celt_sig x)
} }
#endif #endif
mean=EPSILON; mean=0;
mem0=0; mem0=0;
/* Grouping by two to reduce complexity */ /* Grouping by two to reduce complexity */
len/=2; len/=2;
@ -407,7 +407,7 @@ static inline opus_val16 SIG2WORD16(celt_sig x)
ratio */ ratio */
/* Inverse of the mean energy in Q15+6 */ /* 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 /* Compute harmonic mean discarding the unreliable boundaries
The data is smooth, so we only take 1/4th of the samples */ The data is smooth, so we only take 1/4th of the samples */
unmask=0; unmask=0;