]> git.sesse.net Git - ffmpeg/commitdiff
opusenc: do not signal digital silence
authorRostislav Pehlivanov <atomnuker@gmail.com>
Fri, 7 Apr 2017 23:48:28 +0000 (00:48 +0100)
committerRostislav Pehlivanov <atomnuker@gmail.com>
Fri, 7 Apr 2017 23:48:28 +0000 (00:48 +0100)
Apparently its only use is to enable comfort noise/error recovery.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
libavcodec/opusenc.c

index d80ae7a5e45906e48abf1ee4f119565e8f23a50d..4e0781bf512cf0acb1130519a954fff49a425b08 100644 (file)
@@ -249,9 +249,9 @@ static void celt_frame_mdct(OpusEncContext *s, CeltFrame *f)
 }
 
 /* Fills the bands and normalizes them */
-static int celt_frame_map_norm_bands(OpusEncContext *s, CeltFrame *f)
+static void celt_frame_map_norm_bands(OpusEncContext *s, CeltFrame *f)
 {
-    int i, j, ch, noise = 0;
+    int i, j, ch;
 
     for (ch = 0; ch < f->channels; ch++) {
         CeltBlock *block = &f->block[ch];
@@ -274,10 +274,8 @@ static int celt_frame_map_norm_bands(OpusEncContext *s, CeltFrame *f)
 
             /* CELT_ENERGY_SILENCE is what the decoder uses and its not -infinity */
             block->energy[i] = FFMAX(block->energy[i], CELT_ENERGY_SILENCE);
-            noise |= block->energy[i] > CELT_ENERGY_SILENCE;
         }
     }
-    return !noise;
 }
 
 static void celt_enc_tf(OpusRangeCoder *rc, CeltFrame *f)
@@ -811,11 +809,7 @@ static void celt_encode_frame(OpusEncContext *s, OpusRangeCoder *rc, CeltFrame *
         /* Not implemented */
     }
     celt_frame_mdct(s, f);
-    f->silence = celt_frame_map_norm_bands(s, f);
-    if (f->silence) {
-        f->framebits = 1;
-        return;
-    }
+    celt_frame_map_norm_bands(s, f);
 
     ff_opus_rc_enc_log(rc, f->silence, 15);