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/lsp.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 lsp.c 51 52 ------------------------------------------------------------------------------ 53 */ 54 55 /*---------------------------------------------------------------------------- 56 ; CONTINUE ONLY IF NOT ALREADY DEFINED 57 ----------------------------------------------------------------------------*/ 58 #ifndef lsp_h 59 #define lsp_h "$Id $" 60 61 /*---------------------------------------------------------------------------- 62 ; INCLUDES 63 ----------------------------------------------------------------------------*/ 64 #include "typedef.h" 65 #include "q_plsf.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 103 /* Past LSPs */ 104 Word16 lsp_old[M]; 105 Word16 lsp_old_q[M]; 106 107 /* Quantization state */ 108 Q_plsfState *qSt; 109 110 } lspState; 111 112 /*---------------------------------------------------------------------------- 113 ; GLOBAL FUNCTION DEFINITIONS 114 ; Function Prototype declaration 115 ----------------------------------------------------------------------------*/ 116 /* 117 ************************************************************************** 118 * 119 * Function : lsp_init 120 * Purpose : Allocates memory and initializes state variables 121 * Description : Stores pointer to filter status struct in *st. This 122 * pointer has to be passed to lsp in each call. 123 * Returns : 0 on success 124 * 125 ************************************************************************** 126 */ 127 Word16 lsp_init(lspState **st); 128 129 /* 130 ************************************************************************** 131 * 132 * Function : lsp_reset 133 * Purpose : Resets state memory 134 * Returns : 0 on success 135 * 136 ************************************************************************** 137 */ 138 Word16 lsp_reset(lspState *st); 139 140 /* 141 ************************************************************************** 142 * 143 * Function : lsp_exit 144 * Purpose : The memory used for state memory is freed 145 * Description : Stores NULL in *st 146 * 147 ************************************************************************** 148 */ 149 void lsp_exit(lspState **st); 150 151 /* 152 ************************************************************************** 153 * 154 * Function : lsp 155 * Purpose : Conversion from LP coefficients to LSPs. 156 * Quantization of LSPs. 157 * Description : Generates 2 sets of LSPs from 2 sets of 158 * LP coefficients for mode 12.2. For the other 159 * modes 1 set of LSPs is generated from 1 set of 160 * LP coefficients. These LSPs are quantized with 161 * Matrix/Vector quantization (depending on the mode) 162 * and interpolated for the subframes not yet having 163 * their own LSPs. 164 * 165 ************************************************************************** 166 */ 167 void lsp(lspState *st, /* i/o : State struct */ 168 enum Mode req_mode, /* i : requested coder mode */ 169 enum Mode used_mode,/* i : used coder mode */ 170 Word16 az[], /* i/o : interpolated LP parameters Q12 */ 171 Word16 azQ[], /* o : quantization interpol. LP parameters Q12*/ 172 Word16 lsp_new[], /* o : new lsp vector */ 173 Word16 **anap, /* o : analysis parameters */ 174 Flag *pOverflow /* o : Flag set when overflow occurs */ 175 ); 176 177 /*---------------------------------------------------------------------------- 178 ; END 179 ----------------------------------------------------------------------------*/ 180 #ifdef __cplusplus 181 } 182 #endif 183 184 #endif /* _LSP_H_ */ 185 186 187