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 Filename: /audio/gsm_amr/c/include/d_plsf.h 32 33 ------------------------------------------------------------------------------ 34 REVISION HISTORY 35 36 Description: Placed header file in the proper template format. Added 37 parameter pOverflow for the basic math ops. 38 39 Description: Replaced "int" and/or "char" with OSCL defined types. 40 41 Description: Moved _cplusplus #ifdef after Include section. 42 43 Who: Date: 44 Description: 45 46 ------------------------------------------------------------------------------ 47 INCLUDE DESCRIPTION 48 49 This file contains all the constant definitions and prototype definitions 50 needed by the d_plsf_3.c and d_plsf_5.c 51 52 ------------------------------------------------------------------------------ 53 */ 54 55 /*---------------------------------------------------------------------------- 56 ; CONTINUE ONLY IF NOT ALREADY DEFINED 57 ----------------------------------------------------------------------------*/ 58 #ifndef d_plsf_h 59 #define d_plsf_h "$Id $" 60 61 /*---------------------------------------------------------------------------- 62 ; INCLUDES 63 ----------------------------------------------------------------------------*/ 64 #include "typedef.h" 65 #include "cnst.h" 66 #include "mode.h" 67 68 /*--------------------------------------------------------------------------*/ 69 #ifdef __cplusplus 70 extern "C" 71 { 72 #endif 73 74 /*---------------------------------------------------------------------------- 75 ; MACROS 76 ; Define module specific macros here 77 ----------------------------------------------------------------------------*/ 78 79 /*---------------------------------------------------------------------------- 80 ; DEFINES 81 ; Include all pre-processor statements here. 82 ----------------------------------------------------------------------------*/ 83 84 /*---------------------------------------------------------------------------- 85 ; EXTERNAL VARIABLES REFERENCES 86 ; Declare variables used in this module but defined elsewhere 87 ----------------------------------------------------------------------------*/ 88 89 /*---------------------------------------------------------------------------- 90 ; SIMPLE TYPEDEF'S 91 ----------------------------------------------------------------------------*/ 92 93 /*---------------------------------------------------------------------------- 94 ; ENUMERATED TYPEDEF'S 95 ----------------------------------------------------------------------------*/ 96 97 /*---------------------------------------------------------------------------- 98 ; STRUCTURES TYPEDEF'S 99 ----------------------------------------------------------------------------*/ 100 typedef struct 101 { 102 Word16 past_r_q[M]; /* Past quantized prediction error, Q15 */ 103 Word16 past_lsf_q[M]; /* Past dequantized lsfs, Q15 */ 104 } D_plsfState; 105 106 /*---------------------------------------------------------------------------- 107 ; GLOBAL FUNCTION DEFINITIONS 108 ; Function Prototype declaration 109 ----------------------------------------------------------------------------*/ 110 111 /* 112 ************************************************************************** 113 * 114 * Function : D_plsf_reset 115 * Purpose : Resets state memory 116 * Returns : 0 on success 117 * 118 ************************************************************************** 119 */ 120 Word16 D_plsf_reset(D_plsfState *st); 121 122 /* 123 ************************************************************************** 124 * 125 * Function : D_plsf_exit 126 * Purpose : The memory used for state memory is freed 127 * Description : Stores NULL in *st 128 * Returns : void 129 * 130 ************************************************************************** 131 */ 132 void D_plsf_exit(D_plsfState **st); 133 134 /* 135 ************************************************************************** 136 * 137 * Function : D_plsf_5 138 * Purpose : Decodes the 2 sets of LSP parameters in a frame 139 * using the received quantization indices. 140 * Description : The two sets of LSFs are quantized using split by 141 * 5 matrix quantization (split-MQ) with 1st order MA 142 * prediction. 143 * See "q_plsf_5.c" for more details about the 144 * quantization procedure 145 * Returns : 0 146 * 147 ************************************************************************** 148 */ 149 void D_plsf_5( 150 D_plsfState *st, /* i/o: State variables */ 151 Word16 bfi, /* i : bad frame indicator (set to 1 if a bad 152 frame is received) */ 153 Word16 *indice, /* i : quantization indices of 5 submatrices, Q0 */ 154 Word16 *lsp1_q, /* o : quantized 1st LSP vector (M) Q15 */ 155 Word16 *lsp2_q, /* o : quantized 2nd LSP vector (M) Q15 */ 156 Flag *pOverflow /* o : Flag set when overflow occurs */ 157 ); 158 159 /************************************************************************* 160 * 161 * FUNCTION: D_plsf_3() 162 * 163 * PURPOSE: Decodes the LSP parameters using the received quantization 164 * indices.1st order MA prediction and split by 3 matrix 165 * quantization (split-MQ) 166 * 167 *************************************************************************/ 168 169 void D_plsf_3( 170 D_plsfState *st, /* i/o: State struct */ 171 enum Mode mode, /* i : coder mode */ 172 Word16 bfi, /* i : bad frame indicator (set to 1 if a */ 173 /* bad frame is received) */ 174 Word16 * indice, /* i : quantization indices of 3 submatrices, Q0 */ 175 Word16 * lsp1_q, /* o : quantized 1st LSP vector, Q15 */ 176 Flag *pOverflow /* o : Flag set when overflow occurs */ 177 ); 178 179 /************************************************************************* 180 * 181 * FUNCTION: Init_D_plsf_3() 182 * 183 * PURPOSE: Set the past_r_q[M] vector to one of the eight 184 * past_rq_init vectors. 185 * 186 *************************************************************************/ 187 void Init_D_plsf_3(D_plsfState *st, /* i/o: State struct */ 188 Word16 index /* i : past_rq_init[] index [0, 7] */ 189 ); 190 191 /*---------------------------------------------------------------------------- 192 ; END 193 ----------------------------------------------------------------------------*/ 194 #ifdef __cplusplus 195 } 196 #endif 197 198 #endif /* _Q_PLSF_H_ */ 199 200