From 817220e91d67215ed3d21ef683f5b605fed12544 Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin <jean-marc.valin@usherbrooke.ca> Date: Mon, 8 Aug 2011 11:33:17 -0400 Subject: [PATCH] Using a more conservative trim (just in case) following Greg's last patch --- libcelt/celt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libcelt/celt.c b/libcelt/celt.c index ad4ef6013..77301a11f 100644 --- a/libcelt/celt.c +++ b/libcelt/celt.c @@ -840,7 +840,9 @@ static int alloc_trim_analysis(const CELTMode *m, const celt_norm *X, diff += bandLogE[i+c*m->nbEBands]*(opus_int32)(2+2*i-m->nbEBands); } } while (++c<C); - diff /= C*(end-1); + /* We divide by two here to avoid making the tilt larger for stereo as a + result of a bug in the loop above */ + diff /= 2*C*(end-1); /*printf("%f\n", diff);*/ if (diff > QCONST16(2.f, DB_SHIFT)) trim_index--; -- GitLab