No longer filling the stereo side with noise.

This commit is contained in:
Jean-Marc Valin 2010-10-13 11:48:17 -04:00
parent ccd5a61a69
commit ccd51fe947
2 changed files with 27 additions and 20 deletions

View file

@ -909,7 +909,6 @@ void quant_all_bands(int encode, const CELTMode *m, int start, int end, celt_nor
int curr_balance; int curr_balance;
celt_norm * restrict X, * restrict Y; celt_norm * restrict X, * restrict Y;
int tf_change=0; int tf_change=0;
celt_norm *effective_lowband;
X = _X+M*eBands[i]; X = _X+M*eBands[i];
if (_Y!=NULL) if (_Y!=NULL)
@ -953,12 +952,8 @@ void quant_all_bands(int encode, const CELTMode *m, int start, int end, celt_nor
Y = norm; Y = norm;
} }
if (tf_change==0 && !shortBlocks && fold==2)
effective_lowband = NULL;
else
effective_lowband = lowband;
quant_band(encode, m, i, X, Y, N, b, fold, B, tf_change, quant_band(encode, m, i, X, Y, N, b, fold, B, tf_change,
effective_lowband, resynth, ec, &remaining_bits, LM, lowband, resynth, ec, &remaining_bits, LM,
norm+M*eBands[i], bandE, 0, &seed, Q15ONE, lowband_scratch); norm+M*eBands[i], bandE, 0, &seed, Q15ONE, lowband_scratch);
balance += pulses[i] + tell; balance += pulses[i] + tell;

View file

@ -183,17 +183,23 @@ void alg_quant(celt_norm *X, int N, int K, int spread, int B, celt_norm *lowband
{ {
if (lowband != NULL && resynth) if (lowband != NULL && resynth)
{ {
for (j=0;j<N;j++) if (spread==2 && B<=1)
X[j] = lowband[j]; {
for (j=0;j<N;j++)
{
*seed = lcg_rand(*seed);
X[j] = (int)(*seed)>>20;
}
} else {
for (j=0;j<N;j++)
X[j] = lowband[j];
}
renormalise_vector(X, N, gain);
} else { } else {
/* This is important for encoding the side in stereo mode */ /* This is important for encoding the side in stereo mode */
for (j=0;j<N;j++) for (j=0;j<N;j++)
{ X[j] = 0;
*seed = lcg_rand(*seed);
X[j] = (int)(*seed)>>20;
}
} }
renormalise_vector(X, N, gain);
return; return;
} }
K = get_pulses(K); K = get_pulses(K);
@ -361,17 +367,23 @@ void alg_unquant(celt_norm *X, int N, int K, int spread, int B,
{ {
if (lowband != NULL) if (lowband != NULL)
{ {
for (i=0;i<N;i++) if (spread==2 && B<=1)
X[i] = lowband[i]; {
for (i=0;i<N;i++)
{
*seed = lcg_rand(*seed);
X[i] = (int)(*seed)>>20;
}
} else {
for (i=0;i<N;i++)
X[i] = lowband[i];
}
renormalise_vector(X, N, gain);
} else { } else {
/* This is important for encoding the side in stereo mode */ /* This is important for encoding the side in stereo mode */
for (i=0;i<N;i++) for (i=0;i<N;i++)
{ X[i] = 0;
*seed = lcg_rand(*seed);
X[i] = (int)(*seed)>>20;
}
} }
renormalise_vector(X, N, gain);
return; return;
} }
K = get_pulses(K); K = get_pulses(K);