1 /* ------------------------------------------------------------------
2 * Copyright (C) 1998-2009 PacketVideo
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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
14 * See the License for the specific language governing permissions
15 * and limitations under the License.
16 * -------------------------------------------------------------------
18 /****************************************************************************************
19 Portions of this file are derived from the following 3GPP standard:
22 ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
23 Available from http://www.3gpp.org
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 ****************************************************************************************/
30 ------------------------------------------------------------------------------
34 Pathname: ./audio/gsm-amr/c/src/d_gain_p.c
39 ------------------------------------------------------------------------------
43 (1) Removed extra includes
44 (2) Replaced function calls to basic math operations with ANSI C standard
45 mathemtical operations.
46 (3) Placed code in the proper software template.
48 Description: Replaced "int" and/or "char" with OSCL defined types.
50 Description: Added #ifdef __cplusplus around extern'ed table.
54 ------------------------------------------------------------------------------
55 INPUT AND OUTPUT DEFINITIONS
58 mode -- enumerated type -- AMR mode
59 index -- Word16 -- index of quantization
66 Global Variables Used:
69 Local Variables Needed:
72 ------------------------------------------------------------------------------
75 Function : d_gain_pitch
76 Purpose : Decodes the pitch gain using the received index.
79 ------------------------------------------------------------------------------
84 ------------------------------------------------------------------------------
87 d_gain_p.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
89 ------------------------------------------------------------------------------
94 ------------------------------------------------------------------------------
96 When the code is written for a specific target processor the
97 the resources used should be documented below.
99 STACK USAGE: [stack count for this module] + [variable to represent
100 stack usage for each subroutine called]
102 where: [stack usage variable] = stack usage for [subroutine
103 name] (see [filename].ext)
105 DATA MEMORY USED: x words
107 PROGRAM MEMORY USED: x words
109 CLOCK CYCLES: [cycle count equation for this module] + [variable
110 used to represent cycle count for each subroutine
113 where: [cycle count variable] = cycle count for [subroutine
114 name] (see [filename].ext)
116 ------------------------------------------------------------------------------
120 /*----------------------------------------------------------------------------
122 ----------------------------------------------------------------------------*/
123 #include "d_gain_p.h"
127 /*--------------------------------------------------------------------------*/
133 /*----------------------------------------------------------------------------
135 ; Define module specific macros here
136 ----------------------------------------------------------------------------*/
139 /*----------------------------------------------------------------------------
141 ; Include all pre-processor statements here. Include conditional
142 ; compile variables also.
143 ----------------------------------------------------------------------------*/
145 /*----------------------------------------------------------------------------
146 ; LOCAL FUNCTION DEFINITIONS
147 ; Function Prototype declaration
148 ----------------------------------------------------------------------------*/
151 /*----------------------------------------------------------------------------
152 ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
153 ; Variable declaration - defined here and used outside this module
154 ----------------------------------------------------------------------------*/
156 /*----------------------------------------------------------------------------
157 ; EXTERNAL FUNCTION REFERENCES
158 ; Declare functions defined elsewhere and referenced in this module
159 ----------------------------------------------------------------------------*/
161 /*----------------------------------------------------------------------------
162 ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
163 ; Declare variables used in this module but defined elsewhere
164 ----------------------------------------------------------------------------*/
165 extern const Word16 qua_gain_pitch[];
167 /*--------------------------------------------------------------------------*/
172 /*----------------------------------------------------------------------------
174 ----------------------------------------------------------------------------*/
176 Word16 d_gain_pitch( /* return value: gain (Q14) */
177 enum Mode mode, /* i : AMR mode */
178 Word16 index /* i : index of quantization */
183 gain = qua_gain_pitch[index];