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 ------------------------------------------------------------------------------
36 ------------------------------------------------------------------------------
40 Purpose : DTX mode computation of SID parameters
42 ------------------------------------------------------------------------------
46 #define dtx_enc_h "$Id $"
48 /*----------------------------------------------------------------------------
50 ----------------------------------------------------------------------------*/
56 #include "dtx_common_def.h"
58 /*--------------------------------------------------------------------------*/
64 /*----------------------------------------------------------------------------
66 ; [Define module specific macros here]
67 ----------------------------------------------------------------------------*/
69 /*----------------------------------------------------------------------------
71 ; [Include all pre-processor statements here.]
72 ----------------------------------------------------------------------------*/
74 /*----------------------------------------------------------------------------
75 ; EXTERNAL VARIABLES REFERENCES
76 ; [Declare variables used in this module but defined elsewhere]
77 ----------------------------------------------------------------------------*/
79 /*----------------------------------------------------------------------------
81 ----------------------------------------------------------------------------*/
83 /*----------------------------------------------------------------------------
84 ; ENUMERATED TYPEDEF'S
85 ----------------------------------------------------------------------------*/
87 /*----------------------------------------------------------------------------
88 ; STRUCTURES TYPEDEF'S
89 ----------------------------------------------------------------------------*/
92 Word16 lsp_hist[M * DTX_HIST_SIZE];
93 Word16 log_en_hist[DTX_HIST_SIZE];
96 Word16 init_lsf_vq_index;
99 /* DTX handler stuff */
100 Word16 dtxHangoverCount;
101 Word16 decAnaElapsedCount;
105 /*----------------------------------------------------------------------------
106 ; GLOBAL FUNCTION DEFINITIONS
107 ; [List function prototypes here]
108 ----------------------------------------------------------------------------*/
110 **************************************************************************
111 * Function : dtx_enc_init
112 * Purpose : Allocates memory and initializes state variables
113 * Description : Stores pointer to filter status struct in *st. This
114 * pointer has to be passed to dtx_enc in each call.
115 * Returns : 0 on success
117 **************************************************************************
119 Word16 dtx_enc_init(dtx_encState **st, const Word16* lsp_init_data_ptr);
122 **************************************************************************
124 * Function : dtx_enc_reset
125 * Purpose : Resets state memory
126 * Returns : 0 on success
128 **************************************************************************
130 Word16 dtx_enc_reset(dtx_encState *st, const Word16* lsp_init_data_ptr);
133 **************************************************************************
135 * Function : dtx_enc_exit
136 * Purpose : The memory used for state memory is freed
137 * Description : Stores NULL in *st
139 **************************************************************************
141 void dtx_enc_exit(dtx_encState **st);
144 **************************************************************************
150 **************************************************************************
152 void dtx_enc(dtx_encState *st, /* i/o : State struct */
153 Word16 computeSidFlag, /* i : compute SID */
154 Q_plsfState *qSt, /* i/o : Qunatizer state struct */
155 gc_predState* predState, /* i/o : State struct */
156 Word16 **anap, /* o : analysis parameters */
157 Flag *pOverflow /* i/o : overflow indicator */
161 **************************************************************************
163 * Function : dtx_buffer
164 * Purpose : handles the DTX buffer
166 **************************************************************************
168 void dtx_buffer(dtx_encState *st, /* i/o : State struct */
169 Word16 lsp_new[], /* i : LSP vector */
170 Word16 speech[], /* i : speech samples */
171 Flag *pOverflow /* i/o : overflow indicator */
175 **************************************************************************
177 * Function : tx_dtx_handler
178 * Purpose : adds extra speech hangover to analyze speech on the decoding side.
179 * Description : returns 1 when a new SID analysis may be made
180 * otherwise it adds the appropriate hangover after a sequence
181 * with out updates of SID parameters .
183 **************************************************************************
185 Word16 tx_dtx_handler(dtx_encState *st, /* i/o : State struct */
186 Word16 vad_flag, /* i : vad decision */
187 enum Mode *usedMode, /* i/o : mode changed or not */
188 Flag *pOverflow /* i/o : overflow indicator */
196 #endif /* _dtx_enc_h_ */