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