#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 Calculation_of_the_LTP_parameters | P4 ((d, dp, bc_out, Nc_out), register word *d, register word *dp, word *bc_out, word *Nc_out) |
|
void Gsm_Long_Term_Synthesis_Filtering | P5 ((S, Ncr, bcr, erp, drp), struct gsm_state *S, word Ncr, word bcr, register word *erp, register word *drp) |
|
static void Long_term_analysis_filtering | P6 ((bc, Nc, dp, d, dpp, e), word bc, word Nc, register word *dp, register word *d, register word *dpp, register word *e) |
|
void Gsm_Long_Term_Predictor | P7 ((S, d, dp, e, dpp, Nc, bc), struct gsm_state *S, word *d, word *dp, word *e, word *dpp, word *Nc, word *bc) |
|
◆ STEP [1/2]
#define STEP |
( |
|
k | ) |
(longword)wt[k] * dp[k - lambda] |
◆ STEP [2/2]
Value:for (k = 0; k <= 39; k++) { \
}
static word GSM_SUB(longword a, longword b)
◆ P4()
static void Calculation_of_the_LTP_parameters P4 |
( |
(d, dp, bc_out, Nc_out) |
, |
|
|
register word * |
d, |
|
|
register word * |
dp, |
|
|
word * |
bc_out, |
|
|
word * |
Nc_out |
|
) |
| |
|
static |
Definition at line 158 of file long_term.c.
References a, b, bc, c, dmax, GSM_ABS, gsm_DLB, gsm_state::ltp_cut, Nc, P5(), S, SASR, and STEP.
180 for (k = 0; k <= 39; k++) {
183 if (temp > dmax) dmax = temp;
187 if (dmax == 0) scal = 0;
190 temp = gsm_norm( (
longword)dmax << 16 );
193 if (temp > 6) scal = 0;
194 else scal = 6 - temp;
201 for (k = 0; k <= 39; k++) wt[k] =
SASR(
d[k], scal );
206 L_max = k6maxcc(wt,dp,&Nc);
211 for (lambda = 40; lambda <= 120; lambda++) {
214 # define STEP(k) (longword)wt[k] * dp[k - lambda] 218 L_result =
STEP(0) ; L_result +=
STEP(1) ;
219 L_result +=
STEP(2) ; L_result +=
STEP(3) ;
220 L_result +=
STEP(4) ; L_result +=
STEP(5) ;
221 L_result +=
STEP(6) ; L_result +=
STEP(7) ;
222 L_result +=
STEP(8) ; L_result +=
STEP(9) ;
223 L_result +=
STEP(10) ; L_result +=
STEP(11) ;
224 L_result +=
STEP(12) ; L_result +=
STEP(13) ;
225 L_result +=
STEP(14) ; L_result +=
STEP(15) ;
226 L_result +=
STEP(16) ; L_result +=
STEP(17) ;
227 L_result +=
STEP(18) ; L_result +=
STEP(19) ;
228 L_result +=
STEP(20) ; L_result +=
STEP(21) ;
229 L_result +=
STEP(22) ; L_result +=
STEP(23) ;
230 L_result +=
STEP(24) ; L_result +=
STEP(25) ;
231 L_result +=
STEP(26) ; L_result +=
STEP(27) ;
232 L_result +=
STEP(28) ; L_result +=
STEP(29) ;
233 L_result +=
STEP(30) ; L_result +=
STEP(31) ;
234 L_result +=
STEP(32) ; L_result +=
STEP(33) ;
235 L_result +=
STEP(34) ; L_result +=
STEP(35) ;
236 L_result +=
STEP(36) ; L_result +=
STEP(37) ;
237 L_result +=
STEP(38) ; L_result +=
STEP(39) ;
239 if (L_result > L_max) {
252 assert(scal <= 100 && scal >= -100);
253 L_max = L_max >> (6 - scal);
255 assert( Nc <= 120 && Nc >= 40);
261 for (k = 0; k <= 39; k++) {
265 L_temp =
SASR( dp[k - Nc], 3 );
266 L_power += L_temp * L_temp;
277 if (L_max >= L_power) {
282 temp = gsm_norm( L_power );
284 R = (
word)
SASR( L_max << temp, 16 );
285 S = (
word)
SASR( L_power << temp, 16 );
293 for (bc = 0; bc <= 2; bc++)
if (R <= gsm_mult(S,
gsm_DLB[bc]))
break;
◆ P5()
void Gsm_Long_Term_Synthesis_Filtering P5 |
( |
(S, Ncr, bcr, erp, drp) |
, |
|
|
struct gsm_state * |
S, |
|
|
word |
Ncr, |
|
|
word |
bcr, |
|
|
register word * |
erp, |
|
|
register word * |
drp |
|
) |
| |
Definition at line 912 of file long_term.c.
References GSM_ADD(), GSM_MULT_R, gsm_QLB, MIN_WORD, and gsm_state::nrp.
Referenced by P4().
931 Nr = Ncr < 40 || Ncr > 120 ? S->
nrp : Ncr;
933 assert(Nr >= 40 && Nr <= 120);
944 for (k = 0; k <= 39; k++) {
946 drp[k] =
GSM_ADD( erp[k], drpp );
954 for (k = 0; k <= 119; k++) drp[ -120 + k ] = drp[ -80 + k ];
static word GSM_ADD(longword a, longword b)
◆ P6()
static void Long_term_analysis_filtering P6 |
( |
(bc, Nc, dp, d, dpp, e) |
, |
|
|
word |
bc, |
|
|
word |
Nc, |
|
|
register word * |
dp, |
|
|
register word * |
d, |
|
|
register word * |
dpp, |
|
|
register word * |
e |
|
) |
| |
|
static |
Definition at line 842 of file long_term.c.
References STEP.
861 for (k = 0; k <= 39; k++) { \ 862 dpp[k] = (word)GSM_MULT_R( BP, dp[k - Nc]); \ 863 e[k] = GSM_SUB( d[k], dpp[k] ); \ 867 case 0:
STEP( 3277 );
break;
868 case 1:
STEP( 11469 );
break;
869 case 2:
STEP( 21299 );
break;
870 case 3:
STEP( 32767 );
break;
◆ P7()
void Gsm_Long_Term_Predictor P7 |
( |
(S, d, dp, e, dpp, Nc, bc) |
, |
|
|
struct gsm_state * |
S, |
|
|
word * |
d, |
|
|
word * |
dp, |
|
|
word * |
e, |
|
|
word * |
dpp, |
|
|
word * |
Nc, |
|
|
word * |
bc |
|
) |
| |
Definition at line 874 of file long_term.c.
References gsm_state::fast, and gsm_state::ltp_cut.
887 assert(
d ); assert( dp ); assert( e );
888 assert( dpp); assert(
Nc ); assert(
bc );
890 #if defined(FAST) && defined(USE_FLOAT_MUL) 892 #if defined (LTP_CUT) 894 Cut_Fast_Calculation_of_the_LTP_parameters(S,
898 Fast_Calculation_of_the_LTP_parameters(
d, dp,
bc,
Nc );
903 Cut_Calculation_of_the_LTP_parameters(S,
d, dp,
bc,
Nc);
906 Calculation_of_the_LTP_parameters(
d, dp,
bc,
Nc);
908 Long_term_analysis_filtering( *
bc, *
Nc, dp,
d, dpp, e );