Line data Source code
1 : /******************************************************************************************************
2 :
3 : (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
4 : Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
5 : Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
6 : Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
7 : contributors to this repository. All Rights Reserved.
8 :
9 : This software is protected by copyright law and by international treaties.
10 : The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
11 : Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
12 : Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
13 : Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
14 : contributors to this repository retain full ownership rights in their respective contributions in
15 : the software. This notice grants no license of any kind, including but not limited to patent
16 : license, nor is any license granted by implication, estoppel or otherwise.
17 :
18 : Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
19 : contributions.
20 :
21 : This software is provided "AS IS", without any express or implied warranties. The software is in the
22 : development stage. It is intended exclusively for experts who have experience with such software and
23 : solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
24 : and fitness for a particular purpose are hereby disclaimed and excluded.
25 :
26 : Any dispute, controversy or claim arising under or in relation to providing this software shall be
27 : submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
28 : accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
29 : the United Nations Convention on Contracts on the International Sales of Goods.
30 :
31 : *******************************************************************************************************/
32 :
33 : #include "options.h"
34 : #include <stdlib.h>
35 : #include "ivas_cnst.h"
36 : #include "ivas_prot.h"
37 : #include "prot.h"
38 : #include "ivas_rom_com.h"
39 : #include <math.h>
40 : #ifdef DEBUGGING
41 : #include "debug.h"
42 : #endif
43 :
44 : /*---------------------------------------------------------------
45 : * Local constants
46 : *---------------------------------------------------------------*/
47 :
48 : #define GAMMA_ISM_LOW_IMP 0.8f
49 : #define GAMMA_ISM_MEDIUM_IMP 1.2f
50 : #define GAMMA_ISM_HIGH_IMP 1.4f
51 :
52 : #define GAMMA_ISM_LOW_IMP2 0.9f
53 : #define GAMMA_ISM_MEDIUM_IMP2 1.2f
54 : #define GAMMA_ISM_HIGH_IMP2 1.35f
55 :
56 : #define GAMMA_ISM_LOW_IMP3 0.85f
57 : #define GAMMA_ISM_MEDIUM_IMP3 1.15f
58 : #define GAMMA_ISM_HIGH_IMP3 1.3f
59 :
60 : #define GAMMA_ISM_LOW_IMP4 0.8f
61 : #define GAMMA_ISM_MEDIUM_IMP4 1.0f
62 : #define GAMMA_ISM_HIGH_IMP4 1.2f
63 :
64 : #define PAN_MAX_DEG 30.0f
65 : #define ONE_OVER_PAN_STEP_DEG 10.0f
66 : #define SIN_LS_ANGLE 0.5f /* sinf( 30.0f * PI_OVER_180 ) */
67 :
68 :
69 : /*---------------------------------------------------------------
70 : * ivas_omasa_ism_mode_select()
71 : *
72 : * selects the ISM mode base on IVAS total bit-rate and
73 : * the number of objects in the combined ISM MASA format mode
74 : * ---------------------------------------------------------------*/
75 :
76 : /*! r : ISM format mode */
77 3083280 : ISM_MODE ivas_omasa_ism_mode_select(
78 : const int32_t ivas_total_brate, /* i : IVAS total bitrate */
79 : const int16_t nchan_ism /* i : number of input ISM's */
80 : )
81 : {
82 3083280 : ISM_MODE ism_mode = ISM_MODE_NONE;
83 :
84 3083280 : switch ( nchan_ism )
85 : {
86 450692 : case 1:
87 450692 : if ( ivas_total_brate >= IVAS_24k4 )
88 : {
89 420543 : ism_mode = ISM_MASA_MODE_DISC;
90 : }
91 : else
92 : {
93 30149 : ism_mode = ISM_MODE_NONE;
94 : }
95 450692 : break;
96 454916 : case 2:
97 454916 : if ( ivas_total_brate >= IVAS_48k )
98 : {
99 312496 : ism_mode = ISM_MASA_MODE_DISC;
100 : }
101 142420 : else if ( ivas_total_brate >= IVAS_32k )
102 : {
103 115180 : ism_mode = ISM_MASA_MODE_PARAM_ONE_OBJ;
104 : }
105 : else
106 : {
107 27240 : ism_mode = ISM_MODE_NONE;
108 : }
109 454916 : break;
110 886292 : case 3:
111 886292 : if ( ivas_total_brate >= IVAS_96k )
112 : {
113 313618 : ism_mode = ISM_MASA_MODE_DISC;
114 : }
115 572674 : else if ( ivas_total_brate >= IVAS_64k )
116 : {
117 225778 : ism_mode = ISM_MASA_MODE_PARAM_ONE_OBJ;
118 : }
119 346896 : else if ( ivas_total_brate >= IVAS_32k )
120 : {
121 295056 : ism_mode = ISM_MASA_MODE_MASA_ONE_OBJ;
122 : }
123 : else
124 : {
125 51840 : ism_mode = ISM_MODE_NONE;
126 : }
127 886292 : break;
128 1291380 : case 4:
129 1291380 : if ( ivas_total_brate >= IVAS_128k )
130 : {
131 456121 : ism_mode = ISM_MASA_MODE_DISC;
132 : }
133 835259 : else if ( ivas_total_brate >= IVAS_64k )
134 : {
135 363709 : ism_mode = ISM_MASA_MODE_PARAM_ONE_OBJ;
136 : }
137 471550 : else if ( ivas_total_brate >= IVAS_32k )
138 : {
139 395860 : ism_mode = ISM_MASA_MODE_MASA_ONE_OBJ;
140 : }
141 : else
142 : {
143 75690 : ism_mode = ISM_MODE_NONE;
144 : }
145 1291380 : break;
146 : }
147 :
148 3083280 : return ism_mode;
149 : }
150 :
151 :
152 : /*---------------------------------------------------------------
153 : * ivas_set_omasa_TC()
154 : *
155 : * set number of transport channels in OMASA format
156 : * ---------------------------------------------------------------*/
157 :
158 233382 : void ivas_set_omasa_TC(
159 : const ISM_MODE ism_mode, /* i : ISM mode */
160 : const int16_t nchan_ism, /* i : number of input ISMs */
161 : int16_t *nSCE, /* o : number of SCEs */
162 : int16_t *nCPE /* o : number of CPEs */
163 : )
164 : {
165 233382 : switch ( ism_mode )
166 : {
167 103483 : case ISM_MASA_MODE_MASA_ONE_OBJ:
168 : case ISM_MASA_MODE_PARAM_ONE_OBJ:
169 103483 : *nCPE = 1;
170 103483 : *nSCE = 1;
171 103483 : break;
172 65659 : case ISM_MASA_MODE_DISC:
173 65659 : *nCPE = 1;
174 65659 : *nSCE = nchan_ism;
175 65659 : break;
176 64240 : case ISM_MODE_NONE:
177 64240 : *nCPE = 1;
178 64240 : *nSCE = 0;
179 64240 : break;
180 0 : default:
181 0 : break;
182 : }
183 :
184 233382 : return;
185 : }
186 :
187 :
188 : /*---------------------------------------------------------------
189 : * ivas_interformat_brate()
190 : *
191 : * Bit-budget distribution in case of combined-format coding
192 : * ---------------------------------------------------------------*/
193 :
194 : /*! r: adjusted bitrate */
195 2862983 : int32_t ivas_interformat_brate(
196 : const ISM_MODE ism_mode, /* i : ISM mode */
197 : const int16_t nchan_ism, /* i : number of ISM channels */
198 : const int32_t element_brate, /* i : element bitrate */
199 : const int16_t ism_imp, /* i : ISM importance flag */
200 : const int16_t limit_flag /* i : flag to limit the bitrate increase */
201 : )
202 : {
203 : int32_t element_brate_out;
204 : int16_t nBits, limit_low, limit_high;
205 :
206 2862983 : nBits = (int16_t) ( element_brate / FRAMES_PER_SEC );
207 :
208 2862983 : if ( ism_imp == ISM_INACTIVE_IMP )
209 : {
210 65168 : nBits = BITS_ISM_INACTIVE;
211 : }
212 : else
213 : {
214 2797815 : if ( ism_mode == ISM_MASA_MODE_DISC && ( ( nchan_ism == 4 && element_brate == 24000 ) || ( nchan_ism == 3 && element_brate <= 24000 ) || ( nchan_ism == 2 && element_brate <= 11000 ) ) ) /* for border case in DISC mode */
215 : {
216 314772 : if ( limit_flag == 1 && ( ( nchan_ism == 4 && element_brate == 24000 ) || ( nchan_ism == 3 && element_brate == 20000 ) || ( nchan_ism == 2 && element_brate <= 11000 ) ) )
217 : {
218 228964 : return element_brate;
219 : }
220 :
221 85808 : if ( ism_imp == ISM_LOW_IMP )
222 : {
223 15195 : nBits = (int16_t) ( nBits * GAMMA_ISM_LOW_IMP4 );
224 : }
225 70613 : else if ( ism_imp == ISM_MEDIUM_IMP )
226 : {
227 19113 : nBits = (int16_t) ( nBits * GAMMA_ISM_MEDIUM_IMP4 );
228 19113 : if ( limit_flag == -1 )
229 : {
230 0 : nBits = (int16_t) ( nBits * GAMMA_ISM_HIGH_IMP4 );
231 : }
232 : }
233 : else /* ISM_HIGH_IMP */
234 : {
235 51500 : nBits = (int16_t) ( nBits * GAMMA_ISM_HIGH_IMP4 );
236 51500 : if ( limit_flag == -1 )
237 : {
238 48 : nBits = (int16_t) ( nBits * GAMMA_ISM_HIGH_IMP4 );
239 : }
240 : }
241 : }
242 2483043 : else if ( ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ||
243 1693856 : ( ism_mode == ISM_MASA_MODE_DISC && element_brate == 9600 ) /* this condition corresponds to the ivas_total_brate = 24400 and 1 object */
244 : )
245 : {
246 448532 : if ( ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ && element_brate == IVAS_13k2 )
247 : {
248 71706 : if ( ism_imp == ISM_LOW_IMP )
249 : {
250 7021 : nBits = (int16_t) ( nBits * GAMMA_ISM_LOW_IMP3 );
251 : }
252 64685 : else if ( ism_imp == ISM_MEDIUM_IMP )
253 : {
254 16436 : nBits = (int16_t) ( nBits * GAMMA_ISM_MEDIUM_IMP3 );
255 : }
256 : else /* ISM_HIGH_IMP */
257 : {
258 48249 : nBits = (int16_t) ( nBits * GAMMA_ISM_HIGH_IMP4 );
259 : }
260 : }
261 : else
262 : {
263 376826 : if ( ism_imp == ISM_LOW_IMP )
264 : {
265 35052 : nBits = (int16_t) ( nBits * GAMMA_ISM_LOW_IMP3 );
266 : }
267 341774 : else if ( ism_imp == ISM_MEDIUM_IMP )
268 : {
269 106651 : nBits = (int16_t) ( nBits * GAMMA_ISM_MEDIUM_IMP3 );
270 : }
271 : else /* ISM_HIGH_IMP */
272 : {
273 235123 : nBits = (int16_t) ( nBits * GAMMA_ISM_HIGH_IMP3 );
274 : }
275 : }
276 : }
277 2034511 : else if ( ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ && element_brate == 16000 )
278 : {
279 178431 : if ( ism_imp == ISM_LOW_IMP )
280 : {
281 22442 : nBits = (int16_t) ( nBits * GAMMA_ISM_LOW_IMP );
282 : }
283 155989 : else if ( ism_imp == ISM_MEDIUM_IMP )
284 : {
285 53295 : nBits = (int16_t) ( nBits * GAMMA_ISM_MEDIUM_IMP );
286 : }
287 : else /* ISM_HIGH_IMP */
288 : {
289 102694 : nBits = (int16_t) ( nBits * GAMMA_ISM_HIGH_IMP3 );
290 : }
291 : }
292 : else
293 : {
294 1856080 : if ( ism_imp == ISM_LOW_IMP )
295 : {
296 173792 : nBits = (int16_t) ( nBits * GAMMA_ISM_LOW_IMP );
297 : }
298 1682288 : else if ( ism_imp == ISM_MEDIUM_IMP )
299 : {
300 435670 : nBits = (int16_t) ( nBits * GAMMA_ISM_MEDIUM_IMP );
301 : }
302 : else /* ISM_HIGH_IMP */
303 : {
304 1246618 : nBits = (int16_t) ( nBits * GAMMA_ISM_HIGH_IMP );
305 : }
306 : }
307 : }
308 :
309 2634019 : limit_low = MIN_BRATE_SWB_BWE / FRAMES_PER_SEC;
310 2634019 : if ( ism_imp == ISM_INACTIVE_IMP )
311 : {
312 65168 : limit_low = BITS_ISM_INACTIVE;
313 : }
314 2568851 : else if ( element_brate >= SCE_CORE_16k_LOW_LIMIT )
315 : {
316 1896879 : limit_low = SCE_CORE_16k_LOW_LIMIT / FRAMES_PER_SEC;
317 : }
318 :
319 2634019 : limit_high = IVAS_512k / FRAMES_PER_SEC;
320 2634019 : if ( element_brate < SCE_CORE_16k_LOW_LIMIT )
321 : {
322 687055 : limit_high = ACELP_12k8_HIGH_LIMIT / FRAMES_PER_SEC;
323 : }
324 :
325 2634019 : nBits = check_bounds_s( nBits, limit_low, limit_high );
326 :
327 2634019 : element_brate_out = nBits * FRAMES_PER_SEC;
328 :
329 2634019 : return element_brate_out;
330 : }
331 :
332 :
333 : /*---------------------------------------------------------------
334 : * ivas_combined_format_brate_sanity()
335 : *
336 : * Sanity check in combined format coding
337 : * ---------------------------------------------------------------*/
338 :
339 69168 : void ivas_combined_format_brate_sanity(
340 : const int32_t element_brate, /* i : element bitrate */
341 : const int16_t core, /* i : core */
342 : const int32_t total_brate, /* i : total bitrate */
343 : int32_t *core_brate, /* i/o: core bitrate */
344 : int16_t *inactive_coder_type_flag, /* o : inactive coder_type flag */
345 : int16_t *diff_nBits /* o : number of differential bits */
346 : )
347 : {
348 : int16_t limit_high, nBits;
349 : int32_t brate_diff;
350 :
351 69168 : brate_diff = total_brate - *core_brate;
352 :
353 : /* sanity check: at lowest IVAS bit-rates and one ISM channel coded by
354 : low-rate core-coder mode, it can happen that the CPE (MASA) bit-budget
355 : for ACELP core-coding @12.8 kHz is too high */
356 :
357 69168 : if ( element_brate < ACELP_12k8_HIGH_LIMIT )
358 : {
359 31404 : limit_high = ACELP_12k8_HIGH_LIMIT / FRAMES_PER_SEC;
360 31404 : nBits = (int16_t) ( *core_brate / FRAMES_PER_SEC );
361 :
362 31404 : *diff_nBits = nBits - limit_high;
363 31404 : if ( *diff_nBits > 0 )
364 : {
365 4957 : if ( core == TCX_20_CORE || core == TCX_10_CORE )
366 : {
367 4028 : *diff_nBits = 0;
368 : }
369 : else /* ACELP core */
370 : {
371 929 : *core_brate -= ( *diff_nBits * FRAMES_PER_SEC );
372 : }
373 : }
374 : }
375 :
376 : /*-----------------------------------------------------------------*
377 : * set inactive coder_type flag in ACELP core
378 : *-----------------------------------------------------------------*/
379 :
380 69168 : if ( core == ACELP_CORE )
381 : {
382 28654 : *inactive_coder_type_flag = 0; /* AVQ by default */
383 28654 : if ( *core_brate + brate_diff <= MAX_GSC_INACTIVE_BRATE )
384 : {
385 18942 : *inactive_coder_type_flag = 1; /* GSC */
386 : }
387 : }
388 :
389 69168 : return;
390 : }
391 :
392 :
393 : /*---------------------------------------------------------------
394 : * bits_index_ism_ratio()
395 : *
396 : *
397 : * ---------------------------------------------------------------*/
398 :
399 : /*!r : number of bits for ISM ratio index */
400 268709 : int16_t bits_index_ism_ratio(
401 : const int16_t nchan_ism /* i : number of objects */
402 : )
403 : {
404 : int16_t bits_index;
405 :
406 268709 : bits_index = 0;
407 268709 : if ( nchan_ism == 2 )
408 : {
409 36942 : bits_index = 3;
410 : }
411 231767 : else if ( nchan_ism == 3 )
412 : {
413 80976 : bits_index = 6;
414 : }
415 150791 : else if ( nchan_ism == 4 )
416 : {
417 150791 : bits_index = 7;
418 : }
419 : else
420 : {
421 0 : assert( ( nchan_ism >= 2 && nchan_ism <= 4 ) && "Wrong number of objects for MASA_ISM." );
422 : }
423 :
424 268709 : return bits_index;
425 : }
426 :
427 :
428 : /*---------------------------------------------------------------
429 : * calculate_nbits_meta()
430 : *
431 : *
432 : * ---------------------------------------------------------------*/
433 :
434 352160 : void calculate_nbits_meta(
435 : const int16_t nchan_ism,
436 : float q_energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS],
437 : float masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS],
438 : const int16_t numSf,
439 : const int16_t numCodingBands,
440 : int16_t *bits_ism,
441 : const int16_t idx_sep_obj,
442 : const int16_t ism_imp )
443 : {
444 : int16_t sf, band, obj;
445 : float priority[MAX_NUM_OBJECTS], max_p;
446 :
447 352160 : if ( nchan_ism > 1 )
448 : {
449 352160 : set_f( priority, 0.0f, nchan_ism );
450 1292197 : for ( sf = 0; sf < numSf; sf++ )
451 : {
452 6309716 : for ( band = 0; band < numCodingBands; band++ )
453 : {
454 24406317 : for ( obj = 0; obj < nchan_ism; obj++ )
455 : {
456 19036638 : priority[obj] = max( priority[obj], ( q_energy_ratio_ism[sf][band][obj] * ( 1 - masa_to_total_energy_ratio[sf][band] ) ) );
457 : }
458 : }
459 : }
460 : }
461 : else
462 : {
463 0 : priority[0] = 1;
464 : }
465 :
466 : /* decide parameters for ISM metadata quantization */
467 352160 : maximum( priority, nchan_ism, &max_p );
468 1536326 : for ( obj = 0; obj < nchan_ism; obj++ )
469 : {
470 1184166 : if ( obj == idx_sep_obj )
471 : {
472 352160 : if ( ism_imp == 3 )
473 : {
474 217130 : priority[obj] = 1;
475 : }
476 135030 : else if ( ism_imp == 2 )
477 : {
478 96055 : priority[obj] = ( 1 + max_p ) * 0.5f;
479 : }
480 : else
481 : {
482 38975 : priority[obj] = max_p;
483 : }
484 : }
485 1184166 : bits_ism[obj] = bits_direction_masa[0] - (int16_t) ( ( 1 - ( (int16_t) ( priority[obj] * 1000.0f ) ) * 0.001f ) * 6 );
486 : }
487 :
488 352160 : return;
489 : }
490 :
491 :
492 : /*---------------------------------------------------------------
493 : * ivas_get_stereo_panning_gains()
494 : *
495 : *
496 : *---------------------------------------------------------------*/
497 :
498 3857867 : void ivas_get_stereo_panning_gains(
499 : const float aziDeg,
500 : const float eleDeg,
501 : float panningGains[2] )
502 : {
503 : float aziPlusEle, aziMinusEle, y;
504 :
505 : /* use identity sin(A+B) + sin(A−B) = 2 sinA cosB */
506 3857867 : aziPlusEle = aziDeg + eleDeg;
507 3857867 : aziMinusEle = aziDeg - eleDeg;
508 :
509 : /* wrap into -180..+180 */
510 4144729 : while ( aziPlusEle > 180.0f )
511 : {
512 286862 : aziPlusEle -= 360.0f;
513 : }
514 3991659 : while ( aziPlusEle < -180.0f )
515 : {
516 133792 : aziPlusEle += 360.0f;
517 : }
518 4124046 : while ( aziMinusEle > 180.0f )
519 : {
520 266179 : aziMinusEle -= 360.0f;
521 : }
522 3982257 : while ( aziMinusEle < -180.0f )
523 : {
524 124390 : aziMinusEle += 360.0f;
525 : }
526 :
527 : /* compute Y-coordinate corresponding to the azimuth and elevation: y = sin(azi) * cos(ele) = (sin(azi+ele) + sin(azi-ele)) / 2 */
528 3857867 : y = ( sinf( aziPlusEle * PI_OVER_180 ) + sinf( aziMinusEle * PI_OVER_180 ) ) * 0.5f;
529 :
530 3857867 : if ( y >= SIN_LS_ANGLE )
531 : { /* Left side */
532 807427 : panningGains[0] = 1.0f;
533 807427 : panningGains[1] = 0.0f;
534 : }
535 3050440 : else if ( y <= -SIN_LS_ANGLE )
536 : { /* Right side */
537 814334 : panningGains[0] = 0.0f;
538 814334 : panningGains[1] = 1.0f;
539 : }
540 : else /* Tangent panning law */
541 : {
542 : /* from sin(angle) to index assuming range -30..+30 degrees with 0.1-degree spacing */
543 : float angleDeg, pos;
544 : int16_t idx;
545 :
546 : /* Convert azi and ele to an azi value of the cone of confusion */
547 2236106 : angleDeg = asinf( y ) * _180_OVER_PI;
548 2236106 : angleDeg = fmaxf( fminf( angleDeg, PAN_MAX_DEG ), -PAN_MAX_DEG );
549 :
550 : /* compute the panning gains from the mapped azimuth using a look-up table */
551 2236106 : pos = ( angleDeg + PAN_MAX_DEG ) * ONE_OVER_PAN_STEP_DEG; /* ideal floating index */
552 2236106 : idx = (int16_t) roundf( pos );
553 :
554 2236106 : idx = max( 0, min( idx, OMASA_PAN_TBL_LEN - 1 ) );
555 :
556 2236106 : panningGains[0] = ivas_tan_panning_gain_tbl[idx];
557 2236106 : panningGains[1] = ivas_tan_panning_gain_tbl[OMASA_PAN_TBL_LEN - 1 - idx];
558 : }
559 :
560 3857867 : return;
561 : }
562 :
563 :
564 : /*---------------------------------------------------------------
565 : * calculate_brate_limit_flag()
566 : *
567 : *
568 : *---------------------------------------------------------------*/
569 :
570 : /*! r: limitation flag */
571 908533 : int16_t calculate_brate_limit_flag(
572 : const int16_t ism_imp[], /* i : ISM importance flags */
573 : const int16_t nchan_ism /* i : number of objects */
574 : )
575 : {
576 : int16_t n;
577 : int16_t brate_limit_flag;
578 : int16_t nzeros;
579 :
580 908533 : brate_limit_flag = 0;
581 908533 : nzeros = 0;
582 3051779 : for ( n = 0; n < nchan_ism; n++ )
583 : {
584 2143246 : brate_limit_flag += ism_imp[n];
585 2143246 : if ( ism_imp[n] == 0 )
586 : {
587 49630 : nzeros++;
588 : }
589 : }
590 :
591 908533 : if ( brate_limit_flag >= (int16_t) ( nchan_ism * 2.5f ) )
592 : {
593 754745 : brate_limit_flag = 1;
594 : }
595 : else
596 : {
597 153788 : if ( nzeros / (float) nchan_ism >= 0.5f )
598 : {
599 17229 : brate_limit_flag = -1; /* there is no limitation, on the contrary */
600 : }
601 : }
602 :
603 908533 : return brate_limit_flag;
604 : }
|