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