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 : /*====================================================================================
34 : EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
35 : ====================================================================================*/
36 :
37 : #include <stdint.h>
38 : #include "options.h"
39 : #ifdef DEBUGGING
40 : #include "debug.h"
41 : #endif
42 : #include <math.h>
43 : #include "prot.h"
44 : #include "rom_com.h"
45 : #include "basop_util.h"
46 : #include "basop_mpy.h"
47 : #include "stl.h"
48 : #include "wmc_auto.h"
49 :
50 : #define WMC_TOOL_SKIP
51 :
52 : /*-------------------------------------------------------------------
53 : * Local constants
54 : *-------------------------------------------------------------------*/
55 :
56 : #define MIN_BITS_FIX 0
57 : #define HQ_16k40_BIT ( HQ_16k40 / FRAMES_PER_SEC ) /* 16400/50=328, FOR FIX TMP */
58 : #define C1_QRk ( 1 << SWB_BWE_LR_QRk ) /* 1 */
59 : #define Qbf 14
60 : #define C1_Qbf ( 1 << Qbf ) /* 1 */
61 : #define BITS_FACT_1p10 ( Word16 )( 1.10f * (float) pow( 2, Qbf ) + 0.5f )
62 : #define BITS_FACT_1p05 ( Word16 )( 1.05f * (float) pow( 2, Qbf ) + 0.5f )
63 : #define BITS_FACT_1p00 ( Word16 )( 1.00f * (float) pow( 2, Qbf ) + 0.5f )
64 : #define BITS_FACT_0p97 ( Word16 )( 0.97f * (float) pow( 2, Qbf ) + 0.5f )
65 : #define BITS_FACT_0p92 ( Word16 )( 0.92f * (float) pow( 2, Qbf ) + 0.5f )
66 :
67 : #define L_Comp( hi, lo ) L_mac( L_deposit_h( hi ), lo, 1 )
68 :
69 : /*-------------------------------------------------------------------
70 : * div_s_ss()
71 : *
72 : *
73 : *-------------------------------------------------------------------*/
74 :
75 : /*! r: result of division (Word16 Q0) */
76 96 : static Word16 div_s_ss(
77 : const Word16 n, /* i : numerator (Word16 Q0 */
78 : const Word16 d /* i : denominator (Word16 Q0) */
79 : )
80 : {
81 : Word16 norm_n, norm_d;
82 : Word16 ns, ds;
83 : Word16 res;
84 : Word16 tmp;
85 :
86 96 : test();
87 96 : IF( n == 0 || d == 0 )
88 : {
89 0 : return 0;
90 : }
91 :
92 96 : norm_n = norm_s( n );
93 96 : norm_n = sub( norm_n, 1 );
94 96 : ns = shl( n, norm_n );
95 :
96 96 : norm_d = norm_s( d );
97 96 : ds = shl( d, norm_d );
98 :
99 96 : tmp = div_s( ns, ds );
100 96 : res = shr( tmp, add( sub( norm_n, norm_d ), 15 ) );
101 :
102 96 : return res;
103 : }
104 :
105 :
106 : /*-------------------------------------------------------------------*
107 : * Bits2indvsb()
108 : *
109 : * Bit allocation to individual SB's in a group
110 : *-------------------------------------------------------------------*/
111 288 : static void Bits2indvsb_fx(
112 : const Word32 *L_be, /* i : Qbe Band Energy of sub-band */
113 : const Word16 start_band, /* i : Q0 start band indices */
114 : const Word16 end_band, /* i : Q0 end band indices */
115 : const Word16 Bits, /* i : Q0 Total number of bits allocated to a group */
116 : const Word32 L_Bits_needed, /* i : QRk smallest bit number for allocation in group */
117 : Word32 *L_Rsubband, /* o : QRk bit allocation of sub-band */
118 : Word16 *p2aflags_fx /* i/o: Q0 peaky/noise subband flag */
119 : )
120 : {
121 : Word16 i, j, k;
122 : Word32 L_R_temp[14]; /* QRk = QL_Rsubband; */
123 : Word16 Ravg_fx;
124 : Word16 QRavg;
125 :
126 : const Word32 *L_y_ptr;
127 : Word32 *L_R_ptr;
128 :
129 : Word16 Bits_avg_fx;
130 : Word16 QBavg;
131 : Word16 scale_fact_fx;
132 :
133 : Word16 band_num_fx;
134 : Word16 index_fx[14];
135 :
136 : Word16 y_index_fx[14];
137 :
138 : Word16 be_sum_fx; /* Q0 */
139 :
140 : Word16 exp_normn, exp_normd;
141 : Word16 enr_diffcnt_fx;
142 : Word16 th_5_fx;
143 : Word16 Rcnt_fx;
144 :
145 : Word16 be_cnt_fx;
146 : Word16 *p2aflags_fx_ptr;
147 :
148 : Word32 L_temp1;
149 : Word32 L_temp2;
150 :
151 288 : band_num_fx = sub( end_band, start_band );
152 288 : L_y_ptr = L_be + start_band;
153 288 : L_R_ptr = L_Rsubband + start_band;
154 288 : p2aflags_fx_ptr = p2aflags_fx + start_band;
155 :
156 2016 : FOR( i = 0; i < band_num_fx; i++ )
157 : {
158 1728 : y_index_fx[i] = extract_h( L_shr( L_y_ptr[i], sub( SWB_BWE_LR_Qbe, 16 ) ) );
159 1728 : move16();
160 1728 : index_fx[i] = i;
161 1728 : move16();
162 : }
163 :
164 :
165 : /* Rearrange norm vector in decreasing order */
166 288 : reordvct( y_index_fx, band_num_fx, index_fx );
167 :
168 288 : be_sum_fx = 0;
169 288 : move16();
170 288 : be_cnt_fx = 0;
171 288 : move16();
172 2016 : FOR( j = 0; j < band_num_fx; j++ )
173 : {
174 1728 : test();
175 1728 : IF( y_index_fx[j] <= 0 || p2aflags_fx_ptr[index_fx[j]] == 0 )
176 : {
177 0 : y_index_fx[j] = 0;
178 0 : move16();
179 0 : L_R_temp[j] = 0x0L;
180 0 : move32();
181 : }
182 : ELSE
183 : {
184 1728 : L_R_temp[j] = C1_QRk;
185 1728 : move32(); /* filled not zero value */
186 1728 : be_cnt_fx = add( be_cnt_fx, 1 );
187 : }
188 : }
189 :
190 288 : i = sub( be_cnt_fx, 1 );
191 2016 : FOR( k = 0; k <= i; k++ )
192 : {
193 1728 : test();
194 1728 : if ( L_R_temp[k] > 0 )
195 : {
196 1728 : be_sum_fx = add( be_sum_fx, y_index_fx[k] );
197 : }
198 : }
199 288 : QBavg = 0;
200 288 : move16();
201 :
202 : /*Ravg = (float) be_sum/be_cnt;*/
203 288 : Ravg_fx = 0;
204 288 : move16();
205 288 : QRavg = 0;
206 288 : move16();
207 288 : IF( be_cnt_fx != 0x0 )
208 : {
209 288 : exp_normn = norm_s( be_sum_fx );
210 288 : exp_normn = sub( exp_normn, 1 );
211 288 : exp_normd = norm_s( be_cnt_fx );
212 288 : Ravg_fx = div_s( shl( be_sum_fx, exp_normn ), shl( be_cnt_fx, exp_normd ) );
213 :
214 288 : Ravg_fx = shr( Ravg_fx, 2 ); /* safe shift */
215 288 : QRavg = add( sub( exp_normn, exp_normd ), 15 - 2 );
216 : }
217 :
218 288 : enr_diffcnt_fx = 0;
219 288 : move16();
220 288 : th_5_fx = shl( 5, QRavg );
221 2016 : FOR( j = 0; j < be_cnt_fx; j++ )
222 : {
223 1728 : IF( sub( abs_s( sub( Ravg_fx, shl( y_index_fx[j], QRavg ) ) ), th_5_fx ) > 0 )
224 : {
225 8 : enr_diffcnt_fx = add( enr_diffcnt_fx, 1 );
226 : }
227 : }
228 :
229 288 : IF( enr_diffcnt_fx > 0 )
230 : {
231 4 : scale_fact_fx = 11468;
232 4 : move16(); /* 0.35f 11468.8(Q15) */
233 : }
234 : ELSE
235 : {
236 284 : scale_fact_fx = 19661;
237 284 : move16(); /* 0.60f 19660.8(Q15) */
238 : }
239 :
240 : /* Bits allocation to individual SB's in a group based on Band Energies */
241 340 : FOR( j = 0; j < be_cnt_fx; j++ )
242 : {
243 340 : Rcnt_fx = add( i, 1 );
244 :
245 : /* Ravg = (float) be_sum/Rcnt; */
246 340 : exp_normn = norm_s( be_sum_fx );
247 340 : exp_normn = sub( exp_normn, 1 );
248 340 : exp_normd = norm_s( Rcnt_fx );
249 340 : Ravg_fx = div_s( shl( be_sum_fx, exp_normn ), shl( Rcnt_fx, exp_normd ) );
250 340 : Ravg_fx = shr( Ravg_fx, 2 ); /* safe shift */
251 340 : QRavg = add( sub( exp_normn, exp_normd ), 15 - 2 );
252 :
253 340 : test();
254 340 : if ( be_sum_fx <= 0 )
255 : {
256 0 : be_sum_fx = 1;
257 0 : move16();
258 : }
259 :
260 : /* Bits_avg = (float) Bits/(be_sum+EPSILON); */
261 340 : Bits_avg_fx = 0;
262 340 : move16();
263 340 : QBavg = 0;
264 340 : move16();
265 340 : IF( Bits != 0 )
266 : {
267 340 : exp_normn = norm_s( Bits );
268 340 : exp_normn = sub( exp_normn, 1 );
269 340 : exp_normd = norm_s( be_sum_fx );
270 340 : Bits_avg_fx = div_s( shl( Bits, exp_normn ), shl( be_sum_fx, exp_normd ) );
271 340 : Bits_avg_fx = shr( Bits_avg_fx, 2 ); /* safe_shift */
272 340 : QBavg = add( sub( exp_normn, exp_normd ), 15 - 2 );
273 : }
274 2290 : FOR( k = 0; k <= i; k++ )
275 : {
276 1950 : IF( L_R_temp[k] > 0 ) /* Rtemp -> SWB_BWE_LR_QRk */
277 : {
278 : /* Allocate more bits to SB, if SB bandenergy is higher than average energy */
279 : /* R_temp[k] = (float)( Bits_avg * y_index[k]+( scale_fact * (y_index[k] - Ravg))); */
280 1950 : L_temp1 = L_mult( Bits_avg_fx, y_index_fx[k] ); /* QBavg+1 */
281 1950 : L_temp2 = L_mult( scale_fact_fx, sub( shl( y_index_fx[k], QRavg ), Ravg_fx ) ); /* 15+QRavg+1 */
282 1950 : L_R_temp[k] = L_add( L_shr( L_temp1, sub( add( QBavg, 1 ), SWB_BWE_LR_QRk ) ), L_shr( L_temp2, sub( add( QRavg, 16 ), SWB_BWE_LR_QRk ) ) ); /* SWB_BWE_LR_QRk */
283 : }
284 : }
285 340 : IF( L_sub( L_R_temp[i], L_Bits_needed ) < 0 )
286 : {
287 52 : L_R_temp[i] = 0x0L;
288 52 : move32();
289 :
290 52 : p2aflags_fx_ptr[index_fx[i]] = 0;
291 52 : move16();
292 :
293 : /* be_sum -= y_index[i]; */
294 52 : be_sum_fx = sub( be_sum_fx, y_index_fx[i] );
295 :
296 52 : i = sub( i, 1 );
297 : }
298 : ELSE
299 : {
300 288 : BREAK;
301 : }
302 : }
303 :
304 : /* Rearrange the bit allocation to align with original */
305 2016 : FOR( k = 0; k < band_num_fx; k++ )
306 : {
307 1728 : j = index_fx[k];
308 1728 : move16();
309 1728 : L_R_ptr[j] = L_R_temp[k];
310 1728 : move32();
311 : }
312 :
313 288 : return;
314 : }
315 :
316 : /*-------------------------------------------------------------------*
317 : * hq2_bit_alloc_har()
318 : *
319 : * Bit allocation mechanism for HQ_HARMONIC mode
320 : *-------------------------------------------------------------------*/
321 :
322 96 : void hq2_bit_alloc_har(
323 : float *y, /* i : band energy of sub-vectors */
324 : int16_t B_fx, /* i : number of available bits */
325 : int16_t N_fx, /* i : number of sub-vectors */
326 : Word32 *L_Rsubband,
327 : int16_t p2a_bands_fx,
328 : int32_t L_core_brate, /* i : core bitrate */
329 : int16_t p2a_flags_fx[],
330 : int16_t band_width_fx[] )
331 : {
332 : Word16 i, j, k;
333 :
334 : Word32 L_norm_sum; /* Qbe */
335 : Word32 L_Ravg_sub[GRP_SB]; /* Qbe */
336 : Word32 L_temp_band_energy[BANDS_MAX]; /* Qbe */
337 :
338 : Word16 j_fx, k_fx, Bits_grp_fx[GRP_SB];
339 :
340 : Word32 L_temp_band_energydiff[BANDS_MAX];
341 : Word16 G1_BE_DIFF_POS_fx; /* Q0 */
342 : Word32 L_G1_BE_DIFF_VAL; /* Qbe Word32 */
343 : Word16 final_gr_fact_pos_fx, gmax_range_fx[2], temp_fx;
344 : Word16 bits_fact_fx, bits_fact1_fx; /* Q? */
345 : Word16 grp_rngmax_fx[2];
346 : Word16 index_fx[NB_SWB_SUBBANDS_HAR], y_index_fx[NB_SWB_SUBBANDS_HAR], esthf_bits_fx, grp_bit_avg_fx, harmonic_band_fx;
347 : Word32 L_norm_sum_avg;
348 : Word32 L_norm_diff; /* Qbe */
349 : Word16 bits_allocweigh_fx; /* Q15 */
350 : Word16 grp_bound_fx[5];
351 : Word32 L_grp_thr[GRP_SB]; /* not require Word32 precission */
352 : Word16 lf_hf_ge_r_fx; /* Q15 */
353 : Word32 L_avg_enhf_en_diff; /* Qbe */
354 :
355 : Word16 B_norm_fx;
356 :
357 : Word32 L_temp, L_temp2;
358 : Word16 exp, frac;
359 :
360 : Word32 L_THR1, L_THR2, L_THR3;
361 :
362 : Word16 exp_norm;
363 : Word16 norm_sum_fx;
364 : Word16 Qns; /* Q value for norm_sum_fx */
365 : Word16 Inv_norm_sum_fx; /* 1/norm_sum */
366 : Word16 QIns; /* Q value for Inv_norm_sum_fx */
367 :
368 : Word16 exp_normn, exp_normd;
369 : Word16 div_fx;
370 :
371 : Word16 Inv_p2a_bands_fx;
372 : Word16 QIpb;
373 :
374 : Word16 exp_shift;
375 :
376 : Word32 L_y[BANDS_MAX];
377 :
378 : #ifdef BASOP_NOGLOB
379 : Flag Overflow;
380 96 : Overflow = 0;
381 : #endif
382 :
383 96 : grp_rngmax_fx[0] = 0;
384 96 : grp_rngmax_fx[1] = 0;
385 :
386 2208 : for ( i = 0; i < N_fx; i++ )
387 : {
388 2112 : L_y[i] = (Word32) ( y[i] * (float) pow( 2.0f, SWB_BWE_LR_Qbe ) );
389 : }
390 :
391 96 : L_THR1 = L_shl( L_deposit_l( THR1 ), SWB_BWE_LR_QRk );
392 96 : L_THR2 = L_shl( L_deposit_l( THR2 ), SWB_BWE_LR_QRk );
393 96 : L_THR3 = L_shl( L_deposit_l( THR3 ), SWB_BWE_LR_QRk );
394 :
395 96 : set_val_Word16( Bits_grp_fx, 0, GRP_SB );
396 :
397 : /* Initialize subbands bits allocation vector based on harmonic bands */
398 96 : harmonic_band_fx = add( sub( N_fx, p2a_bands_fx ), 1 );
399 : /*printf("harmonic_band= %d %d\n", harmonic_band, harmonic_band_fx);*/
400 2208 : FOR( k = 0; k < N_fx; k++ )
401 : {
402 2112 : L_Rsubband[k] = (Word32) ( C1_QRk );
403 2112 : move32(); /* Constant Value */
404 2112 : L_temp_band_energy[k] = L_y[k];
405 2112 : move32(); /* SWB_BWE_LR_Qbe */
406 : }
407 96 : final_gr_fact_pos_fx = 2;
408 96 : move16();
409 96 : bits_fact_fx = C1_Qbf;
410 96 : move16();
411 96 : bits_fact1_fx = C1_Qbf;
412 96 : move16();
413 :
414 96 : gmax_range_fx[0] = G1_RANGE;
415 96 : move16();
416 96 : gmax_range_fx[1] = G1G2_RANGE;
417 96 : move16();
418 :
419 96 : IF( L_sub( L_core_brate, HQ_16k40 ) == 0 )
420 : {
421 0 : gmax_range_fx[1] = add( gmax_range_fx[1], 2 );
422 0 : move16();
423 : }
424 :
425 : /* decide each group range, for grouping spectral coefficients */
426 96 : grp_rngmax_fx[1] = 16;
427 96 : move16();
428 96 : grp_rngmax_fx[0] = 7;
429 96 : move16();
430 96 : temp_fx = 0;
431 96 : move16();
432 288 : FOR( i = 0; i < 2; i++ )
433 : {
434 192 : j_fx = gmax_range_fx[i];
435 192 : move16();
436 192 : k_fx = 0;
437 192 : move16();
438 192 : test();
439 262 : WHILE( L_sub( L_temp_band_energy[gmax_range_fx[i] - 1], L_temp_band_energy[j_fx] ) >= 0x0L && sub( j_fx, grp_rngmax_fx[i] ) < 0x0 )
440 : {
441 70 : test();
442 70 : k_fx = add( k_fx, 1 );
443 70 : j_fx = add( j_fx, 1 );
444 : }
445 :
446 192 : temp_fx = k_fx;
447 192 : move16();
448 192 : IF( sub( temp_fx, 1 ) > 0 )
449 : {
450 4 : FOR( temp_fx = 2; temp_fx <= k_fx; )
451 : {
452 4 : IF( L_sub( L_temp_band_energy[gmax_range_fx[i] + temp_fx - 1], L_temp_band_energy[gmax_range_fx[i] + temp_fx] ) < 0 )
453 : {
454 2 : BREAK;
455 : }
456 2 : ELSE IF( L_sub( L_temp_band_energy[gmax_range_fx[i] + temp_fx - 1], L_temp_band_energy[gmax_range_fx[i] + temp_fx] ) >= 0 )
457 : {
458 2 : temp_fx = add( temp_fx, 1 );
459 2 : IF( sub( temp_fx, k_fx ) > 0 )
460 : {
461 0 : temp_fx = sub( temp_fx, 1 );
462 0 : BREAK;
463 : }
464 : }
465 : }
466 :
467 2 : gmax_range_fx[i] = add( gmax_range_fx[i], temp_fx );
468 : }
469 : ELSE
470 : {
471 190 : gmax_range_fx[i] = add( gmax_range_fx[i], temp_fx );
472 : }
473 : }
474 :
475 96 : grp_bound_fx[0] = 0;
476 96 : move16();
477 288 : FOR( i = 1; i < GRP_SB - 1; i++ )
478 : {
479 192 : grp_bound_fx[i] = gmax_range_fx[i - 1];
480 192 : move16();
481 : }
482 96 : grp_bound_fx[i] = harmonic_band_fx;
483 96 : move16();
484 96 : grp_bound_fx[i + 1] = N_fx;
485 96 : move16();
486 :
487 :
488 480 : FOR( i = 0; i < GRP_SB; i++ )
489 : {
490 384 : L_Ravg_sub[i] = 0x0L;
491 384 : move32();
492 2496 : FOR( j = grp_bound_fx[i]; j < grp_bound_fx[i + 1]; j++ )
493 : {
494 2112 : IF( L_temp_band_energy[j] > 0x0L )
495 : {
496 2112 : L_Ravg_sub[i] = L_add( L_Ravg_sub[i], L_temp_band_energy[j] );
497 2112 : move32();
498 : }
499 : }
500 : }
501 :
502 96 : L_temp_band_energydiff[0] = L_temp_band_energy[0];
503 96 : move32();
504 1728 : FOR( j = 1; j < harmonic_band_fx; j++ )
505 : {
506 1632 : L_temp_band_energydiff[j] = L_abs( L_sub( L_temp_band_energy[j], L_temp_band_energy[j - 1] ) );
507 1632 : move32();
508 : }
509 :
510 96 : G1_BE_DIFF_POS_fx = 0;
511 96 : move16();
512 96 : L_G1_BE_DIFF_VAL = 0x0L;
513 96 : move32();
514 :
515 1728 : FOR( j = 1; j < harmonic_band_fx; j++ )
516 : {
517 1632 : IF( L_sub( L_temp_band_energydiff[j], L_G1_BE_DIFF_VAL ) > 0 )
518 : {
519 350 : G1_BE_DIFF_POS_fx = j;
520 350 : move16();
521 350 : L_G1_BE_DIFF_VAL = L_temp_band_energydiff[j];
522 350 : move32();
523 : }
524 : }
525 :
526 96 : test();
527 96 : test();
528 96 : IF( sub( G1_BE_DIFF_POS_fx, gmax_range_fx[0] ) < 0 && G1_BE_DIFF_POS_fx > 0 )
529 : {
530 10 : final_gr_fact_pos_fx = 0;
531 10 : move16();
532 : }
533 86 : ELSE IF( sub( G1_BE_DIFF_POS_fx, gmax_range_fx[0] ) >= 0 && sub( G1_BE_DIFF_POS_fx, gmax_range_fx[1] ) < 0 )
534 : {
535 86 : final_gr_fact_pos_fx = 1;
536 86 : move16();
537 : }
538 : ELSE
539 : {
540 0 : final_gr_fact_pos_fx = 2;
541 0 : move16();
542 : }
543 :
544 96 : test();
545 96 : IF( final_gr_fact_pos_fx == 0 || sub( final_gr_fact_pos_fx, 1 ) == 0 )
546 : {
547 96 : IF( L_sub( L_core_brate, HQ_16k40 ) == 0 )
548 : {
549 0 : bits_fact_fx = BITS_FACT_1p10;
550 0 : move16(); /* 1.10f; */ /* G1 */
551 0 : bits_fact1_fx = BITS_FACT_0p92;
552 0 : move16(); /* 0.92f; */ /* G3 */
553 : }
554 : ELSE
555 : {
556 96 : bits_fact_fx = BITS_FACT_1p05;
557 96 : move16(); /* 1.05f; */ /* G1 */
558 96 : bits_fact1_fx = BITS_FACT_0p97;
559 96 : move16(); /* 0.97f; */ /* G3 */
560 : }
561 : }
562 : ELSE
563 : {
564 0 : IF( L_sub( L_core_brate, HQ_16k40 ) == 0 )
565 : {
566 0 : bits_fact_fx = BITS_FACT_0p97;
567 0 : move16(); /* 0.97f; */ /* G1 */
568 0 : bits_fact1_fx = BITS_FACT_1p00;
569 0 : move16(); /* 1.00f; */ /* G3 */
570 : }
571 : ELSE
572 : {
573 0 : bits_fact_fx = BITS_FACT_0p92;
574 0 : move16(); /* 0.92f; */ /* G1 */
575 0 : bits_fact1_fx = BITS_FACT_1p00;
576 0 : move16(); /* 1.00f; */ /* G3 */
577 : }
578 : }
579 :
580 480 : FOR( i = 0; i < sub( N_fx, harmonic_band_fx ); i++ )
581 : {
582 384 : y_index_fx[i] = extract_h( L_shl( L_temp_band_energy[harmonic_band_fx + i], sub( 16, SWB_BWE_LR_Qbe ) ) );
583 384 : move16();
584 384 : index_fx[i] = add( harmonic_band_fx, i );
585 384 : move16();
586 : }
587 :
588 96 : reordvct( y_index_fx, sub( N_fx, harmonic_band_fx ), index_fx );
589 :
590 : /* Log2 */
591 96 : L_temp = L_deposit_l( band_width_fx[index_fx[0]] );
592 96 : exp = norm_l( L_temp );
593 96 : frac = Log2_norm_lc( L_shl( L_temp, exp ) );
594 96 : exp = sub( 30, exp );
595 96 : L_temp = L_Comp( exp, frac );
596 : /* ceil */
597 96 : if ( L_and( 0x0000ffff, L_temp ) > 0 )
598 : {
599 96 : L_temp = L_add( L_temp, 0x00010000 );
600 : }
601 96 : esthf_bits_fx = extract_h( L_temp );
602 :
603 96 : L_grp_thr[0] = L_THR1;
604 96 : move32();
605 96 : L_grp_thr[1] = L_THR2;
606 96 : move32();
607 96 : L_grp_thr[2] = L_THR3;
608 96 : move32();
609 96 : L_grp_thr[3] = L_shl( L_deposit_l( esthf_bits_fx ), SWB_BWE_LR_QRk );
610 96 : move16();
611 :
612 96 : L_norm_sum = 1;
613 96 : move32();
614 384 : FOR( i = 0; i < 3; i++ )
615 : {
616 288 : L_norm_sum = L_add( L_norm_sum, L_Ravg_sub[i] );
617 288 : move32();
618 : }
619 :
620 : /*reserve bits for HF coding */
621 96 : L_temp = L_add( L_norm_sum, L_Ravg_sub[GRP_SB - 1] );
622 96 : exp_normn = norm_l( L_temp );
623 96 : exp_normn = sub( exp_normn, 1 );
624 96 : exp_normd = norm_s( N_fx );
625 :
626 96 : div_fx = div_l( L_shl( L_temp, exp_normn ), shl( N_fx, exp_normd ) ); /* (Qbe+exp_normn)-(0+exp_normd)-1) */
627 96 : L_norm_sum_avg = L_shr( L_deposit_h( div_fx ), add( sub( exp_normn, exp_normd ), 15 ) ); /* -> Qbe */
628 :
629 96 : exp_norm = norm_l( L_norm_sum );
630 96 : norm_sum_fx = extract_h( L_shl( L_norm_sum, exp_norm ) ); /* SWB_BWE_LR_Qbe+exp_norm-16 */
631 96 : Qns = sub( add( SWB_BWE_LR_Qbe, exp_norm ), 16 );
632 :
633 96 : Inv_norm_sum_fx = div_s( 0x4000 /* Q15 */, norm_sum_fx );
634 96 : QIns = sub( 31, exp_norm ); /* 14 - (14+exp_norm-16) + 15 */
635 :
636 96 : grp_bit_avg_fx = div_s_ss( B_fx, GRP_SB ); /* Q0 */
637 :
638 96 : exp_normd = norm_s( p2a_bands_fx );
639 96 : Inv_p2a_bands_fx = div_s( 0x3fff, shl( p2a_bands_fx, exp_normd ) ); /* 14-exp_normd+15 */
640 96 : QIpb = sub( 29, exp_normd );
641 :
642 96 : L_temp = L_shl( Mpy_32_16( L_Ravg_sub[GRP_SB - 1], Inv_p2a_bands_fx ), sub( SWB_BWE_LR_Qbe, sub( QIpb, 1 ) ) );
643 96 : L_norm_diff = L_sub( L_temp, L_norm_sum_avg ); /* Qbe */
644 :
645 96 : L_temp = Mpy_32_16( L_Ravg_sub[GRP_SB - 1], sub( GRP_SB, 1 ) ); /* Qbe+0+1 */
646 96 : L_temp = Mpy_32_16( L_temp, Inv_norm_sum_fx ); /* Qbe+1+QIpb+1 */
647 : #ifdef BASOP_NOGLOB
648 96 : lf_hf_ge_r_fx = round_fx_o( L_shl_o( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ), &Overflow ), &Overflow );
649 96 : Overflow = 0; /* reset BASOP Overflow */
650 : #else
651 : lf_hf_ge_r_fx = round_fx( L_shl( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ) ) );
652 : #endif
653 :
654 96 : exp_normn = norm_s( norm_sum_fx );
655 96 : exp_normn = sub( exp_normn, 1 );
656 96 : exp_normd = norm_s( harmonic_band_fx );
657 :
658 96 : div_fx = div_s( shl( norm_sum_fx, exp_normn ), shl( harmonic_band_fx, exp_normd ) );
659 96 : L_avg_enhf_en_diff = L_sub( L_temp_band_energy[index_fx[0]], L_shl( L_deposit_h( div_fx ), sub( sub( SWB_BWE_LR_Qbe, ( add( Qns, sub( exp_normn, exp_normd ) ) ) ), 31 ) ) ); /* Qbe - (Qns+exp_normn-(exp_normd)+15) -16 */
660 :
661 96 : IF( sub( lf_hf_ge_r_fx, 26214 ) > 0x0 && L_sub( L_avg_enhf_en_diff, (Word32) ( 8 << SWB_BWE_LR_Qbe ) ) > 0x0L ) /* 0.8=26214.4(Q15) 8.0f=131072(Qbe) */
662 : {
663 4 : bits_allocweigh_fx = 6554;
664 4 : move16(); /* 0.2 6553.6(Q15) */
665 4 : IF( L_norm_diff < 0x0L )
666 : {
667 0 : bits_allocweigh_fx = 13107;
668 0 : move16(); /* 0.4 13107.2(Q15) */
669 : }
670 :
671 : /*allocate bits*/
672 : /*Bits_grp[GRP_SB-1] = (int16_t)min((grp_bit_avg/p2a_bands + bits_allocweigh*norm_diff),10);*/
673 4 : L_temp = L_mult( grp_bit_avg_fx, Inv_p2a_bands_fx ); /* Q0+QIpb+1 */
674 4 : L_temp2 = Mpy_32_16( L_norm_diff, bits_allocweigh_fx ); /* Qbe+Q15-15 */
675 :
676 4 : L_temp = L_shr( L_temp, add( QIpb, 1 ) );
677 4 : L_temp = L_add( L_shl( L_temp, SWB_BWE_LR_Qbe ), L_temp2 );
678 :
679 4 : Bits_grp_fx[GRP_SB - 1] = extract_h( L_shl( L_temp, sub( 16, SWB_BWE_LR_Qbe ) ) );
680 4 : Bits_grp_fx[GRP_SB - 1] = s_min( Bits_grp_fx[GRP_SB - 1], 10 );
681 :
682 4 : test();
683 4 : if ( sub( Bits_grp_fx[GRP_SB - 1], esthf_bits_fx ) < 0 )
684 : {
685 4 : Bits_grp_fx[GRP_SB - 1] = 0;
686 4 : move16();
687 : }
688 4 : B_fx = sub( B_fx, Bits_grp_fx[GRP_SB - 1] );
689 : }
690 :
691 96 : exp_shift = sub( add( SWB_BWE_LR_Qbe, QIns ), 47 ); /* (SWB_BWE_LR_Qbe+14+1+QIns-15-16) */
692 96 : exp_norm = norm_s( B_fx );
693 96 : B_norm_fx = shl( B_fx, exp_norm );
694 96 : exp_shift = add( exp_shift, exp_norm );
695 :
696 96 : IF( sub( final_gr_fact_pos_fx, 1 ) == 0 )
697 : {
698 86 : L_temp = Mpy_32_16( L_Ravg_sub[1], extract_h( L_mult( bits_fact_fx, B_norm_fx ) ) );
699 86 : L_temp = Mpy_32_16( L_temp, Inv_norm_sum_fx );
700 86 : Bits_grp_fx[1] = extract_h( L_shr( L_temp, exp_shift ) );
701 :
702 86 : L_temp = Mpy_32_16( L_Ravg_sub[2], extract_h( L_mult( bits_fact1_fx, B_norm_fx ) ) );
703 86 : L_temp = Mpy_32_16( L_temp, Inv_norm_sum_fx );
704 86 : Bits_grp_fx[2] = extract_h( L_shr( L_temp, exp_shift ) );
705 :
706 86 : Bits_grp_fx[0] = sub( sub( B_fx, Bits_grp_fx[1] ), Bits_grp_fx[2] );
707 : }
708 : ELSE
709 : {
710 10 : L_temp = Mpy_32_16( L_Ravg_sub[0], extract_h( L_mult( bits_fact_fx, B_norm_fx ) ) );
711 10 : L_temp = Mpy_32_16( L_temp, Inv_norm_sum_fx );
712 10 : Bits_grp_fx[0] = extract_h( L_shr( L_temp, exp_shift ) );
713 :
714 10 : L_temp = Mpy_32_16( L_Ravg_sub[2], extract_h( L_mult( bits_fact1_fx, B_norm_fx ) ) );
715 10 : L_temp = Mpy_32_16( L_temp, Inv_norm_sum_fx );
716 10 : Bits_grp_fx[2] = extract_h( L_shr( L_temp, exp_shift ) );
717 :
718 10 : Bits_grp_fx[1] = sub( sub( B_fx, Bits_grp_fx[0] ), Bits_grp_fx[2] );
719 : }
720 :
721 96 : IF( sub( Bits_grp_fx[2], THR2 ) < 0 )
722 : {
723 0 : Bits_grp_fx[1] = add( Bits_grp_fx[1], Bits_grp_fx[2] );
724 0 : move16();
725 0 : Bits_grp_fx[2] = 0;
726 0 : move16();
727 : }
728 :
729 480 : FOR( i = 0; i < GRP_SB; i++ )
730 : {
731 384 : IF( Bits_grp_fx[i] > 0 )
732 : {
733 288 : Bits2indvsb_fx( L_temp_band_energy, grp_bound_fx[i], grp_bound_fx[i + 1], Bits_grp_fx[i], L_grp_thr[i], L_Rsubband, p2a_flags_fx );
734 : }
735 : ELSE
736 : {
737 96 : set_val_Word32( L_Rsubband + grp_bound_fx[i], 0x0L, sub( grp_bound_fx[i + 1], grp_bound_fx[i] ) );
738 96 : IF( sub( i, GRP_SB - 1 ) == 0 )
739 : {
740 96 : set_val_Word16( p2a_flags_fx + grp_bound_fx[i], 0, sub( grp_bound_fx[i + 1], grp_bound_fx[i] ) );
741 : }
742 : }
743 : }
744 96 : return;
745 : }
746 :
747 3924 : void hq2_bit_alloc(
748 : const float band_energy[], /* i : band energy of each subband */
749 : const int16_t bands, /* i : total number of subbands in a frame */
750 : Word32 L_Rk[], /* i/o: Bit allocation/Adjusted bit alloc. */
751 : int16_t *bit_budget_fx, /* i/o: bit bugdet */
752 : int16_t *p2a_flags, /* i : HF tonal indicator */
753 : const Word16 weight_fx, /* i : weight (Q13) */
754 : const int16_t band_width[], /* i : Sub band bandwidth */
755 : const int16_t num_bits, /* i : available bits */
756 : const int16_t hqswb_clas, /* i : HQ2 class information */
757 : const int16_t bwidth, /* i : input bandwidth */
758 : const int16_t is_transient /* i : indicator HQ_TRANSIENT or not */
759 : )
760 : {
761 : Word16 j, k;
762 : Word16 tmp;
763 : Word16 bit_budget_norm_fx;
764 :
765 : Word32 L_Rcalc, L_Ravg, L_Rcalc1;
766 :
767 : Word16 exp_normn, exp_normd;
768 :
769 : Word16 Rcnt_fx;
770 :
771 : Word16 div_fx;
772 : Word16 Qdiv;
773 :
774 : Word32 L_tmp;
775 : Word16 tmp_fx;
776 :
777 : Word32 L_maxxy;
778 : Word16 maxdex_fx;
779 : Word32 L_dummy;
780 :
781 : Word16 bit_budget_temp_fx;
782 :
783 : Word16 negflag;
784 :
785 : Word32 L_THR1, L_THR2, L_THR3;
786 :
787 : Word32 L_band_energy[BANDS_MAX];
788 :
789 85674 : for ( k = 0; k < bands; k++ )
790 : {
791 81750 : L_band_energy[k] = (Word32) ( band_energy[k] * (float) pow( 2.0f, SWB_BWE_LR_Qbe ) );
792 : }
793 :
794 3924 : L_THR1 = L_shl( L_deposit_l( THR1 ), SWB_BWE_LR_QRk );
795 3924 : L_THR2 = L_shl( L_deposit_l( THR2 ), SWB_BWE_LR_QRk );
796 3924 : L_THR3 = L_shl( L_deposit_l( THR3 ), SWB_BWE_LR_QRk );
797 :
798 : /* Init Rk to non-zero values for bands to be allocated bits */
799 3924 : IF( sub( num_bits, HQ_16k40_BIT ) <= 0 )
800 : {
801 3924 : set_val_Word32( L_Rk, (Word32) ( C1_QRk ), bands ); /* 1<<SWB_BWE_LR_QRk */
802 :
803 3924 : test();
804 3924 : IF( is_transient && sub( bands, 32 ) == 0 )
805 : {
806 122 : L_Rk[6] = 0x0L;
807 122 : move32();
808 122 : L_Rk[7] = 0x0L;
809 122 : move32();
810 122 : L_Rk[14] = 0x0L;
811 122 : move32();
812 122 : L_Rk[15] = 0x0L;
813 122 : move32();
814 122 : L_Rk[22] = 0x0L;
815 122 : move32();
816 122 : L_Rk[23] = 0x0L;
817 122 : move32();
818 122 : L_Rk[30] = 0x0L;
819 122 : move32();
820 122 : L_Rk[31] = 0x0L;
821 122 : move32();
822 : }
823 : }
824 : ELSE
825 : {
826 : /*mvs2r( p2a_flags, Rk, bands ); */
827 0 : FOR( k = 0; k < bands; k++ )
828 : {
829 0 : L_Rk[k] = L_shl( L_deposit_l( p2a_flags[k] ), SWB_BWE_LR_QRk );
830 : }
831 : }
832 :
833 3924 : L_Rcalc = 0x0L;
834 3924 : move32();
835 3924 : L_Rcalc1 = 0x0L;
836 3924 : move32();
837 :
838 25225 : FOR( j = 0; j < bands; j++ )
839 : {
840 25225 : Rcnt_fx = 0;
841 25225 : move16();
842 25225 : L_Ravg = 0x0L;
843 25225 : move32();
844 :
845 565233 : FOR( k = 0; k < bands; k++ )
846 : {
847 540008 : IF( L_Rk[k] > 0 )
848 : {
849 461893 : L_Ravg = L_add( L_Ravg, L_shl( L_band_energy[k], sub( SWB_BWE_LR_QRk, SWB_BWE_LR_Qbe ) ) ); /* SWB_BWE_LR_QRk-SWB_BWE_LR_Qbe */
850 461893 : Rcnt_fx = add( Rcnt_fx, 1 );
851 : }
852 : }
853 : /* Ravg Qband_energy */
854 :
855 : /*L_Ravg /= Rcnt; */
856 25225 : exp_normd = norm_l( L_Ravg );
857 25225 : exp_normd = sub( exp_normd, 1 );
858 25225 : exp_normn = norm_s( Rcnt_fx );
859 :
860 25225 : tmp = shl( Rcnt_fx, exp_normn );
861 25225 : tmp = s_max( tmp, 1 );
862 25225 : IF( L_Ravg > 0 )
863 : {
864 25129 : div_fx = div_l( L_shl( L_Ravg, exp_normd ), tmp ); /* Qdiv = 14+exp_normd-(exp_normn)-1 */
865 : }
866 : ELSE
867 : {
868 96 : div_fx = div_l( L_shl( L_abs( L_Ravg ), exp_normd ), tmp ); /* Qdiv = 14+exp_normd-(exp_normn)-1 */
869 96 : div_fx = negate( div_fx );
870 : }
871 :
872 : /*Qdiv = QRk+exp_normd-(exp_normn)-1; */
873 25225 : Qdiv = sub( sub( add( SWB_BWE_LR_QRk, exp_normd ), exp_normn ), 1 );
874 :
875 25225 : L_Ravg = L_shr( L_deposit_l( div_fx ), sub( Qdiv, SWB_BWE_LR_QRk ) );
876 :
877 25225 : exp_normd = norm_s( *bit_budget_fx );
878 25225 : exp_normd = sub( exp_normd, 1 );
879 25225 : bit_budget_norm_fx = shl( *bit_budget_fx, exp_normd );
880 25225 : div_fx = 0;
881 25225 : move16();
882 :
883 25225 : test();
884 25225 : IF( bit_budget_norm_fx > 0 && sub( bit_budget_norm_fx, tmp ) < 0 )
885 : {
886 25225 : div_fx = div_s( bit_budget_norm_fx, tmp );
887 : }
888 25225 : Qdiv = add( sub( exp_normd, exp_normn ), 15 );
889 :
890 565233 : FOR( k = 0; k < bands; k++ )
891 : {
892 540008 : IF( L_Rk[k] > 0 )
893 : {
894 : /*Rk[k] = ((float) *bit_budget / Rcnt + weight * (band_energy[k] - Ravg)); */
895 :
896 461893 : L_tmp = Mpy_32_16( L_sub( L_shl( L_band_energy[k], sub( SWB_BWE_LR_QRk, SWB_BWE_LR_Qbe ) ), L_Ravg ), weight_fx ); /* SWB_BWE_LR_QRk + Q13 - 15 */
897 461893 : L_tmp = L_shl( L_tmp, 2 ); /* -> SWB_BWE_LR_QRk */
898 :
899 461893 : L_Rk[k] = L_add( L_shr( L_deposit_l( div_fx ), sub( Qdiv, SWB_BWE_LR_QRk ) ), L_tmp );
900 : }
901 : }
902 :
903 25225 : negflag = 0;
904 25225 : move16();
905 25225 : L_Rcalc = 0;
906 25225 : move32();
907 565233 : FOR( k = 0; k < bands; k++ )
908 : {
909 540008 : IF( L_sub( L_Rk[k], MIN_BITS_FIX ) < 0 )
910 : {
911 2472 : L_Rk[k] = 0x0L;
912 2472 : move32();
913 2472 : negflag = 1;
914 2472 : move16();
915 : }
916 540008 : L_Rcalc = L_add( L_Rcalc, L_Rk[k] ); /*SWB_BWE_LR_QRk */
917 : }
918 :
919 : /* prune noiselike bands with low allocation */
920 25225 : IF( sub( num_bits, HQ_16k40_BIT ) <= 0 && negflag == 0 )
921 : {
922 24319 : L_maxxy = 0;
923 24319 : move32();
924 24319 : maxdex_fx = -1;
925 24319 : move16();
926 24319 : L_Rcalc = 0;
927 24319 : move32();
928 :
929 : /* find worst under-allocation */
930 549597 : FOR( k = sub( bands, 1 ); k >= 0; k-- )
931 : {
932 : /* dummy = ((float) min (band_width[k], max (12, band_width[k] / 4))) - Rk[k]; */
933 525278 : tmp_fx = s_min( band_width[k], s_max( 12, shr( band_width[k], 2 ) ) );
934 525278 : L_dummy = L_sub( L_shl( L_deposit_l( tmp_fx ), SWB_BWE_LR_QRk ), L_Rk[k] ); /*SWB_BWE_LR_QRk */
935 525278 : test();
936 525278 : test();
937 525278 : test();
938 525278 : IF( p2a_flags[k] == 0 && L_sub( L_dummy, L_maxxy ) > 0 && L_Rk[k] > 0 )
939 : {
940 14709 : maxdex_fx = k;
941 14709 : move16();
942 14709 : L_maxxy = L_dummy;
943 14709 : move32(); /*SWB_BWE_LR_QRk */
944 : }
945 : }
946 :
947 : /* prune worst allocation and recalculate total allocation */
948 24319 : IF( sub( maxdex_fx, -1 ) > 0 )
949 : {
950 14415 : L_Rk[maxdex_fx] = 0;
951 14415 : move32();
952 : }
953 549597 : FOR( k = 0; k < bands; k++ )
954 : {
955 525278 : L_Rcalc = L_add( L_Rcalc, L_Rk[k] ); /*SWB_BWE_LR_QRk */
956 : }
957 : }
958 25225 : test();
959 25225 : IF( L_sub( L_Rcalc, L_Rcalc1 ) == 0 && sub( bwidth, SWB ) == 0 )
960 : {
961 : /* Reallocate bits to individual subbands for HQ_NORMAL mode */
962 : /* if bits allocated to subbands areless than predefined threshold */
963 4108 : IF( sub( hqswb_clas, HQ_NORMAL ) == 0 && sub( num_bits, HQ_16k40_BIT ) < 0 )
964 : {
965 3986 : L_dummy = 0x0L;
966 3986 : move32();
967 92042 : FOR( k = 0; k < bands; k++ )
968 : {
969 88056 : test();
970 88056 : test();
971 88056 : test();
972 88056 : test();
973 88056 : test();
974 88056 : IF( sub( k, 11 ) < 0 && L_sub( L_Rk[k], L_THR1 ) < 0 )
975 : {
976 1022 : L_Rk[k] = 0x0L;
977 1022 : move32();
978 : }
979 87034 : ELSE IF( sub( k, 11 ) >= 0 && sub( k, 16 ) < 0 && L_sub( L_Rk[k], L_THR2 ) < 0 )
980 : {
981 980 : L_Rk[k] = 0x0L;
982 980 : move32();
983 : }
984 86054 : ELSE IF( sub( k, 16 ) >= 0 && sub( k, bands ) < 0 && L_sub( L_Rk[k], L_THR3 ) < 0 )
985 : {
986 20495 : L_Rk[k] = 0x0L;
987 20495 : move32();
988 : }
989 :
990 88056 : L_dummy = L_add( L_dummy, L_Rk[k] );
991 : }
992 :
993 3986 : IF( L_sub( L_dummy, L_Rcalc ) == 0 )
994 : {
995 3106 : test();
996 3106 : IF( sub( hqswb_clas, HQ_NORMAL ) == 0 && sub( num_bits, HQ_16k40_BIT ) < 0 )
997 : {
998 3106 : bit_budget_temp_fx = *bit_budget_fx;
999 3106 : move16();
1000 15530 : FOR( k = 0; k < NB_SWB_SUBBANDS; k++ )
1001 : {
1002 12424 : IF( p2a_flags[bands - NB_SWB_SUBBANDS + k] == 1 && L_Rk[bands - NB_SWB_SUBBANDS + k] == 0.0f )
1003 : {
1004 198 : p2a_flags[bands - NB_SWB_SUBBANDS + k] = 0;
1005 198 : move16();
1006 198 : bit_budget_temp_fx = sub( bit_budget_temp_fx, bits_lagIndices_modeNormal[k] );
1007 : }
1008 : }
1009 :
1010 3106 : IF( sub( bit_budget_temp_fx, *bit_budget_fx ) < 0 )
1011 : {
1012 149 : *bit_budget_fx = bit_budget_temp_fx;
1013 149 : move16();
1014 : /* a negative *bit_budget_fx may occur here due to Bit Errors */
1015 : /* handled outside this function to properly set flag: st_fx->BER_detect */
1016 : }
1017 2957 : ELSE IF( sub( bit_budget_temp_fx, *bit_budget_fx ) == 0 )
1018 : {
1019 2957 : BREAK;
1020 : }
1021 : }
1022 : ELSE
1023 : {
1024 : BREAK;
1025 : }
1026 : }
1027 : }
1028 : ELSE
1029 : {
1030 : BREAK;
1031 : }
1032 : }
1033 21117 : ELSE IF( L_sub( L_Rcalc, L_Rcalc1 ) == 0 && sub( bwidth, SWB ) != 0 )
1034 : {
1035 845 : BREAK;
1036 : }
1037 :
1038 21301 : L_Rcalc1 = L_Rcalc;
1039 21301 : move32();
1040 : }
1041 3924 : return;
1042 : }
1043 :
1044 : #undef WMC_TOOL_SKIP
|