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  Pathname: ./gsm-amr/c/include/amrdecode.h
35 
36      Date: 05/23/2001
37 
38 ------------------------------------------------------------------------------
39  REVISION HISTORY
40 
41  Description: Added BytesUsed table so that the code can allow for padding
42               at the end of each frame.
43 
44  Description: Removed function prototypes for getbits, putbits,
45               put_frame_header_in, and get_frame_header_off. Removed
46               basicop_malloc.h and replaced it with typedef.h in the include
47               section. Fixed table entries for various SID modes. Removed
48               #defines because they are not used by AMRDecode function.
49               Removed tables not used by AMRDecode function.
50 
51  Description: The data type Speech_Decode_FrameState is now being passed into
52               this function as a void pointer rather than a structure of type
53               Speech_Decode_FrameState.
54 
55  Description: The variable decoder_state was renamed to state_data.
56 
57  Description: Updated function prototype and header template.
58 
59  Description: Added mode.h and frame_type_3gpp.h to include section, and
60               removed sp_dec.h.
61 
62  Description: Removed definition of Changed BytesThisFrame[] table. Added
63               extern declaration for BytesThisFrame[] table.
64 
65  Description: Added #define for WMF and IF2. Updated function prototype.
66 
67  Description: Moved input format #defines and BytesThisFrame table to
68               dec_input_format_tab.h and dec_input_format_tab.c, respectively.
69               Updated function prototype.
70 
71  Description: Updated function prototype of AMRDecode due to the removal of
72               *prev_mode_ptr. Added extern of If2BytesPerFrame
73 
74  Description: Added #defines for WMF, IF2, and ETS input formats.
75 
76  Description: Changed WmfBytesPerFrame to WmfDecBytesPerFrame, and
77               If2BytesPerFrame to If2DecBytesPerFrame.
78 
79  Description: Renamed #defines for input format types to make it unique to the
80               decoder.
81 
82  Description:  Replaced "int" and/or "char" with OSCL defined types.
83 
84  Description: Moved _cplusplus #ifdef after Include section.
85 
86  Description:
87 
88 ------------------------------------------------------------------------------
89  INCLUDE DESCRIPTION
90 
91  This file contains all the constant definitions and prototype definitions
92  needed by the norm_s function.
93 
94 ------------------------------------------------------------------------------
95 */
96 
97 /*----------------------------------------------------------------------------
98 ; CONTINUE ONLY IF NOT ALREADY DEFINED
99 ----------------------------------------------------------------------------*/
100 #ifndef ARMDECODE_H
101 #define ARMDECODE_H
102 
103 /*----------------------------------------------------------------------------
104 ; INCLUDES
105 ----------------------------------------------------------------------------*/
106 #include    "typedef.h"
107 #include    "mode.h"
108 #include    "frame_type_3gpp.h"
109 
110 /*--------------------------------------------------------------------------*/
111 #ifdef __cplusplus
112 extern "C"
113 {
114 #endif
115 
116     /*----------------------------------------------------------------------------
117     ; MACROS
118     ; Define module specific macros here
119     ----------------------------------------------------------------------------*/
120 
121     /*----------------------------------------------------------------------------
122     ; DEFINES
123     ; Include all pre-processor statements here.
124     ----------------------------------------------------------------------------*/
125 #define NUM_AMRSID_RXMODE_BITS   3
126 #define AMRSID_RXMODE_BIT_OFFSET 36
127 #define AMRSID_RXTYPE_BIT_OFFSET 35
128 
129     /*----------------------------------------------------------------------------
130     ; EXTERNAL VARIABLES REFERENCES
131     ; Declare variables used in this module but defined elsewhere
132     ----------------------------------------------------------------------------*/
133     extern const Word16 WmfDecBytesPerFrame[];
134     extern const Word16 If2DecBytesPerFrame[];
135 
136     /*----------------------------------------------------------------------------
137     ; SIMPLE TYPEDEF'S
138     ----------------------------------------------------------------------------*/
139 
140     /*----------------------------------------------------------------------------
141     ; ENUMERATED TYPEDEF'S
142     ----------------------------------------------------------------------------*/
143 
144     /*----------------------------------------------------------------------------
145     ; STRUCTURES TYPEDEF'S
146     ----------------------------------------------------------------------------*/
147 
148     /*----------------------------------------------------------------------------
149     ; GLOBAL FUNCTION DEFINITIONS
150     ; Function Prototype declaration
151     ----------------------------------------------------------------------------*/
152 
153     Word16 AMRDecode(
154         void *state_data,
155         enum Frame_Type_3GPP  frame_type,
156         UWord8 *speech_bits_ptr,
157         Word16 *raw_pcm_buffer,
158         bitstream_format input_format
159     );
160 
161 #ifdef __cplusplus
162 }
163 #endif
164 
165 #endif  /* _AMRDECODE_H_ */
166