1 /* ------------------------------------------------------------------
2  * Copyright (C) 1998-2009 PacketVideo
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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
13  * express or implied.
14  * See the License for the specific language governing permissions
15  * and limitations under the License.
16  * -------------------------------------------------------------------
17  */
18 /****************************************************************************************
19 Portions of this file are derived from the following 3GPP standard:
20 
21     3GPP TS 26.073
22     ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
23     Available from http://www.3gpp.org
24 
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 ****************************************************************************************/
29 /*
30 ------------------------------------------------------------------------------
31 
32 
33 
34  Filename: /audio/gsm_amr/c/include/add.h
35 
36 
37 
38 
39      Date: 08/11/2000
40 
41 
42 
43 ------------------------------------------------------------------------------
44  REVISION HISTORY
45 
46 
47  Description: Created separate header file for add function.
48 
49  Description: Changed function prototype; pointer to  overflow flag is passed
50               in as a parameter.
51 
52  Description: Updated copyright section.
53               Changed "overflow" to "pOverflow" in the function prototype.
54 
55  Description: Moved _cplusplus #ifdef after Include section.
56 
57  Description:
58 
59 
60 ------------------------------------------------------------------------------
61  INCLUDE DESCRIPTION
62 
63  This file contains all the constant definitions and prototype definitions
64  needed by the comfort noise(CN) generator functions
65 
66 ------------------------------------------------------------------------------
67 */
68 
69 #ifndef B_CN_COD_H
70 #define B_CN_COD_H
71 
72 /*----------------------------------------------------------------------------
73 ; INCLUDES
74 ----------------------------------------------------------------------------*/
75 #include    "basicop_malloc.h"
76 
77 /*--------------------------------------------------------------------------*/
78 #ifdef __cplusplus
79 extern "C"
80 {
81 #endif
82 
83     /*----------------------------------------------------------------------------
84     ; MACROS
85     ; Define module specific macros here
86     ----------------------------------------------------------------------------*/
87 
88     /*----------------------------------------------------------------------------
89     ; DEFINES
90     ; Include all pre-processor statements here.
91     ----------------------------------------------------------------------------*/
92 
93     /*----------------------------------------------------------------------------
94     ; EXTERNAL VARIABLES REFERENCES
95     ; Declare variables used in this module but defined elsewhere
96     ----------------------------------------------------------------------------*/
97     extern Word16 window_200_40[];
98 
99     /*----------------------------------------------------------------------------
100     ; SIMPLE TYPEDEF'S
101     ----------------------------------------------------------------------------*/
102 
103     /*----------------------------------------------------------------------------
104     ; ENUMERATED TYPEDEF'S
105     ----------------------------------------------------------------------------*/
106 
107     /*----------------------------------------------------------------------------
108     ; STRUCTURES TYPEDEF'S
109     ----------------------------------------------------------------------------*/
110 
111     /*----------------------------------------------------------------------------
112     ; GLOBAL FUNCTION DEFINITIONS
113     ; Function Prototype declaration
114     ----------------------------------------------------------------------------*/
115 
116     /*----------------------------------------------------------------------------
117 
118     ; FUNCTION NAME: pseudonoise
119     ;
120     ; PURPOSE: Generate a random integer value to use in comfort noise
121     ;          generation. The algorithm uses polynomial x^31 + x^3 + 1
122     ;          (length of PN sequence is 2^31 - 1).
123     ;
124     ----------------------------------------------------------------------------*/
125 
126     Word16 pseudonoise(
127         Word32 *pShift_reg,     /* i/o : Old CN generator shift register state */
128         Word16 no_bits          /* i   : Number of bits                        */
129     );
130 
131     /*----------------------------------------------------------------------------
132 
133     ; FUNCTION NAME: build_CN_code
134     ;
135     ; PURPOSE: Compute the comfort noise fixed codebook excitation. The
136     ;          gains of the pulses are always +/-1.
137     ;
138     ----------------------------------------------------------------------------*/
139 
140     void build_CN_code(
141         Word32 *pSeed,          /* i/o : Old CN generator shift register state  */
142         Word16 cod[],           /* o   : Generated CN fixed codebook vector     */
143         Flag   *pOverflow       /* i/o : Overflow flag                          */
144     );
145 
146     /*----------------------------------------------------------------------------
147 
148     ; FUNCTION NAME: build_CN_param
149     ;
150     ; PURPOSE: Randomize the speech parameters. So that they
151     ;          do not produce tonal artifacts if used by ECU.
152     ;
153     ----------------------------------------------------------------------------*/
154 
155     void build_CN_param(
156         Word16 *pSeed,          /* i/o : Old CN generator shift register state  */
157         const Word16 n_param,               /* i  : number of params            */
158         const Word16 param_size_table[],    /* i : size of params               */
159         Word16 parm[],                  /* o : CN Generated params              */
160         Flag  *pOverflow                /* i/o : Overflow Flag                  */
161     );
162 
163     /*----------------------------------------------------------------------------
164     ; END
165     ----------------------------------------------------------------------------*/
166 #ifdef __cplusplus
167 }
168 #endif
169 
170 #endif /* _B_CN_COD_H_ */
171 
172