gsmamr_dec.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 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/*--------------------------------------------------------------------------*/ 91#ifdef __cplusplus 92extern "C" 93{ 94#endif 95 96 /*---------------------------------------------------------------------------- 97 ; MACROS 98 ----------------------------------------------------------------------------*/ 99 100 101 /*---------------------------------------------------------------------------- 102 ; DEFINES 103 ----------------------------------------------------------------------------*/ 104 /* Number of 13-bit linear PCM samples per 20 ms frame */ 105 /* L_FRAME = (8 kHz) * (20 msec) = 160 samples */ 106#define L_FRAME 160 107 108 /*---------------------------------------------------------------------------- 109 ; EXTERNAL VARIABLES REFERENCES 110 ----------------------------------------------------------------------------*/ 111 112 113 /*---------------------------------------------------------------------------- 114 ; SIMPLE TYPEDEF'S 115 ----------------------------------------------------------------------------*/ 116 117 /*---------------------------------------------------------------------------- 118 ; ENUMERATED TYPEDEF'S 119 ----------------------------------------------------------------------------*/ 120 enum Frame_Type_3GPP 121 { 122 AMR_475 = 0, /* 4.75 kbps */ 123 AMR_515, /* 5.15 kbps */ 124 AMR_59, /* 5.9 kbps */ 125 AMR_67, /* 6.7 kbps */ 126 AMR_74, /* 7.4 kbps */ 127 AMR_795, /* 7.95 kbps */ 128 AMR_102, /* 10.2 kbps */ 129 AMR_122, /* 12.2 kbps */ 130 AMR_SID, /* GSM AMR DTX */ 131 GSM_EFR_SID, /* GSM EFR DTX */ 132 TDMA_EFR_SID, /* TDMA EFR DTX */ 133 PDC_EFR_SID, /* PDC EFR DTX */ 134 FOR_FUTURE_USE1, /* Unused 1 */ 135 FOR_FUTURE_USE2, /* Unused 2 */ 136 FOR_FUTURE_USE3, /* Unused 3 */ 137 AMR_NO_DATA 138 }; /* No data */ 139 140 /*---------------------------------------------------------------------------- 141 ; STRUCTURES TYPEDEF'S 142 ----------------------------------------------------------------------------*/ 143 144 145 /*---------------------------------------------------------------------------- 146 ; GLOBAL FUNCTION DEFINITIONS 147 ----------------------------------------------------------------------------*/ 148 /* 149 * This function allocates memory for filter structure and initializes state 150 * memory used by the GSM AMR decoder. This function returns zero. It will 151 * return negative one if there is an error. 152 */ 153 Word16 GSMInitDecode(void **state_data, 154 Word8 *id); 155 156 /* 157 * AMRDecode steps into the part of the library that decodes the raw data 158 * speech bits for the decoding process. It returns the address offset of 159 * the next frame to be decoded. 160 */ 161 Word16 AMRDecode( 162 void *state_data, 163 enum Frame_Type_3GPP frame_type, 164 UWord8 *speech_bits_ptr, 165 Word16 *raw_pcm_buffer, 166 Word16 input_format 167 ); 168 169 /* 170 * This function resets the state memory used by the GSM AMR decoder. This 171 * function returns zero. It will return negative one if there is an error. 172 */ 173 Word16 Speech_Decode_Frame_reset(void *state_data); 174 175 /* 176 * This function frees up the memory used for the state memory of the 177 * GSM AMR decoder. 178 */ 179 void GSMDecodeFrameExit(void **state_data); 180 181 182#ifdef __cplusplus 183} 184#endif 185 186#endif /* _GSMAMR_DEC_H_ */ 187 188