FreeCalypso > hg > gsm-codec-lib
comparison libtwamr/ol_ltp.c @ 417:f17e42c63058
libtwamr: integrate ol_ltp.c
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 07 May 2024 03:21:14 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
416:48c7f8e8c9af | 417:f17e42c63058 |
---|---|
1 /* | |
2 ******************************************************************************** | |
3 * | |
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001 | |
5 * R99 Version 3.3.0 | |
6 * REL-4 Version 4.1.0 | |
7 * | |
8 ******************************************************************************** | |
9 * | |
10 * File : ol_ltp.c | |
11 * Purpose : Compute the open loop pitch lag. | |
12 * | |
13 ******************************************************************************** | |
14 */ | |
15 | |
16 /* | |
17 ******************************************************************************** | |
18 * MODULE INCLUDE FILE AND VERSION ID | |
19 ******************************************************************************** | |
20 */ | |
21 #include "namespace.h" | |
22 #include "ol_ltp.h" | |
23 | |
24 /* | |
25 ******************************************************************************** | |
26 * INCLUDE FILES | |
27 ******************************************************************************** | |
28 */ | |
29 #include "typedef.h" | |
30 #include "cnst.h" | |
31 #include "pitch_ol.h" | |
32 #include "p_ol_wgh.h" | |
33 #include "no_count.h" | |
34 #include "basic_op.h" | |
35 | |
36 /* | |
37 ******************************************************************************** | |
38 * LOCAL VARIABLES AND TABLES | |
39 ******************************************************************************** | |
40 */ | |
41 | |
42 /* | |
43 ******************************************************************************** | |
44 * PUBLIC PROGRAM CODE | |
45 ******************************************************************************** | |
46 */ | |
47 int ol_ltp( | |
48 pitchOLWghtState *st, /* i/o : State struct */ | |
49 vadState *vadSt, /* i/o : VAD state struct */ | |
50 enum Mode mode, /* i : coder mode */ | |
51 Word16 wsp[], /* i : signal used to compute the OL pitch, Q0 */ | |
52 /* uses signal[-pit_max] to signal[-1] */ | |
53 Word16 *T_op, /* o : open loop pitch lag, Q0 */ | |
54 Word16 old_lags[], /* i : history with old stored Cl lags */ | |
55 Word16 ol_gain_flg[], /* i : OL gain flag */ | |
56 Word16 idx, /* i : index */ | |
57 Flag dtx /* i : dtx flag; use dtx=1, do not use dtx=0 */ | |
58 ) | |
59 { | |
60 test (); | |
61 if (sub (mode, MR102) != 0 ) | |
62 { | |
63 ol_gain_flg[0] = 0; move16 (); | |
64 ol_gain_flg[1] = 0; move16 (); | |
65 } | |
66 | |
67 test (); test (); | |
68 if (sub (mode, MR475) == 0 || sub (mode, MR515) == 0 ) | |
69 { | |
70 *T_op = Pitch_ol(vadSt, mode, wsp, PIT_MIN, PIT_MAX, L_FRAME, idx, dtx); | |
71 move16 (); | |
72 } | |
73 else | |
74 { | |
75 if ( sub (mode, MR795) <= 0 ) | |
76 { | |
77 test(); | |
78 *T_op = Pitch_ol(vadSt, mode, wsp, PIT_MIN, PIT_MAX, L_FRAME_BY2, | |
79 idx, dtx); | |
80 move16 (); | |
81 } | |
82 else if ( sub (mode, MR102) == 0 ) | |
83 { | |
84 test(); test(); | |
85 *T_op = Pitch_ol_wgh(st, vadSt, wsp, PIT_MIN, PIT_MAX, L_FRAME_BY2, | |
86 old_lags, ol_gain_flg, idx, dtx); | |
87 move16 (); | |
88 } | |
89 else | |
90 { | |
91 test(); test(); | |
92 *T_op = Pitch_ol(vadSt, mode, wsp, PIT_MIN_MR122, PIT_MAX, | |
93 L_FRAME_BY2, idx, dtx); | |
94 move16 (); | |
95 } | |
96 } | |
97 return 0; | |
98 } |