From 96069fd013043d8979fd4d41aac1cedbd05e2e92 Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin Date: Tue, 15 Apr 2008 21:14:18 +1000 Subject: [PATCH] optimisation: managed to avoid dividing in the "full gain" case of alg_quant() --- libcelt/vq.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/libcelt/vq.c b/libcelt/vq.c index 2c5de866..3698dce4 100644 --- a/libcelt/vq.c +++ b/libcelt/vq.c @@ -183,42 +183,43 @@ void alg_quant(celt_norm_t *X, celt_mask_t *W, int N, int K, const celt_norm_t * best_num = Rxy; best_id = j; } - } while (++j= best_num) + if (MULT16_16(best_den, num) > MULT16_16(Ryy, best_num)) { + best_den = Ryy; best_num = num; best_id = j; - } - } + } + } while (++j