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