Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/celt-0.7.0.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorvald Natvig <slicer@users.sourceforge.net>2009-11-25 03:02:42 +0300
committerJean-Marc Valin <jean-marc.valin@usherbrooke.ca>2009-11-25 04:16:03 +0300
commit065dafdc3e6259093c49f984a39b3a16a299e44a (patch)
treeb26ff45ae217f9b0be28b6d1896946f542db115f
parente05e7e23bb62495670cbd6d73957cbde3f0db1d0 (diff)
Use stack_alloc for pitch.c
-rw-r--r--libcelt/pitch.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/libcelt/pitch.c b/libcelt/pitch.c
index f04934e..72c183d 100644
--- a/libcelt/pitch.c
+++ b/libcelt/pitch.c
@@ -105,14 +105,21 @@ void find_temporal_pitch(const CELTMode *m, const celt_sig * restrict x, celt_wo
const int lag = MAX_PERIOD;
const int N = FRAMESIZE(m);
int best_pitch[2]={0};
- celt_word16 x_lp[len>>1];
- celt_word16 x_lp4[len>>2];
- celt_word16 y_lp4[lag>>2];
- celt_word32 xcorr[max_pitch>>1];
+ VARDECL(celt_word16, x_lp);
+ VARDECL(celt_word16, x_lp4);
+ VARDECL(celt_word16, y_lp4);
+ VARDECL(celt_word32, xcorr);
celt_word32 maxcorr=1;
int offset;
int shift=0;
+ SAVE_STACK;
+
+ ALLOC(x_lp, len>>1, celt_word16);
+ ALLOC(x_lp4, len>>2, celt_word16);
+ ALLOC(y_lp4, len>>2, celt_word16);
+ ALLOC(xcorr, max_pitch>>1, celt_word32);
+
/* Down-sample by two and downmix to mono */
for (i=1;i<len>>1;i++)
x_lp[i] = SHR32(HALF32(HALF32(x[(2*i-1)*C]+x[(2*i+1)*C])+x[2*i*C]), SIG_SHIFT);
@@ -195,5 +202,7 @@ void find_temporal_pitch(const CELTMode *m, const celt_sig * restrict x, celt_wo
CELT_COPY(y, y+(N>>1), (lag-N)>>1);
CELT_COPY(y+((lag-N)>>1), x_lp, N>>1);
+ RESTORE_STACK;
+
/*printf ("%d\n", *pitch);*/
}