diff options
Diffstat (limited to 'celt/vq.c')
-rw-r--r-- | celt/vq.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -210,7 +210,8 @@ opus_val16 op_pvq_search_c(celt_norm *X, int *iy, int K, int N, int arch) while (++j<N); sum = QCONST16(1.f,14); } - rcp = EXTRACT16(MULT16_32_Q16(K-1, celt_rcp(sum))); + /* Using K+e with e < 1 guarantees we cannot get more than K pulses. */ + rcp = EXTRACT16(MULT16_32_Q16(K+0.8, celt_rcp(sum))); j=0; do { #ifdef FIXED_POINT /* It's really important to round *towards zero* here */ @@ -225,7 +226,7 @@ opus_val16 op_pvq_search_c(celt_norm *X, int *iy, int K, int N, int arch) pulsesLeft -= iy[j]; } while (++j<N); } - celt_assert2(pulsesLeft>=1, "Allocated too many pulses in the quick pass"); + celt_assert2(pulsesLeft>=0, "Allocated too many pulses in the quick pass"); /* This should never happen, but just in case it does (e.g. on silence) we fill the first bin with pulses. */ |