gains_tbl.cpp 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 Filename: /audio/gsm_amr/c/src/gains_tbl.c
32
33------------------------------------------------------------------------------
34 REVISION HISTORY
35
36 Description: Created this file from the reference, gains.tab
37
38 Description: Added include of "typedef.h" to includes section.
39
40 Description: Added #ifdef __cplusplus and removed "extern" from table
41              definition.
42
43 Description: Put "extern" back.
44
45 Who:                               Date:
46 Description:
47
48------------------------------------------------------------------------------
49 MODULE DESCRIPTION
50
51------------------------------------------------------------------------------
52*/
53
54/*----------------------------------------------------------------------------
55; INCLUDES
56----------------------------------------------------------------------------*/
57#include "typedef.h"
58
59/*--------------------------------------------------------------------------*/
60#ifdef __cplusplus
61extern "C"
62{
63#endif
64
65    /*----------------------------------------------------------------------------
66    ; MACROS
67    ; [Define module specific macros here]
68    ----------------------------------------------------------------------------*/
69
70    /*----------------------------------------------------------------------------
71    ; DEFINES
72    ; [Include all pre-processor statements here. Include conditional
73    ; compile variables also.]
74    ----------------------------------------------------------------------------*/
75#define NB_QUA_PITCH 16
76#define NB_QUA_CODE 32
77
78    /*----------------------------------------------------------------------------
79    ; LOCAL FUNCTION DEFINITIONS
80    ; [List function prototypes here]
81    ----------------------------------------------------------------------------*/
82
83    /*----------------------------------------------------------------------------
84    ; LOCAL VARIABLE DEFINITIONS
85    ; [Variable declaration - defined here and used outside this module]
86    ----------------------------------------------------------------------------*/
87
88
89    extern const Word16 qua_gain_pitch[NB_QUA_PITCH] =
90    {
91        0, 3277, 6556, 8192, 9830, 11469, 12288, 13107,
92        13926, 14746, 15565, 16384, 17203, 18022, 18842, 19661
93    };
94
95
96    extern const Word16 qua_gain_code[(NB_QUA_CODE+1)*3] =
97    {
98        /* gain factor (g_fac) and quantized energy error (qua_ener_MR122, qua_ener)
99         * are stored:
100         *
101         * qua_ener_MR122 = log2(g_fac)      (not the rounded floating point value, but
102         *                                    the value the original EFR algorithm
103         *                                    calculates from g_fac [using Log2])
104         * qua_ener       = 20*log10(g_fac); (rounded floating point value)
105         *
106         *
107         * g_fac (Q11), qua_ener_MR122 (Q10), qua_ener (Q10)
108         */
109        159,                -3776,          -22731,
110        206,                -3394,          -20428,
111        268,                -3005,          -18088,
112        349,                -2615,          -15739,
113        419,                -2345,          -14113,
114        482,                -2138,          -12867,
115        554,                -1932,          -11629,
116        637,                -1726,          -10387,
117        733,                -1518,           -9139,
118        842,                -1314,           -7906,
119        969,                -1106,           -6656,
120        1114,                 -900,           -5416,
121        1281,                 -694,           -4173,
122        1473,                 -487,           -2931,
123        1694,                 -281,           -1688,
124        1948,                  -75,            -445,
125        2241,                  133,             801,
126        2577,                  339,            2044,
127        2963,                  545,            3285,
128        3408,                  752,            4530,
129        3919,                  958,            5772,
130        4507,                 1165,            7016,
131        5183,                 1371,            8259,
132        5960,                 1577,            9501,
133        6855,                 1784,           10745,
134        7883,                 1991,           11988,
135        9065,                 2197,           13231,
136        10425,                 2404,           14474,
137        12510,                 2673,           16096,
138        16263,                 3060,           18429,
139        21142,                 3448,           20763,
140        27485,                 3836,           23097,
141        27485,                 3836,           23097
142    };
143
144    /*--------------------------------------------------------------------------*/
145#ifdef __cplusplus
146}
147#endif
148
149/*
150------------------------------------------------------------------------------
151 FUNCTION NAME:
152------------------------------------------------------------------------------
153 INPUT AND OUTPUT DEFINITIONS
154
155 Inputs:
156    None
157
158 Outputs:
159    None
160
161 Returns:
162    None
163
164 Global Variables Used:
165    None
166
167 Local Variables Needed:
168    None
169
170------------------------------------------------------------------------------
171 FUNCTION DESCRIPTION
172
173 None
174
175------------------------------------------------------------------------------
176 REQUIREMENTS
177
178 None
179
180------------------------------------------------------------------------------
181 REFERENCES
182
183 [1] gains.tab,  UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
184
185------------------------------------------------------------------------------
186 PSEUDO-CODE
187
188
189------------------------------------------------------------------------------
190 RESOURCES USED [optional]
191
192 When the code is written for a specific target processor the
193 the resources used should be documented below.
194
195 HEAP MEMORY USED: x bytes
196
197 STACK MEMORY USED: x bytes
198
199 CLOCK CYCLES: (cycle count equation for this function) + (variable
200                used to represent cycle count for each subroutine
201                called)
202     where: (cycle count variable) = cycle count for [subroutine
203                                     name]
204
205------------------------------------------------------------------------------
206 CAUTION [optional]
207 [State any special notes, constraints or cautions for users of this function]
208
209------------------------------------------------------------------------------
210*/
211
212/*----------------------------------------------------------------------------
213; FUNCTION CODE
214----------------------------------------------------------------------------*/
215
216
217
218