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 ------------------------------------------------------------------------------
39 This file contains all the constant definitions and prototype definitions
40 needed by the Phase dispersion of excitation signal ph_disp() function.
42 ------------------------------------------------------------------------------
46 #define PH_DISP_H "$Id $"
48 /*----------------------------------------------------------------------------
50 ----------------------------------------------------------------------------*/
53 #include "get_const_tbls.h"
55 /*--------------------------------------------------------------------------*/
61 /*----------------------------------------------------------------------------
63 ; Define module specific macros here
64 ----------------------------------------------------------------------------*/
66 /*----------------------------------------------------------------------------
68 ; Include all pre-processor statements here.
69 ----------------------------------------------------------------------------*/
70 #define PHDGAINMEMSIZE 5
71 #define PHDTHR1LTP 9830 /* 0.6 in Q14 */
72 #define PHDTHR2LTP 14746 /* 0.9 in Q14 */
73 #define ONFACTPLUS1 16384 /* 2.0 in Q13 */
76 /*----------------------------------------------------------------------------
77 ; EXTERNAL VARIABLES REFERENCES
78 ; Declare variables used in this module but defined elsewhere
79 ----------------------------------------------------------------------------*/
81 /*----------------------------------------------------------------------------
83 ----------------------------------------------------------------------------*/
85 /*----------------------------------------------------------------------------
86 ; ENUMERATED TYPEDEF'S
87 ----------------------------------------------------------------------------*/
89 /*----------------------------------------------------------------------------
90 ; STRUCTURES TYPEDEF'S
91 ----------------------------------------------------------------------------*/
94 Word16 gainMem[PHDGAINMEMSIZE];
101 /*----------------------------------------------------------------------------
102 ; GLOBAL FUNCTION DEFINITIONS
103 ; Function Prototype declaration
104 ----------------------------------------------------------------------------*/
106 /*----------------------------------------------------------------------------
108 ; Function: ph_disp_reset
109 ; Purpose: Initializes state memory
111 ----------------------------------------------------------------------------*/
112 Word16 ph_disp_reset(ph_dispState *state);
114 /*----------------------------------------------------------------------------
116 ; Function: ph_disp_exit
117 ; Purpose: The memory used for state memory is freed
119 ----------------------------------------------------------------------------*/
120 void ph_disp_exit(ph_dispState **state);
122 /*----------------------------------------------------------------------------
124 ; Function: ph_disp_lock
125 ; Purpose: mark phase dispersion as locked in state struct
127 ----------------------------------------------------------------------------*/
128 void ph_disp_lock(ph_dispState *state);
130 /*----------------------------------------------------------------------------
132 ; Function: ph_disp_release
133 ; Purpose: mark phase dispersion as unlocked in state struct
135 ----------------------------------------------------------------------------*/
137 void ph_disp_release(ph_dispState *state);
139 /*----------------------------------------------------------------------------
142 ; Purpose: perform phase dispersion according to the specified codec
143 ; mode and computes total excitation for synthesis part
146 ----------------------------------------------------------------------------*/
149 ph_dispState *state, /* i/o : State struct */
150 enum Mode mode, /* i : codec mode */
151 Word16 x[], /* i/o Q0 : in: LTP excitation signal */
152 /* out: total excitation signal */
153 Word16 cbGain, /* i Q1 : Codebook gain */
154 Word16 ltpGain, /* i Q14 : LTP gain */
155 Word16 inno[], /* i/o Q13 : Innovation vector (Q12 for 12.2) */
156 Word16 pitch_fac, /* i Q14 : pitch factor used to scale the
157 LTP excitation (Q13 for 12.2) */
158 Word16 tmp_shift, /* i Q0 : shift factor applied to sum of
159 scaled LTP ex & innov. before
161 CommonAmrTbls* common_amr_tbls, /* i : ptr to struct of table ptrs */
162 Flag *pOverflow /* i/o : oveflow indicator */
165 /*----------------------------------------------------------------------------
167 ----------------------------------------------------------------------------*/
172 #endif /* _PH_DISP_H_ */