shithub: opus

Download patch

ref: 5f807c176fd9bc395f5e1cd030dfca3f0b14ba9f
parent: 9d1b6fef2a8a8cc4a57af6bf8bed2fed645dea80
author: Jean-Marc Valin <[email protected]>
date: Mon Jan 6 23:48:42 EST 2014

Adds SMALL_FOOTPRINT hack to the CELT PLC too

--- a/celt/celt_decoder.c
+++ b/celt/celt_decoder.c
@@ -442,7 +442,11 @@
    if (noise_based)
    {
       /* Noise-based PLC/CNG */
+#ifdef SMALL_FOOTPRINT
+      celt_norm *X;
+#else
       VARDECL(celt_norm, X);
+#endif
       opus_uint32 seed;
       opus_val16 *plcLogE;
       int end;
@@ -451,9 +455,13 @@
       end = st->end;
       effEnd = IMAX(start, IMIN(end, mode->effEBands));
 
-      /* Share the interleaved signal MDCT coefficient buffer with the
-         deemphasis scratch buffer. */
+#ifdef SMALL_FOOTPRINT
+      /* This is an ugly hack that breaks aliasing rules and would be easily broken,
+         but it saves almost 4kB of stack. */
+      X = (celt_norm*)(out_syn[C-1]+overlap/2);
+#else
       ALLOC(X, C*N, celt_norm);   /**< Interleaved normalised MDCTs */
+#endif
 
       if (loss_count >= 5)
          plcLogE = backgroundLogE;