PLC cleanup

Pitch search can now go up to 720 samples
This commit is contained in:
Jean-Marc Valin 2011-05-13 17:24:25 -04:00
parent ba547467c0
commit 5f3d1afc05

View file

@ -317,13 +317,13 @@ static int transient_analysis(const celt_word32 * restrict in, int len, int C,
int is_transient = 0; int is_transient = 0;
int block; int block;
int N; int N;
/* FIXME: Make that smaller */ VARDECL(celt_word16, bins);
celt_word16 bins[50];
SAVE_STACK; SAVE_STACK;
ALLOC(tmp, len, celt_word16); ALLOC(tmp, len, celt_word16);
block = overlap/2; block = overlap/2;
N=len/block; N=len/block;
ALLOC(bins, N, celt_word16);
if (C==1) if (C==1)
{ {
for (i=0;i<len;i++) for (i=0;i<len;i++)
@ -2106,15 +2106,15 @@ static void celt_decode_lost(CELTDecoder * restrict st, celt_word16 * restrict p
plc = 0; plc = 0;
} else if (st->loss_count == 0) } else if (st->loss_count == 0)
{ {
celt_word16 pitch_buf[MAX_PERIOD>>1]; celt_word16 pitch_buf[DECODE_BUFFER_SIZE>>1];
int len2 = len; /* Corresponds to a min pitch of 67 Hz. It's possible to save CPU in this
/* FIXME: This is a kludge */ search by using only part of the decode buffer */
if (len2>MAX_PERIOD>>1) int poffset = 720;
len2 = MAX_PERIOD>>1; pitch_downsample(decode_mem, pitch_buf, DECODE_BUFFER_SIZE, C);
pitch_downsample(out_mem, pitch_buf, MAX_PERIOD, C); /* Max pitch is 100 samples (480 Hz) */
pitch_search(pitch_buf+((MAX_PERIOD-len2)>>1), pitch_buf, len2, pitch_search(pitch_buf+((poffset)>>1), pitch_buf, DECODE_BUFFER_SIZE-poffset,
MAX_PERIOD-len2-100, &pitch_index); poffset-100, &pitch_index);
pitch_index = MAX_PERIOD-len2-pitch_index; pitch_index = poffset-pitch_index;
st->last_pitch_index = pitch_index; st->last_pitch_index = pitch_index;
} else { } else {
pitch_index = st->last_pitch_index; pitch_index = st->last_pitch_index;