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/ton_stab.h
35 
36      Date: 02/05/2002
37 
38 ------------------------------------------------------------------------------
39  REVISION HISTORY
40 
41  Description:  Replaced "int" and/or "char" with OSCL defined types.
42 
43  Description: Moved _cplusplus #ifdef after Include section.
44 
45  Description:
46 
47 ------------------------------------------------------------------------------
48  INCLUDE DESCRIPTION
49 
50      File             : ton_stab.h
51      Purpose          : Tone stabilization routines
52 
53 ------------------------------------------------------------------------------
54 */
55 
56 #ifndef TON_STAB_H
57 #define TON_STAB_H
58 #define ton_stab_h "$Id $"
59 
60 /*----------------------------------------------------------------------------
61 ; INCLUDES
62 ----------------------------------------------------------------------------*/
63 #include "typedef.h"
64 #include "mode.h"
65 #include "cnst.h"
66 
67 /*--------------------------------------------------------------------------*/
68 #ifdef __cplusplus
69 extern "C"
70 {
71 #endif
72 
73     /*----------------------------------------------------------------------------
74     ; MACROS
75     ; Define module specific macros here
76     ----------------------------------------------------------------------------*/
77 
78     /*----------------------------------------------------------------------------
79     ; DEFINES
80     ; Include all pre-processor statements here.
81     ----------------------------------------------------------------------------*/
82 
83     /*----------------------------------------------------------------------------
84     ; EXTERNAL VARIABLES REFERENCES
85     ; Declare variables used in this module but defined elsewhere
86     ----------------------------------------------------------------------------*/
87 
88     /*----------------------------------------------------------------------------
89     ; SIMPLE TYPEDEF'S
90     ----------------------------------------------------------------------------*/
91     /* state variable */
92     typedef struct
93     {
94         /* counters */
95         Word16 count;
96         /* gain history Q11 */
97         Word16 gp[N_FRAME];
98     } tonStabState;
99 
100     /*----------------------------------------------------------------------------
101     ; ENUMERATED TYPEDEF'S
102     ----------------------------------------------------------------------------*/
103 
104     /*----------------------------------------------------------------------------
105     ; STRUCTURES TYPEDEF'S
106     ----------------------------------------------------------------------------*/
107 
108     /*----------------------------------------------------------------------------
109     ; GLOBAL FUNCTION DEFINITIONS
110     ; Function Prototype declaration
111     ----------------------------------------------------------------------------*/
112     Word16 ton_stab_init(tonStabState **st);
113     /* initialize one instance of the pre processing state.
114        Stores pointer to filter status struct in *st. This pointer has to
115        be passed to ton_stab in each call.
116        returns 0 on success
117      */
118 
119     Word16 ton_stab_reset(tonStabState *st);
120     /* reset of pre processing state (i.e. set state memory to zero)
121        returns 0 on success
122      */
123 
124     void ton_stab_exit(tonStabState **st);
125     /* de-initialize pre processing state (i.e. free status struct)
126        stores NULL in *st
127      */
128 
129     Word16 check_lsp(tonStabState *st, /* i/o : State struct            */
130                      Word16 *lsp,      /* i   : unquantized LSP's       */
131                      Flag   *pOverflow
132                     );
133 
134     Word16 check_gp_clipping(tonStabState *st, /* i/o : State struct          */
135                              Word16 g_pitch,   /* i   : pitch gain            */
136                              Flag  *pOverflow
137                             );
138 
139     void update_gp_clipping(tonStabState *st, /* i/o : State struct            */
140                             Word16 g_pitch,   /* i   : pitch gain              */
141                             Flag  *pOverflow
142                            );
143 
144     /*----------------------------------------------------------------------------
145     ; END
146     ----------------------------------------------------------------------------*/
147 #ifdef __cplusplus
148 }
149 #endif
150 
151 #endif /* _TON_STAB_H_ */
152 
153 
154 
155 
156