comparison libtwamr/dtx_dec.h @ 407:5a1d18542f8a

libtwamr: integrate dtx_dec.c and dtx_enc.c
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 07 May 2024 00:05:12 +0000
parents
children
comparison
equal deleted inserted replaced
406:85e9768d497f 407:5a1d18542f8a
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 : dtx_dec.h
11 * Purpose : Decode comfort noice when in DTX
12 *
13 *****************************************************************************
14 */
15 #ifndef dtx_dec_h
16 #define dtx_dec_h "$Id $"
17
18 /*
19 *****************************************************************************
20 * INCLUDE FILES
21 *****************************************************************************
22 */
23 #include "tw_amr.h"
24 #include "typedef.h"
25 #include "dtx_common.h"
26 #include "d_plsf.h"
27 #include "gc_pred.h"
28 #include "c_g_aver.h"
29
30 /*
31 *****************************************************************************
32 * LOCAL VARIABLES AND TABLES
33 *****************************************************************************
34 */
35 enum DTXStateType {SPEECH = 0, DTX, DTX_MUTE};
36
37 #define DTX_MAX_EMPTY_THRESH 50
38
39 /*
40 *****************************************************************************
41 * DEFINITION OF DATA TYPES
42 *****************************************************************************
43 */
44
45 typedef struct {
46 Word16 since_last_sid;
47 Word16 true_sid_period_inv;
48 Word16 log_en;
49 Word16 old_log_en;
50 Word32 L_pn_seed_rx;
51 Word16 lsp[M];
52 Word16 lsp_old[M];
53
54 Word16 lsf_hist[M*DTX_HIST_SIZE];
55 Word16 lsf_hist_ptr;
56 Word16 lsf_hist_mean[M*DTX_HIST_SIZE];
57 Word16 log_pg_mean;
58 Word16 log_en_hist[DTX_HIST_SIZE];
59 Word16 log_en_hist_ptr;
60
61 Word16 log_en_adjust;
62
63 Word16 dtxHangoverCount;
64 Word16 decAnaElapsedCount;
65
66 Word16 sid_frame;
67 Word16 valid_data;
68 Word16 dtxHangoverAdded;
69
70 enum DTXStateType dtxGlobalState; /* contains previous state */
71 /* updated in main decoder */
72
73 Word16 data_updated; /* marker to know if CNI data is ever renewed */
74
75 } dtx_decState;
76
77 /*
78 *****************************************************************************
79 * DECLARATION OF PROTOTYPES
80 *****************************************************************************
81 */
82
83 /*
84 **************************************************************************
85 *
86 * Function : dtx_dec_reset
87 * Purpose : Resets state memory
88 * Returns : 0 on success
89 *
90 **************************************************************************
91 */
92 void dtx_dec_reset (dtx_decState *st);
93
94 /*
95 **************************************************************************
96 *
97 * Function : dtx_dec
98 * Purpose :
99 * Description :
100 *
101 **************************************************************************
102 */
103 int dtx_dec(
104 dtx_decState *st, /* i/o : State struct */
105 Word16 mem_syn[], /* i/o : AMR decoder state */
106 D_plsfState* lsfState, /* i/o : decoder lsf states */
107 gc_predState* predState, /* i/o : prediction states */
108 Cb_gain_averageState* averState, /* i/o : CB gain average states */
109 enum DTXStateType new_state, /* i : new DTX state */
110 enum Mode mode, /* i : AMR mode */
111 Word16 parm[], /* i : Vector of synthesis parameters */
112 Word16 synth[], /* o : synthesised speech */
113 Word16 A_t[] /* o : decoded LP filter in 4 subframes*/
114 );
115
116 void dtx_dec_activity_update(dtx_decState *st,
117 Word16 lsf[],
118 Word16 frame[]);
119
120 /*
121 **************************************************************************
122 *
123 * Function : rx_dtx_handler
124 * Purpose : reads the frame type and checks history
125 * Description : to decide what kind of DTX/CNI action to perform
126
127 **************************************************************************
128 */
129 enum DTXStateType rx_dtx_handler(dtx_decState *st, /* i/o : State struct */
130 enum RXFrameType frame_type /* i : Frame type */
131 );
132
133 #endif