shithub: opus

Download patch

ref: a7aa7fb382416ff257ab352c3b9cf3d46da51f56
parent: 843121b356685ff5a8c40211951f392f77f689cc
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Wed Feb 13 06:48:20 EST 2019

Fixing initialization issues on small frame sizes

--- a/src/analysis.c
+++ b/src/analysis.c
@@ -488,7 +488,11 @@
     int is_silence;
     SAVE_STACK;
 
-    tonal->initialized = 1;
+    if (!tonal->initialized)
+    {
+       tonal->mem_fill = 240;
+       tonal->initialized = 1;
+    }
     alpha = 1.f/IMIN(10, 1+tonal->count);
     alphaE = 1.f/IMIN(25, 1+tonal->count);
     /* Noise floor related decay for bandwidth detection: -2.2 dB/second */
@@ -506,8 +510,6 @@
     }
 
     kfft = celt_mode->mdct.kfft[0];
-    if (tonal->count==0)
-       tonal->mem_fill = 240;
     tonal->hp_ener_accum += (float)downmix_and_resample(downmix, x,
           &tonal->inmem[tonal->mem_fill], tonal->downmix_state,
           IMIN(len, ANALYSIS_BUF_SIZE-tonal->mem_fill), offset, c1, c2, C, tonal->Fs);