shithub: opus

Download patch

ref: 7aa9d8c7ae491259f4094877facca36934058dd7
parent: 62290065100f4f7af379b839deb54089847900c0
author: Jean-Marc Valin <[email protected]>
date: Sun Apr 20 20:04:23 EDT 2008

Saved some memory by reducing the size of some arrays to only what's needed.
Typically saves 768 bytes.

--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -100,8 +100,8 @@
 
    st->fft = pitch_state_alloc(MAX_PERIOD);
    
-   st->in_mem = celt_alloc(N*C*sizeof(celt_sig_t));
-   st->mdct_overlap = celt_alloc(N*C*sizeof(celt_sig_t));
+   st->in_mem = celt_alloc(st->overlap*C*sizeof(celt_sig_t));
+   st->mdct_overlap = celt_alloc(st->overlap*C*sizeof(celt_sig_t));
    st->out_mem = celt_alloc(MAX_PERIOD*C*sizeof(celt_sig_t));
 
    st->oldBandE = (celt_word16_t*)celt_alloc(C*mode->nbEBands*sizeof(celt_word16_t));
@@ -474,7 +474,7 @@
    st->block_size = N;
    st->overlap = mode->overlap;
 
-   st->mdct_overlap = celt_alloc(N*C*sizeof(celt_sig_t));
+   st->mdct_overlap = celt_alloc(st->overlap*C*sizeof(celt_sig_t));
    st->out_mem = celt_alloc(MAX_PERIOD*C*sizeof(celt_sig_t));
    
    st->oldBandE = (celt_word16_t*)celt_alloc(C*mode->nbEBands*sizeof(celt_word16_t));