Making the modified transient code work with stereo as well

This commit is contained in:
Jean-Marc Valin 2009-05-30 10:09:06 -04:00
parent 18c1c22e16
commit e4c05a4d74

View file

@ -547,15 +547,18 @@ int celt_encode_float(CELTEncoder * restrict st, const celt_sig_t * pcm, celt_si
compute_mdcts(st->mode, shortBlocks, in, freq);
if (shortBlocks && !transient_shift)
{
celt_word32_t sum[4];
int m=0;
celt_word32_t sum[4]={1,1,1,1};
int m;
for (c=0;c<C;c++)
{
m=0;
do {
sum[m] = 1;
celt_word32_t tmp=0;
for (i=m;i<N;i+=st->mode->nbShortMdcts)
for (i=m*C+c;i<N;i+=C*st->mode->nbShortMdcts)
tmp += ABS32(freq[i]);
sum[m++] = tmp;
sum[m++] += tmp;
} while (m<st->mode->nbShortMdcts);
}
m=0;
#ifdef FIXED_POINT
do {
@ -570,8 +573,13 @@ int celt_encode_float(CELTEncoder * restrict st, const celt_sig_t * pcm, celt_si
}
m++;
} while (m<st->mode->nbShortMdcts-1);
for (i=1;i<N;i+=2)
if (mdct_weight_shift)
{
for (c=0;c<C;c++)
for (m=mdct_weight_pos+1;m<st->mode->nbShortMdcts;m++)
for (i=m*C+c;i<N;i+=C*st->mode->nbShortMdcts)
freq[i] = SHR32(freq[i],mdct_weight_shift);
}
#else
do {
if (sum[m+1] > 8*sum[m])
@ -587,8 +595,9 @@ int celt_encode_float(CELTEncoder * restrict st, const celt_sig_t * pcm, celt_si
} while (m<st->mode->nbShortMdcts-1);
if (mdct_weight_shift)
{
for (c=0;c<C;c++)
for (m=mdct_weight_pos+1;m<st->mode->nbShortMdcts;m++)
for (i=m;i<N;i+=st->mode->nbShortMdcts)
for (i=m*C+c;i<N;i+=C*st->mode->nbShortMdcts)
freq[i] = (1./(1<<mdct_weight_shift))*freq[i];
}
#endif
@ -793,8 +802,9 @@ int celt_encode_float(CELTEncoder * restrict st, const celt_sig_t * pcm, celt_si
if (mdct_weight_shift)
{
int m;
for (c=0;c<C;c++)
for (m=mdct_weight_pos+1;m<st->mode->nbShortMdcts;m++)
for (i=m;i<N;i+=st->mode->nbShortMdcts)
for (i=m*C+c;i<N;i+=C*st->mode->nbShortMdcts)
#ifdef FIXED_POINT
freq[i] = SHL32(freq[i], mdct_weight_shift);
#else
@ -1251,8 +1261,9 @@ int celt_decode_float(CELTDecoder * restrict st, const unsigned char *data, int
if (mdct_weight_shift)
{
int m;
for (c=0;c<C;c++)
for (m=mdct_weight_pos+1;m<st->mode->nbShortMdcts;m++)
for (i=m;i<N;i+=st->mode->nbShortMdcts)
for (i=m*C+c;i<N;i+=C*st->mode->nbShortMdcts)
#ifdef FIXED_POINT
freq[i] = SHL32(freq[i], mdct_weight_shift);
#else