From f54a0a39e5031713a778e003fdd4c74e560f7d92 Mon Sep 17 00:00:00 2001
From: Jean-Marc Valin <jean-marc.valin@octasic.com>
Date: Fri, 13 May 2011 17:36:31 -0400
Subject: [PATCH] Reduces the PLC array sizes to what's necessary

---
 libcelt/celt.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libcelt/celt.c b/libcelt/celt.c
index 750c6def7..58ae2ece7 100644
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -2124,14 +2124,15 @@ static void celt_decode_lost(CELTDecoder * restrict st, celt_word16 * restrict p
    if (plc)
    {
       c=0; do {
-         /* FIXME: This is more memory than necessary */
-         celt_word32 e[2*MAX_PERIOD];
-         celt_word16 exc[2*MAX_PERIOD];
+         VARDECL(celt_word32, e);
+         celt_word16 exc[MAX_PERIOD];
          celt_word32 ac[LPC_ORDER+1];
          celt_word16 decay = 1;
          celt_word32 S1=0;
          celt_word16 mem[LPC_ORDER]={0};
 
+         ALLOC(e, MAX_PERIOD+2*st->mode->overlap, celt_word32);
+
          offset = MAX_PERIOD-pitch_index;
          for (i=0;i<MAX_PERIOD;i++)
             exc[i] = ROUND16(out_mem[c][i], SIG_SHIFT);
-- 
GitLab