FreeCalypso > hg > gsm-codec-lib
comparison libtwamr/d_gain_p.c @ 340:e18452a4fbac
libtwamr: integrate d_gain_p.c
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 18 Apr 2024 23:45:25 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
339:a723d9f9f697 | 340:e18452a4fbac |
---|---|
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 : d_gain_p.c | |
11 * | |
12 ******************************************************************************** | |
13 */ | |
14 | |
15 | |
16 /* | |
17 ******************************************************************************** | |
18 * MODULE INCLUDE FILE AND VERSION ID | |
19 ******************************************************************************** | |
20 */ | |
21 #include "namespace.h" | |
22 #include "d_gain_p.h" | |
23 | |
24 /* | |
25 ******************************************************************************** | |
26 * INCLUDE FILES | |
27 ******************************************************************************** | |
28 */ | |
29 #include "tw_amr.h" | |
30 #include "typedef.h" | |
31 #include "basic_op.h" | |
32 #include "oper_32b.h" | |
33 #include "no_count.h" | |
34 #include "cnst.h" | |
35 #include "gains_tab.h" | |
36 | |
37 /* | |
38 ******************************************************************************** | |
39 * PUBLIC PROGRAM CODE | |
40 ******************************************************************************** | |
41 */ | |
42 | |
43 /* | |
44 ************************************************************************** | |
45 * | |
46 * Function : d_gain_pitch | |
47 * Purpose : Decodes the pitch gain using the received index. | |
48 * output is in Q14 | |
49 * | |
50 ************************************************************************** | |
51 */ | |
52 Word16 d_gain_pitch ( /* return value: gain (Q14) */ | |
53 enum Mode mode, /* i : AMR mode */ | |
54 Word16 index /* i : index of quantization */ | |
55 ) | |
56 { | |
57 Word16 gain; | |
58 | |
59 test (); | |
60 if (sub(mode, MR122) == 0) | |
61 { | |
62 /* clear 2 LSBits */ | |
63 gain = shl (shr (qua_gain_pitch[index], 2), 2); move16 (); | |
64 } | |
65 else | |
66 { | |
67 gain = qua_gain_pitch[index]; move16 (); | |
68 } | |
69 | |
70 return gain; | |
71 } |