Use stack_alloc for pitch.c
This commit is contained in:
parent
e05e7e23bb
commit
065dafdc3e
1 changed files with 13 additions and 4 deletions
|
@ -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 lag = MAX_PERIOD;
|
||||||
const int N = FRAMESIZE(m);
|
const int N = FRAMESIZE(m);
|
||||||
int best_pitch[2]={0};
|
int best_pitch[2]={0};
|
||||||
celt_word16 x_lp[len>>1];
|
VARDECL(celt_word16, x_lp);
|
||||||
celt_word16 x_lp4[len>>2];
|
VARDECL(celt_word16, x_lp4);
|
||||||
celt_word16 y_lp4[lag>>2];
|
VARDECL(celt_word16, y_lp4);
|
||||||
celt_word32 xcorr[max_pitch>>1];
|
VARDECL(celt_word32, xcorr);
|
||||||
celt_word32 maxcorr=1;
|
celt_word32 maxcorr=1;
|
||||||
int offset;
|
int offset;
|
||||||
int shift=0;
|
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 */
|
/* Down-sample by two and downmix to mono */
|
||||||
for (i=1;i<len>>1;i++)
|
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);
|
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, y+(N>>1), (lag-N)>>1);
|
||||||
CELT_COPY(y+((lag-N)>>1), x_lp, N>>1);
|
CELT_COPY(y+((lag-N)>>1), x_lp, N>>1);
|
||||||
|
|
||||||
|
RESTORE_STACK;
|
||||||
|
|
||||||
/*printf ("%d\n", *pitch);*/
|
/*printf ("%d\n", *pitch);*/
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue