Making the modified transient code work with stereo as well
This commit is contained in:
parent
18c1c22e16
commit
e4c05a4d74
1 changed files with 33 additions and 22 deletions
|
@ -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);
|
compute_mdcts(st->mode, shortBlocks, in, freq);
|
||||||
if (shortBlocks && !transient_shift)
|
if (shortBlocks && !transient_shift)
|
||||||
{
|
{
|
||||||
celt_word32_t sum[4];
|
celt_word32_t sum[4]={1,1,1,1};
|
||||||
int m=0;
|
int m;
|
||||||
do {
|
for (c=0;c<C;c++)
|
||||||
sum[m] = 1;
|
{
|
||||||
celt_word32_t tmp=0;
|
m=0;
|
||||||
for (i=m;i<N;i+=st->mode->nbShortMdcts)
|
do {
|
||||||
tmp += ABS32(freq[i]);
|
celt_word32_t tmp=0;
|
||||||
sum[m++] = tmp;
|
for (i=m*C+c;i<N;i+=C*st->mode->nbShortMdcts)
|
||||||
} while (m<st->mode->nbShortMdcts);
|
tmp += ABS32(freq[i]);
|
||||||
|
sum[m++] += tmp;
|
||||||
|
} while (m<st->mode->nbShortMdcts);
|
||||||
|
}
|
||||||
m=0;
|
m=0;
|
||||||
#ifdef FIXED_POINT
|
#ifdef FIXED_POINT
|
||||||
do {
|
do {
|
||||||
|
@ -570,8 +573,13 @@ int celt_encode_float(CELTEncoder * restrict st, const celt_sig_t * pcm, celt_si
|
||||||
}
|
}
|
||||||
m++;
|
m++;
|
||||||
} while (m<st->mode->nbShortMdcts-1);
|
} while (m<st->mode->nbShortMdcts-1);
|
||||||
for (i=1;i<N;i+=2)
|
if (mdct_weight_shift)
|
||||||
freq[i] = SHR32(freq[i],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
|
#else
|
||||||
do {
|
do {
|
||||||
if (sum[m+1] > 8*sum[m])
|
if (sum[m+1] > 8*sum[m])
|
||||||
|
@ -587,9 +595,10 @@ int celt_encode_float(CELTEncoder * restrict st, const celt_sig_t * pcm, celt_si
|
||||||
} while (m<st->mode->nbShortMdcts-1);
|
} while (m<st->mode->nbShortMdcts-1);
|
||||||
if (mdct_weight_shift)
|
if (mdct_weight_shift)
|
||||||
{
|
{
|
||||||
for (m=mdct_weight_pos+1;m<st->mode->nbShortMdcts;m++)
|
for (c=0;c<C;c++)
|
||||||
for (i=m;i<N;i+=st->mode->nbShortMdcts)
|
for (m=mdct_weight_pos+1;m<st->mode->nbShortMdcts;m++)
|
||||||
freq[i] = (1./(1<<mdct_weight_shift))*freq[i];
|
for (i=m*C+c;i<N;i+=C*st->mode->nbShortMdcts)
|
||||||
|
freq[i] = (1./(1<<mdct_weight_shift))*freq[i];
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/*printf ("%f\n", short_ratio);*/
|
/*printf ("%f\n", short_ratio);*/
|
||||||
|
@ -793,12 +802,13 @@ int celt_encode_float(CELTEncoder * restrict st, const celt_sig_t * pcm, celt_si
|
||||||
if (mdct_weight_shift)
|
if (mdct_weight_shift)
|
||||||
{
|
{
|
||||||
int m;
|
int m;
|
||||||
for (m=mdct_weight_pos+1;m<st->mode->nbShortMdcts;m++)
|
for (c=0;c<C;c++)
|
||||||
for (i=m;i<N;i+=st->mode->nbShortMdcts)
|
for (m=mdct_weight_pos+1;m<st->mode->nbShortMdcts;m++)
|
||||||
|
for (i=m*C+c;i<N;i+=C*st->mode->nbShortMdcts)
|
||||||
#ifdef FIXED_POINT
|
#ifdef FIXED_POINT
|
||||||
freq[i] = SHL32(freq[i], mdct_weight_shift);
|
freq[i] = SHL32(freq[i], mdct_weight_shift);
|
||||||
#else
|
#else
|
||||||
freq[i] = (1<<mdct_weight_shift)*freq[i];
|
freq[i] = (1<<mdct_weight_shift)*freq[i];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
compute_inv_mdcts(st->mode, shortBlocks, freq, transient_time, transient_shift, st->out_mem);
|
compute_inv_mdcts(st->mode, shortBlocks, freq, transient_time, transient_shift, st->out_mem);
|
||||||
|
@ -1251,12 +1261,13 @@ int celt_decode_float(CELTDecoder * restrict st, const unsigned char *data, int
|
||||||
if (mdct_weight_shift)
|
if (mdct_weight_shift)
|
||||||
{
|
{
|
||||||
int m;
|
int m;
|
||||||
for (m=mdct_weight_pos+1;m<st->mode->nbShortMdcts;m++)
|
for (c=0;c<C;c++)
|
||||||
for (i=m;i<N;i+=st->mode->nbShortMdcts)
|
for (m=mdct_weight_pos+1;m<st->mode->nbShortMdcts;m++)
|
||||||
|
for (i=m*C+c;i<N;i+=C*st->mode->nbShortMdcts)
|
||||||
#ifdef FIXED_POINT
|
#ifdef FIXED_POINT
|
||||||
freq[i] = SHL32(freq[i], mdct_weight_shift);
|
freq[i] = SHL32(freq[i], mdct_weight_shift);
|
||||||
#else
|
#else
|
||||||
freq[i] = (1<<mdct_weight_shift)*freq[i];
|
freq[i] = (1<<mdct_weight_shift)*freq[i];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
/* Compute inverse MDCTs */
|
/* Compute inverse MDCTs */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue