AAC_RENAME_32(ff_mdct_init)(&ac->mdct_small, 8, 1, 1.0 / RANGE15(128.0));
AAC_RENAME_32(ff_mdct_init)(&ac->mdct_ltp, 11, 0, RANGE15(-2.0));
#if !USE_FIXED
- ret = ff_mdct15_init(&ac->mdct480, 1, 5, -1.0f);
+ ret = ff_mdct15_init(&ac->mdct480, 1, 5, -1.0f/(16*1024*960));
if (ret < 0)
return ret;
#endif
}
#if !USE_FIXED
if (n == 480)
- ac->mdct480->imdct_half(ac->mdct480, buf, in, 1, -1.f/(16*1024*960));
+ ac->mdct480->imdct_half(ac->mdct480, buf, in, 1);
else
#endif
ac->mdct.imdct_half(&ac->mdct_ld, buf, in);
}
static void imdct15_half(MDCT15Context *s, float *dst, const float *src,
- ptrdiff_t stride, float scale)
+ ptrdiff_t stride)
{
FFTComplex fft15in[15];
FFTComplex *z = (FFTComplex *)dst;
/* Reindex again, apply twiddles and output */
for (i = 0; i < len8; i++) {
- float re0, im0, re1, im1;
const int i0 = len8 + i, i1 = len8 - i - 1;
const int s0 = s->pfa_postreindex[i0], s1 = s->pfa_postreindex[i1];
- CMUL(re0, im1, s->tmp[s1].im, s->tmp[s1].re, s->twiddle_exptab[i1].im, s->twiddle_exptab[i1].re);
- CMUL(re1, im0, s->tmp[s0].im, s->tmp[s0].re, s->twiddle_exptab[i0].im, s->twiddle_exptab[i0].re);
- z[i1].re = scale * re0;
- z[i1].im = scale * im0;
- z[i0].re = scale * re1;
- z[i0].im = scale * im1;
+ CMUL(z[i1].re, z[i0].im, s->tmp[s1].im, s->tmp[s1].re, s->twiddle_exptab[i1].im, s->twiddle_exptab[i1].re);
+ CMUL(z[i0].re, z[i1].im, s->tmp[s0].im, s->tmp[s0].re, s->twiddle_exptab[i0].im, s->twiddle_exptab[i0].re);
}
}
/* Calculate the middle half of the iMDCT */
void (*imdct_half)(struct MDCT15Context *s, float *dst, const float *src,
- ptrdiff_t src_stride, float scale);
+ ptrdiff_t stride);
} MDCT15Context;
/* Init an (i)MDCT of the length 2 * 15 * (2^N) */
float **output, int channels, int frame_size,
int start_band, int end_band)
{
- int i, j;
+ int i, j, downmix = 0;
int consumed; // bits of entropy consumed thus far for this frame
MDCT15Context *imdct;
- float imdct_scale = 1.0;
if (channels != 1 && channels != 2) {
av_log(f->avctx, AV_LOG_ERROR, "Invalid number of coded channels: %d\n",
/* stereo -> mono downmix */
if (f->output_channels < f->channels) {
f->dsp->vector_fmac_scalar(f->block[0].coeffs, f->block[1].coeffs, 1.0, FFALIGN(frame_size, 16));
- imdct_scale = 0.5;
+ downmix = 1;
} else if (f->output_channels > f->channels)
memcpy(f->block[1].coeffs, f->block[0].coeffs, frame_size * sizeof(float));
float *dst = block->buf + 1024 + j * f->blocksize;
imdct->imdct_half(imdct, dst + CELT_OVERLAP / 2, f->block[i].coeffs + j,
- f->blocks, imdct_scale);
+ f->blocks);
f->dsp->vector_fmul_window(dst, dst, dst + CELT_OVERLAP / 2,
ff_celt_window, CELT_OVERLAP / 2);
}
+ if (downmix)
+ f->dsp->vector_fmul_scalar(&block->buf[1024], &block->buf[1024], 0.5f, frame_size);
+
/* postfilter */
celt_postfilter(f, block);