#include <stdio.h>
#include <assert.h>
#include "private.h"
#include "gsm.h"
#include "proto.h"
Go to the source code of this file.
|
static void Transformation_to_Log_Area_Ratios | P1 ((r), register word *r) |
|
static void Quantization_and_coding | P1 ((LAR), register word *LAR) |
|
static void Autocorrelation | P2 ((s, L_ACF), word *s, longword *L_ACF) |
|
static void Reflection_coefficients | P2 ((L_ACF, r), longword *L_ACF, register word *r) |
|
void Gsm_LPC_Analysis | P3 ((S, s, LARc), struct gsm_state *S, word *s, word *LARc) |
|
◆ NEXTI
◆ SCALE
Value:case n: for (k = 0; k <= 159; k++) \
break;
Referenced by P2().
◆ STEP [1/2]
#define STEP |
( |
|
k | ) |
L_ACF[k] += ((longword)sl * sp[ -(k) ]); |
◆ STEP [2/2]
#define STEP |
( |
|
A, |
|
|
|
B, |
|
|
|
MAC, |
|
|
|
MIC |
|
) |
| |
◆ P1() [1/2]
static void Transformation_to_Log_Area_Ratios P1 |
( |
(r) |
, |
|
|
register word * |
r |
|
) |
| |
|
static |
Definition at line 278 of file lpc.c.
References GSM_ABS, and MIN_WORD.
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;
◆ P1() [2/2]
static void Quantization_and_coding P1 |
( |
(LAR) |
, |
|
|
register word * |
LAR |
|
) |
| |
|
static |
Definition at line 319 of file lpc.c.
References STEP.
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 );
◆ P2() [1/2]
static void Autocorrelation P2 |
( |
(s, L_ACF) |
, |
|
|
word * |
s, |
|
|
longword * |
L_ACF |
|
) |
| |
|
static |
Definition at line 30 of file lpc.c.
References GSM_ABS, MAX_LONGWORD, MAX_WORD, NEXTI, NULL, SCALE, and STEP.
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);
106 # ifdef USE_FLOAT_MUL 107 else for (k = 0; k <= 159; k++) float_s[k] = (
float) s[k];
114 # ifdef USE_FLOAT_MUL 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);
◆ P2() [2/2]
static void Reflection_coefficients P2 |
( |
(L_ACF, r) |
, |
|
|
longword * |
L_ACF, |
|
|
register word * |
r |
|
) |
| |
|
static |
Definition at line 210 of file lpc.c.
References GSM_ABS, GSM_ADD(), GSM_MULT_R, MIN_WORD, P, and SASR.
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++) {
268 P[m] =
GSM_ADD( P[ m+1 ], temp );
271 K[m] =
GSM_ADD( K[ m ], temp );
static word GSM_ADD(longword a, longword b)
◆ P3()
Definition at line 357 of file lpc.c.
References gsm_state::fast.
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);