comparison libtwamr/dec_amr.h @ 426:7bef001cd8b8

libtwamr: integrate dec_amr.c
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 07 May 2024 20:33:01 +0000
parents
children
comparison
equal deleted inserted replaced
425:9499d12d315b 426:7bef001cd8b8
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 : dec_amr.h
11 * Purpose : Speech decoder routine.
12 *
13 *****************************************************************************
14 */
15 #ifndef dec_amr_h
16 #define dec_amr_h "$Id $"
17
18 /*
19 *****************************************************************************
20 * INCLUDE FILES
21 *****************************************************************************
22 */
23 #include "tw_amr.h"
24 #include "typedef.h"
25 #include "cnst.h"
26 #include "dtx_dec.h"
27 #include "d_plsf.h"
28 #include "gc_pred.h"
29 #include "ec_gains.h"
30 #include "ph_disp.h"
31 #include "c_g_aver.h"
32 #include "bgnscd.h"
33 #include "lsp_avg.h"
34
35 /*
36 *****************************************************************************
37 * LOCAL VARIABLES AND TABLES
38 *****************************************************************************
39 */
40 /*---------------------------------------------------------------*
41 * Postfilter constant parameters (defined in "cnst.h") *
42 *---------------------------------------------------------------*
43 * L_FRAME : Frame size. *
44 * PIT_MAX : Maximum pitch lag. *
45 * L_INTERPOL : Length of filter for interpolation. *
46 * M : LPC order. *
47 *---------------------------------------------------------------*/
48
49 /*
50 *****************************************************************************
51 * DEFINITION OF DATA TYPES
52 *****************************************************************************
53 */
54 typedef struct{
55 /* Excitation vector */
56 Word16 old_exc[L_SUBFR + PIT_MAX + L_INTERPOL];
57 Word16 *exc;
58
59 /* Lsp (Line spectral pairs) */
60 /* Word16 lsp[M]; */ /* Used by CN codec */
61 Word16 lsp_old[M];
62
63 /* Filter's memory */
64 Word16 mem_syn[M];
65
66 /* pitch sharpening */
67 Word16 sharp;
68 Word16 old_T0;
69
70 /* Memories for bad frame handling */
71 Word16 prev_bf;
72 Word16 prev_pdf;
73 Word16 state;
74 Word16 excEnergyHist[9];
75
76 /* Variable holding received ltpLag, used in background noise and BFI */
77 Word16 T0_lagBuff;
78
79 /* Variables for the source characteristic detector (SCD) */
80 Word16 inBackgroundNoise;
81 Word16 voicedHangover;
82 Word16 ltpGainHistory[9];
83
84 Bgn_scdState background_state;
85 Word16 nodataSeed;
86
87 Cb_gain_averageState Cb_gain_averState;
88 lsp_avgState lsp_avg_st;
89
90 D_plsfState lsfState;
91 ec_gain_pitchState ec_gain_p_st;
92 ec_gain_codeState ec_gain_c_st;
93 gc_predState pred_state;
94 ph_dispState ph_disp_st;
95 dtx_decState dtxDecoderState;
96 } Decoder_amrState;
97
98
99 /*
100 *****************************************************************************
101 * DECLARATION OF PROTOTYPES
102 *****************************************************************************
103 */
104
105 /*
106 **************************************************************************
107 *
108 * Function : Decoder_amr_reset
109 * Purpose : Resets state memory
110 * Returns : 0 on success
111 *
112 **************************************************************************
113 */
114 void Decoder_amr_reset (Decoder_amrState *st, Flag dtx_partial_reset);
115
116 /*
117 **************************************************************************
118 *
119 * Function : Decoder_amr
120 * Purpose : Speech decoder routine.
121 * Returns : 0
122 *
123 **************************************************************************
124 */
125 int Decoder_amr (
126 Decoder_amrState *st, /* i/o : State variables */
127 enum Mode mode, /* i : AMR mode */
128 Word16 parm[], /* i : vector of synthesis parameters
129 (PRM_SIZE) */
130 enum RXFrameType frame_type, /* i : received frame type */
131 Word16 synth[], /* o : synthesis speech (L_FRAME) */
132 Word16 A_t[] /* o : decoded LP filter in 4 subframes
133 (AZ_SIZE) */
134 );
135
136 #endif