OSDN Git Service

original
[gb-231r1-is01/Gingerbread_2.3.3_r1_IS01.git] / frameworks / base / media / libstagefright / codecs / amrnb / dec / src / gsmamr_dec.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: /audio/gsm-amr/c/include/gsmamr_dec.h
35
36      Date: 09/10/2001
37
38 ------------------------------------------------------------------------------
39  REVISION HISTORY
40
41  Description: Adding comments and removing some tables as per review comments.
42
43  Description: Replace enum Mode with enum Frame_Type_3GPP and updated function
44               prototype of AMRDecode().
45
46  Description: Added back the enum Mode type definition, removed RXFrameType
47               type definition, and updated AMRDecode and GSMInitDecode function
48               prototypes.
49
50  Description: Added #defines for WMF and IF2. Updated AMRDecode function
51               prototype.
52
53  Description: Removed enum Mode type definition and updated AMRDecode function
54               prototype.
55
56  Description: Renamed WMF and IF2 to AMR_WMF and AMR_IF2, respectively. Added
57               #define for AMR_ETS format.
58
59  Description: Rename input format defines to make it unique to the decoder.
60
61  Description: Added comment to describe L_FRAME.
62
63  Description: Moved _cplusplus #ifdef after Include section.
64
65  Description: Included file "typedefs.h" to avoid re-declaring similar typedef
66               this for OSCL-ed compatibility
67
68  Description: Included file "gsm_amr_typedefs.h" and eliminated re-definition
69               of types UWord8, Word8, Word16
70
71  Description:
72
73 ------------------------------------------------------------------------------
74  INCLUDE DESCRIPTION
75
76  This header contains all the necessary information needed to allow the gsm amr
77  decoder library to be used properly upon release.
78
79 ------------------------------------------------------------------------------
80 */
81 #ifndef _GSMAMR_DEC_H_
82 #define _GSMAMR_DEC_H_
83
84 /*----------------------------------------------------------------------------
85 ; INCLUDES
86 ----------------------------------------------------------------------------*/
87
88 #include "gsm_amr_typedefs.h"
89 #include "pvamrnbdecoder_api.h"
90 #include "frame_type_3gpp.h"
91
92 /*--------------------------------------------------------------------------*/
93 #ifdef __cplusplus
94 extern "C"
95 {
96 #endif
97
98     /*----------------------------------------------------------------------------
99     ; MACROS
100     ----------------------------------------------------------------------------*/
101
102
103     /*----------------------------------------------------------------------------
104     ; DEFINES
105     ----------------------------------------------------------------------------*/
106     /* Number of 13-bit linear PCM samples per 20 ms frame */
107     /* L_FRAME = (8 kHz) * (20 msec) = 160 samples         */
108 #define L_FRAME     160
109
110     /*----------------------------------------------------------------------------
111     ; EXTERNAL VARIABLES REFERENCES
112     ----------------------------------------------------------------------------*/
113
114
115     /*----------------------------------------------------------------------------
116     ; SIMPLE TYPEDEF'S
117     ----------------------------------------------------------------------------*/
118
119     /*----------------------------------------------------------------------------
120     ; ENUMERATED TYPEDEF'S
121     ----------------------------------------------------------------------------*/
122
123     /*----------------------------------------------------------------------------
124     ; STRUCTURES TYPEDEF'S
125     ----------------------------------------------------------------------------*/
126
127
128     /*----------------------------------------------------------------------------
129     ; GLOBAL FUNCTION DEFINITIONS
130     ----------------------------------------------------------------------------*/
131     /*
132      * This function allocates memory for filter structure and initializes state
133      * memory used by the GSM AMR decoder. This function returns zero. It will
134      * return negative one if there is an error.
135      */
136     Word16 GSMInitDecode(void **state_data,
137                          Word8 *id);
138
139     /*
140      * AMRDecode steps into the part of the library that decodes the raw data
141      * speech bits for the decoding process. It returns the address offset of
142      * the next frame to be decoded.
143      */
144     Word16 AMRDecode(
145         void                      *state_data,
146         enum Frame_Type_3GPP      frame_type,
147         UWord8                    *speech_bits_ptr,
148         Word16                    *raw_pcm_buffer,
149         Word16                    input_format
150     );
151
152     /*
153      * This function resets the state memory used by the GSM AMR decoder. This
154      * function returns zero. It will return negative one if there is an error.
155      */
156     Word16 Speech_Decode_Frame_reset(void *state_data);
157
158     /*
159      * This function frees up the memory used for the state memory of the
160      * GSM AMR decoder.
161      */
162     void GSMDecodeFrameExit(void **state_data);
163
164
165 #ifdef __cplusplus
166 }
167 #endif
168
169 #endif  /* _GSMAMR_DEC_H_ */
170