ton_stab.h revision b841f14f8e51f2365945281fbfa54ef6a1b1b5a6
1dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui Zhu/* ------------------------------------------------------------------
2dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui Zhu * Copyright (C) 1998-2009 PacketVideo
3dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui Zhu *
4dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui Zhu * Licensed under the Apache License, Version 2.0 (the "License");
5dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui Zhu * you may not use this file except in compliance with the License.
6dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui Zhu * You may obtain a copy of the License at
7dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui Zhu *
8dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui Zhu *      http://www.apache.org/licenses/LICENSE-2.0
9dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui Zhu *
10dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui Zhu * Unless required by applicable law or agreed to in writing, software
11dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui Zhu * distributed under the License is distributed on an "AS IS" BASIS,
12dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui Zhu * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui Zhu * express or implied.
14dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui Zhu * See the License for the specific language governing permissions
15dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui Zhu * and limitations under the License.
16dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui Zhu * -------------------------------------------------------------------
17dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui Zhu */
18dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui Zhu/****************************************************************************************
19dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui ZhuPortions of this file are derived from the following 3GPP standard:
20dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui Zhu
21dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui Zhu    3GPP TS 26.073
22dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui Zhu    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
23dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui Zhu    Available from http://www.3gpp.org
24dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui Zhu
25dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui Zhu(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
26dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui ZhuPermission to distribute, modify and use this file under the standard license
27dd9eb897ee7c7b507cbdcf80263bb4b5de6966bfTeng-Hui Zhuterms 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
69extern "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