39 for(
i=0;
i<lp_order-1;
i++)
40 for(j=
i; j>=0 && lsfq[j] > lsfq[j+1]; j--)
41 FFSWAP(int16_t, lsfq[j], lsfq[j+1]);
43 for(
i=0;
i<lp_order;
i++)
45 lsfq[
i] =
FFMAX(lsfq[
i], lsfq_min);
46 lsfq_min = lsfq[
i] + lsfq_min_distance;
48 lsfq[lp_order-1] =
FFMIN(lsfq[lp_order-1], lsfq_max);
56 prev = lsf[
i] =
FFMAX(lsf[
i], prev + min_spacing);
63 32767, 32738, 32617, 32421, 32145, 31793, 31364, 30860,
64 30280, 29629, 28905, 28113, 27252, 26326, 25336, 24285,
65 23176, 22011, 20793, 19525, 18210, 16851, 15451, 14014,
66 12543, 11043, 9515, 7965, 6395, 4810, 3214, 1609,
67 1, -1607, -3211, -4808, -6393, -7962, -9513, -11040,
68 -12541, -14012, -15449, -16848, -18207, -19523, -20791, -22009,
69 -23174, -24283, -25334, -26324, -27250, -28111, -28904, -29627,
70 -30279, -30858, -31363, -31792, -32144, -32419, -32616, -32736, -32768,
88 for(
i=0;
i<lp_order;
i++)
90 lsp[
i] =
ff_cos(lsf[
i] * 20861 >> 15);
97 for(
i = 0;
i < lp_order;
i++)
98 lsp[
i] = cos(2.0 *
M_PI * lsf[
i]);
106 static void lsp2poly(
int*
f,
const int16_t* lsp,
int lp_half_order)
111 f[1] = -lsp[0] * 256;
113 for(
i=2;
i<=lp_half_order;
i++)
119 f[1] -= lsp[2*
i-2] * 256;
134 for(
i=1;
i<lp_half_order+1;
i++)
136 int ff1 = f1[
i] + f1[
i-1];
137 int ff2 = f2[
i] - f2[
i-1];
140 lp[
i] = (ff1 + ff2) >> 11;
141 lp[(lp_half_order << 1) + 1 -
i] = (ff1 - ff2) >> 11;
147 int lp_half_order = lp_order >> 1;
150 double *qa =
buf + 1;
158 for (
i = 1, j = lp_order - 1;
i < lp_half_order;
i++, j--) {
159 double paf = pa[
i] * (1 + lsp[lp_order - 1]);
160 double qaf = (qa[
i] - qa[
i-2]) * (1 - lsp[lp_order - 1]);
161 lp[
i-1] = (paf + qaf) * 0.5;
162 lp[j-1] = (paf - qaf) * 0.5;
165 lp[lp_half_order - 1] = (1.0 + lsp[lp_order - 1]) *
166 pa[lp_half_order] * 0.5;
168 lp[lp_order - 1] = lsp[lp_order - 1];
171 void ff_acelp_lp_decode(int16_t* lp_1st, int16_t* lp_2nd,
const int16_t* lsp_2nd,
const int16_t* lsp_prev,
int lp_order)
177 for(
i=0;
i<lp_order;
i++)
179 lsp_1st[
i] = (lsp_2nd[
i] >> 1) + (lsp_prev[
i] >> 1);
181 lsp_1st[
i] = (lsp_2nd[
i] + lsp_prev[
i]) >> 1;
198 for(
i=2;
i<=lp_half_order;
i++)
200 double val = -2 * lsp[2*
i];
203 f[j] +=
f[j-1] *
val +
f[j-2];
212 float *lpc2 = lpc + (lp_half_order << 1) - 1;
219 while (lp_half_order--) {
220 double paf = pa[lp_half_order+1] + pa[lp_half_order];
221 double qaf = qa[lp_half_order+1] - qa[lp_half_order];
223 lpc [ lp_half_order] = 0.5*(paf+qaf);
224 lpc2[-lp_half_order] = 0.5*(paf-qaf);
232 for (
i = 0;
i <
len - 1;
i++)
233 for (j =
i; j >= 0 && vals[j] > vals[j+1]; j--)
234 FFSWAP(
float, vals[j], vals[j+1]);