summaryrefslogtreecommitdiff
path: root/libavcodec/opus_celt.c
diff options
context:
space:
mode:
authorRostislav Pehlivanov <atomnuker@gmail.com>2017-07-11 21:29:22 +0100
committerRostislav Pehlivanov <atomnuker@gmail.com>2017-07-11 21:36:48 +0100
commitaef5f9ab05c3acad2cc5d141686a76c974c8927b (patch)
treecf2ab26f80878ca5c5076e586d10a54d3741cf67 /libavcodec/opus_celt.c
parent02d248d5828dbbfecfb37597c626900f41448bea (diff)
downloadffmpeg-aef5f9ab05c3acad2cc5d141686a76c974c8927b.tar.gz
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: Rostislav Pehlivanov <atomnuker@gmail.com>
Diffstat (limited to 'libavcodec/opus_celt.c')
-rw-r--r--libavcodec/opus_celt.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/opus_celt.c b/libavcodec/opus_celt.c
index 3de92f0cb2..13bfe986be 100644
--- a/libavcodec/opus_celt.c
+++ b/libavcodec/opus_celt.c
@@ -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);