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/src/include/pstfilt.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             : pstfilt.h
51       Purpose          : Performs adaptive postfiltering on the synthesis
52                        : speech
53 
54 ------------------------------------------------------------------------------
55 */
56 
57 #ifndef _PSTFILT_H_
58 #define _PSTFILT_H_
59 #define pstfilt_h "$Id $"
60 
61 /*----------------------------------------------------------------------------
62 ; INCLUDES
63 ----------------------------------------------------------------------------*/
64 #include "typedef.h"
65 #include "mode.h"
66 #include "cnst.h"
67 #include "preemph.h"
68 #include "agc.h"
69 
70 /*--------------------------------------------------------------------------*/
71 #ifdef __cplusplus
72 extern "C"
73 {
74 #endif
75 
76     /*----------------------------------------------------------------------------
77     ; MACROS
78     ; [Define module specific macros here]
79     ----------------------------------------------------------------------------*/
80 
81     /*----------------------------------------------------------------------------
82     ; DEFINES
83     ; [Include all pre-processor statements here.]
84     ----------------------------------------------------------------------------*/
85 
86     /*----------------------------------------------------------------------------
87     ; EXTERNAL VARIABLES REFERENCES
88     ; [Declare variables used in this module but defined elsewhere]
89     ----------------------------------------------------------------------------*/
90 
91     /*----------------------------------------------------------------------------
92     ; SIMPLE TYPEDEF'S
93     ----------------------------------------------------------------------------*/
94 
95     /*----------------------------------------------------------------------------
96     ; ENUMERATED TYPEDEF'S
97     ----------------------------------------------------------------------------*/
98 
99     /*----------------------------------------------------------------------------
100     ; STRUCTURES TYPEDEF'S
101     ----------------------------------------------------------------------------*/
102     typedef struct
103     {
104         Word16 res2[L_SUBFR];
105         Word16 mem_syn_pst[M];
106         preemphasisState preemph_state;
107         agcState agc_state;
108         Word16 synth_buf[M + L_FRAME];
109     } Post_FilterState;
110 
111     /*----------------------------------------------------------------------------
112     ; GLOBAL FUNCTION DEFINITIONS
113     ; [List function prototypes here]
114     ----------------------------------------------------------------------------*/
115     Word16 Post_Filter_reset(Post_FilterState *st);
116     /* reset post filter (i.e. set state memory to zero)
117        returns 0 on success
118      */
119 
120     void Post_Filter(
121         Post_FilterState *st, /* i/o : post filter states                        */
122         enum Mode mode,       /* i   : AMR mode                                  */
123         Word16 *syn,          /* i/o : synthesis speech (postfiltered is output) */
124         Word16 *Az_4,         /* i   : interpolated LPC parameters in all subfr. */
125         Flag   *pOverflow
126     );
127     /* filters the signal syn using the parameters in Az_4 to calculate filter
128        coefficients.
129        The filter must be set up using Post_Filter_init prior to the first call
130        to Post_Filter. Post_FilterState is updated to mirror the current state
131        of the filter
132 
133        return 0 on success
134      */
135 
136 #ifdef __cplusplus
137 }
138 #endif
139 
140 #endif  /* _PSTFILT_H_ */
141 
142 
143 
144