Commit aef5f9ab authored by Rostislav Pehlivanov's avatar Rostislav Pehlivanov

mdct15: remove redundant scale argument to imdct_half

The only use of that argument was for Opus downmixing which is very rare
and better done after the mdcts.
Signed-off-by: 's avatarRostislav Pehlivanov <atomnuker@gmail.com>
parent 02d248d5
......@@ -1211,7 +1211,7 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
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
......@@ -2664,7 +2664,7 @@ static void imdct_and_windowing_eld(AACContext *ac, SingleChannelElement *sce)
}
#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);
......
......@@ -207,7 +207,7 @@ static void mdct15(MDCT15Context *s, float *dst, const float *src, ptrdiff_t str
}
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;
......@@ -230,16 +230,11 @@ static void imdct15_half(MDCT15Context *s, float *dst, const float *src,
/* 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);
}
}
......
......@@ -47,7 +47,7 @@ typedef struct MDCT15Context {
/* 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) */
......
......@@ -775,10 +775,9 @@ int ff_celt_decode_frame(CeltFrame *f, OpusRangeCoder *rc,
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",
......@@ -870,7 +869,7 @@ int ff_celt_decode_frame(CeltFrame *f, OpusRangeCoder *rc,
/* 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));
......@@ -895,11 +894,14 @@ int ff_celt_decode_frame(CeltFrame *f, OpusRangeCoder *rc,
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment