[FFmpeg-cvslog] opusenc: fix coarse energy quantization with 2 bits left

Rostislav Pehlivanov git at videolan.org
Thu Feb 16 00:52:31 EET 2017


ffmpeg | branch: master | Rostislav Pehlivanov <atomnuker at gmail.com> | Wed Feb 15 22:51:37 2017 +0000| [3fc86f0d69d3cb1d8e81f5de3f24a7b4c782fa95] | committer: Rostislav Pehlivanov

opusenc: fix coarse energy quantization with 2 bits left

Fixes CID1400584

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

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

 libavcodec/opusenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/opusenc.c b/libavcodec/opusenc.c
index 985b41c..1a829ed 100644
--- a/libavcodec/opusenc.c
+++ b/libavcodec/opusenc.c
@@ -667,7 +667,7 @@ static void celt_quant_coarse(OpusEncContext *s, OpusRangeCoder *rc, CeltFrame *
                 ff_opus_rc_enc_laplace(rc, &q_en, pmod[i << 1] << 7, pmod[(i << 1) + 1] << 6);
             } else if (left >= 2) {
                 q_en = av_clip(q_en, -1, 1);
-                ff_opus_rc_enc_cdf(rc, ((q_en & 1) << 1) | (q_en < 0), ff_celt_model_energy_small);
+                ff_opus_rc_enc_cdf(rc, 2*q_en + 3*(q_en < 0), ff_celt_model_energy_small);
             } else if (left >= 1) {
                 q_en = av_clip(q_en, -1, 0);
                 ff_opus_rc_enc_log(rc, (q_en & 1), 1);



More information about the ffmpeg-cvslog mailing list