diff options
author | Jean-Marc Valin <jean-marc.valin@usherbrooke.ca> | 2009-12-31 06:40:24 +0300 |
---|---|---|
committer | Jean-Marc Valin <jean-marc.valin@usherbrooke.ca> | 2009-12-31 06:40:24 +0300 |
commit | 303b3b627ef0c0f78cca92dc1c8d6d6e800a0643 (patch) | |
tree | 3e375a1dd6f3ea02751a1052c938510c7973e80e | |
parent | 07fed1bf76ce38099d94e58770ca9db19fd772d3 (diff) |
fixed-point: starting conversion of the new PLC
-rw-r--r-- | libcelt/celt.c | 7 | ||||
-rw-r--r-- | libcelt/plc.c | 10 |
2 files changed, 11 insertions, 6 deletions
diff --git a/libcelt/celt.c b/libcelt/celt.c index 2e206e7..527e323 100644 --- a/libcelt/celt.c +++ b/libcelt/celt.c @@ -55,6 +55,7 @@ #include <stdarg.h> #define LPC_ORDER 24 +/* #define NEW_PLC */ #if !defined(FIXED_POINT) || defined(NEW_PLC) #include "plc.c" #endif @@ -1286,7 +1287,7 @@ static void celt_decode_lost(CELTDecoder * restrict st, celt_word16 * restrict p for (c=0;c<C;c++) { celt_word32 e[MAX_PERIOD]; - float exc[MAX_PERIOD]; + celt_word16 exc[MAX_PERIOD]; float ac[LPC_ORDER+1]; float decay = 1; float S1=0; @@ -1294,7 +1295,7 @@ static void celt_decode_lost(CELTDecoder * restrict st, celt_word16 * restrict p offset = MAX_PERIOD-pitch_index; for (i=0;i<MAX_PERIOD;i++) - exc[i] = st->out_mem[i*C+c]; + exc[i] = SHR32(st->out_mem[i*C+c], SIG_SHIFT); if (st->loss_count == 0) { @@ -1340,7 +1341,7 @@ static void celt_decode_lost(CELTDecoder * restrict st, celt_word16 * restrict p offset -= pitch_index; decay *= decay; } - e[i] = decay*exc[offset+i]; + e[i] = decay*SHL32(EXTEND32(exc[offset+i]), SIG_SHIFT); S1 += st->out_mem[offset+i]*1.*st->out_mem[offset+i]; } diff --git a/libcelt/plc.c b/libcelt/plc.c index 8eb12d5..8d6d9a5 100644 --- a/libcelt/plc.c +++ b/libcelt/plc.c @@ -42,12 +42,16 @@ int p if (error<.00001*ac[0]) break; } +#ifdef FIXED_POINT + for (i=0;i<p;i++) + lpc[i] = (1./4096)*floor(.5+4096*lpc[i]); +#endif return error; } -void fir(const float *x, +void fir(const celt_word16 *x, const float *num, - float *y, + celt_word16 *y, int N, int ord, float *mem) @@ -95,7 +99,7 @@ void iir(const celt_word32 *x, } void _celt_autocorr( - const float *x, /* in: [0...n-1] samples x */ + const celt_word16 *x, /* in: [0...n-1] samples x */ float *ac, /* out: [0...lag-1] ac values */ const celt_word16 *window, int overlap, |