Making anti-collapse a bit more conservative again
authorJean-Marc Valin <jean-marc.valin@octasic.com>
Thu, 27 Jan 2011 23:05:47 +0000 (18:05 -0500)
committerJean-Marc Valin <jean-marc.valin@octasic.com>
Thu, 27 Jan 2011 23:05:47 +0000 (18:05 -0500)
The energy memory can be lowered (not increased) during a transient

libcelt/celt.c

index 180ffa0..1f0c04a 100644 (file)
@@ -1424,6 +1424,9 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, i
          oldLogE2[i] = oldLogE[i];
       for (i=0;i<C*st->mode->nbEBands;i++)
          oldLogE[i] = oldBandE[i];
+   } else {
+      for (i=0;i<C*st->mode->nbEBands;i++)
+         oldLogE[i] = MIN16(oldLogE[i], oldBandE[i]);
    }
    if (isTransient)
       st->consec_transient++;
@@ -2245,6 +2248,9 @@ int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *da
          oldLogE[i] = oldBandE[i];
       for (i=0;i<C*st->mode->nbEBands;i++)
          backgroundLogE[i] = MIN16(backgroundLogE[i] + M*QCONST16(0.001f,DB_SHIFT), oldBandE[i]);
+   } else {
+      for (i=0;i<C*st->mode->nbEBands;i++)
+         oldLogE[i] = MIN16(oldLogE[i], oldBandE[i]);
    }
    st->rng = dec->rng;