From 0918365b5141780969e2a09608a11d91228b502e Mon Sep 17 00:00:00 2001
From: Jean-Marc Valin <jmvalin@jmvalin.ca>
Date: Wed, 4 Jul 2012 19:21:42 -0400
Subject: [PATCH] Fixes a VBR bug with 2.5 ms frames

tf_estimate was being initialized to zero and then never set because
transient_analysis() wasn't being called. This could also have affected
other frame sizes at lower complexity.
---
 celt/celt.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/celt/celt.c b/celt/celt.c
index efe12c4ef..77df61f7a 100644
--- a/celt/celt.c
+++ b/celt/celt.c
@@ -293,7 +293,7 @@ static inline opus_val16 SIG2WORD16(celt_sig x)
 }
 
 static int transient_analysis(const opus_val32 * restrict in, int len, int C,
-                              int overlap, opus_val16 *tf_estimate, int *tf_chan, AnalysisInfo *analysis)
+                              int overlap, float *tf_estimate, int *tf_chan, AnalysisInfo *analysis)
 {
    int i;
    VARDECL(opus_val16, tmp);
@@ -317,7 +317,6 @@ static int transient_analysis(const opus_val32 * restrict in, int len, int C,
    N=len/block-1;
    ALLOC(bins, N, opus_val16);
 
-   *tf_estimate = 0;
    tf_max = 0;
    for (c=0;c<C;c++)
    {
@@ -983,7 +982,7 @@ int celt_encode_with_ec(CELTEncoder * restrict st, const opus_val16 * pcm, int f
    int anti_collapse_on=0;
    int silence=0;
    int tf_chan = 0;
-   opus_val16 tf_estimate=0;
+   float tf_estimate=1;
    opus_val16 stereo_saving = 0;
    int pitch_change=0;
    opus_int32 tot_boost=0;
-- 
GitLab