Running transient_analysis() even for 2.5 ms frames
authorJean-Marc Valin <jmvalin@jmvalin.ca>
Tue, 20 Nov 2012 04:17:06 +0000 (23:17 -0500)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Sun, 10 Feb 2013 05:15:49 +0000 (00:15 -0500)
This means 2.5 ms frames can now use a higher bitrate for transients.

celt/celt_encoder.c

index fd81136..1b5426a 100644 (file)
@@ -1298,16 +1298,18 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm,
 
    isTransient = 0;
    shortBlocks = 0;
+   if (st->complexity >= 1)
+   {
+      isTransient = transient_analysis(in, N+st->overlap, CC,
+            &tf_estimate, &tf_chan);
+   }
    if (LM>0 && ec_tell(enc)+3<=total_bits)
    {
-      if (st->complexity >= 1)
-      {
-         isTransient = transient_analysis(in, N+st->overlap, CC,
-                  &tf_estimate, &tf_chan);
-         if (isTransient)
-            shortBlocks = M;
-      }
+      if (isTransient)
+         shortBlocks = M;
       ec_enc_bit_logp(enc, isTransient, 3);
+   } else {
+      isTransient = 0;
    }
 
    ALLOC(freq, CC*N, celt_sig); /**< Interleaved signal MDCTs */