summaryrefslogtreecommitdiff
path: root/audio_codec/libamr/dec_dtx.h (plain)
blob: b8219bcd840a92033015ec0aa02507d4bff7f7dd
1/*
2 *===================================================================
3 * 3GPP AMR Wideband Floating-point Speech Codec
4 *===================================================================
5 */
6#ifndef DEC_DTX_H
7#define DEC_DTX_H
8
9#include "typedef.h"
10
11#define M 16 /* Order of LP filter */
12#define SPEECH 0
13#define DTX 1
14#define D_DTX_MUTE 2
15#define D_DTX_HIST_SIZE 8
16
17typedef struct {
18 Word16 mem_isf_buf[M * D_DTX_HIST_SIZE]; /* ISF vector history (8 frames)*/
19 Word16 mem_isf[M]; /* ISF vector */
20 Word16 mem_isf_prev[M]; /* Previous ISF vector */
21 Word16 mem_log_en_buf[D_DTX_HIST_SIZE];/* logarithmic frame energy history*/
22 Word16 mem_true_sid_period_inv; /* inverse of true SID update rate */
23 Word16 mem_log_en; /* logarithmic frame energy */
24 Word16 mem_log_en_prev; /* previous logarithmic frame energy */
25 Word16 mem_cng_seed; /* Comfort noise excitation seed */
26 Word16 mem_hist_ptr; /* index to beginning of LSF history */
27 Word16 mem_dither_seed; /* comfort noise dithering seed */
28 Word16 mem_cn_dith; /* background noise stationarity information*/
29 Word16 mem_since_last_sid; /* number of frames since last SID frame */
30
31 UWord8 mem_dec_ana_elapsed_count;/* counts elapsed speech frames after DTX*/
32 UWord8 mem_dtx_global_state; /* DTX state flags */
33 UWord8 mem_data_updated; /* flags CNI updates */
34 UWord8 mem_dtx_hangover_count;/* counts down in hangover period */
35 UWord8 mem_sid_frame; /* flags SID frames */
36 UWord8 mem_valid_data; /* flags SID frames containing valid data */
37 UWord8 mem_dtx_hangover_added;/* flags hangover period at end of speech */
38
39} D_DTX_State;
40
41int D_DTX_init(D_DTX_State **st, const Word16 *isf_init);
42int D_DTX_reset(D_DTX_State *st, const Word16 *isf_init);
43void D_DTX_exit(D_DTX_State **st);
44UWord8 D_DTX_rx_handler(D_DTX_State *st, UWord8 frame_type);
45void D_DTX_exe(D_DTX_State *st, Word16 *exc2, Word16 new_state,
46 Word16 isf[], Word16 **prms);
47void D_DTX_activity_update(D_DTX_State *st, Word16 isf[], Word16 exc[]);
48
49#endif
50