Line data Source code
1 : /*====================================================================================
2 : EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
3 : ====================================================================================*/
4 :
5 : #include <stdio.h>
6 : #include <stdlib.h>
7 : #include <memory.h>
8 : #include <assert.h>
9 : #include "options.h"
10 : #include "stl.h"
11 : #include "prot_fx.h"
12 : #include "rom_com.h"
13 : #include "basop_util.h"
14 :
15 : /**********************************************************************/ /*
16 : returns an int val, multiplied with transFac
17 : **************************************************************************/
18 2972384 : Word16 IGF_ApplyTransFac( /**< out: Q0 | multiplication factor */
19 : const Word16 val, /**< in: Q15 | input value for multiplication, Q15 */
20 : const Word16 transFac /**< in: Q14 | multiplicator for variable val, Q14: 1.25f=0x5000, 1.0f=0x4000, 0.5f=0x2000 */
21 : )
22 : {
23 : Word16 ret;
24 :
25 2972384 : IF( EQ_16( transFac, 0x4000 /*ONE in Q14*/ ) )
26 : {
27 1035040 : return val;
28 : }
29 :
30 1937344 : ret = shl( val, 1 );
31 1937344 : ret = mac_r( 0x00000000, ret, transFac );
32 1937344 : ret = add( ret, s_and( ret, 1 ) ); /*Q0*/
33 :
34 :
35 1937344 : return ret; /*Q0*/
36 : }
37 :
38 : /**********************************************************************/ /*
39 : maps a given bitrate to the IGF_BITRATE index
40 : **************************************************************************/
41 927621 : Word16 IGF_MapBitRateToIndex(
42 : const Word32 brate, /* i : bitrate */
43 : const Word16 bwidth, /* i : audio bandwidth */
44 : const Word16 element_mode, /* i : element mode */
45 : const Word16 rf_mode /* i : flag to signal the RF mode */
46 : )
47 : {
48 927621 : Word16 bitRateIndex = IGF_BITRATE_UNKNOWN;
49 927621 : move16();
50 : /* Stereo/CPE modes */
51 927621 : IF( GT_16( element_mode, IVAS_SCE ) )
52 : {
53 872897 : SWITCH( bwidth )
54 : {
55 374 : case IGF_MODE_WB:
56 374 : test();
57 374 : IF( LE_32( brate, IVAS_13k2 ) && EQ_16( rf_mode, 1 ) )
58 : {
59 0 : bitRateIndex = IGF_BITRATE_RF_WB_13200;
60 0 : move16();
61 : }
62 374 : ELSE IF( LE_32( brate, ACELP_9k60 ) )
63 : {
64 222 : bitRateIndex = IGF_BITRATE_WB_13200_CPE;
65 222 : move16();
66 : }
67 152 : ELSE IF( LE_32( brate, IVAS_13k2 ) )
68 : {
69 152 : bitRateIndex = IGF_BITRATE_WB_16400_CPE;
70 152 : move16();
71 : }
72 374 : BREAK;
73 269505 : case IGF_MODE_SWB:
74 : /* DFT and TD Stereo bitrates */
75 269505 : IF( LE_32( brate, ACELP_9k60 ) )
76 : {
77 664 : bitRateIndex = IGF_BITRATE_SWB_13200_CPE;
78 664 : move16();
79 : }
80 268841 : ELSE IF( LE_32( brate, IVAS_13k2 ) )
81 : {
82 658 : IF( EQ_16( rf_mode, 1 ) )
83 : {
84 0 : bitRateIndex = IGF_BITRATE_RF_SWB_13200;
85 0 : move16();
86 : }
87 : ELSE
88 : {
89 658 : bitRateIndex = IGF_BITRATE_SWB_16400_CPE;
90 658 : move16();
91 : }
92 : }
93 268183 : ELSE IF( LE_32( brate, IVAS_16k4 ) )
94 : {
95 1586 : bitRateIndex = IGF_BITRATE_SWB_24400_CPE;
96 1586 : move16();
97 : }
98 266597 : ELSE IF( LE_32( brate, IVAS_24k4 ) )
99 : {
100 1480 : bitRateIndex = IGF_BITRATE_SWB_32000_CPE;
101 1480 : move16();
102 : }
103 265117 : ELSE IF( LE_32( brate, IVAS_32k ) )
104 : {
105 0 : bitRateIndex = IGF_BITRATE_SWB_32000;
106 0 : move16();
107 : }
108 : /* MDCT Stereo bitrates */
109 265117 : ELSE IF( LE_32( brate, IVAS_48k ) )
110 : {
111 135181 : bitRateIndex = IGF_BITRATE_SWB_48000_CPE;
112 135181 : move16();
113 : }
114 129936 : ELSE IF( LE_32( brate, IVAS_64k ) )
115 : {
116 46858 : bitRateIndex = IGF_BITRATE_SWB_64000_CPE;
117 46858 : move16();
118 : }
119 83078 : ELSE IF( LE_32( brate, IVAS_80k ) )
120 : {
121 37522 : bitRateIndex = IGF_BITRATE_SWB_80000_CPE;
122 37522 : move16();
123 : }
124 45556 : ELSE IF( LE_32( brate, IVAS_96k ) )
125 : {
126 45556 : bitRateIndex = IGF_BITRATE_SWB_96000_CPE;
127 45556 : move16();
128 : }
129 269505 : BREAK;
130 603018 : case IGF_MODE_FB:
131 : /* DFT and TD Stereo bitrates */
132 603018 : IF( LE_32( brate, IVAS_16k4 ) )
133 : {
134 732 : bitRateIndex = IGF_BITRATE_FB_24400_CPE;
135 732 : move16();
136 : }
137 602286 : ELSE IF( LE_32( brate, IVAS_24k4 ) )
138 : {
139 1162 : bitRateIndex = IGF_BITRATE_FB_32000_CPE;
140 1162 : move16();
141 : }
142 601124 : ELSE IF( LE_32( brate, IVAS_32k ) )
143 : {
144 0 : bitRateIndex = IGF_BITRATE_FB_32000;
145 0 : move16();
146 : }
147 : /* MDCT Stereo bitrates */
148 601124 : ELSE IF( LE_32( brate, IVAS_48k ) )
149 : {
150 84482 : bitRateIndex = IGF_BITRATE_FB_48000_CPE;
151 84482 : move16();
152 : }
153 516642 : ELSE IF( LE_32( brate, IVAS_64k ) )
154 : {
155 153118 : bitRateIndex = IGF_BITRATE_FB_64000_CPE;
156 153118 : move16();
157 : }
158 363524 : ELSE IF( LE_32( brate, IVAS_80k ) )
159 : {
160 48744 : bitRateIndex = IGF_BITRATE_FB_80000_CPE;
161 48744 : move16();
162 : }
163 314780 : ELSE IF( LE_32( brate, IVAS_96k ) )
164 : {
165 66238 : bitRateIndex = IGF_BITRATE_FB_96000_CPE;
166 66238 : move16();
167 : }
168 248542 : ELSE IF( LE_32( brate, IVAS_128k ) )
169 : {
170 248542 : bitRateIndex = IGF_BITRATE_FB_128000_CPE;
171 248542 : move16();
172 : }
173 603018 : BREAK;
174 : }
175 872897 : }
176 : /* SCE modes: use tunings done for DFT stereo bitrates also for according SCE bitrates, otherwise same config as mono modes */
177 54724 : ELSE IF( EQ_16( element_mode, IVAS_SCE ) )
178 : {
179 54498 : SWITCH( bwidth )
180 : {
181 52 : case IGF_MODE_WB:
182 52 : test();
183 52 : IF( LE_32( brate, IVAS_13k2 ) && EQ_16( rf_mode, 1 ) )
184 : {
185 0 : bitRateIndex = IGF_BITRATE_RF_WB_13200;
186 0 : move16();
187 : }
188 52 : ELSE IF( LE_32( brate, ACELP_9k60 ) ) /* bitrates 8000 and 9600 */
189 : {
190 52 : bitRateIndex = IGF_BITRATE_WB_9600;
191 52 : move16();
192 : }
193 52 : BREAK;
194 21246 : case IGF_MODE_SWB:
195 21246 : IF( LE_32( brate, ACELP_9k60 ) )
196 : {
197 6612 : bitRateIndex = IGF_BITRATE_SWB_13200_CPE;
198 6612 : move16();
199 : }
200 14634 : ELSE IF( LE_32( brate, IVAS_13k2 ) )
201 : {
202 6984 : IF( EQ_16( rf_mode, 1 ) )
203 : {
204 0 : bitRateIndex = IGF_BITRATE_RF_SWB_13200;
205 0 : move16();
206 : }
207 : ELSE
208 : {
209 6984 : bitRateIndex = IGF_BITRATE_SWB_16400_CPE;
210 6984 : move16();
211 : }
212 : }
213 7650 : ELSE IF( LE_32( brate, IVAS_16k4 ) )
214 : {
215 3770 : bitRateIndex = IGF_BITRATE_SWB_24400_CPE;
216 3770 : move16();
217 : }
218 3880 : ELSE IF( LE_32( brate, IVAS_24k4 ) )
219 : {
220 1620 : move16();
221 1620 : bitRateIndex = IGF_BITRATE_SWB_32000_CPE;
222 : }
223 2260 : ELSE IF( LE_32( brate, IVAS_32k ) )
224 : {
225 1536 : bitRateIndex = IGF_BITRATE_SWB_32000;
226 1536 : move16();
227 : }
228 724 : ELSE IF( LE_32( brate, IVAS_48k ) )
229 : {
230 298 : bitRateIndex = IGF_BITRATE_SWB_48000;
231 298 : move16();
232 : }
233 426 : ELSE IF( LE_32( brate, IVAS_64k ) )
234 : {
235 426 : bitRateIndex = IGF_BITRATE_SWB_64000;
236 426 : move16();
237 : }
238 21246 : BREAK;
239 33200 : case IGF_MODE_FB:
240 33200 : IF( LE_32( brate, IVAS_16k4 ) )
241 : {
242 5524 : bitRateIndex = IGF_BITRATE_FB_24400_CPE;
243 5524 : move16();
244 : }
245 27676 : ELSE IF( LE_32( brate, IVAS_24k4 ) )
246 : {
247 9190 : bitRateIndex = IGF_BITRATE_FB_32000_CPE;
248 9190 : move16();
249 : }
250 18486 : ELSE IF( LE_32( brate, IVAS_32k ) )
251 : {
252 7842 : bitRateIndex = IGF_BITRATE_FB_32000;
253 7842 : move16();
254 : }
255 10644 : ELSE IF( LE_32( brate, IVAS_48k ) )
256 : {
257 7002 : bitRateIndex = IGF_BITRATE_FB_48000;
258 7002 : move16();
259 : }
260 3642 : ELSE IF( LE_32( brate, IVAS_64k ) )
261 : {
262 2134 : bitRateIndex = IGF_BITRATE_FB_64000;
263 2134 : move16();
264 : }
265 1508 : ELSE IF( LE_32( brate, IVAS_96k ) )
266 : {
267 1086 : bitRateIndex = IGF_BITRATE_FB_96000;
268 1086 : move16();
269 : }
270 422 : ELSE IF( LE_32( brate, IVAS_128k ) )
271 : {
272 422 : bitRateIndex = IGF_BITRATE_FB_128000;
273 422 : move16();
274 : }
275 33200 : BREAK;
276 : }
277 54498 : }
278 : /* EVS mono */
279 : ELSE
280 : {
281 226 : SWITCH( bwidth )
282 : {
283 0 : case IGF_MODE_WB:
284 0 : test();
285 0 : IF( LE_32( brate, ACELP_13k20 ) && EQ_16( rf_mode, 1 ) )
286 : {
287 0 : bitRateIndex = IGF_BITRATE_RF_WB_13200;
288 0 : move16();
289 : }
290 0 : ELSE IF( LE_32( brate, ACELP_9k60 ) ) /* bitrates 8000 and 9600 */
291 : {
292 0 : bitRateIndex = IGF_BITRATE_WB_9600;
293 0 : move16();
294 : }
295 0 : BREAK;
296 226 : case IGF_MODE_SWB:
297 226 : IF( LE_32( brate, ACELP_9k60 ) )
298 : {
299 0 : move16();
300 0 : bitRateIndex = IGF_BITRATE_SWB_9600;
301 : }
302 226 : ELSE IF( LE_32( brate, ACELP_13k20 ) )
303 : {
304 78 : IF( EQ_16( rf_mode, 1 ) )
305 : {
306 0 : bitRateIndex = IGF_BITRATE_RF_SWB_13200;
307 0 : move16();
308 : }
309 : ELSE
310 : {
311 78 : bitRateIndex = IGF_BITRATE_SWB_13200;
312 78 : move16();
313 : }
314 : }
315 148 : ELSE IF( LE_32( brate, ACELP_16k40 ) )
316 : {
317 0 : bitRateIndex = IGF_BITRATE_SWB_16400;
318 0 : move16();
319 : }
320 148 : ELSE IF( LE_32( brate, ACELP_24k40 ) )
321 : {
322 148 : bitRateIndex = IGF_BITRATE_SWB_24400;
323 148 : move16();
324 : }
325 0 : ELSE IF( LE_32( brate, ACELP_32k ) )
326 : {
327 0 : bitRateIndex = IGF_BITRATE_SWB_32000;
328 0 : move16();
329 : }
330 0 : ELSE IF( LE_32( brate, ACELP_48k ) )
331 : {
332 0 : bitRateIndex = IGF_BITRATE_SWB_48000;
333 0 : move16();
334 : }
335 0 : ELSE IF( LE_32( brate, ACELP_64k ) )
336 : {
337 0 : bitRateIndex = IGF_BITRATE_SWB_64000;
338 0 : move16();
339 : }
340 226 : BREAK;
341 0 : case IGF_MODE_FB:
342 0 : IF( LE_32( brate, ACELP_16k40 ) )
343 : {
344 0 : bitRateIndex = IGF_BITRATE_FB_16400;
345 0 : move16();
346 : }
347 0 : ELSE IF( LE_32( brate, ACELP_24k40 ) )
348 : {
349 0 : bitRateIndex = IGF_BITRATE_FB_24400;
350 0 : move16();
351 : }
352 0 : ELSE IF( LE_32( brate, ACELP_32k ) )
353 : {
354 0 : bitRateIndex = IGF_BITRATE_FB_32000;
355 0 : move16();
356 : }
357 0 : ELSE IF( LE_32( brate, ACELP_48k ) )
358 : {
359 0 : bitRateIndex = IGF_BITRATE_FB_48000;
360 0 : move16();
361 : }
362 0 : ELSE IF( LE_32( brate, ACELP_64k ) )
363 : {
364 0 : bitRateIndex = IGF_BITRATE_FB_64000;
365 0 : move16();
366 : }
367 0 : ELSE IF( LE_32( brate, HQ_96k ) )
368 : {
369 0 : bitRateIndex = IGF_BITRATE_FB_96000;
370 0 : move16();
371 : }
372 0 : ELSE IF( LE_32( brate, HQ_128k ) )
373 : {
374 0 : bitRateIndex = IGF_BITRATE_FB_128000;
375 0 : move16();
376 : }
377 0 : BREAK;
378 : }
379 927621 : }
380 :
381 927621 : return bitRateIndex; /*Q0*/
382 : }
383 :
384 : /**********************************************************************/ /*
385 : IGF grid setup
386 : **************************************************************************/
387 339 : static void IGF_gridSetUp( H_IGF_GRID hGrid, /**< out: | IGF grid handle */
388 : Word16 bitRateIndex, /**< in: Q0 | IGF bitrate index */
389 : Word32 sampleRate, /**< in: | sample rate */
390 : Word16 frameLength, /**< in: | frame length */
391 : Word16 transFac, /**< in: Q14 |transFac */
392 : Word16 igfMinFq /**< in: | IGF minimum frequency indicating lower start frequency for copy up */
393 : )
394 : {
395 : Word16 t;
396 : Word16 sfb;
397 : const Word16 *swb_offset;
398 : Word16 swb_offset_len;
399 : Word16 bandwidth;
400 : Word16 wrp_sfb;
401 : Word16 tmp1;
402 : Word16 tmp2;
403 : Word32 L_tmp1;
404 : Word32 L_tmp2;
405 :
406 339 : swb_offset = NULL;
407 339 : swb_offset_len = 0;
408 339 : move16();
409 :
410 339 : SWITCH( bitRateIndex )
411 : {
412 339 : case IGF_BITRATE_WB_9600:
413 : case IGF_BITRATE_SWB_9600:
414 : case IGF_BITRATE_RF_WB_13200:
415 : case IGF_BITRATE_RF_SWB_13200:
416 : case IGF_BITRATE_SWB_13200:
417 : case IGF_BITRATE_SWB_16400:
418 : case IGF_BITRATE_SWB_24400:
419 : case IGF_BITRATE_SWB_32000:
420 : case IGF_BITRATE_SWB_48000:
421 339 : swb_offset = &swb_offset_LB_new[bitRateIndex][1];
422 339 : swb_offset_len = swb_offset_LB_new[bitRateIndex][0]; /*Q0*/
423 339 : move16();
424 339 : Copy( &igf_whitening_TH[bitRateIndex][0][0], &hGrid->whiteningThreshold[0][0], IGF_MAX_TILES * 2 );
425 339 : BREAK;
426 0 : case IGF_BITRATE_FB_16400:
427 : case IGF_BITRATE_FB_24400:
428 : case IGF_BITRATE_FB_32000:
429 0 : swb_offset = &swb_offset_LB_new[bitRateIndex][1];
430 0 : swb_offset_len = swb_offset_LB_new[bitRateIndex][0]; /*Q0*/
431 0 : move16();
432 0 : Copy( &igf_whitening_TH[bitRateIndex][0][0], &hGrid->whiteningThreshold[0][0], IGF_MAX_TILES * 2 );
433 0 : BREAK;
434 0 : case IGF_BITRATE_FB_48000:
435 : case IGF_BITRATE_FB_96000:
436 : case IGF_BITRATE_FB_128000:
437 0 : swb_offset = &swb_offset_LB_new[bitRateIndex][1];
438 0 : swb_offset_len = swb_offset_LB_new[bitRateIndex][0]; /*Q0*/
439 0 : move16();
440 0 : Copy( &igf_whitening_TH[bitRateIndex][0][0], &hGrid->whiteningThreshold[0][0], IGF_MAX_TILES * 2 );
441 0 : BREAK;
442 0 : case IGF_BITRATE_UNKNOWN:
443 : default:
444 0 : assert( 0 );
445 : }
446 :
447 3156 : FOR( sfb = 0; sfb < swb_offset_len; sfb++ )
448 : {
449 2817 : hGrid->swb_offset[sfb] = IGF_ApplyTransFac( swb_offset[sfb], transFac ); /*Q0*/
450 2817 : move16();
451 : }
452 :
453 339 : hGrid->infoIsRefined = 0;
454 339 : move16();
455 339 : frameLength = IGF_ApplyTransFac( frameLength, transFac ); /*Q0*/
456 339 : tmp2 = norm_s( frameLength );
457 339 : bandwidth = shl( frameLength, tmp2 ); /*tmp2*/
458 339 : hGrid->swb_offset_len = extract_l( L_shr( sampleRate, 2 ) ); /*-1*/
459 339 : move16();
460 339 : tmp1 = sub( norm_s( hGrid->swb_offset_len ), 1 );
461 339 : hGrid->swb_offset_len = shl( hGrid->swb_offset_len, tmp1 ); /*tmp1-1*/
462 339 : move16();
463 339 : bandwidth = div_s( hGrid->swb_offset_len, bandwidth ); /*15 + tmp1-1-tmp2*/
464 339 : tmp2 = sub( add( tmp2, 1 ), tmp1 );
465 339 : bandwidth = shr( bandwidth, sub( 15, tmp2 ) ); /*Q0*/
466 :
467 :
468 339 : hGrid->swb_offset_len = swb_offset_len; /*Q0*/
469 339 : move16();
470 339 : hGrid->startSfb = 0;
471 339 : move16();
472 339 : hGrid->stopSfb = sub( hGrid->swb_offset_len, 1 ); /*Q0*/
473 339 : move16();
474 339 : hGrid->startLine = hGrid->swb_offset[hGrid->startSfb]; /*Q0*/
475 339 : move16();
476 339 : hGrid->stopLine = hGrid->swb_offset[hGrid->stopSfb]; /*Q0*/
477 339 : move16();
478 339 : hGrid->startFrequency = imult1616( bandwidth, hGrid->startLine ); /*Q0*/
479 339 : move16();
480 339 : hGrid->stopFrequency = imult1616( bandwidth, hGrid->stopLine ); /*Q0*/
481 339 : move16();
482 :
483 339 : L_tmp1 = L_mult0( igfMinFq, frameLength ); /*Q0*/
484 339 : tmp1 = sub( norm_l( L_tmp1 ), 1 );
485 339 : L_tmp1 = L_shl( L_tmp1, tmp1 ); /*tmp1*/
486 :
487 339 : tmp2 = norm_l( sampleRate );
488 339 : L_tmp2 = L_shl( sampleRate, tmp2 ); /*tmp2*/
489 339 : tmp1 = add( WORD16_BITS - 1, sub( tmp1, add( tmp2, 1 ) ) ); /* takes into account sampleRate >> 1 */
490 :
491 339 : hGrid->minSrcSubband = div_s( extract_h( L_tmp1 ), extract_h( L_tmp2 ) ); /*tmp1*/
492 339 : hGrid->minSrcSubband = shr( hGrid->minSrcSubband, tmp1 ); /*Q0*/
493 339 : move16();
494 339 : move16();
495 :
496 :
497 339 : hGrid->minSrcSubband = add( hGrid->minSrcSubband, s_and( hGrid->minSrcSubband, 1 ) );
498 339 : move16();
499 339 : hGrid->minSrcFrequency = imult1616( bandwidth, hGrid->minSrcSubband );
500 339 : move16();
501 339 : hGrid->infoGranuleLen = frameLength; /*Q0*/
502 339 : move16();
503 339 : hGrid->infoTransFac = transFac; /*Q14*/
504 339 : move16();
505 :
506 339 : hGrid->sfbWrap[0] = 0;
507 339 : move16();
508 339 : hGrid->tile[0] = hGrid->startLine; /*Q0*/
509 339 : move16();
510 :
511 :
512 : /*************************************************************************/
513 339 : SWITCH( bitRateIndex )
514 : {
515 : /* SWB 13200 */
516 0 : case IGF_BITRATE_WB_9600:
517 0 : hGrid->nTiles = 2;
518 0 : move16();
519 0 : wrp_sfb = 2;
520 0 : move16();
521 :
522 : /*1st*/
523 0 : hGrid->sfbWrap[0 + 1] = wrp_sfb; /*Q0*/
524 0 : move16();
525 0 : hGrid->sbWrap[0] = hGrid->minSrcSubband; /*Q0*/
526 0 : move16();
527 0 : hGrid->tile[0 + 1] = hGrid->swb_offset[wrp_sfb]; /*Q0*/
528 0 : move16();
529 :
530 : /*2nd*/
531 0 : hGrid->sfbWrap[1 + 1] = hGrid->stopSfb; /*Q0*/
532 0 : move16();
533 0 : hGrid->sbWrap[1] = hGrid->minSrcSubband; /*Q0*/
534 0 : move16();
535 0 : hGrid->tile[1 + 1] = hGrid->swb_offset[hGrid->stopSfb]; /*Q0*/
536 0 : move16();
537 0 : BREAK;
538 :
539 0 : case IGF_BITRATE_RF_WB_13200:
540 0 : hGrid->nTiles = 2;
541 0 : move16();
542 0 : wrp_sfb = 2;
543 0 : move16();
544 :
545 : /*1st*/
546 0 : hGrid->sfbWrap[0 + 1] = wrp_sfb; /*Q0*/
547 0 : move16();
548 0 : hGrid->sbWrap[0] = hGrid->minSrcSubband; /*Q0*/
549 0 : move16();
550 0 : hGrid->tile[0 + 1] = hGrid->swb_offset[wrp_sfb]; /*Q0*/
551 0 : move16();
552 :
553 : /*2nd*/
554 0 : hGrid->sfbWrap[1 + 1] = hGrid->stopSfb; /*Q0*/
555 0 : move16();
556 0 : hGrid->sbWrap[1] = hGrid->minSrcSubband; /*Q0*/
557 0 : move16();
558 0 : hGrid->tile[1 + 1] = hGrid->swb_offset[hGrid->stopSfb]; /*Q0*/
559 0 : move16();
560 :
561 0 : BREAK;
562 0 : case IGF_BITRATE_SWB_9600:
563 0 : hGrid->nTiles = 3;
564 0 : move16();
565 0 : wrp_sfb = 1;
566 0 : move16();
567 :
568 : /*1st*/
569 0 : hGrid->sfbWrap[0 + 1] = wrp_sfb; /*Q0*/
570 0 : move16();
571 0 : hGrid->sbWrap[0] = hGrid->minSrcSubband; /*Q0*/
572 0 : move16();
573 0 : hGrid->tile[0 + 1] = hGrid->swb_offset[wrp_sfb]; /*Q0*/
574 0 : move16();
575 :
576 : /*2nd*/
577 0 : wrp_sfb = 2;
578 0 : move16();
579 0 : hGrid->sfbWrap[1 + 1] = wrp_sfb; /*Q0*/
580 0 : move16();
581 0 : hGrid->sbWrap[1] = hGrid->minSrcSubband + IGF_ApplyTransFac( 32, transFac ); /*Q0*/
582 0 : move16();
583 0 : hGrid->tile[1 + 1] = hGrid->swb_offset[wrp_sfb]; /*Q0*/
584 0 : move16();
585 :
586 : /*3rd*/
587 0 : hGrid->sfbWrap[2 + 1] = hGrid->stopSfb; /*Q0*/
588 0 : move16();
589 0 : hGrid->sbWrap[2] = hGrid->minSrcSubband + IGF_ApplyTransFac( 46, transFac ); /*Q0*/
590 0 : move16();
591 0 : hGrid->tile[2 + 1] = hGrid->swb_offset[hGrid->stopSfb]; /*Q0*/
592 0 : move16();
593 :
594 0 : BREAK;
595 0 : case IGF_BITRATE_RF_SWB_13200:
596 0 : hGrid->nTiles = 3;
597 0 : move16();
598 0 : wrp_sfb = 1;
599 0 : move16();
600 :
601 : /*1st*/
602 0 : hGrid->sfbWrap[0 + 1] = wrp_sfb; /*Q0*/
603 0 : move16();
604 0 : hGrid->sbWrap[0] = hGrid->minSrcSubband; /*Q0*/
605 0 : move16();
606 0 : hGrid->tile[0 + 1] = hGrid->swb_offset[wrp_sfb]; /*Q0*/
607 0 : move16();
608 :
609 : /*2nd*/
610 0 : wrp_sfb = 2;
611 0 : move16();
612 0 : hGrid->sfbWrap[1 + 1] = wrp_sfb; /*Q0*/
613 0 : move16();
614 0 : hGrid->sbWrap[1] = hGrid->minSrcSubband + IGF_ApplyTransFac( 32, transFac ); /*Q0*/
615 0 : move16();
616 0 : hGrid->tile[1 + 1] = hGrid->swb_offset[wrp_sfb]; /*Q0*/
617 0 : move16();
618 :
619 : /*3rd*/
620 0 : hGrid->sfbWrap[2 + 1] = hGrid->stopSfb; /*Q0*/
621 0 : move16();
622 0 : hGrid->sbWrap[2] = hGrid->minSrcSubband + IGF_ApplyTransFac( 46, transFac ); /*Q0*/
623 0 : move16();
624 0 : hGrid->tile[2 + 1] = hGrid->swb_offset[hGrid->stopSfb]; /*Q0*/
625 0 : move16();
626 :
627 0 : BREAK;
628 :
629 117 : case IGF_BITRATE_SWB_13200:
630 117 : hGrid->nTiles = 2;
631 117 : move16();
632 117 : wrp_sfb = 4;
633 117 : move16();
634 :
635 : /*1st*/
636 117 : hGrid->sfbWrap[0 + 1] = wrp_sfb; /*Q0*/
637 117 : move16();
638 117 : hGrid->sbWrap[0] = hGrid->minSrcSubband; /*Q0*/
639 117 : move16();
640 117 : hGrid->tile[0 + 1] = hGrid->swb_offset[wrp_sfb]; /*Q0*/
641 117 : move16();
642 :
643 : /*2nd*/
644 117 : hGrid->sfbWrap[1 + 1] = hGrid->stopSfb; /*Q0*/
645 117 : move16();
646 117 : hGrid->sbWrap[1] = add( hGrid->minSrcSubband, IGF_ApplyTransFac( 32, transFac ) ); /*Q0*/
647 117 : move16();
648 117 : hGrid->tile[1 + 1] = hGrid->swb_offset[hGrid->stopSfb]; /*Q0*/
649 117 : move16();
650 117 : BREAK;
651 :
652 0 : case IGF_BITRATE_SWB_16400:
653 0 : hGrid->nTiles = 3;
654 0 : move16();
655 0 : wrp_sfb = 4;
656 0 : move16();
657 :
658 : /*1st*/
659 0 : hGrid->sfbWrap[0 + 1] = wrp_sfb; /*Q0*/
660 0 : move16();
661 0 : hGrid->sbWrap[0] = hGrid->minSrcSubband; /*Q0*/
662 0 : move16();
663 0 : hGrid->tile[0 + 1] = hGrid->swb_offset[wrp_sfb]; /*Q0*/
664 0 : move16();
665 :
666 : /*2nd*/
667 0 : hGrid->sfbWrap[1 + 1] = 6;
668 0 : move16();
669 0 : hGrid->sbWrap[1] = add( hGrid->minSrcSubband, IGF_ApplyTransFac( 48, transFac ) ); /*Q0*/
670 0 : move16();
671 0 : hGrid->tile[1 + 1] = hGrid->swb_offset[6]; /*Q0*/
672 0 : move16();
673 :
674 : /*3nd*/
675 0 : hGrid->sfbWrap[2 + 1] = hGrid->stopSfb; /*Q0*/
676 0 : move16();
677 0 : hGrid->sbWrap[2] = add( hGrid->minSrcSubband, IGF_ApplyTransFac( 64, transFac ) ); /*Q0*/
678 0 : move16();
679 0 : hGrid->tile[2 + 1] = hGrid->swb_offset[hGrid->stopSfb]; /*Q0*/
680 0 : move16();
681 0 : BREAK;
682 :
683 222 : case IGF_BITRATE_SWB_24400:
684 : case IGF_BITRATE_SWB_32000:
685 222 : hGrid->nTiles = 3;
686 222 : move16();
687 222 : wrp_sfb = 4;
688 222 : move16();
689 :
690 : /*1st*/
691 222 : hGrid->sfbWrap[0 + 1] = wrp_sfb; /*Q0*/
692 222 : move16();
693 222 : hGrid->sbWrap[0] = hGrid->minSrcSubband; /*Q0*/
694 222 : move16();
695 222 : hGrid->tile[0 + 1] = hGrid->swb_offset[wrp_sfb]; /*Q0*/
696 222 : move16();
697 :
698 : /*2nd*/
699 222 : hGrid->sfbWrap[1 + 1] = 7;
700 222 : move16();
701 222 : hGrid->sbWrap[1] = add( hGrid->minSrcSubband, IGF_ApplyTransFac( 32, transFac ) ); /*Q0*/
702 222 : move16();
703 222 : hGrid->tile[1 + 1] = hGrid->swb_offset[7]; /*Q0*/
704 222 : move16();
705 :
706 : /*3nd*/
707 222 : hGrid->sfbWrap[2 + 1] = hGrid->stopSfb; /*Q0*/
708 222 : move16();
709 222 : hGrid->sbWrap[2] = add( hGrid->minSrcSubband, IGF_ApplyTransFac( 64, transFac ) ); /*Q0*/
710 222 : move16();
711 222 : hGrid->tile[2 + 1] = hGrid->swb_offset[hGrid->stopSfb]; /*Q0*/
712 222 : move16();
713 222 : BREAK;
714 0 : case IGF_BITRATE_SWB_48000:
715 0 : hGrid->nTiles = 1;
716 0 : move16();
717 0 : wrp_sfb = hGrid->stopSfb;
718 0 : move16();
719 :
720 : /*1st*/
721 0 : hGrid->sfbWrap[0 + 1] = hGrid->stopSfb; /*Q0*/
722 0 : move16();
723 0 : hGrid->sbWrap[0] = sub( shl( hGrid->startLine, 1 ), hGrid->stopLine ); /*Q0*/
724 0 : move16();
725 0 : hGrid->tile[0 + 1] = hGrid->swb_offset[hGrid->stopSfb]; /*Q0*/
726 0 : move16();
727 :
728 0 : BREAK;
729 0 : case IGF_BITRATE_FB_16400:
730 0 : hGrid->nTiles = 3;
731 0 : move16();
732 0 : wrp_sfb = 4;
733 0 : move16();
734 :
735 : /*1st*/
736 0 : hGrid->sfbWrap[0 + 1] = wrp_sfb; /*Q0*/
737 0 : move16();
738 0 : hGrid->sbWrap[0] = hGrid->minSrcSubband; /*Q0*/
739 0 : move16();
740 0 : hGrid->tile[0 + 1] = hGrid->swb_offset[wrp_sfb]; /*Q0*/
741 0 : move16();
742 0 : wrp_sfb = 7;
743 0 : move16();
744 :
745 : /*2nd*/
746 0 : hGrid->sfbWrap[1 + 1] = wrp_sfb; /*Q0*/
747 0 : move16();
748 0 : hGrid->sbWrap[1] = hGrid->minSrcSubband; /*Q0*/
749 0 : move16();
750 0 : hGrid->tile[1 + 1] = hGrid->swb_offset[wrp_sfb]; /*Q0*/
751 0 : move16();
752 :
753 : /*3nd*/
754 0 : hGrid->sfbWrap[2 + 1] = hGrid->stopSfb; /*Q0*/
755 0 : move16();
756 0 : hGrid->sbWrap[2] = hGrid->minSrcSubband; /*Q0*/
757 0 : move16();
758 0 : hGrid->tile[2 + 1] = hGrid->swb_offset[hGrid->stopSfb]; /*Q0*/
759 0 : move16();
760 :
761 0 : BREAK;
762 :
763 0 : case IGF_BITRATE_FB_24400:
764 : case IGF_BITRATE_FB_32000:
765 0 : hGrid->nTiles = 4;
766 0 : move16();
767 0 : wrp_sfb = 4;
768 0 : move16();
769 :
770 : /*1st*/
771 0 : hGrid->sfbWrap[0 + 1] = wrp_sfb; /*Q0*/
772 0 : move16();
773 0 : hGrid->sbWrap[0] = hGrid->minSrcSubband; /*Q0*/
774 0 : move16();
775 0 : hGrid->tile[0 + 1] = hGrid->swb_offset[wrp_sfb]; /*Q0*/
776 0 : move16();
777 0 : wrp_sfb = 6;
778 0 : move16();
779 :
780 : /*2nd*/
781 0 : hGrid->sfbWrap[1 + 1] = wrp_sfb; /*Q0*/
782 0 : move16();
783 0 : hGrid->sbWrap[1] = add( hGrid->minSrcSubband, IGF_ApplyTransFac( 32, transFac ) ); /*Q0*/
784 0 : move16();
785 0 : hGrid->tile[1 + 1] = hGrid->swb_offset[wrp_sfb]; /*Q0*/
786 0 : move16();
787 0 : wrp_sfb = 9;
788 0 : move16();
789 :
790 : /*3nd*/
791 0 : hGrid->sfbWrap[2 + 1] = wrp_sfb; /*Q0*/
792 0 : move16();
793 0 : hGrid->sbWrap[2] = hGrid->minSrcSubband; /*Q0*/
794 0 : move16();
795 0 : hGrid->tile[2 + 1] = hGrid->swb_offset[wrp_sfb]; /*Q0*/
796 0 : move16();
797 :
798 : /*4nd*/
799 0 : hGrid->sfbWrap[3 + 1] = hGrid->stopSfb; /*Q0*/
800 0 : move16();
801 0 : hGrid->sbWrap[3] = add( hGrid->minSrcSubband, sub( hGrid->swb_offset[9], hGrid->swb_offset[8] ) ); /*Q0*/
802 0 : move16();
803 0 : hGrid->tile[3 + 1] = hGrid->swb_offset[hGrid->stopSfb]; /*Q0*/
804 0 : move16();
805 0 : BREAK;
806 0 : case IGF_BITRATE_FB_48000:
807 : case IGF_BITRATE_FB_96000:
808 : case IGF_BITRATE_FB_128000:
809 0 : hGrid->nTiles = 1;
810 0 : move16();
811 :
812 : /*1st*/
813 0 : hGrid->sfbWrap[0 + 1] = hGrid->stopSfb; /*Q0*/
814 0 : move16();
815 0 : hGrid->sbWrap[0] = sub( shl( hGrid->startLine, 1 ), hGrid->stopLine ); /*Q0*/
816 0 : move16();
817 0 : hGrid->tile[0 + 1] = hGrid->swb_offset[hGrid->stopSfb]; /*Q0*/
818 0 : move16();
819 :
820 0 : BREAK;
821 0 : default:
822 0 : assert( 0 );
823 : } /*switch*/
824 :
825 : /*************************************************************************/
826 : /*************************************************************************/
827 :
828 :
829 : /* adapt level envelope: */
830 339 : SWITCH( bitRateIndex )
831 : {
832 0 : case IGF_BITRATE_RF_WB_13200:
833 : case IGF_BITRATE_WB_9600:
834 0 : hGrid->gFactor = 13107 /*0.80f Q14*/;
835 0 : move16();
836 0 : hGrid->fFactor = 11469 /*0.70f Q14*/;
837 0 : move16();
838 0 : hGrid->lFactor = 9830 /*0.60f Q14*/;
839 0 : move16();
840 0 : BREAK;
841 117 : case IGF_BITRATE_SWB_13200:
842 : case IGF_BITRATE_FB_16400:
843 : case IGF_BITRATE_SWB_16400:
844 117 : hGrid->gFactor = 15237 /*0.93f Q14*/;
845 117 : move16();
846 117 : hGrid->fFactor = 3277 /*0.20f Q14*/;
847 117 : move16();
848 117 : hGrid->lFactor = 13926 /*0.85f Q14*/;
849 117 : move16();
850 117 : BREAK;
851 222 : case IGF_BITRATE_FB_24400:
852 : case IGF_BITRATE_SWB_24400:
853 : case IGF_BITRATE_FB_32000:
854 : case IGF_BITRATE_SWB_32000:
855 222 : hGrid->gFactor = 15811 /*0.965f Q14*/;
856 222 : move16();
857 222 : hGrid->fFactor = 3277 /*0.20f Q14*/;
858 222 : move16();
859 222 : hGrid->lFactor = 13926 /*0.85f Q14*/;
860 222 : move16();
861 222 : BREAK;
862 0 : case IGF_BITRATE_FB_48000:
863 : case IGF_BITRATE_SWB_48000:
864 0 : hGrid->gFactor = 16384 /*1.00f Q14*/;
865 0 : move16();
866 0 : hGrid->fFactor = 3277 /*0.20f Q14*/;
867 0 : move16();
868 0 : hGrid->lFactor = 16384 /*1.00f Q14*/;
869 0 : move16();
870 0 : BREAK;
871 0 : case IGF_BITRATE_SWB_9600:
872 : case IGF_BITRATE_RF_SWB_13200:
873 : default:
874 0 : hGrid->gFactor = 16384 /*1.00f Q14*/;
875 0 : move16();
876 0 : hGrid->fFactor = 0 /*0.00f Q14*/;
877 0 : move16();
878 0 : hGrid->lFactor = 16384 /*1.00f Q14*/;
879 0 : move16();
880 : }
881 :
882 2490 : FOR( t = add( hGrid->nTiles, 1 ); t < IGF_MAX_TILES; t++ )
883 : {
884 2151 : hGrid->tile[t] = 0;
885 2151 : move16();
886 2151 : hGrid->sbWrap[t - 1] = 0;
887 2151 : move16();
888 2151 : hGrid->sfbWrap[t] = 0;
889 2151 : move16();
890 : }
891 339 : }
892 161520 : static void IGF_gridSetUp_ivas_fx(
893 : H_IGF_GRID hGrid, /* o : IGF grid handle */
894 : Word16 bitRateIndex, /* i : IGF bitrate index */
895 : const Word32 sampleRate, /* i : sample rate */
896 : Word16 frameLength, /* i : frame length */
897 : const Word16 transFac, /* i : transFac, Q14 */
898 : const Word16 igfMinFq /* i : IGF minimum frequency indicating lower start frequency for copy up */
899 : )
900 : {
901 : Word16 t, k;
902 : Word16 sfb;
903 : Word16 swb_offset_len;
904 : const Word16 *swb_offset;
905 : Word16 bandwidth_fx;
906 : const Word16 *igf_tile_offset;
907 : Word16 tmp2, tmp1;
908 : Word32 L_tmp1, L_tmp2;
909 :
910 : /* inits */
911 161520 : swb_offset = NULL;
912 161520 : swb_offset_len = 0;
913 161520 : move16();
914 :
915 161520 : test();
916 161520 : test();
917 161520 : IF( EQ_16( transFac, 8192 /*0.5 in Q14*/ ) && EQ_16( bitRateIndex, IGF_BITRATE_SWB_48000_CPE ) )
918 : {
919 1474 : bitRateIndex = IGF_BITRATE_SWB_48000_CPE_TCX10;
920 1474 : move16();
921 : }
922 160046 : ELSE IF( EQ_16( transFac, 8192 /*0.5 in Q14*/ ) && EQ_16( bitRateIndex, IGF_BITRATE_FB_48000_CPE ) )
923 : {
924 4292 : bitRateIndex = IGF_BITRATE_FB_48000_CPE_TCX10;
925 4292 : move16();
926 : }
927 :
928 161520 : IF( NE_16( bitRateIndex, IGF_BITRATE_UNKNOWN ) )
929 : {
930 161520 : swb_offset = &swb_offset_LB_new[bitRateIndex][1];
931 161520 : swb_offset_len = swb_offset_LB_new[bitRateIndex][0];
932 161520 : move16();
933 161520 : Copy( &igf_whitening_TH_ivas_fx[bitRateIndex][0][0], &hGrid->whiteningThreshold[0][0], IGF_MAX_TILES * 2 );
934 : }
935 : ELSE
936 : {
937 0 : assert( 0 );
938 : }
939 :
940 1375033 : FOR( sfb = 0; sfb < swb_offset_len; sfb++ )
941 : {
942 1213513 : hGrid->swb_offset[sfb] = IGF_ApplyTransFac( swb_offset[sfb], transFac );
943 1213513 : move16();
944 : }
945 2662967 : FOR( sfb = swb_offset_len; sfb < IGF_MAX_SFB; sfb++ )
946 : {
947 2501447 : hGrid->swb_offset[sfb] = 0;
948 2501447 : move16();
949 : }
950 :
951 161520 : hGrid->infoIsRefined = 0;
952 161520 : move16();
953 161520 : frameLength = IGF_ApplyTransFac( frameLength, transFac ); /*Q0*/
954 161520 : tmp2 = norm_s( frameLength );
955 161520 : bandwidth_fx = shl( frameLength, tmp2 ); /*tmp2*/
956 161520 : hGrid->swb_offset_len = extract_l( L_shr( sampleRate, 2 ) ); /*-1*/
957 161520 : move16();
958 161520 : tmp1 = sub( norm_s( hGrid->swb_offset_len ), 1 );
959 161520 : hGrid->swb_offset_len = shl( hGrid->swb_offset_len, tmp1 ); /*tmp1-1*/
960 161520 : move16();
961 161520 : bandwidth_fx = div_s( hGrid->swb_offset_len, bandwidth_fx ); /*15 + tmp1-1-tmp2*/
962 161520 : tmp2 = sub( add( tmp2, 1 ), tmp1 );
963 161520 : bandwidth_fx = shr( bandwidth_fx, sub( 15, tmp2 ) );
964 161520 : hGrid->swb_offset_len = swb_offset_len; /*Q0*/
965 161520 : move16();
966 161520 : hGrid->startSfb = 0;
967 161520 : move16();
968 161520 : hGrid->stopSfb = sub( hGrid->swb_offset_len, 1 );
969 161520 : move16();
970 161520 : hGrid->startLine = hGrid->swb_offset[hGrid->startSfb];
971 161520 : move16();
972 161520 : hGrid->stopLine = hGrid->swb_offset[hGrid->stopSfb];
973 161520 : move16();
974 161520 : hGrid->startFrequency = imult1616( bandwidth_fx, hGrid->startLine );
975 161520 : move16();
976 161520 : hGrid->stopFrequency = imult1616( bandwidth_fx, hGrid->stopLine );
977 161520 : move16();
978 161520 : L_tmp1 = L_mult0( igfMinFq, frameLength );
979 161520 : tmp1 = sub( norm_l( L_tmp1 ), 1 );
980 161520 : L_tmp1 = L_shl( L_tmp1, tmp1 );
981 161520 : tmp2 = norm_l( sampleRate );
982 161520 : L_tmp2 = L_shl( sampleRate, tmp2 );
983 161520 : tmp1 = add( WORD16_BITS - 1, sub( tmp1, add( tmp2, 1 ) ) ); /* takes into account sampleRate >> 1 */
984 161520 : hGrid->minSrcSubband = div_s( extract_h( L_tmp1 ), extract_h( L_tmp2 ) );
985 161520 : move16();
986 161520 : hGrid->minSrcSubband = shr( hGrid->minSrcSubband, tmp1 ); /*Q0*/
987 161520 : move16();
988 161520 : hGrid->minSrcSubband = add( hGrid->minSrcSubband, s_and( hGrid->minSrcSubband, 1 ) );
989 161520 : move16();
990 161520 : hGrid->minSrcFrequency = imult1616( bandwidth_fx, hGrid->minSrcSubband ); /*Q0*/
991 161520 : move16();
992 161520 : hGrid->infoGranuleLen = frameLength; /*Q0*/
993 161520 : move16();
994 161520 : hGrid->sfbWrap[0] = 0;
995 161520 : move16();
996 161520 : hGrid->tile[0] = hGrid->startLine; /*Q0*/
997 161520 : move16();
998 :
999 161520 : igf_tile_offset = &igf_tile_offset_table[bitRateIndex][1];
1000 161520 : hGrid->nTiles = igf_tile_offset_table[bitRateIndex][0];
1001 161520 : move16();
1002 161520 : hGrid->tile[0] = hGrid->startLine;
1003 161520 : move16();
1004 161520 : hGrid->sfbWrap[0] = 0;
1005 161520 : move16();
1006 935439 : FOR( k = 0; k < hGrid->nTiles; k++ )
1007 : {
1008 773919 : hGrid->sfbWrap[k + 1] = igf_tile_offset[2 * k];
1009 773919 : move16();
1010 773919 : hGrid->sbWrap[k] = add( hGrid->minSrcSubband, IGF_ApplyTransFac( igf_tile_offset[2 * k + 1], transFac ) );
1011 773919 : move16();
1012 773919 : hGrid->tile[k + 1] = hGrid->swb_offset[igf_tile_offset[2 * k]]; /*Q0*/
1013 773919 : move16();
1014 : }
1015 856809 : FOR( t = hGrid->nTiles + 1; t < IGF_MAX_TILES; t++ )
1016 : {
1017 695289 : hGrid->tile[t] = 0;
1018 695289 : move16();
1019 695289 : hGrid->sbWrap[t - 1] = 0;
1020 695289 : move16();
1021 695289 : hGrid->sfbWrap[t] = 0;
1022 695289 : move16();
1023 : }
1024 :
1025 : /* adapt level envelope: */
1026 161520 : SWITCH( bitRateIndex )
1027 : {
1028 639 : case IGF_BITRATE_RF_WB_13200:
1029 : case IGF_BITRATE_WB_9600:
1030 : case IGF_BITRATE_WB_13200_CPE:
1031 : case IGF_BITRATE_WB_16400_CPE:
1032 639 : hGrid->gFactor = 13107 /*0.80f Q14*/;
1033 639 : move16();
1034 639 : hGrid->fFactor = 11469 /*0.70f Q14*/;
1035 639 : move16();
1036 639 : hGrid->lFactor = 9830 /*0.60f Q14*/;
1037 639 : move16();
1038 639 : BREAK;
1039 28881 : case IGF_BITRATE_SWB_13200:
1040 : case IGF_BITRATE_SWB_16400_CPE:
1041 : case IGF_BITRATE_FB_16400:
1042 : case IGF_BITRATE_SWB_16400:
1043 : case IGF_BITRATE_FB_24400_CPE:
1044 : case IGF_BITRATE_SWB_24400_CPE:
1045 28881 : hGrid->gFactor = 15237 /*0.93f Q14*/;
1046 28881 : move16();
1047 28881 : hGrid->fFactor = 3277 /*0.20f Q14*/;
1048 28881 : move16();
1049 28881 : hGrid->lFactor = 13926 /*0.85f Q14*/;
1050 28881 : move16();
1051 28881 : BREAK;
1052 43418 : case IGF_BITRATE_FB_24400:
1053 : case IGF_BITRATE_SWB_24400:
1054 : case IGF_BITRATE_FB_32000_CPE:
1055 : case IGF_BITRATE_SWB_32000_CPE:
1056 : case IGF_BITRATE_FB_32000:
1057 : case IGF_BITRATE_SWB_32000:
1058 : case IGF_BITRATE_SWB_48000_CPE:
1059 : case IGF_BITRATE_SWB_64000_CPE:
1060 43418 : hGrid->gFactor = 15811 /*0.965f Q14*/;
1061 43418 : move16();
1062 43418 : hGrid->fFactor = 3277 /*0.20f Q14*/;
1063 43418 : move16();
1064 43418 : hGrid->lFactor = 13926 /*0.85f Q14*/;
1065 43418 : move16();
1066 43418 : BREAK;
1067 18507 : case IGF_BITRATE_FB_48000:
1068 : case IGF_BITRATE_SWB_48000:
1069 : case IGF_BITRATE_FB_64000:
1070 : case IGF_BITRATE_SWB_64000:
1071 : case IGF_BITRATE_SWB_80000_CPE:
1072 : case IGF_BITRATE_SWB_96000_CPE:
1073 18507 : hGrid->gFactor = 16384 /*1.00f Q14*/;
1074 18507 : move16();
1075 18507 : hGrid->fFactor = 3277 /*0.20f Q14*/;
1076 18507 : move16();
1077 18507 : hGrid->lFactor = 16384 /*1.00f Q14*/;
1078 18507 : move16();
1079 18507 : BREAK;
1080 70075 : case IGF_BITRATE_SWB_9600:
1081 : case IGF_BITRATE_SWB_13200_CPE:
1082 : case IGF_BITRATE_RF_SWB_13200:
1083 : default:
1084 70075 : hGrid->gFactor = 16384 /*1.00f Q14*/;
1085 70075 : move16();
1086 70075 : hGrid->fFactor = 0; /*0.00f Q30*/
1087 70075 : move16();
1088 70075 : hGrid->lFactor = 16384 /*1.00f Q14*/;
1089 70075 : move16();
1090 : }
1091 :
1092 856809 : FOR( t = add( hGrid->nTiles, 1 ); t < IGF_MAX_TILES; t++ )
1093 : {
1094 695289 : hGrid->tile[t] = 0;
1095 695289 : move16();
1096 695289 : hGrid->sbWrap[t - 1] = 0;
1097 695289 : move16();
1098 695289 : hGrid->sfbWrap[t] = 0;
1099 695289 : move16();
1100 : }
1101 161520 : return;
1102 : }
1103 :
1104 :
1105 : /**********************************************************************/ /*
1106 : calculates energy per sfb via power spectrum
1107 : **************************************************************************/
1108 2379366 : void IGFCommonFuncsCalcSfbEnergyPowerSpec( const Word16 startSfb, /**< in: Q0 | start sfb index */
1109 : const Word16 stopSfb, /**< in: Q0 | stop sfb index */
1110 : const Word16 *swb_offset, /**< in: Q0 | IGF swb offset table */
1111 : Word32 *pPowerSpectrum, /**< in: Q31 | power spectrum */
1112 : Word16 *pPowerSpectrum_exp, /**< in: | Exponent of PowerSpectrum */
1113 : Word32 *sfbEnergy, /**< out:Q31 | SFB energies , will be initialized inside this function */
1114 : Word16 *sfbEnergy_exp /**< out: | Exponent of PowerSpectrum */
1115 : )
1116 : {
1117 : Word16 /*Q0*/ sfb;
1118 : Word16 /*Q0*/ line;
1119 : Word32 L_c;
1120 :
1121 : #ifdef BASOP_NOGLOB_DECLARE_LOCAL
1122 2379366 : Flag Overflow = 0;
1123 2379366 : Flag Carry = 0;
1124 2379366 : move16();
1125 2379366 : move16();
1126 : #endif
1127 :
1128 12909136 : FOR( sfb = startSfb; sfb < stopSfb; sfb++ )
1129 : {
1130 10529770 : sfbEnergy[sfb] = L_deposit_l( 0 );
1131 10529770 : move32();
1132 : }
1133 2379366 : IF( NULL == pPowerSpectrum )
1134 : {
1135 0 : return;
1136 : }
1137 :
1138 12909136 : FOR( sfb = startSfb; sfb < stopSfb; sfb++ )
1139 : {
1140 10529770 : L_c = L_deposit_l( 0 );
1141 323921158 : FOR( line = swb_offset[sfb]; line < swb_offset[sfb + 1]; line++ )
1142 : {
1143 313391388 : Carry = 0;
1144 313391388 : move16();
1145 313391388 : sfbEnergy[sfb] = L_add_co( sfbEnergy[sfb], pPowerSpectrum[line], &Carry, &Overflow );
1146 313391388 : move32();
1147 313391388 : Overflow = 0;
1148 313391388 : move16();
1149 313391388 : L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow );
1150 : }
1151 10529770 : sfbEnergy[sfb] = norm_llQ31( L_c, sfbEnergy[sfb], &( sfbEnergy_exp[sfb] ) );
1152 10529770 : move32();
1153 10529770 : sfbEnergy_exp[sfb] = add( sfbEnergy_exp[sfb], *pPowerSpectrum_exp );
1154 10529770 : move16();
1155 : }
1156 : }
1157 :
1158 : /**********************************************************************/ /*
1159 : calculate the MDCT square spectrum in the IGF range
1160 : **************************************************************************/
1161 3563 : void IGFCommonFuncsMDCTSquareSpec( const Word16 sqrtBgn, /**< in: Q0 | start MDCT subband index */
1162 : const Word16 sqrtEnd, /**< in: Q0 | stop MDCT subband index */
1163 : const Word32 *mdctSpec, /**< in: | MDCT spectrum to square */
1164 : const Word16 mdctSpec_e, /**< in: | exponent of mdctSpectrum */
1165 : Word32 *mdctSquareSpec, /**< out: | MDCT square spectrum */
1166 : Word16 *mdctSquareSpec_e, /**< out: | exponent of mdctSquareSpec */
1167 : Word16 indexOffset /**< in: Q0 | index offset */
1168 : )
1169 : {
1170 : Word16 i;
1171 : Word16 j;
1172 : Word16 s1;
1173 : Word16 tmp;
1174 :
1175 :
1176 : /* get headroom, only in IGF range */
1177 3563 : s1 = getScaleFactor32( mdctSpec + sqrtBgn, sub( sqrtEnd, sqrtBgn ) );
1178 :
1179 : /* set new exponent */
1180 3563 : *mdctSquareSpec_e = add( shl( sub( mdctSpec_e, s1 ), 1 ), 1 );
1181 3563 : move16();
1182 :
1183 : /* MDCT square spectrum: MDCT^2 */
1184 3563 : j = add( sqrtBgn, indexOffset ); /* handle indexOffset with care, otherwise memory overruns may occur! */
1185 :
1186 :
1187 704591 : FOR( i = sqrtBgn; i < sqrtEnd; i++ )
1188 : {
1189 701028 : tmp = round_fx_sat( L_shl_sat( mdctSpec[i], s1 ) ); /*(15 - mdctSpec_e)+ S1*/
1190 701028 : mdctSquareSpec[j++] = L_mult0( tmp, tmp ); /*31 - mdctSquareSpec_e*/
1191 701028 : move32();
1192 : }
1193 3563 : }
1194 :
1195 : /**********************************************************************/ /*
1196 : calculate the MDCT square spectrum in the IGF range (for IVAS)
1197 : **************************************************************************/
1198 2913964 : void IGFCommonFuncsMDCTSquareSpec_ivas( const Word16 sqrtBgn, /**< in: Q0 | start MDCT subband index */
1199 : const Word16 sqrtEnd, /**< in: Q0 | stop MDCT subband index */
1200 : const Word32 *mdctSpec, /**< in: | MDCT spectrum to square */
1201 : const Word16 mdctSpec_e, /**< in: | exponent of mdctSpectrum */
1202 : Word32 *mdctSquareSpec, /**< out: | MDCT square spectrum */
1203 : Word16 *mdctSquareSpec_e, /**< out: | exponent of mdctSquareSpec */
1204 : Word16 indexOffset /**< in: Q0 | index offset */
1205 : )
1206 : {
1207 : Word16 i;
1208 : Word16 j;
1209 : Word16 s1;
1210 : Word16 tmp;
1211 :
1212 :
1213 : /* get headroom, only in IGF range */
1214 2913964 : s1 = getScaleFactor32( mdctSpec + sqrtBgn, sub( sqrtEnd, sqrtBgn ) );
1215 :
1216 : /* set new exponent */
1217 2913964 : *mdctSquareSpec_e = add( shl( sub( mdctSpec_e, s1 ), 1 ), 1 );
1218 2913964 : move16();
1219 :
1220 : /* MDCT square spectrum: MDCT^2 */
1221 2913964 : j = add( sqrtBgn, indexOffset ); /* handle indexOffset with care, otherwise memory overruns may occur! */
1222 :
1223 :
1224 328096924 : FOR( i = sqrtBgn; i < sqrtEnd; i++ )
1225 : {
1226 325182960 : tmp = extract_h( L_shl( mdctSpec[i], s1 ) ); /*(15 - mdctSpec_e)+ S1*/
1227 325182960 : mdctSquareSpec[j++] = L_mult0( tmp, tmp ); /*31 - mdctSquareSpec_e*/
1228 325182960 : move32();
1229 : }
1230 2913964 : }
1231 :
1232 :
1233 : /**********************************************************************/ /*
1234 : write bits to stream
1235 : **************************************************************************/
1236 7106 : void IGFCommonFuncsWriteSerialBit(
1237 : BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
1238 : Word16 *pBitOffset, /**< out: Q0 | bit offset */
1239 : Word16 bit /**< in: Q0 | value of bit */
1240 : )
1241 : {
1242 :
1243 7106 : IF( hBstr )
1244 : {
1245 3553 : push_next_indice( hBstr, bit, 1 );
1246 : }
1247 7106 : *pBitOffset = add( *pBitOffset, 1 );
1248 7106 : move16();
1249 :
1250 7106 : return;
1251 : }
1252 :
1253 : /**********************************************************************/ /*
1254 : changes the IGF configuration
1255 : **************************************************************************/
1256 113 : Word16 IGFCommonFuncsIGFConfiguration(
1257 : const Word32 total_brate, /* i : bitrate in bs e.g. 9600 for 9.6kbs */
1258 : const Word16 bwidth, /* i : audio bandwidth */
1259 : const Word16 element_mode, /* i : element mode */
1260 : H_IGF_INFO hIGFInfo, /* o : IGF info handle */
1261 : const Word16 rf_mode /* i : flag to signal the RF mode */
1262 : )
1263 : {
1264 : H_IGF_GRID hGrid;
1265 : Word16 retValue;
1266 : Word32 sampleRate;
1267 : Word16 frameLength;
1268 : Word16 igfMinFq;
1269 : Word16 maxHopsize;
1270 :
1271 113 : retValue = 0; /* bitrate index is unknown -> error! */
1272 113 : move16();
1273 :
1274 : /* interface call for reading in settings */
1275 113 : hIGFInfo->bitRateIndex = IGF_MapBitRateToIndex( total_brate, bwidth, element_mode, rf_mode ); /*Q0*/
1276 113 : move16();
1277 :
1278 113 : IF( NE_16( hIGFInfo->bitRateIndex, IGF_BITRATE_UNKNOWN ) )
1279 : {
1280 113 : retValue = 1; /* no error */
1281 113 : move16();
1282 :
1283 : /* mapping to local values */
1284 113 : sampleRate = igfMode[hIGFInfo->bitRateIndex].sampleRate; /*Q0*/
1285 113 : move32();
1286 113 : frameLength = igfMode[hIGFInfo->bitRateIndex].frameLength; /*Q0*/
1287 113 : move16();
1288 113 : igfMinFq = igfMode[hIGFInfo->bitRateIndex].igfMinFq; /*Q0*/
1289 113 : move16();
1290 113 : maxHopsize = igfMode[hIGFInfo->bitRateIndex].maxHopsize; /*Q0*/
1291 113 : move16();
1292 :
1293 : /* basic information */
1294 113 : hIGFInfo->sampleRate = sampleRate; /*Q0*/
1295 113 : move32();
1296 113 : hIGFInfo->frameLength = frameLength; /*Q0*/
1297 113 : move16();
1298 113 : hIGFInfo->maxHopsize = maxHopsize; /*Q0*/
1299 113 : move16();
1300 :
1301 113 : hIGFInfo->nfSeedBuf[0] = 0;
1302 113 : move16();
1303 113 : hIGFInfo->nfSeedBuf[1] = 0;
1304 113 : move16();
1305 113 : hIGFInfo->nfSeed = &hIGFInfo->nfSeedBuf[0];
1306 113 : move16();
1307 :
1308 : /* set up regular IGF grid for TCX 20 (transfac = 1.f) */
1309 113 : hGrid = &hIGFInfo->grid[IGF_GRID_LB_NORM];
1310 113 : IGF_gridSetUp( hGrid,
1311 113 : hIGFInfo->bitRateIndex,
1312 : sampleRate,
1313 : frameLength,
1314 : 16384 /*1 Q14*/,
1315 : igfMinFq );
1316 :
1317 : /* set up IGF grid for CELP->TCX 20 transitions (transfac = 1.25) */
1318 113 : hGrid = &hIGFInfo->grid[IGF_GRID_LB_TRAN];
1319 113 : IGF_gridSetUp( hGrid,
1320 113 : hIGFInfo->bitRateIndex,
1321 : sampleRate,
1322 : frameLength,
1323 : 20480 /*1.25 Q14*/,
1324 : igfMinFq );
1325 : /* set up IGF grid for TCX 10 (transfac = 0.5) */
1326 113 : hGrid = &hIGFInfo->grid[IGF_GRID_LB_SHORT];
1327 113 : IGF_gridSetUp( hGrid,
1328 113 : hIGFInfo->bitRateIndex,
1329 : sampleRate,
1330 : frameLength,
1331 : 8192 /*0.50f Q14*/,
1332 : igfMinFq );
1333 : }
1334 :
1335 113 : return retValue;
1336 : }
1337 53840 : Word16 IGFCommonFuncsIGFConfiguration_ivas_fx(
1338 : const Word32 total_brate, /* i : bitrate in bs e.g. 9600 for 9.6kbs */
1339 : const Word16 bwidth, /* i : audio bandwidth */
1340 : const Word16 element_mode, /* i : element mode */
1341 : H_IGF_INFO hIGFInfo, /* o : IGF info handle */
1342 : const Word16 rf_mode /* i : flag to signal the RF mode */
1343 : )
1344 : {
1345 : H_IGF_GRID hGrid;
1346 : Word16 retValue;
1347 : Word32 sampleRate;
1348 : Word16 frameLength;
1349 : Word16 igfMinFq;
1350 : Word16 maxHopsize;
1351 :
1352 53840 : retValue = 0; /* bitrate index is unknown -> error! */
1353 53840 : move16();
1354 :
1355 : /* interface call for reading in settings */
1356 53840 : hIGFInfo->bitRateIndex = IGF_MapBitRateToIndex( total_brate, bwidth, element_mode, rf_mode ); /*Q0*/
1357 :
1358 53840 : IF( NE_16( hIGFInfo->bitRateIndex, IGF_BITRATE_UNKNOWN ) )
1359 : {
1360 53840 : retValue = 1; /* no error */
1361 53840 : move16();
1362 :
1363 : /* mapping to local values */
1364 53840 : sampleRate = igfMode[hIGFInfo->bitRateIndex].sampleRate; /*Q0*/
1365 53840 : move32();
1366 53840 : frameLength = igfMode[hIGFInfo->bitRateIndex].frameLength; /*Q0*/
1367 53840 : move16();
1368 53840 : igfMinFq = igfMode[hIGFInfo->bitRateIndex].igfMinFq; /*Q0*/
1369 53840 : move16();
1370 53840 : maxHopsize = igfMode[hIGFInfo->bitRateIndex].maxHopsize; /*Q0*/
1371 53840 : move16();
1372 :
1373 : /* basic information */
1374 53840 : hIGFInfo->sampleRate = sampleRate; /*Q0*/
1375 53840 : move32();
1376 53840 : hIGFInfo->frameLength = frameLength; /*Q0*/
1377 53840 : move16();
1378 53840 : hIGFInfo->maxHopsize = maxHopsize; /*Q0*/
1379 53840 : move16();
1380 53840 : hIGFInfo->nfSeedBuf[0] = 0;
1381 53840 : move16();
1382 53840 : hIGFInfo->nfSeedBuf[1] = 0;
1383 53840 : move16();
1384 53840 : hIGFInfo->nfSeed = &hIGFInfo->nfSeedBuf[0];
1385 53840 : move16();
1386 :
1387 : /* set up regular IGF grid for TCX 20 (transfac = 1.f) */
1388 53840 : hGrid = &hIGFInfo->grid[IGF_GRID_LB_NORM];
1389 53840 : IGF_gridSetUp_ivas_fx( hGrid,
1390 53840 : hIGFInfo->bitRateIndex,
1391 : sampleRate,
1392 : frameLength,
1393 : 16384 /*1 Q14*/,
1394 : igfMinFq );
1395 : /* set up IGF grid for CELP->TCX 20 transitions (transfac = 1.25) */
1396 53840 : hGrid = &hIGFInfo->grid[IGF_GRID_LB_TRAN];
1397 53840 : IGF_gridSetUp_ivas_fx( hGrid,
1398 53840 : hIGFInfo->bitRateIndex,
1399 : sampleRate,
1400 : frameLength,
1401 : 20480 /*1.25 Q14*/,
1402 : igfMinFq );
1403 : /* set up IGF grid for TCX 10 (transfac = 0.5) */
1404 53840 : hGrid = &hIGFInfo->grid[IGF_GRID_LB_SHORT];
1405 53840 : IGF_gridSetUp_ivas_fx( hGrid,
1406 53840 : hIGFInfo->bitRateIndex,
1407 : sampleRate,
1408 : frameLength,
1409 : 8192 /*0.50f Q14*/,
1410 : igfMinFq );
1411 : }
1412 :
1413 53840 : return retValue; /*Q0*/
1414 : }
1415 :
1416 : /**********************************************************************/ /*
1417 : selects cumulative frequency tables and offsets for the IGF SCF arithmetic coder
1418 : **************************************************************************/
1419 53953 : Word16 IGFCommonFuncsIGFGetCFTables_fx(
1420 : const Word32 total_brate, /* i : bitrate in bs e.g. 9600 for 9.6kbs */
1421 : const Word16 bwidth, /* i : audio bandwidth */
1422 : const Word16 element_mode, /* i : element mode */
1423 : const Word16 rf_mode, /* i : flag to signal the RF mode */
1424 : const UWord16 **cf_se00, /* o : CF table for t == 0 and f == 0 */
1425 : const UWord16 **cf_se01, /* o : CF table for t == 0 and f == 1 */
1426 : Word16 *cf_off_se01, /* o : offset for CF table above */
1427 : const UWord16 **cf_se02, /* o : CF tables for t == 0 and f >= 2 */
1428 : const Word16 **cf_off_se02, /* o : offsets for CF tables above */
1429 : const UWord16 **cf_se10, /* o : CF table for t == 1 and f == 0 */
1430 : Word16 *cf_off_se10, /* o : offset for CF table above */
1431 : const UWord16 **cf_se11, /* o : CF tables for t == 1 and f >= 1 */
1432 : const Word16 **cf_off_se11 /* o : offsets for CF tables above */
1433 : )
1434 : {
1435 : Word16 retValue;
1436 : Word16 bitRateIndex;
1437 :
1438 53953 : retValue = 0; /* bitrate index is unknown -> error! */
1439 53953 : move16();
1440 :
1441 53953 : bitRateIndex = IGF_MapBitRateToIndex( total_brate, bwidth, element_mode, rf_mode );
1442 :
1443 53953 : IF( NE_32( bitRateIndex, IGF_BITRATE_UNKNOWN ) )
1444 : {
1445 53953 : retValue = 1; /* no error */
1446 53953 : move16();
1447 :
1448 53953 : SWITCH( bitRateIndex )
1449 : {
1450 111 : case IGF_BITRATE_WB_13200_CPE:
1451 111 : bitRateIndex = IGF_BITRATE_WB_9600;
1452 111 : move16();
1453 111 : BREAK;
1454 76 : case IGF_BITRATE_WB_16400_CPE:
1455 76 : bitRateIndex = IGF_BITRATE_WB_9600;
1456 76 : move16();
1457 76 : BREAK;
1458 3638 : case IGF_BITRATE_SWB_13200_CPE:
1459 3638 : bitRateIndex = IGF_BITRATE_SWB_9600;
1460 3638 : move16();
1461 3638 : BREAK;
1462 3821 : case IGF_BITRATE_SWB_16400_CPE:
1463 3821 : bitRateIndex = IGF_BITRATE_SWB_13200;
1464 3821 : move16();
1465 3821 : BREAK;
1466 2678 : case IGF_BITRATE_SWB_24400_CPE:
1467 2678 : bitRateIndex = IGF_BITRATE_SWB_16400;
1468 2678 : move16();
1469 2678 : BREAK;
1470 3128 : case IGF_BITRATE_FB_24400_CPE:
1471 3128 : bitRateIndex = IGF_BITRATE_FB_16400;
1472 3128 : move16();
1473 3128 : BREAK;
1474 1550 : case IGF_BITRATE_SWB_32000_CPE:
1475 1550 : bitRateIndex = IGF_BITRATE_SWB_24400;
1476 1550 : move16();
1477 1550 : BREAK;
1478 5176 : case IGF_BITRATE_FB_32000_CPE:
1479 5176 : bitRateIndex = IGF_BITRATE_FB_24400;
1480 5176 : move16();
1481 5176 : BREAK;
1482 9756 : case IGF_BITRATE_FB_48000_CPE:
1483 : case IGF_BITRATE_FB_64000_CPE:
1484 9756 : bitRateIndex = IGF_BITRATE_FB_32000;
1485 9756 : move16();
1486 9756 : BREAK;
1487 : }
1488 :
1489 53953 : switch ( bitRateIndex )
1490 : {
1491 13143 : case IGF_BITRATE_WB_9600:
1492 : case IGF_BITRATE_RF_WB_13200:
1493 : case IGF_BITRATE_SWB_9600:
1494 : case IGF_BITRATE_SWB_13200:
1495 : case IGF_BITRATE_RF_SWB_13200:
1496 : case IGF_BITRATE_SWB_16400:
1497 : case IGF_BITRATE_SWB_24400:
1498 : case IGF_BITRATE_SWB_32000:
1499 : case IGF_BITRATE_SWB_48000:
1500 : case IGF_BITRATE_SWB_64000:
1501 13143 : *cf_se00 = cf_se00_tab;
1502 13143 : *cf_se01 = cf_se01_tab[bitRateIndex];
1503 13143 : *cf_off_se01 = cf_off_se01_tab[bitRateIndex];
1504 13143 : *cf_se02 = &cf_se02_tab[bitRateIndex][0][0];
1505 13143 : *cf_off_se02 = &cf_off_se02_tab[bitRateIndex][0];
1506 13143 : *cf_se10 = &cf_se10_tab[0];
1507 13143 : *cf_off_se10 = cf_off_se10_tab;
1508 13143 : *cf_se11 = &cf_se11_tab[0][0][0];
1509 13143 : *cf_off_se11 = &cf_off_se11_tab[0][0];
1510 :
1511 13143 : BREAK;
1512 21981 : case IGF_BITRATE_FB_16400:
1513 : case IGF_BITRATE_FB_24400:
1514 : case IGF_BITRATE_FB_32000:
1515 21981 : bitRateIndex = add( sub( bitRateIndex, IGF_BITRATE_FB_16400 ), IGF_BITRATE_SWB_16400 );
1516 21981 : *cf_se00 = cf_se00_tab;
1517 21981 : *cf_se01 = cf_se01_tab[bitRateIndex];
1518 21981 : *cf_off_se01 = cf_off_se01_tab[bitRateIndex];
1519 21981 : *cf_se02 = &cf_se02_tab[bitRateIndex][0][0];
1520 21981 : *cf_off_se02 = &cf_off_se02_tab[bitRateIndex][0];
1521 21981 : *cf_se10 = &cf_se10_tab[0];
1522 21981 : *cf_off_se10 = cf_off_se10_tab;
1523 21981 : *cf_se11 = &cf_se11_tab[0][0][0];
1524 21981 : *cf_off_se11 = &cf_off_se11_tab[0][0];
1525 21981 : BREAK;
1526 4568 : case IGF_BITRATE_FB_48000:
1527 : case IGF_BITRATE_FB_64000:
1528 4568 : bitRateIndex = add( sub( bitRateIndex, IGF_BITRATE_FB_48000 ), IGF_BITRATE_SWB_48000 );
1529 4568 : *cf_se00 = cf_se00_tab;
1530 4568 : *cf_se01 = cf_se01_tab[bitRateIndex];
1531 4568 : *cf_off_se01 = cf_off_se01_tab[bitRateIndex];
1532 4568 : *cf_se02 = &cf_se02_tab[bitRateIndex][0][0];
1533 4568 : *cf_off_se02 = &cf_off_se02_tab[bitRateIndex][0];
1534 4568 : *cf_se10 = &cf_se10_tab[0];
1535 4568 : *cf_off_se10 = cf_off_se10_tab;
1536 4568 : *cf_se11 = &cf_se11_tab[0][0][0];
1537 4568 : *cf_off_se11 = &cf_off_se11_tab[0][0];
1538 4568 : BREAK;
1539 9473 : case IGF_BITRATE_FB_96000:
1540 : case IGF_BITRATE_FB_128000:
1541 : case IGF_BITRATE_FB_80000_CPE:
1542 : case IGF_BITRATE_FB_96000_CPE:
1543 : case IGF_BITRATE_FB_128000_CPE:
1544 9473 : bitRateIndex = IGF_BITRATE_SWB_48000;
1545 9473 : *cf_se00 = cf_se00_tab;
1546 9473 : *cf_se01 = cf_se01_tab[bitRateIndex];
1547 9473 : *cf_off_se01 = cf_off_se01_tab[bitRateIndex];
1548 9473 : *cf_se02 = &cf_se02_tab[bitRateIndex][0][0];
1549 9473 : *cf_off_se02 = &cf_off_se02_tab[bitRateIndex][0];
1550 9473 : *cf_se10 = &cf_se10_tab[0];
1551 9473 : *cf_off_se10 = cf_off_se10_tab;
1552 9473 : *cf_se11 = &cf_se11_tab[0][0][0];
1553 9473 : *cf_off_se11 = &cf_off_se11_tab[0][0];
1554 9473 : BREAK;
1555 1474 : case IGF_BITRATE_SWB_48000_CPE:
1556 1474 : bitRateIndex = IGF_BITRATE_SWB_16400;
1557 1474 : *cf_se00 = cf_se00_tab;
1558 1474 : *cf_se01 = cf_se01_tab[bitRateIndex];
1559 1474 : *cf_off_se01 = cf_off_se01_tab[bitRateIndex];
1560 1474 : *cf_se02 = &cf_se02_tab[bitRateIndex][0][0];
1561 1474 : *cf_off_se02 = &cf_off_se02_tab[bitRateIndex][0];
1562 1474 : *cf_se10 = &cf_se10_tab[0];
1563 1474 : *cf_off_se10 = cf_off_se10_tab;
1564 1474 : *cf_se11 = &cf_se11_tab[0][0][0];
1565 1474 : *cf_off_se11 = &cf_off_se11_tab[0][0];
1566 1474 : BREAK;
1567 3314 : case IGF_BITRATE_SWB_64000_CPE:
1568 : case IGF_BITRATE_SWB_80000_CPE:
1569 : case IGF_BITRATE_SWB_96000_CPE:
1570 3314 : bitRateIndex = IGF_BITRATE_SWB_48000; /*bitRateIndex-IGF_BITRATE_SWB_56000+IGF_BITRATE_SWB_48000;*/
1571 3314 : *cf_se00 = cf_se00_tab;
1572 3314 : *cf_se01 = cf_se01_tab[bitRateIndex];
1573 3314 : *cf_off_se01 = cf_off_se01_tab[bitRateIndex];
1574 3314 : *cf_se02 = &cf_se02_tab[bitRateIndex][0][0];
1575 3314 : *cf_off_se02 = &cf_off_se02_tab[bitRateIndex][0];
1576 3314 : *cf_se10 = &cf_se10_tab[0];
1577 3314 : *cf_off_se10 = cf_off_se10_tab;
1578 3314 : *cf_se11 = &cf_se11_tab[0][0][0];
1579 3314 : *cf_off_se11 = &cf_off_se11_tab[0][0];
1580 3314 : BREAK;
1581 0 : case IGF_BITRATE_UNKNOWN:
1582 : default:
1583 0 : assert( 0 );
1584 : }
1585 0 : }
1586 :
1587 53953 : return retValue;
1588 : }
|