ref: 9b9e98625c89b943c402eacf480f6444905f790a
parent: cac91ec4dbb4466c5f417ade44e5ca11501da129
author: Jean-Marc Valin <[email protected]>
date: Fri Feb 29 12:07:53 EST 2008
Bit of memory reduction in the pitch search. More needed.
--- a/libcelt/pitch.c
+++ b/libcelt/pitch.c
@@ -49,7 +49,6 @@
int c, i;
float max_corr;
VARDECL(celt_word32_t *xx);
- VARDECL(celt_word32_t *yy);
VARDECL(celt_word32_t *X);
VARDECL(celt_word32_t *Y);
VARDECL(celt_mask_t *curve);
@@ -56,7 +55,6 @@
SAVE_STACK;
int n2 = lag/2;
ALLOC(xx, lag*C, celt_word32_t);
- ALLOC(yy, lag*C, celt_word32_t);
ALLOC(X, lag*C, celt_word32_t);
ALLOC(Y, lag*C, celt_word32_t);
ALLOC(curve, n2*C, celt_mask_t);
@@ -64,16 +62,14 @@
for (i=0;i<C*lag;i++)
xx[i] = 0;
for (c=0;c<C;c++)
- {
for (i=0;i<len;i++)
xx[c*lag+i] = x[C*i+c];
- for (i=0;i<lag;i++)
- yy[c*lag+i] = y[C*i+c];
-
- }
kiss_fftr(fft, xx, X);
- kiss_fftr(fft, yy, Y);
+ for (c=0;c<C;c++)
+ for (i=0;i<lag;i++)
+ xx[c*lag+i] = y[C*i+c];
+ kiss_fftr(fft, xx, Y);
compute_masking(decay, X, curve, lag*C);
--- a/libcelt/stack_alloc.h
+++ b/libcelt/stack_alloc.h
@@ -113,7 +113,7 @@
#else
-#define ALLOC_STACK(stack) (stack = (stack==0) ? celt_alloc_scratch(30000) : stack)
+#define ALLOC_STACK(stack) (stack = (stack==0) ? celt_alloc_scratch(25000) : stack)
#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
#define PUSH(stack, size, type) (ALIGN((stack),sizeof(type)),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))
#define RESTORE_STACK (global_stack = _saved_stack)