Restructuring in quant_band()

This commit is contained in:
Jean-Marc Valin 2010-09-13 14:59:13 -04:00
parent 293b9f1977
commit a18c75e55a

View file

@ -532,6 +532,8 @@ static void quant_band(int encode, const CELTMode *m, int i, celt_norm *X, celt_
return;
}
if (!stereo && level == 0)
{
/* Band recombining to increase frequency resolution */
if (!stereo && B > 1 && level == 0 && tf_change>0)
{
@ -576,6 +578,7 @@ static void quant_band(int encode, const CELTMode *m, int i, celt_norm *X, celt_
if (lowband)
deinterleave_vector(lowband, N_B, B0);
}
}
/* If we need more than 32 bits, try splitting the band in two. */
if (!stereo && LM != -1 && b > 32<<BITRES && N>2)
@ -801,11 +804,16 @@ static void quant_band(int encode, const CELTMode *m, int i, celt_norm *X, celt_
/* This code is used by the decoder and by the resynthesis-enabled encoder */
if (resynth)
{
if (stereo)
{
stereo_merge(X, Y, mid, side, N);
} else if (level == 0)
{
int k;
/* Undo the sample reorganization going from time order to frequency order */
if (!stereo && B0>1 && level==0)
if (B0>1)
{
interleave_vector(X, N_B, B0);
if (lowband)
@ -834,7 +842,7 @@ static void quant_band(int encode, const CELTMode *m, int i, celt_norm *X, celt_
}
/* Scale output for later folding */
if (lowband_out && !stereo)
if (lowband_out)
{
int j;
celt_word16 n;
@ -842,9 +850,7 @@ static void quant_band(int encode, const CELTMode *m, int i, celt_norm *X, celt_
for (j=0;j<N0;j++)
lowband_out[j] = MULT16_16_Q15(n,X[j]);
}
if (stereo)
stereo_merge(X, Y, mid, side, N);
}
}
}