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/****************************************************************************************
19Portions 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)
26Permission to distribute, modify and use this file under the standard license
27terms 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    "frame_type_3gpp.h"
108
109/*--------------------------------------------------------------------------*/
110#ifdef __cplusplus
111extern "C"
112{
113#endif
114
115    /*----------------------------------------------------------------------------
116    ; MACROS
117    ; Define module specific macros here
118    ----------------------------------------------------------------------------*/
119
120    /*----------------------------------------------------------------------------
121    ; DEFINES
122    ; Include all pre-processor statements here.
123    ----------------------------------------------------------------------------*/
124#define NUM_AMRSID_RXMODE_BITS   3
125#define AMRSID_RXMODE_BIT_OFFSET 36
126#define AMRSID_RXTYPE_BIT_OFFSET 35
127
128    /*----------------------------------------------------------------------------
129    ; EXTERNAL VARIABLES REFERENCES
130    ; Declare variables used in this module but defined elsewhere
131    ----------------------------------------------------------------------------*/
132    extern const Word16 WmfDecBytesPerFrame[];
133    extern const Word16 If2DecBytesPerFrame[];
134
135    /*----------------------------------------------------------------------------
136    ; SIMPLE TYPEDEF'S
137    ----------------------------------------------------------------------------*/
138
139    /*----------------------------------------------------------------------------
140    ; ENUMERATED TYPEDEF'S
141    ----------------------------------------------------------------------------*/
142
143    /*----------------------------------------------------------------------------
144    ; STRUCTURES TYPEDEF'S
145    ----------------------------------------------------------------------------*/
146
147    /*----------------------------------------------------------------------------
148    ; GLOBAL FUNCTION DEFINITIONS
149    ; Function Prototype declaration
150    ----------------------------------------------------------------------------*/
151
152    Word16 AMRDecode(
153        void *state_data,
154        enum Frame_Type_3GPP  frame_type,
155        UWord8 *speech_bits_ptr,
156        Word16 *raw_pcm_buffer,
157        bitstream_format input_format
158    );
159
160#ifdef __cplusplus
161}
162#endif
163
164#endif  /* _AMRDECODE_H_ */
165