ref: 303b3b627ef0c0f78cca92dc1c8d6d6e800a0643
parent: 07fed1bf76ce38099d94e58770ca9db19fd772d3
author: Jean-Marc Valin <[email protected]>
date: Wed Dec 30 17:40:24 EST 2009
fixed-point: starting conversion of the new PLC
--- 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 @@
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 @@
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 @@
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];
}
--- a/libcelt/plc.c
+++ b/libcelt/plc.c
@@ -42,12 +42,16 @@
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 _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,