Initialize Tizen 2.3
[external/opencore-amr.git] / opencore / codecs_v2 / audio / gsm_amr / amr_nb / common / src / bitno_tab.cpp
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: bitno_tab.cpp
32
33 ------------------------------------------------------------------------------
34  INPUT AND OUTPUT DEFINITIONS
35
36  Inputs:
37     None
38
39  Local Stores/Buffers/Pointers Needed:
40     None
41
42  Global Stores/Buffers/Pointers Needed:
43     None
44
45  Outputs:
46     None
47
48  Pointers and Buffers Modified:
49     None
50
51  Local Stores Modified:
52     None
53
54  Global Stores Modified:
55     None
56
57 ------------------------------------------------------------------------------
58  FUNCTION DESCRIPTION
59
60       File             : bitno.tab
61       Purpose          : Tables for bit2prm and prm2bit
62
63 ------------------------------------------------------------------------------
64  REQUIREMENTS
65
66  None
67
68 ------------------------------------------------------------------------------
69  REFERENCES
70
71  None
72
73 ------------------------------------------------------------------------------
74  PSEUDO-CODE
75
76
77 ------------------------------------------------------------------------------
78 */
79
80
81 /*----------------------------------------------------------------------------
82 ; INCLUDES
83 ----------------------------------------------------------------------------*/
84 #include "typedef.h"
85 #include "cnst.h"   /* parameter sizes: MAX_PRM_SIZE */
86 #include "mode.h"   /* N_MODES */
87 #include "bitno_tab.h"
88
89
90 /*--------------------------------------------------------------------------*/
91 #ifdef __cplusplus
92 extern "C"
93 {
94 #endif
95
96     /*----------------------------------------------------------------------------
97     ; MACROS
98     ; Define module specific macros here
99     ----------------------------------------------------------------------------*/
100
101
102     /*----------------------------------------------------------------------------
103     ; DEFINES
104     ; Include all pre-processor statements here. Include conditional
105     ; compile variables also.
106     ----------------------------------------------------------------------------*/
107
108     /*----------------------------------------------------------------------------
109     ; LOCAL FUNCTION DEFINITIONS
110     ; Function Prototype declaration
111     ----------------------------------------------------------------------------*/
112
113
114     /*----------------------------------------------------------------------------
115     ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
116     ; Variable declaration - defined here and used outside this module
117     ----------------------------------------------------------------------------*/
118     /* number of parameters per modes (values must be <= MAX_PRM_SIZE!) */
119     const Word16 prmno[N_MODES] =
120     {
121         PRMNO_MR475,
122         PRMNO_MR515,
123         PRMNO_MR59,
124         PRMNO_MR67,
125         PRMNO_MR74,
126         PRMNO_MR795,
127         PRMNO_MR102,
128         PRMNO_MR122,
129         PRMNO_MRDTX
130     };
131
132     /* number of parameters to first subframe per modes */
133     const Word16 prmnofsf[N_MODES - 1] =
134     {
135         PRMNOFSF_MR475,
136         PRMNOFSF_MR515,
137         PRMNOFSF_MR59,
138         PRMNOFSF_MR67,
139         PRMNOFSF_MR74,
140         PRMNOFSF_MR795,
141         PRMNOFSF_MR102,
142         PRMNOFSF_MR122
143     };
144
145     /* parameter sizes (# of bits), one table per mode */
146     const Word16 bitno_MR475[PRMNO_MR475] =
147     {
148         8, 8, 7,                                 /* LSP VQ          */
149         8, 7, 2, 8,                              /* first subframe  */
150         4, 7, 2,                                 /* second subframe */
151         4, 7, 2, 8,                              /* third subframe  */
152         4, 7, 2,                                 /* fourth subframe */
153     };
154
155     const Word16 bitno_MR515[PRMNO_MR515] =
156     {
157         8, 8, 7,                                 /* LSP VQ          */
158         8, 7, 2, 6,                              /* first subframe  */
159         4, 7, 2, 6,                              /* second subframe */
160         4, 7, 2, 6,                              /* third subframe  */
161         4, 7, 2, 6,                              /* fourth subframe */
162     };
163
164     const Word16 bitno_MR59[PRMNO_MR59] =
165     {
166         8, 9, 9,                                 /* LSP VQ          */
167         8, 9, 2, 6,                              /* first subframe  */
168         4, 9, 2, 6,                              /* second subframe */
169         8, 9, 2, 6,                              /* third subframe  */
170         4, 9, 2, 6,                              /* fourth subframe */
171     };
172
173     const Word16 bitno_MR67[PRMNO_MR67] =
174     {
175         8, 9, 9,                                 /* LSP VQ          */
176         8, 11, 3, 7,                             /* first subframe  */
177         4, 11, 3, 7,                             /* second subframe */
178         8, 11, 3, 7,                             /* third subframe  */
179         4, 11, 3, 7,                             /* fourth subframe */
180     };
181
182     const Word16 bitno_MR74[PRMNO_MR74] =
183     {
184         8, 9, 9,                                 /* LSP VQ          */
185         8, 13, 4, 7,                             /* first subframe  */
186         5, 13, 4, 7,                             /* second subframe */
187         8, 13, 4, 7,                             /* third subframe  */
188         5, 13, 4, 7,                             /* fourth subframe */
189     };
190
191     const Word16 bitno_MR795[PRMNO_MR795] =
192     {
193         9, 9, 9,                                 /* LSP VQ          */
194         8, 13, 4, 4, 5,                          /* first subframe  */
195         6, 13, 4, 4, 5,                          /* second subframe */
196         8, 13, 4, 4, 5,                          /* third subframe  */
197         6, 13, 4, 4, 5,                          /* fourth subframe */
198     };
199
200     const Word16 bitno_MR102[PRMNO_MR102] =
201     {
202         8, 9, 9,                                 /* LSP VQ          */
203         8, 1, 1, 1, 1, 10, 10, 7, 7,             /* first subframe  */
204         5, 1, 1, 1, 1, 10, 10, 7, 7,             /* second subframe */
205         8, 1, 1, 1, 1, 10, 10, 7, 7,             /* third subframe  */
206         5, 1, 1, 1, 1, 10, 10, 7, 7,             /* fourth subframe */
207     };
208
209     const Word16 bitno_MR122[PRMNO_MR122] =
210     {
211         7, 8, 9, 8, 6,                           /* LSP VQ          */
212         9, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5,   /* first subframe  */
213         6, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5,   /* second subframe */
214         9, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5,   /* third subframe  */
215         6, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5    /* fourth subframe */
216     };
217
218     const Word16 bitno_MRDTX[PRMNO_MRDTX] =
219     {
220         3,
221         8, 9, 9,
222         6
223     };
224
225     /* overall table with all parameter sizes for all modes */
226     const Word16 * const bitno[N_MODES] =
227     {
228         bitno_MR475,
229         bitno_MR515,
230         bitno_MR59,
231         bitno_MR67,
232         bitno_MR74,
233         bitno_MR795,
234         bitno_MR102,
235         bitno_MR122,
236         bitno_MRDTX
237     };
238     /*----------------------------------------------------------------------------
239     ; EXTERNAL FUNCTION REFERENCES
240     ; Declare functions defined elsewhere and referenced in this module
241     ----------------------------------------------------------------------------*/
242
243
244     /*----------------------------------------------------------------------------
245     ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
246     ; Declare variables used in this module but defined elsewhere
247     ----------------------------------------------------------------------------*/
248
249
250     /*--------------------------------------------------------------------------*/
251 #ifdef __cplusplus
252 }
253 #endif
254
255 /*----------------------------------------------------------------------------
256 ; FUNCTION CODE
257 ----------------------------------------------------------------------------*/
258
259 /*----------------------------------------------------------------------------
260 ; Define all local variables
261 ----------------------------------------------------------------------------*/
262
263
264 /*----------------------------------------------------------------------------
265 ; Function body here
266 ----------------------------------------------------------------------------*/
267
268
269 /*----------------------------------------------------------------------------
270 ; Return nothing or data or data pointer
271 ----------------------------------------------------------------------------*/
272
273