1 /* ------------------------------------------------------------------
2 * Copyright (C) 1998-2009 PacketVideo
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14 * See the License for the specific language governing permissions
15 * and limitations under the License.
16 * -------------------------------------------------------------------
18 /****************************************************************************************
19 Portions of this file are derived from the following 3GPP standard:
22 ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
23 Available from http://www.3gpp.org
25 (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
26 Permission to distribute, modify and use this file under the standard license
27 terms listed above has been obtained from the copyright holder.
28 ****************************************************************************************/
30 ------------------------------------------------------------------------------
34 Filename: /audio/gsm_amr/c/src/include/dtx_enc.h
38 ------------------------------------------------------------------------------
41 Description: Replaced "int" and/or "char" with OSCL defined types.
43 Description: Moved _cplusplus #ifdef after Include section.
47 ------------------------------------------------------------------------------
51 Purpose : DTX mode computation of SID parameters
53 ------------------------------------------------------------------------------
57 #define dtx_enc_h "$Id $"
59 /*----------------------------------------------------------------------------
61 ----------------------------------------------------------------------------*/
67 #include "dtx_common_def.h"
69 /*--------------------------------------------------------------------------*/
75 /*----------------------------------------------------------------------------
77 ; [Define module specific macros here]
78 ----------------------------------------------------------------------------*/
80 /*----------------------------------------------------------------------------
82 ; [Include all pre-processor statements here.]
83 ----------------------------------------------------------------------------*/
85 /*----------------------------------------------------------------------------
86 ; EXTERNAL VARIABLES REFERENCES
87 ; [Declare variables used in this module but defined elsewhere]
88 ----------------------------------------------------------------------------*/
89 extern const Word16 lsp_init_data[];
90 /*----------------------------------------------------------------------------
92 ----------------------------------------------------------------------------*/
94 /*----------------------------------------------------------------------------
95 ; ENUMERATED TYPEDEF'S
96 ----------------------------------------------------------------------------*/
98 /*----------------------------------------------------------------------------
99 ; STRUCTURES TYPEDEF'S
100 ----------------------------------------------------------------------------*/
103 Word16 lsp_hist[M * DTX_HIST_SIZE];
104 Word16 log_en_hist[DTX_HIST_SIZE];
107 Word16 init_lsf_vq_index;
110 /* DTX handler stuff */
111 Word16 dtxHangoverCount;
112 Word16 decAnaElapsedCount;
116 /*----------------------------------------------------------------------------
117 ; GLOBAL FUNCTION DEFINITIONS
118 ; [List function prototypes here]
119 ----------------------------------------------------------------------------*/
121 **************************************************************************
122 * Function : dtx_enc_init
123 * Purpose : Allocates memory and initializes state variables
124 * Description : Stores pointer to filter status struct in *st. This
125 * pointer has to be passed to dtx_enc in each call.
126 * Returns : 0 on success
128 **************************************************************************
130 Word16 dtx_enc_init(dtx_encState **st);
133 **************************************************************************
135 * Function : dtx_enc_reset
136 * Purpose : Resets state memory
137 * Returns : 0 on success
139 **************************************************************************
141 Word16 dtx_enc_reset(dtx_encState *st);
144 **************************************************************************
146 * Function : dtx_enc_exit
147 * Purpose : The memory used for state memory is freed
148 * Description : Stores NULL in *st
150 **************************************************************************
152 void dtx_enc_exit(dtx_encState **st);
155 **************************************************************************
161 **************************************************************************
163 void dtx_enc(dtx_encState *st, /* i/o : State struct */
164 Word16 computeSidFlag, /* i : compute SID */
165 Q_plsfState *qSt, /* i/o : Qunatizer state struct */
166 gc_predState* predState, /* i/o : State struct */
167 Word16 **anap, /* o : analysis parameters */
168 Flag *pOverflow /* i/o : overflow indicator */
172 **************************************************************************
174 * Function : dtx_buffer
175 * Purpose : handles the DTX buffer
177 **************************************************************************
179 void dtx_buffer(dtx_encState *st, /* i/o : State struct */
180 Word16 lsp_new[], /* i : LSP vector */
181 Word16 speech[], /* i : speech samples */
182 Flag *pOverflow /* i/o : overflow indicator */
186 **************************************************************************
188 * Function : tx_dtx_handler
189 * Purpose : adds extra speech hangover to analyze speech on the decoding side.
190 * Description : returns 1 when a new SID analysis may be made
191 * otherwise it adds the appropriate hangover after a sequence
192 * with out updates of SID parameters .
194 **************************************************************************
196 Word16 tx_dtx_handler(dtx_encState *st, /* i/o : State struct */
197 Word16 vad_flag, /* i : vad decision */
198 enum Mode *usedMode, /* i/o : mode changed or not */
199 Flag *pOverflow /* i/o : overflow indicator */
207 #endif /* _dtx_enc_h_ */