From ae76e553db3d411b5ebb9a8b6df28c18d3a30f82 Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin Date: Fri, 28 Mar 2008 17:59:36 +1100 Subject: [PATCH] Changed the rules for using the pulse spreading. It should be used less often and mainly in the mid-range. --- libcelt/bands.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/libcelt/bands.c b/libcelt/bands.c index fc59d752..7efa58d5 100644 --- a/libcelt/bands.c +++ b/libcelt/bands.c @@ -331,11 +331,15 @@ void quant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, ce if (q > 0) { - int nb_rotations = (B*(eBands[i+1]-eBands[i])+4*q)/(8*q); - exp_rotation(P+B*eBands[i], B*(eBands[i+1]-eBands[i]), -1, B, nb_rotations); - exp_rotation(X+B*eBands[i], B*(eBands[i+1]-eBands[i]), -1, B, nb_rotations); + int nb_rotations = q <= 2*B ? 2*B/q : 0; + if (nb_rotations != 0) + { + exp_rotation(P+B*eBands[i], B*(eBands[i+1]-eBands[i]), -1, B, nb_rotations); + exp_rotation(X+B*eBands[i], B*(eBands[i+1]-eBands[i]), -1, B, nb_rotations); + } alg_quant(X+B*eBands[i], W+B*eBands[i], B*(eBands[i+1]-eBands[i]), q, P+B*eBands[i], enc); - exp_rotation(X+B*eBands[i], B*(eBands[i+1]-eBands[i]), 1, B, nb_rotations); + if (nb_rotations != 0) + exp_rotation(X+B*eBands[i], B*(eBands[i+1]-eBands[i]), 1, B, nb_rotations); } for (j=B*eBands[i];j 0) { - int nb_rotations = (B*(eBands[i+1]-eBands[i])+4*q)/(8*q); - exp_rotation(P+B*eBands[i], B*(eBands[i+1]-eBands[i]), -1, B, nb_rotations); + int nb_rotations = q <= 2*B ? 2*B/q : 0; + if (nb_rotations != 0) + exp_rotation(P+B*eBands[i], B*(eBands[i+1]-eBands[i]), -1, B, nb_rotations); alg_unquant(X+B*eBands[i], B*(eBands[i+1]-eBands[i]), q, P+B*eBands[i], dec); - exp_rotation(X+B*eBands[i], B*(eBands[i+1]-eBands[i]), 1, B, nb_rotations); + if (nb_rotations != 0) + exp_rotation(X+B*eBands[i], B*(eBands[i+1]-eBands[i]), 1, B, nb_rotations); } for (j=B*eBands[i];j