[FFmpeg-cvslog] opus_celt: normalize using mdct scale

Rostislav Pehlivanov git at videolan.org
Tue Jul 11 23:37:49 EEST 2017


ffmpeg | branch: master | Rostislav Pehlivanov <atomnuker at gmail.com> | Tue Jul 11 21:30:41 2017 +0100| [594cd1f38a7bbd15fb25529701000ef0b5d1ac12] | committer: Rostislav Pehlivanov

opus_celt: normalize using mdct scale

Removes a per-sample divide in the IIR filter deemphasis filter.

Signed-off-by: Rostislav Pehlivanov <atomnuker at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=594cd1f38a7bbd15fb25529701000ef0b5d1ac12
---

 libavcodec/opus_celt.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavcodec/opus_celt.c b/libavcodec/opus_celt.c
index 13bfe986be..0177b123b1 100644
--- a/libavcodec/opus_celt.c
+++ b/libavcodec/opus_celt.c
@@ -907,10 +907,11 @@ int ff_celt_decode_frame(CeltFrame *f, OpusRangeCoder *rc,
 
         /* deemphasis and output scaling */
         for (j = 0; j < frame_size; j++) {
-            float tmp = block->buf[1024 - frame_size + j] + m;
+            const float tmp = block->buf[1024 - frame_size + j] + m;
             m = tmp * CELT_EMPH_COEFF;
-            output[i][j] = tmp / 32768.;
+            output[i][j] = tmp;
         }
+
         block->emph_coeff = m;
     }
 
@@ -1006,7 +1007,7 @@ int ff_celt_init(AVCodecContext *avctx, CeltFrame **f, int output_channels)
     frm->output_channels = output_channels;
 
     for (i = 0; i < FF_ARRAY_ELEMS(frm->imdct); i++)
-        if ((ret = ff_mdct15_init(&frm->imdct[i], 1, i + 3, -1.0f)) < 0)
+        if ((ret = ff_mdct15_init(&frm->imdct[i], 1, i + 3, -1.0f/32768)) < 0)
             goto fail;
 
     if ((ret = ff_celt_pvq_init(&frm->pvq)) < 0)



More information about the ffmpeg-cvslog mailing list