shithub: opus

Download patch

ref: c4a95d16cf16574299a1800e2007ec3f02a7ae5a
parent: 2b627e12e5587e8cdefed0137b41fb5cac492e8a
author: Jean-Marc Valin <[email protected]>
date: Fri Jul 27 10:42:54 EDT 2012

Enables the second dynalloc MDCT only at complexity 8

Also applies the compensation for tonality boost only when
the analysis is enabled.

--- a/celt/celt.c
+++ b/celt/celt.c
@@ -1357,7 +1357,7 @@
    printf("\n");*/
 
    ALLOC(bandLogE2, C*st->mode->nbEBands, opus_val16);
-   if (shortBlocks)
+   if (shortBlocks && st->complexity>=8)
    {
       VARDECL(celt_sig, freq2);
       VARDECL(opus_val32, bandE2);
@@ -1513,19 +1513,6 @@
          offsets[i] = boost;
       }
    }
-#ifndef FIXED_POINT
-   if (0 && st->analysis.valid)
-   {
-      if (st->analysis.boost_amount[0]>.2)
-         offsets[st->analysis.boost_band[0]]+=2;
-      if (st->analysis.boost_amount[0]>.4)
-         offsets[st->analysis.boost_band[0]]+=2;
-      if (st->analysis.boost_amount[1]>.2)
-         offsets[st->analysis.boost_band[1]]+=2;
-      if (st->analysis.boost_amount[1]>.4)
-         offsets[st->analysis.boost_band[1]]+=2;
-   }
-#endif
    dynalloc_logp = 6;
    total_bits<<=BITRES;
    total_boost = 0;
@@ -1635,8 +1622,6 @@
         target -= MIN32(target/3, SHR16(MULT16_16(st->stereo_saving,(coded_stereo_dof<<BITRES)),8));
         target += MULT16_16_Q15(QCONST16(0.035,15),coded_stereo_dof<<BITRES);
      }
-     /* Compensates for the average tonality boost */
-     target -= MULT16_16_Q15(QCONST16(0.13f,15),coded_bins<<BITRES);
      /* Limits starving of other bands when using dynalloc */
      target += tot_boost;
      /* Compensates for the average transient boost */
@@ -1649,6 +1634,10 @@
      if (st->analysis.valid) {
         int tonal_target;
         float tonal;
+
+        /* Compensates for the average tonality boost */
+        target -= MULT16_16_Q15(QCONST16(0.13f,15),coded_bins<<BITRES);
+
         tonal = MAX16(0,st->analysis.tonality-.2);
         tonal_target = target + (coded_bins<<BITRES)*2.0f*tonal;
         if (pitch_change)