FreeCalypso > hg > gsm-codec-lib
annotate libtwamr/c_g_aver.h @ 485:751f06541fbb
doc/Codec-utils: clarify lack of DHF in gsmfr-decode-rb
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 20 May 2024 01:47:22 +0000 |
parents | dc3b7caa59c4 |
children |
rev | line source |
---|---|
324
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 ******************************************************************************** |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001 |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * R99 Version 3.3.0 |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 * REL-4 Version 4.1.0 |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 * |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 ******************************************************************************** |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 * |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 * File : c_g_aver.h |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 * Purpose : Background noise source charateristic detector (SCD) |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 * |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 ******************************************************************************** |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 */ |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 #ifndef c_g_aver_h |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 #define c_g_aver_h "$Id $" |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 /* |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 ******************************************************************************** |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 * INCLUDE FILES |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 ******************************************************************************** |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 */ |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 #include "tw_amr.h" |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 #include "typedef.h" |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 #include "cnst.h" |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 /* |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 ******************************************************************************** |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 * LOCAL VARIABLES AND TABLES |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 ******************************************************************************** |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 */ |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 #define L_CBGAINHIST 7 |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 /* |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 ******************************************************************************** |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 * DEFINITION OF DATA TYPES |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 ******************************************************************************** |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 */ |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 typedef struct{ |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 /* history vector of past synthesis speech energy */ |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 Word16 cbGainHistory[L_CBGAINHIST]; |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 /* state flags */ |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 Word16 hangVar; /* counter; */ |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 Word16 hangCount; /* counter; */ |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 } Cb_gain_averageState; |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 /* |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 ******************************************************************************** |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 * DECLARATION OF PROTOTYPES |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 ******************************************************************************** |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 */ |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 /* |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 ************************************************************************** |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 * |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 * Function : Cb_gain_average_reset |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 * Purpose : Resets state memory |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 * Returns : 0 on success |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 * |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 ************************************************************************** |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 */ |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 void Cb_gain_average_reset (Cb_gain_averageState *st); |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 /* |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 ************************************************************************** |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 * |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 * Function : Cb_gain_average |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 * Purpose : Charaterice synthesis speech and detect background noise |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 * Returns : background noise decision; 0 = bgn, 1 = no bgn |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 * |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 ************************************************************************** |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 */ |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 Word16 Cb_gain_average ( |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 Cb_gain_averageState *st, /* i/o : State variables for CB gain avergeing */ |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 enum Mode mode, /* i : AMR mode */ |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 Word16 gain_code, /* i : CB gain Q1 */ |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 Word16 lsp[], /* i : The LSP for the current frame Q15 */ |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 Word16 lspAver[], /* i : The average of LSP for 8 frames Q15 */ |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 Word16 bfi, /* i : bad frame indication flag */ |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 Word16 prev_bf, /* i : previous bad frame indication flag */ |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 Word16 pdfi, /* i : potential degraded bad frame ind flag */ |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 Word16 prev_pdf, /* i : prev pot. degraded bad frame ind flag */ |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 Word16 inBackgroundNoise, /* i : background noise decision */ |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 Word16 voicedHangover /* i : # of frames after last voiced frame */ |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 ); |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 |
dc3b7caa59c4
libtwamr: integrate c_g_aver.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 #endif |