Commit 097cf5e4 authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

The LPC analysis window and lag window are now in Q15.

parent 99a7ef29
......@@ -82,13 +82,6 @@ int p
spx_word16_t r;
spx_word16_t error = ac[0];
if (ac[0] == 0)
{
for (i = 0; i < p; i++)
lpc[i] = 0;
return 0;
}
for (i = 0; i < p; i++) {
/* Sum up this iteration's reflection coefficient */
......
......@@ -468,16 +468,17 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
ALLOC(autocorr, NB_ORDER+1, spx_word16_t);
/* Window for analysis */
for (i=0;i<NB_WINDOW_SIZE-NB_FRAME_SIZE;i++)
w_sig[i] = EXTRACT16(SHR32(MULT16_16(st->winBuf[i],st->window[i]),SIG_SHIFT));
w_sig[i] = MULT16_16_Q15(st->winBuf[i],st->window[i]);
for (;i<NB_WINDOW_SIZE;i++)
w_sig[i] = EXTRACT16(SHR32(MULT16_16(in[i-NB_WINDOW_SIZE+NB_FRAME_SIZE],st->window[i]),SIG_SHIFT));
w_sig[i] = MULT16_16_Q15(in[i-NB_WINDOW_SIZE+NB_FRAME_SIZE],st->window[i]);
/* Compute auto-correlation */
_spx_autocorr(w_sig, autocorr, NB_ORDER+1, NB_WINDOW_SIZE);
autocorr[0] = ADD16(autocorr[0],MULT16_16_Q15(autocorr[0],st->lpc_floor)); /* Noise floor in auto-correlation domain */
/* Lag windowing: equivalent to filtering in the power-spectrum domain */
for (i=0;i<NB_ORDER+1;i++)
autocorr[i] = MULT16_16_Q14(autocorr[i],st->lagWindow[i]);
autocorr[i] = MULT16_16_Q15(autocorr[i],st->lagWindow[i]);
autocorr[0] = ADD16(autocorr[0],1);
/* Levinson-Durbin */
_spx_lpc(lpc, autocorr, NB_ORDER);
......
......@@ -37,39 +37,39 @@
#ifdef FIXED_POINT
const spx_word16_t lag_window[11] = {
16384, 16337, 16199, 15970, 15656, 15260, 14790, 14254, 13659, 13015, 12330
32767, 32675, 32397, 31940, 31311, 30520, 29581, 28508, 27318, 26029, 24661
};
const spx_word16_t lpc_window[200] = {
1310, 1313, 1321, 1333, 1352, 1375, 1403, 1436,
1475, 1518, 1567, 1621, 1679, 1743, 1811, 1884,
1962, 2044, 2132, 2224, 2320, 2421, 2526, 2636,
2750, 2868, 2990, 3116, 3246, 3380, 3518, 3659,
3804, 3952, 4104, 4259, 4417, 4578, 4742, 4909,
5079, 5251, 5425, 5602, 5781, 5963, 6146, 6331,
6518, 6706, 6896, 7087, 7280, 7473, 7668, 7863,
8059, 8256, 8452, 8650, 8847, 9044, 9241, 9438,
9635, 9831, 10026, 10220, 10414, 10606, 10797, 10987,
11176, 11363, 11548, 11731, 11912, 12091, 12268, 12443,
12615, 12785, 12952, 13116, 13277, 13435, 13590, 13742,
13890, 14035, 14176, 14314, 14448, 14578, 14704, 14826,
14944, 15058, 15168, 15273, 15374, 15470, 15562, 15649,
15732, 15810, 15883, 15951, 16015, 16073, 16127, 16175,
16219, 16257, 16291, 16319, 16342, 16360, 16373, 16381,
16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384,
16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384,
16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384,
16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384,
16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384,
16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384,
16384, 16384, 16384, 16361, 16294, 16183, 16028, 15830,
15588, 15304, 14979, 14613, 14207, 13763, 13282, 12766,
12215, 11631, 11016, 10373, 9702, 9007, 8289, 7551,
6797, 6028, 5251, 4470, 3695, 2943, 2248, 1696
2621, 2627, 2642, 2668, 2704, 2750, 2807, 2874,
2951, 3038, 3135, 3242, 3359, 3486, 3623, 3769,
3925, 4090, 4264, 4448, 4641, 4843, 5053, 5272,
5500, 5736, 5981, 6233, 6493, 6761, 7036, 7319,
7609, 7905, 8209, 8519, 8835, 9157, 9485, 9819,
10158, 10502, 10852, 11206, 11564, 11926, 12293, 12663,
13037, 13414, 13793, 14176, 14561, 14948, 15337, 15727,
16119, 16512, 16906, 17300, 17695, 18089, 18484, 18877,
19270, 19662, 20053, 20442, 20829, 21214, 21596, 21976,
22353, 22726, 23096, 23463, 23826, 24184, 24538, 24887,
25231, 25570, 25904, 26232, 26555, 26871, 27181, 27484,
27781, 28070, 28353, 28628, 28896, 29157, 29409, 29653,
29889, 30117, 30336, 30547, 30749, 30941, 31125, 31300,
31465, 31621, 31767, 31903, 32030, 32147, 32254, 32352,
32439, 32516, 32582, 32639, 32685, 32722, 32747, 32763,
32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
32767, 32767, 32767, 32723, 32590, 32368, 32058, 31661,
31177, 30610, 29959, 29227, 28416, 27528, 26566, 25532,
24430, 23263, 22034, 20747, 19406, 18015, 16579, 15104,
13594, 12058, 10503, 8941, 7391, 5887, 4498, 3392
};
#else
const spx_word16_t lag_window[11] = {
1.00000, 0.99716, 0.98869, 0.97474, 0.95554, 0.93140, 0.90273, 0.86998, 0.83367, 0.79434, 0.75258
1.00000f, 0.99716f, 0.98869f, 0.97474f, 0.95554f, 0.93140f, 0.90273f, 0.86998f, 0.83367f, 0.79434f, 0.75258f
};
const spx_word16_t lpc_window[200] = {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment