30static void Autocorrelation
P2((s, L_ACF),
56 for (k = 0; k <= 159; k++) {
58 if (temp > smax) smax = temp;
63 lmax = k6maxmin(s,160,
NULL);
69 if (smax == 0) scalauto = 0;
72 scalauto = 4 - gsm_norm( (
longword)smax << 16 );
83 case n: for (k = 0; k <= 159; k++) \
84 float_s[k] = (float) \
85 (s[k] = GSM_MULT_R(s[k], 16384 >> (n-1)));\
89 case n: for (k = 0; k <= 159; k++) \
90 s[k] = (word)GSM_MULT_R( s[k], 16384 >> (n-1) );\
103 k6vsraw(s,160,scalauto);
107 else for (k = 0; k <= 159; k++) float_s[k] = (
float) s[k];
115 register float * sp = float_s;
116 register float sl = *sp;
118# define STEP(k) L_ACF[k] += (longword)(sl * sp[ -(k) ]);
123# define STEP(k) L_ACF[k] += ((longword)sl * sp[ -(k) ]);
126# define NEXTI sl = *++sp
129 for (k = 9; k--; L_ACF[k] = 0) ;
147 for (i = 8; i <= 159; i++) {
156 for (k = 9; k--; L_ACF[k] <<= 1) ;
163 for (k=0; k<9; k++) {
164 L_ACF[k] = 2*k6iprod(s,s+k,160-k);
171 assert(scalauto <= 4);
173 for (k = 160; k--; *s++ <<= scalauto) ;
175 k6vsllw(s,160,scalauto);
180#if defined(USE_FLOAT_MUL) && defined(FAST)
182static void Fast_Autocorrelation
P2((s, L_ACF),
191 register float *sf = s_f;
193 for (i = 0; i < 160; ++i) sf[i] = s[i];
194 for (k = 0; k <= 8; k++) {
195 register float L_temp2 = 0;
196 register float *sfl = sf - k;
197 for (i = k; i < 160; ++i) L_temp2 += sf[i] * sfl[i];
198 f_L_ACF[k] = L_temp2;
202 for (k = 0; k <= 8; k++) {
203 L_ACF[k] = f_L_ACF[k] * scale;
210static void Reflection_coefficients
P2( (L_ACF, r),
215 register int i, m, n;
225 for (i = 8; i--; *r++ = 0) ;
229 assert( L_ACF[0] != 0 );
230 temp = gsm_norm( L_ACF[0] );
232 assert(temp >= 0 && temp < 32);
235 for (i = 0; i <= 8; i++) ACF[i] = (
word)
SASR( L_ACF[i] << temp, 16 );
240 for (i = 1; i <= 7; i++) K[ i ] = ACF[ i ];
241 for (i = 0; i <= 8; i++)
P[ i ] = ACF[ i ];
245 for (n = 1; n <= 8; n++, r++) {
250 for (i = n; i <= 8; i++) *r++ = 0;
254 *r = gsm_div( temp,
P[0] );
257 if (
P[1] > 0) *r = -*r;
266 for (m = 1; m <= 8 - n; m++) {
271 K[m] =
GSM_ADD( K[ m ], temp );
278static void Transformation_to_Log_Area_Ratios
P1((r),
295 for (i = 1; i <= 8; i++, r++) {
303 }
else if (temp < 31130) {
304 assert( temp >= 11059 );
307 assert( temp >= 26112 );
312 *r = *r < 0 ? -temp : temp;
319static void Quantization_and_coding
P1((LAR),
336# define STEP( A, B, MAC, MIC ) \
337 temp = (word)GSM_MULT( A, *LAR ); \
338 temp = GSM_ADD( temp, B ); \
339 temp = GSM_ADD( temp, 256 ); \
340 temp = (word)SASR( temp, 9 ); \
341 *LAR = temp>MAC ? MAC - MIC : (temp<MIC ? 0 : temp - MIC); \
344 STEP( 20480, 0, 31, -32 );
345 STEP( 20480, 0, 31, -32 );
346 STEP( 20480, 2048, 15, -16 );
347 STEP( 20480, -2560, 15, -16 );
349 STEP( 13964, 94, 7, -8 );
350 STEP( 15360, -1792, 7, -8 );
351 STEP( 8534, -341, 3, -4 );
352 STEP( 9036, -1144, 3, -4 );
364#if defined(USE_FLOAT_MUL) && defined(FAST)
365 if (
S->fast) Fast_Autocorrelation (s, L_ACF );
368 Autocorrelation (s, L_ACF );
369 Reflection_coefficients (L_ACF,
LARc );
370 Transformation_to_Log_Area_Ratios (
LARc);
371 Quantization_and_coding (
LARc);
static word GSM_ADD(longword a, longword b)
void Gsm_LPC_Analysis P3((S, s, LARc), struct gsm_state *S, word *s, word *LARc)
static void Transformation_to_Log_Area_Ratios P1((r), register word *r)
static void Autocorrelation P2((s, L_ACF), word *s, longword *L_ACF)