Fixes some overflows in the fixed-point pitch code

The overflows reported were:
- Syy in find_best_pitch() in pitch.c
- xy, xx and yy in remove_doubling() in pitch.c

The fixes are:
- Adaptive scaling in pitch_downsample() which also improves quality
- Adding a missing downshift in find_best_pitch()
- More conservative yshift when calling find_best_pitch()
This commit is contained in:
Jean-Marc Valin 2012-04-06 23:32:11 -04:00
parent cd539dfdcd
commit 178758b81a
2 changed files with 26 additions and 6 deletions

View file

@ -128,6 +128,17 @@ static inline opus_val16 celt_maxabs16(opus_val16 *x, int len)
}
#endif
#ifndef OVERRIDE_CELT_MAXABS32
static inline opus_val32 celt_maxabs32(opus_val32 *x, int len)
{
int i;
opus_val32 maxval = 0;
for (i=0;i<len;i++)
maxval = MAX32(maxval, ABS32(x[i]));
return maxval;
}
#endif
/** Integer log in base2. Defined for zero, but not for negative numbers */
static inline opus_int16 celt_zlog2(opus_val32 x)
{