From 8256ed4cf745436f4c9b9cd5857917614193f22c Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin Date: Fri, 12 Dec 2008 20:50:56 -0500 Subject: [PATCH] New VQ search is now enabled by default after fixing the last remaining issues: 1) the case of the null vector and 2) getting rid of the 32-bit division --- libcelt/vq.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/libcelt/vq.c b/libcelt/vq.c index e9836555..aff50e43 100644 --- a/libcelt/vq.c +++ b/libcelt/vq.c @@ -138,20 +138,30 @@ void alg_quant(celt_norm_t *X, celt_mask_t *W, int N, int K, celt_norm_t *P, ec_ xy = yy = yp = 0; pulsesLeft = K; -#if 0 + + /* Do a pre-search by projecting on the pyramid */ if (K > (N>>1)) { celt_word32_t sum=0; + celt_word16_t rcp; j=0; do { sum += X[j]; } while (++j N+2) + printf ("%d / %d (%d)\n", pulsesLeft, K, N);*/ celt_assert2(pulsesLeft>=1, "Allocated too many pulses in the quick pass"); -#endif + while (pulsesLeft > 1) { int pulsesAtOnce=1; @@ -230,6 +241,7 @@ void alg_quant(celt_norm_t *X, celt_mask_t *W, int N, int K, celt_norm_t *P, ec_ pulsesLeft -= pulsesAtOnce; } + if (pulsesLeft > 0) { celt_word16_t g; celt_word16_t best_num = -VERY_LARGE16;