More quant_band() reorganisation.

This commit is contained in:
Jean-Marc Valin 2010-09-13 15:06:35 -04:00
parent a18c75e55a
commit a5ce03fe8a

View file

@ -534,10 +534,11 @@ static void quant_band(int encode, const CELTMode *m, int i, celt_norm *X, celt_
if (!stereo && level == 0) if (!stereo && level == 0)
{ {
int k;
if (tf_change>0)
recombine = tf_change;
/* Band recombining to increase frequency resolution */ /* Band recombining to increase frequency resolution */
if (!stereo && B > 1 && level == 0 && tf_change>0) for (k=0;k<recombine;k++)
{
while (B>1 && tf_change>0)
{ {
B>>=1; B>>=1;
N_B<<=1; N_B<<=1;
@ -545,17 +546,10 @@ static void quant_band(int encode, const CELTMode *m, int i, celt_norm *X, celt_
haar1(X, N_B, B); haar1(X, N_B, B);
if (lowband) if (lowband)
haar1(lowband, N_B, B); haar1(lowband, N_B, B);
recombine++;
tf_change--;
}
B0=B;
N_B0 = N_B;
} }
/* Increasing the time resolution */ /* Increasing the time resolution */
if (!stereo && level==0) while ((N_B&1) == 0 && tf_change<0)
{
while ((N_B&1) == 0 && tf_change<0 && B <= (1<<LM))
{ {
if (encode) if (encode)
haar1(X, N_B, B); haar1(X, N_B, B);
@ -566,12 +560,11 @@ static void quant_band(int encode, const CELTMode *m, int i, celt_norm *X, celt_
time_divide++; time_divide++;
tf_change++; tf_change++;
} }
B0 = B; B0=B;
N_B0 = N_B; N_B0 = N_B;
}
/* Reorganize the samples in time order instead of frequency order */ /* Reorganize the samples in time order instead of frequency order */
if (!stereo && B0>1 && level==0) if (B0>1)
{ {
if (encode) if (encode)
deinterleave_vector(X, N_B, B0); deinterleave_vector(X, N_B, B0);