From 9d069846eeee8517c2cb97cd6e8e81cb4e34424c Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin <jean-marc.valin@usherbrooke.ca> Date: Tue, 25 May 2010 23:54:56 -0400 Subject: [PATCH] More recombining "infrastructure" --- libcelt/bands.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/libcelt/bands.c b/libcelt/bands.c index 4603c97e5..49f926266 100644 --- a/libcelt/bands.c +++ b/libcelt/bands.c @@ -492,7 +492,7 @@ static void quant_band(int encode, const CELTMode *m, int i, celt_norm *X, celt_ if (!stereo && spread > 1 && level == 0 && tf_change>0) { - while (spread>1 && recombine<2) + while (spread>1 && tf_change>0) { spread>>=1; N_B<<=1; @@ -501,6 +501,7 @@ static void quant_band(int encode, const CELTMode *m, int i, celt_norm *X, celt_ if (lowband) haar1(lowband, N_B, spread); recombine++; + tf_change--; } spread0=spread; N_B0 = N_B; @@ -508,22 +509,26 @@ static void quant_band(int encode, const CELTMode *m, int i, celt_norm *X, celt_ if (!stereo && spread>1 && level==0) { - if ((N_B&1) == 0 && tf_change<0) + while ((N_B&1) == 0 && tf_change<0 && spread <= (1<<LM)) { if (encode) - haar1(X, N_B0, spread0); + haar1(X, N_B, spread); if (lowband) - haar1(lowband, N_B0, spread0); + haar1(lowband, N_B, spread); spread <<= 1; N_B >>= 1; time_divide++; - spread0 = spread; - N_B0 = N_B; + tf_change++; + } + spread0 = spread; + N_B0 = N_B; + if (spread0>1) + { + if (encode) + deinterleave_vector(X, N_B, spread0); + if (lowband) + deinterleave_vector(lowband, N_B, spread0); } - if (encode) - deinterleave_vector(X, N_B, spread0); - if (lowband) - deinterleave_vector(lowband, N_B, spread0); } /* If we need more than 32 bits, try splitting the band in two. */ -- GitLab