diff --git a/lib_com/fill_spectrum.c b/lib_com/fill_spectrum.c index 187ee475dd839985875891788093db43aa86c8a0..7571b03bacef420e60286d56db29685364c559f7 100644 --- a/lib_com/fill_spectrum.c +++ b/lib_com/fill_spectrum.c @@ -352,13 +352,15 @@ void ivas_fill_spectrum_fx( IF( EQ_16( HQ_mode, HQ_HARMONIC ) ) { /*high_sfm = (core_brate == HQ_BWE_CROSSOVER_BRATE) ? HVQ_THRES_SFM_24k-1 : HVQ_THRES_SFM_32k-3; */ - high_sfm = sub( HVQ_THRES_SFM_32k, 1 ); - IF( LT_32( L_core_brate, HQ_BWE_CROSSOVER_BRATE ) ) + high_sfm = HVQ_THRES_SFM_32k - 1; + move16(); + if ( LT_32( L_core_brate, HQ_BWE_CROSSOVER_BRATE ) ) { - high_sfm = sub( HVQ_THRES_SFM_24k, 1 ); + high_sfm = HVQ_THRES_SFM_24k - 1; + move16(); } - IF( LT_16( last_sfm, high_sfm ) ) + if ( LT_16( last_sfm, high_sfm ) ) { last_sfm = high_sfm; move16(); @@ -381,7 +383,7 @@ void ivas_fill_spectrum_fx( test(); test(); IF( EQ_16( length, L_FRAME16k ) || - ( ( EQ_16( length, L_FRAME32k ) && NE_16( HQ_mode, HQ_HARMONIC ) && NE_16( HQ_mode, HQ_HVQ ) ) && EQ_16( *no_att_hangover, 0 ) ) ) + ( ( EQ_16( length, L_FRAME32k ) && NE_16( HQ_mode, HQ_HARMONIC ) && NE_16( HQ_mode, HQ_HVQ ) ) && ( *no_att_hangover == 0 ) ) ) { /* Norm adjustment function */ env_adj_fx( npulses, length, last_sfm, norm_adj, env_stab, sfmsize ); @@ -393,7 +395,7 @@ void ivas_fill_spectrum_fx( test(); test(); test(); - IF( EQ_16( length, L_FRAME32k ) && ( ( LT_16( env_stab, 16384 ) && *no_att_hangover == 0 ) || EQ_16( HQ_mode, HQ_HVQ ) ) ) + if ( EQ_16( length, L_FRAME32k ) && ( ( LT_16( env_stab, 16384 ) && *no_att_hangover == 0 ) || EQ_16( HQ_mode, HQ_HVQ ) ) ) { flag_32K_env_hangover = 1; move16(); @@ -426,7 +428,7 @@ void ivas_fill_spectrum_fx( *----------------------------------------------------------------*/ test(); - IF( NE_16( HQ_mode, HQ_HVQ ) && GT_16( cb_size, 0 ) ) + IF( NE_16( HQ_mode, HQ_HVQ ) && ( cb_size > 0 ) ) { apply_noisefill_HQ_fx( R, length, flag_32K_env_hangover, L_core_brate, last_sfm, CodeBook, CodeBook_mod, cb_size, sfm_start, sfm_end, sfmsize, coeff ); @@ -436,7 +438,7 @@ void ivas_fill_spectrum_fx( * Normal mode BWE *----------------------------------------------------------------*/ - IF( EQ_16( HQ_mode, HQ_NORMAL ) ) + IF( HQ_mode == HQ_NORMAL ) { hq_fold_bwe_fx( last_sfm, sfm_end, num_sfm, coeff ); } @@ -524,6 +526,7 @@ void ivas_fill_spectrum_fx( IF( EQ_16( length, L_FRAME32k ) && LE_32( L_core_brate, HQ_32k ) ) { *prev_R = R[SFM_N_WB - 1]; + move16(); Copy32( L_coeff_out + L_FRAME16k - L_HQ_WB_BWE, prev_coeff_out, L_HQ_WB_BWE ); } @@ -784,6 +787,7 @@ void fill_spectrum_fx( IF( EQ_16( length, L_FRAME32k ) && LE_32( L_core_brate, HQ_32k ) ) { *prev_R = R[SFM_N_WB - 1]; + move16(); Copy32( L_coeff_out + L_FRAME16k - L_HQ_WB_BWE, prev_coeff_out, L_HQ_WB_BWE ); } diff --git a/lib_com/findpulse.c b/lib_com/findpulse.c index be75d3c838bdd5e52095ce7338b3178d2a3a28de..c04b13a4d09fb5871b3fd31b7762fe8507c1edd1 100644 --- a/lib_com/findpulse.c +++ b/lib_com/findpulse.c @@ -185,7 +185,6 @@ Word16 findpulse_fx( /* o : pulse position *------------------------------------------------------------------------*/ ptr = resf + L_frame - 1; - move16(); maxi = 0; move16(); diff --git a/lib_com/fine_gain_bits_fx.c b/lib_com/fine_gain_bits_fx.c index 1ffc695350454076b0d03a3fc118f2f22421aa64..e2f1dd8c7873eab7ff0028401634a48a61f4c03a 100644 --- a/lib_com/fine_gain_bits_fx.c +++ b/lib_com/fine_gain_bits_fx.c @@ -87,7 +87,6 @@ Word16 assign_gain_bits_fx( /* o : Number of assigned } /* Re-adjust bit budget for gain quantization */ - move16(); gain_bits_tot = 0; move16(); *Rcalc = 0; @@ -125,7 +124,7 @@ static void ivas_subband_gain_bits_fx( { /*bps = (short)(Rk[i]*((word16)min(32767, ceil(32767.0f/sfmsize[i]); inexact C-integer division approx. */ bps = extract_l( L_shr( L_mult0( Rk[i], fg_inv_tbl_fx[sfmsize[i] >> 3] ), 18 ) ); /* 3+15 */ - IF( EQ_32( L_shl( L_mult0( sfmsize[i], add( bps, 1 ) ), 3 ), Rk[i] ) ) + if ( EQ_32( L_shl( L_mult0( sfmsize[i], add( bps, 1 ) ), 3 ), Rk[i] ) ) { bps = add( bps, 1 ); } @@ -138,7 +137,7 @@ static void ivas_subband_gain_bits_fx( tot = add( tot, b ); } - IF( EQ_16( tot, 0 ) ) + if ( tot == 0 ) { /* If no gain bits were assigned, use one bit anyway for potential PVQ overage */ bits[0] = 1; @@ -177,7 +176,7 @@ Word16 ivas_assign_gain_bits_fx( /* o : Number of ass move16(); FOR( i = 0; i < BANDS; i++ ) { - IF( GT_16( Rk[i], 0 ) ) + IF( Rk[i] > 0 ) { Rk[i] = sub( Rk[i], shl( gain_bits_array[i], 3 ) ); move16(); diff --git a/lib_com/frame_ener.c b/lib_com/frame_ener.c index 46fcddfb3f15501b967a8f7499f559bcd327f5aa..4fa6e41baeaf2379cb9cb4e46f17597c06150fce 100644 --- a/lib_com/frame_ener.c +++ b/lib_com/frame_ener.c @@ -107,11 +107,12 @@ void fer_energy_fx( IF( EQ_16( clas, VOICED_CLAS ) || EQ_16( clas, ONSET ) || EQ_16( clas, SIN_ONSET ) ) /* Voiced or Onset current frame */ { len = ( pitch ); /* pitch value */ + move16(); pt_synth = synth; - IF( NE_16( offset, 0 ) ) + IF( offset != 0 ) { - pt_synth = synth + L_frame - len; + pt_synth = synth + sub( L_frame, len ); } emaximum_32fx( q_synth, pt_synth, len, enr ); /* pitch synchronous E */ @@ -119,22 +120,25 @@ void fer_energy_fx( ELSE { pt_synth = synth; - IF( NE_16( offset, 0 ) ) + IF( offset != 0 ) { pt_synth = synth + shr( L_frame, 1 ); } W_tmp = 0; - for ( int i = 0; i < shr( L_frame, 1 ); i++ ) + move64(); + FOR( int i = 0; i < L_frame / 2; i++ ) { W_tmp = W_add( W_tmp, W_mult0_32_32( pt_synth[i], pt_synth[i] ) ); // Q = q_synth * 2 } shift = W_norm( W_tmp ); W_tmp = W_shl( W_tmp, shift ); // Q = q_synth * 2 + shift *enr = W_extract_h( W_tmp ); // Q = q_synth * 2 + shift - 32 + move32(); enr_tmp = BASOP_Util_Divide3216_Scale( *enr, shr( L_frame, 1 ) /*Q0*/, &exp ); - *enr = L_shr( L_deposit_l( enr_tmp ), ( shift - 32 - exp - 1 ) ); + *enr = L_shr( L_deposit_l( enr_tmp ), sub( sub( sub( shift, 32 ), exp ), 1 ) ); + move32(); } return; } @@ -291,8 +295,10 @@ Word16 frame_ener_fx( IF( EQ_16( L_frame, 320 ) ) { *enr_q = Mult_32_16( *enr_q, 26214 ); /*x 0.8 to get /160*/ + move32(); i = norm_l( *enr_q ); *enr_q = L_shl( *enr_q, i ); + move32(); exp_enrq = add( i, exp_enrq ); } } @@ -301,6 +307,7 @@ Word16 frame_ener_fx( exp_enrq = sub( exp_enrq, add( Q_new, Q_new ) ); enr_q_tmp /*Q30 exp2+exp_enrq*/ = BASOP_Util_Divide3216_Scale( *enr_q /*Q31*/, L_frame2 /*Q0*/, &exp2 ); *enr_q = L_shr( L_deposit_l( enr_q_tmp ), sub( 30, add( exp2, exp_enrq ) ) ); /*Q0*/ + move32(); *enr_q = L_add( *enr_q, 1 ); move32(); exp_enrq = 0; @@ -331,6 +338,7 @@ Word16 frame_energy_fx( /* o : Frame energy in Q8 Word16 len, enern; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; + move32(); #endif diff --git a/lib_com/get_gain.c b/lib_com/get_gain.c index e6288ad015196dde23606256b8d0bb4c91fc02b7..43d39ae318a9b1a0b31b35d0507412cfecb45767 100644 --- a/lib_com/get_gain.c +++ b/lib_com/get_gain.c @@ -87,6 +87,7 @@ Word32 get_gain( /* output: codebook gain (adaptive or fixed) Word16 exp_c, exp_e, exp, tmp; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; + move32(); #endif @@ -122,6 +123,7 @@ Word32 get_gain2( /* output: codebook gain (adaptive or fixed) Word16 m_corr, m_ener, negative, Q_corr, Q_ener; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; + move32(); #endif negative = 0; diff --git a/lib_com/hp50.c b/lib_com/hp50.c index 0e99e3203004354378827d0150da1e98e39fcdd2..288d690e3394ab87fb8a7e7b846e3af00f88c976 100644 --- a/lib_com/hp50.c +++ b/lib_com/hp50.c @@ -438,7 +438,7 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * } -#ifdef IVAS_FLOAT_FIXED +#if 0 void hp20_fix32( Word32 signal_fx[], const Word16 lg, @@ -590,3 +590,192 @@ void hp20_fix32( return; } #endif + +#ifdef IVAS_FLOAT_FIXED +void hp20_fix32( + Word32 signal_fx[], + const Word16 lg, + Word32 mem_fx[], + const Word32 Fs ) +{ + Word16 i; + Word32 a1_fx, a2_fx, b1_fx, b2_fx; + Word16 Qx0, Qx1, Qx2, Qy1, Qprev_y1, Qy2, Qprev_y2, Qmin; + Word64 x0_fx64, x1_fx64, x2_fx64, y0_fx64, y1_fx64, y2_fx64, R1, R2, R3, R4, R5; + + IF( EQ_32( Fs, 8000 ) ) + { + /* hp filter 20Hz at 3dB for 8000KHz input sampling rate + [b,a] = butter(2, 20.0/4000.0, 'high'); + b = [0.988954248067140 -1.977908496134280 0.988954248067140] + a =[1.000000000000000 -1.977786483776764 0.978030508491796]*/ + a1_fx = 1061816033l /* 1.977786483776764 Q29*/; + a2_fx = -525076131l /*-0.978030508491796 Q29*/; + b1_fx = -1061881538l /*-1.977908496134280 Q29*/; + b2_fx = 530940769l /* 0.988954248067140 Q29*/; + } + ELSE IF( EQ_32( Fs, 16000 ) ) + { + /* hp filter 20Hz at 3dB for 16000KHz sampling rate + [b,a] = butter(2, 20.0/8000.0, 'high'); + b =[ 0.994461788958195 -1.988923577916390 0.994461788958195] + a =[1.000000000000000 -1.988892905899653 0.988954249933127] */ + a1_fx = 1067778748l /* 1.988892905899653 Q29*/; + a2_fx = -530940770l /*-0.988954249933127 Q29*/; + b1_fx = -1067795215l /*-1.988923577916390 Q29*/; + b2_fx = 533897608l /* 0.994461788958195 Q29*/; + } + ELSE IF( EQ_32( Fs, 32000 ) ) + { + /* hp filter 20Hz at 3dB for 32000KHz sampling rate + [b,a] = butter(2, 20.0/16000.0, 'high'); + b =[0.997227049904470 -1.994454099808940 0.997227049904470] + a =[1.000000000000000 -1.994446410541927 0.994461789075954]*/ + a1_fx = 1070760263l /* 1.994446410541927 Q29*/; + a2_fx = -533897608l /*-0.994461789075954 Q29*/; + b1_fx = -1070764392l /*-1.994454099808940 Q29*/; + b2_fx = 535382196l /* 0.997227049904470 Q29*/; + } + ELSE + { + /* hp filter 20Hz at 3dB for 48000KHz sampling rate + [b,a] = butter(2, 20.0/24000.0, 'high'); + b =[ 0.998150511190452 -1.996301022380904 0.998150511190452] + a =[1.000000000000000 -1.996297601769122 0.996304442992686]*/ + a1_fx = 1071754114l /* 1.996297601769122 Q29*/; + a2_fx = -534886875l /*-0.996304442992686 Q29*/; + b1_fx = -1071755951l /*-1.996301022380904 Q29*/; + b2_fx = 535877975l /* 0.998150511190452 Q29*/; + } + move32(); + move32(); + move32(); + move32(); + + Qprev_y1 = extract_l( mem_fx[4] ); + Qprev_y2 = extract_l( mem_fx[5] ); + y1_fx64 = (Word64) mem_fx[0]; + y2_fx64 = (Word64) mem_fx[1]; + x0_fx64 = (Word64) mem_fx[2]; + x1_fx64 = (Word64) mem_fx[3]; + move64(); + move64(); + move64(); + move64(); + + FOR( i = 0; i < lg; i++ ) + { + x2_fx64 = x1_fx64; + x1_fx64 = x0_fx64; + x0_fx64 = (Word64) signal_fx[i]; + move64(); + move64(); + move64(); + + Qy1 = W_norm( y1_fx64 ); + if ( y1_fx64 == 0 ) + { + Qy1 = 62; + move16(); + } + Qy1 = sub( Qy1, 34 ); + R1 = W_mult0_32_32( W_extract_l( W_shl( y1_fx64, Qy1 ) ), a1_fx ); + Qy1 = add( Qy1, Qprev_y1 ); + + Qy2 = W_norm( y2_fx64 ); + if ( y2_fx64 == 0 ) + { + Qy2 = 62; + move16(); + } + Qy2 = sub( Qy2, 34 ); + R2 = W_mult0_32_32( W_extract_l( W_shl( y2_fx64, Qy2 ) ), a2_fx ); + Qy2 = add( Qy2, Qprev_y2 ); + + Qx0 = W_norm( x0_fx64 ); + if ( x0_fx64 == 0 ) + { + Qx0 = 62; + move16(); + } + Qx0 = sub( Qx0, 34 ); + R3 = W_mult0_32_32( W_extract_l( W_shl( x0_fx64, Qx0 ) ), b2_fx ); + + Qx1 = W_norm( x1_fx64 ); + if ( x1_fx64 == 0 ) + { + Qx1 = 62; + move16(); + } + Qx1 = sub( Qx1, 34 ); + R4 = W_mult0_32_32( W_extract_l( W_shl( x1_fx64, Qx1 ) ), b1_fx ); + + Qx2 = W_norm( x2_fx64 ); + if ( x2_fx64 == 0 ) + { + Qx2 = 62; + move16(); + } + Qx2 = sub( Qx2, 34 ); + R5 = W_mult0_32_32( W_extract_l( W_shl( x2_fx64, Qx2 ) ), b2_fx ); + + Qmin = s_min( Qy1, Qy2 ); + + y0_fx64 = W_add( W_shr( R1, sub( Qy1, Qmin ) ), W_shr( R2, sub( Qy2, Qmin ) ) ); + + Qmin = s_min( Qmin, Qx0 ); + Qmin = s_min( Qmin, Qx1 ); + Qmin = s_min( Qmin, Qx2 ); + + y0_fx64 = W_add( W_shr( y0_fx64, sub( s_min( Qy1, Qy2 ), Qmin ) ), W_add( W_shr( R3, sub( Qx0, Qmin ) ), W_add( W_shr( R4, sub( Qx1, Qmin ) ), W_shr( R5, sub( Qx2, Qmin ) ) ) ) ); + + y0_fx64 = W_shr( y0_fx64, 29 ); + + signal_fx[i] = W_extract_l( W_shr( y0_fx64, Qmin ) ); + IF( signal_fx[i] < 0 ) + { + signal_fx[i] = L_add( signal_fx[i], 1 ); + } + + y2_fx64 = y1_fx64; + y1_fx64 = y0_fx64; + Qprev_y2 = Qprev_y1; + Qprev_y1 = Qmin; + move64(); + move64(); + move16(); + move16(); + } + + Qy1 = W_norm( y1_fx64 ); + test(); + IF( y1_fx64 != 0 && LT_16( Qy1, 32 ) ) + { + y1_fx64 = W_shr( y1_fx64, sub( 32, Qy1 ) ); + Qprev_y1 = sub( Qprev_y1, sub( 32, Qy1 ) ); + } + + Qy2 = W_norm( y2_fx64 ); + test(); + IF( y2_fx64 != 0 && LT_16( Qy2, 32 ) ) + { + y2_fx64 = W_shr( y2_fx64, sub( 32, Qy2 ) ); + Qprev_y2 = sub( Qprev_y2, sub( 32, Qy2 ) ); + } + + mem_fx[0] = W_extract_l( y1_fx64 ); + mem_fx[1] = W_extract_l( y2_fx64 ); + mem_fx[2] = W_extract_l( x0_fx64 ); + mem_fx[3] = W_extract_l( x1_fx64 ); + mem_fx[4] = Qprev_y1; + mem_fx[5] = Qprev_y2; + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + + return; +} +#endif diff --git a/lib_com/hq2_core_com_fx.c b/lib_com/hq2_core_com_fx.c index c649e8d178602f3dd18f53614caa2f038e66319e..b00a25aaa6eb4fc79dfc088dfddec8cbc90ad168 100644 --- a/lib_com/hq2_core_com_fx.c +++ b/lib_com/hq2_core_com_fx.c @@ -91,9 +91,11 @@ void mdct_spectrum_denorm_fx( #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; + move16(); /* allow overflow happen. */ #endif exp_safe = 4; /* safe bit for overflow */ + move16(); FOR( k = 0; k < bands; k++ ) { @@ -407,7 +409,9 @@ IF( is_transient ) bands_sh = *bands; move16(); *bands = shl( bands_sh, 2 ); + move16(); *length = shl( *length, 2 ); + move16(); FOR( i = 1; i <= 3; i++ ) { @@ -523,6 +527,7 @@ void spt_shorten_domain_pre_fx( } kpos = 0; + move16(); j = 0; move16(); FOR( k = sub( BANDS, SPT_SHORTEN_SBNUM ); k < BANDS; k++ ) @@ -702,9 +707,13 @@ void bit_allocation_second_fx( const Word16 input_frame ) { Word16 k, k2 = 0; + move16(); Word16 ever_bits[BANDS_MAX], ever_sort[BANDS_MAX]; /*Q12 */ Word16 class_flag = 0; + move16(); Word16 rk_temp = 32767, ever_temp = 32767; /*Q12 */ + move16(); + move16(); Word16 exp; Word16 tmp; Word32 L_tmp; diff --git a/lib_com/hq2_noise_inject_fx.c b/lib_com/hq2_noise_inject_fx.c index 9f787fde5ed12ff334ef671262fdd086298475cb..c47bb5cfdc986221e43db90caf26669764cdef6c 100644 --- a/lib_com/hq2_noise_inject_fx.c +++ b/lib_com/hq2_noise_inject_fx.c @@ -82,6 +82,7 @@ void hq2_noise_inject_fx( Word16 sb = bands; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; + move16(); #endif satur = 0; @@ -194,6 +195,7 @@ void hq2_noise_inject_fx( } max_pos_pulse = k; + move16(); L_tmp2 = Ep_fx[k]; move32(); L_tmp = L_max( 1, L_tmp2 ); diff --git a/lib_com/hq_bit_allocation_fx.c b/lib_com/hq_bit_allocation_fx.c index 2b798c962f5f403bb6f824419fcc4ff676e2f854..8b476fb073f840ab6e851c7c741e775bfbc72c1b 100644 --- a/lib_com/hq_bit_allocation_fx.c +++ b/lib_com/hq_bit_allocation_fx.c @@ -61,6 +61,7 @@ void ivas_hq_bit_allocation_fx( { /* 'nf_idx' 2-bits index written later */ *num_bits = sub( *num_bits, 2 ); + move16(); } test(); @@ -74,10 +75,12 @@ void ivas_hq_bit_allocation_fx( { *num_bits = sub( *num_bits, HQ_GENERIC_SWB_NBITS ); } + move16(); IF( EQ_16( length, L_SPEC48k ) ) { *num_bits = sub( *num_bits, HQ_GENERIC_FB_NBITS ); + move16(); } } @@ -103,6 +106,7 @@ void ivas_hq_bit_allocation_fx( { /* classification and limit bandwidth for bit allocation */ sfm_limit = sub( sfm_limit, 2 ); + move16(); limit_band_noise_level_calc_fx( wnorm, &sfm_limit, core_brate, noise_level ); /* Detect important band in high frequency region */ @@ -150,6 +154,7 @@ void ivas_hq_bit_allocation_fx( ELSE IF( EQ_16( hqswb_clas, HQ_GEN_SWB ) || ( EQ_16( hqswb_clas, HQ_TRANSIENT ) && EQ_16( length, L_FRAME32k ) && LE_32( core_brate, HQ_32k ) ) ) { *sum = BitAllocF_fx( wnorm, core_brate, *num_bits, nb_sfm, R, Rsubband, hqswb_clas, num_env_bands ); + move16(); } ELSE IF( EQ_16( length, L_FRAME16k ) && LE_32( core_brate, HQ_32k ) ) { @@ -172,6 +177,7 @@ void ivas_hq_bit_allocation_fx( /* Estimate number of bits per band */ *sum = BitAllocWB_fx( wnorm, *num_bits, nb_sfm, R, Rsubband ); + move16(); } ELSE { @@ -201,22 +207,27 @@ ELSE /* Find last coded core band */ *core_sfm = sub( nb_sfm, 1 ); +move16(); test(); test(); IF( hqswb_clas == HQ_NORMAL || EQ_16( hqswb_clas, HQ_HARMONIC ) ) { *core_sfm = find_last_band_fx( R, nb_sfm ); + move16(); } ELSE IF( EQ_16( hqswb_clas, HQ_GEN_SWB ) || EQ_16( hqswb_clas, HQ_GEN_FB ) ) { *core_sfm = find_last_band_fx( R, nb_sfm ); + move16(); IF( LT_16( *core_sfm, num_env_bands ) ) { *core_sfm = sub( num_env_bands, 1 ); + move16(); } } *num_bits = sub( *num_bits, *sum ); +move16(); return; } @@ -352,6 +363,7 @@ void hq_bit_allocation_fx( ELSE IF( EQ_16( hqswb_clas, HQ_GEN_SWB ) || ( EQ_16( hqswb_clas, HQ_TRANSIENT ) && EQ_16( length, L_FRAME32k ) && LE_32( core_brate, HQ_32k ) ) ) { *sum = BitAllocF_fx( wnorm, core_brate, *num_bits, nb_sfm, R, Rsubband, hqswb_clas, num_env_bands ); + move16(); } ELSE IF( EQ_16( length, L_FRAME16k ) && EQ_32( core_brate, HQ_32k ) ) { @@ -376,6 +388,7 @@ void hq_bit_allocation_fx( /* Estimate number of bits per band */ *sum = BitAllocWB_fx( wnorm, *num_bits, nb_sfm, R, Rsubband ); + move16(); } ELSE { @@ -405,22 +418,27 @@ void hq_bit_allocation_fx( /* Find last coded core band */ *core_sfm = sub( nb_sfm, 1 ); + move16(); test(); test(); IF( hqswb_clas == HQ_NORMAL || EQ_16( hqswb_clas, HQ_HARMONIC ) ) { *core_sfm = find_last_band_fx( R, nb_sfm ); + move16(); } ELSE IF( EQ_16( hqswb_clas, HQ_GEN_SWB ) || EQ_16( hqswb_clas, HQ_GEN_FB ) ) { *core_sfm = find_last_band_fx( R, nb_sfm ); + move16(); IF( LT_16( *core_sfm, num_env_bands ) ) { *core_sfm = sub( num_env_bands, 1 ); + move16(); } } *num_bits = sub( *num_bits, *sum ); + move16(); return; } diff --git a/lib_com/hq_conf.c b/lib_com/hq_conf.c index c027eb7002df9fbfae10c0a9fe71ca6d7bf1edfb..4dfe55d80573342be9894ee43f2fd5df814cb953 100644 --- a/lib_com/hq_conf.c +++ b/lib_com/hq_conf.c @@ -277,6 +277,7 @@ void hq_configure_fx( Word16 i, bw_ext; bw_ext = 0; + move16(); *start_norm = 0; move16(); @@ -521,10 +522,13 @@ void hq_configure_fx( { /*sfmsize[i] = (int16_t)(1.25f * p_sfmsize[i]);*/ sfmsize[i] = mult_r( shl( p_sfmsize[i], 1 ), 20480 ); + move16(); /*sfm_start[i] = (int16_t)(1.25f * p_sfm_start[i]);*/ sfm_start[i] = mult_r( shl( p_sfm_start[i], 1 ), 20480 ); + move16(); /*sfm_end[i] = (int16_t)(1.25f * p_sfm_end[i]);*/ sfm_end[i] = mult_r( shl( p_sfm_end[i], 1 ), 20480 ); + move16(); } *nb_sfm = *num_sfm; *num_env_bands = *num_sfm; @@ -539,6 +543,7 @@ void hq_configure_fx( } *numnrmibits = extract_l( L_mult0( sub( *num_env_bands, 1 ), NORMI_BITS ) ); + move16(); return; } diff --git a/lib_com/hq_conf_fx.c b/lib_com/hq_conf_fx.c index 4596658823c518a01393528729868399db802fdb..bed185ae137f3046b79091592a31002331cfcd0f 100644 --- a/lib_com/hq_conf_fx.c +++ b/lib_com/hq_conf_fx.c @@ -285,10 +285,13 @@ void ivas_hq_configure_fx( { /*sfmsize[i] = (int16_t)(1.25f * p_sfmsize[i]);*/ sfmsize[i] = mult_r( shl( p_sfmsize[i], 1 ), 20480 ); + move16(); /*sfm_start[i] = (int16_t)(1.25f * p_sfm_start[i]);*/ sfm_start[i] = mult_r( shl( p_sfm_start[i], 1 ), 20480 ); + move16(); /*sfm_end[i] = (int16_t)(1.25f * p_sfm_end[i]);*/ sfm_end[i] = mult_r( shl( p_sfm_end[i], 1 ), 20480 ); + move16(); } *nb_sfm = *num_sfm; *num_env_bands = *num_sfm; @@ -303,6 +306,7 @@ void ivas_hq_configure_fx( } *numnrmibits = extract_l( L_mult0( sub( *num_env_bands, 1 ), NORMI_BITS ) ); + move16(); return; } @@ -577,10 +581,13 @@ void hq_configure_evs_fx( { /*sfmsize[i] = (int16_t)(1.25f * p_sfmsize[i]);*/ sfmsize[i] = mult_r( shl( p_sfmsize[i], 1 ), 20480 ); + move16(); /*sfm_start[i] = (int16_t)(1.25f * p_sfm_start[i]);*/ sfm_start[i] = mult_r( shl( p_sfm_start[i], 1 ), 20480 ); + move16(); /*sfm_end[i] = (int16_t)(1.25f * p_sfm_end[i]);*/ sfm_end[i] = mult_r( shl( p_sfm_end[i], 1 ), 20480 ); + move16(); } *nb_sfm = *num_sfm; *num_env_bands = *num_sfm; @@ -595,6 +602,7 @@ void hq_configure_evs_fx( } *numnrmibits = extract_l( L_mult0( sub( *num_env_bands, 1 ), NORMI_BITS ) ); + move16(); return; } diff --git a/lib_com/hq_tools_fx.c b/lib_com/hq_tools_fx.c index 7e6ab6dfb47e79fb33189c21a87b11dfd4a27b01..ae3468c9ae1f3d10c65be8a422e96b96a90629c4 100644 --- a/lib_com/hq_tools_fx.c +++ b/lib_com/hq_tools_fx.c @@ -125,6 +125,7 @@ void hq_swb_harmonic_calc_norm_envelop_fx( /* Apply MA filter */ L_envelope[env_index] = L_deposit_l( EPSILLON_FX ); + move32(); FOR( n_lag = 0; n_lag < n_lag_now; n_lag++ ) { L_tmp = L_abs( L_SWB_signal[add( n_freq, n_lag )] ); @@ -469,6 +470,7 @@ void apply_noisefill_HQ_fx( { /*coeff[j] = cb_buff[j - istart] * E_corr; */ coeff[j] = extract_h( L_shl( L_mult( cb_buff[j - istart], E_corr ), 2 ) ); /*Q12 (12+13+1+2-16) */ + move16(); } } ELSE @@ -542,6 +544,7 @@ void harm_bwe_fine_fx( FOR( i = sfm_start[sfm]; i < sfm_end[sfm]; i++ ) { coeff_out[i] = L_deposit_l( 0 ); + move16(); } } } @@ -765,6 +768,7 @@ void hq_fold_bwe_fx( src = coeff + sfm_end[last_sfm] - 1; first_coeff = sfm_end[last_sfm]; + move16(); dst = coeff + sfm_end[last_sfm]; end = coeff + sfm_end[num_sfm - 1]; @@ -851,6 +855,7 @@ void ivas_harm_bwe_fx( Word32 normq, L_tmp, L_tmp2; Word32 E_L; Word16 alfa = 16384; + move16(); Word16 tmp, tmp1, exp1; Word16 beta; Word32 *src, *dst; @@ -1035,6 +1040,7 @@ void harm_bwe_fx( Word32 normq, L_tmp, L_tmp2; Word32 E_L; Word16 alfa = 16384; + move16(); Word16 tmp, tmp1, exp1; Word16 beta; Word32 *src, *dst; @@ -1061,9 +1067,11 @@ void harm_bwe_fx( /* shaping the BWE spectrum further by envelopes and noise factors */ L_tmp = L_mult( 29491, prev_noise_level[0] ); /* 15 +1 +15 */ noise_level[0] = round_fx( L_mac( L_tmp, 3277, noise_level[0] ) ); /*15 */ + move16(); L_tmp = L_mult( 29491, prev_noise_level[1] ); noise_level[1] = round_fx( L_mac( L_tmp, 3277, noise_level[1] ) ); + move16(); test(); IF( prev_hq_mode == HQ_NORMAL || EQ_16( prev_hq_mode, HQ_GEN_SWB ) ) @@ -1221,7 +1229,9 @@ void hvq_bwe_fx( Word32 L_normq; Word32 L_E; Word32 L_tmp_norm = 0; + move32(); Word16 bwe_noise_th = 0; + move16(); Word16 peak_band, low, high, sel_norm; Word16 norm_ind; Word32 *L_src, *L_dst; @@ -1248,6 +1258,8 @@ void hvq_bwe_fx( /* shaping the BWE spectrum further by envelopes and noise factors */ noise_level[0] = round_fx( L_mac( L_mult( 29491, prev_noise_level[0] ), 3277, noise_level[0] ) ); /* Q15 (15+15+1-16) */ noise_level[1] = round_fx( L_mac( L_mult( 29491, prev_noise_level[1] ), 3277, noise_level[1] ) ); /* Q15 (15+15+1-16) */ + move16(); + move16(); test(); IF( prev_hq_mode == HQ_NORMAL || EQ_16( prev_hq_mode, HQ_GEN_SWB ) ) @@ -2116,7 +2128,9 @@ void hq_wb_nf_bwe_fx( } /* calculate the peak-average ratio of saturable subbands */ num = 0; + move16(); sharp_fx = 0; + move16(); FOR( sfm = last_sfm; sfm >= 8; sfm-- ) { tmp = shl( sfmsize[sfm], 9 ); /*Q9 */ @@ -2491,6 +2505,7 @@ void hq_wb_nf_bwe_fx( Copy32( L_normq_v, prev_normq_fx, SFM_N_WB ); Copy32( L_coeff_out + L_FRAME16k - L_HQ_WB_BWE, prev_coeff_out_fx, L_HQ_WB_BWE ); *prev_R = R[SFM_N_WB - 1]; + move16(); return; } @@ -2520,6 +2535,7 @@ void enforce_zero_for_min_envelope_fx( FOR( j = sfm_start[0]; j < sfm_end[0]; j++ ) { L_coefsq[j] = L_deposit_l( 0 ); + move32(); } } @@ -2530,6 +2546,7 @@ void enforce_zero_for_min_envelope_fx( FOR( j = sfm_start[i]; j < sfm_end[i]; j++ ) { L_coefsq[j] = L_deposit_l( 0 ); + move32(); } } } diff --git a/lib_com/hvq_pvq_bitalloc_fx.c b/lib_com/hvq_pvq_bitalloc_fx.c index 43e014ce916d44c3dcc6c761383e3205cf6ee7e9..487aaf2ea8f2448aba21fca1e06946d0747fda3d 100644 --- a/lib_com/hvq_pvq_bitalloc_fx.c +++ b/lib_com/hvq_pvq_bitalloc_fx.c @@ -50,6 +50,7 @@ Word16 hvq_pvq_bitalloc_fx( { num_sfm = SFM_N_HARM; } + move16(); IF( LT_32( core_brate, HQ_BWE_CROSSOVER_BRATE ) ) { @@ -159,6 +160,7 @@ Word16 hvq_pvq_bitalloc_fx( IF( EQ_16( band_len_harm[k_max], 96 ) ) { n = 61; + move16(); } ELSE { @@ -172,6 +174,7 @@ Word16 hvq_pvq_bitalloc_fx( sel_bands[*n_sel_bands] = k_max; move16(); *n_sel_bands = add( *n_sel_bands, 1 ); + move16(); R[k_max] = 1; /* Mark that the band has been encoded for fill_spectrum */ move16(); } diff --git a/lib_com/ifft_rel.c b/lib_com/ifft_rel.c index ff67fd3e4e414db73a17c84e42eb00750320f81e..c1e8687164023acb56bfb7058aa975788b939c0b 100644 --- a/lib_com/ifft_rel.c +++ b/lib_com/ifft_rel.c @@ -309,6 +309,7 @@ void ifft_rel_fx( Word16 tmp; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; + move16(); #endif @@ -1034,6 +1035,7 @@ void ifft_rel_fx32( const Word16 *idx; Word32 temp[512]; Word16 n_inv = 128; + move16(); SWITCH( n ) { @@ -1050,6 +1052,7 @@ void ifft_rel_fx32( assert( 0 ); BREAK; } + move16(); /*-----------------------------------------------------------------* * IFFT @@ -1060,11 +1063,13 @@ void ifft_rel_fx32( FOR( k = 1; k < m; k++ ) { is = 0; + move16(); id = n2; + move16(); n2 = shr( n2, 1 ); n4 = shr( n2, 2 ); n8 = shr( n4, 1 ); - WHILE( LT_16( is, n - 1 ) ) + WHILE( LT_16( is, sub( n, 1 ) ) ) { xi1 = x + is + 1; xi2 = xi1 + n4; @@ -1075,32 +1080,42 @@ void ifft_rel_fx32( { t1 = L_sub( *xi1, *xi3 ); *xi1 = L_add( *xi1, *xi3 ); + move32(); *xi2 = L_shl( *xi2, 1 ); + move32(); *xi3 = L_sub( t1, L_shl( *xi4, 1 ) ); + move32(); *xi4 = L_add( t1, L_shl( *xi4, 1 ) ); - IF( n4 != 1 ) + move32(); + IF( NE_16( n4, 1 ) ) { t1 = Mpy_32_16_1( L_sub( *( xi2 + n8 ), *( xi1 + n8 ) ), INV_SQRT_2_16 ); t2 = Mpy_32_16_1( L_add( *( xi4 + n8 ), *( xi3 + n8 ) ), INV_SQRT_2_16 ); *( xi1 + n8 ) = L_add( *( xi1 + n8 ), *( xi2 + n8 ) ); + move32(); *( xi2 + n8 ) = L_sub( *( xi4 + n8 ), *( xi3 + n8 ) ); + move32(); *( xi3 + n8 ) = L_shl( L_negate( L_add( t2, t1 ) ), 1 ); + move32(); *( xi4 + n8 ) = L_shl( L_sub( t1, t2 ), 1 ); + move32(); } xi1 += id; xi2 += id; xi3 += id; xi4 += id; } - is = 2 * id - n2; - id = 4 * id; + is = sub( shl( id, 1 ), n2 ); + id = shl( id, 2 ); } + /*Can be acheived with a shr */ step = N_MAX_FFT / n2; + move16(); s = sincos_t_ext_fx + step; c = s + N_MAX_FFT / 4; - s3 = sincos_t_ext_fx + 3 * step; + s3 = sincos_t_ext_fx + imult1616( 3, step ); c3 = s3 + N_MAX_FFT / 4; FOR( j = 2; j <= n8; j++ ) { @@ -1110,51 +1125,61 @@ void ifft_rel_fx32( ss3 = *s3; is = 0; - id = 2 * n2; + move16(); + id = shl( n2, 1 ); + move16(); c += step; s += step; - c3 += 3 * step; - s3 += 3 * step; - WHILE( LT_16( is, n - 1 ) ) + c3 += imult1616( 3, step ); + s3 += imult1616( 3, step ); + WHILE( LT_16( is, sub( n, 1 ) ) ) { - xup1 = x + j + is; - xup3 = xup1 + 2 * n4; - xdn6 = xup3 - 2 * j + 2; - xdn8 = xdn6 + 2 * n4; + xup1 = x + add( j, is ); + xup3 = xup1 + shl( n4, 1 ); + xdn6 = xup3 - sub( shl( j, 1 ), 2 ); + xdn8 = xdn6 + shl( n4, 1 ); FOR( i = is; i < n; i += id ) { t1 = L_sub( *xup1, *xdn6 ); *xup1 = L_add( *xup1, *xdn6 ); + move32(); xup1 += n4; xdn6 -= n4; t2 = L_sub( *xdn6, *xup1 ); *xdn6 = L_add( *xup1, *xdn6 ); + move32(); xdn6 += n4; t3 = L_add( *xdn8, *xup3 ); *xdn6 = L_sub( *xdn8, *xup3 ); + move32(); xup3 += n4; xdn8 -= n4; t4 = L_add( *xup3, *xdn8 ); *xup1 = L_sub( *xup3, *xdn8 ); + move32(); t5 = L_sub( t1, t4 ); t1 = L_add( t1, t4 ); t4 = L_sub( t2, t3 ); t2 = L_add( t2, t3 ); *xup3 = L_sub( Mpy_32_16_1( t1, cc3 ), Mpy_32_16_1( t2, ss3 ) ); + move32(); xup3 -= n4; *xup3 = L_add( Mpy_32_16_1( t5, cc1 ), Mpy_32_16_1( t4, ss1 ) ); + move32(); *xdn8 = L_sub( Mpy_32_16_1( t5, ss1 ), Mpy_32_16_1( t4, cc1 ) ); + move32(); xdn8 += n4; *xdn8 = L_add( Mpy_32_16_1( t2, cc3 ), Mpy_32_16_1( t1, ss3 ) ); + move32(); xup1 -= n4; xup1 += id; @@ -1162,7 +1187,7 @@ void ifft_rel_fx32( xdn6 += id; xdn8 += id; } - is = shl( id, 1 ) - n2; + is = sub( shl( id, 1 ), n2 ); id = shl( id, 2 ); } } @@ -1173,7 +1198,9 @@ void ifft_rel_fx32( *-----------------------------------------------------------------*/ is = 1; + move16(); id = 4; + move16(); WHILE( LT_16( is, n ) ) { xi0 = x + is; @@ -1182,12 +1209,15 @@ void ifft_rel_fx32( FOR( i0 = is; i0 <= n; i0 += id ) { r1 = *xi0; + move32(); *xi0 = L_add( r1, *xi1 ); + move32(); *xi1 = L_sub( r1, *xi1 ); + move32(); xi0 += id; xi1 += id; } - is = shl( id, 1 ) - 1; + is = sub( shl( id, 1 ), 1 ); id = shl( id, 2 ); } @@ -1203,6 +1233,7 @@ void ifft_rel_fx32( { j = *idx++; temp[i] = x[1 + shr( j, 1 )]; + move32(); } } ELSE IF( EQ_16( n, 256 ) ) @@ -1211,6 +1242,7 @@ void ifft_rel_fx32( { j = *idx++; temp[i] = x[1 + j]; + move32(); } } ELSE IF( EQ_16( n, 512 ) ) @@ -1219,7 +1251,9 @@ void ifft_rel_fx32( { j = *idx++; temp[i] = x[1 + 2 * j]; + move32(); temp[i + 256] = x[2 + 2 * j]; + move32(); } } ELSE @@ -1233,6 +1267,9 @@ void ifft_rel_fx32( xt = x[j]; x[j] = x[i]; x[i] = xt; + move32(); + move32(); + move32(); } k = shr( n, 1 ); WHILE( LT_16( k, j ) ) @@ -1251,6 +1288,7 @@ void ifft_rel_fx32( FOR( i = 1; i <= n; i++ ) { x[i] = Mpy_32_16_1( xi0[i], n_inv ); + move32(); } return; diff --git a/lib_com/igf_base_fx.c b/lib_com/igf_base_fx.c index 1b9f44d63987275fd66699f17ffadc466883182f..ac1a1bcdeeb86a66761814c1376634393e0f47fc 100644 --- a/lib_com/igf_base_fx.c +++ b/lib_com/igf_base_fx.c @@ -455,8 +455,10 @@ static void IGF_gridSetUp( H_IGF_GRID hGrid, /**< ou tmp2 = norm_s( frameLength ); bandwidth = shl( frameLength, tmp2 ); hGrid->swb_offset_len = extract_l( L_shr( sampleRate, 2 ) ); + move16(); tmp1 = sub( norm_s( hGrid->swb_offset_len ), 1 ); hGrid->swb_offset_len = shl( hGrid->swb_offset_len, tmp1 ); + move16(); bandwidth = div_s( hGrid->swb_offset_len, bandwidth ); tmp2 = sub( add( tmp2, 1 ), tmp1 ); bandwidth = shr( bandwidth, sub( 15, tmp2 ) ); @@ -467,12 +469,15 @@ static void IGF_gridSetUp( H_IGF_GRID hGrid, /**< ou hGrid->startSfb = 0; move16(); hGrid->stopSfb = sub( hGrid->swb_offset_len, 1 ); + move16(); hGrid->startLine = hGrid->swb_offset[hGrid->startSfb]; move16(); hGrid->stopLine = hGrid->swb_offset[hGrid->stopSfb]; move16(); hGrid->startFrequency = imult1616( bandwidth, hGrid->startLine ); + move16(); hGrid->stopFrequency = imult1616( bandwidth, hGrid->stopLine ); + move16(); L_tmp1 = L_mult0( igfMinFq, frameLength ); tmp1 = sub( norm_l( L_tmp1 ), 1 ); @@ -484,10 +489,14 @@ static void IGF_gridSetUp( H_IGF_GRID hGrid, /**< ou hGrid->minSrcSubband = div_s( extract_h( L_tmp1 ), extract_h( L_tmp2 ) ); hGrid->minSrcSubband = shr( hGrid->minSrcSubband, tmp1 ); + move16(); + move16(); hGrid->minSrcSubband = add( hGrid->minSrcSubband, s_and( hGrid->minSrcSubband, 1 ) ); + move16(); hGrid->minSrcFrequency = imult1616( bandwidth, hGrid->minSrcSubband ); + move16(); hGrid->infoGranuleLen = frameLength; move16(); hGrid->infoTransFac = transFac; @@ -528,59 +537,91 @@ static void IGF_gridSetUp( H_IGF_GRID hGrid, /**< ou case IGF_BITRATE_RF_WB_13200: hGrid->nTiles = 2; + move16(); wrp_sfb = 2; + move16(); /*1st*/ hGrid->sfbWrap[0 + 1] = wrp_sfb; + move16(); hGrid->sbWrap[0] = hGrid->minSrcSubband; + move16(); hGrid->tile[0 + 1] = hGrid->swb_offset[wrp_sfb]; + move16(); /*2nd*/ hGrid->sfbWrap[1 + 1] = hGrid->stopSfb; + move16(); hGrid->sbWrap[1] = hGrid->minSrcSubband; + move16(); hGrid->tile[1 + 1] = hGrid->swb_offset[hGrid->stopSfb]; + move16(); BREAK; case IGF_BITRATE_SWB_9600: hGrid->nTiles = 3; + move16(); wrp_sfb = 1; + move16(); /*1st*/ hGrid->sfbWrap[0 + 1] = wrp_sfb; + move16(); hGrid->sbWrap[0] = hGrid->minSrcSubband; + move16(); hGrid->tile[0 + 1] = hGrid->swb_offset[wrp_sfb]; + move16(); /*2nd*/ wrp_sfb = 2; + move16(); hGrid->sfbWrap[1 + 1] = wrp_sfb; + move16(); hGrid->sbWrap[1] = hGrid->minSrcSubband + IGF_ApplyTransFac( 32, transFac ); + move16(); hGrid->tile[1 + 1] = hGrid->swb_offset[wrp_sfb]; + move16(); /*3rd*/ hGrid->sfbWrap[2 + 1] = hGrid->stopSfb; + move16(); hGrid->sbWrap[2] = hGrid->minSrcSubband + IGF_ApplyTransFac( 46, transFac ); + move16(); hGrid->tile[2 + 1] = hGrid->swb_offset[hGrid->stopSfb]; + move16(); BREAK; case IGF_BITRATE_RF_SWB_13200: hGrid->nTiles = 3; + move16(); wrp_sfb = 1; + move16(); /*1st*/ hGrid->sfbWrap[0 + 1] = wrp_sfb; + move16(); hGrid->sbWrap[0] = hGrid->minSrcSubband; + move16(); hGrid->tile[0 + 1] = hGrid->swb_offset[wrp_sfb]; + move16(); /*2nd*/ wrp_sfb = 2; + move16(); hGrid->sfbWrap[1 + 1] = wrp_sfb; + move16(); hGrid->sbWrap[1] = hGrid->minSrcSubband + IGF_ApplyTransFac( 32, transFac ); + move16(); hGrid->tile[1 + 1] = hGrid->swb_offset[wrp_sfb]; + move16(); /*3rd*/ hGrid->sfbWrap[2 + 1] = hGrid->stopSfb; + move16(); hGrid->sbWrap[2] = hGrid->minSrcSubband + IGF_ApplyTransFac( 46, transFac ); + move16(); hGrid->tile[2 + 1] = hGrid->swb_offset[hGrid->stopSfb]; + move16(); BREAK; @@ -869,19 +910,26 @@ static void IGF_gridSetUp_ivas_fx( /* inits */ swb_offset = NULL; swb_offset_len = 0; + move16(); + + test(); + test(); IF( EQ_16( transFac, 8192 ) && EQ_16( bitRateIndex, IGF_BITRATE_SWB_48000_CPE ) ) { bitRateIndex = IGF_BITRATE_SWB_48000_CPE_TCX10; + move16(); } ELSE IF( EQ_16( transFac, 8192 ) && EQ_16( bitRateIndex, IGF_BITRATE_FB_48000_CPE ) ) { bitRateIndex = IGF_BITRATE_FB_48000_CPE_TCX10; + move16(); } IF( NE_16( bitRateIndex, IGF_BITRATE_UNKNOWN ) ) { swb_offset = &swb_offset_LB_new[bitRateIndex][1]; swb_offset_len = swb_offset_LB_new[bitRateIndex][0]; + move16(); Copy( &igf_whitening_TH_ivas_fx[bitRateIndex][0][0], &hGrid->whiteningThreshold[0][0], IGF_MAX_TILES * 2 ); } ELSE @@ -892,29 +940,41 @@ static void IGF_gridSetUp_ivas_fx( FOR( sfb = 0; sfb < swb_offset_len; sfb++ ) { hGrid->swb_offset[sfb] = IGF_ApplyTransFac( swb_offset[sfb], transFac ); + move16(); } FOR( sfb = swb_offset_len; sfb < IGF_MAX_SFB; sfb++ ) { hGrid->swb_offset[sfb] = 0; + move16(); } hGrid->infoIsRefined = 0; + move16(); frameLength = IGF_ApplyTransFac( frameLength, transFac ); tmp2 = norm_s( frameLength ); bandwidth_fx = shl( frameLength, tmp2 ); hGrid->swb_offset_len = extract_l( L_shr( sampleRate, 2 ) ); + move16(); tmp1 = sub( norm_s( hGrid->swb_offset_len ), 1 ); hGrid->swb_offset_len = shl( hGrid->swb_offset_len, tmp1 ); + move16(); bandwidth_fx = div_s( hGrid->swb_offset_len, bandwidth_fx ); tmp2 = sub( add( tmp2, 1 ), tmp1 ); bandwidth_fx = shr( bandwidth_fx, sub( 15, tmp2 ) ); hGrid->swb_offset_len = swb_offset_len; + move16(); hGrid->startSfb = 0; + move16(); hGrid->stopSfb = sub( hGrid->swb_offset_len, 1 ); + move16(); hGrid->startLine = hGrid->swb_offset[hGrid->startSfb]; + move16(); hGrid->stopLine = hGrid->swb_offset[hGrid->stopSfb]; + move16(); hGrid->startFrequency = imult1616( bandwidth_fx, hGrid->startLine ); + move16(); hGrid->stopFrequency = imult1616( bandwidth_fx, hGrid->stopLine ); + move16(); L_tmp1 = L_mult0( igfMinFq, frameLength ); tmp1 = sub( norm_l( L_tmp1 ), 1 ); L_tmp1 = L_shl( L_tmp1, tmp1 ); @@ -922,28 +982,44 @@ static void IGF_gridSetUp_ivas_fx( L_tmp2 = L_shl( sampleRate, tmp2 ); tmp1 = add( WORD16_BITS - 1, sub( tmp1, add( tmp2, 1 ) ) ); /* takes into account sampleRate >> 1 */ hGrid->minSrcSubband = div_s( extract_h( L_tmp1 ), extract_h( L_tmp2 ) ); + move16(); hGrid->minSrcSubband = shr( hGrid->minSrcSubband, tmp1 ); + move16(); hGrid->minSrcSubband = add( hGrid->minSrcSubband, s_and( hGrid->minSrcSubband, 1 ) ); + move16(); hGrid->minSrcFrequency = imult1616( bandwidth_fx, hGrid->minSrcSubband ); + move16(); hGrid->infoGranuleLen = frameLength; + move16(); hGrid->sfbWrap[0] = 0; + move16(); hGrid->tile[0] = hGrid->startLine; + move16(); igf_tile_offset = &igf_tile_offset_table[bitRateIndex][1]; hGrid->nTiles = igf_tile_offset_table[bitRateIndex][0]; + move16(); hGrid->tile[0] = hGrid->startLine; + move16(); hGrid->sfbWrap[0] = 0; + move16(); FOR( k = 0; k < hGrid->nTiles; k++ ) { hGrid->sfbWrap[k + 1] = igf_tile_offset[2 * k]; + move16(); hGrid->sbWrap[k] = add( hGrid->minSrcSubband, IGF_ApplyTransFac( igf_tile_offset[2 * k + 1], transFac ) ); + move16(); hGrid->tile[k + 1] = hGrid->swb_offset[igf_tile_offset[2 * k]]; + move16(); } FOR( t = hGrid->nTiles + 1; t < IGF_MAX_TILES; t++ ) { hGrid->tile[t] = 0; + move16(); hGrid->sbWrap[t - 1] = 0; + move16(); hGrid->sfbWrap[t] = 0; + move16(); } /* adapt level envelope: */ @@ -1008,7 +1084,6 @@ static void IGF_gridSetUp_ivas_fx( hGrid->gFactor = 16384 /*1.00f Q14*/; move16(); hGrid->fFactor = 0; /*0.00f Q30*/ - ; move16(); hGrid->lFactor = 16384 /*1.00f Q14*/; move16(); @@ -1047,11 +1122,14 @@ void IGFCommonFuncsCalcSfbEnergyPowerSpec( const Word16 startSfb, /**< in #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; Flag Carry = 0; + move16(); + move16(); #endif FOR( sfb = startSfb; sfb < stopSfb; sfb++ ) { sfbEnergy[sfb] = L_deposit_l( 0 ); + move16(); } IF( NULL == pPowerSpectrum ) { @@ -1064,6 +1142,7 @@ void IGFCommonFuncsCalcSfbEnergyPowerSpec( const Word16 startSfb, /**< in FOR( line = swb_offset[sfb]; line < swb_offset[sfb + 1]; line++ ) { Carry = 0; + move16(); #ifdef BASOP_NOGLOB sfbEnergy[sfb] = L_add_co( sfbEnergy[sfb], pPowerSpectrum[line], &Carry, &Overflow ); #else /* BASOP_NOGLOB */ @@ -1071,6 +1150,7 @@ void IGFCommonFuncsCalcSfbEnergyPowerSpec( const Word16 startSfb, /**< in #endif /* BASOP_NOGLOB */ move32(); Overflow = 0; + move16(); #ifdef BASOP_NOGLOB L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow ); #else /* BASOP_NOGLOB */ @@ -1233,7 +1313,9 @@ Word16 IGFCommonFuncsIGFConfiguration( //100820 temp fix #endif hIGFInfo->nfSeedBuf[0] = 0; + move16(); hIGFInfo->nfSeedBuf[1] = 0; + move16(); hIGFInfo->nfSeed = &hIGFInfo->nfSeedBuf[0]; move16(); @@ -1314,7 +1396,9 @@ Word16 IGFCommonFuncsIGFConfiguration_ivas_fx( //100820 temp fix #endif hIGFInfo->nfSeedBuf[0] = 0; + move16(); hIGFInfo->nfSeedBuf[1] = 0; + move16(); hIGFInfo->nfSeed = &hIGFInfo->nfSeedBuf[0]; move16(); @@ -1371,12 +1455,14 @@ Word16 IGFCommonFuncsIGFGetCFTables( Word16 bitRateIndex; retValue = 0; /* bitrate index is unknown -> error! */ + move16(); bitRateIndex = IGF_MapBitRateToIndex( total_brate, bwidth, element_mode, rf_mode ); IF( bitRateIndex != IGF_BITRATE_UNKNOWN ) { retValue = 1; /* no error */ + move16(); SWITCH( bitRateIndex ) { diff --git a/lib_com/index_pvq_opt_fx.c b/lib_com/index_pvq_opt_fx.c index 713c2afb05cc9567f9b4327c25240ed3f8aab1d3..2f75d8ac8233234b8294532ce0e91d59fc149e75 100644 --- a/lib_com/index_pvq_opt_fx.c +++ b/lib_com/index_pvq_opt_fx.c @@ -191,6 +191,7 @@ static UWord32 direct_msize_fx( Word16 dim_in, Word16 k_in ) UWord32 UL_msize, k, ksq; UL_msize = 1; /* k==0 or dim==1 , and base fot other dims */ + move32(); IF( k_in != 0 ) { k = UL_deposit_l( k_in ); /*k = (UWord32) k_in;*/ @@ -226,7 +227,9 @@ static void initOffsets_fx( Word16 dim_in, UWord32 *h_mem, Word16 k_val_in ) h_mem[0] = UL_deposit_l( 0 ); /* A(=>0,k=0) */ + move32(); h_mem[1] = UL_deposit_l( 1 ); /* A(*,k=1) */ + move32(); UL_k_val_in = UL_deposit_l( k_val_in ); IF( EQ_16( dim_in, 2 ) ) @@ -360,6 +363,7 @@ static void a_u_fwd_fx( UWord32 *a_u_in, u_kp1 = UL_lshr( a_u_in[k_val_in], 1 ); a_u_in[mem_size_m1] = UL_addNsD( 1U, UL_addNsD( u_kp1_prev, UL_addNsD( u_k_prev, u_kp1 ) ) ); + move32(); return; } @@ -381,7 +385,9 @@ static UWord32 nm_h_prep_opt_fx( /* o: msize for dim */ Word16 end_loop, add_last_odd; h[0] = UL_deposit_l( 0 ); /* % A(=>0,k=0) */ + move32(); h[1] = UL_deposit_l( 1 ); /* % A(*,k=1) */ + move32(); mem_size_m1 = add( k_val_in, 1 ); @@ -490,6 +496,7 @@ static Word16 find_amp_split_offset_func_mem_fx( /* o: found k_value */ UWord32 *UL_tmp_offset ) /* o: offset found */ { Word16 not_ready, low, k_test = 0; + move16(); UWord16 sgn; UWord32 UL_tmp; /* split over A(n,k) = h_mem(k), or use direct A function evaluation */ @@ -504,6 +511,7 @@ static Word16 find_amp_split_offset_func_mem_fx( /* o: found k_value */ { k_test = shr( add( low, high ), 1 ); /*% split range in half */ *UL_tmp_offset = ( *h_func_ptr )( UL_deposit_l( k_test ) ); /* call direct A offset-function */ + move32(); UL_tmp = UL_subNs( *UL_tmp_offset, ind_in, &sgn ); IF( sgn ) @@ -548,6 +556,7 @@ static Word16 get_lead_sign_fx( UWord32 *ind ) move16(); } ( *ind ) = UL_lshr( *ind, 1 ); + move32(); return leading_sign; } @@ -566,6 +575,7 @@ static void mind2vec_one_fx( /* NB input k_val_in can be zero */ /* *vec_out = leading_sign*k_val_in; */ *vec_out = (Word16) ind; /* dummy assignment to avoid gcc "unused parameter" warning for ind, i.e no move16() needed */ + move16(); /* *vec_out = extract_l(L_mult0(leading_sign,k_val_in)); move16(); // 3 ops */ if ( leading_sign < 0 ) @@ -623,6 +633,7 @@ static Word16 setval_update_sign_fx( Word16 k_delta, { mind2vec_one_fx( k_delta, *leading_sign, *ind_in, vec_out ); *leading_sign = get_lead_sign_fx( ind_in ); + move16(); k_max_local = sub( k_max_local, k_delta ); } return k_max_local; @@ -874,12 +885,16 @@ static void vec2mind_one_fx( ) { *ind = (Word32) ( *k_val_out_ptr ); /* dummy assignment to avoid gcc "unused parameter" warning for *k_val_out_ptr, i.e no move32 needed() */ + move32(); *ind = UL_deposit_l( 0 ); + move32(); *next_sign_ind = UL_deposit_l( 0 ); + move32(); if ( *vec_in < 0 ) { *next_sign_ind = UL_deposit_l( 1 ); /*single basicop */ + move32(); } return; } @@ -903,8 +918,10 @@ static void vec2mind_two_fx( *k_val_out_ptr = abs01; move16(); /* can be zero */ *ind = UL_deposit_l( 0 ); /* [KMAX 0 ] , and dual zeros */ + move32(); *next_sign_ind = UL_deposit_h( SIGNBIT_SHRT_FX ); /* "unset" sign flag set */ /* dual zeroes can happen in a recursive encoding call */ + move32(); IF( abs01 != 0 ) @@ -912,6 +929,7 @@ static void vec2mind_two_fx( sptr = 0; move16(); /*used as ptr to vec0 or vec1 value */ *next_sign_ind = UL_deposit_l( sptr ); + move32(); test(); IF( abs0 != 0 && abs1 != 0 ) @@ -933,6 +951,7 @@ static void vec2mind_two_fx( { /* [ 0 KMAX]*/ *ind = UL_deposit_l( (UWord16) sub( lshl( abs1, 1 ), 1 ) ); + move32(); sptr = 1; move16(); } @@ -942,6 +961,7 @@ static void vec2mind_two_fx( if ( vec_in[sptr] < 0 ) { *next_sign_ind = UL_deposit_l( 1 ); /*single instruction */ + move32(); } } return; @@ -958,6 +978,7 @@ static void enc_push_sign( Word16 val, UWord32 *next_sign_ind, UWord32 *index ) IF( ( UL_and( *next_sign_ind, SIGNBIT_FX ) == 0 ) && ( val != 0 ) ) { *index = UL_addNsD( UL_lshl( *index, 1 ), *next_sign_ind ); + move32(); } /* push sign to next non_zero position */ @@ -965,10 +986,12 @@ static void enc_push_sign( Word16 val, UWord32 *next_sign_ind, UWord32 *index ) if ( val < 0 ) { *next_sign_ind = UL_deposit_l( 1 ); /* single basicop */ + move32(); } if ( val > 0 ) { *next_sign_ind = UL_deposit_l( 0 ); /* single basicop */ + move32(); } } @@ -997,8 +1020,10 @@ static void vec2mind_gen345_fx( move32(); /* adaptive function call setup */ *index = UL_addNsD( *index, ( *a_func_ptr )( UL_deposit_l( *k_val_out_ptr ) ) ); + move32(); *k_val_out_ptr = add( *k_val_out_ptr, abs_s( tmp_val ) ); + move16(); return; } @@ -1075,6 +1100,7 @@ static void vec2mind_fx( Word16 dim_in, /* i : dim mem_size_m1 = add( k_val_in, 1 ); *next_sign_ind = UL_deposit_h( SIGNBIT_SHRT_FX ); /* highest bit set signals no sign found yet, should always be 0 or 1 out, */ + move32(); pos = sub( dim_in, 2 ); /* adress 2nd last sample */ vec2mind_two_fx( &vec_in[pos], &k_val_acc, next_sign_ind, index ); @@ -1090,6 +1116,7 @@ static void vec2mind_fx( Word16 dim_in, /* i : dim /* now add indexing offset up to this reverse (r_l) accumulated amplitude point */ *index = UL_addNsD( *index, tmp_h ); /* k_val_acc==0 ==>0 */ + move32(); /* k_val_acc = k_val_acc + vec_abs[pos];*/ /* now increase acc k value for next N */ k_val_acc = add( k_val_acc, abs_s( tmp_val ) ); diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 126cc3d1c3c94869ab7f0f8873e0b4b9b2eb6225..c8fa4f9e8777eff1243cdbb85e848f00028736c7 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1283,6 +1283,9 @@ enum #define MASA_NO_POINTS_EQUATOR 430 #define MASA_NO_CIRCLES 121 +#ifdef IVAS_FLOAT_FIXED +#define MASA_NO_CIRCLES_Q23 ( 1015021568 ) +#endif #define MASA_ASIN_OFFSET 0.0064471690266724975f #define MASA_ASIN_OFFSET_Q15 ( 211 ) #define MASA_NTOT2_FAC 32768.00566947353f diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index 3b70fd7df7671ba3315cb6490612fa38dafffa8e..e2d4abf3f6628a805e85c4f86db947bb8c3f67aa 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -43,6 +43,9 @@ #include "prot_fx1.h" #include "prot_fx2.h" #include "ivas_prot_fx.h" +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif /*-----------------------------------------------------------------------* * Local function prototypes diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index 60caa2e178947d00890316cc82146438a0d05bdf..a72aba04a7540e4d9723522fcf3f24a3fcfc9cb3 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -41,6 +41,9 @@ #include "ivas_prot_fx.h" #include "prot_fx1.h" #include "prot_fx2.h" +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif /*------------------------------------------------------------------------------------------* diff --git a/lib_com/ivas_lfe_com.c b/lib_com/ivas_lfe_com.c index 1239813943963509a45a0fd0b775ee8295915ad2..99c7741c31556781b8601f8146ea743fa19d3342 100644 --- a/lib_com/ivas_lfe_com.c +++ b/lib_com/ivas_lfe_com.c @@ -44,6 +44,9 @@ #ifdef IVAS_FLOAT_FIXED #include "ivas_prot_fx.h" #endif +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif /*-----------------------------------------------------------------------------------------* diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index 388dd6a6062583b39dbd4a04a2d4a8bf0e008749..dbcda4b56a94d6c119c323b159274ec4d0d9fa34 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -195,7 +195,7 @@ void ivas_masa_set_elements_fx( *element_mode = IVAS_SCE; /* This is needed for the initialization phase to initialize codec mode to SCE, since it is written first to the file*/ move16(); } - ELSE IF( EQ_16( ivas_format, MASA_ISM_FORMAT ) && NE_16( ism_mode, ISM_MODE_NONE ) ) + ELSE IF( EQ_16( ivas_format, MASA_ISM_FORMAT ) && ism_mode != ISM_MODE_NONE ) { *nCPE = 1; move16(); @@ -234,6 +234,9 @@ void ivas_masa_set_elements_fx( } /* hQMetaData->bits_frame_nominal = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC ); */ hQMetaData->bits_frame_nominal = extract_l( Mpy_32_32( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ); + test(); + test(); + test(); IF( EQ_16( ivas_format, MASA_ISM_FORMAT ) && ( EQ_16( ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_16( ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) || EQ_16( ism_mode, ISM_MASA_MODE_DISC ) ) ) { /* hQMetaData->bits_frame_nominal -= (int16_t) ( ism_total_brate / FRAMES_PER_SEC ); */ @@ -270,8 +273,7 @@ void ivas_masa_set_elements_fx( } ELSE { - hQMetaData->bits_frame_nominal = (Word16) ( ivas_total_brate / FRAMES_PER_SEC ); - move16(); + hQMetaData->bits_frame_nominal = extract_l( Mpy_32_32( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ); } *element_mode = IVAS_SCE; move16(); @@ -511,35 +513,35 @@ void ivas_masa_set_coding_config_fx( /* Setup coding parameters based on the bitrate, transport channel count, subframe metadata information, * and number of directions in metadata. */ nbands = 0; + move16(); nTwoDirBands = 0; + move16(); i = 0; move16(); /* First select correct bit budget table */ masa_bits_table = masa_bits; - move16(); test(); IF( isMcMasa ) { masa_bits_table = mcmasa_bits; - move16(); } ELSE IF( LT_32( ivas_total_brate, IVAS_48k ) && EQ_16( nchan_transport, 2 ) ) { masa_bits_table = masa_bits_LR_stereo; - move16(); } - WHILE( EQ_16( nbands, 0 ) && LT_16( i, IVAS_NUM_ACTIVE_BRATES ) ) + WHILE( nbands == 0 && LT_16( i, IVAS_NUM_ACTIVE_BRATES ) ) { + test(); IF( LE_32( ivas_total_brate, ivas_brate_tbl[i + SIZE_IVAS_BRATE_TBL - IVAS_NUM_ACTIVE_BRATES] ) ) { Word16 idx_bands; test(); test(); - IF( LT_32( ivas_total_brate, IVAS_48k ) && EQ_16( nchan_transport, 2 ) && GT_16( i, 3 ) ) + if ( LT_32( ivas_total_brate, IVAS_48k ) && EQ_16( nchan_transport, 2 ) && GT_16( i, 3 ) ) { /* because it uses the bitallocation for the lower bit rates from 'masa_bits_LR_stereo' and it has 4 elements */ i = 3; @@ -550,7 +552,16 @@ void ivas_masa_set_coding_config_fx( IF( GT_16( config->numberOfDirections, 1 ) ) { - nTwoDirBands = config->joinedSubframes ? masa_twodir_bands_joined[i] : masa_twodir_bands[i]; + IF( config->joinedSubframes ) + { + nTwoDirBands = masa_twodir_bands_joined[i]; + move16(); + } + ELSE + { + nTwoDirBands = masa_twodir_bands[i]; + move16(); + } test(); test(); @@ -564,20 +575,23 @@ void ivas_masa_set_coding_config_fx( IF( config->joinedSubframes ) { nbands = masa_joined_nbands[idx_bands]; + move16(); } ELSE { nbands = masa_nbands[idx_bands]; + move16(); } - config->max_metadata_bits = masa_bits_table[i]; + config->max_metadata_bits = (UWord16) masa_bits_table[i]; move16(); test(); IF( EQ_32( ivas_total_brate, IVAS_64k ) && GT_16( config->numberOfDirections, 1 ) ) { /* At 64k, we increase metadata bit budget when there is two directions present. */ - config->max_metadata_bits = (UWord16) L_add( config->max_metadata_bits, MASA_EXTRA_BAND_META_BITS ); + config->max_metadata_bits = (UWord16) add( config->max_metadata_bits, MASA_EXTRA_BAND_META_BITS ); + move16(); } test(); @@ -586,21 +600,26 @@ void ivas_masa_set_coding_config_fx( IF( ( ( EQ_32( ivas_total_brate, IVAS_32k ) && EQ_16( nchan_transport, 2 ) ) || EQ_32( ivas_total_brate, IVAS_48k ) ) && config->joinedSubframes ) { /* At 32k and 48k, we increase metadata bit budget when joinedSubframes. */ - config->max_metadata_bits = (UWord16) L_add( config->max_metadata_bits, MASA_SMALL_INC_META_BITS ); + config->max_metadata_bits = (UWord16) add( config->max_metadata_bits, MASA_SMALL_INC_META_BITS ); + move16(); } } i = add( i, 1 ); } config->numCodingBands = nbands; + move16(); config->numTwoDirBands = nTwoDirBands; + move16(); IF( EQ_16( config->joinedSubframes, TRUE ) ) { config->mergeRatiosOverSubframes = FALSE; + move16(); } ELSE { config->mergeRatiosOverSubframes = TRUE; + move16(); } /* Setup frequency band mapping based on the number of used coding bands */ @@ -620,7 +639,7 @@ void ivas_masa_set_coding_config_fx( BREAK; case MASA_FREQUENCY_BANDS: /* With input count of bands, no mapping is needed but for unified processing later, we store normal mapping */ - FOR( i = 0; i < add( MASA_FREQUENCY_BANDS, 1 ); i++ ) + FOR( i = 0; i < MASA_FREQUENCY_BANDS + 1; i++ ) { band_mapping[i] = i; move16(); @@ -631,12 +650,14 @@ void ivas_masa_set_coding_config_fx( } config->useCoherence = TRUE; + move16(); test(); test(); test(); IF( ( !isMcMasa && LT_32( ivas_total_brate, IVAS_48k ) ) || ( isMcMasa && LT_32( ivas_total_brate, IVAS_16k4 ) ) ) { config->useCoherence = FALSE; + move16(); } return; @@ -769,6 +790,7 @@ void masa_sample_rate_band_correction_fx( UWord8 numBands48k; numBands48k = config->numCodingBands; + move16(); FOR( band = 1; band < config->numCodingBands + 1; band++ ) { @@ -778,18 +800,22 @@ void masa_sample_rate_band_correction_fx( IF( GE_16( highBand, (Word16) maxBand ) ) { config->numCodingBands = band; + move16(); hQMetaData->numCodingBands = band; + move16(); IF( is_encoder ) { - test(); - IF( GT_16( hQMetaData->q_direction->cfg.nbands, (Word16) band ) ) + if ( GT_16( hQMetaData->q_direction->cfg.nbands, (Word16) band ) ) { hQMetaData->q_direction->cfg.nbands = band; + move16(); } - IF( EQ_16( (Word16) hQMetaData->no_directions, 2 ) && GT_16( hQMetaData->q_direction[1].cfg.nbands, (Word16) band ) ) + test(); + if ( EQ_16( (Word16) hQMetaData->no_directions, 2 ) && GT_16( hQMetaData->q_direction[1].cfg.nbands, (Word16) band ) ) { hQMetaData->q_direction[1].cfg.nbands = band; + move16(); } } @@ -812,9 +838,11 @@ void masa_sample_rate_band_correction_fx( hQMetaData->q_direction[0].band_data[band].energy_ratio_fx[sf] = 0; move32(); - IF( hQMetaData->coherence_flag && hQMetaData->q_direction[0].coherence_band_data != NULL ) + test(); + if ( hQMetaData->coherence_flag && hQMetaData->q_direction[0].coherence_band_data != NULL ) { hQMetaData->q_direction[0].coherence_band_data[band].spread_coherence[sf] = 0u; + move16(); } IF( EQ_16( (Word16) hQMetaData->no_directions, 2 ) ) @@ -826,21 +854,26 @@ void masa_sample_rate_band_correction_fx( hQMetaData->q_direction[1].band_data[band].energy_ratio_fx[sf] = 0; move32(); - IF( hQMetaData->coherence_flag && hQMetaData->q_direction[1].coherence_band_data != NULL ) + test(); + if ( hQMetaData->coherence_flag && hQMetaData->q_direction[1].coherence_band_data != NULL ) { hQMetaData->q_direction[1].coherence_band_data[band].spread_coherence[sf] = 0u; + move16(); } } - IF( hQMetaData->coherence_flag && hQMetaData->surcoh_band_data != NULL ) + test(); + if ( hQMetaData->coherence_flag && hQMetaData->surcoh_band_data != NULL ) { hQMetaData->surcoh_band_data[band].surround_coherence[sf] = 0u; + move16(); } } - IF( EQ_16( (Word16) hQMetaData->no_directions, 2 ) ) + if ( EQ_16( (Word16) hQMetaData->no_directions, 2 ) ) { hQMetaData->twoDirBands[band] = 0; + move16(); } } @@ -854,14 +887,21 @@ void masa_sample_rate_band_correction_fx( hExtOutMeta->directionIndex[0][sf][band] = SPH_IDX_FRONT; move16(); hExtOutMeta->directToTotalRatio[0][sf][band] = 0u; + move16(); hExtOutMeta->spreadCoherence[0][sf][band] = 0u; + move16(); hExtOutMeta->directionIndex[1][sf][band] = SPH_IDX_FRONT; + move16(); hExtOutMeta->directToTotalRatio[1][sf][band] = 0u; + move16(); hExtOutMeta->spreadCoherence[1][sf][band] = 0u; + move16(); hExtOutMeta->surroundCoherence[sf][band] = 0u; + move16(); hExtOutMeta->diffuseToTotalRatio[sf][band] = UINT8_MAX; + move16(); } } } @@ -992,7 +1032,7 @@ UWord16 index_theta_phi_16_fx( move32(); phi_fx = L_add( phi_fx, L_shl( 180, Q22 ) ); - IF( LT_32( theta_fx, 0 ) ) + IF( theta_fx < 0 ) { abs_theta_fx = L_negate( theta_fx ); sign_th = -1; @@ -1030,11 +1070,13 @@ UWord16 index_theta_phi_16_fx( IF( EQ_16( sign_th, -1 ) ) { *p_theta = L_negate( theta_hat_fx ); + move32(); } *p_phi = L_sub( phi_hat_fx, L_shl( 180, Q22 ) ); + move32(); /* Starting from Equator, alternating positive and negative */ - IF( EQ_16( id_th, 0 ) ) + IF( id_th == 0 ) { idx_sph = id_phi; move16(); @@ -1045,7 +1087,7 @@ UWord16 index_theta_phi_16_fx( { idx_sph = 65534; move16(); - IF( LT_16( sign_th, 0 ) ) + if ( sign_th < 0 ) { idx_sph = 65535; move16(); @@ -1058,7 +1100,7 @@ UWord16 index_theta_phi_16_fx( cum_n = (UWord16) L_add( cum_n, gridData->no_phi[0] ); - IF( GT_16( sign_th, 0 ) ) + IF( sign_th > 0 ) { cum_n = (UWord16) L_sub( cum_n, shl( gridData->no_phi[id_th], 1 ) ); } @@ -1076,7 +1118,7 @@ UWord16 index_theta_phi_16_fx( /*------------------------------------------------------------------------- - * quantize_phi_masa() + * quantize_theta_masa() * * *------------------------------------------------------------------------*/ @@ -1137,15 +1179,18 @@ static Word16 quantize_theta_masa_fx( { imin = sub( imin, 1 ); *xhat_fx = Mpy_32_16_1( MASA_ANGLE_AT_EQUATOR_DEG_Q31, shl( imin, 6 ) ); // 31 + 6 - 15 = Q22 + move32(); } ELSE { *xhat_fx = L_shl( 90, Q22 ); + move32(); } } ELSE { *xhat_fx = Mpy_32_16_1( MASA_ANGLE_AT_EQUATOR_DEG_Q31, shl( imin, 6 ) ); // 31 + 6 - 15 = Q22 + move32(); } return imin; @@ -1258,6 +1303,7 @@ static Word16 quantize_phi_masa_fx( } *phi_hat_fx = L_add( L_shl( Mpy_32_16_1( delta_phi_fx, id_phi ), 15 ), dd_fx ); // q22 + q0 - 15 = q7 -> q7 + 15 = q22 + move32(); return id_phi; } @@ -1440,6 +1486,19 @@ void deindex_sph_idx_fx( Word16 tmp16, tmp_e; move16(); move16(); + move16(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); IF( GE_32( sphIndex, limit_index1 ) ) { @@ -1482,9 +1541,9 @@ void deindex_sph_idx_fx( tmp32 = L_shr( tmp32, sub( Q8, tmp16 ) ); /* Q23 */ estim_fx = L_add( ba_crt_fx, tmp32 ); /* Q23 */ - if ( GT_32( estim_fx, MASA_NO_CIRCLES << Q23 ) ) + if ( GT_32( estim_fx, MASA_NO_CIRCLES_Q23 ) ) { - estim_fx = MASA_NO_CIRCLES << Q23; + estim_fx = MASA_NO_CIRCLES_Q23; move32(); } @@ -1537,7 +1596,7 @@ void deindex_sph_idx_fx( move16(); IF( LT_32( sphIndex, base_low ) ) { - id_th--; + id_th = sub( id_th, 1 ); n_crt = n[id_th]; move16(); IF( id_th == 0 ) @@ -1557,7 +1616,7 @@ void deindex_sph_idx_fx( } ELSE IF( GE_32( sphIndex, base_up ) ) { - id_th++; + id_th = add( id_th, 1 ); n_crt = n[id_th]; move16(); base_low = base_up; @@ -1693,7 +1752,7 @@ Word16 valid_ratio_index_fx( move16(); FOR( i = len - 1; i >= 0; i-- ) { - IF( EQ_16( index, 0 ) ) + IF( index == 0 ) { elem = 0; move16(); @@ -1768,7 +1827,7 @@ void reconstruct_ism_ratios_fx( sum = 0; move32(); - FOR( i = 0; i < sub( nchan_ism, 1 ); i++ ) + FOR( i = 0; i < nchan_ism - 1; i++ ) { q_energy_ratio_ism[i] = L_shl( L_mult( ratio_ism_idx[i], step ), 14 ); // q0 + q15 + 1 + 14 = q30; move32(); @@ -1779,7 +1838,7 @@ void reconstruct_ism_ratios_fx( q_energy_ratio_ism[nchan_ism - 1] = L_sub( ONE_IN_Q30, sum ); move32(); - IF( LT_32( q_energy_ratio_ism[nchan_ism - 1], 0 ) ) + if ( q_energy_ratio_ism[nchan_ism - 1] < 0 ) { q_energy_ratio_ism[nchan_ism - 1] = 0; move32(); @@ -1917,7 +1976,7 @@ void distribute_evenly_ism_fx( move16(); FOR( i = 0; i < nchan_ism; i++ ) { - IF( EQ_16( K, 0 ) ) + IF( K == 0 ) { idx[i] = 0; move16(); @@ -2011,6 +2070,7 @@ Word32 calculate_cpe_brate_MASA_ISM_fx( WHILE( LT_16( k, SIZE_IVAS_BRATE_TBL ) && NE_32( ivas_total_brate, ivas_brate_tbl[k] ) ) { + test(); k = add( k, 1 ); } diff --git a/lib_com/ivas_mc_param_com.c b/lib_com/ivas_mc_param_com.c index 07ab1f9b8b71c6e9e088412728db3138224fca68..5297d332a8439b961b9b884a87f1f35acfd9490d 100644 --- a/lib_com/ivas_mc_param_com.c +++ b/lib_com/ivas_mc_param_com.c @@ -41,6 +41,9 @@ #include "ivas_stat_com.h" #include "ivas_rom_com.h" #include "wmc_auto.h" +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif /*------------------------------------------------------------------------- @@ -313,7 +316,8 @@ void ivas_param_mc_set_coded_bands( FOR( i = 0; i < hMetadataPMC->nbands_coded; i++ ) { - hMetadataPMC->nbands_in_param_frame[hMetadataPMC->coding_band_mapping[i]]++; + hMetadataPMC->nbands_in_param_frame[hMetadataPMC->coding_band_mapping[i]] = add( hMetadataPMC->nbands_in_param_frame[hMetadataPMC->coding_band_mapping[i]], 1 ); + move16(); } return; diff --git a/lib_com/ivas_mcmasa_com.c b/lib_com/ivas_mcmasa_com.c index f8550d48efcff47c2cbaf9b0f1920346da953072..c10c0d2dd30faf65ffb0c134f9b263cffa3b9b41 100644 --- a/lib_com/ivas_mcmasa_com.c +++ b/lib_com/ivas_mcmasa_com.c @@ -108,12 +108,14 @@ void ivas_mcmasa_set_separate_channel_mode_fx( IF( GE_32( ivas_total_brate, MCMASA_SEPARATE_BRATE ) ) { *separateChannelEnabled = 1; + move16(); *separateChannelIndex = 2; /* Center channel */ move16(); } ELSE { *separateChannelEnabled = 0; + move16(); *separateChannelIndex = 0; move16(); } @@ -165,23 +167,43 @@ void ivas_mcmasa_split_brate_fx( IF( LT_32( ivas_total_brate, IVAS_96k ) ) { *brate_sce = Mpy_32_32( MCMASA_MONOBITRATIO_64k_Q31, ivas_total_brate ); /* Q0 */ + move32(); } ELSE { *brate_sce = Mpy_32_32( MCMASA_MONOBITRATIO_Q31, ivas_total_brate ); /* Q0 */ + move32(); } *brate_cpe = L_sub( ivas_total_brate, *brate_sce ); + move32(); } ELSE { - Word16 tmp_e = 0; + Word16 tmp, tmp_e; + tmp_e = 0; move16(); - Word16 tmp = BASOP_Util_Divide3216_Scale( ivas_total_brate, ( add( nCPE, nSCE ) ), &tmp_e ); - *brate_sce = GT_16( nSCE, 0 ) ? ( L_shr( (Word32) tmp, negate( add( 1, tmp_e ) ) ) ) : 0; - move32(); - *brate_cpe = GT_16( nCPE, 0 ) ? ( L_shr( (Word32) tmp, negate( add( 1, tmp_e ) ) ) ) : 0; - move32(); + tmp = BASOP_Util_Divide3216_Scale( ivas_total_brate, ( add( nCPE, nSCE ) ), &tmp_e ); + IF( nSCE > 0 ) + { + *brate_sce = L_shr( (Word32) tmp, negate( add( 1, tmp_e ) ) ); + move32(); + } + ELSE + { + *brate_sce = 0; + move32(); + } + IF( nCPE > 0 ) + { + *brate_cpe = L_shr( (Word32) tmp, negate( add( 1, tmp_e ) ) ); + move32(); + } + ELSE + { + *brate_cpe = 0; + move32(); + } } return; diff --git a/lib_com/ivas_mct_com.c b/lib_com/ivas_mct_com.c index 6da936755c7000fb82b154096ccc2ed1c45fe9a3..f68f576f90a209fae0f66c8584e6a7c18b8c744c 100644 --- a/lib_com/ivas_mct_com.c +++ b/lib_com/ivas_mct_com.c @@ -210,20 +210,21 @@ void splitAvailableBitsMCT( Word16 core[MCT_MAX_CHANNELS]; MCT_CHAN_MODE mct_chan_mode[MCT_MAX_CHANNELS]; min_bits_tot = 0; + move16(); FOR( i = 0; i < nchan; i++ ) { IF( enc_dec == ENC ) { mct_chan_mode[i] = ( (Encoder_State *) sts[i] )->mct_chan_mode; - move16(); + move32(); core[i] = ( (Encoder_State *) sts[i] )->core; move16(); } ELSE { mct_chan_mode[i] = ( (Decoder_State *) sts[i] )->mct_chan_mode; - move16(); + move32(); core[i] = ( (Decoder_State *) sts[i] )->core; move16(); } @@ -231,24 +232,30 @@ void splitAvailableBitsMCT( FOR( i = 0; i < nchan; i++ ) { - IF( mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE ) + IF( NE_32( mct_chan_mode[i], MCT_CHAN_MODE_IGNORE ) ) { min_chan_bits[i] = 0; move16(); - nSubframes = ( core[i] == TCX_20_CORE ) ? 1 : NB_DIV; - move16(); + IF( EQ_32( core[i], TCX_20_CORE ) ) + { + nSubframes = 1; + move16(); + } + ELSE + { + nSubframes = NB_DIV; + move16(); + } FOR( k = 0; k < nSubframes; k++ ) { - min_chan_bits[i] += SMDCT_MINIMUM_ARITH_BITS + MIN_SAFETY_BITS_MC; + min_chan_bits[i] = add( min_chan_bits[i], SMDCT_MINIMUM_ARITH_BITS + MIN_SAFETY_BITS_MC ); move16(); } - min_bits_tot += min_chan_bits[i]; - move16(); + min_bits_tot = add( min_bits_tot, min_chan_bits[i] ); } } - remaining_bits = total_bits - min_bits_tot; - move16(); + remaining_bits = sub( total_bits, min_bits_tot ); /*initial value of bits already given*/ bits_split = 0; @@ -263,25 +270,20 @@ void splitAvailableBitsMCT( IF( enc_dec == ENC ) { bits_frame_channel = &( (Encoder_State *) sts[i] )->bits_frame_channel; - move16(); } ELSE /* DEC */ { bits_frame_channel = &( (Decoder_State *) sts[i] )->bits_frame_channel; - move16(); } - IF( - mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE ) + IF( NE_32( mct_chan_mode[i], MCT_CHAN_MODE_IGNORE ) ) { assert( split_ratio[i] >= 1 && split_ratio[i] < BITRATE_MCT_RATIO_RANGE ); - *bits_frame_channel = (Word16) L_shr( (Word32) split_ratio[i] * remaining_bits, NBBITS_MCT_RATIO ) + min_chan_bits[i]; - move16(); - bits_split += *bits_frame_channel; - move16(); + *bits_frame_channel = add( extract_l( L_shr( L_mult0( split_ratio[i], remaining_bits ), NBBITS_MCT_RATIO ) ), min_chan_bits[i] ); + bits_split = add( bits_split, *bits_frame_channel ); /*determine channel with most bits (energy)*/ - IF( *bits_frame_channel > tmp ) + IF( GT_16( *bits_frame_channel, tmp ) ) { tmp = *bits_frame_channel; move16(); @@ -292,10 +294,9 @@ void splitAvailableBitsMCT( } /*if bits distributed are more than available bits, substract the proportional amount of bits from all channels*/ - IF( bits_split != total_bits ) + IF( NE_16( bits_split, total_bits ) ) { - diff = bits_split - total_bits; - move16(); + diff = sub( bits_split, total_bits ); /*re-count bits distributed to each channel*/ bits_split = 0; @@ -306,68 +307,61 @@ void splitAvailableBitsMCT( IF( enc_dec == ENC ) { bits_frame_channel = &( (Encoder_State *) sts[i] )->bits_frame_channel; - move16(); } ELSE /* DEC */ { bits_frame_channel = &( (Decoder_State *) sts[i] )->bits_frame_channel; - move16(); } - IF( mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE ) + IF( NE_32( mct_chan_mode[i], MCT_CHAN_MODE_IGNORE ) ) { - Word32 temp_res = (Word32) diff * split_ratio[i]; + Word32 temp_res; + temp_res = L_mult0( diff, split_ratio[i] ); IF( temp_res < 0 ) { - temp_res = -temp_res; - move16(); + temp_res = L_negate( temp_res ); temp_res = L_shr( temp_res, NBBITS_MCT_RATIO ); - move16(); - temp_res = -temp_res; - move16(); + temp_res = L_negate( temp_res ); } ELSE { temp_res = L_shr( temp_res, NBBITS_MCT_RATIO ); - move16(); } - *bits_frame_channel -= (Word16) temp_res; - move16(); - *bits_frame_channel = max( min_chan_bits[i], *bits_frame_channel ); + *bits_frame_channel = sub( *bits_frame_channel, extract_l( temp_res ) ); move16(); - bits_split += *bits_frame_channel; + *bits_frame_channel = s_max( min_chan_bits[i], *bits_frame_channel ); move16(); + bits_split = add( bits_split, *bits_frame_channel ); } } } /*if there any bits left assign them to the channel with the maximum energy (or more bits)*/ - IF( total_bits != bits_split ) + IF( NE_16( total_bits, bits_split ) ) { IF( enc_dec == ENC ) { bits_frame_channel = &( (Encoder_State *) sts[max_chn] )->bits_frame_channel; - move16(); } ELSE /* DEC */ { bits_frame_channel = &( (Decoder_State *) sts[max_chn] )->bits_frame_channel; - move16(); } - *bits_frame_channel += ( total_bits - bits_split ); - move16(); + *bits_frame_channel = add( *bits_frame_channel, sub( total_bits, bits_split ) ); /*if all channels are silent assign bits to ch 0*/ IF( enc_dec == ENC ) { - IF( ( (Encoder_State *) sts[max_chn] )->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + IF( EQ_32( ( (Encoder_State *) sts[max_chn] )->mct_chan_mode, MCT_CHAN_MODE_IGNORE ) ) { assert( bits_split == 0 ); ( (Encoder_State *) sts[max_chn] )->mct_chan_mode = MCT_CHAN_MODE_REGULAR; - ( (Encoder_State *) sts[max_chn] )->side_bits_frame_channel = ( ( (Encoder_State *) sts[max_chn] )->core ) * ( NBITS_TCX_GAIN + NOISE_FILL_RANGES * NBITS_NOISE_FILL_LEVEL ); - *bits_frame_channel -= ( (Encoder_State *) sts[max_chn] )->side_bits_frame_channel; + move32(); + ( (Encoder_State *) sts[max_chn] )->side_bits_frame_channel = imult1616( ( ( (Encoder_State *) sts[max_chn] )->core ), ( NBITS_TCX_GAIN + NOISE_FILL_RANGES * NBITS_NOISE_FILL_LEVEL ) ); + move16(); + *bits_frame_channel = sub( *bits_frame_channel, ( (Encoder_State *) sts[max_chn] )->side_bits_frame_channel ); move16(); } } diff --git a/lib_com/ivas_mdct_core_com.c b/lib_com/ivas_mdct_core_com.c index b98f3a470cd8a456705735e2831b72a209c0a1a5..a715790b8f2554e12acf62f890d19de54ba6c417 100644 --- a/lib_com/ivas_mdct_core_com.c +++ b/lib_com/ivas_mdct_core_com.c @@ -55,14 +55,23 @@ void ivas_mdct_tcx10_bit_distribution_fx( ) { Word16 k; - Word16 min_required_bits = add( add( NBITS_TCX_GAIN, i_mult2( NOISE_FILL_RANGES, NBITS_NOISE_FILL_LEVEL ) ), SMDCT_MINIMUM_ARITH_BITS ); + Word16 min_required_bits; + min_required_bits = add( add( NBITS_TCX_GAIN, i_mult2( NOISE_FILL_RANGES, NBITS_NOISE_FILL_LEVEL ) ), SMDCT_MINIMUM_ARITH_BITS ); FOR( k = 0; k < 2; k++ ) { - IF( nbits_tcx & 1 ) + IF( s_and( nbits_tcx, 1 ) ) { - target_bitsTCX10[k] = sub( add( shr( nbits_tcx, 1 ), ( k == 0 ? 1 : 0 ) ), nTnsBitsTCX10[k] ); - move16(); + IF( k == 0 ) + { + target_bitsTCX10[k] = sub( add( shr( nbits_tcx, 1 ), 1 ), nTnsBitsTCX10[k] ); + move16(); + } + ELSE + { + target_bitsTCX10[k] = sub( add( shr( nbits_tcx, 1 ), 0 ), nTnsBitsTCX10[k] ); + move16(); + } } ELSE { diff --git a/lib_com/ivas_mdct_imdct_fx.c b/lib_com/ivas_mdct_imdct_fx.c index c14432c0839aa787f3423fe0a202b55664b42fcf..cb64739e8987ec79f8479702c8dbc0f4fe7b7b61 100644 --- a/lib_com/ivas_mdct_imdct_fx.c +++ b/lib_com/ivas_mdct_imdct_fx.c @@ -69,7 +69,8 @@ void ivas_tda_fx( ) { Word16 i; - Word16 len_by_2 = shr( length, 1 ); + Word16 len_by_2; + len_by_2 = shr( length, 1 ); FOR( i = 0; i < len_by_2; i++ ) { @@ -101,19 +102,22 @@ void ivas_dct_windowing_fx( Word32 *pTemp_lfe ) { Word16 i; - Word16 rem_len = 0; + Word16 rem_len; + rem_len = 0; + move16(); Copy32( pBuffer_prev, pOut_buf + zero_pad_len, fade_len ); - Copy32( pTemp_lfe, ( pOut_buf + fade_len + zero_pad_len ), dct_len ); + Copy32( pTemp_lfe, ( pOut_buf + add( fade_len, zero_pad_len ) ), dct_len ); set32_fx( pOut_buf, 0, zero_pad_len ); - Copy32( ( pOut_buf + full_len - fade_len ), pBuffer_prev, fade_len ); + Copy32( ( pOut_buf + sub( full_len, fade_len ) ), pBuffer_prev, fade_len ); FOR( i = 0; i < fade_len; i++ ) { pOut_buf[add( zero_pad_len, i )] = Mult_32_32( pOut_buf[add( zero_pad_len, i )], pWindow_coeffs[i] ); + move32(); } rem_len = sub( full_len, ( add( i_mult( zero_pad_len, 3 ), fade_len ) ) ); @@ -121,6 +125,7 @@ void ivas_dct_windowing_fx( FOR( i = 0; i < rem_len; i++ ) { pOut_buf[add( add( i_mult( zero_pad_len, 3 ), fade_len ), i )] = Mult_32_32( pOut_buf[add( add( i_mult( zero_pad_len, 3 ), fade_len ), i )], pWindow_coeffs[sub( sub( fade_len, i ), 1 )] ); + move32(); } set32_fx( &pOut_buf[full_len], 0, sub( frame_len, full_len ) ); @@ -153,14 +158,18 @@ void ivas_mdct_fx( FOR( i = 0; i < len_by_2; i++ ) { - pOut[i] = L_sub( pIn[len_by_2 + i], pIn[len_by_2 - i - 1] ); - pOut[len_by_2 + i] = L_add( pIn[length * 2 - i - 1], pIn[length + i] ); + pOut[i] = L_sub( pIn[add( len_by_2, i )], pIn[sub( sub( len_by_2, i ), 1 )] ); + move32(); + pOut[add( len_by_2, i )] = L_add( pIn[sub( sub( imult1616( length, 2 ), i ), 1 )], pIn[add( length, i )] ); + move32(); } FOR( i = 0; i < len_by_2; i++ ) { - re[i] = L_negate( L_add( Mpy_32_16_1( pOut[2 * i], pTwid_re[i] ), Mpy_32_16_1( pOut[length - 1 - 2 * i], pTwid_im[i] ) ) ); - im[i] = L_sub( Mpy_32_16_1( pOut[length - 1 - 2 * i], pTwid_re[i] ), Mpy_32_16_1( pOut[2 * i], pTwid_im[i] ) ); + re[i] = L_negate( L_add( Mpy_32_16_1( pOut[2 * i], pTwid_re[i] ), Mpy_32_16_1( pOut[sub( sub( length, 1 ), imult1616( 2, i ) )], pTwid_im[i] ) ) ); + move32(); + im[i] = L_sub( Mpy_32_16_1( pOut[sub( sub( length, 1 ), imult1616( 2, i ) )], pTwid_re[i] ), Mpy_32_16_1( pOut[2 * i], pTwid_im[i] ) ); + move32(); } DoFFT_fx( &re[0], &im[0], len_by_2 ); @@ -168,21 +177,28 @@ void ivas_mdct_fx( FOR( i = 0; i < len_by_2; i++ ) { re[i] = Mult_32_32( re[i], ivas_mdct_scaling_gain ); + move32(); im[i] = Mult_32_32( im[i], ivas_mdct_scaling_gain ); + move32(); } - *q_out = *q_out + Q15; + *q_out = add( *q_out, Q15 ); + move16(); FOR( i = 0; i < len_by_2; i++ ) { Word32 tmp; tmp = L_sub( Mpy_32_16_1( re[i], pTwid_re[i] ), Mpy_32_16_1( im[i], pTwid_im[i] ) ); im[i] = L_add( Mpy_32_16_1( im[i], pTwid_re[i] ), Mpy_32_16_1( re[i], pTwid_im[i] ) ); + move32(); re[i] = tmp; + move32(); } FOR( i = 0; i < len_by_2; i++ ) { - pOut[length - 2 * i - 1] = re[i]; + pOut[sub( sub( length, imult1616( 2, i ) ), 1 )] = re[i]; + move32(); pOut[2 * i] = im[i]; + move32(); } return; @@ -201,23 +217,32 @@ static void ivas_ifft_cplx( const Word16 length ) { Word16 i; - Word32 ivas_imdct_one_by_powergain = IVAS_ONE_BY_IMDCT_SCALING_GAIN_Q16; + Word32 ivas_imdct_one_by_powergain; + ivas_imdct_one_by_powergain = IVAS_ONE_BY_IMDCT_SCALING_GAIN_Q16; + move32(); /*re-arrange inputs to use fft as ifft */ re[0] = Mult_32_32( re[0], ivas_imdct_one_by_powergain ); + move32(); im[0] = Mult_32_32( im[0], ivas_imdct_one_by_powergain ); + move32(); FOR( i = 1; i <= shr( length, 1 ); i++ ) { - Word32 tmp = Mult_32_32( re[length - i], ivas_imdct_one_by_powergain ); - re[length - i] = Mult_32_32( re[i], ivas_imdct_one_by_powergain ); + Word32 tmp; + tmp = Mult_32_32( re[sub( length, i )], ivas_imdct_one_by_powergain ); + re[sub( length, i )] = Mult_32_32( re[i], ivas_imdct_one_by_powergain ); + move32(); re[i] = tmp; + move32(); - tmp = Mult_32_32( im[length - i], ivas_imdct_one_by_powergain ); - im[length - i] = Mult_32_32( im[i], ivas_imdct_one_by_powergain ); + tmp = Mult_32_32( im[sub( length, i )], ivas_imdct_one_by_powergain ); + im[sub( length, i )] = Mult_32_32( im[i], ivas_imdct_one_by_powergain ); + move32(); im[i] = tmp; + move32(); } - DoFFT_fx( re, im, (Word16) length ); + DoFFT_fx( re, im, length ); return; } @@ -236,14 +261,19 @@ void ivas_itda_fx( ) { Word16 i; - Word16 len_by_2 = shr( length, 1 ); + Word16 len_by_2; + len_by_2 = shr( length, 1 ); FOR( i = 0; i < len_by_2; i++ ) { - pOut[i] = -re[len_by_2 - i - 1]; - pOut[len_by_2 + i] = re[i]; - pOut[length + i] = re[len_by_2 + i]; - pOut[3 * len_by_2 + i] = re[length - i - 1]; + pOut[i] = L_negate( re[sub( sub( len_by_2, i ), 1 )] ); + move32(); + pOut[add( len_by_2, i )] = re[i]; + move32(); + pOut[add( length, i )] = re[add( len_by_2, i )]; + move32(); + pOut[add( imult1616( 3, len_by_2 ), i )] = re[sub( sub( length, i ), 1 )]; + move32(); } return; @@ -263,23 +293,27 @@ void ivas_imdct_fx( Word16 *q_out ) { const Word16 *pTwid_re, *pTwid_im; - Word16 len_by_2 = shr( length, 1 ); + Word16 len_by_2; Word16 i; Word32 re[IVAS_480_PT_LEN]; Word32 im[IVAS_480_PT_LEN]; + len_by_2 = shr( length, 1 ); ivas_get_twid_factors_fx1( length, &pTwid_re, &pTwid_im ); FOR( i = 0; i < len_by_2; i++ ) { - re[i] = L_add( Mpy_32_16_1( pIn[length - 2 * i - 1], pTwid_re[i] ), Mpy_32_16_1( pIn[2 * i], pTwid_im[i] ) ); /*stl_arr_index*/ - im[i] = L_sub( Mpy_32_16_1( pIn[2 * i], pTwid_re[i] ), Mpy_32_16_1( pIn[length - 2 * i - 1], pTwid_im[i] ) ); /*stl_arr_index*/ + re[i] = L_add( Mpy_32_16_1( pIn[sub( sub( length, imult1616( 2, i ) ), 1 )], pTwid_re[i] ), Mpy_32_16_1( pIn[2 * i], pTwid_im[i] ) ); /*stl_arr_index*/ + move32(); + im[i] = L_sub( Mpy_32_16_1( pIn[2 * i], pTwid_re[i] ), Mpy_32_16_1( pIn[sub( sub( length, imult1616( 2, i ) ), 1 )], pTwid_im[i] ) ); /*stl_arr_index*/ + move32(); } ivas_ifft_cplx( &re[0], &im[0], len_by_2 ); - IF( GT_16( len_by_2, 0 ) ) + IF( len_by_2 > 0 ) { - *q_out = *q_out - Q15; + *q_out = sub( *q_out, Q15 ); + move16(); } FOR( i = 0; i < len_by_2; i++ ) @@ -287,21 +321,29 @@ void ivas_imdct_fx( Word32 tmp; tmp = L_add( Mpy_32_16_1( re[i], pTwid_re[i] ), Mpy_32_16_1( im[i], pTwid_im[i] ) ); im[i] = L_sub( Mpy_32_16_1( im[i], pTwid_re[i] ), Mpy_32_16_1( re[i], pTwid_im[i] ) ); + move32(); re[i] = tmp; + move32(); } FOR( i = ( len_by_2 - 1 ); i >= 0; i-- ) { - re[2 * i + 1] = im[( len_by_2 - 1 ) - i]; - re[2 * i] = -re[i]; + re[add( imult1616( 2, i ), 1 )] = im[sub( sub( len_by_2, 1 ), i )]; + move32(); + re[imult1616( 2, i )] = L_negate( re[i] ); + move32(); } FOR( i = 0; i < len_by_2; i++ ) { - pOut[i] = -re[len_by_2 - i - 1]; - pOut[len_by_2 + i] = re[i]; - pOut[length + i] = re[len_by_2 + i]; - pOut[3 * len_by_2 + i] = re[length - i - 1]; + pOut[i] = L_negate( re[sub( sub( len_by_2, i ), 1 )] ); + move32(); + pOut[add( len_by_2, i )] = re[i]; + move32(); + pOut[add( length, i )] = re[add( len_by_2, i )]; + move32(); + pOut[add( imult1616( 3, len_by_2 ), i )] = re[sub( sub( length, i ), 1 )]; + move32(); } return; @@ -357,23 +399,28 @@ void ivas_get_twid_factors_fx1( Word32 ivas_get_mdct_scaling_gain_fx( const Word16 dct_len_by_2 ) { - Word32 gain = 0; + Word32 gain; + gain = 0; + move32(); SWITCH( dct_len_by_2 ) { case L_FRAME48k >> 2: { gain = IVAS_MDCT_SCALING_GAIN_48k_Q46; + move32(); BREAK; } case L_FRAME32k >> 2: { gain = IVAS_MDCT_SCALING_GAIN_32k_Q46; + move32(); BREAK; } case L_FRAME16k >> 2: { gain = IVAS_MDCT_SCALING_GAIN_16k_Q46; + move32(); BREAK; } default: diff --git a/lib_com/ivas_mdft_imdft.c b/lib_com/ivas_mdft_imdft.c index ab93395231c61ba4b21082b67ae4980d533f3c30..2a785bd342fc48f803b07c18bb150efee7cefea9 100644 --- a/lib_com/ivas_mdft_imdft.c +++ b/lib_com/ivas_mdft_imdft.c @@ -48,6 +48,9 @@ #define fix_to_float( n, factor ) ( (float) n / ( 1 << factor ) ) #define SHC( x ) ( (Word16) x ) #endif +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif /*-----------------------------------------------------------------------------------------* * Local constants @@ -77,14 +80,13 @@ static void ivas_get_mdft_twid_factors_fx( const Word16 length, const Word32 **ppTwid ) { - switch ( length ) + SWITCH( length ) { case L_FRAME48k: *ppTwid = &ivas_mdft_coeff_cos_twid_960_fx[0]; break; case L_FRAME32k: *ppTwid = &ivas_mdft_coeff_cos_twid_640_fx[0]; - break; case L_FRAME16k: *ppTwid = &ivas_mdft_coeff_cos_twid_320_fx[0]; @@ -104,7 +106,6 @@ static void ivas_get_mdft_twid_factors_fx( case IVAS_40_PT_LEN: *ppTwid = &ivas_mdft_coeff_cos_twid_40_fx[0]; break; - default: assert( !"Not supported FFT length!" ); break; @@ -122,7 +123,7 @@ static void ivas_get_imdft_twid_factors_fx( const Word16 length, const Word32 **ppTwid ) { - switch ( length ) + SWITCH( length ) { case L_FRAME48k: *ppTwid = ivas_mdft_coeff_cos_twid_960_fx; @@ -271,31 +272,37 @@ static void get_one_by_length_fx( Word32 *one_by_length, const Word16 length ) { - if ( length == L_FRAME48k ) + IF( EQ_16( length, L_FRAME48k ) ) { *one_by_length = IVAS_ONE_BY_960_Q37; + move32(); } - else if ( length == L_FRAME32k ) + ELSE IF( EQ_16( length, L_FRAME32k ) ) { *one_by_length = IVAS_ONE_BY_640_Q37; + move32(); } - else if ( length == L_FRAME16k ) + ELSE IF( EQ_16( length, L_FRAME16k ) ) { *one_by_length = IVAS_ONE_BY_320_Q37; + move32(); } - else if ( length == IVAS_240_PT_LEN ) + ELSE IF( EQ_16( length, IVAS_240_PT_LEN ) ) { *one_by_length = IVAS_ONE_BY_240_Q37; + move32(); } - else if ( length == IVAS_160_PT_LEN ) + ELSE IF( EQ_16( length, IVAS_160_PT_LEN ) ) { *one_by_length = IVAS_ONE_BY_160_Q37; + move32(); } - else if ( length == IVAS_80_PT_LEN ) + ELSE IF( EQ_16( length, IVAS_80_PT_LEN ) ) { *one_by_length = IVAS_ONE_BY_80_Q37; + move32(); } - else + ELSE { assert( !"Not supported FFT length!" ); } @@ -320,17 +327,23 @@ static void ivas_ifft_cplx1_fx( /* re-arrange inputs to use fft as ifft */ re[0] = Mpy_32_32( re[0], one_by_length ); + move32(); im[0] = Mpy_32_32( im[0], one_by_length ); + move32(); - for ( i = 1; i <= length >> 1; i++ ) + FOR( i = 1; i <= length >> 1; i++ ) { - tmp = Mpy_32_32( re[length - i], one_by_length ); /*stl_arr_index*/ - re[length - i] = Mpy_32_32( re[i], one_by_length ); /*stl_arr_index*/ + tmp = Mpy_32_32( re[sub( length, i )], one_by_length ); /*stl_arr_index*/ + re[sub( length, i )] = Mpy_32_32( re[i], one_by_length ); /*stl_arr_index*/ + move32(); re[i] = tmp; + move32(); - tmp = Mpy_32_32( im[length - i], one_by_length ); /*stl_arr_index*/ - im[length - i] = Mpy_32_32( im[i], one_by_length ); /*stl_arr_index*/ + tmp = Mpy_32_32( im[sub( length, i )], one_by_length ); /*stl_arr_index*/ + im[sub( length, i )] = Mpy_32_32( im[i], one_by_length ); /*stl_arr_index*/ + move32(); im[i] = tmp; + move32(); } fft_fx( re, im, length, 1 ); @@ -358,34 +371,42 @@ void ivas_mdft_fx( Word32 im[L_FRAME48k]; Word16 j, len_by_2; const Word32 *pTwid; - len_by_2 = mdft_length >> 1; + len_by_2 = shr( mdft_length, 1 ); ivas_get_mdft_twid_factors_fx( mdft_length, &pTwid ); - if ( mdft_length == input_length ) + IF( EQ_16( mdft_length, input_length ) ) { - for ( j = 0; j < mdft_length; j++ ) + FOR( j = 0; j < mdft_length; j++ ) { re[j] = Mpy_32_32( pIn[j], pTwid[j] ); - im[j] = Mpy_32_32( -pIn[j], pTwid[mdft_length - j] ); + move32(); + im[j] = Mpy_32_32( L_negate( pIn[j] ), pTwid[sub( mdft_length, j )] ); + move32(); } } - else + ELSE { - for ( j = 0; j < mdft_length; j++ ) + FOR( j = 0; j < mdft_length; j++ ) { - re[j] = Msub_32_32( Mpy_32_32( pIn[j], pTwid[j] ), pIn[j + mdft_length], pTwid[mdft_length - j] ); - im[j] = Msub_32_32( Mpy_32_32( -pIn[j], pTwid[mdft_length - j] ), pIn[j + mdft_length], pTwid[j] ); + re[j] = Msub_32_32( Mpy_32_32( pIn[j], pTwid[j] ), pIn[add( mdft_length, j )], pTwid[sub( mdft_length, j )] ); + move32(); + im[j] = Msub_32_32( Mpy_32_32( L_negate( pIn[j] ), pTwid[sub( mdft_length, j )] ), pIn[add( mdft_length, j )], pTwid[j] ); + move32(); } } fft_fx( re, im, mdft_length, 1 ); - for ( j = 0; j < len_by_2; j++ ) + FOR( j = 0; j < len_by_2; j++ ) { pOut_re[2 * j] = re[j]; - pOut_re[2 * j + 1] = re[mdft_length - j - 1]; + move32(); + pOut_re[add( imult1616( 2, j ), 1 )] = re[sub( sub( mdft_length, j ), 1 )]; + move32(); pOut_im[2 * j] = im[j]; - pOut_im[2 * j + 1] = -im[mdft_length - j - 1]; + move32(); + pOut_im[add( imult1616( 2, j ), 1 )] = L_negate( im[sub( sub( mdft_length, j ), 1 )] ); + move32(); } return; } @@ -408,28 +429,35 @@ void ivas_imdft_fx( Word32 *re_tmp = pOut; Word32 *im_tmp = pOut + length; Word32 tmp; - Word32 j; - Word32 len_by_2 = length >> 1; + Word16 j; + Word16 len_by_2; const Word32 *pTwid; + len_by_2 = shr( length, 1 ); ivas_get_imdft_twid_factors_fx( length, &pTwid ); - for ( j = 0; j < len_by_2; j++ ) + FOR( j = 0; j < len_by_2; j++ ) { re_tmp[j] = pRe[2 * j]; - re_tmp[j + len_by_2] = pRe[length - 2 * j - 1]; + move32(); + re_tmp[add( j, len_by_2 )] = pRe[sub( sub( length, imult1616( 2, j ) ), 1 )]; + move32(); im_tmp[j] = pIm[2 * j]; - im_tmp[j + len_by_2] = -pIm[length - 2 * j - 1]; + move32(); + im_tmp[add( j, len_by_2 )] = L_negate( pIm[sub( sub( length, imult1616( 2, j ) ), 1 )] ); + move32(); } ivas_ifft_cplx1_fx( re_tmp, im_tmp, length ); - for ( j = 0; j < length; j++ ) + FOR( j = 0; j < length; j++ ) { - tmp = Msub_32_32( Mpy_32_32( re_tmp[j] >> 6, pTwid[j] ), im_tmp[j] >> 6, pTwid[length - j] ); - im_tmp[j] = -( Madd_32_32( Mpy_32_32( re_tmp[j] >> 6, pTwid[length - j] ), im_tmp[j] >> 6, pTwid[j] ) ); + tmp = Msub_32_32( Mpy_32_32( L_shr( re_tmp[j], Q6 ), pTwid[j] ), L_shr( im_tmp[j], Q6 ), pTwid[sub( length, j )] ); + im_tmp[j] = L_negate( Madd_32_32( Mpy_32_32( L_shr( re_tmp[j], Q6 ), pTwid[sub( length, j )] ), L_shr( im_tmp[j], Q6 ), pTwid[j] ) ); + move32(); re_tmp[j] = tmp; + move32(); } return; } diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index afdac0d9bc934bdab993ab1eb7f5cac23dc75285..d7f25bfbb4fd0470c82e493f62a6cf50ff957d34 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -95,7 +95,7 @@ ISM_MODE ivas_omasa_ism_mode_select_fx( ) { ISM_MODE ism_mode = ISM_MODE_NONE; - move16(); + move32(); SWITCH( nchan_ism ) { @@ -103,73 +103,73 @@ ISM_MODE ivas_omasa_ism_mode_select_fx( IF( GE_32( ivas_total_brate, IVAS_24k4 ) ) { ism_mode = ISM_MASA_MODE_DISC; - move16(); + move32(); } ELSE { ism_mode = ISM_MODE_NONE; - move16(); + move32(); } BREAK; case 2: IF( GE_32( ivas_total_brate, IVAS_48k ) ) { ism_mode = ISM_MASA_MODE_DISC; - move16(); + move32(); } ELSE IF( GE_32( ivas_total_brate, IVAS_32k ) ) { ism_mode = ISM_MASA_MODE_PARAM_ONE_OBJ; - move16(); + move32(); } ELSE { ism_mode = ISM_MODE_NONE; - move16(); + move32(); } BREAK; case 3: IF( GE_32( ivas_total_brate, IVAS_96k ) ) { ism_mode = ISM_MASA_MODE_DISC; - move16(); + move32(); } ELSE IF( GE_32( ivas_total_brate, IVAS_64k ) ) { ism_mode = ISM_MASA_MODE_PARAM_ONE_OBJ; - move16(); + move32(); } ELSE IF( GE_32( ivas_total_brate, IVAS_32k ) ) { ism_mode = ISM_MASA_MODE_MASA_ONE_OBJ; - move16(); + move32(); } ELSE { ism_mode = ISM_MODE_NONE; - move16(); + move32(); } BREAK; case 4: IF( GE_32( ivas_total_brate, IVAS_128k ) ) { ism_mode = ISM_MASA_MODE_DISC; - move16(); + move32(); } ELSE IF( GE_32( ivas_total_brate, IVAS_64k ) ) { ism_mode = ISM_MASA_MODE_PARAM_ONE_OBJ; - move16(); + move32(); } ELSE IF( GE_32( ivas_total_brate, IVAS_32k ) ) { ism_mode = ISM_MASA_MODE_MASA_ONE_OBJ; - move16(); + move32(); } ELSE { ism_mode = ISM_MODE_NONE; - move16(); + move32(); } BREAK; } @@ -661,8 +661,10 @@ void ivas_combined_format_brate_sanity_fx( nBits = extract_l( Mpy_32_32( *core_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ); *diff_nBits = sub( nBits, limit_high ); + move16(); IF( *diff_nBits > 0 ) { + test(); IF( EQ_16( core, TCX_20_CORE ) || EQ_16( core, TCX_10_CORE ) ) { *diff_nBits = 0; @@ -671,6 +673,7 @@ void ivas_combined_format_brate_sanity_fx( ELSE /* ACELP core */ { *core_brate = L_sub( *core_brate, L_mult0( *diff_nBits, FRAMES_PER_SEC ) ); + move32(); } } } @@ -883,6 +886,12 @@ void calculate_nbits_meta( static Word16 get_bits_ism( Word32 val ) { Word16 res; + test(); + test(); + test(); + test(); + test(); + test(); IF( LE_32( val, 536870912 ) && GT_32( val, 447750340 ) ) { res = 0; @@ -1038,19 +1047,22 @@ void get_panning_gain( const Word16 sinAngleMapped, Word16 *panningGains ) { - Word16 tbl_len = 601; - Word16 idx = shr( tbl_len, 1 ); + Word16 tbl_len, idx, lim_l, lim_r; const Word16 *ptr_sin = &ivas_sine_panning_tbl_fx[0]; const Word16 *ptr_tan_0 = ivas_tan_panning_gain_tbl_fx; - Word16 lim_l = 0; + tbl_len = 601; move16(); - Word16 lim_r = tbl_len; + idx = shr( tbl_len, 1 ); + lim_l = 0; + move16(); + lim_r = tbl_len; move16(); WHILE( 1 ) { idx = shr( add( lim_l, lim_r ), 1 ); + test(); IF( GE_16( idx, tbl_len ) ) { panningGains[0] = ptr_tan_0[tbl_len - 1]; @@ -1059,7 +1071,7 @@ void get_panning_gain( move16(); BREAK; } - ELSE IF( LT_16( idx, 0 ) ) + ELSE IF( idx < 0 ) { panningGains[0] = ptr_tan_0[0]; move16(); @@ -1073,7 +1085,7 @@ void get_panning_gain( { panningGains[0] = ptr_tan_0[idx + 1]; move16(); - panningGains[1] = ptr_tan_0[tbl_len - idx - 2]; + panningGains[1] = ptr_tan_0[sub( sub( tbl_len, idx ), 2 )]; move16(); BREAK; } @@ -1081,25 +1093,26 @@ void get_panning_gain( { panningGains[0] = ptr_tan_0[idx]; move16(); - panningGains[1] = ptr_tan_0[tbl_len - idx - 1]; + panningGains[1] = ptr_tan_0[sub( sub( tbl_len, idx ), 1 )]; move16(); BREAK; } ELSE { - Word16 mid = extract_l( L_shr( L_add( L_deposit_l( ptr_sin[idx] ), L_deposit_l( ptr_sin[idx + 1] ) ), 1 ) ); + Word16 mid; + mid = extract_l( L_shr( L_add( L_deposit_l( ptr_sin[idx] ), L_deposit_l( ptr_sin[idx + 1] ) ), 1 ) ); IF( LE_16( sinAngleMapped, mid ) ) { panningGains[0] = ptr_tan_0[idx]; move16(); - panningGains[1] = ptr_tan_0[tbl_len - idx - 1]; + panningGains[1] = ptr_tan_0[sub( sub( tbl_len, idx ), 1 )]; move16(); } ELSE { panningGains[0] = ptr_tan_0[idx + 1]; move16(); - panningGains[1] = ptr_tan_0[tbl_len - idx - 2]; + panningGains[1] = ptr_tan_0[sub( sub( tbl_len, idx ), 2 )]; move16(); } BREAK; @@ -1147,7 +1160,8 @@ void ivas_get_stereo_panning_gains_fx( azSubEl = add( azSubEl, 360 ); } // sin_az_cos_el = (ptr_sin_az[azAddEl] + ptr_sin_az[azSubEl])/2; - Word16 sin_az_cos_el = extract_l( L_shr( L_add( L_deposit_l( ptr_sin_az[azAddEl + 180] ), L_deposit_l( ptr_sin_az[azSubEl + 180] ) ), 1 ) ); + Word16 sin_az_cos_el; + sin_az_cos_el = extract_l( L_shr( L_add( L_deposit_l( ptr_sin_az[azAddEl + 180] ), L_deposit_l( ptr_sin_az[azSubEl + 180] ) ), 1 ) ); IF( GE_16( sin_az_cos_el, SIN_30_DEGREES_Q15 ) ) { /* Left side */ @@ -1198,13 +1212,14 @@ Word16 calculate_brate_limit_flag_fx( FOR( n = 0; n < nchan_ism; n++ ) { brate_limit_flag = add( brate_limit_flag, ism_imp[n] ); - if ( ism_imp[n] == 0 ) + IF( ism_imp[n] == 0 ) { nzeros = add( nzeros, 1 ); } } nchan_ism_sat = nchan_ism; - if ( EQ_16( nchan_ism & 1, 1 ) ) + move16(); + IF( EQ_16( s_and( nchan_ism, 1 ), 1 ) ) { nchan_ism_sat = sub( nchan_ism, 1 ); } diff --git a/lib_com/ivas_pca_tools.c b/lib_com/ivas_pca_tools.c index 98db76f4b8c28a6207e500248f76b827f556bbe9..2fa1f11f013381709393ebbff8db49a5b27f08a1 100644 --- a/lib_com/ivas_pca_tools.c +++ b/lib_com/ivas_pca_tools.c @@ -82,7 +82,7 @@ void eye_matrix_fx( } FOR( i = 0; i < n; i++ ) { - mat[i * n + i] = d; + mat[add( imult1616( i, n ), i )] = d; move16(); } @@ -606,21 +606,37 @@ void dquat2mat_fx( dy = mult( d, y ); dz = mult( d, z ); m[0] = sub( sub( aw, bx ), add( cy, dz ) ); + move16(); m[1] = sub( sub( cz, dy ), add( ax, bw ) ); - m[2] = add( sub( sub( -ay, bz ), cw ), dx ); + move16(); + m[2] = add( sub( sub( negate( ay ), bz ), cw ), dx ); + move16(); m[3] = sub( sub( by, az ), add( cx, dw ) ); + move16(); m[4] = add( sub( add( bw, ax ), dy ), cz ); - m[5] = add( add( add( -bx, aw ), dz ), cy ); - m[6] = sub( sub( add( -by, az ), dw ), cx ); - m[7] = add( sub( sub( -bz, ay ), dx ), cw ); + move16(); + m[5] = add( add( add( negate( bx ), aw ), dz ), cy ); + move16(); + m[6] = sub( sub( add( negate( by ), az ), dw ), cx ); + move16(); + m[7] = add( sub( sub( negate( bz ), ay ), dx ), cw ); + move16(); m[8] = sub( add( add( cw, dx ), ay ), bz ); - m[9] = sub( sub( add( -cx, dw ), az ), by ); - m[10] = add( add( add( -cy, dz ), aw ), bx ); - m[11] = sub( add( sub( -cz, dy ), ax ), bw ); + move16(); + m[9] = sub( sub( add( negate( cx ), dw ), az ), by ); + move16(); + m[10] = add( add( add( negate( cy ), dz ), aw ), bx ); + move16(); + m[11] = sub( add( sub( negate( cz ), dy ), ax ), bw ); + move16(); m[12] = add( add( sub( dw, cx ), by ), az ); - m[13] = add( sub( sub( -dx, cw ), bz ), ay ); - m[14] = sub( add( sub( -dy, cz ), bw ), ax ); - m[15] = add( add( add( -dz, cy ), bx ), aw ); + move16(); + m[13] = add( sub( sub( negate( dx ), cw ), bz ), ay ); + move16(); + m[14] = sub( add( sub( negate( dy ), cz ), bw ), ax ); + move16(); + m[15] = add( add( add( negate( dz ), cy ), bx ), aw ); + move16(); return; } @@ -691,23 +707,28 @@ void quat_shortestpath_fx( { Word32 d0, d1; Word16 res, i; - Word16 exp1 = 0, exp2 = 0; + Word16 exp1, exp2; + exp1 = 0; + move16(); + exp2 = 0; + move16(); d0 = dotp_fx( q00, q01, IVAS_PCA_INTERP, &exp1 ); d1 = dotp_fx( q10, q11, IVAS_PCA_INTERP, &exp2 ); res = 0; move16(); - IF( LT_32( d0, 0 ) && LT_32( d1, 0 ) ) + test(); + IF( d0 < 0 && d1 < 0 ) { res = 1; move16(); } ELSE { - IF( LT_32( d0, 0 ) ) + IF( d0 < 0 ) { - IF( GT_32( ( -d0 ), d1 ) ) + if ( GT_32( L_negate( d0 ), d1 ) ) { res = 1; move16(); @@ -715,9 +736,9 @@ void quat_shortestpath_fx( } ELSE { - IF( LT_32( d1, 0 ) ) + IF( d1 < 0 ) { - IF( GT_32( ( -d1 ), d0 ) ) + if ( GT_32( L_negate( d1 ), d0 ) ) { res = 1; move16(); @@ -730,9 +751,9 @@ void quat_shortestpath_fx( { FOR( i = 0; i < IVAS_PCA_INTERP; i++ ) { - q01[i] = -q01[i]; + q01[i] = negate( q01[i] ); move16(); - q11[i] = -q11[i]; + q11[i] = negate( q11[i] ); move16(); } } @@ -802,14 +823,17 @@ static void norm_quat_fx( Word16 *q ) { Word32 norm_q; - Word16 i, exp1 = 0; + Word16 i, exp1; + exp1 = 0; + move16(); norm_q = dotp_fx( q, q, IVAS_PCA_INTERP, &exp1 ); - exp1 = ( 31 - ( exp1 + 2 ) ); + exp1 = sub( 31, add( exp1, 2 ) ); norm_q = ISqrt32( norm_q, &exp1 ); /*q(15 - exp)*/ FOR( i = 0; i < IVAS_PCA_INTERP; i++ ) { - q[i] = mult( q[i], (Word16) L_shr( norm_q, 15 ) ); // todo : recheck + q[i] = mult( q[i], extract_l( L_shr( norm_q, 15 ) ) ); // todo : recheck + move16(); } return; @@ -846,11 +870,15 @@ static void quat_nlerp_preproc_fx( FOR( i = 0; i < IVAS_PCA_INTERP; i++ ) { - tmp1 = mult( ( MAX_16 - alpha ), q1[i] ); + tmp1 = mult( sub( MAX_16, alpha ), q1[i] ); tmp2 = mult_r( alpha, q0[i] ); - IF( ( alpha == q0[i] ) && ( alpha == 32767 ) ) - tmp2 = 32767; + if ( EQ_16( alpha, q0[i] ) && EQ_16( alpha, 32767 ) ) + { + tmp2 = 32767; + move16(); + } q_slerp[i] = add( tmp1, tmp2 ); + move16(); } norm_quat_fx( q_slerp ); @@ -898,13 +926,15 @@ void pca_interp_preproc_fx( FOR( j = 0; j < len; j++ ) { tmp = sub( len, 1 ); - IF( EQ_16( j, 0 ) ) + IF( j == 0 ) { alpha = 0; move16(); } ELSE - alpha = idiv1616( j, tmp ); // the increment can be updated by simple delta //q15 + { + alpha = idiv1616( j, tmp ); // the increment can be updated by simple delta //q15 + } tmp2 = mult( EVS_PI_FX, alpha ); // q13 tmp3 = getCosWord16( tmp2 ); // q14 alpha = shr( sub( ONE_IN_Q14, tmp3 ), 1 ); // q15 @@ -960,9 +990,13 @@ static void sp2cart_fx( s2 = getSinWord16( ph2 ); // q15 s1s2 = mult( s1, s2 ); // q15 q[3] = mult( getSinWord16( ph3 ), s1s2 ); // q15 + move16(); q[2] = mult( getCosWord16( ph3 ), s1s2 ); // q15 - q[1] = mult( getCosWord16( ph2 ), s1 ); // q15 + move16(); + q[1] = mult( getCosWord16( ph2 ), s1 ); // q15 + move16(); q[0] = shl_sat( getCosWord16( ph1 ), 1 ); // q15 + move16(); return; } @@ -986,10 +1020,11 @@ static Word16 calc_n2_fx( const Word16 ph1 ) { Word16 n2; - Word32 temp = L_mult( 23040, getSinWord16( ph1 ) ); // q8 + Word32 temp; + temp = L_mult( 23040, getSinWord16( ph1 ) ); // q8 n2 = round_fx( temp ); n2 = shr( n2, 7 ); - IF( EQ_16( s_and( n2, 1 ), 0 ) ) + IF( s_and( n2, 1 ) == 0 ) { n2 = add( n2, 1 ); } @@ -1031,14 +1066,14 @@ static Word16 calc_n3_fx( n3 = shr( n3, 8 ); - IF( EQ_16( n3, 0 ) ) + IF( n3 == 0 ) { n3 = 1; move16(); } ELSE { - IF( ( s_and( n3, 1 ) ) == 1 ) + IF( EQ_16( s_and( n3, 1 ), 1 ) ) { n3 = add( n3, 1 ); } @@ -1215,7 +1250,7 @@ static Word16 get_pca_offset_n2_fx( } ELSE { - index2 = ivas_pca_offset_n2[IVAS_PCA_N1 - 1 - index1]; + index2 = ivas_pca_offset_n2[sub( sub( IVAS_PCA_N1, 1 ), index1 )]; move16(); } @@ -1436,11 +1471,11 @@ void pca_dec_s3_fx( move16(); FOR( i = 0; i < IVAS_PCA_N1; i++ ) { - IF( j < ivas_pca_offset_index1[i + 1] ) + IF( LT_32( j, ivas_pca_offset_index1[i + 1] ) ) { index1 = i; move16(); - break; + BREAK; } } @@ -1448,7 +1483,9 @@ void pca_dec_s3_fx( n1 = IVAS_PCA_N1; move16(); - Word16 num_fx = 12868; + Word16 num_fx; + num_fx = 12868; + move16(); d_fx = idiv1616( num_fx, n1 ); // Q12 ph1_q_fx = i_mult( index1, d_fx ); // Q12 @@ -1460,11 +1497,11 @@ void pca_dec_s3_fx( move16(); FOR( i = 0; i < n2; i++ ) { - IF( j < ivas_pca_offset_index2[i + get_pca_offset_n2_fx( index1 ) + 1] ) + IF( LT_32( j, L_deposit_l( ivas_pca_offset_index2[add( add( i, get_pca_offset_n2_fx( index1 ) ), 1 )] ) ) ) { index2 = i; move16(); - break; + BREAK; } } @@ -1484,10 +1521,10 @@ void pca_dec_s3_fx( ph2_q_fx = i_mult( index2, d_fx ); // Q12 } - j = L_sub( j, ivas_pca_offset_index2[index2 + get_pca_offset_n2_fx( index1 )] ); + j = L_sub( j, ivas_pca_offset_index2[add( index2, get_pca_offset_n2_fx( index1 ) )] ); + + index3 = extract_l( j ); - index3 = (Word16) j; - move16(); n3 = calc_n3_fx( ph1_q_fx, ph2_q_fx ); IF( EQ_16( n3, 1 ) ) diff --git a/lib_com/ivas_qmetadata_com.c b/lib_com/ivas_qmetadata_com.c index bc998fed5a6500d5d1b088639efa50d3e9578293..dcd68f04b8e062c677f4df9d026aab957a932cac 100644 --- a/lib_com/ivas_qmetadata_com.c +++ b/lib_com/ivas_qmetadata_com.c @@ -45,8 +45,11 @@ #include "prot_fx2.h" #include "ivas_prot_fx.h" #endif +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif -//#include "debug.h" +// #include "debug.h" /*-----------------------------------------------------------------------* * Local constants @@ -139,6 +142,7 @@ ivas_error ivas_qmetadata_allocate_memory( ELSE { do_realloc = TRUE; + move16(); } IF( do_realloc ) @@ -146,6 +150,7 @@ ivas_error ivas_qmetadata_allocate_memory( ivas_qmetadata_free_memory( hQMetaData ); hQMetaData->numCodingBands = (UWord8) nbands; + move16(); hQMetaData->no_directions = ndirs; move16(); hQMetaData->coherence_flag = coherence_flag; @@ -160,7 +165,7 @@ ivas_error ivas_qmetadata_allocate_memory( { hQMetaData->q_direction[dir].cfg.nbands = nbands; move16(); - IF( EQ_16( nbands, 0 ) ) + IF( nbands == 0 ) { hQMetaData->q_direction[dir].band_data = NULL; } @@ -427,6 +432,7 @@ void ivas_qmetadata_close( IVAS_QMETADATA_HANDLE *hQMetaData /* i/o: q_metadata handle */ ) { + test(); IF( hQMetaData == NULL || *hQMetaData == NULL ) { return; @@ -547,10 +553,10 @@ ivas_error only_reduce_bits_direction_fx( delta = 1; move16(); - IF( GT_16( reduce_bits, 0 ) ) + IF( reduce_bits > 0 ) { - red_times = reduce_bits / ( coding_subbands * no_subframes ); /* number of complete reductions by 1 bit */ - IF( GT_16( red_times, 0 ) ) + red_times = idiv1616( reduce_bits, imult1616( coding_subbands, no_subframes ) ); /* number of complete reductions by 1 bit */ + IF( red_times > 0 ) { FOR( j = 0; j < coding_subbands; j++ ) { @@ -582,14 +588,15 @@ ivas_error only_reduce_bits_direction_fx( bits_dir0 = (Word16 *) q_direction->band_data[j].bits_sph_idx; FOR( k = 0; k < no_subframes; k++ ) { + test(); IF( LT_16( n, rem ) && GT_16( bits_dir0[k], sub( MASA_MIN_BITS_TF, delta ) ) ) { bits_dir0[k] = sub( bits_dir0[k], 1 ); move16(); - n++; + n = add( n, 1 ); } - IF( LT_16( max_nb, bits_dir0[k] ) ) + if ( LT_16( max_nb, bits_dir0[k] ) ) { max_nb = bits_dir0[k]; move16(); @@ -635,7 +642,9 @@ ivas_error only_reduce_bits_direction_fx( FOR( j = 0; j < m; j++ ) { index1 = ind_order[j]; + move16(); index2 = ind_order[j + 1]; + move16(); tmp = 0; move16(); FOR( k = 0; k < no_subframes; k++ ) @@ -643,6 +652,7 @@ ivas_error only_reduce_bits_direction_fx( tmp = add( tmp, sub( bits_sph_idx_orig[index1][k], q_direction->band_data[index1].bits_sph_idx[k] ) ); } penalty[0] = L_shr( W_extract_l( W_mult_32_16( tmp, bits_sph_idx_orig[index2][0] ) ), 1 ); + move32(); tmp = 0; move16(); FOR( k = 0; k < no_subframes; k++ ) @@ -650,6 +660,7 @@ ivas_error only_reduce_bits_direction_fx( tmp = add( tmp, sub( bits_sph_idx_orig[index2][k], q_direction->band_data[index2].bits_sph_idx[k] ) ); } penalty[1] = L_shr( W_extract_l( W_mult_32_16( tmp, bits_sph_idx_orig[index1][0] ) ), 1 ); + move32(); IF( LT_32( penalty[0], penalty[1] ) ) { sorted = 0; @@ -691,7 +702,7 @@ ivas_error only_reduce_bits_direction_fx( move16(); FOR( k = 0; k < no_subframes; k++ ) { - IF( GT_16( bits_sph_idx_orig[j][k], 0 ) ) + IF( bits_sph_idx_orig[j][k] > 0 ) { tmp = add( tmp, sub( bits_sph_idx_orig[j][k], q_direction->band_data[j].bits_sph_idx[k] ) ); } @@ -709,7 +720,7 @@ ivas_error only_reduce_bits_direction_fx( { FOR( k = 0; k < no_subframes; k++ ) { - IF( GT_16( bits_sph_idx_orig[j][k], 0 ) ) + IF( bits_sph_idx_orig[j][k] > 0 ) { tmp = BASOP_Util_Divide3232_Scale( extract_l( L_sub( bits_sph_idx_orig[j][k], q_direction->band_data[j].bits_sph_idx[k] ) ), bits_sph_idx_orig[j][k], &tmp_e ); tmp_32 = L_add( tmp_32, L_shl( tmp, tmp_e ) ); @@ -725,6 +736,7 @@ ivas_error only_reduce_bits_direction_fx( } *reduce_bits_out = negate( reduce_bits ); + move16(); return IVAS_ERR_OK; } @@ -856,32 +868,36 @@ void update_bits_next_block( Word16 k; diff = *p_diff; move16(); - IF( LT_16( diff, 0 ) ) + IF( diff < 0 ) { /* increase bits for next subbands */ k = 0; move16(); - WHILE( LT_16( diff, 0 ) && LT_16( j, max_i ) && LT_16( k, max_k ) ) + WHILE( diff < 0 && LT_16( j, max_i ) && LT_16( k, max_k ) ) { + test(); + test(); IF( LT_32( q_direction->band_data[j].bits_sph_idx[k], MASA_DIRECTION_MAX_BITS ) ) { q_direction->band_data[j].bits_sph_idx[k] = (UWord16) L_add( q_direction->band_data[j].bits_sph_idx[k], 1 ); move16(); - diff++; + diff = add( diff, 1 ); } - k++; + k = add( k, 1 ); } } ELSE { k = 0; - WHILE( GT_16( diff, 0 ) && LT_16( k, max_k ) ) + move16(); + WHILE( diff > 0 && LT_16( k, max_k ) ) { - IF( GT_32( q_direction->band_data[j].bits_sph_idx[k], 0 ) ) + test(); + IF( q_direction->band_data[j].bits_sph_idx[k] > 0 ) { q_direction->band_data[j].bits_sph_idx[k] = (UWord16) L_sub( q_direction->band_data[j].bits_sph_idx[k], 1 ); move16(); - diff--; + diff = sub( diff, 1 ); } } } @@ -990,8 +1006,8 @@ void invdct4_transform_fx( a_fx = L_add( v_fx[0], v_fx[2] ); b_fx = L_sub( v_fx[0], v_fx[2] ); - c_fx = L_shl( L_add( Mpy_32_32( 1402911360, v_fx[1] ), Mpy_32_32( 581104896, v_fx[3] ) ), 31 - 30 ); - d_fx = L_shl( L_sub( Mpy_32_32( 581104896, v_fx[1] ), Mpy_32_32( 1402911360, v_fx[3] ) ), 31 - 30 ); + c_fx = L_shl( L_add( Mpy_32_32( 1402911360, v_fx[1] ), Mpy_32_32( 581104896, v_fx[3] ) ), Q31 - Q30 ); + d_fx = L_shl( L_sub( Mpy_32_32( 581104896, v_fx[1] ), Mpy_32_32( 1402911360, v_fx[3] ) ), Q31 - Q30 ); f_invdct_v_fx[0] = L_shl( L_add( a_fx, c_fx ), 7 ); move32(); f_invdct_v_fx[1] = L_shl( L_add( b_fx, d_fx ), 7 ); @@ -1003,9 +1019,10 @@ void invdct4_transform_fx( FOR( i = 0; i < 4; i++ ) { - IF( LT_32( f_invdct_v_fx[i], 0 ) ) + IF( f_invdct_v_fx[i] < 0 ) { invdct_v[i] = 0; + move16(); } ELSE { @@ -1015,6 +1032,7 @@ void invdct4_transform_fx( move32(); } invdct_v[i] = (UWord8) L_shr( f_invdct_v_fx[i], q ); + move16(); } } @@ -1043,12 +1061,16 @@ void masa_compensate_two_dir_energy_ratio_index_fx( IF( hodirac_flag ) { *ratio_index_mod1 = masa_diffuse_ratios[ratio_index_1][ratio_index_2].hordiac_ratio1; + move16(); *ratio_index_mod2 = masa_diffuse_ratios[ratio_index_1][ratio_index_2].hoardia_ratio2; + move16(); } ELSE { *ratio_index_mod1 = masa_diffuse_ratios[ratio_index_1][ratio_index_2].ratio1; + move16(); *ratio_index_mod2 = masa_diffuse_ratios[ratio_index_1][ratio_index_2].ratio2; + move16(); } return; @@ -1222,8 +1244,10 @@ void ivas_qmetadata_direction_vector_to_azimuth_elevation_fx( L_tmp = L_add( Mpy_32_32( dv[0], dv[0] ), Mpy_32_32( dv[1], dv[1] ) ); /* 2 * dv_q - 31 */ e_tmp = shl( sub( 31, dv_q ), 1 ); L_tmp = Sqrt32( L_tmp, &e_tmp ); - *el = L_mult0( BASOP_util_atan2( dv[2], L_tmp, 31 - dv_q - e_tmp ), 29335 ); /* Q22 */ - *az = L_mult0( BASOP_util_atan2( dv[1], dv[0], 0 ), 29335 ); /* Q22 */ + *el = L_mult0( BASOP_util_atan2( dv[2], L_tmp, sub( sub( 31, dv_q ), e_tmp ) ), 29335 ); /* Q22 */ + move32(); + *az = L_mult0( BASOP_util_atan2( dv[1], dv[0], 0 ), 29335 ); /* Q22 */ + move32(); return; } #endif diff --git a/lib_com/ivas_qspherical_com.c b/lib_com/ivas_qspherical_com.c index 9c2f5f64343a1769212ec99c052660a00fc9134a..0eb7f6a1c32a0cb85e321b729c21320757e4c906 100644 --- a/lib_com/ivas_qspherical_com.c +++ b/lib_com/ivas_qspherical_com.c @@ -41,6 +41,9 @@ #include "cnst.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif /*------------------------------------------------------------------------- @@ -78,7 +81,7 @@ Word16 ivas_qmetadata_dereorder_generic( const UWord16 uns_value /* i : unsigned value result of ReorderGeneric */ ) { - IF( NE_32( L_and( uns_value, 1 ), 0 ) ) + IF( L_and( uns_value, 1 ) != 0 ) { return sub( negate( extract_l( L_shr( uns_value, 1 ) ) ), 1 ); } @@ -121,7 +124,7 @@ Word16 ivas_dirac_project_elevation_index( Word16 el_idx_proj; /* evaluate floor((el_idx / (el_alph - 1)) * (el_alph_proj - 1) + 0.5) using only integer */ - el_idx_proj = ( 2 * el_idx * ( el_alph_proj - 1 ) + ( el_alph - 1 ) ) / ( 2 * ( el_alph - 1 ) ); + el_idx_proj = idiv1616( add( imult1616( imult1616( 2, el_idx ), sub( el_alph_proj, 1 ) ), sub( el_alph, 1 ) ), imult1616( 2, sub( el_alph, 1 ) ) ); return el_idx_proj; } @@ -161,11 +164,11 @@ Word16 ivas_chan_project_elevation_index( /* evaluate floor((el_idx / (el_alph - 1)) * (el_alph_proj - 1) + 0.5) using only integer */ IF( EQ_16( el_idx, sub( el_alph, 1 ) ) ) { - el_idx_proj = el_alph_proj - 1; + el_idx_proj = sub( el_alph_proj, 1 ); } ELSE { - el_idx_proj = ( 2 * el_idx * el_alph_proj + el_alph ) / ( 2 * el_alph ); + el_idx_proj = idiv1616( add( imult1616( imult1616( 2, el_idx ), el_alph_proj ), el_alph ), imult1616( 2, el_alph ) ); } return el_idx_proj; @@ -216,9 +219,9 @@ Word16 ivas_dirac_project_azimuth_index( } /* evaluate floor((az_idx / az_alph) * az_alph_proj + 0.5) using only integer */ - az_idx_proj = ( 2 * az_idx * az_alph_proj + az_alph ) / ( 2 * az_alph ); + az_idx_proj = idiv1616( add( imult1616( imult1616( 2, az_idx ), az_alph_proj ), az_alph ), imult1616( 2, az_alph ) ); - IF( EQ_16( az_idx_proj, az_alph_proj ) ) + if ( EQ_16( az_idx_proj, az_alph_proj ) ) { az_idx_proj = 0; move16(); @@ -280,6 +283,7 @@ void small_reduction_direction( IF( GT_32( bits_dir[i][j], MASA_MIN_BITS_TF ) ) { bits_dir[i][j] = (UWord16) L_sub( bits_dir[i][j], 1 ); + move16(); ( *diff )--; } } @@ -411,7 +415,9 @@ Word16 quantize_phi_fx( Word32 temp_res; delta_phi_fx = delta_phi_val[n]; + move32(); inv_delta_phi_fx = inv_delta_phi_val[n]; + move32(); IF( EQ_16( n, 1 ) ) { *phi_hat = 0; @@ -433,17 +439,17 @@ Word16 quantize_phi_fx( } temp_res = Mpy_32_32( L_sub( L_sub( phi, DEGREE_180_Q_22 ), dd_fx ), inv_delta_phi_fx ); - id_phi = round_fx( L_shr( temp_res, 22 - 16 ) ); + id_phi = round_fx( L_shr( temp_res, Q22 - Q16 ) ); assert( L_sub( L_abs( temp_res ), abs( id_phi ) * ONE_IN_Q22 ) <= ONE_IN_Q21 ); - IF( LT_16( add( id_phi, shr( n, 1 ) ), 0 ) ) + IF( add( id_phi, shr( n, 1 ) ) < 0 ) { id_phi = add( id_phi, 1 ); } - IF( GE_16( sub( id_phi, shr( n, 1 ) ), 0 ) ) + IF( sub( id_phi, shr( n, 1 ) ) >= 0 ) { id_phi = negate( shr( n, 1 ) ); } @@ -465,6 +471,7 @@ ELSE } *phi_hat = L_add( L_add( ( id_phi * delta_phi_fx ), dd_fx ), DEGREE_180_Q_22 ); +move32(); id_phi = add( id_phi, shr( n, 1 ) ); return id_phi; @@ -574,6 +581,66 @@ Word32 companding_azimuth_fx( Word32 comp_azi_fx; Word16 i, not_done, start; Word32 abs_azi_fx; + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); test(); test(); @@ -628,6 +695,7 @@ Word32 companding_azimuth_fx( move16(); WHILE( not_done && ( LT_16( i, sub( no_points, 1 ) ) ) ) { + test(); IF( LE_32( abs_azi_fx, pA_fx[i + 1] ) ) { not_done = 0; @@ -669,11 +737,11 @@ Word32 companding_azimuth_fx( } ELSE { - i++; + i = add( i, 1 ); } } - IF( LT_32( azi_fx, 0 ) ) + IF( azi_fx < 0 ) { comp_azi_fx = L_negate( comp_azi_fx ); } diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index c3b7456f3d2dd980090d24b77845ed534c910bc9..cc37a8565a2468f95f72555cc8e176f1725c40e7 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -557,18 +557,6 @@ const float ica_sincInterp2[2*SINC_ORDER1+1] = 1.0f, 0.634114f,0.0f,-0.204776f, 0.0f, 0.115220f,0.0f,-0.074578f, 0.0f, 0.050649f,0.0f,-0.034727f, 0.0f, 0.023503f,0.0f,-0.015447f, 0.0f, 0.009735f,0.0f,-0.005865f, 0.0f, 0.003486f,0.0f,-0.002323f, 0.0f }; -const Word32 ica_sincInterp2_fx[2 * SINC_ORDER1 + 1] = -{ - 0, -4988604, 0, 7486127, 0, --12594991, 0, 20905753, 0, -33172179, 0, -50472307, 0, -74575663, 0, 108767895, 0, --160155039, 0, 247433071, 0, -439753119, 0, -1361749503, 2147483647, 1361749503, 0, -439753119, 0, -247433071, 0, -160155039, 0, 108767895, 0, --74575663, 0, 50472307, 0, -33172179, 0, -20905753, 0, -12594991, 0, 7486127, 0, --4988604, 0 -}; const float ica_sincInterp4[2*SINC_ORDER1+1] = { 0.0f,-0.003285f,-0.005537f,-0.004930f, 0.0f, 0.008295f, 0.015189f, 0.013767f, 0.0f,-0.021845f,-0.038282f,-0.033239f, @@ -596,13 +584,6 @@ const float icbwe_gsMapping_tbl[16] = -0.1690688f, -0.0987095f, -0.0700000f, -0.0500000f, -0.0200000f, 0.0000000f, 0.0400000f, 0.0800000f }; -const Word16 pow_10_icbwe_gsMapping_tbl_fx[16] = //Q14 -{ - 164 ,733 ,1793 ,3195 ,4524 ,5875 ,7438 ,9155 ,11101 ,13053 ,13945 ,14602 ,15647 ,16384 , - 17965 ,19698 -}; - - const float icbwe_gsMappingDFT_tbl[128] = { -5.0000000f, -4.5000000f, -4.0000000f, -3.5000000f, -3.0000000f, -2.5000000f, -1.9000000f, -1.5474502f, @@ -623,20 +604,6 @@ const float icbwe_gsMappingDFT_tbl[128] = 0.0155180f, 0.0224511f, 0.0298570f, 0.0375954f, 0.0457853f, 0.0549424f, 0.0659733f, 0.0785186f }; -const Word16 pow_10_icbwe_gsMappingDFT_tbl_fx[128] = //Q14 -{ - 0 ,1 ,2 ,5 ,16 ,52 ,206 ,464 ,518 ,585 ,667 ,688 ,803 ,899 , - 1324 ,1349 ,1513 ,1534 ,1578 ,1625 ,1711 ,1756 ,1808 ,1879 ,1926 ,2001 ,2050 ,2130 , - 2191 ,2280 ,2366 ,2394 ,2456 ,2574 ,2643 ,2726 ,2796 ,2850 ,2869 ,2908 ,2962 ,2991 , - 3023 ,3051 ,3091 ,3130 ,3202 ,3233 ,3268 ,3342 ,3388 ,3429 ,3483 ,3519 ,3553 ,3595 , - 3651 ,3706 ,3738 ,3795 ,3844 ,3890 ,3946 ,3990 ,4028 ,4075 ,4119 ,4166 ,4214 ,4259 , - 4303 ,4350 ,4389 ,4441 ,4481 ,4540 ,4605 ,4684 ,4764 ,4854 ,4950 ,5068 ,5198 ,5348 , - 5519 ,5692 ,5881 ,6073 ,6273 ,6473 ,6676 ,6883 ,7124 ,7364 ,7616 ,7852 ,8097 ,8370 , - 8630 ,8916 ,9200 ,9496 ,9866 ,10252 ,10652 ,11052 ,11436 ,11813 ,12247 ,12697 ,13153 ,13611 , - 14072 ,14503 ,14936 ,15336 ,15702 ,16032 ,16384 ,16664 ,16980 ,17253 ,17550 ,17866 ,18206 ,18594 , - 19072 ,19631 -}; - /*----------------------------------------------------------------------------------* * TD Stereo ROM tables @@ -650,14 +617,6 @@ const float tdm_ratio_tabl[TDM_NQ+1] = 0.9045f, 0.9330f, 0.9568f, 0.9755f, 0.9891f, 1.0000f, 1.0000f, 1.0000f }; -const UWord32 tdm_ratio_tabl_fx[TDM_NQ + 1] = -{ 0, 0, 23407572, 52613348, 92771296, -143881408, 205084688, 275736896, 355193792, 442596384, 536870912, -636943680, 741955584, 850403520, 961428416, 1073741824, 1186055168, -1297080064, 1405528064, 1510540032, 1610612736, 1704887296, 1792289792, -1871746688, 1942398976, 2003602304, 2054712320, 2094870272, 2124076032, -2147483647, 2147483647, 2147483647 }; - const float tdm_den_ratio_tabl[TDM_NQ+1] = /* 1.0f/(2*LR_ratio*LR_ratio-2*LR_ratio+1) */ { 1.0000f, 1.0000f, 1.0221f, 1.0501f, 1.0902f, 1.1429f, 1.2088f, 1.2884f, @@ -666,14 +625,6 @@ const float tdm_den_ratio_tabl[TDM_NQ+1] = /* 1.0f/(2*LR_ratio*LR_ratio-2*LR_ra 1.2088f, 1.1429f, 1.0902f, 1.0501f, 1.0221f, 1.0000f, 1.0000f, 1.0000f }; -const UWord32 tdm_den_ratio_tabl_fx[TDM_NQ + 1] = -{ 1073741824, 1073741824, 1097471488, 1127536256, 1170593280, -1227179520, 1297939072, 1383409024, 1483374336, 1596009856, 1717986944, -1842648320, 1960330496, 2058470400, 2124290816, 2147483647, 2124290816, -2058470400, 1960330496, 1842648320, 1717986944, 1596009856, 1483374336, -1383409024, 1297939072, 1227179520, 1170593280, 1127536256, 1097471488, -1073741824, 1073741824, 1073741824 }; - const int16_t tdm_bit_allc_tbl[5][6] = { /* IC -- UC -- GC -- TM --AC */ @@ -683,59 +634,7 @@ const int16_t tdm_bit_allc_tbl[5][6] = { 1650, 6050, 0, 10000, 0, 10000 }, /* IVAS_32k */ { 1650, 6050, 0, 13000, 0, 14000 } /* IVAS_48k */ }; -#ifdef IVAS_FLOAT_FIXED -/* LSFs Intra-frame prediction tables */ -//2.56 -const Word16 tdm_LSF_MEAN_RE_USE_OUT_fx[M] = -{ - 771, 1335, 2229, 3431, 4383, 5354, 6371, 7273, 8183, 9198, 10133, 10991, 12058, 13104, 14200, 15152 -}; -//2.56 -const Word16 tdm_LSF_MEAN_RE_USE_IN_fx[M] = -{ - 733, 1337, 2271, 3451, 4418, 5382, 6430, 7304, 8221, 9247, 10165, 11079, 12115, 13197, 14266, 15269, -}; -//2.56 -const Word16 tdm_LSF_MEAN_RE_USE_fx[M] = -{ - 680, 1369, 2354, 3448, 4498, 5435, 6546, 7494, 8446, 9437, 10328, 11248, 12241, 13199, 14189, 15174 -}; - -const Word16 tdm_Beta_Q1bit_re_use_13k2_fx[2] = { 31784, 24576 };//Q15 -const Word16 tdm_Beta_Q1bit_re_use_16k4_fx[2] = { 31129, 23265 };//Q15 -const Word16 tdm_Beta_Q1bit_re_use_24k4_32k_fx[2] = { 30474, 23920 };//Q15 -const Word16 tdm_Beta_Q1bit_re_use_48k_fx[2] = { 31784, 25231 };//Q15 -//Q15 -const Word16 tdm_RE_USE_adaptive_beta_prd_diag_3_fx[15 + 16 + 15] = -{ - 29028, 6750, 1916, 27016, 7516, 1195, 26787, 5557, -196, 27796, 6753, 2172, 29434, 4446, 2175, 26053, 6337, 3063, 26043, 5521, 3633, 26082, - 5989, 3515, 25672, 5911, 4846, 24123, 6494, 4374, 24971, 6225, 6235, 24146, 5619, 5848, 23638, 5393, 6445, 22579, 4027, 6694, 20698, 1779, - 5789, 17681 -}; -//2.56 -const Word16 tdm_LSF_MEAN_PRED_QNT_fx[M] = -{ - 1002, 1558, 2478, 3467, 4377, 5326, 6274, 7160, 8182, 9099, 10022, 10967, 12051, 13081, 14148, 15113 -}; -//2.56 -const Word16 tdm_LSF_MEAN_PRED_QNT_IN_fx[M] = -{ - 739, 1371, 2303, 3436, 4431, 5394, 6378, 7321, 8293, 9282, 10221, 11153, 12166, 13193, 14252, 15290 -}; -//2.56 -const Word16 tdm_LSF_MEAN_PRED_QNT_OUT_fx[M] = -{ - 733, 1337, 2271, 3451, 4418, 5382, 6430, 7304, 8221, 9247, 10165, 11079, 12115, 13197, 14266, 15269 -}; -//Q15 -const Word16 tdm_PRED_QNT_fixed_beta_prd_diag_3_fx[15 + 16 + 15] = -{ - 23067, 3941, -3666, 24050, 5907, 829, 21960, 6229, -6052, 25859, 9862, -1369, 28559, 6019, 108, 22658, 7844, 697, 22045, 7998, 2310, 24735, - 6497, 2464, 23434, 7120, 2903, 20194, 10049, 711, 26610, 6622, 5190, 23955, 5721, 3945, 23906, 6481, 4033, 24581, 4043, 5599, 20879, 3473, - 3909, 21541 -}; -#endif /* LSFs Intra-frame prediction tables */ const float tdm_LSF_MEAN_RE_USE_OUT[M] = { @@ -903,30 +802,12 @@ const float dft_cng_coh_pred[STEREO_DFT_N_COH_PRED][STEREO_DFT_COH_PRED_COEFFS] { 0.202543f, 0.048819f, 0.263407f, 0.023538f, 0.092021f, 0.395655f, 0.013064f, -0.011127f, 0.035466f, 0.976055f, 0.009968f, 0.162957f, 0.383185f, -0.365493f, 2.534677f}, { 1.393664f, -0.131401f, 0.989429f, 0.738330f, 0.683865f, 0.001677f, -0.225448f, -0.012158f, 1.084608f, -0.115464f, 0.022371f, -0.045560f, -0.336230f, 0.422742f, 0.499163f} }; -#ifdef IVAS_FLOAT_FIXED -const Word16 dft_cng_coh_pred_fx[STEREO_DFT_N_COH_PRED][STEREO_DFT_COH_PRED_COEFFS] /*Q-13*/= { - { 4926, -827, 10396, 696, 2285, 5488, 668, 1547, -1416, 2633, 76, -690, 2967, -3495, 6212 }, - { 7007, 3446, 3385, -76, -3274, 11352, 101, -125, 1281, 4238, 1312, -2487, 3913, -4593, 11326 }, - { 1659, 399, 2157, 192, 753, 3241, 107, -91, 290, 7995, 81, 1334, 3139, -2994, 20764 }, - { 11416, -1076, 8105, 6048, 5602, 13, -1846, -99, 8885, -945, 183, -373, -2754, 3463, 4089 } -}; -#endif // IVAS_FLOAT_FIXED const int16_t dft_cng_coh_u2i[9] = { 4, 5, 3, 6, 2, 7, 1, 8, 0 }; /* Coherence unary codeword -> residual codeword conversion table */ const int16_t dft_cng_coh_i2u[9] = { 8, 6, 4, 2, 0, 1, 3, 5, 7 }; /* Coherence residual codeword -> unary codeword conversion table */ const int16_t dft_cng_coh_alpha_start[STEREO_DFT_N_COH_ALPHA_STEPS - 1] = { 15, 16, 17, 18 }; -#ifdef IVAS_FLOAT_FIXED -const Word16 dft_cng_alpha_bits_fx[STEREO_DFT_N_COH_ALPHA_STEPS][STEREO_DFT_N_COH_ALPHA_LEVELS]/*Q-15*/ = -{ - { 3277/*0.1f*/, 19661/*0.6f*/ }, - { 3277/*0.1f*/, 19661/*0.6f*/ }, - { 3277/*0.1f*/, 22938/*0.7f*/ }, - { 3277/*0.1f*/, 29491/*0.9f*/ }, - { 6554/*0.2f*/, 29491/*0.9f*/ } -}; -#endif // IVAS_FLOAT_FIXED const float dft_cng_alpha_bits[STEREO_DFT_N_COH_ALPHA_STEPS][STEREO_DFT_N_COH_ALPHA_LEVELS] = { @@ -954,13 +835,6 @@ const float diffuseness_reconstructions[DIRAC_DIFFUSE_LEVELS] = 0.85009765625f }; -#ifdef IVAS_FLOAT_FIXED -const Word32 diffuseness_reconstructions_fx[DIRAC_DIFFUSE_LEVELS] = // q = 30 -{ - 0, 42467328, 96206848, 170655744, 331087872, 508821504, 678952960, 912785408 -}; -#endif - const float diffuseness_thresholds[DIRAC_DIFFUSE_LEVELS + 1] = { 0.0f, @@ -974,21 +848,6 @@ const float diffuseness_thresholds[DIRAC_DIFFUSE_LEVELS + 1] = 2.0f /* out-of-range large value to make searching easier */ }; -#ifdef IVAS_FLOAT_FIXED -const Word32 diffuseness_thresholds_fx[DIRAC_DIFFUSE_LEVELS + 1] = -{ - 0, - 20447232, - 67633152, - 128188416, - 237502464, - 428605440, - 587988992, - 788791296, - MAX_32 /* out-of-range large value to make searching easier */ -}; -#endif // IVAS_FLOAT_FIXED - const int16_t DirAC_band_grouping_12[12 + 1] = { 0, 1, 2, 3, 4, 5, 6, 7, 11, 17, 25, 40, 60 @@ -1657,7 +1516,6 @@ const ivas_huff_models_t ivas_huff_decd_r_consts[TOTAL_DECD_QUANT_STRATS] = /* DTX quantization and bitstream constants */ const float dtx_pd_real_min_max[2] = { 0, 1.6f }; -const Word32 dtx_pd_real_min_max_fx[2] = { 0, 429496729 }; const int16_t dtx_pd_real_q_levels[3][3] = { { 7,7,7 },{ 7,7,0 },{ 3,0,0 } }; const int16_t dtx_pr_real_q_levels[3][3] = { { 9,9,9 },{ 9,7,9 },{ 9,5,7 } }; const int16_t pr_pr_idx_pairs[3][3][2] = { { { 0, 0 },{ 0, 0 },{ 0, 0 } },{ { 0, 0 },{ 0, 0 },{ 0, 0 } },{ { 0, 0 },{ 1, 3 },{ 0, 0 } } }; @@ -2783,28 +2641,12 @@ const float ivas_param_mc_quant_ild_5d1_48[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] = -8.0f, -5.5f, -3.5f, -1.5f, 0.0f, 1.5f, 3.5f, 5.5f, 8.0f, 10.0f, 13.0f, 20.0f }; -#ifdef IVAS_FLOAT_FIXED -//Q8 -const Word16 ivas_param_mc_quant_ild_5d1_48_fx[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] = -{ - -25600 ,-5120 ,-3328 ,-2560 ,-2048 ,-1408 ,-896 ,-384 ,0 ,384 ,896 ,1408 ,2048 ,2560 ,3328 ,5120 , -}; -#endif - /* Quantizer for ICCs in Parametric MC Processing */ const float ivas_param_mc_quant_icc[PARAM_MC_SZ_ICC_QUANTIZER] = { -0.99f, -0.589f, 0.0f, 0.36764f, 0.60092f, 0.84118f, 0.937f, 1.0f }; -#ifdef IVAS_FLOAT_FIXED -//Q15 -const Word16 ivas_param_mc_quant_icc_fx[PARAM_MC_SZ_ICC_QUANTIZER] = -{ - -32440,-19300,0,12046,19690,27563,30703,32767 -}; -#endif - /* Alphabet for delta coding for the ICCs in Parametric MC processing */ const uint16_t ivas_param_mc_cum_freq_icc_cicp6_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1] = { @@ -3110,29 +2952,6 @@ const float coherence_cb1_masa[MASA_NO_CV_COH1*MASA_MAXIMUM_CODING_SUBBANDS] = 0.0017f, 0.2521f, -0.2479f, 0.7217f, -0.7157f }; -#ifdef IVAS_FLOAT_FIXED - -const Word32 coherence_cb0_masa_fx[DIRAC_DIFFUSE_LEVELS * 2 * MASA_NO_CV_COH] = //q = 21 -{ - 100243, 534144, 1156579, 2068840, 2846464, 3531184, 4125936, 0, 253965, 864655, 1467377, - 2129448, 2977326, 3768791, 0, 0, 338480, 1189924, 2035915, 2872888, 3640026, 0, 0, 0, - 492621, 1532179, 2527278, 3470157, 0, 0, 0, 0, 499331, 1506803, 2465831, 3425697, 0, - 0, 0, 0, 503316, 1473668, 2392221, 3406404, 0, 0, 0, 0, 737778, 1970903, 3450654, 0, 0, - 0, 0, 0, 2097152, 0, 0, 0, 0, 0, 0, 0, 303038, 719742, 1122186, 1577897, 2117075, 2770337, - 3648834, 0, 419849, 932603, 1440533, 2011797, 2745172, 3571240, 0, 0, 548824, 1165177, - 1812987, 2555379, 3366138, 0, 0, 0, 695835, 1428160, 2190475, 3084910, 0, 0, 0, 0, 697093, - 1381603, 2092957, 2970406, 0, 0, 0, 0, 708417, 1396283, 2099039, 2992426, 0, 0, 0, 0, 835924, - 1728892, 2836607, 0, 0, 0, 0, 0, 2097152, 0, 0, 0, 0, 0, 0, 0 -}; - -const Word32 coherence_cb1_masa_fx[MASA_NO_CV_COH1*MASA_MAXIMUM_CODING_SUBBANDS] = // q = 21 -{ - -3984, 544630, -565392, 1314704, -1320157, -11534, 541484, -583847, 1357486, -1371118, - -6081, 525546, -551551, 1362729, -1371537, -838, 533934, -540855, 1436758, -1414109, - 3565, 528692, -519883, 1513514, -1500931 -}; -#endif - const int16_t len_cb_dct0_masa[DIRAC_DIFFUSE_LEVELS] = { 7, 6, 5, 4, 4, 4, 3, 2 }; const uint8_t sur_coherence_cb_masa[MASA_MAX_NO_CV_SUR_COH*MASA_NO_CB_SUR_COH] = @@ -3171,31 +2990,6 @@ const int16_t no_phi_masa[NO_SPHERICAL_GRIDS][MAX_NO_THETA] = /* from 1 to 11 bi { 60, 60, 58, 56, 54, 50, 46, 41, 36, 30, 23, 17, 10, 1 }, { 89, 89, 88, 86, 84, 81, 77, 73, 68, 63, 57, 51, 44, 38, 30, 23, 15, 8, 1 } }; -#ifdef IVAS_FLOAT_FIXED -const Word32 no_phi_masa_inv_fx[NO_SPHERICAL_GRIDS][MAX_NO_THETA] = /* from 1 to 11 bits*/ /*q factor = 8*/ -{ - {1073741824}, - {536870912}, - {536870912, 1073741824}, - {268435456, 536870912}, - {178956970, 306783378, 1073741824, 2147483647}, - {153391689, 165191049, 238609294, 1073741824, 2147483647}, - {97612893, 102261126, 126322567, 195225786, 715827882, 2147483647}, - {65075262, 67108864, 74051160, 93368854, 126322567, 238609294, 2147483647}, - {44739242, 45691141, 47721858, 52377649, 61356675, 76695844, 107374182, 178956970, 1073741824, 2147483647}, - {35791394, 35791394, 37025580, 38347922, 39768215, 42949672, 46684427, 52377649, 59652323, 71582788, 93368854, 126322567, 214748364, 2147483647}, - {24129029, 24129029, 24403223, 24970740, 25565281, 26512143, 27889398, 29417584, 31580641, 34087042, 37675151, 42107522, 48806446, 56512727, 71582788, 93368854, 143165576, 268435456, 2147483647} -}; - -const Word32 azimuth_cb_fx[8] = -{ - 0, -754974720, -377487360, 377487360, -188743680, 188743680, -566231040, 566231040 -}; - -const Word32 delta_theta_masa_fx[NO_SPHERICAL_GRIDS - 2] = -{ 188743680, 188743680, 150994944, 106954752, 83886080, 62914560, 45214596, 28101836, 20971520 }; - -#endif const float delta_theta_masa[NO_SPHERICAL_GRIDS - 2] = { /*180.0f, 90.0f,*/ 45.0f, 45.0f, 36.0f, 25.5f, 20.0f, /*14.9f*/ 15.0f, 10.78f, 6.7f, 5.0f }; @@ -3322,29 +3116,6 @@ const float ls_elevation_CICP16[9] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 35 const float ls_azimuth_CICP19[11] = { 30.0f, -30.0f, 0.0f, 135.0f, -135.0f, 90.0f, -90.0f, 30.0f, -30.0f, 135.0f, -135.0f }; const float ls_elevation_CICP19[11] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 35.0f, 35.0f, 35.0f, 35.0f }; -const float cb_azi_chan[] = { 0.0f, 30.0f, 110.0f, 135.0f }; - -#ifdef IVAS_FLOAT_FIXED -const int16_t ls_azimuth_CICP2_idx[2] = { 1, 2 }; -const int16_t ls_elevation_CICP2_idx[2] = { 0, 0 }; - -const int16_t ls_azimuth_CICP6_idx[5] = { 1, 2, 0, 7, 8 }; -const int16_t ls_elevation_CICP6_idx[5] = { 0, 0, 0, 0, 0 }; - -const int16_t ls_azimuth_CICP12_idx[7] = { 1, 2, 0, 7, 8, 9, 10 }; -const int16_t ls_elevation_CICP12_idx[7] = { 0, 0, 0, 0, 0, 0, 0 }; - -const int16_t ls_azimuth_CICP14_idx[7] = { 1, 2, 0, 7, 8, 1, 2 }; -const int16_t ls_elevation_CICP14_idx[7] = { 0, 0, 0, 0, 0, 3, 4 }; - -const int16_t ls_azimuth_CICP16_idx[9] = { 1, 2, 0, 7, 8, 1, 2, 7, 8 }; -const int16_t ls_elevation_CICP16_idx[9] = { 0, 0, 0, 0, 0, 3, 3, 3, 3 }; - - -const int16_t ls_azimuth_CICP19_idx[11] = { 1, 2, 0, 9, 10, 5, 6, 1, 2, 9, 10 }; -const int16_t ls_elevation_CICP19_idx[11] = { 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3 }; - - const float shoebox_sin_cos_tbl[11][2] ={{0.00000000f, 1.00000000f }, //0 {0.500000000f, 0.866025388f}, { -0.500000000f, 0.866025388f}, //30, -30 {0.573576450f , 0.819152057f}, {-0.573576450f, 0.819152057f}, //35, -35 @@ -3352,80 +3123,7 @@ const float shoebox_sin_cos_tbl[11][2] ={{0.00000000f, 1.00000000f }, //0 {0.939692616f , -0.342020124f}, {-0.939692616f,-0.342020124f},//110,-110 {0.707106769f , -0.707106769f}, {-0.707106769f,-0.707106769f}}; //135, -135 -const Word32 shoebox_sin_cos_tbl_fx[11][2] ={{0,1073741824} , //0 - {536870912, 929887680},{-536870912, 929887680}, //30, -30 - {615873024,879557824},{-615873024,879557824},//35, -35 - {1073741824,0}, {-1073741824,0},//90, -90 - {1008987264,-367241312}, {-1008987264,-367241312},//110,-110 - {759250112,-759250112},{-759250112,-759250112}}; //135, -135 //Q.30 - -#endif - - - -const Word32 delta_phi_val[90] = -{ 0, 1509949440, 754974720, 503316480, 377487360, 301989888, -251658240, 215707056, 188743680, 167772160, 150994944, -137268128, 125829120, 116149960, 107853528, 100663296, -94371840, 88820552, 83886080, 79471024, 75497472, -71902352, 68634064, 65649976, 62914560, 60397976, -58074980, 55924052, 53926764, 52067224, 50331648, -48708048, 47185920, 45756044, 44410276, 43141412, -41943040, 40809444, 39735512, 38716652, 37748736, -36828036, 35951176, 35115104, 34317032, 33554432, -32824988, 32126584, 31457280, 30815294, 30198988, -29606852, 29037490, 28489612, 27962026, 27453626, -26963382, 26490342, 26033612, 25592364, 25165824, -24753270, 24354024, 23967452, 23592960, 23229992, -22878022, 22536558, 22205138, 21883326, 21570706, -21266894, 20971520, 20684238, 20404722, 20132660, -19867756, 19609732, 19358326, 19113284, 18874368, -18641352, 18414018, 18192162, 17975588, 17764112, -17557552, 17355740, 17158516, 16965724 }; - -const Word32 inv_delta_phi_val[90] = -{ 0, 5965232, 11930464, 17895697, 23860929, 29826161, -35791394, 41756626, 47721858, 53687091, 59652323, -65617555, 71582788, 77548020, 83513252, 89478485, -95443717, 101408950, 107374182, 113339414, 119304647, -125269879, 131235111, 137200344, 143165576, 149130808, -155096041, 161061273, 167026505, 172991738, 178956970, -184922203, 190887435, 196852667, 202817900, 208783132, -214748364, 220713597, 226678829, 232644061, 238609294, -244574526, 250539758, 256504991, 262470223, 268435456, -274400688, 280365920, 286331153, 292296385, 298261617, -304226850, 310192082, 316157314, 322122547, 328087779, -334053011, 340018244, 345983476, 351948708, 357913941, -363879173, 369844406, 375809638, 381774870, 387740103, -393705335, 399670567, 405635800, 411601032, 417566264, -423531497, 429496729, 435461961, 441427194, 447392426, -453357659, 459322891, 465288123, 471253356, 477218588, -483183820, 489149053, 495114285, 501079517, 507044750, -513009982, 518975214, 524940447, 530905679, }; - -const Word32 dd_val[90] = -{ 0, 754974720, 377487360, 251658240, 188743680, 150994944, -125829120, 107853528, 94371840, 83886080, 75497472, -68634064, 62914560, 58074980, 53926764, 50331648, -47185920, 44410276, 41943040, 39735512, 37748736, -35951176, 34317032, 32824988, 31457280, 30198988, -29037490, 27962026, 26963382, 26033612, 25165824, -24354024, 23592960, 22878022, 22205138, 21570706, -20971520, 20404722, 19867756, 19358326, 18874368, -18414018, 17975588, 17557552, 17158516, 16777216, -16412494, 16063292, 15728640, 15407647, 15099494, -14803426, 14518745, 14244806, 13981013, 13726813, -13481691, 13245171, 13016806, 12796182, 12582912, -12376635, 12177012, 11983726, 11796480, 11614996, -11439011, 11268279, 11102569, 10941663, 10785353, -10633447, 10485760, 10342119, 10202361, 10066330, -9933878, 9804866, 9679163, 9556642, 9437184, -9320676, 9207009, 9096081, 8987794, 8882056, -8778776, 8677870, 8579258, 8482862 }; - -#ifdef IVAS_FLOAT_FIXED -const Word32 cb_azi_chan_fx[] = { 0, 125829120, 461373440, 566231040 }; -#endif +const float cb_azi_chan[] = { 0.0f, 30.0f, 110.0f, 135.0f }; const float McMASA_LFEGain_vectors[64] = { @@ -3515,53 +3213,6 @@ const float dct12[12*12]= 0.2887f, -0.4048f, 0.3943f, -0.3772f, 0.3536f, -0.3239f, 0.2887f, -0.2485f, 0.2041f, -0.1562f, 0.1057f, -0.0533f }; -#ifdef IVAS_FLOAT_FIXED -const Word32 dct4_fx[4*4] = -{ - 1073741824, 1402951040, 1073741824, 581109056, - 1073741824, 581109056, -1073741824, -1402951040, - 1073741824, -581109056, -1073741824, 1402951040, - 1073741824, -1402951040, 1073741824, -581109056 -}; - -const Word32 dct5_fx[5*5] = -{ - 960354688, 1291711360, 1098867328, 798219648, 419618304, - 960354688, 798219648, -419618304, -1291711360, -1098867328, - 960354688, 0, -1358283392, 0, 1358283392, - 960354688, -798219648, -419618304, 1291711360, -1098867328, - 960354688, -1291711360, 1098867328, -798219648, 419618304 -}; - -const Word32 dct8_fx[8*8] = -{ - 759350208, 1053125952, 991922688, 892708928, 759350208, 596570944, 410813632, 209379648, - 759350208, 892708928, 410813632, -209379648, -759350208, -1053125952, -991922688, -596570944, - 759350208, 596570944, -410813632, -1053125952, -759350208, 209379648, 991922688, 892708928, - 759350208, 209379648, -991922688, -596570944, 759350208, 892708928, -410813632, -1053125952, - 759350208, -209379648, -991922688, 596570944, 759350208, -892708928, -410813632, 1053125952, - 759350208, -596570944, -410813632, 1053125952, -759350208, -209379648, 991922688, -892708928, - 759350208, -892708928, 410813632, 209379648, -759350208, 1053125952, -991922688, 596570944, - 759350208, -1053125952, 991922688, -892708928, 759350208, -596570944, 410813632, -209379648 -}; - -const Word32 dct12_fx[12*12]= -{ - 619978560, 869301376, 846752832, 810030848, 759350208, 695569984, 619978560, 533649696, 438301408, 335436960, 226989024, 114460880, - 619978560, 810030848, 619978560, 335436960, 0, -335436960, -619978560, -810030848, -876602816, -810030848, -619978560, -335436960, - 619978560, 695569984, 226989024, -335436960, -759350208, -869301376, -619978560, -114460880, 438301408, 810030848, 846752832, 533649696, - 619978560, 533649696, -226989024, -810030848, -759350208, -114460880, 619978560, 869301376, 438301408, -335436960, -846752832, -695569984, - 619978560, 335436960, -619978560, -810030848, 0, 810030848, 619978560, -335436960, -876602816, -335436960, 619978560, 810030848, 619978560, - 114460880, -846752832, -335436960, 759350208, 533649696, -619978560, -695569984, 438301408, 810030848, -226989024, -869301376, 619978560, - -114460880, -846752832, 335436960, 759350208, -533649696, -619978560, 695569984, 438301408, -810030848, -226989024, 869301376, 619978560, - -335436960, -619978560, 810030848, 0, -810030848, 619978560, 335436960, -876602816, 335436960, 619978560, -810030848, 619978560, -533649696, - -226989024, 810030848, -759350208, 114460880, 619978560, -869301376, 438301408, 335436960, -846752832, 695569984, 619978560, -695569984, - 226989024, 335436960, -759350208, 869301376, -619978560, 114460880, 438301408, -810030848, 846752832, -533649696, 619978560, -810030848, - 619978560, -335436960, 0, 335436960, -619978560, 810030848, -876602816, 810030848, -619978560, 335436960, 619978560, -869301376, 846752832, - -810030848, 759350208, -695569984, 619978560, -533649696, 438301408, -335436960, 226989024, -114460880 -}; -#endif - /*----------------------------------------------------------------------------------* * ISM ROM tables *----------------------------------------------------------------------------------*/ @@ -3576,20 +3227,6 @@ const float ism_elevation_borders[4] = ISM_ELEVATION_MIN, ISM_ELEVATION_LOW_BORDER, ISM_ELEVATION_HIGH_BORDER, ISM_ELEVATION_MAX }; -#ifdef IVAS_FLOAT_FIXED -const Word32 ism_azimuth_borders_fx[4] = -{ - ISM_AZIMUTH_MIN_FX, ISM_AZIMUTH_LOW_BORDER_FX, ISM_AZIMUTH_HIGH_BORDER_FX, ISM_AZIMUTH_MAX_FX -}; - -const Word32 ism_elevation_borders_fx[4] = -{ - ISM_ELEVATION_MIN_FX, ISM_ELEVATION_LOW_BORDER_FX, ISM_ELEVATION_HIGH_BORDER_FX, ISM_ELEVATION_MAX_FX -}; - -#endif - - /*----------------------------------------------------------------------------------* * Param ISM ROM tables *----------------------------------------------------------------------------------*/ @@ -3703,11 +3340,6 @@ const float ivas_lfe_window_coeff_48k[IVAS_LFE_FADE_LEN_48K] = 0.999999941142332f, 0.999999966087832f, 0.999999983040042f, 0.999999993835372f }; -#ifdef IVAS_FLOAT_FIXED -const Word32 ivas_lfe_window_coeff_48k_fx[IVAS_LFE_FADE_LEN_48K] = { 0x0003a373, 0x000608f6, 0x000888a7, 0x000b3e1b, 0x000e34f1, 0x001174a2, 0x00150328, 0x0018e5e1, 0x001d21eb, 0x0021bc4d, 0x0026ba09, 0x002c202f, 0x0031f3dc, 0x00383a43, 0x003ef8ad, 0x0046347b, 0x004df325, 0x00563a3f, 0x005f0f74, 0x00687888, 0x00727b59, 0x007d1ddb, 0x0088661c, 0x00945a41, 0x00a10087, 0x00ae5f3d, 0x00bc7ccd, 0x00cb5fb3, 0x00db0e7d, 0x00eb8fd0, 0x00fcea61, 0x010f24f8, 0x0122466a, 0x013655a0, 0x014b598e, 0x01615936, 0x01785ba8, 0x01906800, 0x01a9855e, 0x01c3baf0, 0x01df0fee, 0x01fb8b90, 0x02193514, 0x023813c4, 0x02582ee4, 0x02798db8, 0x029c378c, 0x02c033a4, 0x02e58944, 0x030c3fa8, 0x03345e0c, 0x035deba0, 0x0388ef8c, 0x03b570f0, 0x03e376dc, 0x04130858, 0x04442c58, 0x0476e9b8, 0x04ab4760, 0x04e14c00, 0x0518fe48, 0x055264c8, 0x058d8600, 0x05ca6850, 0x06091200, 0x06498930, 0x068bd3f0, 0x06cff830, 0x0715fba8, 0x075de408, 0x07a7b6c8, 0x07f37940, 0x084130a0, 0x0890e200, 0x08e29220, 0x093645c0, 0x098c0150, 0x09e3c940, 0x0a3da180, 0x0a998e30, 0x0af792e0, 0x0b57b320, 0x0bb9f240, 0x0c1e5360, 0x0c84d940, 0x0ced8690, 0x0d585dc0, 0x0dc560f0, 0x0e349200, 0x0ea5f2b0, 0x0f198450, 0x0f8f4820, 0x10073f00, 0x10816980, 0x10fdc840, 0x117c5b00, 0x11fd21e0, 0x12801c60, 0x130549a0, 0x138ca8c0, 0x14163880, 0x14a1f740, 0x152fe320, 0x15bffa00, 0x16523980, 0x16e69ee0, 0x177d2700, 0x1815cec0, 0x18b09260, 0x194d6e00, 0x19ec5d60, 0x1a8d5c20, 0x1b306580, 0x1bd57440, 0x1c7c8300, 0x1d258c40, 0x1dd08a00, 0x1e7d7600, 0x1f2c49a0, 0x1fdcfe20, 0x208f8c40, 0x2143ed00, 0x21fa1840, 0x22b20680, 0x236baf40, 0x24270a00, 0x24e40e00, 0x25a2b280, 0x2662ee00, 0x2724b700, 0x27e80400, 0x28acca80, 0x297300c0, 0x2a3a9c00, 0x2b039180, 0x2bcdd680, 0x2c995fc0, 0x2d6621c0, 0x2e341140, 0x2f032240, 0x2fd34900, 0x30a47900, 0x3176a640, 0x3249c440, 0x331dc600, 0x33f29f40, 0x34c842c0, 0x359ea340, 0x3675b3c0, 0x374d66c0, 0x3825af00, 0x38fe7ec0, 0x39d7c880, 0x3ab17e40, 0x3b8b9240, 0x3c65f6c0, 0x3d409d80, 0x3e1b7880, 0x3ef679c0, 0x3fd19340, 0x40acb680, 0x4187d580, 0x4262e280, 0x433dce80, 0x44188c00, 0x44f30c80, 0x45cd4180, 0x46a71e00, 0x47809300, 0x48599300, 0x49320f80, 0x4a09fb80, 0x4ae14880, 0x4bb7e900, 0x4c8dcf80, 0x4d62ee80, 0x4e373880, 0x4f0aa080, 0x4fdd1900, 0x50ae9600, 0x517f0980, 0x524e6780, 0x531ca380, 0x53e9b100, 0x54b58400, 0x55801080, 0x56494b00, 0x57112800, 0x57d79c00, 0x589c9c00, 0x59601d00, 0x5a221480, 0x5ae27880, 0x5ba13e00, 0x5c5e5c00, 0x5d19c880, 0x5dd37a80, 0x5e8b6800, 0x5f418980, 0x5ff5d580, 0x60a84480, 0x6158ce00, 0x62076a80, 0x62b41280, 0x635ebf80, 0x64076a80, 0x64ae0d00, 0x6552a100, 0x65f52080, 0x66958680, 0x6733cd00, 0x67cff000, 0x6869ea80, 0x6901b880, 0x69975600, 0x6a2abf80, 0x6abbf200, 0x6b4aea80, 0x6bd7a680, 0x6c622300, 0x6cea5f80, 0x6d705900, 0x6df40f00, 0x6e758080, 0x6ef4ac80, 0x6f719300, 0x6fec3380, 0x70648f00, 0x70daa580, 0x714e7880, 0x71c00880, 0x722f5780, 0x729c6700, 0x73073980, 0x736fd100, 0x73d62f80, 0x743a5900, 0x749c5080, 0x74fc1880, 0x7559b600, 0x75b52b80, 0x760e7e80, 0x7665b280, 0x76bacc80, 0x770dd180, 0x775ec600, 0x77adb000, 0x77fa9480, 0x78457900, 0x788e6400, 0x78d55b80, 0x791a6500, 0x795d8780, 0x799ec900, 0x79de3100, 0x7a1bc580, 0x7a578d80, 0x7a919100, 0x7ac9d600, 0x7b006500, 0x7b354400, 0x7b687b80, 0x7b9a1300, 0x7bca1180, 0x7bf87f80, 0x7c256400, 0x7c50c780, 0x7c7ab180, 0x7ca32a00, 0x7cca3900, 0x7cefe600, 0x7d143900, 0x7d373a80, 0x7d58f280, 0x7d796800, 0x7d98a380, 0x7db6ad00, 0x7dd38c80, 0x7def4900, 0x7e09eb00, 0x7e237a00, 0x7e3bfd80, 0x7e537d80, 0x7e6a0180, 0x7e7f9080, 0x7e943200, 0x7ea7ed80, 0x7ebaca00, 0x7ecccf00, 0x7ede0300, 0x7eee6d00, 0x7efe1400, 0x7f0cfe80, 0x7f1b3380, 0x7f28b900, 0x7f359500, 0x7f41ce80, 0x7f4d6b80, 0x7f587180, 0x7f62e680, 0x7f6cd000, 0x7f763400, 0x7f7f1780, 0x7f878080, 0x7f8f7380, 0x7f96f580, 0x7f9e0b80, 0x7fa4bb00, 0x7fab0780, 0x7fb0f600, 0x7fb68b00, 0x7fbbca00, 0x7fc0b800, 0x7fc55880, 0x7fc9af80, 0x7fcdc080, 0x7fd18f00, 0x7fd51e80, 0x7fd87280, 0x7fdb8d80, 0x7fde7380, 0x7fe12700, 0x7fe3aa80, 0x7fe60100, 0x7fe82d00, 0x7fea3180, 0x7fec1000, 0x7fedcb00, 0x7fef6500, 0x7ff0e000, 0x7ff23e00, 0x7ff38080, 0x7ff4a980, 0x7ff5ba80, 0x7ff6b580, 0x7ff79c00, 0x7ff86e80, 0x7ff92f80, 0x7ff9e000, 0x7ffa8100, 0x7ffb1380, 0x7ffb9880, 0x7ffc1180, 0x7ffc7f80, 0x7ffce300, 0x7ffd3c80, 0x7ffd8d80, 0x7ffdd680, 0x7ffe1880, 0x7ffe5300, 0x7ffe8800, 0x7ffeb700, 0x7ffee100, 0x7fff0600, 0x7fff2700, 0x7fff4480, 0x7fff5e80, 0x7fff7500, 0x7fff8900, 0x7fff9a80, 0x7fffaa00, 0x7fffb780, 0x7fffc300, 0x7fffcd00, 0x7fffd580, 0x7fffdc80, 0x7fffe300, 0x7fffe880, 0x7fffec80, 0x7ffff080, 0x7ffff380, 0x7ffff680, 0x7ffff880, 0x7ffffa00, 0x7ffffb80, 0x7ffffc80, 0x7ffffd80, 0x7ffffe80, 0x7fffff00, 0x7fffff00, 0x7fffff80, 0x7fffff80, 0x7fffffff, 0x7fffffff }; -#endif - - const float ivas_lfe_window_coeff_32k[IVAS_LFE_FADE_LEN_32K] = { 0.000135992220705702f, 0.000243900754874608f, 0.000366502488193403f, 0.000507754555407233f, @@ -3776,11 +3408,6 @@ const float ivas_lfe_window_coeff_32k[IVAS_LFE_FADE_LEN_32K] = 0.999999871092647f, 0.999999932837961f, 0.999999970256211f, 0.999999990753058f }; -#ifdef IVAS_FLOAT_FIXED -const Word32 ivas_lfe_window_coeff_32k_fx[IVAS_LFE_FADE_LEN_32K] = { 0x000474c9, 0x0007fdfd, 0x000c0272, 0x0010a35b, 0x0015f4ae, 0x001c079e, 0x0022ecc2, 0x002ab4c6, 0x003370ac, 0x003d31e5, 0x00480a5f, 0x00540c87, 0x00614b4e, 0x006fda25, 0x007fccfb, 0x0091383a, 0x00a430c2, 0x00b8cbe7, 0x00cf1f67, 0x00e74167, 0x0101486c, 0x011d4b52, 0x013b614e, 0x015ba1d8, 0x017e24ae, 0x01a301c8, 0x01ca514e, 0x01f42b90, 0x0220a900, 0x024fe224, 0x0281ef88, 0x02b6e9c0, 0x02eee954, 0x032a06b4, 0x03685a34, 0x03a9fc00, 0x03ef0408, 0x043789f8, 0x0483a538, 0x04d36cd0, 0x0526f760, 0x057e5b20, 0x05d9adc0, 0x06390470, 0x069c73c0, 0x07040fa8, 0x076feb68, 0x07e01990, 0x0854abe0, 0x08cdb350, 0x094b4000, 0x09cd6120, 0x0a5424d0, 0x0adf9870, 0x0b6fc830, 0x0c04bf20, 0x0c9e8760, 0x0d3d29c0, 0x0de0ade0, 0x0e891a50, 0x0f367440, 0x0fe8bfa0, 0x109fff00, 0x115c33a0, 0x121d5d80, 0x12e37b00, 0x13ae8960, 0x147e8440, 0x155365c0, 0x162d26c0, 0x170bbe80, 0x17ef22e0, 0x18d74820, 0x19c42100, 0x1ab59f20, 0x1babb200, 0x1ca64840, 0x1da54e80, 0x1ea8b080, 0x1fb057e0, 0x20bc2d80, 0x21cc1800, 0x22dffd40, 0x23f7c1c0, 0x25134800, 0x26327200, 0x27552000, 0x287b30c0, 0x29a48280, 0x2ad0f180, 0x2c005940, 0x2d329440, 0x2e677c00, 0x2f9ee880, 0x30d8b100, 0x3214ac40, 0x3352afc0, 0x34929040, 0x35d421c0, 0x37173780, 0x385ba480, 0x39a13b00, 0x3ae7cc40, 0x3c2f2a00, 0x3d7724c0, 0x3ebf8d80, 0x40083400, 0x4150e980, 0x42997d80, 0x43e1c000, 0x45298180, 0x46709200, 0x47b6c280, 0x48fbe380, 0x4a3fc600, 0x4b823b80, 0x4cc31600, 0x4e022800, 0x4f3f4500, 0x507a4080, 0x51b2ee80, 0x52e92580, 0x541cba80, 0x554d8580, 0x567b5e00, 0x57a61d80, 0x58cd9e00, 0x59f1bb80, 0x5b125200, 0x5c2f3f00, 0x5d486280, 0x5e5d9d00, 0x5f6ecf80, 0x607bde00, 0x6184ad00, 0x62892280, 0x63892680, 0x6484a280, 0x657b8100, 0x666daf00, 0x675b1980, 0x6843b100, 0x69276680, 0x6a062d00, 0x6adff980, 0x6bb4c180, 0x6c847d80, 0x6d4f2680, 0x6e14b800, 0x6ed52e80, 0x6f908900, 0x7046c680, 0x70f7e880, 0x71a3f300, 0x724aea00, 0x72ecd300, 0x7389b680, 0x74219c80, 0x74b48f80, 0x75429b80, 0x75cbcc80, 0x76503100, 0x76cfd800, 0x774ad280, 0x77c13180, 0x78330780, 0x78a06880, 0x79096800, 0x796e1b80, 0x79ce9980, 0x7a2af880, 0x7a835000, 0x7ad7b800, 0x7b284980, 0x7b751c80, 0x7bbe4c00, 0x7c03f080, 0x7c462580, 0x7c850480, 0x7cc0a880, 0x7cf92c00, 0x7d2eaa80, 0x7d613e00, 0x7d910180, 0x7dbe0f80, 0x7de88300, 0x7e107600, 0x7e360300, 0x7e594280, 0x7e7a4f80, 0x7e994200, 0x7eb63280, 0x7ed13a00, 0x7eea6f00, 0x7f01e980, 0x7f17c000, 0x7f2c0800, 0x7f3ed780, 0x7f504280, 0x7f605d80, 0x7f6f3c00, 0x7f7cf100, 0x7f898e00, 0x7f952500, 0x7f9fc600, 0x7fa98200, 0x7fb26800, 0x7fba8680, 0x7fc1eb80, 0x7fc8a400, 0x7fcebd80, 0x7fd44380, 0x7fd94100, 0x7fddc180, 0x7fe1ce80, 0x7fe57180, 0x7fe8b400, 0x7feb9d80, 0x7fee3680, 0x7ff08600, 0x7ff29280, 0x7ff46300, 0x7ff5fc80, 0x7ff76500, 0x7ff8a180, 0x7ff9b600, 0x7ffaa780, 0x7ffb7900, 0x7ffc2e80, 0x7ffccb80, 0x7ffd5200, 0x7ffdc580, 0x7ffe2800, 0x7ffe7b80, 0x7ffec200, 0x7ffefd80, 0x7fff2f00, 0x7fff5880, 0x7fff7a80, 0x7fff9680, 0x7fffad80, 0x7fffc000, 0x7fffcf00, 0x7fffdb00, 0x7fffe480, 0x7fffeb80, 0x7ffff180, 0x7ffff580, 0x7ffff900, 0x7ffffb00, 0x7ffffd00, 0x7ffffe00, 0x7fffff00, 0x7fffff80, 0x7fffffff, 0x7fffffff }; -#endif - - const float ivas_lfe_window_coeff_16k[IVAS_LFE_FADE_LEN_16K] = { 0.000192322041967661f, 0.000432042541451336f, 0.000754275578824202f, 0.00117365342860051f, @@ -3817,11 +3444,6 @@ const float ivas_lfe_window_coeff_16k[IVAS_LFE_FADE_LEN_16K] = 0.999999311268578f, 0.999999715534135f, 0.999999906669617f, 0.999999981506116f }; -#ifdef IVAS_FLOAT_FIXED -const Word32 ivas_lfe_window_coeff_16k_fx[IVAS_LFE_FADE_LEN_16K] = { 0x00064d50, 0x000e283c, 0x0018b753, 0x00267552, 0x0037e397, 0x004d8c2b, 0x006801d2, 0x0087dfb9, 0x00adc8fc, 0x00da680b, 0x010e6df8, 0x014a91a0, 0x018f8ecc, 0x01de252a, 0x02371734, 0x029b2908, 0x030b1f1c, 0x0387bd00, 0x0411c3e8, 0x04a9f148, 0x0550fd60, 0x060799b0, 0x06ce6f88, 0x07a61e78, 0x088f3ad0, 0x098a4c30, 0x0a97cc00, 0x0bb82430, 0x0cebadd0, 0x0e32afe0, 0x0f8d5df0, 0x10fbd760, 0x127e2680, 0x14143f40, 0x15bdff00, 0x177b2bc0, 0x194b7440, 0x1b2e6f00, 0x1d239ae0, 0x1f2a5ee0, 0x21420ac0, 0x2369d700, 0x25a0e640, 0x27e64500, 0x2a38ebc0, 0x2c97bfc0, 0x2f019400, 0x31752b00, 0x33f13800, 0x36746180, 0x38fd42c0, 0x3b8a6cc0, 0x3e1a6a80, 0x40abc080, 0x433cf080, 0x45cc7c80, 0x4858e600, 0x4ae0b400, 0x4d627280, 0x4fdcb500, 0x524e1b00, 0x54b54e80, 0x57110880, 0x59601300, 0x5ba14800, 0x5dd39780, 0x5ff60500, 0x6207aa80, 0x6407ba80, 0x65f57e80, 0x67d05b00, 0x6997cc80, 0x6b4b6b00, 0x6ceae880, 0x6e761080, 0x6fecc980, 0x714f1280, 0x729d0480, 0x73d6ce80, 0x74fcb800, 0x760f1d80, 0x770e6e80, 0x77fb2f00, 0x78d5f280, 0x799f5b80, 0x7a581b80, 0x7b00ec80, 0x7b9a9480, 0x7c25df80, 0x7ca39e80, 0x7d14a680, 0x7d79ce00, 0x7dd3eb00, 0x7e23d180, 0x7e6a5180, 0x7ea83680, 0x7ede4580, 0x7f0d3a80, 0x7f35cb00, 0x7f58a180, 0x7f765e80, 0x7f8f9880, 0x7fa4db80, 0x7fb6a700, 0x7fc57100, 0x7fd1a400, 0x7fdb9f80, 0x7fe3b980, 0x7fea3e00, 0x7fef6f80, 0x7ff38900, 0x7ff6bc80, 0x7ff93500, 0x7ffb1780, 0x7ffc8300, 0x7ffd9080, 0x7ffe5500, 0x7ffee280, 0x7fff4580, 0x7fff8a00, 0x7fffb800, 0x7fffd580, 0x7fffe880, 0x7ffff400, 0x7ffffa00, 0x7ffffd80, 0x7fffff00, 0x7fffffff }; -#endif - - const float ivas_lpf_4_butter_16k_sos[IVAS_BIQUAD_FILT_LEN << 2] = { 3.97464794223146e-07f, 7.94929601777927e-07f, 3.97464788468481e-07f, 1.f, @@ -3829,16 +3451,6 @@ const float ivas_lpf_4_butter_16k_sos[IVAS_BIQUAD_FILT_LEN << 2] = 1.00000001447843f, 1.f, -1.95913666348268f, 0.961692382252710f }; -#ifdef IVAS_FLOAT_FIXED -const Word32 ivas_lpf_4_butter_16k_sos_fx[IVAS_BIQUAD_FILT_LEN << 2] = -{ - 0x1ab, 0x356, 0x1ab, 0x40000000, - 0x85ec0b80, 0x3a3cb940, 0x40000000, 0x7fffffff, - 0x40000000, 0x40000000, 0x829d8180, 0x3d8c5e40 -}; -#endif - - const float ivas_lpf_4_butter_32k_sos[IVAS_BIQUAD_FILT_LEN << 2] = { 2.56674586654460e-08f, 5.13349181918215e-08f, 2.56674582938215e-08f, 1, @@ -3846,16 +3458,6 @@ const float ivas_lpf_4_butter_32k_sos[IVAS_BIQUAD_FILT_LEN << 2] = 1.00000001447843f, 1, -1.98000953138860f, 0.980654742275836f }; -#ifdef IVAS_FLOAT_FIXED -const Word32 ivas_lpf_4_butter_32k_sos_fx[IVAS_BIQUAD_FILT_LEN << 2] = -{ - 0x1c, 0x37, 0x1c, 0x40000000, - 0x82fd4b80, 0x3d0d2280, 0x40000000, 0x7fffffff, - 0x40000000, 0x40000000, 0x81478600, 0x3ec30c00 -}; -#endif - - const float ivas_lpf_4_butter_48k_sos[IVAS_BIQUAD_FILT_LEN << 2] = { 5.12617881476274e-09f, 1.02523584294987e-08f, 5.12617879059970e-09f, @@ -3863,55 +3465,21 @@ const float ivas_lpf_4_butter_48k_sos[IVAS_BIQUAD_FILT_LEN << 2] = 1.00000000471366f, 1.f , -1.98677297369091f, 0.987060670205863f }; -#ifdef IVAS_FLOAT_FIXED -const Word32 ivas_lpf_4_butter_48k_sos_fx[IVAS_BIQUAD_FILT_LEN << 2] = -{ - 0x6, 0xb, 0x6, 0x40000000, - 0x81ffd700, 0x3e04d500, 0x40000000, 0x7fffff80, - 0x40000000, 0x40000000, 0x80d8b600, 0x3f2c0080 -}; -#endif - - const float ivas_lpf_2_butter_16k[IVAS_BIQUAD_FILT_LEN << 1] = { 0.000628720643081143f, 0.00125744128616229f, 0.000628720643081143f, 1.f, -1.92783286977036f, 0.930347752342683f }; -#ifdef IVAS_FLOAT_FIXED -const Word32 ivas_lpf_2_butter_16k_fx[IVAS_BIQUAD_FILT_LEN << 1] = -{ - 0xa4d0c, 0x149a17, 0xa4d0c, 0x40000000, 0x849e6300, 0x3b8ad140 -}; -#endif - - const float ivas_lpf_2_butter_32k[IVAS_BIQUAD_FILT_LEN << 1] = { 0.000159990787823749f, 0.000319981575647499f, 0.000159990787823749f, 1.f, -1.96390539174033f, 0.964545354891623f }; -#ifdef IVAS_FLOAT_FIXED -const Word32 ivas_lpf_2_butter_32k_fx[IVAS_BIQUAD_FILT_LEN << 1] = -{ - 0x53e1a, 0x29f0d, 0x40000000, 0x824f6000, 0x3dbb1c80, 0x29f0d -}; -#endif - - const float ivas_lpf_2_butter_48k[IVAS_BIQUAD_FILT_LEN << 1] = { 7.15317998432330e-05f, 0.000143063599686466f, 7.15317998432330e-05f, 1.f, -1.97593552482925f, 0.976221652028620f }; -#ifdef IVAS_FLOAT_FIXED -const Word32 ivas_lpf_2_butter_48k_fx[IVAS_BIQUAD_FILT_LEN << 1] = -{ - 0x12c07, 0x2580d, 0x12c07, 0x40000000, 0x818a4580, 0x3e7a6a80 -}; -#endif - - const ivas_lfe_freq_models ivas_str_lfe_freq_models = { { 16384, 14924, 13463, 12003, 10542, 9082, 7622, 6161, @@ -3963,26 +3531,6 @@ const int16_t ivas_lfe_min_shift_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP] = { 1, 0 }; const float ivas_lfe_lpf_delay[2] = { 0.00175f, 0.0035f }; const Word16 ivas_lfe_lpf_delay_Q15[2] = { 57, 114 }; -#ifdef IVAS_FLOAT_FIXED -//Q31 -const UWord32 d_hamm_lfe_plc_fx[LFE_PLC_LENANA / 2] = { - 171798691, 172140039, 173163845, 174869403, 177255533, 180320587, 184062447, 188478526, - 193565772, 199320670, 205739242, 212817053, 220549212, 228930373, 237954746, 247616094, - 257907739, 268822570, 280353042, 292491188, 305228618, 318556530, 332465713, 346946555, - 361989047, 377582794, 393717019, 410380572, 427561937, 445249239, 463430255, 482092421, - 501222838, 520808286, 540835229, 561289828, 582157945, 603425159, 625076772, 647097821, - 669473086, 692187106, 715224182, 738568392, 762203605, 786113486, 810281510, 834690976, - 859325014, 884166600, 909198565, 934403610, 959764316, 985263157, 1010882509, 1036604668, - 1062411858, 1088286242, 1114209939, 1140165034, 1166133589, 1192097656, 1218039293, 1243940572, - 1269783591, 1295550491, 1321223465, 1346784770, 1372216740, 1397501800, 1422622476, 1447561406, - 1472301355, 1496825225, 1521116069, 1545157098, 1568931699, 1592423440, 1615616087, 1638493611, - 1661040202, 1683240277, 1705078494, 1726539762, 1747609248, 1768272390, 1788514910, 1808322817, - 1827682422, 1846580346, 1865003529, 1882939237, 1900375077, 1917298998, 1933699304, 1949564660, - 1964884103, 1979647046, 1993843284, 2007463009, 2020496806, 2032935668, 2044771000, 2055994621, - 2066598775, 2076576133, 2085919801, 2094623320, 2102680676, 2110086301, 2116835076, 2122922337, - 2128343877, 2133095950, 2137175272, 2140579023, 2143304850, 2145350871, 2146715671, 2147398307 -}; -#else const double d_hamm_lfe_plc[LFE_PLC_LENANA / 2] = { 0.08000000000000002, 0.08015895227847719, 0.08063569926248770, 0.08142991147368656, 0.08254104003450596, 0.08396831704748331, 0.08571075612595230, 0.08776715307573196, @@ -4001,7 +3549,6 @@ const double d_hamm_lfe_plc[LFE_PLC_LENANA / 2] = 0.96233504613317988, 0.96698111571154954, 0.97133209998031445, 0.97538499198789563, 0.97913699079334116, 0.98258550340204664, 0.98572814655776630, 0.98856274838967395, 0.99108734991333569, 0.99330020638455863, 0.99519978850517732, 0.99678478347994692, 0.99805409592381300, 0.99900684861892730, 0.99964238312089115, 0.99996026021380402 }; -#endif /*------------------------------------------------------------------------------------------* * MDFT/iMDFT ROM tables @@ -4605,687 +4152,7 @@ const float ivas_mdft_coeff_cos_twid_40[IVAS_40_PT_LEN + 1] = 0.3826834324f, 0.3461170571f, 0.3090169944f, 0.2714404499f, 0.2334453639f, 0.1950903220f, 0.1564344650f, 0.1175373975f, 0.0784590957f, 0.0392598158f, 0.000000000f }; -#ifdef IVAS_FLOAT_FIXED - const Word32 ivas_mdft_coeff_cos_twid_960_fx[IVAS_960_PT_LEN + 1] = -{ - 2147483647 , - 2147480832 ,2147472128 ,2147457792 ,2147437696 , - 2147411840 ,2147380096 ,2147342848 ,2147299712 , - 2147250816 ,2147196160 ,2147135872 ,2147069696 , - 2146997888 ,2146920192 ,2146836864 ,2146747776 , - 2146652928 ,2146552320 ,2146445952 ,2146333824 , - 2146216064 ,2146092416 ,2145963136 ,2145827968 , - 2145687168 ,2145540608 ,2145388288 ,2145230208 , - 2145066496 ,2144896896 ,2144721664 ,2144540544 , - 2144353792 ,2144161280 ,2143963008 ,2143759104 , - 2143549312 ,2143333888 ,2143112704 ,2142885760 , - 2142653056 ,2142414592 ,2142170496 ,2141920512 , - 2141664896 ,2141403648 ,2141136512 ,2140863616 , - 2140585088 ,2140300800 ,2140010752 ,2139715072 , - 2139413632 ,2139106432 ,2138793472 ,2138474752 , - 2138150400 ,2137820288 ,2137484544 ,2137142912 , - 2136795648 ,2136442624 ,2136083968 ,2135719552 , - 2135349376 ,2134973440 ,2134591872 ,2134204544 , - 2133811584 ,2133412864 ,2133008384 ,2132598272 , - 2132182400 ,2131760896 ,2131333632 ,2130900608 , - 2130461952 ,2130017536 ,2129567360 ,2129111680 , - 2128650112 ,2128182912 ,2127710080 ,2127231488 , - 2126747136 ,2126257152 ,2125761536 ,2125260160 , - 2124753152 ,2124240384 ,2123721984 ,2123197824 , - 2122668032 ,2122132608 ,2121591424 ,2121044608 , - 2120492032 ,2119933824 ,2119369984 ,2118800384 , - 2118225152 ,2117644288 ,2117057792 ,2116465536 , - 2115867648 ,2115264128 ,2114654848 ,2114039936 , - 2113419392 ,2112793216 ,2112161408 ,2111523840 , - 2110880640 ,2110231808 ,2109577344 ,2108917248 , - 2108251520 ,2107580032 ,2106903040 ,2106220288 , - 2105532032 ,2104838016 ,2104138496 ,2103433216 , - 2102722304 ,2102005888 ,2101283712 ,2100556032 , - 2099822592 ,2099083648 ,2098338944 ,2097588736 , - 2096832896 ,2096071424 ,2095304320 ,2094531712 , - 2093753344 ,2092969472 ,2092179968 ,2091384832 , - 2090584192 ,2089777920 ,2088966016 ,2088148480 , - 2087325440 ,2086496768 ,2085662464 ,2084822656 , - 2083977216 ,2083126272 ,2082269696 ,2081407488 , - 2080539776 ,2079666560 ,2078787712 ,2077903232 , - 2077013248 ,2076117632 ,2075216640 ,2074309888 , - 2073397760 ,2072479872 ,2071556608 ,2070627712 , - 2069693312 ,2068753408 ,2067807872 ,2066856832 , - 2065900288 ,2064938240 ,2063970560 ,2062997504 , - 2062018816 ,2061034624 ,2060044928 ,2059049728 , - 2058049024 ,2057042688 ,2056030976 ,2055013760 , - 2053990912 ,2052962688 ,2051928960 ,2050889728 , - 2049844992 ,2048794752 ,2047739008 ,2046677888 , - 2045611136 ,2044539008 ,2043461376 ,2042378368 , - 2041289728 ,2040195712 ,2039096192 ,2037991296 , - 2036880896 ,2035764992 ,2034643712 ,2033516928 , - 2032384768 ,2031247104 ,2030104064 ,2028955520 , - 2027801600 ,2026642176 ,2025477376 ,2024307200 , - 2023131520 ,2021950464 ,2020764032 ,2019572096 , - 2018374784 ,2017172096 ,2015964032 ,2014750592 , - 2013531648 ,2012307328 ,2011077760 ,2009842688 , - 2008602240 ,2007356416 ,2006105216 ,2004848640 , - 2003586816 ,2002319488 ,2001046912 ,1999768832 , - 1998485504 ,1997196800 ,1995902720 ,1994603264 , - 1993298560 ,1991988480 ,1990673152 ,1989352320 , - 1988026240 ,1986694912 ,1985358208 ,1984016128 , - 1982668800 ,1981316224 ,1979958272 ,1978595072 , - 1977226496 ,1975852672 ,1974473472 ,1973089152 , - 1971699456 ,1970304384 ,1968904192 ,1967498624 , - 1966087808 ,1964671872 ,1963250560 ,1961823872 , - 1960392064 ,1958955008 ,1957512704 ,1956065152 , - 1954612352 ,1953154304 ,1951691136 ,1950222592 , - 1948748928 ,1947270016 ,1945785856 ,1944296576 , - 1942801920 ,1941302272 ,1939797248 ,1938287104 , - 1936771840 ,1935251328 ,1933725568 ,1932194688 , - 1930658688 ,1929117440 ,1927571072 ,1926019584 , - 1924462848 ,1922900992 ,1921334016 ,1919761920 , - 1918184576 ,1916602112 ,1915014656 ,1913421952 , - 1911824128 ,1910221184 ,1908613248 ,1907000064 , - 1905381760 ,1903758464 ,1902130048 ,1900496512 , - 1898857856 ,1897214208 ,1895565312 ,1893911552 , - 1892252544 ,1890588544 ,1888919552 ,1887245440 , - 1885566208 ,1883881984 ,1882192768 ,1880498432 , - 1878799104 ,1877094656 ,1875385344 ,1873670912 , - 1871951488 ,1870227072 ,1868497536 ,1866763136 , - 1865023744 ,1863279232 ,1861529856 ,1859775360 , - 1858016000 ,1856251648 ,1854482304 ,1852707968 , - 1850928768 ,1849144448 ,1847355392 ,1845561216 , - 1843762176 ,1841958144 ,1840149248 ,1838335360 , - 1836516608 ,1834692864 ,1832864384 ,1831030784 , - 1829192448 ,1827349120 ,1825500928 ,1823647744 , - 1821789824 ,1819927040 ,1818059264 ,1816186624 , - 1814309248 ,1812426880 ,1810539776 ,1808647680 , - 1806750848 ,1804849152 ,1802942720 ,1801031296 , - 1799115136 ,1797194112 ,1795268352 ,1793337728 , - 1791402368 ,1789462144 ,1787517184 ,1785567360 , - 1783612800 ,1781653504 ,1779689344 ,1777720576 , - 1775746944 ,1773768576 ,1771785344 ,1769797504 , - 1767804928 ,1765807616 ,1763805440 ,1761798656 , - 1759787136 ,1757771008 ,1755750016 ,1753724416 , - 1751694080 ,1749659008 ,1747619328 ,1745574912 , - 1743525888 ,1741472128 ,1739413760 ,1737350784 , - 1735283072 ,1733210752 ,1731133696 ,1729052160 , - 1726965888 ,1724875008 ,1722779520 ,1720679424 , - 1718574720 ,1716465408 ,1714351616 ,1712233088 , - 1710109952 ,1707982336 ,1705850112 ,1703713280 , - 1701571968 ,1699426048 ,1697275648 ,1695120640 , - 1692961024 ,1690796928 ,1688628352 ,1686455296 , - 1684277632 ,1682095488 ,1679908864 ,1677717632 , - 1675522048 ,1673321984 ,1671117312 ,1668908288 , - 1666694656 ,1664476672 ,1662254208 ,1660027264 , - 1657795968 ,1655560192 ,1653319936 ,1651075200 , - 1648826240 ,1646572672 ,1644314752 ,1642052480 , - 1639785728 ,1637514752 ,1635239168 ,1632959360 , - 1630675200 ,1628386560 ,1626093568 ,1623796352 , - 1621494656 ,1619188736 ,1616878336 ,1614563712 , - 1612244736 ,1609921408 ,1607593856 ,1605261952 , - 1602925696 ,1600585216 ,1598240384 ,1595891328 , - 1593538048 ,1591180416 ,1588818560 ,1586452480 , - 1584082048 ,1581707520 ,1579328640 ,1576945536 , - 1574558336 ,1572166784 ,1569771136 ,1567371136 , - 1564967040 ,1562558720 ,1560146304 ,1557729664 , - 1555308800 ,1552883712 ,1550454656 ,1548021248 , - 1545583872 ,1543142272 ,1540696576 ,1538246656 , - 1535792768 ,1533334656 ,1530872448 ,1528406272 , - 1525935872 ,1523461376 ,1520982912 ,1518500224 , - 1516013568 ,1513522816 ,1511028096 ,1508529280 , - 1506026368 ,1503519488 ,1501008512 ,1498493568 , - 1495974656 ,1493451648 ,1490924672 ,1488393728 , - 1485858816 ,1483319936 ,1480777088 ,1478230144 , - 1475679360 ,1473124608 ,1470565888 ,1468003328 , - 1465436672 ,1462866176 ,1460291840 ,1457713536 , - 1455131264 ,1452545152 ,1449955200 ,1447361280 , - 1444763520 ,1442161920 ,1439556352 ,1436947072 , - 1434333824 ,1431716864 ,1429095936 ,1426471296 , - 1423842688 ,1421210368 ,1418574336 ,1415934336 , - 1413290624 ,1410643200 ,1407991808 ,1405336832 , - 1402678016 ,1400015488 ,1397349120 ,1394679040 , - 1392005248 ,1389327744 ,1386646528 ,1383961600 , - 1381272960 ,1378580608 ,1375884544 ,1373184768 , - 1370481408 ,1367774336 ,1365063552 ,1362349184 , - 1359631232 ,1356909440 ,1354184192 ,1351455232 , - 1348722688 ,1345986560 ,1343246720 ,1340503424 , - 1337756416 ,1335005952 ,1332251776 ,1329494144 , - 1326732928 ,1323968128 ,1321199744 ,1318427904 , - 1315652480 ,1312873600 ,1310091136 ,1307305216 , - 1304515712 ,1301722880 ,1298926464 ,1296126464 , - 1293323136 ,1290516352 ,1287705984 ,1284892288 , - 1282075136 ,1279254528 ,1276430464 ,1273603072 , - 1270772224 ,1267937920 ,1265100288 ,1262259200 , - 1259414784 ,1256567040 ,1253715840 ,1250861312 , - 1248003456 ,1245142272 ,1242277760 ,1239409920 , - 1236538624 ,1233664128 ,1230786432 ,1227905280 , - 1225020928 ,1222133248 ,1219242368 ,1216348160 , - 1213450624 ,1210550016 ,1207646080 ,1204738816 , - 1201828480 ,1198914816 ,1195998080 ,1193078016 , - 1190154752 ,1187228416 ,1184298752 ,1181366016 , - 1178430080 ,1175491072 ,1172548736 ,1169603456 , - 1166654976 ,1163703296 ,1160748544 ,1157790720 , - 1154829824 ,1151865728 ,1148898688 ,1145928448 , - 1142955136 ,1139978880 ,1136999552 ,1134017024 , - 1131031680 ,1128043136 ,1125051648 ,1122057088 , - 1119059584 ,1116059136 ,1113055616 ,1110049152 , - 1107039616 ,1104027264 ,1101011840 ,1097993600 , - 1094972288 ,1091948032 ,1088920960 ,1085890944 , - 1082857984 ,1079822208 ,1076783488 ,1073741824 , - 1070697344 ,1067649984 ,1064599744 ,1061546688 , - 1058490816 ,1055432064 ,1052370496 ,1049306112 , - 1046238912 ,1043168960 ,1040096192 ,1037020608 , - 1033942272 ,1030861120 ,1027777280 ,1024690624 , - 1021601280 ,1018509184 ,1015414336 ,1012316800 , - 1009216512 ,1006113536 ,1003007936 ,999899584 , - 996788544 ,993674880 ,990558528 ,987439552 , - 984317888 ,981193600 ,978066688 ,974937152 , - 971805056 ,968670336 ,965532992 ,962393088 , - 959250560 ,956105536 ,952957888 ,949807744 , - 946655040 ,943499776 ,940342016 ,937181696 , - 934018880 ,930853632 ,927685824 ,924515520 , - 921342784 ,918167552 ,914989888 ,911809792 , - 908627200 ,905442176 ,902254784 ,899064960 , - 895872704 ,892678080 ,889481024 ,886281600 , - 883079808 ,879875648 ,876669120 ,873460288 , - 870249088 ,867035584 ,863819712 ,860601536 , - 857381120 ,854158336 ,850933312 ,847705984 , - 844476352 ,841244544 ,838010432 ,834774080 , - 831535488 ,828294656 ,825051648 ,821806400 , - 818558976 ,815309376 ,812057536 ,808803520 , - 805547392 ,802289088 ,799028608 ,795766016 , - 792501312 ,789234496 ,785965504 ,782694464 , - 779421248 ,776146048 ,772868736 ,769589312 , - 766307840 ,763024320 ,759738816 ,756451200 , - 753161600 ,749870016 ,746576320 ,743280704 , - 739983104 ,736683520 ,733381952 ,730078400 , - 726772864 ,723465472 ,720156096 ,716844800 , - 713531520 ,710216384 ,706899392 ,703580480 , - 700259648 ,696936960 ,693612416 ,690286016 , - 686957760 ,683627648 ,680295744 ,676961984 , - 673626432 ,670289024 ,666949888 ,663608960 , - 660266240 ,656921728 ,653575488 ,650227520 , - 646877760 ,643526272 ,640173120 ,636818176 , - 633461568 ,630103296 ,626743296 ,623381568 , - 620018240 ,616653248 ,613286592 ,609918336 , - 606548352 ,603176832 ,599803648 ,596428864 , - 593052544 ,589674560 ,586295040 ,582913920 , - 579531264 ,576147072 ,572761280 ,569374016 , - 565985152 ,562594816 ,559203008 ,555809664 , - 552414848 ,549018560 ,545620736 ,542221504 , - 538820864 ,535418720 ,532015168 ,528610176 , - 525203776 ,521795968 ,518386752 ,514976160 , - 511564192 ,508150848 ,504736160 ,501320096 , - 497902720 ,494483968 ,491063936 ,487642560 , - 484219904 ,480795936 ,477370656 ,473944128 , - 470516320 ,467087264 ,463656960 ,460225408 , - 456792608 ,453358592 ,449923392 ,446486944 , - 443049344 ,439610528 ,436170528 ,432729376 , - 429287072 ,425843616 ,422399008 ,418953280 , - 415506432 ,412058464 ,408609376 ,405159232 , - 401707968 ,398255648 ,394802272 ,391347808 , - 387892320 ,384435776 ,380978208 ,377519648 , - 374060032 ,370599456 ,367137856 ,363675296 , - 360211744 ,356747232 ,353281760 ,349815360 , - 346348032 ,342879744 ,339410560 ,335940448 , - 332469472 ,328997568 ,325524800 ,322051168 , - 318576640 ,315101280 ,311625088 ,308148064 , - 304670208 ,301191520 ,297712032 ,294231776 , - 290750688 ,287268864 ,283786240 ,280302848 , - 276818752 ,273333888 ,269848288 ,266361952 , - 262874928 ,259387184 ,255898752 ,252409632 , - 248919840 ,245429392 ,241938272 ,238446512 , - 234954112 ,231461072 ,227967424 ,224473168 , - 220978304 ,217482848 ,213986816 ,210490208 , - 206993040 ,203495312 ,199997040 ,196498224 , - 192998896 ,189499040 ,185998688 ,182497840 , - 178996496 ,175494672 ,171992384 ,168489632 , - 164986416 ,161482768 ,157978704 ,154474192 , - 150969280 ,147463968 ,143958256 ,140452144 , - 136945680 ,133438832 ,129931632 ,126424088 , - 122916200 ,119407992 ,115899456 ,112390608 , - 108881464 ,105372032 ,101862312 ,98352320 , - 94842064 ,91331552 ,87820800 ,84309816 , - 80798600 ,77287168 ,73775528 ,70263696 , - 66751672 ,63239472 ,59727100 ,56214568 , - 52701888 ,49189064 ,45676112 ,42163032 , - 38649844 ,35136552 ,31623164 ,28109692 , - 24596146 ,21082532 ,17568864 ,14055147 , - 10541393 ,7027612 ,3513810 ,0 , -}; - - const Word32 ivas_mdft_coeff_cos_twid_640_fx[IVAS_640_PT_LEN + 1] = -{ - 2147483647 , - 2147477120 ,2147457792 ,2147425408 ,2147380096 , - 2147321984 ,2147250816 ,2147166720 ,2147069696 , - 2146959744 ,2146836864 ,2146701056 ,2146552320 , - 2146390656 ,2146216064 ,2146028416 ,2145827968 , - 2145614592 ,2145388288 ,2145149056 ,2144896896 , - 2144631808 ,2144353792 ,2144062848 ,2143759104 , - 2143442304 ,2143112704 ,2142770048 ,2142414592 , - 2142046208 ,2141664896 ,2141270784 ,2140863616 , - 2140443648 ,2140010752 ,2139565056 ,2139106432 , - 2138634880 ,2138150400 ,2137653120 ,2137142912 , - 2136619904 ,2136083968 ,2135535104 ,2134973440 , - 2134398976 ,2133811584 ,2133211392 ,2132598272 , - 2131972352 ,2131333632 ,2130681984 ,2130017536 , - 2129340288 ,2128650112 ,2127947264 ,2127231488 , - 2126502912 ,2125761536 ,2125007360 ,2124240384 , - 2123460608 ,2122668032 ,2121862656 ,2121044608 , - 2120213632 ,2119369984 ,2118513536 ,2117644288 , - 2116762368 ,2115867648 ,2114960128 ,2114039936 , - 2113107072 ,2112161408 ,2111202944 ,2110231808 , - 2109248000 ,2108251520 ,2107242240 ,2106220288 , - 2105185792 ,2104138496 ,2103078528 ,2102005888 , - 2100920576 ,2099822592 ,2098712064 ,2097588736 , - 2096452864 ,2095304320 ,2094143232 ,2092969472 , - 2091783168 ,2090584192 ,2089372672 ,2088148480 , - 2086911744 ,2085662464 ,2084400640 ,2083126272 , - 2081839360 ,2080539776 ,2079227776 ,2077903232 , - 2076566144 ,2075216640 ,2073854464 ,2072479872 , - 2071092864 ,2069693312 ,2068281344 ,2066856832 , - 2065420032 ,2063970560 ,2062508800 ,2061034624 , - 2059548032 ,2058049024 ,2056537600 ,2055013760 , - 2053477504 ,2051928960 ,2050368000 ,2048794752 , - 2047209088 ,2045611136 ,2044000896 ,2042378368 , - 2040743424 ,2039096192 ,2037436800 ,2035764992 , - 2034081024 ,2032384768 ,2030676224 ,2028955520 , - 2027222528 ,2025477376 ,2023720064 ,2021950464 , - 2020168704 ,2018374784 ,2016568704 ,2014750592 , - 2012920192 ,2011077760 ,2009223168 ,2007356416 , - 2005477632 ,2003586816 ,2001683840 ,1999768832 , - 1997841792 ,1995902720 ,1993951616 ,1991988480 , - 1990013440 ,1988026240 ,1986027264 ,1984016128 , - 1981993216 ,1979958272 ,1977911424 ,1975852672 , - 1973782016 ,1971699456 ,1969604992 ,1967498624 , - 1965380480 ,1963250560 ,1961108736 ,1958955008 , - 1956789632 ,1954612352 ,1952423424 ,1950222592 , - 1948010112 ,1945785856 ,1943549952 ,1941302272 , - 1939042816 ,1936771840 ,1934489088 ,1932194688 , - 1929888768 ,1927571072 ,1925241856 ,1922900992 , - 1920548608 ,1918184576 ,1915809024 ,1913421952 , - 1911023360 ,1908613248 ,1906191616 ,1903758464 , - 1901313920 ,1898857856 ,1896390400 ,1893911552 , - 1891421184 ,1888919552 ,1886406400 ,1883881984 , - 1881346176 ,1878799104 ,1876240640 ,1873670912 , - 1871089920 ,1868497536 ,1865894016 ,1863279232 , - 1860653184 ,1858016000 ,1855367552 ,1852707968 , - 1850037248 ,1847355392 ,1844662272 ,1841958144 , - 1839242880 ,1836516608 ,1833779200 ,1831030784 , - 1828271360 ,1825500928 ,1822719360 ,1819927040 , - 1817123584 ,1814309248 ,1811483904 ,1808647680 , - 1805800704 ,1802942720 ,1800073856 ,1797194112 , - 1794303616 ,1791402368 ,1788490240 ,1785567360 , - 1782633728 ,1779689344 ,1776734336 ,1773768576 , - 1770792064 ,1767804928 ,1764807168 ,1761798656 , - 1758779648 ,1755750016 ,1752709760 ,1749659008 , - 1746597760 ,1743525888 ,1740443520 ,1737350784 , - 1734247424 ,1731133696 ,1728009600 ,1724875008 , - 1721730048 ,1718574720 ,1715409024 ,1712233088 , - 1709046784 ,1705850112 ,1702643200 ,1699426048 , - 1696198656 ,1692961024 ,1689713280 ,1686455296 , - 1683187072 ,1679908864 ,1676620416 ,1673321984 , - 1670013312 ,1666694656 ,1663366016 ,1660027264 , - 1656678656 ,1653319936 ,1649951232 ,1646572672 , - 1643184128 ,1639785728 ,1636377472 ,1632959360 , - 1629531392 ,1626093568 ,1622646016 ,1619188736 , - 1615721600 ,1612244736 ,1608758144 ,1605261952 , - 1601756032 ,1598240384 ,1594715264 ,1591180416 , - 1587636096 ,1584082048 ,1580518656 ,1576945536 , - 1573363072 ,1569771136 ,1566169600 ,1562558720 , - 1558938496 ,1555308800 ,1551669760 ,1548021248 , - 1544363648 ,1540696576 ,1537020288 ,1533334656 , - 1529639808 ,1525935872 ,1522222592 ,1518500224 , - 1514768768 ,1511028096 ,1507278336 ,1503519488 , - 1499751552 ,1495974656 ,1492188672 ,1488393728 , - 1484589824 ,1480777088 ,1476955264 ,1473124608 , - 1469285120 ,1465436672 ,1461579520 ,1457713536 , - 1453838720 ,1449955200 ,1446062848 ,1442161920 , - 1438252160 ,1434333824 ,1430406912 ,1426471296 , - 1422527104 ,1418574336 ,1414612992 ,1410643200 , - 1406664832 ,1402678016 ,1398682752 ,1394679040 , - 1390667008 ,1386646528 ,1382617728 ,1378580608 , - 1374535168 ,1370481408 ,1366419456 ,1362349184 , - 1358270848 ,1354184192 ,1350089472 ,1345986560 , - 1341875584 ,1337756416 ,1333629312 ,1329494144 , - 1325350912 ,1321199744 ,1317040640 ,1312873600 , - 1308698624 ,1304515712 ,1300325120 ,1296126464 , - 1291920128 ,1287705984 ,1283484160 ,1279254528 , - 1275017216 ,1270772224 ,1266519552 ,1262259200 , - 1257991296 ,1253715840 ,1249432832 ,1245142272 , - 1240844160 ,1236538624 ,1232225664 ,1227905280 , - 1223577472 ,1219242368 ,1214899840 ,1210550016 , - 1206192896 ,1201828480 ,1197456896 ,1193078016 , - 1188691968 ,1184298752 ,1179898496 ,1175491072 , - 1171076480 ,1166654976 ,1162226304 ,1157790720 , - 1153348224 ,1148898688 ,1144442240 ,1139978880 , - 1135508608 ,1131031680 ,1126547712 ,1122057088 , - 1117559680 ,1113055616 ,1108544768 ,1104027264 , - 1099503104 ,1094972288 ,1090434944 ,1085890944 , - 1081340416 ,1076783488 ,1072219968 ,1067649984 , - 1063073600 ,1058490816 ,1053901632 ,1049306112 , - 1044704320 ,1040096192 ,1035481792 ,1030861120 , - 1026234304 ,1021601280 ,1016962112 ,1012316800 , - 1007665408 ,1003007936 ,998344384 ,993674880 , - 988999360 ,984317888 ,979630464 ,974937152 , - 970238016 ,965532992 ,960822144 ,956105536 , - 951383104 ,946655040 ,941921216 ,937181696 , - 932436544 ,927685824 ,922929472 ,918167552 , - 913400128 ,908627200 ,903848768 ,899064960 , - 894275648 ,889481024 ,884681024 ,879875648 , - 875065024 ,870249088 ,865427968 ,860601536 , - 855769984 ,850933312 ,846091456 ,841244544 , - 836392512 ,831535488 ,826673472 ,821806400 , - 816934464 ,812057536 ,807175744 ,802289088 , - 797397632 ,792501312 ,787600256 ,782694464 , - 777783936 ,772868736 ,767948864 ,763024320 , - 758095232 ,753161600 ,748223424 ,743280704 , - 738333568 ,733381952 ,728425856 ,723465472 , - 718500672 ,713531520 ,708558144 ,703580480 , - 698598528 ,693612416 ,688622080 ,683627648 , - 678629056 ,673626432 ,668619712 ,663608960 , - 658594176 ,653575488 ,648552832 ,643526272 , - 638495872 ,633461568 ,628423488 ,623381568 , - 618335936 ,613286592 ,608233536 ,603176832 , - 598116480 ,593052544 ,587985024 ,582913920 , - 577839360 ,572761280 ,567679744 ,562594816 , - 557506496 ,552414848 ,547319808 ,542221504 , - 537119936 ,532015168 ,526907136 ,521795968 , - 516681632 ,511564192 ,506443680 ,501320096 , - 496193504 ,491063936 ,485931392 ,480795936 , - 475657568 ,470516320 ,465372256 ,460225408 , - 455075776 ,449923392 ,444768288 ,439610528 , - 434450112 ,429287072 ,424121440 ,418953280 , - 413782592 ,408609376 ,403433728 ,398255648 , - 393075168 ,387892320 ,382707136 ,377519648 , - 372329856 ,367137856 ,361943648 ,356747232 , - 351548672 ,346348032 ,341145280 ,335940448 , - 330733632 ,325524800 ,320314016 ,315101280 , - 309886688 ,304670208 ,299451872 ,294231776 , - 289009856 ,283786240 ,278560896 ,273333888 , - 268105200 ,262874928 ,257643056 ,252409632 , - 247174704 ,241938272 ,236700384 ,231461072 , - 226220368 ,220978304 ,215734912 ,210490208 , - 205244240 ,199997040 ,194748624 ,189499040 , - 184248320 ,178996496 ,173743584 ,168489632 , - 163234656 ,157978704 ,152721792 ,147463968 , - 142205248 ,136945680 ,131685280 ,126424088 , - 121162136 ,115899456 ,110636072 ,105372032 , - 100107344 ,94842064 ,89576208 ,84309816 , - 79042912 ,73775528 ,68507704 ,63239472 , - 57970852 ,52701888 ,47432604 ,42163032 , - 36893208 ,31623164 ,26352928 ,21082532 , - 15812011 ,10541393 ,5270713 ,0 , - }; - - const Word32 ivas_mdft_coeff_cos_twid_320_fx[IVAS_320_PT_LEN + 1] = - { - 2147483647 , - 2147457792 ,2147380096 ,2147250816 ,2147069696 , - 2146836864 ,2146552320 ,2146216064 ,2145827968 , - 2145388288 ,2144896896 ,2144353792 ,2143759104 , - 2143112704 ,2142414592 ,2141664896 ,2140863616 , - 2140010752 ,2139106432 ,2138150400 ,2137142912 , - 2136083968 ,2134973440 ,2133811584 ,2132598272 , - 2131333632 ,2130017536 ,2128650112 ,2127231488 , - 2125761536 ,2124240384 ,2122668032 ,2121044608 , - 2119369984 ,2117644288 ,2115867648 ,2114039936 , - 2112161408 ,2110231808 ,2108251520 ,2106220288 , - 2104138496 ,2102005888 ,2099822592 ,2097588736 , - 2095304320 ,2092969472 ,2090584192 ,2088148480 , - 2085662464 ,2083126272 ,2080539776 ,2077903232 , - 2075216640 ,2072479872 ,2069693312 ,2066856832 , - 2063970560 ,2061034624 ,2058049024 ,2055013760 , - 2051928960 ,2048794752 ,2045611136 ,2042378368 , - 2039096192 ,2035764992 ,2032384768 ,2028955520 , - 2025477376 ,2021950464 ,2018374784 ,2014750592 , - 2011077760 ,2007356416 ,2003586816 ,1999768832 , - 1995902720 ,1991988480 ,1988026240 ,1984016128 , - 1979958272 ,1975852672 ,1971699456 ,1967498624 , - 1963250560 ,1958955008 ,1954612352 ,1950222592 , - 1945785856 ,1941302272 ,1936771840 ,1932194688 , - 1927571072 ,1922900992 ,1918184576 ,1913421952 , - 1908613248 ,1903758464 ,1898857856 ,1893911552 , - 1888919552 ,1883881984 ,1878799104 ,1873670912 , - 1868497536 ,1863279232 ,1858016000 ,1852707968 , - 1847355392 ,1841958144 ,1836516608 ,1831030784 , - 1825500928 ,1819927040 ,1814309248 ,1808647680 , - 1802942720 ,1797194112 ,1791402368 ,1785567360 , - 1779689344 ,1773768576 ,1767804928 ,1761798656 , - 1755750016 ,1749659008 ,1743525888 ,1737350784 , - 1731133696 ,1724875008 ,1718574720 ,1712233088 , - 1705850112 ,1699426048 ,1692961024 ,1686455296 , - 1679908864 ,1673321984 ,1666694656 ,1660027264 , - 1653319936 ,1646572672 ,1639785728 ,1632959360 , - 1626093568 ,1619188736 ,1612244736 ,1605261952 , - 1598240384 ,1591180416 ,1584082048 ,1576945536 , - 1569771136 ,1562558720 ,1555308800 ,1548021248 , - 1540696576 ,1533334656 ,1525935872 ,1518500224 , - 1511028096 ,1503519488 ,1495974656 ,1488393728 , - 1480777088 ,1473124608 ,1465436672 ,1457713536 , - 1449955200 ,1442161920 ,1434333824 ,1426471296 , - 1418574336 ,1410643200 ,1402678016 ,1394679040 , - 1386646528 ,1378580608 ,1370481408 ,1362349184 , - 1354184192 ,1345986560 ,1337756416 ,1329494144 , - 1321199744 ,1312873600 ,1304515712 ,1296126464 , - 1287705984 ,1279254528 ,1270772224 ,1262259200 , - 1253715840 ,1245142272 ,1236538624 ,1227905280 , - 1219242368 ,1210550016 ,1201828480 ,1193078016 , - 1184298752 ,1175491072 ,1166654976 ,1157790720 , - 1148898688 ,1139978880 ,1131031680 ,1122057088 , - 1113055616 ,1104027264 ,1094972288 ,1085890944 , - 1076783488 ,1067649984 ,1058490816 ,1049306112 , - 1040096192 ,1030861120 ,1021601280 ,1012316800 , - 1003007936 ,993674880 ,984317888 ,974937152 , - 965532992 ,956105536 ,946655040 ,937181696 , - 927685824 ,918167552 ,908627200 ,899064960 , - 889481024 ,879875648 ,870249088 ,860601536 , - 850933312 ,841244544 ,831535488 ,821806400 , - 812057536 ,802289088 ,792501312 ,782694464 , - 772868736 ,763024320 ,753161600 ,743280704 , - 733381952 ,723465472 ,713531520 ,703580480 , - 693612416 ,683627648 ,673626432 ,663608960 , - 653575488 ,643526272 ,633461568 ,623381568 , - 613286592 ,603176832 ,593052544 ,582913920 , - 572761280 ,562594816 ,552414848 ,542221504 , - 532015168 ,521795968 ,511564192 ,501320096 , - 491063936 ,480795936 ,470516320 ,460225408 , - 449923392 ,439610528 ,429287072 ,418953280 , - 408609376 ,398255648 ,387892320 ,377519648 , - 367137856 ,356747232 ,346348032 ,335940448 , - 325524800 ,315101280 ,304670208 ,294231776 , - 283786240 ,273333888 ,262874928 ,252409632 , - 241938272 ,231461072 ,220978304 ,210490208 , - 199997040 ,189499040 ,178996496 ,168489632 , - 157978704 ,147463968 ,136945680 ,126424088 , - 115899456 ,105372032 ,94842064 ,84309816 , - 73775528 ,63239472 ,52701888 ,42163032 , - 31623164 ,21082532 ,10541393 ,0 , - }; - - const Word32 ivas_mdft_coeff_cos_twid_240_fx[IVAS_240_PT_LEN + 1] = - { - 2147483647 , - 2147437696 ,2147299712 ,2147069696 ,2146747776 , - 2146333824 ,2145827968 ,2145230208 ,2144540544 , - 2143759104 ,2142885760 ,2141920512 ,2140863616 , - 2139715072 ,2138474752 ,2137142912 ,2135719552 , - 2134204544 ,2132598272 ,2130900608 ,2129111680 , - 2127231488 ,2125260160 ,2123197824 ,2121044608 , - 2118800384 ,2116465536 ,2114039936 ,2111523840 , - 2108917248 ,2106220288 ,2103433216 ,2100556032 , - 2097588736 ,2094531712 ,2091384832 ,2088148480 , - 2084822656 ,2081407488 ,2077903232 ,2074309888 , - 2070627712 ,2066856832 ,2062997504 ,2059049728 , - 2055013760 ,2050889728 ,2046677888 ,2042378368 , - 2037991296 ,2033516928 ,2028955520 ,2024307200 , - 2019572096 ,2014750592 ,2009842688 ,2004848640 , - 1999768832 ,1994603264 ,1989352320 ,1984016128 , - 1978595072 ,1973089152 ,1967498624 ,1961823872 , - 1956065152 ,1950222592 ,1944296576 ,1938287104 , - 1932194688 ,1926019584 ,1919761920 ,1913421952 , - 1907000064 ,1900496512 ,1893911552 ,1887245440 , - 1880498432 ,1873670912 ,1866763136 ,1859775360 , - 1852707968 ,1845561216 ,1838335360 ,1831030784 , - 1823647744 ,1816186624 ,1808647680 ,1801031296 , - 1793337728 ,1785567360 ,1777720576 ,1769797504 , - 1761798656 ,1753724416 ,1745574912 ,1737350784 , - 1729052160 ,1720679424 ,1712233088 ,1703713280 , - 1695120640 ,1686455296 ,1677717632 ,1668908288 , - 1660027264 ,1651075200 ,1642052480 ,1632959360 , - 1623796352 ,1614563712 ,1605261952 ,1595891328 , - 1586452480 ,1576945536 ,1567371136 ,1557729664 , - 1548021248 ,1538246656 ,1528406272 ,1518500224 , - 1508529280 ,1498493568 ,1488393728 ,1478230144 , - 1468003328 ,1457713536 ,1447361280 ,1436947072 , - 1426471296 ,1415934336 ,1405336832 ,1394679040 , - 1383961600 ,1373184768 ,1362349184 ,1351455232 , - 1340503424 ,1329494144 ,1318427904 ,1307305216 , - 1296126464 ,1284892288 ,1273603072 ,1262259200 , - 1250861312 ,1239409920 ,1227905280 ,1216348160 , - 1204738816 ,1193078016 ,1181366016 ,1169603456 , - 1157790720 ,1145928448 ,1134017024 ,1122057088 , - 1110049152 ,1097993600 ,1085890944 ,1073741824 , - 1061546688 ,1049306112 ,1037020608 ,1024690624 , - 1012316800 ,999899584 ,987439552 ,974937152 , - 962393088 ,949807744 ,937181696 ,924515520 , - 911809792 ,899064960 ,886281600 ,873460288 , - 860601536 ,847705984 ,834774080 ,821806400 , - 808803520 ,795766016 ,782694464 ,769589312 , - 756451200 ,743280704 ,730078400 ,716844800 , - 703580480 ,690286016 ,676961984 ,663608960 , - 650227520 ,636818176 ,623381568 ,609918336 , - 596428864 ,582913920 ,569374016 ,555809664 , - 542221504 ,528610176 ,514976160 ,501320096 , - 487642560 ,473944128 ,460225408 ,446486944 , - 432729376 ,418953280 ,405159232 ,391347808 , - 377519648 ,363675296 ,349815360 ,335940448 , - 322051168 ,308148064 ,294231776 ,280302848 , - 266361952 ,252409632 ,238446512 ,224473168 , - 210490208 ,196498224 ,182497840 ,168489632 , - 154474192 ,140452144 ,126424088 ,112390608 , - 98352320 ,84309816 ,70263696 ,56214568 , - 42163032 ,28109692 ,14055147 ,0 , - }; -const Word32 ivas_mdft_coeff_cos_twid_160_fx[IVAS_160_PT_LEN + 1] = -{ - 2147483647 , - 2147380096 ,2147069696 ,2146552320 ,2145827968 , - 2144896896 ,2143759104 ,2142414592 ,2140863616 , - 2139106432 ,2137142912 ,2134973440 ,2132598272 , - 2130017536 ,2127231488 ,2124240384 ,2121044608 , - 2117644288 ,2114039936 ,2110231808 ,2106220288 , - 2102005888 ,2097588736 ,2092969472 ,2088148480 , - 2083126272 ,2077903232 ,2072479872 ,2066856832 , - 2061034624 ,2055013760 ,2048794752 ,2042378368 , - 2035764992 ,2028955520 ,2021950464 ,2014750592 , - 2007356416 ,1999768832 ,1991988480 ,1984016128 , - 1975852672 ,1967498624 ,1958955008 ,1950222592 , - 1941302272 ,1932194688 ,1922900992 ,1913421952 , - 1903758464 ,1893911552 ,1883881984 ,1873670912 , - 1863279232 ,1852707968 ,1841958144 ,1831030784 , - 1819927040 ,1808647680 ,1797194112 ,1785567360 , - 1773768576 ,1761798656 ,1749659008 ,1737350784 , - 1724875008 ,1712233088 ,1699426048 ,1686455296 , - 1673321984 ,1660027264 ,1646572672 ,1632959360 , - 1619188736 ,1605261952 ,1591180416 ,1576945536 , - 1562558720 ,1548021248 ,1533334656 ,1518500224 , - 1503519488 ,1488393728 ,1473124608 ,1457713536 , - 1442161920 ,1426471296 ,1410643200 ,1394679040 , - 1378580608 ,1362349184 ,1345986560 ,1329494144 , - 1312873600 ,1296126464 ,1279254528 ,1262259200 , - 1245142272 ,1227905280 ,1210550016 ,1193078016 , - 1175491072 ,1157790720 ,1139978880 ,1122057088 , - 1104027264 ,1085890944 ,1067649984 ,1049306112 , - 1030861120 ,1012316800 ,993674880 ,974937152 , - 956105536 ,937181696 ,918167552 ,899064960 , - 879875648 ,860601536 ,841244544 ,821806400 , - 802289088 ,782694464 ,763024320 ,743280704 , - 723465472 ,703580480 ,683627648 ,663608960 , - 643526272 ,623381568 ,603176832 ,582913920 , - 562594816 ,542221504 ,521795968 ,501320096 , - 480795936 ,460225408 ,439610528 ,418953280 , - 398255648 ,377519648 ,356747232 ,335940448 , - 315101280 ,294231776 ,273333888 ,252409632 , - 231461072 ,210490208 ,189499040 ,168489632 , - 147463968 ,126424088 ,105372032 ,84309816 , - 63239472 ,42163032 ,21082532 ,0 , -}; - -const Word32 ivas_mdft_coeff_cos_twid_120_fx[IVAS_120_PT_LEN + 1] = -{ - 2147483647 , - 2147299712 ,2146747776 ,2145827968 ,2144540544 , - 2142885760 ,2140863616 ,2138474752 ,2135719552 , - 2132598272 ,2129111680 ,2125260160 ,2121044608 , - 2116465536 ,2111523840 ,2106220288 ,2100556032 , - 2094531712 ,2088148480 ,2081407488 ,2074309888 , - 2066856832 ,2059049728 ,2050889728 ,2042378368 , - 2033516928 ,2024307200 ,2014750592 ,2004848640 , - 1994603264 ,1984016128 ,1973089152 ,1961823872 , - 1950222592 ,1938287104 ,1926019584 ,1913421952 , - 1900496512 ,1887245440 ,1873670912 ,1859775360 , - 1845561216 ,1831030784 ,1816186624 ,1801031296 , - 1785567360 ,1769797504 ,1753724416 ,1737350784 , - 1720679424 ,1703713280 ,1686455296 ,1668908288 , - 1651075200 ,1632959360 ,1614563712 ,1595891328 , - 1576945536 ,1557729664 ,1538246656 ,1518500224 , - 1498493568 ,1478230144 ,1457713536 ,1436947072 , - 1415934336 ,1394679040 ,1373184768 ,1351455232 , - 1329494144 ,1307305216 ,1284892288 ,1262259200 , - 1239409920 ,1216348160 ,1193078016 ,1169603456 , - 1145928448 ,1122057088 ,1097993600 ,1073741824 , - 1049306112 ,1024690624 ,999899584 ,974937152 , - 949807744 ,924515520 ,899064960 ,873460288 , - 847705984 ,821806400 ,795766016 ,769589312 , - 743280704 ,716844800 ,690286016 ,663608960 , - 636818176 ,609918336 ,582913920 ,555809664 , - 528610176 ,501320096 ,473944128 ,446486944 , - 418953280 ,391347808 ,363675296 ,335940448 , - 308148064 ,280302848 ,252409632 ,224473168 , - 196498224 ,168489632 ,140452144 ,112390608 , - 84309816 ,56214568 ,28109692 ,0 , -}; - -const Word32 ivas_mdft_coeff_cos_twid_80_fx[IVAS_80_PT_LEN + 1] = -{ - 2147483647 , - 2147069696 ,2145827968 ,2143759104 ,2140863616 , - 2137142912 ,2132598272 ,2127231488 ,2121044608 , - 2114039936 ,2106220288 ,2097588736 ,2088148480 , - 2077903232 ,2066856832 ,2055013760 ,2042378368 , - 2028955520 ,2014750592 ,1999768832 ,1984016128 , - 1967498624 ,1950222592 ,1932194688 ,1913421952 , - 1893911552 ,1873670912 ,1852707968 ,1831030784 , - 1808647680 ,1785567360 ,1761798656 ,1737350784 , - 1712233088 ,1686455296 ,1660027264 ,1632959360 , - 1605261952 ,1576945536 ,1548021248 ,1518500224 , - 1488393728 ,1457713536 ,1426471296 ,1394679040 , - 1362349184 ,1329494144 ,1296126464 ,1262259200 , - 1227905280 ,1193078016 ,1157790720 ,1122057088 , - 1085890944 ,1049306112 ,1012316800 ,974937152 , - 937181696 ,899064960 ,860601536 ,821806400 , - 782694464 ,743280704 ,703580480 ,663608960 , - 623381568 ,582913920 ,542221504 ,501320096 , - 460225408 ,418953280 ,377519648 ,335940448 , - 294231776 ,252409632 ,210490208 ,168489632 , - 126424088 ,84309816 ,42163032 ,0 , -}; - -const Word32 ivas_mdft_coeff_cos_twid_40_fx[IVAS_40_PT_LEN + 1] = -{ - 2147483647 , - 2145827968 ,2140863616 ,2132598272 ,2121044608 , - 2106220288 ,2088148480 ,2066856832 ,2042378368 , - 2014750592 ,1984016128 ,1950222592 ,1913421952 , - 1873670912 ,1831030784 ,1785567360 ,1737350784 , - 1686455296 ,1632959360 ,1576945536 ,1518500224 , - 1457713536 ,1394679040 ,1329494144 ,1262259200 , - 1193078016 ,1122057088 ,1049306112 ,974937152 , - 899064960 ,821806400 ,743280704 ,663608960 , - 582913920 ,501320096 ,418953280 ,335940448 , - 252409632 ,168489632 ,84309816 ,0 , -}; -#endif const float ivas_sin_twiddle_480[IVAS_480_PT_LEN >> 1] = { -0.000818122995607253f, -0.00736304124977957f, -0.0139076440957708f, -0.0204516511845773f, @@ -5609,18 +4476,7 @@ const float dirac_gains_norm_term[9] = { 1.000000e+00f, 7.071068e-01f, 1.000000e+00f, 4.082483e-01f, 2.041242e-01f, 1.000000e+00f, 2.886751e-01f, 9.128709e-02f, 3.726780e-02f }; -#ifdef IVAS_FLOAT_FIXED -const Word32 dirac_gains_norm_term_int[9] = //Q30 -{ - 1073741824, 759250176, 1073741824, 438353280, 219176688, 1073741824, 309962528, 98018768, - 40015996 -}; -const Word32 dirac_gains_norm_term_fx[9] = //Q31 -{ - 2147483647, 1518500352, 2147483647, 876706560, 438353376, 2147483647, 619925056, 196037536, 80031992 -}; -#endif const float dirac_gains_Pnm[91][9] = { {-1.000000e+00f,-0.000000e+00f,1.000000e+00f,-0.000000e+00f,0.000000e+00f,-1.000000e+00f,-0.000000e+00f,0.000000e+00f,-0.000000e+00f}, @@ -5715,102 +4571,7 @@ const float dirac_gains_Pnm[91][9] = {-1.745235e-02f,9.998478e-01f,-4.995431e-01f,-5.234908e-02f,2.999086e+00f,2.616524e-02f,-1.497488e+00f,-2.617055e-01f,1.499315e+01f}, {-4.371139e-08f,1.000000e+00f,-5.000000e-01f,-1.311342e-07f,3.000000e+00f,6.556709e-08f,-1.500000e+00f,-6.556709e-07f,1.500000e+01f} }; -#ifdef IVAS_FLOAT_FIXED -const Word32 dirac_gains_Pnm_int[91][9] = //Q27 -{ - {-134217728, 0, 134217728, 0, 0, -134217728, 0, 0, 0}, - {-134197288, 2342396, 134156400, -7026119, 122639, -134095104, 14049026, -613106, 10701}, - {-134135976, 4684105, 133972536, -14043751, 490416, -133727536, 28061840, -2450586, 85575}, - {-134033784, 7024438, 133666264, -21044428, 1102895, -133115936, 42002312, -5506921, 288606}, - {-133890784, 9362478, 133238096, -28019012, 1959264, -132262040, 55833192, -9772457, 683351}, - {-133706992, 11697809, 132688440, -34959892, 3058584, -131167848, 69520408, -15234719, 1332861}, - {-133482480, 14029564, 132017976, -41858120, 4399464, -129836328, 83027720, -21876818, 2299344}, - {-133217280, 16357047, 131227600, -48705360, 5980272, -128270864, 96320208, -29678480, 3644062}, - {-132911536, 18679510, 130318176, -55493180, 7799064, -126475552, 109363520, -38615824, 5427104}, - {-132565296, 20996256, 129290928, -62213284, 9853607, -124455056, 122123976, -48661468, 7707213}, - {-132178656, 23306694, 128146968, -68857816, 12141505, -122214432, 134569248, -59785232, 10541761}, - {-131751776, 25609964, 126887800, -75418320, 14659851, -119759704, 146666688, -71952528, 13986158}, - {-131284736, 27905410, 125514928, -81886824, 17405570, -117097048, 158385376, -85126080, 18094094}, - {-130777744, 30192412, 124030024, -88255768, 20375446, -114233392, 169695776, -99266128, 22917396}, - {-130230888, 32470208, 122434848, -94517128, 23565774, -111176104, 180568608, -114328832, 28505376}, - {-129644368, 34738112, 120731408, -100663320, 26972664, -107933048, 190976128, -130267952, 34905200}, - {-129018344, 36995424, 118921736, -106686840, 30591964, -104512608, 200891728, -147034448, 42161440}, - {-128353056, 39241452, 117008088, -112580368, 34419264, -100923608, 210290720, -164576576, 50316080}, - {-127648640, 41475572, 114992728, -118336848, 38449984, -97175216, 219149232, -182840512, 59408524}, - {-126905360, 43697012, 112878208, -123949000, 42679048, -93277184, 227444688, -201769248, 69474696}, - {-126123408, 45905176, 110666976, -129410248, 47101484, -89239304, 235156848, -221304640, 80548296}, - {-125303040, 48099312, 108361848, -134713792, 51711740, -85072152, 242266352, -241385344, 92659128}, - {-124444528, 50278820, 105965584, -139853120, 56504308, -80786280, 248755776, -261949392, 105834368}, - {-123548080, 52443040, 103481048, -144822272, 61473384, -76392608, 254609280, -282932704, 120097808}, - {-122614016, 54591264, 100911328, -149614784, 66612780, -71902504, 259812912, -304269024, 135469312}, - {-121642584, 56722880, 98259536, -154225168, 71916384, -67327280, 264354304, -325891904, 151965872}, - {-120634104, 58837188, 95528944, -158647504, 77377552, -62678672, 268222720, -347732352, 169600480}, - {-119588872, 60933588, 92722800, -162876704, 82989840, -57968464, 271409984, -369722464, 188383040}, - {-118507224, 63011412, 89844624, -166907264, 88746208, -53208660, 273908992, -391791360, 208319200}, - {-117389480, 65070028, 86897888, -170734608, 94639696, -48411356, 275714624, -413868832, 229411120}, - {-116235952, 67108864, 83886096, -174353936, 100663296, -43588484, 276824064, -435884832, 251658240}, - {-115047032, 69127240, 80812992, -177760784, 106809472, -38752388, 277236128, -457767936, 275054816}, - {-113823072, 71124576, 77682296, -180951136, 113070880, -33915128, 276951296, -479447744, 299592224}, - {-112564464, 73100224, 74497888, -183920976, 119439696, -29088994, 275972448, -500852768, 325257600}, - {-111271560, 75053584, 71263600, -186666800, 125908272, -24285974, 274304128, -521913568, 352034976}, - {-109944736, 76984136, 67983320, -189185120, 132468856, -19517968, 271952224, -542560640, 379905024}, - {-108584440, 78891192, 64661120, -191472992, 139113184, -14796968, 268925472, -562724864, 408843424}, - {-107191040, 80774240, 61300996, -193527600, 145833472, -10134552, 265233552, -582338944, 438823936}, - {-105765016, 82632672, 57907084, -195346384, 152621264, -5542341, 260888528, -601335936, 469815200}, - {-104306760, 84465968, 54483472, -196927072, 159468512, -1031517, 255903808, -619651456, 501783968}, - {-102816736, 86273488, 51034412, -198267904, 166366624, 3386773, 250294992, -637221056, 534692032}, - {-101295408, 88054736, 47564080, -199367280, 173307296, 7701825, 244078832, -653983232, 568498944}, - {-99743224, 89809192, 44076620, -200223728, 180282192, 11903295, 237274256, -669879040, 603161856}, - {-98160648, 91536272, 40576356, -200836160, 187282720, 15980983, 229901280, -684849728, 638632640}, - {-96548144, 93235488, 37067500, -201203920, 194300432, 19925212, 221981760, -698840192, 674862144}, - {-94906272, 94906272, 33554432, -201326592, 201326592, 23726568, 213539056, -711796992, 711796992}, - {-93235488, 96548144, 30041364, -201203920, 208352752, 27376188, 204597888, -723670016, 749382016}, - {-91536272, 98160648, 26532496, -200836160, 215370464, 30865648, 195183856, -734411520, 787559936}, - {-89809200, 99743208, 23032272, -200223728, 222370864, 34186800, 185324752, -743976000, 826268864}, - {-88054736, 101295408, 19544786, -199367280, 229345888, 37332284, 175048640, -752322176, 865447872}, - {-86273488, 102816736, 16074439, -198268032, 236286560, 40294912, 164385440, -759410496, 905030144}, - {-84465944, 104306784, 12625336, -196927072, 243184800, 43068320, 153365504, -765205632, 944950528}, - {-82632672, 105765016, 9201773, -195346384, 250031920, 45646496, 142020480, -769675200, 985139200}, - {-80774256, 107191032, 5807891, -193527600, 256819584, 48024044, 130382952, -772789696, 1025526400}, - {-78891192, 108584440, 2447739, -191472992, 263540000, 50196224, 118485736, -774524480, 1066041600}, - {-76984120, 109944720, -874438, -189185120, 270184320, 52158672, 106363224, -774856768, 1106610176}, - {-75053584, 111271544, -4154720, -186666800, 276744864, 53907864, 94049432, -773768704, 1147159552}, - {-73100224, 112564464, -7389016, -183920976, 283213504, 55440728, 81579720, -771245696, 1187614080}, - {-71124568, 113823072, -10573435, -180951136, 289582400, 56754824, 68989160, -767276288, 1227898496}, - {-69127232, 115047064, -13704140, -177760784, 295843776, 57848416, 56313356, -761853888, 1267938048}, - {-67108880, 116235952, -16777203, -174353936, 301989888, 58720256, 43588536, -754974720, 1307654528}, - {-65070028, 117389472, -19788994, -170734608, 308013440, 59369844, 30850226, -746639232, 1346972928}, - {-63011400, 118507224, -22735772, -166907264, 313906944, 59797272, 18134762, -736851968, 1385816832}, - {-60933588, 119588872, -25613950, -162876704, 319663424, 60003204, 5477891, -725620736, 1424110464}, - {-58837172, 120634088, -28420080, -158647504, 325275584, 59989016, -7084927, -712957184, 1461778688}, - {-56722868, 121642576, -31150674, -154225168, 330736768, 59756660, -19517928, -698877184, 1498746240}, - {-54591276, 122613992, -33802452, -149614784, 336040384, 59308680, -31786382, -683399744, 1534940800}, - {-52443040, 123548064, -36372160, -144822272, 341179712, 58648260, -43855684, -666547776, 1570288384}, - {-50278848, 124444520, -38856688, -139853264, 346148864, 57779188, -55691916, -648348160, 1604717952}, - {-48099324, 125303040, -41252988, -134713792, 350941376, 56705796, -67261816, -628830848, 1638160896}, - {-45905160, 126123416, -43558124, -129410240, 355551744, 55433036, -78532848, -608029120, 1670546304}, - {-43697012, 126905360, -45769332, -123949000, 359974080, 53966400, -89473440, -585980480, 1701810944}, - {-41475560, 127648632, -47883864, -118336808, 364203168, 52311936, -100052728, -562724992, 1731889152}, - {-39241464, 128353048, -49899212, -112580408, 368233856, 50476188, -110241232, -538305984, 1760719104}, - {-36995424, 129018360, -51812888, -106686856, 372061216, 48466224, -120010336, -512769824, 1788240512}, - {-34738100, 129644368, -53622532, -100663280, 375680512, 46289628, -129332608, -486166400, 1814398208}, - {-32470208, 130230888, -55325984, -94517088, 379087360, 43954400, -138181984, -458547616, 1839134464}, - {-30192412, 130777744, -56921148, -88255752, 382277728, 41469052, -146533552, -429968768, 1862399872}, - {-27905450, 131284752, -58406064, -81886920, 385247552, 38842476, -154363936, -400487584, 1884144384}, - {-25609950, 131751776, -59778952, -75418272, 387993376, 36083912, -161651424, -370163232, 1904324096}, - {-23306666, 132178656, -61038128, -68857760, 390511712, 33203050, -168375472, -339058272, 1922894464}, - {-20996270, 132565280, -62182040, -62213328, 392799456, 30209874, -174517136, -307236864, 1939817984}, - {-18679498, 132911536, -63209344, -55493124, 394854208, 27114732, -180059392, -274765312, 1955057024}, - {-16357021, 133217280, -64118736, -48705292, 396672992, 23928188, -184986656, -241711232, 1968580864}, - {-14029578, 133482472, -64909128, -41858176, 398253664, 20661142, -189285248, -208144320, 1980359808}, - {-11697849, 133706992, -65579560, -34960012, 399594624, 17324636, -192943088, -174134880, 1990369664}, - {-9362556, 133890784, -66129224, -28019252, 400693888, 13929935, -195949824, -139755008, 1998589184}, - {-7024411, 134033784, -66557432, -21044346, 401550304, 10488515, -198297168, -105077560, 2004999424}, - {-4684126, 134135976, -66863648, -14043818, 402162752, 7011926, -199978640, -70176320, 2009588352}, - {-2342414, 134197304, -67047540, -7026174, 402530496, 3511839, -200989440, -35125516, 2012346496}, - {-5, 134217728, -67108864, -17, 402653184, 8, -201326592, -88, 2013265920} -}; -#endif + const float dirac_gains_trg_term[181][2] = { {-1.000000e+00f,8.742278e-08f}, @@ -5995,376 +4756,7 @@ const float dirac_gains_trg_term[181][2] = {9.998477e-01f,-1.745241e-02f}, {1.000000e+00f,0.000000e+00f} }; -#ifdef IVAS_FLOAT_FIXED -const Word32 dirac_gains_trg_term_int[181][2] = //Q30 -{ - {-1073741824, 93}, - {-1073578304, -18739436}, - {-1073087680, -37473000}, - {-1072270272, -56195404}, - {-1071126272, -74900440}, - {-1069655936, -93582656}, - {-1067859776, -112236624}, - {-1065738240, -130856168}, - {-1063292288, -149436080}, - {-1060522368, -167970160}, - {-1057429248, -186453440}, - {-1054014208, -204879600}, - {-1050278016, -223243376}, - {-1046221952, -241539408}, - {-1041847104, -259761664}, - {-1037154944, -277904896}, - {-1032146880, -295963392}, - {-1026824448, -313931616}, - {-1021189120, -331804480}, - {-1015242880, -349576096}, - {-1008987264, -367241408}, - {-1002424448, -384794592}, - {-995556160, -402230656}, - {-988384640, -419544416}, - {-980912000, -436730112}, - {-973140608, -453782944}, - {-965072832, -470697376}, - {-956710976, -487468704}, - {-948057792, -504091296}, - {-939115840, -520560224}, - {-929887680, -536871040}, - {-920376384, -553017856}, - {-910584576, -568996544}, - {-900515712, -584801664}, - {-890172480, -600428672}, - {-879557888, -615873088}, - {-868675520, -631129536}, - {-857528320, -646194048}, - {-846120128, -661061376}, - {-834454080, -675727744}, - {-822533888, -690187904}, - {-810363392, -704438016}, - {-797945664, -718473536}, - {-785285056, -732290112}, - {-772385152, -745883904}, - {-759250176, -759250176}, - {-745883904, -772385152}, - {-732290112, -785285056}, - {-718473600, -797945664}, - {-704438016, -810363392}, - {-690187904, -822533888}, - {-675727552, -834454144}, - {-661061376, -846120128}, - {-646194048, -857528320}, - {-631129536, -868675392}, - {-615873088, -879557760}, - {-600428672, -890172352}, - {-584801792, -900515712}, - {-568996544, -910584576}, - {-553017856, -920376384}, - {-536871040, -929887680}, - {-520560224, -939115776}, - {-504091296, -948057792}, - {-487468704, -956710976}, - {-470697376, -965072832}, - {-453782944, -973140608}, - {-436730208, -980911936}, - {-419544416, -988384640}, - {-402230784, -995556160}, - {-384794592, -1002424448}, - {-367241280, -1008987264}, - {-349576096, -1015242880}, - {-331804480, -1021189120}, - {-313931712, -1026824384}, - {-295963392, -1032146880}, - {-277904800, -1037154944}, - {-259761664, -1041847104}, - {-241539296, -1046221952}, - {-223243488, -1050278016}, - {-204879600, -1054014208}, - {-186453328, -1057429248}, - {-167970160, -1060522368}, - {-149435984, -1063292288}, - {-130856168, -1065738240}, - {-112236624, -1067859776}, - {-93582792, -1069655936}, - {-74900448, -1071126272}, - {-56195288, -1072270272}, - {-37473008, -1073087680}, - {-18739318, -1073578304}, - {-46, -1073741824}, - {18739350, -1073578304}, - {37473052, -1073087680}, - {56195320, -1072270272}, - {74900480, -1071126272}, - {93582824, -1069655936}, - {112236512, -1067859776}, - {130856168, -1065738240}, - {149435984, -1063292288}, - {167970272, -1060522368}, - {186453328, -1057429248}, - {204879504, -1054014208}, - {223243488, -1050278016}, - {241539296, -1046221952}, - {259761664, -1041847104}, - {277904896, -1037154944}, - {295963392, -1032146880}, - {313931712, -1026824448}, - {331804480, -1021189120}, - {349576096, -1015242880}, - {367241408, -1008987264}, - {384794720, -1002424320}, - {402230784, -995556160}, - {419544320, -988384640}, - {436730112, -980912000}, - {453782848, -973140608}, - {470697504, -965072832}, - {487468576, -956710976}, - {504091296, -948057792}, - {520560352, -939115776}, - {536870912, -929887680}, - {553017920, -920376384}, - {568996544, -910584704}, - {584801664, -900515712}, - {600428800, -890172224}, - {615873088, -879557888}, - {631129536, -868675392}, - {646193920, -857528320}, - {661061504, -846120064}, - {675727616, -834454144}, - {690187904, -822533888}, - {704438016, -810363136}, - {718473536, -797945792}, - {732290176, -785285056}, - {745883776, -772385216}, - {759250176, -759250176}, - {772385216, -745883776}, - {785285056, -732290112}, - {797945664, -718473536}, - {810363264, -704438016}, - {822533888, -690187904}, - {834454144, -675727616}, - {846120128, -661061504}, - {857528320, -646193920}, - {868675392, -631129536}, - {879557888, -615873088}, - {890172352, -600428800}, - {900515712, -584801792}, - {910584704, -568996544}, - {920376384, -553017920}, - {929887680, -536870912}, - {939115776, -520560352}, - {948057792, -504091296}, - {956710976, -487468576}, - {965072832, -470697504}, - {973140608, -453782944}, - {980911936, -436730112}, - {988384640, -419544320}, - {995556160, -402230784}, - {1002424320, -384794592}, - {1008987264, -367241280}, - {1015242880, -349576096}, - {1021189120, -331804480}, - {1026824448, -313931712}, - {1032146880, -295963392}, - {1037154944, -277904800}, - {1041847104, -259761664}, - {1046221952, -241539296}, - {1050278016, -223243488}, - {1054014208, -204879600}, - {1057429248, -186453328}, - {1060522368, -167970272}, - {1063292288, -149435984}, - {1065738240, -130856168}, - {1067859776, -112236624}, - {1069655936, -93582760}, - {1071126272, -74900440}, - {1072270272, -56195308}, - {1073087680, -37473052}, - {1073578304, -18739382}, - {1073741824, 0} -}; - -const Word32 dirac_gains_trg_term_fx[181][2] = //Q31 -{ - {(-2147483647 - 1),187}, - {-2147156608,-37478872}, - {-2146175360,-74946000}, - {-2144540544,-112390808}, - {-2142252544,-149800880}, - {-2139311872,-187165312}, - {-2135719552,-224473248}, - {-2131476480,-261712336}, - {-2126584576,-298872160}, - {-2121044736,-335940320}, - {-2114858496,-372906880}, - {-2108028416,-409759200}, - {-2100556032,-446486752}, - {-2092443904,-483078816}, - {-2083694208,-519523328}, - {-2074309888,-555809792}, - {-2064293760,-591926784}, - {-2053648896,-627863232}, - {-2042378240,-663608960}, - {-2030485760,-699152192}, - {-2017974528,-734482816}, - {-2004848896,-769589184}, - {-1991112320,-804461312}, - {-1976769280,-839088832}, - {-1961824000,-873460224}, - {-1946281216,-907565888}, - {-1930145664,-941394752}, - {-1913421952,-974937408}, - {-1896115584,-1008182592}, - {-1878231680,-1041120448}, - {-1859775360,-1073742080}, - {-1840752768,-1106035712}, - {-1821169152,-1137993088}, - {-1801031424,-1169603328}, - {-1780344960,-1200857344}, - {-1759115776,-1231746176}, - {-1737351040,-1262259072}, - {-1715056640,-1292388096}, - {-1692240256,-1322122752}, - {-1668908160,-1351455488}, - {-1645067776,-1380375808}, - {-1620726784,-1408876032}, - {-1595891328,-1436947072}, - {-1570570112,-1464580224}, - {-1544770304,-1491767808}, - {-1518500352,-1518500352}, - {-1491767808,-1544770304}, - {-1464580224,-1570570112}, - {-1436947200,-1595891328}, - {-1408876032,-1620726784}, - {-1380375808,-1645067776}, - {-1351455104,-1668908288}, - {-1322122752,-1692240256}, - {-1292388096,-1715056640}, - {-1262259072,-1737350784}, - {-1231746176,-1759115520}, - {-1200857344,-1780344704}, - {-1169603584,-1801031424}, - {-1137993088,-1821169152}, - {-1106035712,-1840752768}, - {-1073742080,-1859775360}, - {-1041120448,-1878231552}, - {-1008182592,-1896115584}, - {-974937408,-1913421952}, - {-941394752,-1930145664}, - {-907565888,-1946281216}, - {-873460416,-1961823872}, - {-839088832,-1976769280}, - {-804461568,-1991112320}, - {-769589184,-2004848896}, - {-734482560,-2017974528}, - {-699152192,-2030485760}, - {-663608960,-2042378240}, - {-627863424,-2053648768}, - {-591926784,-2064293760}, - {-555809600,-2074309888}, - {-519523328,-2083694208}, - {-483078592,-2092443904}, - {-446486976,-2100556032}, - {-409759200,-2108028416}, - {-372906656, -2114858496}, - { -335940320,-2121044736 }, - { -298871968,-2126584576 }, - { -261712336,-2131476480 }, - { -224473248,-2135719552 }, - { -187165584,-2139311872 }, - { -149800896,-2142252544 }, - { -112390576,-2144540544 }, - { -74946016,-2146175360 }, - { -37478636,-2147156608 }, - { -93,(-2147483647 - 1) }, - { 37478700,-2147156608 }, - { 74946104,-2146175360 }, - { 112390640,-2144540544 }, - { 149800960,-2142252544 }, - { 187165648,-2139311872 }, - { 224473024,-2135719552 }, - { 261712336,-2131476480 }, - { 298871968,-2126584576 }, - { 335940544,-2121044736 }, - { 372906656,-2114858496 }, - { 409759008,-2108028416 }, - { 446486976,-2100556032 }, - { 483078592,-2092443904 }, - { 519523328,-2083694208 }, - { 555809792,-2074309888 }, - { 591926784,-2064293760 }, - { 627863424,-2053648896 }, - { 663608960,-2042378240 }, - { 699152192,-2030485760 }, - { 734482816,-2017974528 }, - { 769589440,-2004848640 }, - { 804461568,-1991112320 }, - { 839088640,-1976769280 }, - { 873460224,-1961824000 }, - { 907565696,-1946281216 }, - { 941395008,-1930145664 }, - { 974937152,-1913421952 }, - { 1008182592,-1896115584 }, - { 1041120704,-1878231552 }, - { 1073741824,-1859775360 }, - { 1106035840,-1840752768 }, - { 1137993088,-1821169408 }, - { 1169603328,-1801031424 }, - { 1200857600,-1780344448 }, - { 1231746176,-1759115776 }, - { 1262259072,-1737350784 }, - { 1292387840,-1715056640 }, - { 1322123008,-1692240128 }, - { 1351455232,-1668908288 }, - { 1380375808,-1645067776 }, - { 1408876032,-1620726272 }, - { 1436947072,-1595891584 }, - { 1464580352,-1570570112 }, - { 1491767552,-1544770432 }, - { 1518500352,-1518500352 }, - { 1544770432,-1491767552 }, - { 1570570112,-1464580224 }, - { 1595891328,-1436947072 }, - { 1620726528,-1408876032 }, - { 1645067776,-1380375808 }, - { 1668908288,-1351455232 }, - { 1692240256,-1322123008 }, - { 1715056640,-1292387840 }, - { 1737350784,-1262259072 }, - { 1759115776,-1231746176 }, - { 1780344704,-1200857600 }, - { 1801031424,-1169603584 }, - { 1821169408,-1137993088 }, - { 1840752768,-1106035840 }, - { 1859775360,-1073741824 }, - { 1878231552,-1041120704 }, - { 1896115584,-1008182592 }, - { 1913421952,-974937152 }, - { 1930145664,-941395008 }, - { 1946281216,-907565888 }, - { 1961823872,-873460224 }, - { 1976769280,-839088640 }, - { 1991112320,-804461568 }, - { 2004848640,-769589184 }, - { 2017974528,-734482560 }, - { 2030485760,-699152192 }, - { 2042378240,-663608960 }, - { 2053648896,-627863424 }, - { 2064293760,-591926784 }, - { 2074309888,-555809600 }, - { 2083694208,-519523328 }, - { 2092443904,-483078592 }, - { 2100556032,-446486976 }, - { 2108028416,-409759200 }, - { 2114858496,-372906656 }, - { 2121044736,-335940544 }, - { 2126584576,-298871968 }, - { 2131476480,-261712336 }, - { 2135719552,-224473248 }, - { 2139311872,-187165520 }, - { 2142252544,-149800880 }, - { 2144540544,-112390616 }, - { 2146175360,-74946104 }, - { 2147156608,-37478764 }, - { 2147483647,0 } }; -#endif + /*----------------------------------------------------------------------------------* * FB ROM tables *----------------------------------------------------------------------------------*/ @@ -6429,24 +4821,6 @@ const float ivas_fb_cf_4ms_16k[IVAS_FB_4MS_16K_SAMP] = 0.9664963994f, 0.9747640903f, 0.9818880329f, 0.9878510650f, 0.9926388212f, 0.9962397673f, 0.9986452283f, 0.9998494093f, }; -#ifdef IVAS_FLOAT_FIXED -const Word16 ivas_fb_cf_4ms_48k_fx[IVAS_FB_4MS_48K_SAMP] = -{ -0, 4, 13, 26, 44, 66, 92, 123, 158, 197, 241, 289, 341, 398, 458, 524, 593, 667, 744, 826, 913, 1003, 1097, 1196, 1298, 1405, 1516, 1630, 1749, 1871, 1998, 2128, 2262, 2400, 2541, 2687, 2836, 2988, 3144, 3304, 3467, 3634, 3804, 3977, 4154, 4334, 4517, 4704, 4893, 5086, 5282, 5480, 5682, 5886, 6094, 6304, 6516, 6732, 6949, 7170, 7393, 7618, 7846, 8076, 8308, 8542, 8779, 9017, 9258, 9500, 9744, 9990, 10238, 10487, 10738, 10990, 11244, 11499, 11756, 12014, 12273, 12533, 12794, 13056, 13319, 13582, 13847, 14112, 14378, 14644, 14911, 15178, 15446, 15713, 15981, 16249, 16518, 16786, 17054, 17321, 17589, 17856, 18123, 18389, 18655, 18920, 19185, 19448, 19711, 19973, 20234, 20494, 20753, 21011, 21268, 21523, 21777, 22029, 22280, 22529, 22777, 23023, 23267, 23509, 23750, 23988, 24225, 24459, 24691, 24921, 25149, 25374, 25597, 25818, 26035, 26251, 26463, 26673, 26881, 27085, 27287, 27485, 27681, 27874, 28063, 28250, 28433, 28613, 28790, 28963, 29133, 29300, 29463, 29623, 29779, 29931, 30080, 30226, 30367, 30505, 30639, 30769, 30896, 31018, 31137, 31251, 31362, 31469, 31571, 31670, 31764, 31854, 31941, 32023, 32100, 32174, 32243, 32309, 32369, 32426, 32478, 32526, 32570, 32609, 32644, 32675, 32701, 32723, 32741, 32754, 32763, 32767, -}; - -const Word16 ivas_fb_cf_4ms_32k_fx[IVAS_FB_4MS_32K_SAMP] = -{ - 1, 11, 30, 60, 99, 149, 208, 276, 355, 443, 541, 648, 765, 891, 1026, 1171, 1325, 1488, 1660, 1840, 2030, 2228, 2435, 2650, 2873, 3105, 3345, 3592, 3847, 4110, 4380, 4657, 4941, 5233, 5530, 5835, 6146, 6463, 6786, 7115, 7449, 7789, 8134, 8483, 8838, 9197, 9561, 9928, 10300, 10675, 11054, 11435, 11820, 12208, 12598, 12990, 13385, 13781, 14179, 14578, 14978, 15379, 15780, 16182, 16585, 16987, 17388, 17789, 18189, 18588, 18986, 19382, 19777, 20169, 20559, 20947, 21332, 21713, 22092, 22467, 22839, 23206, 23570, 23929, 24284, 24633, 24978, 25318, 25652, 25981, 26304, 26621, 26932, 27237, 27534, 27826, 28110, 28387, 28657, 28920, 29175, 29422, 29662, 29894, 30117, 30332, 30539, 30737, 30927, 31107, 31279, 31442, 31596, 31741, 31876, 32002, 32119, 32226, 32324, 32412, 32491, 32559, 32618, 32668, 32707, 32737, 32756, 32766, -}; - -const Word16 ivas_fb_cf_4ms_16k_fx[IVAS_FB_4MS_16K_SAMP] = -{ -4, 44, 123, 241, 398, 593, 826, 1097, 1405, 1749, 2128, 2541, 2988, 3467, 3977, 4517, 5086, 5682, 6304, 6949, 7618, 8308, 9017, 9744, 10487, 11244, 12014, 12794, 13582, 14378, 15178, 15981, 16786, 17589, 18389, 19185, 19973, 20753, 21523, 22280, 23023, 23750, 24459, 25149, 25818, 26463, 27085, 27681, 28250, 28790, 29300, 29779, 30226, 30639, 31018, 31362, 31670, 31941, 32174, 32369, 32526, 32644, 32723, 32763, -}; -#endif - - const float ivas_fb_fcs_12band_1ms[IVAS_FB_BANDS_12] = { 0.0083333333f, 0.0250000000f, 0.0416666667f, 0.0583333333f, @@ -6573,24 +4947,6 @@ const float ivas_fb_cf_1ms_16k[IVAS_FB_1MS_16K_SAMP] = 0.5490085702f, 0.6451423386f, 0.7356983684f, 0.8171966421f, 0.8865052267f, 0.9409606322f, 0.9784701679f, 0.9975923633f, }; -#ifdef IVAS_FLOAT_FIXED -const Word16 ivas_fb_cf_1ms_48k_fx[IVAS_FB_1MS_48K_SAMP] = -{ - 8, 78, 218, 427, 705, 1050, 1460, 1934, 2470, 3066, 3718, 4425, 5184, 5990, 6840, 7732, 8660, 9622, 10612, 11627, 12663, 13715, 14778, 15847, 16920, 17989, 19052, 20104, 21140, 22155, 23145, 24107, 25035, 25927, 26777, 27583, 28342, 29049, 29701, 30297, 30833, 31307, 31717, 32062, 32340, 32549, 32689, 32759, -}; - -const Word16 ivas_fb_cf_1ms_32k_fx[IVAS_FB_1MS_32K_SAMP] = -{ - 19, 177, 491, 957, 1573, 2330, 3224, 4244, 5381, 6624, 7960, 9378, 10864, 12403, 13979, 15580, 17187, 18788, 20364, 21903, 23389, 24807, 26143, 27386, 28523, 29543, 30437, 31194, 31810, 32276, 32590, 32748, -}; - -const Word16 ivas_fb_cf_1ms_16k_fx[IVAS_FB_1MS_16K_SAMP] = -{ -78, 705, 1934, 3718, 5990, 8660, 11627, 14778, 17989, 21140, 24107, 26777, 29049, 30833, 32062, 32689, - }; - -#endif - const float ivas_fb_fr_12band_1ms_re[IVAS_FB_12_1MS_LEN] = { 0.9748788957f, 0.9427895242f, 0.8792742509f, 0.7856320394f, 0.6637543553f, 0.5159842697f, 0.3449612971f, 0.1523029468f, @@ -7634,22 +5990,6 @@ const float ivas_fb_resp_cheby_ramp_16del[IVAS_FB_1MS_16K_SAMP + 1] = 0.500000000000000f }; -#ifdef IVAS_FLOAT_FIXED -/* Q Factor is 31*/ -const Word32 ivas_fb_resp_cheby_ramp_32del_fx[IVAS_FB_1MS_32K_SAMP + 1] = { - 21970992, 16097417, 21859084, 28772960, 36989692, 46636088, 57839904, 70755400, 85490472, - 102165872, 120908192, 141807584, 164922576, 190321136, 218072144, 248214064, 280795872, - 315834176, 353276992, 393021664, 435109696, 479474528, 525959424, 574472512, 624859584, - 676981248, 730657728, 785668096, 841854208, 899002688, 956860544, 1015180800, 1073741824, -}; - -/* Q Factor is 31*/ -const Word32 ivas_fb_resp_cheby_ramp_16del_fx[IVAS_FB_1MS_16K_SAMP + 1] = { - 23460896, 29872362, 47814248, 71691184, 102337872, 140498880, 186843680, 241748256, 305433120, - 377921280, 458893152, 547769792, 643727232, 745668672, 852315136, 962208832, 1073741824, -}; -#endif - const int16_t ivas_num_active_bands[FB - WB + 1] = { IVAS_16K_12BANDS_ACTIVE_BANDS, IVAS_FB_BANDS_12, IVAS_FB_BANDS_12 @@ -7796,140 +6136,6 @@ const float ivas_sns_cdbk_tcx20_stage1[ 128 * 16 ] = 0.2253418f, 2.2539062f, 2.265625f, 0.57128906f, -0.7661133f, -0.6245117f, 0.21313477f, 1.2248535f, 0.8737793f, -0.12524414f, -0.9609375f, -2.416504f, -1.1223145f, -0.70532227f, -0.31469727f, -0.592041f, }; -#ifdef IVAS_FLOAT_FIXED -/*Q12*/ -const Word16 ivas_sns_cdbk_tcx20_stage1_fx[ 128 * 16 ] = -{ - -7498 , -8552 , -3948 , 11493 , 10929 , 4767 , 5696 , 4985 , 5673 , 1825 , -1927 , -2174 , -3321 , -4771 , -5964 , -7214 , - -10641 , -13643 , -7600 , -1477 , 6893 , 10597 , 4021 , 919 , -537 , 684 , 6146 , 1349 , 1375 , 4748 , 736 , -3571 , - 8121 , 9016 , 4721 , 3315 , 3543 , 4759 , 5279 , 5578 , 4435 , 3410 , 492 , -2942 , -8990 , -12493 , -13751 , -14493 , - 646 , 4522 , 1609 , -2654 , -4481 , -4275 , -4938 , -4698 , -4089 , -1547 , 1428 , 4430 , 5202 , 4974 , 3429 , 441 , - 1001 , -2898 , -4776 , -4824 , -1005 , 1623 , 4558 , 5049 , 5546 , 4459 , 3687 , 3688 , -126 , -3430 , -5243 , -7311 , - -3765 , -762 , -3030 , -6261 , -7149 , -5194 , -3869 , 997 , 5325 , 6801 , 5249 , 4107 , 2928 , 2308 , 1946 , 369 , - 10168 , 5956 , 3730 , 2771 , 2326 , 2853 , 3117 , 2884 , 1479 , -133 , -2832 , -4621 , -6076 , -6372 , -6981 , -8269 , - 9885 , 6118 , 4056 , 3729 , 2954 , 2262 , 382 , -887 , -2030 , -1996 , -3016 , -3773 , -4113 , -4045 , -4375 , -5152 , - -3335 , 5139 , 6949 , 5817 , 4078 , 4678 , 4112 , 3805 , 2705 , 921 , -2675 , -4919 , -5304 , -5636 , -7035 , -9300 , - -5726 , 774 , 1426 , -213 , -1582 , -1060 , -1381 , -448 , -337 , 307 , -78 , 485 , 1252 , 2090 , 2767 , 1723 , - 4376 , 8005 , 8723 , 8483 , 6453 , 4642 , 1740 , -811 , -3455 , -4423 , -5495 , -5697 , -5721 , -5357 , -5457 , -6006 , - 9786 , 10280 , 4686 , 1498 , -692 , -958 , 1101 , 3151 , 2236 , 2122 , -1101 , -3777 , -4952 , -6004 , -7796 , -9579 , - -5550 , 5500 , 6501 , 7932 , 2414 , 2004 , -724 , -797 , 465 , 79 , 1246 , -954 , -8806 , -5066 , -857 , -3387 , - 3592 , -6275 , -6564 , -5666 , -2347 , -3624 , -3711 , -4039 , -4858 , -5538 , -5004 , -2044 , 6173 , 16714 , 9046 , 14147 , - 16852 , 13619 , 9025 , 4301 , 605 , -1497 , -3065 , -3483 , -4472 , -4221 , -4897 , -5230 , -4820 , -4121 , -3894 , -4701 , - 3227 , 10297 , 4142 , -3143 , -5540 , -3558 , 1739 , 5927 , 5194 , 4741 , -1693 , -3809 , -3779 , -3780 , -3312 , -6653 , - -9100 , -5057 , -1642 , 2448 , -2023 , 4879 , 133 , 5593 , 1767 , 4924 , 6821 , 2411 , -1210 , -4078 , -4246 , -1619 , - -7619 , -11980 , 600 , 2505 , 2570 , -5562 , 1970 , -1802 , 2335 , 4846 , -4895 , 3392 , 5151 , 6508 , 2257 , -277 , - 8936 , 11845 , 11978 , 10584 , 9236 , 7186 , 3794 , 1874 , -708 , -3953 , -7322 , -9670 , -10750 , -10778 , -10917 , -11335 , - 8587 , 838 , -5142 , -8197 , -8172 , -5767 , -4419 , -1944 , -79 , 1853 , 3022 , 3823 , 4142 , 4618 , 3723 , 3112 , - -5283 , 568 , 1979 , 2570 , 2120 , 2234 , 1918 , 2247 , 1603 , 2038 , 1584 , -93 , -1478 , -3355 , -4339 , -4312 , - 3278 , 2345 , 280 , -2908 , -4330 , -3770 , -3036 , -1236 , 758 , 3245 , 3120 , 2288 , 1603 , 916 , -401 , -2152 , - 18828 , 10647 , 3579 , -3906 , -287 , 10855 , 5635 , -3673 , -6872 , -5289 , -2424 , -5462 , -6052 , -2769 , -4104 , -8707 , - -4121 , 2761 , 3751 , 4035 , 3218 , -38 , -1640 , -513 , -750 , -12 , -1597 , -1672 , -1522 , -637 , 42 , -1302 , - -5458 , 2924 , 6701 , 9084 , 6798 , 7952 , 4454 , 5450 , 5949 , 5277 , -2303 , -8307 , -11701 , -10523 , -8863 , -7432 , - 379 , 6294 , 8583 , 7842 , 6055 , 3554 , -1419 , -894 , -4610 , -4731 , -3777 , -2242 , -3681 , -3172 , -3323 , -4856 , - 9040 , 14426 , 8046 , 2314 , -89 , 612 , 655 , 895 , -4796 , -4631 , -1323 , -264 , -6051 , -6580 , -5728 , -6526 , - 10320 , 9632 , 5351 , 853 , -2496 , -4459 , -5580 , -5161 , -5476 , -4380 , -3281 , -1752 , -624 , 1835 , 2457 , 2762 , - 6230 , 4286 , 3054 , 2103 , 1411 , 882 , -116 , -345 , 353 , 511 , -1457 , -2334 , -2581 , -2840 , -3948 , -5209 , - -2351 , -845 , -4051 , -7663 , -8133 , -6619 , -6596 , -5580 , -3850 , -278 , 3739 , 7371 , 8632 , 9397 , 9551 , 7277 , - 14878 , 8087 , 1612 , -2811 , -4559 , -4173 , -3660 , -2457 , -1780 , -938 , -1082 , -880 , -541 , 40 , -680 , -1056 , - -357 , 6763 , 7507 , 2217 , 983 , 5824 , 3263 , 5362 , 4023 , 5140 , -7718 , -7703 , -6304 , -5528 , -5237 , -8233 , - -9056 , -2879 , 4548 , 9096 , 9567 , 8235 , 6713 , 5876 , 4240 , 2331 , -452 , -3615 , -6496 , -8240 , -9501 , -10367 , - -6591 , -10319 , -10037 , 1092 , 9508 , 10608 , 14496 , -4303 , -5138 , -1136 , 3886 , 5677 , 2912 , -4172 , -5188 , -1298 , - 3868 , 10098 , 10930 , 8191 , 5304 , 4169 , 3641 , 2883 , 1198 , -205 , -3154 , -5928 , -8536 , -10323 , -10806 , -11331 , - -580 , -1263 , -2402 , -5074 , -6014 , -4529 , -3202 , -2168 , -259 , 2212 , 3665 , 5339 , 5604 , 4695 , 3222 , 754 , - 1658 , -3851 , -5014 , -4529 , -1764 , -300 , 8217 , 16396 , 2000 , 824 , 665 , -1713 , -3175 , -3034 , -3057 , -3324 , - -11375 , -8634 , -6184 , -6208 , -4129 , -150 , 1519 , 4345 , 5629 , 5310 , 4007 , 4455 , 3926 , 3560 , 3104 , 823 , - 7473 , 12120 , 11294 , 4728 , 3568 , 5501 , 3688 , 3508 , 1692 , -1661 , -8566 , -9762 , -8843 , -8001 , -8086 , -8653 , - 8613 , 5171 , 4353 , 3298 , 925 , -530 , -1637 , -2214 , -3071 , -2941 , -3234 , -2961 , -2504 , -1211 , -880 , -1176 , - 621 , 10589 , 7196 , 3759 , 1529 , -659 , -1898 , -893 , -380 , -88 , -927 , -1736 , -2729 , -3606 , -4369 , -6410 , - -10687 , -7849 , -5755 , -6353 , -5913 , -3150 , -2865 , -1183 , -382 , 1696 , 2622 , 5191 , 7208 , 8842 , 10178 , 8401 , - -366 , 8121 , 9838 , 5330 , 503 , 3640 , 5493 , 4385 , 472 , -837 , -3977 , -9982 , -8797 , -5441 , -3061 , -5319 , - 10435 , 576 , -3431 , -5099 , -5048 , -3131 , -1414 , 1467 , 2492 , 2334 , 1243 , 257 , 1129 , 1454 , -1171 , -2093 , - -2408 , 4154 , 6243 , 5033 , 3118 , 2477 , 901 , 862 , 622 , 627 , -473 , -1897 , -2823 , -3803 , -5378 , -7253 , - 5751 , -3944 , -5457 , -3268 , 270 , -185 , -1373 , -2563 , -3758 , -4024 , -4052 , -3460 , -2709 , -237 , 9209 , 19800 , - 11172 , 15303 , 13936 , 10936 , 5606 , 374 , -3235 , -4534 , -5841 , -5872 , -6303 , -6525 , -6391 , -6176 , -6037 , -6414 , - 5173 , 10429 , 7690 , -211 , -4293 , -3886 , -1661 , 896 , 81 , -608 , -1808 , -2380 , -2191 , -1905 , -2123 , -3203 , - -8788 , -1052 , 5387 , 6699 , 5899 , 3671 , 3443 , 3830 , 4015 , 2746 , -536 , -2438 , -3985 , -4693 , -6124 , -8075 , - -8721 , -8773 , -1913 , 3002 , 5005 , -1141 , -1250 , 4860 , 3573 , -249 , 246 , 1790 , 3243 , 3739 , -189 , -3222 , - 12821 , 11330 , 7418 , 6142 , 4487 , 3660 , 3434 , 2422 , 898 , -805 , -4025 , -7013 , -9016 , -9871 , -10400 , -11484 , - 6459 , 1432 , -705 , -1814 , -2564 , -2337 , -2669 , -1789 , -1565 , -767 , -696 , -14 , 629 , 1614 , 2310 , 2475 , - 523 , 864 , 661 , 262 , 533 , 1619 , 2390 , 2554 , 2076 , 1532 , 248 , -542 , -1545 , -2462 , -3431 , -5282 , - 2754 , 7840 , 1531 , -5320 , -7337 , -5059 , -1828 , 2415 , 2801 , 2414 , 920 , -54 , -675 , 295 , 594 , -1290 , - 16459 , 9353 , 5397 , 5154 , 6401 , 4035 , 525 , -1206 , -2684 , -3963 , -5726 , -6290 , -6446 , -6516 , -6917 , -7575 , - 3331 , 2764 , 1820 , 1449 , 404 , 197 , -617 , -518 , -755 , -625 , -1250 , -1192 , -1278 , -978 , -1091 , -1661 , - 1202 , 10867 , 13999 , 10573 , 8667 , 5713 , 3901 , 1699 , -649 , -3697 , -6326 , -8102 , -9055 , -9334 , -9517 , -9940 , - 3105 , 10471 , 11637 , 9256 , 1588 , -4373 , -5838 , -3257 , -2501 , -2719 , -3963 , -4248 , -3642 , -2230 , -780 , -2506 , - 7036 , 12562 , 13320 , 10158 , 3016 , -3341 , -3328 , 586 , 1408 , -1129 , -5924 , -5878 , -5793 , -6843 , -7570 , -8279 , - 11292 , 4466 , 2522 , 790 , -1414 , -1946 , -1506 , -261 , 583 , 802 , -656 , -1773 , -2651 , -2250 , -3307 , -4691 , - 4319 , 4371 , 4567 , 4600 , 3221 , 2633 , 1994 , 1398 , 564 , -536 , -2662 , -3664 , -4402 , -4565 , -5348 , -6489 , - -7437 , -5416 , -5951 , -7745 , -7676 , -4554 , -4813 , -2349 , 668 , 6481 , 8239 , 7629 , 6574 , 6530 , 6295 , 3525 , - 13292 , 11390 , 5199 , 2139 , 489 , -271 , -644 , -427 , -1114 , -1854 , -3425 , -4756 , -5461 , -5211 , -4922 , -4424 , - 710 , 9953 , 9525 , 5612 , 1946 , 2958 , 298 , -154 , -1714 , -3333 , -6410 , -9882 , -5524 , -2172 , -432 , -1382 , - -10643 , -8047 , -2326 , 2007 , 3553 , 2546 , 4871 , 5435 , 4843 , 4106 , 2244 , 1050 , -497 , -1808 , -2878 , -4457 , - 294 , -9337 , -8427 , -1045 , 9093 , 10411 , 3417 , 3239 , 2068 , -534 , 1078 , -1517 , -2125 , -1732 , -2738 , -2145 , - 5432 , 12777 , 10582 , 2772 , -92 , 2136 , 2501 , 4105 , 2738 , 3539 , -1530 , -8480 , -9513 , -8753 , -8426 , -9787 , - 5972 , 8255 , 4335 , -524 , -2484 , -2872 , -3937 , -3518 , -3037 , -774 , 635 , 1891 , 1590 , 660 , -1520 , -4672 , - 6572 , 3645 , -218 , -1090 , 345 , 2321 , 3692 , 4654 , 4719 , 3041 , 2117 , 459 , -3402 , -7045 , -8640 , -11170 , - -5410 , -344 , -990 , -3893 , -5051 , -2311 , -77 , 3918 , 4679 , 4822 , 3303 , 1776 , 337 , 305 , 409 , -1472 , - 8389 , 11222 , 8707 , 4721 , 3131 , 2061 , 1130 , 791 , -354 , -651 , -3686 , -5202 , -6383 , -7339 , -7792 , -8746 , - 9298 , 9362 , 6305 , 3177 , 968 , -72 , -945 , -819 , -1079 , -725 , -2067 , -2739 , -3434 , -4331 , -5460 , -7441 , - 2704 , 6870 , 6571 , 6294 , 4511 , 3348 , 2296 , 2931 , 2159 , 954 , -1545 , -3421 , -5465 , -7201 , -9296 , -11710 , - 880 , -1826 , -3492 , -4233 , -3893 , -2425 , -1948 , -823 , -259 , 657 , 1000 , 2107 , 2906 , 3603 , 3958 , 3790 , - -196 , 6860 , 8581 , 9562 , 7277 , 7244 , 1471 , 1946 , -228 , -338 , -3115 , -7547 , -11656 , -9838 , -4686 , -5339 , - 8578 , 4837 , 2226 , 754 , -1817 , -2201 , 499 , 2914 , 3313 , 3158 , -527 , -4733 , -5791 , -4100 , -3403 , -3706 , - -4232 , 6556 , 1920 , 6615 , -946 , 4468 , 280 , 2157 , 766 , -524 , -922 , -1974 , -2072 , -1600 , -4968 , -5524 , - 7288 , 2936 , -1640 , -4588 , -6332 , -6285 , -6188 , -5571 , -5223 , -3844 , -1671 , 2013 , 5110 , 8289 , 8345 , 7362 , - 11493 , 11342 , 6954 , 1821 , -1692 , -2612 , -3300 , -3319 , -3814 , -2738 , -2931 , -2814 , -2479 , -1890 , -1719 , -2303 , - 8177 , 11903 , 6525 , -1422 , -3274 , 251 , 4220 , 4653 , 3045 , -303 , -5550 , -5079 , -5244 , -5314 , -5883 , -6703 , - -9438 , -3031 , 483 , 1317 , 1847 , 1874 , 3018 , 2956 , 788 , 3090 , 730 , -1912 , -1688 , 122 , 860 , -1017 , - -3693 , -4977 , -541 , 2877 , 3327 , -2337 , -4262 , -2189 , 699 , 2375 , 3310 , 1962 , 1504 , 1017 , 1319 , -390 , - 6065 , 7469 , 7234 , 10424 , 10658 , 7912 , 5388 , 4640 , 2156 , -733 , -4795 , -9010 , -11277 , -11766 , -11999 , -12365 , - 10932 , 2437 , -1845 , -3262 , -3753 , -3716 , -4031 , -3422 , -2848 , -1620 , -1167 , 176 , 1764 , 2966 , 3342 , 4047 , - -619 , -1377 , -1334 , -455 , -198 , 333 , 279 , 702 , 835 , 1061 , 505 , 476 , 127 , 254 , 270 , -859 , - 5215 , 1197 , -575 , -1227 , -2612 , -2325 , -649 , 1885 , 2691 , 2793 , 1163 , -765 , -1768 , -1371 , -1567 , -2082 , - 19164 , 11491 , 4615 , -1985 , -3389 , 3234 , 9530 , 1792 , -6657 , -7546 , -6135 , -3576 , -5395 , -6848 , -4207 , -4089 , - -5579 , 2618 , 4644 , 1302 , 270 , 4372 , 3748 , 1797 , -752 , -937 , -2728 , -2859 , -706 , -865 , -1022 , -3304 , - -1838 , 6025 , 10256 , 11080 , 7972 , 1492 , -1232 , 2649 , 3965 , 3980 , -6137 , -7448 , -7596 , -7566 , -6578 , -9023 , - 1944 , 6450 , 7024 , 8636 , 7062 , 1810 , -1661 , -772 , 542 , -13 , -3255 , -4851 , -5285 , -5086 , -5501 , -7043 , - 8123 , 16086 , 12234 , 5222 , 1088 , 112 , 327 , 1928 , -3259 , -5187 , -6713 , -7464 , -5697 , -5814 , -5336 , -5649 , - 859 , 7375 , 6059 , 2544 , 375 , -1579 , -3831 , -3783 , -3738 , -2686 , -2393 , -1129 , 29 , 1048 , 1033 , -183 , - 2101 , 4211 , 3442 , 2574 , 2178 , 2151 , 1104 , 386 , 135 , -216 , -2007 , -2668 , -2626 , -2609 , -3456 , -4701 , - -5046 , -336 , -968 , -3416 , -4451 , -3637 , -4472 , -3410 , -3255 , -1874 , -1058 , 1763 , 4855 , 7351 , 9606 , 8347 , - 19995 , 9006 , 2634 , -634 , -1483 , -1947 , -2216 , -805 , -298 , -446 , -2156 , -3518 , -3871 , -4075 , -4720 , -5467 , - -2272 , 8650 , 9022 , 2896 , -866 , 3555 , 4656 , 4146 , 4057 , 5105 , 893 , -7960 , -11942 , -9282 , -3999 , -6659 , - -3314 , 4163 , 6336 , 8539 , 7909 , 6703 , 4331 , 4759 , 3115 , 1223 , -1904 , -4488 , -6662 , -8210 , -10273 , -12228 , - -1219 , -6996 , -6238 , 5560 , 19256 , 6948 , 16806 , -1718 , -4399 , -4432 , 1743 , -4434 , -5576 , -4824 , -5420 , -5055 , - 7337 , 7092 , 7560 , 9007 , 7842 , 4106 , 2111 , 1823 , -310 , -2228 , -4758 , -6480 , -7636 , -7833 , -8350 , -9284 , - -127 , -7162 , -7239 , -8124 , -5968 , -3470 , -2064 , 167 , 1784 , 2556 , 3741 , 6051 , 7042 , 5293 , 3278 , 4242 , - -4837 , -8327 , -8445 , -7964 , -6737 , -3635 , 12584 , 10749 , 9489 , 14113 , 4466 , -818 , -963 , -2829 , -1662 , -5183 , - -9221 , -7856 , -8616 , -9610 , -8803 , -4648 , -2322 , 3345 , 7609 , 8661 , 7189 , 7848 , 6804 , 4876 , 3375 , 1368 , - 3370 , 8415 , 9491 , 3696 , 2112 , 4195 , 2535 , 1216 , -704 , -2599 , -4917 , -4773 , -4766 , -4924 , -5695 , -6652 , - 5033 , 6480 , 5225 , 2803 , 1389 , 388 , -1095 , -1930 , -1285 , -783 , -2330 , -2783 , -2299 , -2271 , -2847 , -3696 , - 6462 , 10974 , 9445 , 5632 , 3121 , 338 , -2526 , -3512 , -4157 , -4256 , -4496 , -3576 , -3213 , -3003 , -3042 , -4191 , - -8903 , -5489 , -3362 , -3932 , -2867 , -42 , -794 , 1047 , 1551 , 2990 , 1925 , 1809 , 2047 , 3857 , 5983 , 4180 , - -1078 , 5534 , 5668 , 8546 , 7579 , 7727 , 3515 , 2403 , 425 , -3939 , -7676 , -10486 , -4654 , -3810 , -5900 , -3854 , - 11241 , 2333 , -888 , -2668 , -601 , 2056 , 973 , -782 , -1134 , -628 , -1278 , -1464 , -1036 , -1025 , -2566 , -2532 , - 188 , 993 , 1510 , 3746 , 3964 , 4113 , 3912 , 3774 , 2904 , 1760 , -544 , -2262 , -3823 , -5032 , -6585 , -8617 , - 17244 , 5164 , -3514 , -5803 , -5740 , -3512 , -4264 , -5949 , -7105 , -7263 , -6297 , -4203 , 3488 , 882 , 9119 , 17753 , - 18572 , 16918 , 11329 , 8930 , 3706 , 2301 , -534 , -4811 , -6296 , -6264 , -6923 , -7015 , -7012 , -7183 , -7628 , -8090 , - 2776 , 9267 , 4870 , -2407 , -3332 , 1594 , 479 , 626 , -2334 , -2117 , -1714 , -1452 , -1892 , -1016 , -575 , -2774 , - -5418 , -1560 , 977 , 3118 , 4128 , 4683 , 3995 , 3168 , 1326 , 367 , -798 , -1786 , -2341 , -2513 , -3011 , -4334 , - -5417 , -6011 , -5325 , -2432 , 93 , 2347 , 2339 , 1497 , 2097 , 3182 , 2553 , 1778 , 1688 , 2154 , 997 , -1540 , - 9725 , 13565 , 12472 , 9916 , 5050 , 2613 , 1338 , 621 , -1049 , -4212 , -7066 , -8072 , -8504 , -8673 , -8645 , -9079 , - 3568 , 2083 , 779 , -447 , -1488 , -1526 , -2026 , -1584 , -1564 , -893 , -955 , -362 , 96 , 991 , 1665 , 1663 , - 4308 , 2100 , 967 , 1304 , 1477 , 1636 , 1557 , 2064 , 2234 , 1529 , -1013 , -2413 , -2782 , -3000 , -4202 , -5767 , - -2729 , 7254 , 5313 , 626 , -4368 , -3106 , 689 , 2051 , 1436 , 577 , 2137 , -551 , -4980 , -1408 , 137 , -3079 , - 15090 , 13574 , 8552 , 4879 , 2489 , 603 , 625 , 413 , -965 , -1853 , -5221 , -7106 , -7498 , -7482 , -7752 , -8349 , - 2370 , 3151 , 1957 , 225 , -516 , -337 , -392 , 223 , 813 , 1307 , 124 , -276 , -702 , -1169 , -2432 , -4348 , - -4031 , 4338 , 9696 , 9577 , 10361 , 8623 , 7730 , 5093 , 2251 , -518 , -3768 , -6931 , -9490 , -10533 , -10950 , -11448 , - 10303 , 15787 , 11780 , 8011 , -1234 , -5671 , -6127 , -5176 , -4588 , -3477 , -4783 , -2583 , -2036 , -3150 , -2990 , -4066 , - 1649 , 10539 , 12961 , 10244 , 5607 , -356 , -2601 , -488 , 30 , -2077 , -2877 , -8331 , -8515 , -7727 , -3810 , -4247 , - 8997 , 5275 , 2084 , -488 , -2018 , -2461 , -3081 , -2315 , -2223 , -1654 , -1778 , -1155 , -563 , 285 , 587 , 507 , - 2053 , 8908 , 7041 , 522 , -1083 , 1920 , 1555 , 2991 , 959 , 1714 , -3254 , -3680 , -2792 , -4401 , -4878 , -7576 , - -9455 , -8989 , -9057 , -10160 , -9541 , -6763 , -5661 , -3200 , -593 , 3501 , 6901 , 10117 , 10416 , 11442 , 11927 , 9115 , - 7190 , 11877 , 7889 , 1661 , -96 , 1823 , 1276 , 741 , -1950 , -1969 , -4935 , -5445 , -5084 , -4151 , -3666 , -5162 , - 923 , 9232 , 9280 , 2340 , -3138 , -2558 , 873 , 5017 , 3579 , -513 , -3936 , -9898 , -4597 , -2889 , -1289 , -2425 , -}; -#endif const float ivas_sns_cdbk_tcx20_stage2[ 64 * 16 ] = { -1.1569824f, -0.4765625f, 0.008056641f, 0.47802734f, 0.38330078f, -0.075683594f, -0.3737793f, -0.29516602f, -0.1352539f, 0.012939453f, 0.22241211f, 0.375f, 0.31689453f, 0.20874023f, 0.2541504f, 0.25439453f, @@ -7997,76 +6203,7 @@ const float ivas_sns_cdbk_tcx20_stage2[ 64 * 16 ] = 0.3227539f, -1.0678711f, -1.1435547f, 0.068603516f, 0.7546387f, 0.38745117f, 0.09008789f, -0.0007324219f, -0.12792969f, 0.076416016f, 0.24853516f, 0.28735352f, 0.076660156f, -0.041748047f, -0.01977539f, 0.08911133f, 0.6101074f, -0.22070312f, -0.5324707f, -0.119384766f, 0.10473633f, 0.16333008f, -0.15112305f, -0.34472656f, -0.39746094f, -0.43652344f, -0.23876953f, 0.0017089844f, 0.056152344f, 0.22973633f, 0.50024414f, 0.7751465f, }; -#ifdef IVAS_FLOAT_FIXED -/*Q12*/ -const Word16 ivas_sns_cdbk_tcx20_stage2_fx[ 64 * 16 ] = -{ - -4739 , -1952 , 33 , 1958 , 1570 , -310 , -1531 , -1209 , -554 , 53 , 911 , 1536 , 1298 , 855 , 1041 , 1042 , - -1663 , -904 , -175 , 651 , -1032 , -2713 , -1113 , 1177 , 1464 , 826 , 214 , -1494 , -1846 , 763 , 2736 , 3107 , - 112 , -859 , -1631 , -2224 , -1919 , -1030 , -1104 , -307 , 1536 , 3827 , 3753 , 1748 , 107 , -638 , -468 , -902 , - 46 , 1539 , 3454 , 2870 , 2388 , -2034 , -3447 , -1887 , -692 , -27 , -310 , -923 , -859 , -521 , 27 , 377 , - 1736 , 793 , 312 , 1806 , 467 , -1631 , -500 , 1432 , 2116 , -102 , -2181 , -280 , 2082 , -270 , -2800 , -2981 , - -499 , 628 , 1238 , 973 , 1115 , 3296 , 3147 , 1180 , -225 , -1217 , -1869 , -1759 , -1756 , -1809 , -1438 , -1005 , - -814 , -42 , -125 , -171 , 215 , 305 , 107 , -109 , 761 , 921 , 805 , 630 , 183 , -456 , -1018 , -1190 , - 3133 , 1965 , 1284 , 613 , 952 , 693 , 240 , -514 , -738 , -801 , -702 , -785 , -963 , -1364 , -1554 , -1460 , - -2540 , -1194 , -624 , 654 , 1697 , 2507 , 1824 , 793 , -441 , -1656 , -427 , 1665 , 1549 , -53 , -1580 , -2175 , - -2612 , -80 , 1350 , -1143 , -868 , 3411 , 1168 , -1279 , -1792 , -1401 , -43 , 224 , 407 , 470 , 941 , 1247 , - -3135 , -2208 , -1570 , -1618 , -898 , 791 , 778 , -354 , -184 , 553 , 1861 , 2776 , 2413 , 1232 , 177 , -614 , - 1427 , -894 , 74 , 274 , 1641 , 1416 , -2247 , -3524 , -984 , 2485 , 916 , -207 , 570 , 111 , -306 , -753 , - 567 , 223 , 845 , -469 , -3177 , -2357 , 2872 , 824 , -1392 , 757 , 1566 , -859 , -167 , 552 , 315 , -101 , - -1017 , -1966 , -2969 , -2645 , -1036 , 1791 , 2595 , 2648 , 2209 , 1368 , 569 , 1255 , 1349 , -305 , -1605 , -2241 , - -180 , -2117 , -1548 , 2748 , 1044 , -1910 , -2213 , -915 , 378 , 69 , 1015 , 1919 , 2044 , 1120 , -379 , -1075 , - 61 , 1450 , 1443 , -536 , -2041 , -2153 , -241 , 101 , -1208 , -1900 , -710 , 1553 , 1938 , 1209 , 785 , 249 , - -871 , -3584 , -3398 , -2068 , -1304 , -586 , 802 , 1195 , 1173 , 629 , 692 , 918 , 1136 , 1304 , 1676 , 2286 , - -5190 , 69 , 1485 , 2699 , 2450 , 2023 , 739 , 746 , 653 , -67 , -772 , -1497 , -1398 , -1046 , -609 , -285 , - 436 , 3227 , 395 , -2370 , -1678 , 289 , 1631 , 1271 , 450 , 574 , 1098 , 1346 , 176 , -1624 , -2479 , -2743 , - -2034 , 1082 , 2695 , 1685 , 1183 , 915 , 636 , -341 , -486 , 350 , 1164 , 625 , -760 , -1982 , -2380 , -2349 , - 914 , 1532 , 886 , -2080 , -3920 , -4687 , -1446 , 2800 , 2748 , 1303 , 524 , -634 , -11 , 747 , 691 , 632 , - 1084 , -467 , -438 , 1087 , 2116 , 2201 , 1470 , 691 , 853 , 987 , 574 , -224 , -1366 , -2404 , -3041 , -3123 , - 3022 , -593 , -1542 , -411 , 421 , 580 , 276 , -223 , -67 , -96 , -91 , -202 , -250 , -445 , -371 , -7 , - 4287 , 2796 , 539 , -861 , -426 , -868 , -1334 , -1937 , -2448 , -2081 , -837 , 139 , 474 , 386 , 738 , 1432 , - -3717 , -1050 , 587 , 144 , -312 , -549 , -30 , 857 , 1641 , 2410 , 2657 , 2049 , 788 , -915 , -1966 , -2594 , - 1656 , 90 , 245 , 2403 , 4979 , 1448 , -716 , -288 , -387 , -1023 , -1625 , -1371 , -1425 , -1584 , -1505 , -899 , - 2943 , -214 , -1605 , -563 , 565 , 838 , 558 , -616 , -919 , -1002 , 498 , 2396 , 2264 , -116 , -2465 , -2562 , - 29 , 1348 , 1688 , 136 , -859 , -273 , -627 , 84 , 1360 , 3635 , 2904 , -1691 , -2928 , -2031 , -1197 , -1576 , - -3472 , 1420 , 442 , -1499 , -1990 , -1702 , -1566 , -1104 , 78 , 1033 , 1640 , 1632 , 1574 , 1220 , 1212 , 1081 , - 1953 , -23 , -627 , -1383 , -1259 , 1004 , 3624 , 2500 , -1346 , -2634 , -1795 , -778 , -511 , -345 , 456 , 1163 , - 4332 , -964 , -3948 , -3470 , 1285 , 4835 , 3224 , 584 , -77 , -893 , -848 , -484 , -428 , -664 , -1430 , -1053 , - -117 , -1788 , -833 , 558 , 730 , 891 , -108 , -1659 , -2651 , -2745 , -1081 , 1583 , 2809 , 2204 , 1191 , 1018 , - -1345 , -373 , -461 , -1404 , -2370 , -2179 , -1860 , -1422 , -886 , -763 , -387 , 596 , 1341 , 2668 , 4449 , 4396 , - 703 , 1081 , 785 , 116 , -226 , 588 , 371 , 128 , -841 , -1511 , -2399 , -3059 , -3098 , -175 , 3474 , 4064 , - 2514 , -777 , -1994 , -1860 , -1724 , -1633 , -1409 , -1049 , -426 , 483 , 1396 , 1809 , 1677 , 1298 , 934 , 762 , - -2407 , 787 , 1259 , 1895 , 1549 , 339 , -1486 , -2126 , -2176 , -1736 , -1109 , -617 , -109 , 887 , 2228 , 2818 , - -2370 , -192 , 160 , -107 , 141 , -1165 , -2137 , 299 , 2936 , 3445 , -1416 , -1420 , 1045 , 1309 , 500 , -1029 , - -803 , 477 , 733 , 1105 , 1659 , 1199 , 396 , -525 , -596 , -699 , -668 , -547 , -466 , -585 , -527 , -153 , - -854 , -1179 , -969 , -484 , 67 , 243 , 278 , -137 , -55 , 12 , 281 , 514 , 599 , 462 , 461 , 759 , - -555 , 4717 , 2129 , -264 , -987 , -522 , -88 , -291 , -391 , -491 , -515 , -766 , -855 , -879 , -331 , 88 , - -1373 , -2671 , -1199 , 3480 , 2467 , 1443 , 608 , 260 , -542 , -1600 , -1685 , -1118 , -694 , -114 , 750 , 1987 , - 934 , 3323 , 1049 , -2373 , 769 , 3068 , 503 , -1591 , -2364 , -3449 , -3986 , -3071 , 844 , 5877 , 941 , -474 , - -425 , 228 , -1215 , -1583 , -1505 , -1579 , -934 , -791 , -484 , -477 , 1056 , 4177 , 4488 , 3123 , -786 , -3291 , - 1305 , -1331 , -1055 , 1844 , 3061 , 1077 , -2285 , -2600 , 230 , 4597 , 1138 , -3419 , -3967 , -827 , 2157 , 77 , - 997 , 210 , -659 , -997 , -624 , 153 , 286 , -62 , -2489 , 591 , 3868 , 1520 , -1263 , -1424 , -494 , 387 , - 550 , 1926 , -1797 , -3507 , -2499 , -447 , 586 , 751 , 425 , -141 , -276 , 149 , 519 , 762 , 1372 , 1626 , - 4225 , -2078 , 205 , 1305 , -229 , -2501 , -1305 , -231 , 298 , 233 , -219 , -284 , -355 , -157 , 196 , 896 , - 1933 , 2394 , 2521 , -320 , -2587 , -3794 , -3666 , -1887 , -607 , -128 , 189 , 577 , 518 , 1040 , 1956 , 1861 , - -4582 , -2223 , -1479 , -548 , -20 , 1204 , 1867 , 1627 , 992 , -767 , -2361 , -1057 , 474 , 2119 , 2744 , 2011 , - -3537 , -810 , -278 , -246 , 338 , 2203 , 3 , -278 , -22 , 2105 , 1761 , -1452 , -2749 , -633 , 2262 , 1334 , - 2549 , 1831 , 1526 , 633 , -570 , -1662 , -2041 , -1590 , -568 , 965 , 2087 , 1627 , 325 , -934 , -1811 , -2366 , - -2625 , 735 , 4126 , 1924 , -1352 , -1375 , -67 , -263 , -332 , -611 , -223 , 69 , -41 , -365 , -50 , 449 , - 1945 , -542 , 862 , 1501 , -463 , -3503 , -3203 , 3338 , 4340 , -1886 , -1472 , -176 , -899 , -1007 , 153 , 1012 , - 1176 , -2807 , 927 , 489 , -701 , -1222 , 1377 , 2025 , 1740 , 704 , 835 , 366 , -857 , -1584 , -1462 , -1007 , - 1374 , 1113 , 165 , -297 , -35 , -391 , -815 , -1221 , -716 , -497 , -249 , 51 , 360 , 245 , 279 , 635 , - 4741 , 2291 , -661 , -1808 , -1569 , -1013 , -23 , 449 , 899 , 914 , -15 , -826 , -1123 , -1159 , -870 , -227 , - -3095 , -3457 , -326 , 1213 , 999 , 1504 , 2296 , 1487 , 1074 , 733 , 257 , -216 , -595 , -863 , -635 , -376 , - 1313 , 1943 , 2320 , 2119 , 1731 , 1184 , 521 , -954 , -2164 , -2882 , -2594 , -1657 , -957 , -667 , -49 , 792 , - -225 , 2104 , 1245 , 2010 , 1467 , -381 , -1564 , -1777 , -2347 , -1964 , -723 , 1747 , 2298 , 1153 , -937 , -2106 , - 1110 , -1091 , -1843 , -326 , 890 , 1762 , 1723 , 1959 , 2404 , 1131 , -1081 , -2694 , -2783 , -1612 , -483 , 933 , - -3280 , 740 , 493 , -1621 , -2458 , -538 , 3182 , 2390 , 1740 , 648 , 349 , -246 , -677 , -725 , -96 , 98 , - 1151 , 1644 , 2333 , 571 , -841 , -749 , 1667 , 2880 , 2249 , 381 , -1951 , -2564 , -2038 , -1604 , -1690 , -1440 , - 1322 , -4374 , -4684 , 281 , 3091 , 1587 , 369 , -3 , -524 , 313 , 1018 , 1177 , 314 , -171 , -81 , 365 , - 2499 , -904 , -2181 , -489 , 429 , 669 , -619 , -1412 , -1628 , -1788 , -978 , 7 , 230 , 941 , 2049 , 3175 -}; -#endif + const float ivas_sns_cdbk_tcx20_stage3[ 32 * 16 ] = { -0.12109375f, -0.32348633f, -0.25976562f, 0.21435547f, 0.4814453f, 0.14819336f, -0.22363281f, -0.31030273f, -0.13256836f, 0.10107422f, 0.33276367f, 0.32495117f, 0.16577148f, -0.079833984f, -0.16210938f, -0.15527344f, @@ -8102,44 +6239,7 @@ const float ivas_sns_cdbk_tcx20_stage3[ 32 * 16 ] = 0.17895508f, -0.31396484f, -0.033203125f, -0.02734375f, -0.0637207f, -0.11791992f, -0.03466797f, 0.0061035156f, 0.07324219f, 0.072753906f, 0.14916992f, 0.13671875f, 0.12524414f, 0.017333984f, -0.08178711f, -0.08618164f, 0.13330078f, -0.15893555f, -0.22045898f, -0.032226562f, -0.07739258f, -0.25463867f, -0.32299805f, -0.2614746f, 0.039794922f, 0.18554688f, 0.1262207f, -0.04321289f, -0.010498047f, 0.13330078f, 0.31860352f, 0.44506836f, }; -#ifdef IVAS_FLOAT_FIXED -/*Q12*/ -const Word16 ivas_sns_cdbk_tcx20_stage3_fx[32 * 16] = -{ - -496 , -1325 , -1064 , 878 , 1972 , 607 , -916 , -1271 , -543 , 414 , 1363 , 1331 , 679 , -327 , -664 , -636 , - 362 , -60 , -548 , -1188 , 3577 , -1280 , -794 , 791 , -404 , 216 , -537 , -90 , -322 , -81 , -302 , 662 , - -474 , 1151 , 1105 , -431 , -442 , -1174 , -1503 , -1387 , -649 , 79 , 712 , 865 , 1105 , 707 , 299 , 37 , - 334 , 155 , -1060 , -1247 , -263 , 534 , 1502 , 1635 , 1393 , 587 , -48 , -494 , -698 , -945 , -853 , -533 , - -102 , -2580 , 3220 , -45 , -520 , -353 , 93 , 202 , 19 , -559 , -404 , 0 , 267 , 59 , 248 , 455 , - -1614 , 689 , 1170 , -355 , -659 , 214 , 1065 , 234 , -205 , -321 , 68 , 241 , 302 , -162 , -349 , -318 , - 49 , -471 , -419 , -290 , 40 , -128 , -639 , -61 , 432 , -165 , -1970 , -1140 , 2419 , 2709 , 567 , -934 , - 1995 , 749 , -847 , -723 , -809 , -1302 , -1034 , 36 , 1174 , 1053 , 777 , 479 , 202 , -226 , -725 , -798 , - 503 , -396 , 223 , 711 , 939 , 1443 , 1651 , 131 , -658 , -607 , -422 , -361 , -558 , -963 , -997 , -639 , - -2380 , -60 , -1779 , -303 , 1247 , 1476 , 787 , 528 , 535 , 131 , -102 , -243 , -199 , -125 , 129 , 359 , - -480 , 67 , 624 , 1594 , 1140 , -29 , -302 , -842 , -1229 , -1468 , -958 , -139 , 349 , 447 , 512 , 716 , - -441 , 257 , -20 , 524 , -98 , -901 , -345 , 1409 , 932 , -1626 , -1328 , 1998 , 1784 , -632 , -919 , -596 , - 13 , -162 , 276 , -73 , -1083 , 1249 , 1237 , -1331 , -2051 , 634 , 2497 , 636 , -778 , -595 , 73 , -539 , - 150 , -478 , -1380 , -2201 , -557 , 1248 , 1317 , -435 , -672 , -351 , 51 , 444 , 824 , 719 , 625 , 695 , - -1787 , -1936 , -691 , -455 , -726 , -586 , 62 , 521 , 559 , 532 , 788 , 935 , 953 , 717 , 592 , 523 , - -307 , 803 , 537 , -415 , -32 , -772 , -200 , 1387 , 1056 , -700 , -1667 , -1182 , -198 , 200 , 611 , 879 , - -1136 , -297 , 1067 , 1599 , 933 , 85 , -496 , -329 , 704 , 1505 , 440 , -791 , -926 , -846 , -811 , -698 , - 554 , 1640 , -641 , -1038 , 1272 , 2216 , -1350 , -1756 , 606 , 710 , -732 , -972 , -109 , -55 , -189 , -155 , - -1245 , 526 , 853 , -490 , -1359 , -1307 , -459 , 418 , 1330 , 1485 , 1076 , 66 , -528 , -675 , -21 , 330 , - 1408 , 1470 , 1952 , 558 , -474 , -218 , 330 , -50 , -91 , -404 , -330 , -556 , -753 , -1070 , -1056 , -717 , - 48 , -64 , 1098 , -961 , -1463 , 2614 , -1256 , 333 , -225 , 412 , -110 , -417 , -56 , -260 , 2 , 305 , - -416 , 207 , 378 , 157 , -143 , 675 , 352 , 15 , -633 , -373 , 108 , -981 , -1789 , -1138 , 895 , 2685 , - -658 , 135 , 341 , 217 , -171 , 367 , 678 , 235 , -334 , 875 , 199 , -2878 , -1134 , 2089 , 1114 , -1075 , - 2544 , 16 , 331 , 686 , 339 , -461 , -853 , -1260 , -1021 , -628 , 3 , 359 , 463 , 93 , -282 , -329 , - 1673 , -1600 , -1453 , 892 , 900 , -44 , 456 , 879 , 586 , -366 , -785 , -970 , -549 , -140 , 126 , 396 , - -901 , 3362 , -1315 , 487 , -27 , -544 , 32 , -54 , -225 , -100 , 268 , -6 , -228 , -277 , -289 , -183 , - -605 , -695 , -453 , 2594 , -1649 , -1440 , 1218 , 352 , 100 , -292 , 42 , 3 , -89 , 81 , 342 , 494 , - -276 , 125 , 78 , 668 , 688 , 152 , 243 , 303 , 145 , 226 , 286 , 252 , 795 , 844 , -1302 , -3227 , - 522 , -167 , -889 , -105 , 51 , -136 , -646 , 213 , -785 , -1079 , 132 , 3267 , -1969 , -884 , 1495 , 982 , - 1886 , 878 , 347 , -1000 , -2044 , -679 , 1235 , 203 , -306 , -879 , -543 , -38 , 273 , 119 , 160 , 390 , - 733 , -1286 , -136 , -112 , -261 , -483 , -142 , 25 , 300 , 298 , 611 , 560 , 513 , 71 , -335 , -353 , - 546 , -651 , -903 , -132 , -317 , -1043 , -1323 , -1071 , 163 , 760 , 517 , -177 , -43 , 546 , 1305 , 1823 -}; -#endif + const float ivas_sns_cdbk_tcx20_stage4[ 32 * 16 ] = { -0.0056152344f, -0.03955078f, 0.071777344f, 0.26879883f, 0.44140625f, -0.08203125f, -0.20092773f, -0.009277344f, 0.05810547f, -0.06347656f, -0.07910156f, -0.05126953f, -0.07006836f, -0.068847656f, -0.07885742f, -0.09082031f, @@ -8176,49 +6276,8 @@ const float ivas_sns_cdbk_tcx20_stage4[ 32 * 16 ] = -0.0017089844f, -0.014160156f, -0.048339844f, -0.037109375f, -0.0949707f, -0.005859375f, 0.48388672f, -0.17480469f, -0.19140625f, 0.5727539f, -0.18920898f, -0.26391602f, 0.0048828125f, 0.067871094f, -0.045654297f, -0.06201172f, }; -#ifdef IVAS_FLOAT_FIXED -/*Q12*/ -const Word16 ivas_sns_cdbk_tcx20_stage4_fx[ 32 * 16 ] = -{ - -23 , -162 , 294 , 1101 , 1808 , -336 , -823 , -38 , 238 , -260 , -324 , -210 , -287 , -282 , -323 , -372 , - -49 , -247 , 49 , 204 , -183 , 155 , 406 , 257 , 91 , -371 , 16 , 1575 , 421 , -2168 , -1339 , 1183 , - -1457 , 1563 , 444 , 336 , 129 , -10 , -15 , -113 , -128 , -394 , -382 , -424 , -287 , 33 , 271 , 436 , - 157 , 92 , -904 , 2169 , -1450 , 1225 , -665 , -162 , 218 , -301 , -211 , 88 , 190 , 121 , -213 , -353 , - 311 , -803 , 192 , -2 , -217 , -143 , 781 , 349 , -660 , -1220 , -924 , -287 , 221 , 635 , 780 , 987 , - 337 , 1084 , -628 , -576 , -28 , 247 , -210 , -956 , -1165 , -580 , 325 , 976 , 847 , 398 , 61 , -133 , - 843 , -807 , 219 , 110 , -49 , -191 , -461 , 246 , 1392 , 1370 , -584 , -1545 , -895 , 69 , 341 , -57 , - 1408 , -1582 , -268 , -301 , -440 , 153 , 593 , 65 , 11 , 367 , 796 , 421 , -129 , -246 , -411 , -437 , - 526 , 80 , 669 , 935 , -656 , -1721 , -781 , 354 , 349 , -93 , 46 , 56 , -14 , 78 , -24 , 196 , - 112 , 33 , -306 , 471 , 9 , -1712 , 2296 , -1177 , 94 , -317 , -118 , 790 , 230 , 22 , -199 , -227 , - -152 , 530 , -1584 , -390 , 9 , -51 , 806 , 1056 , 519 , -417 , -360 , 39 , 581 , 595 , -314 , -867 , - 1217 , 271 , -1536 , -330 , 608 , -3 , -86 , 55 , -58 , -462 , -331 , -230 , -564 , -248 , 434 , 1262 , - -103 , 98 , -113 , -4 , 335 , -551 , -94 , 2816 , -1630 , -504 , 276 , 178 , -221 , -60 , -186 , -238 , - 60 , 171 , -102 , 21 , -326 , -190 , -116 , 90 , -469 , -487 , -171 , -8 , -1140 , 1358 , 2645 , -1333 , - -573 , -82 , 1285 , -2182 , 1292 , 153 , -175 , -243 , -223 , -40 , -30 , 63 , 315 , 338 , 48 , 55 , - -204 , 94 , -337 , -350 , 51 , 63 , -918 , 640 , -809 , 2336 , -1509 , 298 , 1930 , -1470 , 602 , -418 , - -702 , -781 , -877 , -125 , 396 , -358 , -395 , 70 , 355 , 170 , 242 , 140 , 333 , 526 , 492 , 514 , - -184 , 25 , 155 , 70 , 264 , 34 , -841 , -103 , 303 , 255 , -655 , -1131 , 1838 , 578 , -1675 , 1067 , - -612 , 728 , 94 , -512 , 2 , 779 , 158 , -163 , 387 , 828 , 919 , 457 , -331 , -696 , -1030 , -1009 , - -383 , 115 , -175 , 222 , 65 , -691 , -1245 , -708 , 283 , 1251 , 953 , -372 , 549 , 1413 , 150 , -1428 , - -820 , -428 , 172 , 383 , 42 , 193 , 1079 , 977 , 557 , -176 , -262 , -564 , -744 , -413 , -138 , 143 , - 600 , 113 , 1392 , -21 , -405 , 175 , -764 , -1357 , -582 , 164 , 149 , -297 , -490 , -7 , 387 , 944 , - 977 , 1086 , 140 , 175 , 207 , 142 , 499 , 161 , -74 , -393 , -441 , -657 , -705 , -513 , -398 , -208 , - -335 , -210 , -840 , 473 , 592 , -45 , -670 , -209 , 154 , 998 , 1575 , 223 , -1650 , -900 , 325 , 520 , - -1044 , -1156 , 804 , 1184 , 196 , -140 , 51 , -475 , -858 , -334 , 550 , 669 , 323 , 208 , 55 , -32 , - -278 , 97 , -45 , -152 , -784 , 487 , -82 , -1620 , 2324 , -113 , -981 , 425 , -194 , 122 , 307 , 487 , - 390 , -32 , 1476 , -311 , -835 , 256 , 628 , 184 , 17 , -565 , -603 , 62 , 717 , 453 , -600 , -1235 , - 262 , -96 , 317 , -990 , 168 , 771 , -1790 , 1064 , 1028 , -1523 , 167 , 1061 , 15 , -183 , -130 , -142 , - 104 , 381 , 464 , -114 , -36 , -288 , 116 , -216 , -800 , -1336 , 2780 , -303 , -616 , -288 , -113 , 265 , - -203 , 637 , -66 , -1133 , -1244 , -550 , 336 , 402 , 307 , 157 , 228 , -16 , -76 , 160 , 435 , 626 , - -177 , -754 , -187 , -206 , 868 , 2171 , 398 , -527 , -386 , -355 , -360 , -395 , -185 , 90 , -54 , 58 , - -7 , -58 , -198 , -152 , -389 , -24 , 1982 , -716 , -784 , 2346 , -775 , -1081 , 20 , 278 , -187 , -254 -}; -#endif const float *const ivas_sns_cdbks_tcx20[SNS_MSVQ_NSTAGES_TCX20] = { ivas_sns_cdbk_tcx20_stage1, ivas_sns_cdbk_tcx20_stage2, ivas_sns_cdbk_tcx20_stage3, ivas_sns_cdbk_tcx20_stage4 }; -#ifdef IVAS_FLOAT_FIXED -const Word16 *const ivas_sns_cdbks_tcx20_fx[SNS_MSVQ_NSTAGES_TCX20] = { ivas_sns_cdbk_tcx20_stage1_fx, ivas_sns_cdbk_tcx20_stage2_fx, ivas_sns_cdbk_tcx20_stage3_fx, ivas_sns_cdbk_tcx20_stage4_fx }; -#endif const int16_t ivas_sns_cdbks_tcx10_levels[SNS_MSVQ_NSTAGES_TCX10] = { 128, 32, 8 }; const int16_t ivas_sns_cdbks_tcx10_bits[SNS_MSVQ_NSTAGES_TCX10] = { 7, 5, 3 }; @@ -8354,140 +6413,7 @@ const float ivas_sns_cdbk_tcx10_stage1[ 128 * 16 ] = 3.256836f, 3.5593262f, 2.2746582f, 1.1318359f, 0.3149414f, -0.02368164f, 0.27172852f, -0.19335938f, -0.48779297f, -0.9663086f, -0.9187012f, -1.0222168f, -1.512207f, -1.6816406f, -1.8964844f, -2.1069336f, -0.057617188f, -0.45092773f, -0.9638672f, -0.72143555f, 0.20703125f, 1.4692383f, 1.921875f, 1.6833496f, 1.3933105f, 0.6699219f, 0.17333984f, -0.43798828f, -0.9772949f, -1.1477051f, -1.3552246f, -1.4057617f, }; -#ifdef IVAS_FLOAT_FIXED -/*Q12*/ -const Word16 ivas_sns_cdbk_tcx10_stage1_fx[ 128 * 16 ] = -{ - 4155 , 4844 , 1339 , -2626 , -4982 , -4674 , -4721 , -3645 , -803 , 3032 , 4826 , 4436 , 3204 , 1104 , -1360 , -4129 , --1594 , -1284 , -4844 , -8342 , -8548 , -7606 , -6706 , -5389 , -1713 , 2074 , 5231 , 5641 , 7605 , 9627 , 9427 , 6422 , -1788 , 7725 , 11493 , 9169 , 6341 , 587 , 299 , -4595 , -4548 , -3005 , -1718 , -3671 , -4272 , -3268 , -4935 , -7392 , -6395 , 3818 , 2406 , 1897 , 897 , 256 , -693 , -1410 , -1832 , -2500 , -2621 , -2342 , -1577 , -1062 , -856 , -776 , -4150 , 7919 , 3439 , -2033 , -2704 , -1557 , 231 , 1278 , 3321 , 2731 , -93 , -3269 , -3781 , -2586 , -2807 , -4238 , --3449 , -354 , 2017 , 2387 , 4764 , 5609 , 2963 , 1108 , 1421 , 28 , -950 , -1353 , -2415 , -2770 , -4077 , -4929 , -8524 , 7457 , 4506 , 1934 , 338 , -1987 , -2756 , -2266 , -1957 , -2240 , -2375 , -2413 , -2097 , -1743 , -1348 , -1577 , -7090 , 5351 , 2190 , 948 , 174 , 15 , 389 , 653 , 810 , 817 , 897 , 265 , -1778 , -3881 , -6266 , -7674 , -6804 , 11715 , 7237 , -532 , -1146 , 4914 , 6089 , 4999 , 2534 , -5124 , -6431 , -5499 , -5543 , -5359 , -6419 , -8238 , -7709 , 2493 , -2143 , -6489 , -5196 , -3714 , -2590 , -832 , -1060 , 376 , 749 , 4940 , 4149 , -203 , -522 , 2334 , -2478 , 4656 , 6266 , 8166 , 8080 , 7910 , 7237 , 5633 , 3847 , 82 , -2972 , -5614 , -9294 , -11465 , -12330 , -12680 , --3763 , 439 , 1331 , -211 , -1125 , 837 , 3525 , 1259 , 263 , -714 , -2457 , -3123 , -445 , 2047 , 1650 , 487 , -4433 , 3075 , 1944 , 16 , -1183 , -2102 , -2546 , -2683 , -2426 , -1757 , -724 , 250 , 488 , 152 , 994 , 2067 , --9469 , -5101 , -2893 , -3433 , -2063 , 164 , 2573 , 3814 , 3385 , 1553 , 818 , -98 , 1471 , 3904 , 3575 , 1801 , -15946 , 17207 , 12819 , 11001 , 8646 , 8327 , 189 , -5678 , -6626 , -8191 , -8726 , -8916 , -9067 , -9108 , -8807 , -9017 , --5510 , -1763 , 1586 , 4321 , 5956 , 6915 , 5607 , 1816 , -152 , -948 , -2191 , -3237 , -3324 , -3026 , -2853 , -3196 , -8688 , 10873 , 8275 , 4634 , 1734 , -557 , -1294 , -1577 , -1538 , -3121 , -4044 , -4288 , -3973 , -4095 , -4377 , -5339 , -8314 , 381 , -4203 , -6906 , -2427 , 2895 , 4683 , -1276 , -3574 , -1537 , 382 , -1706 , -1536 , -1335 , 2670 , 5175 , -2014 , 6901 , 7450 , 8391 , 5660 , 5349 , 3318 , 632 , -1645 , -7184 , -11554 , -6162 , -2239 , -4081 , -3232 , -3618 , -2463 , 7959 , 4852 , -2086 , -2118 , 2942 , 2680 , 273 , -1971 , -3815 , -4209 , -3731 , -1973 , 228 , 710 , -2203 , -2203 , 1934 , 716 , -1238 , -808 , -125 , -35 , 38 , -139 , -93 , 845 , 1853 , 747 , -583 , -2071 , -3245 , --8428 , -9073 , -4283 , -324 , 6076 , 5438 , -488 , -2617 , -275 , 3550 , -1050 , -170 , 4675 , 4235 , 2065 , 669 , -11333 , 11955 , 6902 , 1934 , -1514 , -2879 , -3232 , -4238 , -3422 , -2837 , -2629 , -2898 , -2649 , -2035 , -2008 , -1783 , -426 , 4019 , 4713 , 3739 , 3356 , 3491 , 3050 , 1887 , 1284 , -268 , -2029 , -3494 , -4307 , -4440 , -5214 , -6212 , -2092 , 5801 , 8237 , 9551 , 6780 , 3678 , 2472 , 1019 , 1067 , -1082 , -3123 , -5119 , -7460 , -7403 , -7732 , -8778 , -961 , 1615 , -886 , -4376 , -5548 , -5310 , -4982 , -4885 , -3665 , -1478 , 1198 , 2863 , 4755 , 6850 , 7462 , 5426 , -12293 , 13814 , 11807 , 11074 , 9876 , 10313 , 5810 , 199 , -2989 , -7493 , -10043 , -10534 , -10988 , -11237 , -10950 , -10951 , -250 , 3000 , 5233 , 3533 , 1034 , 378 , -553 , -1707 , -2133 , -2878 , -2837 , -2353 , -1841 , -364 , 705 , 534 , -8771 , 7295 , 2905 , -1528 , -2797 , -2224 , -2434 , -3707 , -3996 , -3372 , -2464 , -2340 , 88 , 2453 , 2127 , 1224 , --5356 , -4080 , -3178 , -3415 , -3409 , -2987 , -2237 , -677 , 1836 , 4189 , 5902 , 5483 , 3659 , 2525 , 1749 , -4 , -8540 , 13122 , 10394 , 3057 , 1011 , 2922 , 1889 , -673 , -1284 , -4815 , -6548 , -6657 , -5605 , -4808 , -4643 , -5902 , --904 , 3036 , 3724 , 1024 , 621 , 2200 , 3068 , 4347 , 4727 , 939 , -3049 , -4688 , -4457 , -3259 , -3173 , -4155 , -7412 , 8540 , 3520 , -908 , -2046 , -2396 , -2247 , -1458 , -976 , 74 , -489 , 690 , 143 , -3498 , -4187 , -2172 , --9034 , -10692 , -9925 , -9020 , -3884 , 6891 , 9607 , 8744 , 7840 , 4174 , 2713 , 2569 , 3504 , 3316 , -948 , -5856 , -12528 , 15782 , 10788 , 3495 , -369 , -2158 , -2473 , -3242 , -3527 , -5125 , -5686 , -5358 , -4614 , -3620 , -2829 , -3594 , -3762 , 7050 , 3669 , -309 , -1556 , -2008 , -2380 , -2362 , -2016 , -1483 , -971 , -939 , -639 , 127 , 288 , -234 , -5466 , 5096 , 839 , -4326 , -4389 , -495 , 3962 , 6525 , 4641 , 474 , -1865 , -1808 , -2070 , -3368 , -3972 , -4710 , --7682 , -10419 , -8678 , 2804 , 7231 , 15597 , 6455 , -2426 , -908 , 2257 , 7253 , 5190 , -3489 , -5573 , -6505 , -1107 , -10313 , 8489 , 4954 , 1234 , -1203 , -393 , 1849 , 1910 , 915 , -2272 , -5380 , -5480 , -3449 , -3573 , -4108 , -3807 , -9010 , 7210 , 5020 , 3041 , 1855 , 1295 , 314 , -953 , -2075 , -2616 , -2829 , -2858 , -3271 , -3970 , -4378 , -4795 , -1460 , 6841 , 8628 , 3136 , 3143 , 6063 , 5972 , 3426 , 2223 , -5238 , -7341 , -6357 , -5904 , -3889 , -4715 , -7448 , -1449 , -1827 , -4550 , -6487 , -5713 , -2732 , -660 , 433 , 1307 , 2371 , 2794 , 3239 , 3158 , 2432 , 2376 , 2409 , -5243 , 9630 , 12091 , 11941 , 10590 , 7240 , 4378 , 1797 , -801 , -6201 , -9586 , -10323 , -9468 , -8915 , -8728 , -8887 , --6934 , -1067 , 786 , -193 , 251 , 625 , 700 , 418 , 356 , 314 , 163 , 106 , 6 , 1088 , 1894 , 1487 , -6060 , 3896 , 485 , -2939 , -4736 , -3436 , 282 , 2032 , 1869 , -523 , -3273 , -3045 , -833 , -16 , 1127 , 3049 , --6670 , -1890 , 358 , -230 , 447 , 2409 , 3909 , 6279 , 5449 , 1441 , -878 , -2018 , -2272 , -1424 , -1908 , -3000 , -11826 , 16636 , 13050 , 6279 , 1706 , 781 , 2337 , -3227 , -5169 , -7375 , -6710 , -5822 , -6503 , -6377 , -5089 , -6343 , -485 , 663 , 700 , 2165 , 1981 , 966 , 376 , 1834 , 2298 , 1627 , 1114 , 702 , -758 , -3039 , -4935 , -6179 , -15276 , 10241 , 6249 , 2873 , 783 , 322 , 994 , 1738 , 951 , -1804 , -4461 , -5446 , -5652 , -6733 , -7613 , -7717 , --4421 , -2251 , -2182 , -3670 , -3227 , -2064 , -1880 , -1860 , -609 , 307 , 1234 , 2129 , 3532 , 5592 , 5516 , 3853 , -3360 , 7922 , 10867 , 9394 , 6526 , 1053 , 1896 , 2883 , 1638 , -5507 , -7666 , -7210 , -7668 , -4745 , -5551 , -7191 , -2467 , 6411 , 8292 , 4274 , 2274 , 1209 , -243 , -1212 , -1185 , -2826 , -3570 , -3368 , -3512 , -3049 , -2692 , -3269 , -3028 , 7338 , 7308 , 4275 , 997 , -2048 , -3118 , -4094 , -3189 , -2517 , -1649 , -1480 , -692 , 504 , -1307 , -3355 , --13713 , -11806 , -7131 , -79 , 6455 , 6414 , -589 , -4681 , -1922 , 6331 , 330 , 637 , 6245 , 5108 , 4653 , 3749 , -14977 , 9830 , 6085 , 2938 , 1863 , 1059 , -553 , -2267 , -3180 , -4394 , -5086 , -4951 , -4163 , -4237 , -4011 , -3909 , --1081 , 3251 , 6408 , 7149 , 4954 , 5039 , 4478 , 4353 , 4522 , 680 , -6756 , -9382 , -7832 , -5831 , -3856 , -6094 , -7162 , 7991 , 4675 , 976 , 841 , 2948 , 4353 , 3456 , 2703 , 451 , -1709 , -4266 , -5937 , -7074 , -7860 , -8711 , -7238 , -605 , -4007 , 3 , 8333 , 1173 , -2176 , -5314 , -6069 , -5080 , -4591 , -4717 , -2795 , -241 , 5388 , 13461 , -10596 , 12578 , 13802 , 10908 , 7436 , 2231 , 2444 , 1872 , -2275 , -7177 , -9152 , -9171 , -8796 , -8290 , -8520 , -8488 , --737 , 2442 , 485 , -2808 , -3574 , -3229 , -2953 , -2353 , -857 , 704 , 1697 , 2241 , 2025 , 2311 , 2655 , 1952 , -12162 , 6690 , 2238 , -2622 , -4617 , -5816 , -5879 , -5236 , -4308 , -2961 , -1748 , -1607 , 1838 , 2753 , 3664 , 5448 , --3077 , 452 , 1966 , -389 , -1269 , 118 , 175 , 1055 , 3620 , 4579 , 1375 , -1234 , -1480 , -1197 , -1718 , -2974 , -15858 , 15042 , 10523 , 5569 , 4228 , 4314 , 3082 , 654 , -1725 , -5657 , -8057 , -9036 , -8888 , -8704 , -8514 , -8690 , -1704 , 1674 , 529 , 1843 , 4216 , 6144 , 6034 , 4105 , 2177 , -429 , -2012 , -2595 , -4212 , -5660 , -6417 , -7102 , -4241 , 3011 , -177 , -3536 , -4674 , -3686 , -1588 , 992 , 3180 , 2882 , 1972 , 1063 , 676 , -379 , -1461 , -2516 , --10246 , -9377 , -9897 , -10469 , -9129 , -5712 , -3574 , -1246 , 1237 , 4416 , 7620 , 7504 , 9023 , 11338 , 10287 , 8226 , -5873 , 10679 , 11753 , 7933 , 5561 , 2214 , 30 , -1608 , -3259 , -6151 , -6707 , -5993 , -5418 , -4939 , -4492 , -5477 , -1703 , 1720 , 48 , -171 , 92 , 1005 , 1475 , 1312 , 659 , -228 , -981 , -1903 , -1549 , -716 , -784 , -1681 , -534 , 4872 , 3894 , -2429 , -4953 , -2172 , 3168 , 2622 , 2251 , 1388 , -2147 , -4094 , -1110 , 1384 , -375 , -2832 , --10365 , -5877 , -612 , 3409 , 4994 , 5250 , 3856 , 2179 , 1532 , 1289 , 947 , 43 , -882 , -1327 , -1874 , -2562 , -7364 , 8825 , 6753 , 3174 , 1572 , 1020 , -1433 , -3832 , -4629 , -5540 , -5397 , -4403 , -2961 , -1278 , 255 , 511 , -3616 , 2982 , 2441 , 1531 , 2154 , 2980 , 1762 , 767 , 272 , -953 , -1744 , -2069 , -2225 , -2573 , -3790 , -5149 , -6016 , 10717 , 11396 , 4773 , 1867 , 5061 , 5183 , 3833 , 2366 , -3588 , -10444 , -10907 , -9023 , -5516 , -3941 , -7793 , -6375 , 1989 , -1308 , -3670 , -4356 , -4171 , -3980 , -3432 , -2043 , -587 , 591 , 1288 , 2794 , 3630 , 3600 , 3279 , -8179 , 11466 , 8560 , 3788 , 3482 , 5771 , 6843 , 5604 , 4908 , 1374 , -3903 , -8790 , -11546 , -12047 , -11857 , -11832 , --3090 , 661 , 1382 , -807 , 2129 , 5268 , 1730 , -823 , -481 , -2827 , -4904 , -3053 , -219 , 1606 , 3077 , 350 , -8949 , 4159 , 587 , -2658 , -2926 , -2276 , -1678 , -1050 , -331 , -65 , -22 , -396 , -501 , -142 , -463 , -1189 , --5048 , -1761 , -1240 , -3476 , -3747 , -2868 , 162 , 3168 , 4073 , 1904 , 569 , 468 , 1695 , 3016 , 2504 , 582 , -13457 , 16793 , 15820 , 10226 , 6095 , -181 , -2293 , -4895 , -6222 , -6960 , -7158 , -7267 , -7171 , -6955 , -6811 , -6477 , --1163 , 1485 , 2929 , 4720 , 6317 , 6894 , 3387 , -44 , -1981 , -2797 , -3233 , -2707 , -2580 , -3352 , -3680 , -4195 , -10024 , 13762 , 8664 , 2406 , 361 , 330 , 523 , -3418 , -2716 , 1302 , -192 , -7081 , -7539 , -6126 , -4791 , -5509 , -221 , -2249 , -2660 , -1660 , -613 , -278 , -544 , -655 , 183 , 1048 , 1304 , 660 , 1055 , 1496 , 1247 , 1445 , -846 , 5133 , 6934 , 10757 , 11411 , 9325 , 4488 , 1331 , -3265 , -7057 , -8303 , -5003 , -4657 , -8262 , -7258 , -6419 , -9482 , 12253 , 6534 , -607 , -2653 , -673 , 306 , -1178 , -1765 , -3207 , -3766 , -3761 , -3142 , -1768 , -2113 , -3942 , --550 , 1425 , 2011 , 157 , -1079 , -1413 , -1697 , -1610 , -686 , 39 , 810 , 288 , 848 , 1801 , 1010 , -1353 , --10109 , -11744 , -7706 , 379 , 8248 , 6559 , 38 , -828 , 2185 , 6885 , 844 , 754 , 4769 , 3153 , -890 , -2538 , -13503 , 12466 , 7450 , 1458 , -2178 , -4645 , -5771 , -6295 , -6474 , -5971 , -4508 , -2899 , 1290 , 560 , 405 , 1608 , -4667 , 8260 , 6596 , 1763 , 3540 , 6861 , 3573 , -969 , -5225 , -5388 , -4163 , -2503 , -3545 , -3940 , -3641 , -5886 , -5072 , 10057 , 11017 , 4484 , 3638 , 2703 , 2095 , 2224 , 2067 , -2996 , -4340 , -4397 , -7071 , -7750 , -8132 , -8671 , -7076 , 4469 , 996 , -4409 , -7469 , -8582 , -7901 , -7025 , -4868 , -1656 , 2572 , 4172 , 4462 , 5363 , 6290 , 6510 , -11515 , 12880 , 10465 , 3540 , 1874 , 6237 , 6698 , 3799 , -2308 , -7772 , -8623 , -8541 , -7869 , -7144 , -7664 , -7087 , -1889 , 3817 , 3520 , 1054 , -342 , -451 , -2129 , -3116 , -3726 , -5315 , -4316 , -2809 , 54 , 3440 , 4742 , 3688 , -12822 , 7564 , 3096 , -1375 , -2981 , -3502 , -2957 , -2787 , -2321 , -2052 , -2014 , -1157 , -656 , -1499 , -1036 , 856 , --7298 , -3128 , -1459 , -3766 , -3686 , -1244 , 669 , 2187 , 5005 , 6621 , 4491 , 1512 , 782 , 783 , -274 , -1196 , -12071 , 12166 , 10231 , 7547 , 4891 , 1997 , 167 , -1868 , -2940 , -5141 , -6998 , -7442 , -6793 , -6155 , -5653 , -6081 , --1753 , 1625 , 4228 , 3372 , 2337 , 4063 , 4415 , 1944 , 491 , -2688 , -5614 , -5677 , -3836 , -1216 , -247 , -1444 , -12512 , 6411 , 2980 , 101 , -359 , -558 , -915 , -211 , -81 , -568 , -1190 , -2006 , -2777 , -3666 , -4294 , -5379 , --9543 , -6774 , -6214 , -7549 , -7059 , -3854 , -1628 , 2101 , 5622 , 6976 , 6572 , 5418 , 5229 , 4875 , 3740 , 2087 , -8837 , 12535 , 11328 , 7255 , 2550 , -2526 , -4345 , -6428 , -5892 , -7230 , -7262 , -4485 , -1885 , -283 , -223 , -1946 , -9129 , 8498 , 4366 , 281 , -3607 , -5680 , -5660 , -5230 , -3574 , -1874 , -344 , -92 , 1479 , 1933 , 516 , -142 , -5256 , 9433 , 6759 , -793 , -3866 , -459 , 5206 , 4388 , 3690 , -2799 , -7970 , -5691 , -3094 , -697 , -2658 , -6706 , --2216 , -5889 , -3568 , 2955 , 9741 , 7436 , 239 , -1003 , 1111 , 4778 , -1103 , -1008 , 1967 , -1394 , -4972 , -7074 , -10789 , 7440 , 2779 , -665 , -2630 , -3084 , -1314 , 514 , 584 , -2094 , -4598 , -5089 , -1705 , -879 , -523 , 474 , -6838 , 5757 , 5081 , 5754 , 4886 , 2602 , 782 , 166 , -233 , -2235 , -3851 , -4886 , -4905 , -4949 , -5029 , -5777 , -3777 , 8672 , 7923 , 2766 , 875 , 3035 , 2111 , 256 , -660 , -3765 , -6885 , -7930 , -5724 , -1376 , 64 , -3141 , -1043 , 1116 , -2723 , -6588 , -6935 , -6723 , -5310 , 129 , 5099 , 4079 , 3612 , 2961 , 2573 , 4722 , 2989 , -43 , -1107 , 6435 , 9892 , 10493 , 10103 , 8530 , 4943 , 5882 , 5571 , -2662 , -9598 , -11372 , -11225 , -10110 , -8411 , -9579 , --5006 , -976 , 1744 , 1682 , 136 , -921 , -1278 , -2195 , -2395 , -1642 , 74 , 1034 , 1476 , 2263 , 2966 , 3036 , -5150 , 4553 , 3608 , 1262 , -1364 , -913 , 1595 , 2380 , 2112 , -469 , -3306 , -3879 , -2810 , -2832 , -2793 , -2294 , --3555 , -3199 , -1984 , -903 , 897 , 2488 , 1905 , 2582 , 2162 , 544 , 447 , 1148 , 647 , -112 , -935 , -2133 , -19565 , 17281 , 11036 , 5756 , 1904 , 520 , -2148 , -4844 , -5499 , -5875 , -6311 , -6526 , -6486 , -6349 , -6068 , -5956 , --4564 , 687 , 4457 , 4047 , 2491 , 1633 , 917 , 80 , 46 , 286 , -541 , -1798 , -2353 , -1410 , -1770 , -2208 , -10582 , 8739 , 6358 , 4552 , 5070 , 5384 , 3814 , 1464 , -830 , -3127 , -4787 , -5934 , -6628 , -7437 , -8195 , -9024 , --8243 , -6062 , -5955 , -6127 , -4538 , -1750 , -708 , 329 , 1275 , 2189 , 2653 , 2630 , 4348 , 7441 , 7186 , 5331 , -3524 , 8176 , 10617 , 11183 , 9097 , 4548 , 2951 , -138 , -2003 , -4822 , -9077 , -10737 , -10317 , -6266 , -1688 , -5048 , --160 , 2942 , 5298 , 6724 , 7063 , 1816 , -1506 , -2566 , -575 , -1613 , -6146 , -5214 , -2667 , -893 , -655 , -1848 , -1846 , 4832 , 4243 , 1910 , 516 , -856 , -1034 , -742 , -737 , -953 , -523 , -41 , -980 , -1924 , -2386 , -3170 , --15228 , -14072 , -7488 , 944 , 6245 , 6079 , 828 , -630 , 1680 , 6027 , 390 , 513 , 5448 , 5516 , 2111 , 1639 , -19563 , 12033 , 6609 , 1145 , -1338 , -2373 , -3214 , -3154 , -3135 , -3507 , -3551 , -3495 , -3191 , -3941 , -4145 , -4305 , --3621 , -2181 , 970 , 8464 , 10422 , 7881 , 6143 , 5042 , 3015 , 869 , -2539 , -3894 , -5022 , -7336 , -8360 , -9855 , -4589 , 9181 , 6169 , 1082 , 342 , 359 , 16 , 127 , 334 , -1624 , -2322 , -2546 , -2957 , -3264 , -4017 , -5471 , -3606 , -2296 , -3662 , -4758 , -3791 , -5478 , -4900 , -5253 , -5389 , -5139 , -4257 , -168 , 6209 , 6583 , 9851 , 18841 , -8752 , 12363 , 11875 , 8625 , 6928 , 5159 , 4395 , 2087 , 1077 , -2569 , -6852 , -9550 , -10394 , -10712 , -10636 , -10548 , -1860 , 2305 , -375 , -3366 , -3658 , -1668 , 102 , 33 , -397 , -793 , -1050 , -1026 , 612 , 3009 , 3141 , 1271 , -3601 , 5629 , 2769 , -909 , -3496 , -4488 , -4379 , -4804 , -4034 , -2723 , -478 , 276 , 2538 , 4467 , 3717 , 2316 , --1091 , -1227 , -3638 , -5036 , -2839 , 46 , 2252 , 4024 , 4850 , 4463 , 2408 , 276 , -365 , -206 , -1119 , -2800 , -13340 , 14579 , 9317 , 4636 , 1290 , -97 , 1113 , -792 , -1998 , -3958 , -3763 , -4187 , -6194 , -6888 , -7768 , -8630 , --236 , -1847 , -3948 , -2955 , 848 , 6018 , 7872 , 6895 , 5707 , 2744 , 710 , -1794 , -4003 , -4701 , -5551 , -5758 -}; -#endif + const float ivas_sns_cdbk_tcx10_stage2[ 32 * 16 ] = { 0.30615234f, 0.48828125f, -0.02709961f, -0.47680664f, -0.5300293f, -0.25463867f, -0.13305664f, -0.14941406f, -0.14819336f, 0.08666992f, 0.28833008f, 0.27514648f, 0.099365234f, -0.017578125f, 0.033203125f, 0.15893555f, @@ -8524,44 +6450,6 @@ const float ivas_sns_cdbk_tcx10_stage2[ 32 * 16 ] = -0.20361328f, -0.21557617f, -0.16308594f, -0.041748047f, -0.111083984f, -0.057617188f, 0.0390625f, 0.013183594f, 0.17358398f, 0.74902344f, 0.9448242f, 0.4477539f, -0.09423828f, -0.32739258f, -0.50634766f, -0.6467285f, }; -#ifdef IVAS_FLOAT_FIXED -/*Q12*/ -const Word16 ivas_sns_cdbk_tcx10_stage2_fx[ 32 * 16 ] = -{ - 1254 , 2000 , -111 , -1953 , -2171 , -1043 , -545 , -612 , -607 , 355 , 1181 , 1127 , 407 , -72 , 136 , 651 , - 1677 , -181 , -362 , 1586 , 2110 , 1730 , 1432 , 1098 , 154 , -818 , -1272 , -1336 , -1575 , -1560 , -1581 , -1103 , - -657 , -1538 , -1699 , -507 , 1053 , 1212 , 186 , -178 , -469 , -827 , 133 , 2395 , 4402 , 1302 , -1796 , -3012 , - -2950 , 352 , 1493 , 317 , -158 , -83 , 933 , 969 , -252 , -2462 , -2188 , -58 , 1292 , 1447 , 1121 , 226 , - 698 , -549 , -716 , -673 , -616 , -664 , 851 , 3231 , 3395 , 1140 , -408 , -1086 , -1210 , -1305 , -1243 , -845 , - 2743 , 2575 , 2092 , 1507 , 389 , -1102 , -1786 , -2168 , -2057 , -1183 , -331 , 322 , -167 , -615 , -313 , 93 , - -600 , -1922 , -1784 , -461 , 89 , -257 , -435 , -978 , -1404 , -863 , 41 , 1077 , 1513 , 1868 , 2050 , 2065 , - -2614 , -1550 , -493 , 1920 , 2469 , 1658 , 1322 , 891 , 120 , 39 , 375 , 58 , -816 , -1117 , -1258 , -1006 , - 4114 , 141 , -1496 , -667 , -717 , -670 , 81 , 172 , -377 , -514 , -566 , -636 , -562 , -172 , 483 , 1384 , - -1224 , -232 , 927 , 1449 , 1662 , 219 , -1358 , -2391 , -2453 , -568 , 1446 , 1748 , 514 , -215 , 94 , 381 , - -2542 , -2686 , -1605 , -961 , -430 , -99 , 429 , 1125 , 1378 , 1174 , 1221 , 1454 , 908 , 258 , 15 , 360 , - -990 , 1611 , 1860 , -56 , -115 , 132 , -143 , 570 , 2335 , 1232 , -117 , -340 , -953 , -1048 , -1653 , -2325 , - -1043 , 825 , 558 , 90 , 77 , 1451 , 1251 , -180 , -132 , 1996 , 1103 , -2372 , -3534 , -1902 , 879 , 933 , - 413 , -20 , 632 , 2414 , 2389 , 615 , -571 , -1252 , -1630 , -1721 , -1782 , -2012 , -990 , 319 , 1376 , 1819 , - -3559 , -518 , 1547 , 1324 , -401 , -1236 , -464 , 286 , 445 , 417 , 78 , -85 , -106 , 81 , 648 , 1542 , - 175 , 86 , 1305 , 954 , -1355 , -3290 , -3017 , -1397 , 49 , 1139 , 1881 , 2013 , 1238 , 580 , -71 , -289 , - -1374 , 310 , -1225 , -3016 , -2673 , -729 , 1486 , 1715 , 1031 , 429 , 124 , -461 , 110 , 1435 , 1736 , 1102 , - 1452 , 2766 , 1584 , 39 , -167 , 368 , 1002 , 674 , -710 , -1804 , -1906 , -1640 , -1156 , -768 , -151 , 418 , - 1743 , 660 , -478 , -657 , -589 , -842 , -315 , -227 , -806 , -1840 , -1270 , 444 , 2334 , 2275 , 464 , -895 , - -1221 , -2116 , -2089 , -944 , 1010 , 2035 , 1826 , 1844 , 652 , -1037 , -1405 , -1030 , -188 , 323 , 779 , 1560 , - 1345 , 1687 , 1678 , 945 , -1118 , -3020 , -1357 , 854 , 1198 , 98 , -913 , -918 , -434 , -448 , -201 , 605 , - -720 , 1466 , 2918 , 2271 , 1555 , 1037 , 3 , -715 , -816 , -748 , -566 , -552 , -1105 , -1496 , -1558 , -972 , - 769 , -1385 , -1653 , -673 , -1444 , -2353 , -1657 , 161 , 1159 , 991 , 469 , -49 , 638 , 1195 , 1616 , 2213 , - 921 , -1842 , -199 , 2419 , 2210 , -340 , -2057 , -988 , 955 , 653 , -182 , 179 , -79 , -812 , -707 , -130 , - 3529 , 896 , 163 , 98 , -379 , -690 , -478 , 329 , 251 , 506 , 958 , 943 , 23 , -1379 , -2370 , -2398 , - 2120 , 592 , -895 , -1916 , 1168 , 4037 , 176 , -2475 , -1664 , 291 , -325 , -455 , 71 , 89 , -566 , -249 , - 2005 , -2001 , -3131 , -1768 , -336 , 467 , 955 , 603 , 145 , 776 , 1259 , 1064 , 391 , -96 , -317 , -16 , - -458 , 921 , 2 , -1318 , -618 , 1762 , 2872 , 1443 , -494 , -954 , 625 , 807 , -263 , -885 , -1580 , -1861 , - -913 , -1382 , 280 , 380 , 190 , 897 , -146 , 150 , 2509 , 2072 , -1691 , -2832 , -2267 , 665 , 2229 , -140 , - -57 , 1690 , 1163 , -536 , -1436 , -1521 , -1073 , -1169 , -1491 , -1688 , -1247 , -678 , 313 , 1668 , 2955 , 3108 , - -3201 , 226 , 404 , -1437 , -1195 , 554 , 435 , -1440 , -1127 , 652 , 1406 , 1076 , 1635 , 1724 , 858 , -571 , - -834 , -883 , -668 , -171 , -455 , -236 , 160 , 54 , 711 , 3068 , 3870 , 1834 , -386 , -1341 , -2074 , -2649 -}; -#endif const float ivas_sns_cdbk_tcx10_stage3[ 8 * 16 ] = { 0.15209961f, -0.12768555f, 0.09375f, -0.083496094f, -0.25390625f, 0.12524414f, 0.2993164f, -0.09863281f, -0.34814453f, -0.2434082f, -0.11254883f, -0.060058594f, 0.032470703f, 0.15527344f, 0.23413086f, 0.2355957f, @@ -8574,27 +6462,8 @@ const float ivas_sns_cdbk_tcx10_stage3[ 8 * 16 ] = -0.1821289f, 0.060058594f, 0.24780273f, 0.41674805f, 0.2890625f, -0.1472168f, -0.20581055f, -0.083984375f, -0.060302734f, -0.19921875f, -0.17651367f, -0.08984375f, 0.011230469f, 0.13110352f, 0.080078125f, -0.09106445f, }; -#ifdef IVAS_FLOAT_FIXED -/*Q12*/ -const Word16 ivas_sns_cdbk_tcx10_stage3_fx[ 8 * 16 ] = -{ - 623 , -523 , 384 , -342 , -1040 , 513 , 1226 , -404 , -1426 , -997 , -461 , -246 , 133 , 636 , 959 , 965 , - -665 , -455 , -1300 , -1050 , 567 , 1223 , 430 , 481 , 1090 , 223 , -598 , -788 , 171 , 859 , 304 , -492 , - -208 , 605 , -411 , -1315 , -717 , -764 , -1112 , -319 , 15 , -176 , 415 , 1433 , 1263 , 414 , 315 , 561 , - -784 , -124 , 922 , 326 , -1112 , -803 , 1144 , 1435 , 427 , 25 , 268 , 478 , 151 , -534 , -930 , -887 , - 1087 , -853 , -1027 , 490 , 1117 , 729 , -10 , -523 , -934 , 31 , 874 , 798 , 188 , -485 , -729 , -753 , - 1051 , 1010 , 416 , -120 , -588 , -573 , -850 , -806 , 717 , 1704 , 536 , -841 , -665 , 167 , -153 , -1004 , - -357 , 94 , 2 , 303 , 589 , 278 , 15 , 480 , 358 , 5 , -311 , -465 , -1287 , -1594 , -94 , 1984 , - -746 , 246 , 1015 , 1707 , 1184 , -603 , -843 , -344 , -247 , -816 , -723 , -368 , 46 , 537 , 328 , -373 -}; -#endif - const float *const ivas_sns_cdbks_tcx10[SNS_MSVQ_NSTAGES_TCX10] = { ivas_sns_cdbk_tcx10_stage1, ivas_sns_cdbk_tcx10_stage2, ivas_sns_cdbk_tcx10_stage3}; -#ifdef IVAS_FLOAT_FIXED -const Word16 *const ivas_sns_cdbks_tcx10_fx[SNS_MSVQ_NSTAGES_TCX10] = { ivas_sns_cdbk_tcx10_stage1_fx, ivas_sns_cdbk_tcx10_stage2_fx, ivas_sns_cdbk_tcx10_stage3_fx}; -#endif - const int16_t ivas_sns_cdbks_side_tcx20_levels[SNS_MSVQ_NSTAGES_SIDE] = { 32, 32 }; const int16_t ivas_sns_cdbks_side_tcx20_bits[SNS_MSVQ_NSTAGES_SIDE] = { 5, 5 }; const int16_t ivas_sns_cdbks_side_tcx10_levels[SNS_MSVQ_NSTAGES_SIDE] = { 32, 8 }; @@ -8636,44 +6505,6 @@ const float ivas_sns_cdbks_side_tcx20_stage1[ 32 * 16 ] = -0.19580078f, -0.14624023f, -0.11303711f, -0.055908203f, -0.052001953f, -0.009033203f, 0.022949219f, -0.0068359375f, -0.032470703f, 0.0017089844f, 0.045410156f, 0.025146484f, 0.039794922f, 0.07543945f, 0.1574707f, 0.24267578f, }; -#ifdef IVAS_FLOAT_FIXED -/*Q15*/ -const Word16 ivas_sns_cdbks_side_tcx20_stage1_fx[ 32 * 16 ] = -{ - -3728 , -2160 , 1376 , 1464 , 5856 , -904 , -10680 , -6904 , -1608 , 416 , 424 , 496 , 2688 , 4152 , 4160 , 4952 , - -560 , 3056 , 7720 , 7344 , 3520 , 1648 , 1304 , -240 , -1584 , -2856 , -2792 , -3952 , -3656 , -3480 , -2920 , -2560 , - -8728 , 8968 , 14888 , 5968 , 21344 , 5920 , 4776 , -264 , 8624 , -1504 , -17040 , -5336 , 1256 , -10424 , -14160 , -14288 , - -1448 , -3424 , -3008 , -3480 , -3088 , 3056 , 8840 , 5432 , 2032 , 360 , 712 , -784 , -1200 , -1288 , -1424 , -1288 , - 13432 , 2072 , -720 , -472 , -456 , -608 , -1712 , -1696 , -1040 , -1144 , -904 , -1920 , -1488 , -1384 , -1248 , -704 , - 80 , 1008 , 664 , 448 , -296 , 424 , 312 , -992 , -1584 , -728 , 392 , -568 , -376 , -24 , 392 , 840 , - 5688 , 7336 , 6456 , -624 , -9016 , -17624 , -10056 , -1160 , 24 , -1624 , 2464 , 1712 , 4152 , 5344 , 3976 , 2960 , - -10488 , -9544 , -8104 , -5832 , -4608 , -3472 , -4152 , -3560 , -2824 , -2432 , 1000 , 5216 , 8184 , 10328 , 13400 , 16880 , - -16272 , -1104 , 2744 , 1400 , 1136 , 1768 , 1136 , 776 , 1232 , 1040 , 928 , 8 , 936 , 1008 , 1448 , 1816 , - -1328 , 736 , 320 , 1208 , 1824 , 1536 , 1064 , 2656 , 3136 , 1408 , -288 , -2120 , -1880 , -1544 , -3200 , -3528 , - 8896 , 12112 , 13000 , 12592 , 9880 , 7096 , 5096 , 3976 , -264 , -4192 , -7528 , -12816 , -14632 , -15344 , -11792 , -6072 , - -10376 , -9040 , -7304 , -6064 , -5168 , -3880 , -1520 , 1064 , 3592 , 5512 , 6664 , 5456 , 6560 , 6544 , 4664 , 3288 , - -920 , -896 , -2184 , -3256 , -3448 , -3456 , -1864 , 568 , 2016 , 2568 , 2880 , 1688 , 1776 , 1696 , 1400 , 1440 , - -4720 , -10120 , -2584 , 1744 , 2104 , 1056 , 1888 , 1904 , 1680 , 1368 , 1768 , 496 , 944 , 1104 , 768 , 608 , - 16256 , 14832 , 9552 , 5128 , 1712 , 576 , -1640 , -2176 , -3552 , -4936 , -5616 , -6728 , -6040 , -5752 , -6296 , -5320 , - -184 , -1008 , -3024 , -4136 , -5216 , -3936 , -3624 , -4376 , -4232 , -3232 , 576 , 4216 , 7160 , 8144 , 6144 , 6728 , - -368 , -2000 , -1056 , 5944 , 2240 , -4560 , -3328 , 56 , -152 , 320 , 1032 , -224 , 144 , 784 , 568 , 592 , - -1480 , -1800 , -1408 , 1760 , 6952 , 8256 , 2920 , -1120 , -1624 , -2040 , -2016 , -2568 , -1720 , -1448 , -1512 , -1160 , - 2664 , 6728 , 1408 , 3608 , 12192 , 14000 , 10448 , 6336 , 512 , -5864 , -6624 , -12560 , -8152 , -6744 , -8048 , -9928 , - -13144 , -6696 , -1600 , 616 , -2632 , 528 , 4400 , 8960 , 11480 , 11720 , 6280 , -1864 , -3816 , -5160 , -4912 , -4168 , - 9056 , 9144 , 7344 , 1176 , -3360 , -2016 , -2800 , -6504 , -8400 , -7448 , -6560 , -4112 , -88 , 2680 , 4856 , 7016 , - -3744 , -2248 , 8016 , -104 , -1416 , -1088 , 800 , -120 , -736 , 56 , 608 , -488 , -336 , 72 , 224 , 504 , - 2632 , 7816 , 5536 , 952 , -1432 , -3464 , -2552 , -1216 , -208 , -848 , -1208 , -2080 , -1416 , -1040 , -1064 , -408 , - -2368 , -5768 , -9744 , -11552 , -11408 , -8432 , -6872 , -6064 , -3680 , -1736 , 3160 , 10064 , 12880 , 18576 , 13312 , 9632 , - -7928 , -3608 , -1672 , 1288 , -2016 , -608 , 360 , 1408 , -7064 , -632 , 304 , 1576 , 8632 , 12056 , 4336 , -6424 , - 5312 , 5368 , 4720 , 3544 , 2936 , 3752 , 3848 , 3816 , 4296 , 3704 , 696 , -5192 , -6936 , -8968 , -11080 , -9816 , - -4792 , 2248 , 8104 , 12752 , 10440 , 8984 , 6280 , 4520 , 2280 , -616 , -3800 , -9336 , -11736 , -12464 , -8504 , -4352 , - -21240 , -19008 , -5088 , -2328 , -2720 , 320 , 3480 , 3464 , 4584 , 4256 , 5712 , 6032 , 3072 , 4104 , 6776 , 8592 , - 2568 , 5384 , -472 , -6848 , -2944 , 1408 , 2200 , 248 , -1216 , -960 , -656 , -1040 , 120 , 528 , 504 , 1176 , - -776 , -4680 , -12008 , -3696 , 1384 , 4616 , 1360 , 304 , 1304 , 1816 , 2016 , 1336 , 1840 , 2104 , 1720 , 1360 , - 7576 , 7056 , 5488 , 5128 , 4136 , 3440 , 2848 , 656 , -1136 , -4208 , -6088 , -9664 , -8864 , -5648 , -2272 , 1552 , - -6416 , -4792 , -3704 , -1832 , -1704 , -296 , 752 , -224 , -1064 , 56 , 1488 , 824 , 1304 , 2472 , 5160 , 7952 -}; -#endif const float ivas_sns_cdbks_side_tcx20_stage2[ 32 * 16 ] = { -0.013916016f, 0.0007324219f, 0.017089844f, 0.005859375f, 0.056152344f, -0.08178711f, -0.2927246f, 0.00390625f, 0.140625f, 0.03881836f, 0.010498047f, 0.038330078f, 0.042236328f, 0.020751953f, 0.005859375f, 0.0075683594f, @@ -8710,51 +6541,8 @@ const float ivas_sns_cdbks_side_tcx20_stage2[ 32 * 16 ] = 0.0847168f, 0.18920898f, -0.1796875f, -0.01586914f, -0.017822266f, -0.021728516f, 0.006591797f, -0.0075683594f, -0.019042969f, -0.0107421875f, -0.0146484375f, 0.014160156f, 0.0034179688f, -0.0056152344f, -0.0036621094f, -0.0017089844f, }; -#ifdef IVAS_FLOAT_FIXED -/*Q15*/ -const Word16 ivas_sns_cdbks_side_tcx20_stage2_fx[ 32 * 16 ] = -{ - -456 , 24 , 560 , 192 , 1840 , -2680 , -9592 , 128 , 4608 , 1272 , 344 , 1256 , 1384 , 680 , 192 , 248 , - -2328 , -3360 , 1248 , 3000 , 3896 , 4416 , 1664 , -3648 , -4536 , -6792 , -8432 , -4936 , 1064 , 2664 , 5760 , 10312 , - 2344 , 952 , 640 , 264 , 768 , 680 , 1056 , 720 , 1136 , 584 , -1240 , -4600 , -7104 , -3616 , 1888 , 5520 , - -3544 , -896 , -2704 , -2696 , -2592 , 1632 , 3360 , 7824 , 8416 , 1040 , -5184 , -4800 , -264 , -16 , -472 , 896 , - -744 , 920 , 4624 , -2216 , -2408 , 5328 , -240 , -2152 , -936 , -352 , -784 , 416 , -192 , -216 , -464 , -592 , - -3192 , -3016 , -2016 , -392 , 216 , 1368 , 272 , -576 , -2792 , -4120 , -2064 , 4488 , 8256 , 5024 , 64 , -1528 , - -6632 , 8864 , 1944 , 136 , 728 , -320 , -872 , -896 , -1072 , -552 , -848 , -48 , -248 , -312 , 152 , -32 , - 2112 , -8752 , 4024 , 840 , -208 , 144 , 280 , -56 , 200 , -232 , -616 , 392 , 280 , 328 , 664 , 600 , - -24 , -1232 , -1192 , -512 , 184 , -184 , -96 , 1072 , 1560 , 624 , -344 , 576 , 416 , 144 , -440 , -552 , - 2272 , 1736 , 2000 , 4384 , 4400 , 176 , -3256 , -6008 , -7160 , -2736 , 664 , 1928 , 440 , 376 , 640 , 136 , - 120 , -1656 , -168 , 6256 , -6160 , -1792 , 16 , -712 , -64 , 56 , 136 , 816 , 728 , 904 , 888 , 632 , - 808 , -136 , -872 , -2816 , -2072 , -2248 , -2456 , -1640 , -2000 , -200 , 1848 , 2896 , 1928 , 2208 , 2544 , 2208 , - 4488 , 2784 , 2328 , 1536 , 808 , 160 , -352 , -216 , 464 , -240 , -1360 , -888 , -1360 , -1992 , -3040 , -3120 , - -5496 , 2184 , 5968 , 2424 , -656 , 1816 , 1280 , -3936 , -3536 , 4040 , 12432 , 1072 , -5288 , -4992 , -3456 , -3848 , - -432 , -368 , -1224 , 88 , -1520 , -8008 , 3272 , 3624 , 280 , 336 , 432 , 1264 , 544 , 488 , 632 , 592 , - 1448 , 2544 , -1144 , -6016 , 5152 , 2008 , -968 , -616 , -784 , 24 , -344 , 288 , -184 , -304 , -488 , -616 , - 4488 , 368 , -1096 , -568 , -2544 , -4016 , -2504 , -568 , 4672 , 6984 , 4776 , 1056 , -2744 , -3944 , -2496 , -1880 , - 968 , -4008 , -8112 , 3112 , 6192 , 856 , 424 , 984 , 296 , -304 , -840 , 288 , -80 , -56 , 288 , -8 , - -1264 , -1272 , -2912 , -2256 , 728 , 3352 , 4208 , 2752 , 2152 , 2680 , 2488 , 1312 , -1568 , -3096 , -3392 , -3904 , - 304 , 1536 , 2680 , 1232 , 208 , -1256 , -384 , 9248 , 912 , -8256 , -4200 , 520 , 376 , -472 , -1448 , -1008 , - 2088 , 4072 , 3128 , -4384 , -8616 , -2072 , 1088 , 2160 , 1592 , 864 , 192 , 648 , -96 , -192 , -24 , -432 , - -552 , -1712 , -1880 , 264 , -384 , -2256 , -2816 , -536 , -400 , 1536 , 5952 , 8824 , 4416 , -800 , -4176 , -5480 , - -720 , -1768 , -744 , -16 , 2360 , 2736 , 1856 , -488 , 928 , 3080 , 2008 , -15984 , -608 , 5080 , 1920 , 352 , - 12608 , -1616 , -2600 , -824 , -760 , -680 , 880 , -16 , -1720 , -1112 , -1520 , -352 , -592 , -728 , -528 , -440 , - -7816 , -2128 , -592 , -112 , 1320 , 632 , 600 , 1008 , 984 , 936 , 336 , 1216 , 704 , 1144 , 1152 , 616 , - 1264 , 944 , 848 , 1416 , 1144 , -720 , -1136 , -640 , -776 , -3120 , -4552 , -1072 , 448 , 1928 , 2120 , 1896 , - -488 , 488 , 416 , 1488 , 240 , 2720 , 5832 , 1008 , -3848 , -2352 , -1576 , -232 , -528 , -800 , -1088 , -1272 , - 2264 , -1608 , -7672 , -10576 , -5000 , -928 , 1928 , 1832 , 2824 , 2688 , 1712 , 1792 , 728 , 2584 , 4280 , 3144 , - -4408 , -880 , 3512 , 5256 , 4360 , 1432 , 288 , 656 , 1312 , 576 , -984 , -816 , -2224 , -2840 , -2504 , -2744 , - -640 , -1960 , -2008 , 264 , 1048 , 2688 , -1480 , -8376 , -904 , 3448 , 2056 , 1536 , 952 , 1040 , 1392 , 936 , - -1640 , 2768 , 8904 , 1744 , -2096 , -4256 , -2392 , -1696 , -1200 , -48 , -32 , 712 , 296 , -24 , -432 , -608 , - 2776 , 6200 , -5888 , -520 , -584 , -712 , 216 , -248 , -624 , -352 , -480 , 464 , 112 , -184 , -120 , -56 -}; -#endif const float *const ivas_sns_cdbks_side_tcx20[SNS_MSVQ_NSTAGES_SIDE] = { ivas_sns_cdbks_side_tcx20_stage1, ivas_sns_cdbks_side_tcx20_stage2 }; -#ifdef IVAS_FLOAT_FIXED -/*Q15*/ -const Word16 *const ivas_sns_cdbks_side_tcx20_fx[SNS_MSVQ_NSTAGES_SIDE] = { ivas_sns_cdbks_side_tcx20_stage1_fx, ivas_sns_cdbks_side_tcx20_stage2_fx }; -#endif - const float ivas_sns_cdbks_side_tcx10_stage1[ 32 * 16 ] = { -0.23950195f, -0.203125f, -0.17822266f, -0.1315918f, -0.123291016f, -0.095947266f, -0.106933594f, -0.16552734f, -0.14941406f, -0.075683594f, 0.026367188f, 0.1015625f, 0.17041016f, 0.2770996f, 0.37890625f, 0.5148926f, @@ -8792,45 +6580,6 @@ const float ivas_sns_cdbks_side_tcx10_stage1[ 32 * 16 ] = } ; -#ifdef IVAS_FLOAT_FIXED -/*Q15*/ -const Word16 ivas_sns_cdbks_side_tcx10_stage1_fx[ 32 * 16 ] = -{ - - -7848 , -6656 , -5840 , -4312 , -4040 , -3144 , -3504 , -5424 , -4896 , -2480 , 864 , 3328 , 5584 , 9080 , 12416 , 16872 , - 4224 , 6824 , 7512 , 9824 , 7952 , 4744 , 2576 , 808 , -2496 , -6040 , -8736 , -10896 , -9040 , -4576 , -1000 , -1680 , - -4640 , -4360 , -3664 , -1224 , -1248 , 1688 , 2408 , 240 , 1472 , -768 , -4040 , -384 , 9208 , 7928 , 2304 , -4904 , - 1752 , 4024 , 4568 , 3272 , 2560 , 608 , 1128 , 3400 , 2144 , -992 , -3240 , -3264 , -1968 , -3920 , -5976 , -4080 , - -1424 , -1096 , -2184 , -2136 , -1600 , -3816 , -6736 , -6640 , -5104 , -32 , 3400 , 6944 , 8000 , 4760 , 3232 , 4416 , - 1904 , 7392 , 3336 , -2824 , -2448 , 1712 , 1720 , -1384 , -2312 , -1216 , -792 , -1032 , -1048 , -1328 , -1248 , -432 , - 656 , -1096 , -4768 , -13792 , -6424 , 1248 , 872 , 536 , 1256 , 1896 , 2216 , 2648 , 2992 , 3336 , 3928 , 4496 , - 4480 , 10016 , 15456 , 17952 , 13048 , 8872 , 5768 , 3016 , -432 , -5624 , -10376 , -13808 , -17456 , -15040 , -8984 , -6896 , - -12776 , -12320 , -12112 , -9552 , -8552 , -6528 , -4960 , -2968 , -1336 , 4376 , 9872 , 12640 , 13320 , 10192 , 9832 , 10872 , - 11504 , 17136 , 13720 , 4704 , -1232 , -4304 , -6024 , -5920 , -5168 , -5728 , -5584 , -4984 , -2704 , -2168 , -2112 , -1136 , - -21904 , -10168 , -7024 , -3928 , -3384 , 2632 , 7144 , 6840 , 3328 , 1080 , -1440 , 2560 , 2400 , 2544 , 6792 , 12520 , - -5624 , -3840 , -1144 , 1976 , 5928 , 11032 , 12960 , 8904 , 4208 , -1208 , -5624 , -6976 , -6816 , -5680 , -4096 , -4008 , - -6144 , -13096 , -584 , 3296 , 1888 , 928 , 1800 , 1400 , 1360 , 1536 , 1368 , 1792 , 2032 , 1032 , 440 , 936 , - 11408 , 7680 , -1800 , -5968 , -9432 , -10216 , -9208 , -6496 , -5136 , -2704 , 992 , 4472 , 7248 , 6808 , 5392 , 6960 , - -1896 , -3464 , 2944 , 9976 , 6208 , 4840 , 2976 , -688 , -1752 , -1456 , -2336 , -2912 , -2616 , -2816 , -3208 , -3800 , - 5776 , 8536 , 7128 , 6888 , 6600 , 9088 , 7080 , -40 , -360 , -3832 , -7640 , -5192 , -2648 , -2912 , -11704 , -16760 , - -12496 , -15912 , -11792 , -5288 , -856 , 296 , -416 , 1320 , 3128 , 5064 , 5352 , 6272 , 6928 , 6656 , 5896 , 5848 , - 1912 , 2064 , 1344 , 1048 , 2592 , 2200 , -944 , -1656 , -816 , -5840 , -10576 , -5456 , -176 , 1808 , 3912 , 8560 , - 1568 , -1384 , -7912 , -1256 , 1728 , 2248 , 1904 , 392 , -456 , -360 , 656 , 904 , 1016 , 760 , 464 , -264 , - -120 , 48 , 448 , 0 , 696 , 1096 , 488 , 152 , 1864 , 4400 , 2848 , -168 , -2384 , -3120 , -3592 , -2656 , - -5232 , -3632 , -4264 , -2352 , -2128 , -1848 , -1512 , -400 , 1592 , 1208 , -16 , -800 , -424 , 3016 , 7024 , 9784 , - 18344 , 5184 , -408 , -1416 , -1904 , -488 , -704 , -1256 , -1104 , -1232 , -2264 , -2504 , -2088 , -2120 , -2776 , -3272 , - -1304 , -1072 , -992 , -1688 , -1168 , -1344 , -1280 , 584 , 1688 , 456 , -1464 , -2000 , -400 , 2392 , 4040 , 3568 , - 14784 , 15304 , 12752 , 7616 , 5384 , 5928 , 6856 , 1112 , -4496 , -9040 , -13088 , -12584 , -10176 , -9328 , -9488 , -1528 , - -2888 , -7528 , -13744 , -16216 , -13232 , -9088 , -7384 , -4312 , -1464 , 3944 , 8176 , 10192 , 17080 , 15872 , 10728 , 9872 , - 10880 , 9704 , 5888 , 2192 , 3280 , 4544 , 1144 , -1072 , -3952 , -6872 , -9712 , -6848 , -2696 , -5512 , -5248 , 4304 , - -14480 , 576 , 2424 , 1096 , 1448 , 1544 , 992 , 1336 , 1344 , 752 , 152 , 616 , 936 , 616 , -16 , 680 , - -12000 , -7664 , -2680 , -496 , -1608 , 2592 , 7576 , 9280 , 12576 , 9576 , 3256 , -288 , -3216 , -5392 , -6208 , -5304 , - -5584 , -6016 , -6232 , -5184 , -6632 , -7168 , -4296 , 328 , 3936 , 8224 , 8200 , 6736 , 4760 , 4576 , 3400 , 952 , - 2288 , 2368 , 5984 , 832 , -8112 , -9376 , -3656 , -1216 , 120 , 1048 , 1440 , 1880 , 2560 , 2360 , 936 , 536 , - 2568 , 4440 , 5712 , 5072 , 4120 , -312 , -4944 , -6440 , -6424 , -3376 , -1504 , -856 , 664 , 784 , 432 , 48 , - 8304 , 7392 , 7344 , 5608 , 5952 , 5536 , 5408 , 6632 , 5584 , 848 , -5448 , -7904 , -10480 , -13136 , -12536 , -9104 -}; -#endif const float ivas_sns_cdbks_side_tcx10_stage2[ 8 * 16 ] = { -0.13989258f, -0.024658203f, 0.12670898f, 0.027832031f, 0.06689453f, 0.12817383f, 0.07495117f, -0.01977539f, -0.05834961f, -0.07543945f, -0.06542969f, -0.0546875f, -0.04345703f, -0.0063476562f, 0.034179688f, 0.029541016f, @@ -8843,25 +6592,8 @@ const float ivas_sns_cdbks_side_tcx10_stage2[ 8 * 16 ] = 0.20898438f, -0.011230469f, -0.08496094f, -0.010986328f, 0.032958984f, -0.013183594f, -0.057861328f, -0.07104492f, -0.06689453f, -0.056396484f, -0.047851562f, -0.03491211f, -0.011962891f, 0.032714844f, 0.08178711f, 0.11035156f, }; -#ifdef IVAS_FLOAT_FIXED -/*Q15*/ -const Word16 ivas_sns_cdbks_side_tcx10_stage2_fx[ 8 * 16 ] = -{ - -4584 , -808 , 4152 , 912 , 2192 , 4200 , 2456 , -648 , -1912 , -2472 , -2144 , -1792 , -1424 , -208 , 1120 , 968 , - -2200 , -3752 , -3208 , -2992 , -3992 , -328 , 3600 , 3784 , 1968 , 1248 , 672 , 568 , 792 , 928 , 1256 , 1656 , - 1808 , 1000 , 1280 , 1904 , 704 , 1064 , 1312 , -288 , -1832 , -784 , 1216 , 2080 , 888 , -2416 , -4176 , -3776 , - 3672 , 6576 , 1488 , -3552 , -4648 , -2792 , -1064 , 1112 , 1448 , 216 , -408 , -608 , -440 , -344 , -256 , -400 , - -1368 , -2416 , -4856 , 696 , 5248 , 3904 , 1832 , 2648 , 4112 , 1776 , -1008 , -1336 , -1976 , -2336 , -2544 , -2376 , - -2440 , -1352 , -1328 , -2248 , -1384 , -1264 , -1680 , -2912 , -1816 , 1208 , 2960 , 2192 , 2920 , 4296 , 2664 , 176 , - -1736 , 1104 , 5248 , 5632 , 808 , -4352 , -4568 , -1376 , 224 , 664 , 280 , 48 , -376 , -992 , -736 , 128 , - 6848 , -368 , -2784 , -360 , 1080 , -432 , -1896 , -2328 , -2192 , -1848 , -1568 , -1144 , -392 , 1072 , 2680 , 3616 -}; -#endif const float *const ivas_sns_cdbks_side_tcx10[SNS_MSVQ_NSTAGES_SIDE] = { ivas_sns_cdbks_side_tcx10_stage1, ivas_sns_cdbks_side_tcx10_stage2 }; -#ifdef IVAS_FLOAT_FIXED -const Word16 *const ivas_sns_cdbks_side_tcx10_fx[SNS_MSVQ_NSTAGES_SIDE] = { ivas_sns_cdbks_side_tcx10_stage1_fx, ivas_sns_cdbks_side_tcx10_stage2_fx }; -#endif const int16_t sns_1st_cdbk[2][2][8 * 32] = { { /* split 1 */ @@ -9105,1474 +6837,4 @@ const ACPL_QUANT_TABLE ivas_mc_paramupmix_beta_quant_table[9] = } }; -#ifdef IVAS_FLOAT_FIXED -const ACPL_QUANT_TABLE_FX ivas_mc_paramupmix_alpha_quant_table_fx = -{ - 33, /* nquant */ - 16, /* offset */ - { - -536870912, -485700416, -439563072, -398458880, -362387872, -331350016, -305345344, - -284373824, -268435456, -252497104, -231525584, -205520896, -174483040, -138412032, - -97307856, -51170508, 0, 51170508, 97307856, 138412032, 174483040, - 205520896, 231525584, 252497104, 268435456, 284373824, 305345344, 331350016, - 362387872, 398458880, 439563072, 485700416, 536870912, 0, 0 - } /* data in Q28 */ -}; - -const ACPL_QUANT_TABLE_FX ivas_mc_paramupmix_beta_quant_table_fx[9] = -{ - { - 9, /* nquant */ - 0, /* offset */ - { 0, 63753420, 147639504, 251658240, 375809632, 520093696, 684510400, 869059776, 1073741824 } /* data in Q28 */ - }, - { /* Beta #2 */ - 9, /* nquant */ - 0, /* offset */ - { 0, 54638668, 126531672, 215678976, 322080672, 445736544, 586646912, 744811456, 920230272 } /* data in Q28 */ - }, - { /* Beta #3 */ - 9, /* nquant */ - 0, /* offset */ - { 0, 46420464, 107500024, 183238656, 273636384, 378693184, 498409216, 632784256, 781818240 } /* data in Q28 */ - }, - { /* Beta #4 */ - 9, /* nquant */ - 0, /* offset */ - { 0, 39098780, 90544544, 154337280, 230477024, 318963584, 419797344, 532978048, 658505728 } /* data in Q28 */ - }, - { /* Beta #5 */ - 9, /* nquant */ - 0, /* offset */ - { 0, 32673642, 75665248, 128974864, 192602432, 266548032, 350811584, 445393216, 550292672 } /* data in Q28 */ - }, - { /* Beta #6 */ - 9, /* nquant */ - 0, /* offset */ - { 0, 27144998, 62862136, 107151352, 160012704, 221446144, 291451648, 370029408, 457179136 } /* data in Q28 */ - }, - { /* Beta #7 */ - 9, /* nquant */ - 0, /* offset */ - { 0, 22512928, 52135212, 88866816, 132707776, 183658096, 241717760, 306886688, 379165088 } /* data in Q28 */ - }, - { /* Beta #8 */ - 9, /* nquant */ - 0, /* offset */ - { 0, 18777374, 43484452, 74121200, 110687696, 153183840, 201609712, 255965264, 316250528 } /* data in Q28 */ - }, - { /* Beta #9 */ - 9, /* nquant */ - 0, /* offset */ - { 0, 15938355, 36909876, 62914560, 93952408, 130023424, 171127600, 217264944, 268435456 } /* data in Q28 */ - } -}; -#endif // IVAS_FLOAT_FIXED - -const Word32 one_by_q_level[64] = -{ 0, 2147483647, 1073741824, 715827904, 536870912, 429496736, -357913952, 306783392, 268435456, 238609296, 214748368, -195225792, 178956976, 165191056, 153391696, 143165584, -134217728, 126322568, 119304648, 113025456, 107374184, -102261128, 97612896, 93368856, 89478488, 85899344, -82595528, 79536432, 76695848, 74051160, 71582792, -69273664, 67108864, 65075264, 63161284, 61356676, -59652324, 58040100, 56512728, 55063684, 53687092, -52377648, 51130564, 49941480, 48806448, 47721860, -46684428, 45691140, 44739244, 43826196, 42949672, -42107524, 41297764, 40518560, 39768216, 39045156, -38347924, 37675152, 37025580, 36398028, 35791396, -35204648, 34636832, 34087044 }; - /* clang-format on */ - -#ifdef IVAS_FLOAT_FIXED - -/* Q Factor is 31*/ -const Word32 ivas_han_win_48k_fx[L_FRAME32k] = { - 5760, 22976, 51712, 91904, 143552, 206784, 281408, 367552, 465216, - 574272, 694912, 826944, 970496, 1125504, 1292032, 1470016, 1659456, - 1860352, 2072704, 2296576, 2531904, 2778624, 3036864, 3306560, 3587648, - 3880256, 4184256, 4499712, 4826624, 5164992, 5514752, 5875968, 6248576, - 6632640, 7028096, 7434944, 7853248, 8282880, 8723968, 9176448, 9640320, - 10115584, 10602176, 11100224, 11609536, 12130304, 12662400, 13205824, 13760576, - 14326720, 14904192, 15492928, 16093056, 16704512, 17327232, 17961216, 18606592, - 19263168, 19931072, 20610240, 21300672, 22002368, 22715328, 23439488, 24174912, - 24921600, 25679424, 26448512, 27228800, 28020288, 28822976, 29636864, 30461888, - 31298048, 32145344, 33003840, 33873472, 34754176, 35646016, 36548992, 37463040, - 38388224, 39324416, 40271680, 41230016, 42199424, 43179840, 44171264, 45173696, - 46187200, 47211648, 48247104, 49293504, 50350848, 51419200, 52498432, 53588608, - 54689664, 55801664, 56924544, 58058304, 59202944, 60358400, 61524736, 62701888, - 63889856, 65088640, 66298176, 67518528, 68749632, 69991488, 71244096, 72507392, - 73781440, 75066176, 76361536, 77667648, 78984384, 80311744, 81649728, 82998400, - 84357568, 85727424, 87107776, 88498688, 89900160, 91312128, 92734656, 94167680, - 95611136, 97065088, 98529472, 100004288, 101489536, 102985152, 104491200, 106007552, - 107534336, 109071424, 110618816, 112176512, 113744512, 115322816, 116911296, 118510080, - 120119040, 121738240, 123367552, 125007104, 126656768, 128316608, 129986496, 131666496, - 133356608, 135056768, 136766976, 138487232, 140217408, 141957632, 143707840, 145467968, - 147238016, 149017984, 150807872, 152607616, 154417216, 156236672, 158065920, 159904960, - 161753728, 163612352, 165480640, 167358720, 169246464, 171143808, 173050880, 174967552, - 176893888, 178829760, 180775296, 182730304, 184694848, 186668928, 188652480, 190645504, - 192648000, 194659904, 196681216, 198711936, 200752000, 202801344, 204860032, 206928064, - 209005376, 211091904, 213187648, 215292672, 217406784, 219530048, 221662528, 223804096, - 225954752, 228114496, 230283264, 232461056, 234647872, 236843584, 239048320, 241262016, - 243484544, 245716032, 247956288, 250205440, 252463424, 254730112, 257005632, 259289856, - 261582784, 263884416, 266194688, 268513664, 270841216, 273177344, 275522048, 277875264, - 280237056, 282607296, 284986048, 287373184, 289768768, 292172672, 294584960, 297005632, - 299434560, 301871808, 304317312, 306771072, 309233024, 311703040, 314181312, 316667712, - 319162240, 321664832, 324175424, 326694080, 329220672, 331755200, 334297728, 336848192, - 339406528, 341972672, 344546688, 347128448, 349718080, 352315328, 354920384, 357533120, - 360153536, 362781568, 365417152, 368060352, 370711168, 373369408, 376035200, 378708416, - 381389120, 384077120, 386772608, 389475456, 392185536, 394902976, 397627648, 400359552, - 403098624, 405844928, 408598400, 411358976, 414126592, 416901312, 419683008, 422471680, - 425267392, 428070016, 430879552, 433695936, 436519232, 439349312, 442186112, 445029696, - 447880064, 450737088, 453600832, 456471168, 459348160, 462231616, 465121600, 468018176, - 470921280, 473830784, 476746688, 479668928, 482597632, 485532608, 488473856, 491421376, - 494375168, 497335168, 500301184, 503273472, 506251840, 509236288, 512226752, 515223296, - 518225728, 521234048, 524248320, 527268608, 530294592, 533326528, 536364096, 539407552, - 542456576, 545511296, 548571712, 551637888, 554709440, 557786624, 560869376, 563957504, - 567051264, 570150272, 573254656, 576364544, 579479616, 582600064, 585725696, 588856704, - 591992704, 595134080, 598280256, 601431680, 604588160, 607749632, 610916224, 614087680, - 617264128, 620445312, 623631488, 626822336, 630017984, 633218496, 636423616, 639633408, - 642847872, 646067008, 649290624, 652518784, 655751552, 658988672, 662230400, 665476352, - 668726784, 671981504, 675240576, 678503808, 681771264, 685042944, 688318784, 691598848, - 694882880, 698171072, 701463168, 704759296, 708059392, 711363328, 714671296, 717982976, - 721298560, 724617728, 727940864, 731267392, 734597760, 737931776, 741269376, 744610624, - 747955200, 751303488, 754655040, 758009984, 761368512, 764730240, 768095360, 771463616, - 774835200, 778209792, 781587840, 784968832, 788352896, 791740160, 795130304, 798523584, - 801919616, 805318784, 808720640, 812125312, 815532928, 818943168, 822356288, 825771840, - 829190272, 832611200, 836034816, 839460928, 842889472, 846320640, 849754112, 853190080, - 856628352, 860068992, 863511808, 866957056, 870404352, 873853696, 877305408, 880759104, - 884215040, 887672832, 891132736, 894594496, 898058112, 901523840, 904991232, 908460544, - 911931456, 915404288, 918878528, 922354560, 925832384, 929311616, 932792512, 936274816, - 939758720, 943243904, 946730624, 950218560, 953707840, 957198528, 960690368, 964183488, - 967677568, 971172992, 974669440, 978166912, 981665536, 985164992, 988665600, 992166912, - 995669248, 999172288, 1002676288, 1006180864, 1009686208, 1013192384, 1016698880, 1020206336, - 1023714176, 1027222656, 1030731584, 1034241024, 1037750784, 1041260928, 1044771584, 1048282368, - 1051793600, 1055304896, 1058816512, 1062328192, 1065839872, 1069351872, 1072863808, 1076375808, - 1079887744, 1083399680, 1086911488, 1090423168, 1093934592, 1097445760, 1100956928, 1104467584, - 1107977984, 1111488000, 1114997504, 1118506624, 1122015232, 1125523456, 1129031040, 1132538112, - 1136044544, 1139550336, 1143055360, 1146559616, 1150063104, 1153565696, 1157067648, 1160568576, - 1164068480, 1167567488, 1171065600, 1174562560, 1178058496, 1181553408, 1185046912, 1188539520, - 1192030720, 1195520768, 1199009408, 1202496768, 1205982720, 1209467008, 1212950144, 1216431744, - 1219911936, 1223390336, 1226867328, 1230342528, 1233816192, 1237288064, 1240758144, 1244226560, - 1247693056, 1251157760, 1254620416, 1258081152, 1261539968, 1264996864, 1268451712, 1271904384, - 1275355008, 1278803456, 1282249728, 1285693696, 1289135488, 1292574848, 1296011904, 1299446784, - 1302878976, 1306308736, 1309736064, 1313160960, 1316583296, 1320002944, 1323420032, 1326834304, - 1330246144, 1333655040, 1337061120, 1340464512, 1343865088, 1347262592, 1350657152, 1354048768, - 1357437440, 1360823168, 1364205824, 1367585280, 1370961664, 1374334720, 1377704704, 1381071360, - 1384434816, 1387794944, 1391151616, 1394504960, 1397854976, 1401201152, 1404544000, 1407883520, - 1411219328, 1414551552, 1417880064, 1421204992, 1424526080, 1427843456, 1431157120, 1434466944, - 1437772928, 1441074944, 1444373120, 1447667072, 1450957312, 1454243328, 1457525248, 1460803328, - 1464077056, 1467346688, 1470612096, 1473873408, 1477130240, 1480382848, 1483630976, 1486874752, - 1490114048, 1493348992, 1496579584, 1499805440, 1503026944, 1506243584, 1509455744, 1512663296, - 1515866112, 1519064192, 1522257536, 1525446144, 1528629760, 1531808512, 1534982272, 1538151296, - 1541315328, 1544474368, 1547628288, 1550777216, 1553921024, 1557059840, 1560193152, 1563321472, - 1566444672, 1569562240, 1572674816, 1575782016, 1578883584, 1581980032, 1585070848, 1588156416, - 1591236352, 1594310912, 1597379584, 1600442880, 1603500544, 1606552576, 1609598592 -}; - -/* Q Factor is 31*/ -const Word32 ivas_han_win_32k_fx[L_FRAME32k] = { - 12928, 51648, 116224, 206656, 322880, 464960, 632832, 826496, 1046016, - 1291328, 1562496, 1859392, 2182080, 2530560, 2904832, 3304832, 3730560, - 4182080, 4659328, 5162304, 5690944, 6245312, 6825344, 7431104, 8062464, - 8719488, 9402112, 10110336, 10844160, 11603520, 12388480, 13198976, 14034944, - 14896448, 15783424, 16695808, 17633664, 18596928, 19585536, 20599552, 21638912, - 22703552, 23793472, 24908672, 26049088, 27214720, 28405504, 29621504, 30862592, - 32128704, 33419968, 34736192, 36077440, 37443712, 38834816, 40250880, 41691776, - 43157504, 44648064, 46163328, 47703360, 49268032, 50857408, 52471296, 54109824, - 55772928, 57460416, 59172416, 60908800, 62669568, 64454656, 66264064, 68097664, - 69955456, 71837440, 73743488, 75673600, 77627712, 79605824, 81607808, 83633664, - 85683392, 87756864, 89854080, 91974912, 94119360, 96287424, 98478976, 100694016, - 102932416, 105194240, 107479296, 109787648, 112119232, 114473856, 116851584, 119252352, - 121676096, 124122688, 126592192, 129084480, 131599488, 134137088, 136697408, 139280192, - 141885440, 144513152, 147163264, 149835584, 152530176, 155246848, 157985728, 160746560, - 163529408, 166334144, 169160704, 172009024, 174879040, 177770752, 180683904, 183618624, - 186574720, 189552128, 192550848, 195570752, 198611840, 201673920, 204756992, 207860992, - 210985792, 214131392, 217297600, 220484480, 223691840, 226919680, 230167936, 233436416, - 236725120, 240033984, 243362880, 246711744, 250080512, 253469120, 256877440, 260305472, - 263753024, 267220096, 270706496, 274212288, 277737280, 281281408, 284844672, 288426880, - 292027904, 295647808, 299286464, 302943744, 306619456, 310313728, 314026368, 317757248, - 321506304, 325273472, 329058688, 332861760, 336682688, 340521408, 344377664, 348251520, - 352142784, 356051456, 359977344, 363920448, 367880640, 371857792, 375851840, 379862656, - 383890112, 387934272, 391994880, 396071936, 400165248, 404274816, 408400384, 412542016, - 416699584, 420872960, 425062016, 429266688, 433486912, 437722368, 441973248, 446239360, - 450520576, 454816704, 459127808, 463453696, 467794112, 472149248, 476518784, 480902784, - 485300992, 489713344, 494139840, 498580032, 503034304, 507502208, 511983808, 516478848, - 520987392, 525509120, 530044032, 534592000, 539153088, 543726912, 548313600, 552912832, - 557524608, 562148736, 566785408, 571434048, 576094784, 580767616, 585452224, 590148608, - 594856576, 599576192, 604307072, 609049344, 613802752, 618567296, 623342592, 628128896, - 632925888, 637733504, 642551552, 647380096, 652218752, 657067648, 661926400, 666795264, - 671673856, 676562176, 681459968, 686367232, 691283648, 696209536, 701144320, 706088192, - 711040768, 716002176, 720972224, 725950656, 730937472, 735932480, 740935808, 745947008, - 750966144, 755992960, 761027456, 766069504, 771118976, 776175680, 781239680, 786310528, - 791388416, 796472896, 801564288, 806662080, 811766400, 816876928, 821993792, 827116544, - 832245248, 837379776, 842520064, 847665856, 852817152, 857973696, 863135424, 868302208, - 873474048, 878650560, 883831808, 889017728, 894207936, 899402624, 904601216, 909804160, - 915010944, 920221696, 925435904, 930653952, 935875200, 941099776, 946327616, 951558592, - 956792384, 962029120, 967268416, 972510272, 977754624, 983001344, 988250112, 993501120, - 998753856, 1004008576, 1009264704, 1014522624, 1019781888, 1025042560, 1030304256, 1035566976, - 1040830784, 1046095232, 1051360384, 1056626048, 1061892224, 1067158592, 1072425280, 1077691776, - 1082958208, 1088224512, 1093490560, 1098755968, 1104020736, 1109284864, 1114548224, 1119810432, - 1125071616, 1130331520, 1135590272, 1140847232, 1146102912, 1151356544, 1156608512, 1161858304, - 1167106048, 1172351616, 1177594624, 1182835200, 1188073344, 1193308544, 1198541056, 1203770368, - 1208996736, 1214219648, 1219439232, 1224655488, 1229867904, 1235076736, 1240281472, 1245482240, - 1250679040, 1255871360, 1261059456, 1266243072, 1271421952, 1276596224, 1281765504, 1286929920, - 1292089088, 1297243008, 1302391552, 1307534592, 1312672000, 1317803520, 1322929280, 1328049152, - 1333162752, 1338270336, 1343371264, 1348465920, 1353553920, 1358635264, 1363709568, 1368776960, - 1373837312, 1378890496, 1383936256, 1388974336, 1394004992, 1399028224, 1404043264, 1409050496, - 1414049792, 1419040640, 1424023424, 1428997632, 1433963392, 1438920448, 1443868672, 1448808064, - 1453738496, 1458659328, 1463571328, 1468473856, 1473366912, 1478250240, 1483124096, 1487987968, - 1492841856, 1497685632, 1502519296, 1507342592, 1512155392, 1516957696, 1521749504, 1526530176, - 1531299968, 1536059008, 1540806912, 1545543424, 1550268672, 1554982528, 1559684864, 1564375168, - 1569053952, 1573720832, 1578375680, 1583018240, 1587648640, 1592266496, 1596872192, 1601464960, - 1606045312, 1610612736, 1615167488, 1619708672, 1624237184, 1628752384, 1633254272, 1637742464, - 1642217216, 1646678400, 1651125504, 1655558784, 1659978240, 1664383616, 1668774784, 1673151488, - 1677513856, 1681861760, 1686194816, 1690513408, 1694817024, 1699105792, 1703379200, 1707637760, - 1711880960, 1716108800, 1720321152, 1724518144, 1728699392, 1732865024, 1737014400, 1741148160, - 1745265792, 1749367296, 1753452288, 1757521152, 1761573632, 1765609344, 1769628416, 1773630976, - 1777616640, 1781585408, 1785536768, 1789471488, 1793388800, 1797288832, 1801171328, 1805036544, - 1808883968, 1812713728, 1816525824, 1820320000, 1824096000, 1827854208, 1831594112, 1835315968, - 1839019520, 1842704384, 1846370944, 1850018944, 1853648256, 1857258624, 1860850432, 1864423168, - 1867976960, 1871511296, 1875026688, 1878522880, 1881999616, 1885456896, 1888894720, 1892312832, - 1895711488, 1899089920, 1902448896, 1905787904, 1909106688, 1912405504, 1915684096, 1918942592, - 1922180480, 1925398016, 1928595200, 1931771904, 1934927616, 1938062848, 1941177344, 1944270848, - 1947343360, 1950395136, 1953425664, 1956434944, 1959422976, 1962389632, 1965335040, 1968259072, - 1971161344, 1974042368, 1976901504, 1979739008, 1982554624, 1985348352, 1988120320, 1990870272, - 1993597952, 1996303616, 1998987264, 2001648384, 2004287104, 2006903552, 2009497728, 2012069376, - 2014618112, 2017144576, 2019648256, 2022129024, 2024587136, 2027022336, 2029434624, 2031823872, - 2034190080, 2036533120, 2038853120, 2041149696, 2043423232, 2045673344, 2047900160, 2050103296, - 2052283136, 2054439552, 2056572160, 2058681216, 2060766464, 2062828160, 2064865920, 2066879744, - 2068869888, 2070835968, 2072778240, 2074696192, 2076590336, 2078460160, 2080305792, 2082127360, - 2083924608, 2085697536, 2087446016, 2089170304, 2090870144, 2092545280, 2094196096, 2095822336, - 2097424128, 2099001088, 2100553472, 2102081024, 2103584000, 2105062144, 2106515456, 2107943936, - 2109347584, 2110726272, 2112080000, 2113408768, 2114712448, 2115991168, 2117244672, 2118473216, - 2119676672, 2120854912, 2122007936, 2123135744, 2124238336, 2125315584, 2126367616, 2127394304, - 2128395520, 2129371648, 2130322048, 2131247232, 2132146944, 2133021184, 2133869824, 2134693120, - 2135490816, 2136263040, 2137009664, 2137730688, 2138426112, 2139095936, 2139740160, 2140358656, - 2140951552, 2141518720, 2142060288, 2142576128, 2143066112, 2143530496, 2143969152, 2144382080, - 2144769280, 2145130496, 2145466112, 2145775872, 2146060032, 2146318208, 2146550528, 2146757120, - 2146937984, 2147092992, 2147222016, 2147325440, 2147403008, 2147454592, 2147480448 -}; - -/* Q Factor is 31*/ -const Word32 ivas_han_win_16k_fx[L_FRAME32k] = { - 51584, 206336, 464192, 825216, 1289344, 1856512, 2526592, 3299648, 4175552, - 5154240, 6235584, 7419520, 8705856, 10094592, 11585472, 13178432, 14873280, - 16669824, 18568000, 20567552, 22668288, 24869952, 27172480, 29575488, 32078848, - 34682304, 37385600, 40188480, 43090624, 46091840, 49191808, 52390144, 55686656, - 59081024, 62572800, 66161792, 69847552, 73629824, 77508160, 81482176, 85551552, - 89715904, 93974784, 98327808, 102774528, 107314560, 111947456, 116672768, 121490048, - 126398720, 131398528, 136488832, 141669184, 146939136, 152298048, 157745600, 163281088, - 168904064, 174614016, 180410304, 186292480, 192259904, 198312000, 204448256, 210667968, - 216970688, 223355584, 229822336, 236370112, 242998400, 249706432, 256493632, 263359424, - 270303040, 277323904, 284421184, 291594368, 298842688, 306165440, 313562048, 321031552, - 328573440, 336186944, 343871360, 351625792, 359449600, 367342144, 375302528, 383329984, - 391423744, 399583168, 407807232, 416095424, 424446720, 432860480, 441335680, 449871744, - 458467776, 467122752, 475836160, 484606976, 493434496, 502317568, 511255744, 520247936, - 529293184, 538390784, 547539840, 556739456, 565988800, 575286848, 584632832, 594025792, - 603464960, 612949248, 622477568, 632049536, 641663872, 651319808, 661016192, 670752128, - 680527040, 690339584, 700189056, 710074240, 719994624, 729948800, 739936128, 749955328, - 760005760, 770086400, 780196224, 790334336, 800499328, 810690816, 820907648, 831148608, - 841412992, 851699584, 862007680, 872335936, 882683648, 893049664, 903433024, 913832832, - 924248064, 934677504, 945120256, 955575552, 966042176, 976519040, 987005248, 997499904, - 1008001792, 1018510080, 1029023552, 1039541440, 1050062528, 1060585984, 1071110720, 1081635456, - 1092159616, 1102681984, 1113201664, 1123717504, 1134228480, 1144733696, 1155232256, 1165722752, - 1176204288, 1186676224, 1197137280, 1207586432, 1218022656, 1228445184, 1238852864, 1249244416, - 1259619328, 1269976192, 1280314368, 1290632832, 1300930304, 1311205888, 1321458432, 1331687552, - 1341891840, 1352070400, 1362221952, 1372346112, 1382441472, 1392506880, 1402541952, 1412545280, - 1422516224, 1432453632, 1442356608, 1452224000, 1462054912, 1471848832, 1481604480, 1491320832, - 1500997120, 1510632320, 1520225536, 1529775744, 1539282176, 1548744192, 1558160256, 1567529728, - 1576852096, 1586125824, 1595350272, 1604524800, 1613648128, 1622719872, 1631738624, 1640703744, - 1649614592, 1658469888, 1667269376, 1676011520, 1684695808, 1693321472, 1701887616, 1710393344, - 1718837760, 1727220480, 1735540352, 1743796480, 1751988480, 1760115200, 1768175616, 1776169856, - 1784096256, 1791954688, 1799744000, 1807463424, 1815112576, 1822690048, 1830195968, 1837629184, - 1844988928, 1852274688, 1859485440, 1866620672, 1873679872, 1880662016, 1887566976, 1894393600, - 1901141248, 1907809536, 1914397696, 1920904960, 1927330816, 1933674624, 1939936000, 1946114048, - 1952208256, 1958218240, 1964142848, 1969982336, 1975735552, 1981401984, 1986981376, 1992472832, - 1997876224, 2003190656, 2008415744, 2013551360, 2018596352, 2023550720, 2028413824, 2033185152, - 2037864192, 2042450688, 2046944256, 2051344128, 2055650048, 2059861888, 2063978752, 2068000512, - 2071926784, 2075757056, 2079491072, 2083128576, 2086668928, 2090112128, 2093457408, 2096705024, - 2099854080, 2102904832, 2105856512, 2108709120, 2111462144, 2114115584, 2116668928, 2119122176, - 2121475072, 2123727104, 2125878528, 2127928576, 2129877504, 2131724800, 2133470464, 2135114496, - 2136656384, 2138096128, 2139433728, 2140668928, 2141801472, 2142831616, 2143758848, 2144583424, - 2145304960, 2145923584, 2146439168, 2146851840, 2147161344, 2147367680, 2147470848, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0 -}; - -/* Q Factor is 30 */ -const Word32 ivas_sine_delay_32_fx[32] = { - 52686016, 105245104, 157550640, 209476640, 260898000, 311690784, 361732736, 410903232, 459083776, - 506158400, 552013632, 596539008, 639627264, 681174656, 721080960, 759250112, 795590272, - 830013632, 862437504, 892783744, 920979136, 946955776, 970651136, 992008064, 1010975232, - 1027506880, 1041563136, 1053110208, 1062120192, 1068571456, 1072448448, 1073741824 -}; - -/* Q Factor is 30 */ -const Word32 ivas_sine_frame_len_640_del_32_fx[577] = { - 1073737856, - 1073725888, 1073705984, 1073678144, 1073642368, 1073598592, 1073546880, 1073487168, 1073419584, - 1073343936, 1073260416, 1073168896, 1073069440, 1072962048, 1072846720, 1072723392, 1072592128, - 1072452928, 1072305792, 1072150656, 1071987648, 1071816640, 1071637696, 1071450816, 1071256000, - 1071053248, 1070842560, 1070623936, 1070397312, 1070162880, 1069920448, 1069670080, 1069411776, - 1069145536, 1068871424, 1068589376, 1068299392, 1068001472, 1067695680, 1067381952, 1067060288, - 1066730752, 1066393344, 1066047936, 1065694720, 1065333568, 1064964544, 1064587584, 1064202752, - 1063810048, 1063409472, 1063000960, 1062584576, 1062160384, 1061728256, 1061288320, 1060840448, - 1060384768, 1059921216, 1059449792, 1058970496, 1058483392, 1057988416, 1057485632, 1056974976, - 1056456512, 1055930240, 1055396096, 1054854144, 1054304384, 1053746816, 1053181440, 1052608256, - 1052027200, 1051438400, 1050841856, 1050237504, 1049625280, 1049005376, 1048377664, 1047742144, - 1047098944, 1046447936, 1045789184, 1045122624, 1044448384, 1043766400, 1043076672, 1042379200, - 1041674048, 1040961088, 1040240512, 1039512192, 1038776128, 1038032384, 1037280960, 1036521856, - 1035755008, 1034980544, 1034198464, 1033408640, 1032611200, 1031806016, 1030993280, 1030172864, - 1029344768, 1028509120, 1027665856, 1026814912, 1025956416, 1025090240, 1024216576, 1023335232, - 1022446400, 1021549888, 1020645824, 1019734208, 1018815104, 1017888384, 1016954112, 1016012288, - 1015062912, 1014106112, 1013141760, 1012169856, 1011190464, 1010203584, 1009209280, 1008207424, - 1007198144, 1006181376, 1005157120, 1004125440, 1003086336, 1002039744, 1000985792, 999924352, - 998855552, 997779328, 996695744, 995604736, 994506368, 993400640, 992287552, 991167104, - 990039296, 988904128, 987761664, 986611904, 985454784, 984290304, 983118592, 981939648, - 980753408, 979559872, 978359104, 977151040, 975935744, 974713216, 973483456, 972246528, - 971002304, 969750976, 968492480, 967226688, 965953792, 964673728, 963386496, 962092288, - 960790784, 959482176, 958166464, 956843648, 955513792, 954176832, 952832768, 951481600, - 950123456, 948758272, 947386048, 946006720, 944620480, 943227264, 941826944, 940419776, - 939005568, 937584384, 936156224, 934721152, 933279232, 931830336, 930374528, 928911808, - 927442176, 925965760, 924482432, 922992320, 921495296, 919991424, 918480832, 916963328, - 915439040, 913907968, 912370176, 910825600, 909274240, 907716160, 906151360, 904579840, - 903001664, 901416768, 899825216, 898226944, 896622016, 895010432, 893392256, 891767424, - 890136000, 888497984, 886853376, 885202176, 883544448, 881880128, 880209344, 878532032, - 876848192, 875157824, 873460992, 871757696, 870047872, 868331648, 866608960, 864879872, - 863144384, 861402496, 859654208, 857899584, 856138624, 854371264, 852597632, 850817600, - 849031296, 847238720, 845439808, 843634688, 841823296, 840005632, 838181760, 836351680, - 834515456, 832672960, 830824384, 828969600, 827108672, 825241600, 823368448, 821489152, - 819603840, 817712384, 815814912, 813911360, 812001728, 810086208, 808164608, 806237056, - 804303424, 802363904, 800418496, 798467072, 796509760, 794546560, 792577408, 790602432, - 788621568, 786634880, 784642368, 782644096, 780640000, 778630016, 776614336, 774592896, - 772565696, 770532864, 768494208, 766449856, 764399872, 762344192, 760282944, 758215936, - 756143424, 754065280, 751981504, 749892160, 747797248, 745696832, 743590848, 741479424, - 739362432, 737240000, 735112128, 732978752, 730839936, 728695744, 726546176, 724391168, - 722230784, 720065088, 717894080, 715717696, 713536000, 711349056, 709156864, 706959360, - 704756672, 702548672, 700335488, 698117184, 695893696, 693665024, 691431168, 689192192, - 686948224, 684699008, 682444864, 680185600, 677921280, 675651968, 673377536, 671098176, - 668813888, 666524608, 664230464, 661931328, 659627264, 657318400, 655004544, 652685952, - 650362432, 648034112, 645701056, 643363136, 641020480, 638673088, 636320896, 633964032, - 631602496, 629236224, 626865344, 624489792, 622109632, 619724800, 617335424, 614941504, - 612542976, 610139968, 607732352, 605320256, 602903680, 600482624, 598057152, 595627264, - 593192960, 590754240, 588311104, 585863680, 583411840, 580955712, 578495296, 576030528, - 573561536, 571088320, 568610816, 566129216, 563643264, 561153152, 558659008, 556160576, - 553658112, 551151488, 548640896, 546126144, 543607360, 541084480, 538557696, 536026848, - 533492096, 530953376, 528410656, 525864096, 523313568, 520759232, 518200960, 515638880, - 513073024, 510503328, 507929856, 505352608, 502771616, 500186880, 497598464, 495006400, - 492410624, 489811200, 487208128, 484601440, 481991200, 479377376, 476760000, 474139104, - 471514656, 468886720, 466255328, 463620448, 460982144, 458340480, 455695360, 453046880, - 450395040, 447739872, 445081408, 442419584, 439754496, 437086176, 434414624, 431739840, - 429061792, 426380672, 423696320, 421008864, 418318304, 415624576, 412927808, 410227968, - 407525120, 404819200, 402110304, 399398464, 396683616, 393965856, 391245120, 388521568, - 385795104, 383065760, 380333600, 377598592, 374860800, 372120256, 369376960, 366630848, - 363882080, 361130624, 358376480, 355619648, 352860192, 350098176, 347333536, 344566304, - 341796512, 339024192, 336249376, 333472064, 330692256, 327910016, 325125344, 322338304, - 319548832, 316756960, 313962784, 311166304, 308367488, 305566368, 302763008, 299957376, - 297149568, 294339552, 291527296, 288712928, 285896416, 283077792, 280257024, 277434208, - 274609376, 271782464, 268953568, 266122608, 263289760, 260454928, 257618144, 254779488, - 251938928, 249096480, 246252208, 243406128, 240558224, 237708512, 234857088, 232003888, - 229148976, 226292384, 223434080, 220574160, 217712592, 214849392, 211984608, 209118256, - 206250352, 203380944, 200510000, 197637584, 194763696, 191888352, 189011600, 186133440, - 183253936, 180373024, 177490800, 174607264, 171722416, 168836304, 165948944, 163060368, - 160170544, 157279584, 154387424, 151494128, 148599712, 145704176, 142807600, 139909920, - 137011232, 134111504, 131210816, 128309144, 125406504, 122502952, 119598480, 116693128, - 113786920, 110879856, 107971976, 105063288, 102153832, 99243616, 96332656, 93420992, - 90508624, 87595600, 84681920, 81767616, 78852704, 75937200, 73021144, 70104536, - 67187416, 64269804, 61351708, 58433156, 55514176, 52594776, 49674996, 46754840, - 43834344, 40913520, 37992392, 35070980, 32149316, 29227408, 26305284, 23382966, - 20460476, 17537830, 14615058, 11692176, 8769208, 5846174, 2923098, 0 -}; - - -const Word32 ivas_sine_frame_len_640_del_16_fx[289] = { - 1073725952, - 1073678400, 1073599104, 1073488064, 1073345344, 1073170880, 1072964736, 1072726912, 1072457408, 1072156160, 1071823296, - 1071458752, 1071062528, 1070634688, 1070175232, 1069684096, 1069161472, 1068607168, 1068021312, 1067403904, 1066755008, - 1066074560, 1065362624, 1064619200, 1063844352, 1063038016, 1062200320, 1061331264, 1060430848, 1059499072, 1058536000, - 1057541696, 1056516096, 1055459328, 1054371392, 1053252288, 1052102016, 1050920704, 1049708352, 1048465024, 1047190656, - 1045885376, 1044549184, 1043182208, 1041784320, 1040355712, 1038896320, 1037406272, 1035885568, 1034334272, 1032752448, - 1031140096, 1029497216, 1027824000, 1026120384, 1024386432, 1022622272, 1020827904, 1019003328, 1017148672, 1015264000, - 1013349248, 1011404608, 1009430080, 1007425792, 1005391680, 1003327872, 1001234432, 999111424, 996958848, 994776896, - 992565568, 990324864, 988054912, 985755712, 983427456, 981070144, 978683904, 976268672, 973824576, 971351808, - 968850240, 966320128, 963761408, 961174272, 958558720, 955914816, 953242752, 950542464, 947814144, 945057728, - 942273472, 939461440, 936621504, 933753984, 930858880, 927936192, 924986176, 922008896, 919004288, 915972544, - 912913664, 909827968, 906715264, 903575808, 900409728, 897217024, 893997760, 890752128, 887480128, 884181888, - 880857600, 877507328, 874131072, 870729024, 867301184, 863847744, 860368832, 856864448, 853334848, 849779968, - 846199936, 842594944, 838965120, 835310400, 831631104, 827927168, 824198848, 820446144, 816669184, 812868096, - 809043008, 805194048, 801321216, 797424768, 793504832, 789561344, 785594560, 781604608, 777591488, 773555456, - 769496640, 765414976, 761310656, 757183936, 753034880, 748863552, 744670080, 740454592, 736217216, 731958144, - 727677376, 723375232, 719051648, 714706752, 710340864, 705953920, 701546112, 697117632, 692668544, 688198976, - 683709056, 679198976, 674668864, 670118720, 665548800, 660959296, 656350208, 651721728, 647074048, 642407168, - 637721344, 633016704, 628293376, 623551488, 618791104, 614012480, 609215744, 604400960, 599568384, 594718080, - 589850176, 584964864, 580062272, 575142528, 570205824, 565252224, 560281984, 555295168, 550291904, 545272448, - 540236864, 535185280, 530117952, 525034944, 519936384, 514822496, 509693408, 504549248, 499390144, 494216384, - 489027968, 483825056, 478607904, 473376640, 468131360, 462872224, 457599424, 452313152, 447013472, 441700608, - 436374688, 431035904, 425684352, 420320224, 414943680, 409554848, 404153984, 398741152, 393316512, 387880320, - 382432576, 376973600, 371503488, 366022368, 360530464, 355027904, 349514848, 343991456, 338457920, 332914368, - 327360992, 321797952, 316225376, 310643520, 305052416, 299452352, 293843392, 288225792, 282599680, 276965152, - 271322528, 265671856, 260013344, 254347136, 248673408, 242992352, 237304096, 231608848, 225906752, 220197984, - 214482704, 208761088, 203033328, 197299552, 191559952, 185814672, 180063936, 174307856, 168546624, 162780432, - 157009424, 151233776, 145453648, 139669232, 133880696, 128088216, 122291928, 116492040, 110688704, 104882096, - 99072408, 93259768, 87444384, 81626424, 75806048, 69983424, 64158744, 58332160, 52503856, 46674000, - 40842768, 35010324, 29176854, 23342516, 17507490, 11671948, 5836060, 0 -}; - -/************************ Q30 *******************************/ -const Word32 ivas_fb_fr_12band_1ms_re_fx[IVAS_FB_12_1MS_LEN] = { - 1046768256, 1012312512, 944113536, 843565952, 712700800, 554033920, 370399360, 163534048, -67588040, - -313003296, -547361792, -745791424, -889130944, -964720960, -967822016, -901839040, -777730304, - -612432896, -426573984, -241764928, -77701744, 50405768, 134107528, 173698992, 183571312, - 181978912, 174963648, 163434880, 148881184, 132470640, 115304208, 98219512, 81912736, - 66862960, 53409868, 41724844, 31871182, 23797162, 17385436, 12455156, 8801240, - 6197829, 4427144, 3280128, 2575327, 2155348, 1897329, 1705752, 1516863, - 1289431, 1005694, 661856, 267796, -161263, -604780, -1043282, -1457411, - -1832285, -2155534, -2420027, -2621275, -2759126, -2835035, -2853297, -2818571, - -2737039, -2614376, -2456980, -2270381, -2060530, -1832512, -1591794, -1343094, - -1091494, -841376, -597362, -363290, -143021, 60510, 244561, 407408, - 547618, 664738, 758550, 829643, 878668, 906840, 915250, 905346, - 878343, 835721, 778738, 708948, 627794, 537107, 438729, 334948, - 228103, 120925, 16090, -83524, -175327, -256811, -326026, -381381, - -422046, -447703, -458837, -456405, -442013, -417522, -385138, -347000, - -305255, -261681, -217812, -174648, -132866, -92642, -53935, -16402, - 20279, 56463, 92235, 127494, 161728, 194173, 223691, 249012, - 268700, 281445, 286068, 281804, 268278, 245720, 214858, 177029, - 133974, 87839, 40901, -4492, -46220, -82436, -111817, -133546, - -147456, -153913, -153846, -148528, -139528, -128444, -116827, -105934, - -96699, -89563, -84536, -81138, -78561, -75704, -71400, -64501, - -54108, -39627, -20946, 1593, 27122, 54374, 81719, 107372, - 129497, 146446, 156855, 159848, 155068, 142780, 123803, 99496, - 71589, 42078, 8610925, 16407290, 31915518, 54983844, 85416624, 123087880, - 168063984, 221958576, 289536032, 364878560, 426914240, 455184448, 434995104, 358099712, - 224036640, 40240900, -178615296, -412308800, -637390400, -829991424, -968687232, -1037118016, - -1026013056, -934381184, -769721024, -547208704, -287987072, -16727445, 241188016, 462583776, - 629070144, 729071296, 758930560, 723116864, 633312128, 506752128, 363680000, 224696192, - 107612800, 25033840, -24212064, -54589336, -75035176, -87485160, -93580896, -94591848, - -91737704, -86038536, -78437624, -69711224, -60533488, -51423856, -42794000, -34920752, - -27987240, -22072318, -17188296, -13279352, -10254646, -7989723, -6353249, -5207335, - -4426934, -3897128, -3525509, -3236283, -2977071, -2710878, -2419337, -2094076, - -1738366, -1359253, -969076, -579170, -201992, 153445, 478767, 769398, - 1021418, 1233894, 1405828, 1538184, 1631253, 1686663, 1705249, 1689093, - 1639776, 1560317, 1453594, 1324024, 1175972, 1015086, 846649, 676618, - 509991, 351706, 205173, 73207, -43142, -143513, -229073, -301290, - -362531, -414799, -460247, -500043, -534968, -564551, -587849, -602888, - -607619, -599579, -576918, -538114, -482894, -411845, -327078, -231622, - -129783, -26319, 73437, 164513, 242258, 303205, 344935, 366711, - 369107, 354325, 325569, 287088, 243371, 199057, 158131, 123882, - 98274, 82114, 74715, 74333, 78122, 82791, 84734, 80757, - 68210, 45592, 12513, -29958, -79606, -133015, -186134, -234445, - -273650, -299897, -310406, -303565, -279332, -239075, -185665, -123028, - -55984, 10396, 12276729, 12693837, 13547048, 14871155, 16707203, 19094012, - 22050984, 25567530, 29581572, 33971516, 38534384, 42985632, 46940136, 49924776, - 51363228, 50604824, 46909464, 39493740, 27503144, 10070768, -13759776, -44999620, - -84980336, -136135984, -207135712, -303422240, -412817600, -514972896, -589851392, -619651584, - -591583168, -499579936, -345470464, -138966128, 103208400, 359174656, 604351488, 814326528, - 967700992, 1048627328, 1048680832, 967863296, 814603776, 604752128, 359708672, 103884792, - -138140928, -344495008, -498458752, -590328384, -618282624, -588395136, -513462144, -411289888, - -301917376, -205694144, -134796400, -83778624, -43967052, -12923312, 10688964, 27884292, - 39622020, 46770036, 50183460, 50644772, 48893804, 45580600, 41282912, 36475948, - 31549672, 26793770, 22418028, 18548592, 15250408, 12530037, 10357491, 8671122, - 7396225, 6448686, 5748701, 5221465, 4805724, 4451326, 4123487, 3798131, - 3463431, 3114322, 2752946, 2383612, 2013354, 1648090, 1293873, 954378, - 632818, 330406, 48532, -212349, -450755, -665332, -853410, -1012414, - -1138953, -1230412, -1284349, -1300013, -1277722, -1220043, -1130902, -1016282, - -883017, -739061, -592113, -449695, -317863, -201395, -102837, -23014, - 39453, 87271, 124545, 155673, 185224, 216854, 253275, 295449, - 342868, 393176, 442827, 487113, 521090, 539819, 539332, 516817, - 471355, 403816, 317194, 216106, 106711, -4112, -109126, -201659, - -275976, -328059, -355725, -359045, -340068, -302808, -252589, -195699, - -138533, -87141, -46428, -19866, -8984, -13439, -30918, -57611, - -88487, -118040, -140755, -151891, -147872, -126858, -88834, -35798, - 28549, 99021, 169585, 233841, 285797, 320360, 333987, 324942, - 293611, 242374, 175498, 98630, 18357, -58534, -125609, -177509, - -210361, -222240, -213241, -185532, -143021, -91031, -35654, 16794, - 60506, 90695, 104157, 99518, 77443, 40482, -7123, -59963, - -111945, -157005, -189668, -205697, -202469, -179335, -137639, -80671, - -13290, 58484, 128123, 189173, 235954, 264066, 270883, 255765, - 220174, 2505037, 2442157, 2316154, 2126672, 1874467, 1561489, 1192761, - 775600, 321304, -157412, -645618, -1131069, -1604363, -2065994, -2526609, - -3015154, -3577470, -4283816, -5223516, -6510031, -8269471, -10642073, -13763168, - -17761360, -22731886, -28733746, -35756756, -43722016, -52444716, -61644104, -70903304, - -79696304, -87342288, -93058336, -95895816, -94830640, -88641344, -76058616, -55443336, - -24863958, 24611116, 107440320, 224788944, 364047616, 507399776, 634242176, 724330048, - 760427264, 730852288, 631136576, 464936832, 243827808, -13803173, -284784032, -543737088, - -765995008, -930417472, -1021827456, -1032720576, -964074624, -825139200, -632243584, -406773696, - -172552176, 47020828, 231770176, 367063072, 445488224, 467504928, 441322720, 381553248, - 308519520, 243096544, 190940560, 146958368, 109144704, 76984176, 50110068, 28195132, - 10859917, -2331860, -11867127, -18267046, -22063578, -23780578, -23911906, -22907786, - -21160858, -19000796, -16689673, -14424574, -12340740, -10519832, -8997765, -7775391, - -6827615, -6113435, -5583605, -5187945, -4880011, -4620898, -4380691, -4139162, - -3884798, -3613535, -3326639, -3028821, -2726195, -2424818, -2129499, -1843272, - -1567228, -1300854, -1042591, -790584, -543428, -300799, -63891, 164435, - 379755, 576491, 748467, 889663, 994911, 1060624, 1085268, 1069727, - 1017300, 933554, 825817, 702603, 572797, 444929, 326372, 222801, - 137707, 72284, 25430, -5886, -26190, -40792, -55143, -74076, - -101256, -138661, -186386, -242548, -303550, -364410, -419384, -462555, - -488576, -493231, -474014, -430404, -364059, -278663, -179684, -73826, - 31531, 129079, 212203, 275656, 315980, 331857, 324141, 295780, - 251424, 196978, 138929, 83734, 37113, 3535, -14258, -15450, - -1229, 25423, 60045, 97246, 131265, 156654, 168829, 164631, - 142633, 103366, 49247, -15601, -85794, -155177, -217478, -266899, - -298743, -309847, -298949, -266783, -216054, -151145, -77727, -2174, - 69017, 702811, 654136, 559557, 424419, 255932, 62727, -146313, - -362395, -578054, -786994, -985086, -1169469, -1339221, -1493760, -1633415, - -1757450, -1864970, -1953010, -2018235, -2055396, -2060043, -2027296, -1955369, - -1844129, -1698799, -1527422, -1343910, -1163448, -1004247, -880298, -801810, - -765486, -754582, -727814, -620985, -336399, 251272, 1302991, 3002489, - 5560181, 9191239, 14115464, 20525480, 28584940, 38387408, 49958096, 63204572, - 77930464, 93777392, 110263472, 126708904, 142322784, 156083648, 166946144, 173586320, - 175308576, 166325584, 128680304, 48303544, -74757040, -231715952, -407042976, -580775616, - -731094848, -837272320, -882366976, -855569984, -753729472, -582012992, -353498368, -87845872, - 190881904, 456905760, 685667520, 856595200, 955419584, 975703808, 919454400, 796692096, - 624085824, 422776032, 215700912, 24714716, -132116288, -242736960, -302620672, -315365760, - -293500640, -258619744, -225315280, -194015376, -163910608, -135501680, -109209736, -85466480, - -64529184, -46551644, -31533836, -19377918, -9878438, -2769905, 2268515, 5573895, - 7492172, 8348992, 8445734, 8040905, 7351921, 6546074, 5747758, 5036624, - 4458304, 4026662, 3735443, 3561663, 3475902, 3444629, 3437763, 3428836, - 3399492, 3337488, 3238697, 3103696, 2938339, 2749967, 2547660, 2338971, - 2130630, 1926285, 1727949, 1534741, 1344902, 1155176, 962956, 765794, - 563232, 356016, 147339, -58398, -254956, -435840, -594040, -723684, - -819800, -879714, -902536, -890086, -845966, -775986, -686897, -586473, - -482133, -380953, -288451, -208799, -143979, -94350, -58234, -32830, - -14133, 1978, 19701, 42276, 72069, 109808, 154947, 205272, - 257581, 307614, 350943, 383061, 400284, 399785, 380309, 341971, - 286657, 217523, 139066, 56385, -24953, -99742, -163283, -212106, - -243951, -258230, -255733, -167174, -239722, -322173, -408810, -492821, - -566516, -622391, -653378, -653921, -619965, -549788, -443508, -303565, - -133727, 60691, 274135, 500595, 734943, 972407, 1209697, 1443978, - 1673718, 1897211, 2113333, 2319888, 2514652, 2693915, 2854207, 2991285, - 3102696, 3187122, 3247515, 3290252, 3328147, 3378477, 3464934, 3613501, - 3852565, 4205968, 4691138, 5309438, 6043184, 6844465, 7633047, 8285794, - 8638327, 8477588, 7550391, 5561188, 2190063, -2903797, -10053462, -19577218, - -31739716, -46747292, -64700276, -85602512, -109304912, -135555296, -163926944, -194002976, - -225285872, -258586768, -293477632, -315364832, -302650912, -242803328, -132218944, 24580560, - 215544720, 422611008, 623927680, 796557504, 919359168, 975661312, 955439360, 856681664, - 685819520, 457116384, 191139072, -87558504, -353200000, -581723904, -753469440, -855356160, - -882212736, -837186048, -731079168, -580827520, -407153984, -231873488, -74945544, 48100840, - 128479736, 166141328, 175151264, 173462112, 166856272, 156024384, 142286160, 126683672, - 110236760, 93736176, 77863432, 63103528, 49819328, 38212324, 28380444, 20303444, - 13891988, 8985083, 5391207, 2889572, 1262319, 294475, -203348, -398749, - -423662, -382151, -343523, -352875, -428668, -574135, -776792, -1018896, - -1276918, -1529859, -1757571, -1946540, -2086827, -2175642, -2213314, -2205436, - -2158564, -2081784, -1982822, -1869689, -1747600, -1621008, -1491391, -1359644, - -1224514, -1085096, -939557, -787433, -628324, -463767, -295726, -127991, - 35529, 189782, 330335, 452518, 553054, 629169, 679950, 705285, - 706896, 687113, 649626, 598183, 537192, 470470, 401849, 334088, - 269582, 209498, 154619, 104683, 59308, 17469, -21588, -58843, - -94673, -129406, -162639, -193876, -221997, -245959, -264363, -276167, - -280285, -276237, -263718, -243144, -215155, -181048, -225261, -273555, - -307889, -326103, -327476, -312684, -283609, -243038, -194256, -140631, - -85182, -30244, 22798, 73608, 122885, 172169, 223570, 279366, - 341593, 411622, 489814, 575248, 665622, 757256, 845294, 923987, - 987121, 1028456, 1042203, 1023430, 968397, 874758, 741642, 569587, - 360379, 116796, -157659, -459031, -783110, -1125546, -1481872, -1847416, - -2217186, -2585716, -2947037, -3294742, -3622346, -3923849, -4194709, -4432970, - -4640760, -4825675, -5002266, -5192922, -5428408, -5747161, -6193793, -6815752, - -7658969, -8761350, -10145511, -11809549, -13717971, -15791409, -17898084, -19845242, - -21374384, -22157722, -21800466, -19845174, -15783279, -9068449, 863064, 14571969, - 32592328, 55410852, 83458416, 117107272, 156758688, 202942128, 257651808, 325933440, - 402044000, 464971200, 494205696, 474891008, 398522784, 264288720, 79206760, -142533824, - -381224512, -613975168, -817483264, -970950784, -1058690624, -1072345920, -1012679872, -893613760, - -734287744, -546547584, -339769856, -124623176, 88170360, 288225568, 466194112, 614172160, - 726163904, 798321728, 829131584, 819397568, 772133120, 692285376, 586377152, 462039040, - 327503712, 191064064, 60554008, -57130884, -156432848, -233429280, -286014272, -313941504, - -318749984, -303544416, -272698496, -231426688, -185371904, -140057616, -100631488, -69996648, - -46622364, -28166424, -13810469, -2980571, 4834391, 10133794, 13384151, 15027667, - 15460742, 15036408, 14051635, 12751812, 11326396, 9916592, 8616869, 7484565, - 6544389, 5798046, 5229236, 4811721, 4513168, 4300801, 4143382, 4014381, - 3892172, 3761242, 3611156, 3436579, 3235728, 3009947, 2762235, 2496885, - 2218419, 1931526, 1640448, 1349202, 1061301, 780105, 508675, 250099, - 7326, -216639, -418984, -597023, -748502, -871609, -965247, -1029025, - -1063439, -1069768, -1050128, -1007269, -944511, -865478, -773983, -673761, - -568371, -460991, -354385, -250799, -152007, -59299, 26411, 104546, - 174730, 236744, 290418, 335608, 372145, 399853, 418548, 428095, - 428430, 419636, 401963, 375881, 342083, 301499, 255265, 204699, - 151239, 96397, 41685, -11436, -61625, -107696, -148661, -183744, - -212399, -234301, -249338, -257586, -259295, -171383, -167771, -160946, - -151648, -140875, -129741, -119346, -110602, -104127, -100108, -98276, - -97857, -97667, -96155, -91604, -82246, -66504, -43110, -11334, - 28976, 77253, 132282, 192171, 254555, 316653, 375561, 428343, - 472340, 505222, 525246, 531204, 522588, 499415, 462302, 412189, - 350367, 278167, 197008, 108113, 12645, -88501, -194453, -304491, - -417705, -533098, -649202, -764225, -875703, -980757, -1075829, -1157086, - -1220253, -1261142, -1275529, -1259757, -1210576, -1125738, -1003720, -844248, - -647867, -416383, -152288, 140834, 458975, 797247, 1150575, 1513140, - 1879071, 2241774, 2594688, 2930577, 3242477, 3523085, 3766061, 3965621, - 4118279, 4222622, 4281408, 4301274, 4294860, 4279931, 4280984, 4327080, - 4452293, 4691546, 5079427, 5643594, 6401946, 7353690, 8475606, 9711576, - 10969534, 12110916, 12950640, 13248182, 12713298, 10999818, 7719470, 2437137, - -5306709, -16007364, -30173754, -48382488, -71457888, -101754088, -140816912, -185763344, - -231466336, -272424224, -303010560, -318021792, -313081312, -285067456, -232401024, -155266144, - -55676148, 62564504, 194048000, 332049728, 468930560, 596597632, 707022848, 792757376, - 847434880, 866203136, 846081856, 786193920, 687883392, 554677120, 392130080, 207514704, - 9432382, -192707744, -389200480, -570675136, -728479808, -856350656, -952308800, -1015864832, - -1046220032, -1043342848, -1008126784, -942413952, -848923648, -731177152, -593366784, -440223744, - -276851936, -108565096, 59292484, 221513920, 373199296, 509904800, 627780928, 723682304, - 795257728, 841006144, 860308096, 853421632, 821452480, 766292160, 690533568, 597361024, - 490425248, 373702496, 251347920, 127544600, 6357648, -108405296, -213318272, -305445280, - -382425728, -442537280, -484731648, -508645408, -514583008, -503476768, -476822816, -436599136, - -385166592, -325160416, -259373680, -190640560, -121721768, -55198692, 6621388, 61783672, - 108746912, 146423216, 174197536, 191924704, 199906864, 198850976, 189810704, 174114128, - 153282784, 128943984, 102742896, 76256368, 50914548, 27932052, 8253544, -7485707, - -18981258, -26263536, -29686804, -29902128, -27874808, -24904632, -21873452, -18924710, - -16109369, -13513449, -11193274, -9184409, -7497119, -6124396, -5043505, -4222392, - -3622104, -3201531, -2919256, -2736657, -2618792, -2536063, -2464195, -2384826, - -2284834, -2156265, -1995319, -1801974, -1578908, -1331064, -1064692, -787000, - -505396, -227288, 40476, 291657, 521006, 724191, 898044, 1040397, - 1150221, 1227397, 1272778, 1287922, 1275099, 1237007, 1176756, 1097593, - 1002895, 895923, 779853, 657586, 531818, 404912, 279016, 155978, - 37491, -74965, -179989, -276315, -362698, -438012, -501167, -551237, - -587418, -609171, -616196, -608571, -586708, -551466, -504065, -446144, - -379632, -306754, -229859, -151391, -73706, 962, 70672, 133776, - 189046, 235630, 273114, 301432, 320873, 331952, 335393, 331988, - 322579, 307941, 288792, 265710, 239189, 209598, 177267, 142480, - 105576, 66945, 27114, -13271, -53400, -92348, -129065, -162474, - -191486, -215114, -232503, -243037, -246348, -242394, -231432, -214048, - -191082, -163619, -132881, -100182, -66814, -34004, -2809, 25897, - 51498, 73603, 92073, 106961, 118497, 127000, 132851, 136409, - 137987, 137791, 135930, 132384, 127051, 119749, 110286, 98485, - 84255, 67615, 48748, 27996, 5888, -16902, -39568, -61243, - -81031, -98099, -111715, -121326, -162998, -160088, -154357, -145969, - -135159, -122211, -107436, -91156, -73678, -55283, -36214, -16667, - 3198, 23260, 43411, 63547, 83543, 103238, 122414, 140790, - 158012, 173664, 187268, 198317, 206286, 210673, 211020, 206956, - 198214, 184663, 166317, 143347, 116078, 84982, 50655, 13802, - -24798, -64311, -103888, -142674, -179845, -214613, -246243, -274051, - -297418, -315773, -328608, -335464, -335942, -329700, -316476, -296086, - -268464, -233660, -191884, -143511, -89112, -29451, 34490, 101547, - 170354, 239401, 307043, 371566, 431212, 484258, 529040, 564034, - 587875, 599425, 597777, 582315, 552693, 508884, 451144, 380049, - 296447, 201490, 96577, -16612, -136189, -260017, -385787, -510997, - -633031, -749140, -856549, -952436, -1034059, -1098739, -1143998, -1167540, - -1167397, -1141901, -1089827, -1010351, -903194, -768558, -607272, -420711, - -210944, 19368, 266825, 527423, 796421, 1068545, 1337896, 1598264, - 1843121, 2066095, 2261075, 2422874, 2547443, 2632705, 2678810, 2689041, - 2669949, 2632165, 2590157, 2562709, 2571986, 2643435, 2803848, 3080521, - 3498078, 4076931, 4828788, 5754789, 6839761, 8050914, 9330877, 10598671, - 11740823, 12618964, 13055458, 12877144, 11632705, 8232321, 1712792, -8269488, - -21676128, -38124492, -56918448, -77081536, -97412152, -116545320, -133029752, -145407808, - -152301808, -152496656, -145019616, -129208872, -104771344, -71822984, -30912372, 16976826, - 70442824, 127704136, 186656480, 244947920, 300068000, 349448640, 390571840, 421080480, - 438886880, 442275104, 429992032, 401322976, 356148672, 294980192, 218969888, 129897104, - 30128484, -77446248, -189501472, -302382688, -412230048, -515113984, -607177664, -684781632, - -744644480, -783974400, -800586304, -792999936, -760514496, -703256576, -622199232, -519150624, - -396712160, -258207056, -107581408, 50718884, 211891600, 370936768, 522825024, 662669440, - 785895232, 888400000, 966700096, 1018056320, 1040574720, 1033278976, 996150976, 930138240, - 837128128, 719891072, 581993344, 427717504, 261968336, 89712808, -84335696, -255470448, - -419050304, -570668224, -706270592, -822273344, -915657792, -984053440, -1025798848, -1039984064, - -1026470080, -985886720, -919608064, -829707328, -718891392, -590417984, -447997504, -295682944, - -137750720, 21423548, 177490944, 326252736, 463778272, 586513216, 691375872, 775837824, - 837987456, 876574784, 891035520, 881494912, 848751424, 794240448, 719980032, 628500544, - 522760032, 406049152, 281887712, 153916800, 25789502, -98936256, -216899504, -325029824, - -420629824, -501444512, -565715328, -612217792, -640282304, -649796800, -641192896, -615415808, - -573878848, -518405728, -451161088, -374573216, -291251040, -203897664, -115224504, -27867474, - 55691216, 133193880, 202668432, 262478208, 311359200, 348444032, 373271968, 385785760, - 386315040, 375548096, 354492672, 324428128, 286850336, 243411744, 195858832, 145969024, - 95489384, 46079124, -742270, -43639588, -81497992, -113449472, -138889424, -157482720, - -169159888, -174103616, -172726688, -165642240, -153628176, -137586864, -118502264, -97395800, - -75283368, -53134364, -31835154, -12157406, 5266631, 19962188, 31621642, 40107016, - 45443876, 47808948, 47510056, 44961972, 40656428, 35131248, 28935710, 22599292, - 16597725, 11327856, 7077267, 4007588, 2004813, 698472, -159366, -668117, - -915026, -972592, -904574, -762742, -589613, -417127, -268777, -159451, - -97435, -84877, -119630, -195920, -305911, -440293, -589480, -743976, - -895177, -1035483, -1158746, -1260167, -1336478, -1385695, -1407139, -1401122, - -1368900, -1312362, -1233971, -1136502, -1023004, -896600, -760484, -617774, - -471538, -324684, -179997, -40056, 92731, 216208, 328430, 427747, - 512770, 582446, 636028, 673130, 693701, 698053, 686825, 660989, - 621793, 570758, 509593, 440184, 364504, 284586, 202444, 120043, - 39232, -38277, -110964, -177497, -236776, -287918, -330276, -363413, - -387116, -401358, -406302, -402269, -389735, -369301, -341693, -307732, - -268335, -224488, -177248, -127707, -76997, -26251, 23403, 70879, - 115146, 155262, 190393, 219846, 243073, 259708, 269557, 272617, - 269062, 259245, 243667, 222969, 197896, 169274, 137970, 104873, - 70854, 36751, 3337, -28682, -58696, -86176, -110690, -131889, - -149514, -163373, -173350, -179385, -181478, -179682, -174108, -164916, - -152331, -136632, -118169, -97351, -74653, -50603, -25781, -795, - 23721, 47148, 68883, 88374, 105138, 118782, 129014, 135661, - 138666, 138092, 134111, 126995, -72761, -56245, -38209, -19019, - 926, 21206, 41377, 60995, 79616, 96811, 112175, 125335, - 135964, 143783, 148571, 150171, 148491, 143510, 135276, 123908, - 109592, 92580, 73182, 51764, 28741, 4570, -20258, -45231, - -69817, -93477, -115679, -135902, -153653, -168473, -179953, -187739, - -191549, -191176, -186499, -177490, -164220, -146855, -125663, -101009, - -73349, -43220, -11236, 21933, 55569, 88924, 121238, 151753, - 179734, 204484, 225359, 241786, 253272, 259417, 259926, 254614, - 243416, 226386, 203704, 175675, 142727, 105408, 64381, 20414, - -25629, -72803, -120096, -166448, -210776, -251991, -289028, -320870, - -346577, -365309, -376354, -379149, -373302, -358603, -335043, -302817, - -262324, -214167, -159142, -98227, -32564, 36563, 107751, 179503, - 250256, 318414, 382371, 440551, 491426, 533563, 565640, 586488, - 595111, 590727, 572783, 540991, 495337, 436112, 363911, 279647, - 184541, 80117, -31824, -149225, -269813, -391137, -510624, -625621, - -733459, -831498, -917191, -988123, -1042078, -1077064, -1091376, -1083624, - -1052786, -998241, -919828, -817879, -693286, -547530, -382754, -201766, - -8088, 194084, 399903, 603998, 800600, 983813, 1147877, 1287596, - 1398749, 1478666, 1526731, 1545029, 1538843, 1517225, 1493308, 1484620, - 1512997, 1604428, 1788384, 2097022, 2563860, 3222329, 4104042, 5237042, - 6645377, 8348986, 10388584, 12857124, 15616492, 18195220, 20086854, 20833852, - 20030730, 17354698, 12586763, 5632648, -3464912, -14518786, -27198686, -41038776, - -55453300, -69758216, -83199240, -94984200, -104319184, -110446312, -112682200, -110454752, - -103337336, -91078120, -73623784, -51135812, -23998892, 7179643, 41579336, 78185368, - 115815920, 153157712, 188808416, 221324672, 249274288, 271290496, 286126560, 292708608, - 290184736, 277968256, 255773584, 223642784, 181961872, 131465504, 73229656, 8652162, - -60578956, -132528392, -205066832, -275933056, -342803008, -403363968, -455390976, -496823520, - -525839776, -540925440, -540935296, -525144960, -493290304, -445593920, -382776288, -306051584, - -217107424, -118068792, -11447024, 99925072, 212970192, 324453472, 431076864, 529578144, - 616831424, 689946368, 746362368, 783935232, 801012800, 796497984, 769895232, 721340928, - 651613760, 562127360, 454901984, 332518336, 198053008, 54997860, -92834592, -241417152, - -386622272, -524341152, -650604416, -761700160, -854286656, -925495040, -973019712, -995193152, - -991042688, -960327360, -903553472, -821968256, -717531648, -592866496, -451188992, -296220608, - -132085040, 36808156, 205888512, 370555840, 526312064, 668891968, 794386240, 899356480, - 980934400, 1036909248, 1065792000, 1066936320, 1040546496, 987467136, 909149824, 807691200, - 685777408, 546616256, 393851264, 231466848, 63682176, -105158952, -270702912, -428699744, - -575114688, -706232704, -818754752, -909882496, -977389312, -1019675904, -1035808896, -1025541568, - -989316224, -928248256, -844092096, -739190912, -616410240, -479058656, -330797152, -175539264, - -17346022, 139682832, 291517408, 434303488, 564462720, 678784448, 774506688, 849384640, - 901743936, 930519040, 935273728, 916205312, 874131520, 810461056, 727147968, 626633152, - 511772224, 385754272, 252012128, 114127448, -24266644, -159583088, -288375648, -407428352, - -513837376, -605083264, -679091392, -734279488, -769591104, -784513984, -779083840, -753872640, - -709962816, -648908288, -572682880, -483618976, -384336832, -277668320, -166575776, -54069264, - 56875640, 163397472, 262823600, 352738016, 431040544, 495996064, 546272512, 580966656, - 599617664, 602207872, 589151552, 561271552, 519765696, 466163232, 402273376, 330127520, - 251916672, 169926224, 86470040, 3825426, -75828792, -150469632, -218281248, -277698720, - -327443424, -366549120, -394378400, -410629056, -415330784, -408832544, -391780864, -365090688, - -329909184, -287574176, -239568528, -187472016, -132911848, -77513936, -22855780, 29577298, - 78431608, 122519032, 160844800, 192628240, 217316432, 234590304, 244363440, 246773968, - 242169824, 231088240, 214230352, 192431808, 166630544, 137832768, 107078304, 75406624, - 43824304, 13275079, -15386599, -41417940, -64205456, -83277544, -98311776, -109136888, - -115729656, -118206952, -116813448, -111905648, -103932808, -93415768, -80924248, -67053716, - -52402552, -37550280, -23037704, -9349536, 3099972, 13977919, 23039974, 30133750, - 35198404, 38260568, 39427008, 38874332, 36836352, 33589632, 29437968, 24696382, - 19675442, 14666438, 9928193, 5675861, 2072344, -777524, -2829749, -4100893, - -4665396, -4650187, -4237832, -3670417, -3111787, -2588999, -2111154, -1692910, - -1342761, -1064792, -858034, -718046, -637371, -606817, -616039, -654489, - -711863, -778707, -846654, -908726, -959364, -994500, -1011439, -1008780, - -986218, -944402, -884714, -809115, -719958, -619860, -511553, -397807, - -281326, -164706, -50372, 59439, 162717, 257679, 342798, 416803, - 478690, 527728, 563468, 585733, 594629, 590529, 574063, 546100, - 507723, 460200, 404950, 343501, 277458, 208453, 138112, 68013, - -346, -65582, -126442, -181831, -230824, -272671, -306807, -332846, - -350584, -359987, -361185, -354465, -340256, -319119, -291736, -258891, - -221458, -180384, -136669, -91350, -45474, -81, 43821, 85280, - 123419, 157461, 186741, 210730, 229036, 241421, 247797, 248224, - 242908, 232183, 216503, 196419, 172565, 145631, 116349, 85467, - 53736, 21886, -9380, -39409, -67596, -93402, -116356, -136059, - -152188, -164499, -172828, -177091, -177288, -173497, -165880, -154675, - -140195, -122823, -103005, -81242, -58073, -34073, -9827, 14076, - 37067, 58607, 78202, 95423, 109908, 121382, 129651, 134613, - 136254, 134645, 129937, 122348, -44011, -24892, -4829, 15720, - 36281, 56369, 75506, 93227, 109092, 122701, 133696, 141775, - 146697, 148290, 146451, 141157, 132459, 120486, 105445, 87616, - 67345, 45046, 21187, -3718, -29118, -54435, -79078, -102456, - -123992, -143137, -159380, -172271, -181421, -186524, -187359, -183802, - -175830, -163523, -147066, -126746, -102945, -76138, -46876, -15782, - 16466, 49153, 81535, 112860, 142385, 169387, 193186, 213156, - 228742, 239468, 244958, 244937, 239247, 227851, 210839, 188425, - 160956, 128901, 92851, 53506, 11664, -31790, -75908, -119691, - -162116, -202159, -238815, -271127, -298207, -319262, -333613, -340713, - -340163, -331730, -315348, -291129, -259362, -220512, -175214, -124263, - -68599, -9299, 52451, 115372, 178114, 239282, 297468, 351266, - 399319, 440334, 473120, 496614, 509913, 512295, 503248, 482484, - 449964, 405893, 350744, 285237, 210350, 127286, 37477, -57465, - -155750, -255468, -354592, -451046, -542708, -627478, -703289, -768173, - -820272, -857921, -879657, -884318, -871054, -839446, -789522, -721878, - -637689, -538829, -427837, -308012, -183306, -58351, 61766, 171575, - 265595, 338530, 385818, 403920, 391045, 347469, 276387, 184146, - 81162, -18121, -94264, -123407, -76036, 81568, 389991, 895519, - 1710701, 3002792, 4825273, 7109226, 9729646, 12512602, 15248433, 17702624, - 19630608, 20791430, 20963006, 19955790, 17626208, 13887624, 8719623, 2174045, - -5621665, -14464834, -24081046, -34131360, -44222504, -53920252, -62765096, -70290080, - -76039792, -79590136, -80567832, -78669104, -73676656, -65474260, -54058260, -39545472, - -22176940, -2317326, 19550376, 42834668, 66849928, 90834856, 113974736, 135426640, - 154347008, 169920736, 181390720, 188086896, 189453888, 185076096, 174699280, 158247904, - 135837376, 107780464, 74587640, 36960972, -4218522, -47909872, -92937136, -138019856, - -181808096, -222921312, -259989808, -291697568, -316825344, -334292320, -343195264, -342844000, - -332791264, -312856704, -283143456, -244046832, -196254272, -140736784, -78731208, -11714102, - 58632672, 130463552, 201817312, 270670080, 334992000, 392806176, 442247552, 481620896, - 509455360, 524554208, 526038368, 513381696, 486437344, 445453888, 391080448, 324360480, - 246714016, 159908576, 66019492, -32619810, -133476120, -233882016, -331106848, -422431424, - -505224224, -577016896, -635577152, -678976448, -705651136, -714454400, -704697856, -676181184, - -629208640, -564592384, -483640672, -388133216, -280282016, -162679760, -38236756, 89892360, - 218389968, 343862752, 462932736, 572329472, 668980864, 750100160, 813266368, 856496128, - 878304640, 877753856, 854486592, 808744960, 741372928, 653802560, 548023872, 426538944, - 292301664, 148644560, -806035, -152223392, -301680672, -445254848, -579131904, -699710144, - -803698816, -888209216, -950836352, -989727616, -1003637824, -991967616, -954785856, -892832832, - -807506624, -700830848, -575405568, -434342368, -281185056, -119818392, 45633172, 210913568, - 371747552, 523954144, 663558144, 786896576, 890717440, 972267648, 1029367616, 1060471360, - 1064709056, 1041912064, 992618752, 918061696, 820136128, 701350912, 564763136, 413905312, - 252702016, 85283768, -84153016, -251373152, -412193952, -562598208, -698834304, -817510976, - -915681728, -990918592, -1041372160, -1065817344, -1063683392, -1035067008, -980729024, -902074176, - -801114432, -680417408, -543040576, -392453440, -232449024, -67047936, 99603672, 263338768, - 420074528, 565914944, 697248640, 810838912, 903904448, 974187712, 1020010432, 1040314112, - 1034684224, 1003358720, 947219392, 867767552, 767083328, 647771264, 512892224, 365884480, - 210475200, 50585176, -109770824, -266585856, -415961728, -554206912, -677928256, -784115520, - -870214784, -934190464, -974573952, -990497408, -981711808, -948590080, -892113472, -813843264, - -715877760, -600795712, -471588352, -331581056, -184347104, -33615956, 116822016, 263211632, - 401927360, 529563904, 643020416, 739576448, 816957632, 873389632, 907638720, 919038784, - 907503104, 873521728, 818144448, 742948992, 649996672, 541776128, 421136352, 291211584, - 155339280, 16974000, -120401088, -253362480, -378632256, -493159552, -594195200, -679358336, - -746692608, -794711040, -822428992, -829383232, -815638016, -781777600, -728885632, -658512064, - -572628224, -473572352, -363985824, -246742688, -124873992, -1489180, 120303760, 237476976, - 347158464, 446702912, 533755744, 606308928, 662747520, 701884928, 722987456, 725786624, - 710479424, 677716736, 628580224, 564548800, 487455296, 399434400, 302864160, 200301680, - 94415504, -12084029, -116514408, -216288720, -308979968, -392380352, -464553824, -523880992, - -569095168, -599308544, -614028672, -613164032, -597019520, -566281600, -521994336, -465525920, - -398528192, -322889120, -240680240, -154100192, -65416176, 23095468, 109207648, 190798608, - 265904304, 332765472, 389868896, 435980928, 470173824, 491842976, 500715808, 496851904, - 480634304, 452752704, 414179264, 366137088, 310063456, 247567808, 180386464, 110334864, - 39258892, -31013516, -98719224, -162203968, -219962560, -270674336, -313232768, -346769088, - -370668672, -384580928, -388421408, -382367424, -366846528, -342518912, -310254080, -271102432, - -226263200, -177048848, -124847760, -71085712, -17187518, 35460372, 85545152, 131860032, - 173332944, 209050736, 238278608, 260474080, 275295552, 282605088, 282465888, 275134240, - 261046656, 240802480, 215142736, 184925744, 151100368, 114677616, 76701576, 38220244, - 257309, -36214540, -70298016, -101192744, -128213464, -150804368, -168549456, -181178720, - -188570000, -190746832, -187872144, -180238592, -168255376, -152432528, -133362752, -111701864, - -88148040, -63420712, -38239704, -13305140, 10721270, 33233146, 53694084, 71649704, - 86736888, 98689968, 107343928, 112634456, 114595192, 113352176, 109115832, 102170872, - 92864472, 81593048, 68788288, 54902676, 40395092, 25716910, 11298924, -2460449, - -15205434, -26631372, -36491212, -44599896, -50836640, -55145052, -57531268, -58060172, - -56849976, -54065368, -49909488, -44615140, -38435440, -31634326, -24477204, -17222048, - -10111227, -3364318, 2827930, 8308287, 12956318, 16690166, 19466890, 21281350, - 22163806, 22176328, 21408246, 19970784, 17991204, 15606606, 12957738, 10182934, - 7412561, 4764010, 2337587, 213264, -1551419, -2922471, -3889289, -4463602, - -4677182, -4578945, -4230953, -3704343, -3074240, -2415525, -1797252, -1280920, - -898770, -627791, -434755, -305164, -227603, -191690, -187557, -206218, - -239500, -280340, -322733, -361874, -394053, -416670, -428076, -427515, - -414945, -390943, -356535, -313106, -262250, -205705, -145243, -82626, - -19530, 42469, 101945, 157622, 208399, 253344, 291709, 322917, - 346571, 362440, 370466, 370745, 363530, 349215, 328325, 301500, - 269486, 233106, 193250, 150849, 106856, 62226, 17894, -25242, - -66343, -104637, -139433, -170137, -196253, -217395, -233281, -243746, - -248732, -248291, -242579, -231853, -216463, -196846, -173514, -147048, - -118082, -87293, -55383, -23069, 8934, 39937, 69279, 96351, - 120609, 141582, 158888, 172233, 181426, 186370, 187072, 183631, - 176235, 165155, 150734, 133374, 113527, 91685, 68363, 44092, - 19408, -5162, -29106, -51936, -73196, -92471, -109389, -123633, - -134942, -143118, -148026, -149603, -147856, -142863, -134772, -123799, - -110225, -94386, -76670, -57503, -37343, -16663, 4054, 24338, - 43732, 61811, 78191, 92535, 62535, 80267, 96515, 110869, - 122950, 132423, 139005, 142473, 142671, 139519, 133011, 123223, - 110309, 94503, 76111, 55508, 33131, 9465, -14962, -39597, - -63868, -87203, -109039, -128839, -146103, -160377, -171269, -178455, - -181688, -180805, -175730, -166482, -153172, -136001, -115264, -91340, - -64689, -35842, -5393, 26011, 57690, 88934, 119026, 147254, - 172929, 195397, 214061, 228390, 237937, 242348, 241373, 234879, - 222848, 205389, 182733, 155232, 123355, 87684, 48894, 7752, - -34905, -78188, -121168, -162899, -202440, -238873, -271320, -298971, - -321092, -337048, -346317, -348499, -343329, -330684, -310588, -283215, - -248890, -208087, -161430, -109684, -53754, 5325, 66401, 128208, - 189391, 248521, 304122, 354711, 398828, 435097, 462282, 479357, - 485586, 480607, 464520, 437982, 402277, 359398, 312090, 263877, - 219044, 182590, 160108, 157649, 181489, 237891, 332809, 471594, - 658900, 898625, 1197641, 1570523, 1996663, 2404745, 2717774, 2865679, - 2785718, 2427096, 1754169, 749686, -583221, -2219740, -4113328, -6196593, - -8383364, -10571665, -12647668, -14490343, -15976733, -16987568, -17413068, -17158614, - -16150145, -14338955, -11705745, -8263683, -4060347, 821616, 6265157, 12120884, - 18210488, 24331478, 30263100, 35773284, 40626432, 44591748, 47451940, 49011856, - 49106908, 47610828, 44442580, 39572032, 33024242, 24882062, 15286939, 4437778, - -7412170, -19960400, -32862134, -45739056, -58189596, -69800496, -80159352, -88867704, - -95554448, -99888904, -101593376, -100454560, -96333512, -89173816, -79007528, -65958664, - -50244076, -32171454, -12134525, 9394608, 31875820, 54713840, 77273336, 98895824, - 118918056, 136691248, 151600704, 163085296, 170656112, 173913744, 172563664, 166429120, - 155461200, 139745456, 119505000, 95099632, 67021116, 35884416, 2415097, -32566908, - -68166792, -103437232, -137402992, -169087216, -197538720, -221859376, -241231120, -254941424, - -262406848, -263193680, -257034992, -243843760, -223721280, -196960640, -164045024, -125640616, - -82584344, -35866404, 13391901, 63964612, 114551216, 163809728, 210391808, 252979168, - 290320064, 321265088, 344801344, 360083392, 366461088, 363502304, 351010944, 329038400, - 297889248, 258119712, 210529696, 156147840, 96210000, 32131786, -34524592, -102088152, - -168820816, -232961936, -292774464, -346591552, -392862560, -430196672, -457403712, -473530208, - -477890048, -470088800, -450040832, -417978368, -374452640, -320326336, -256757808, -185176992, - -107253736, -24859086, 59979564, 145128320, 228400464, 307612608, 380641824, 445482432, - 500300512, 543485312, 573695616, 589899584, 591407872, 577897856, 549428800, 506447456, - 449783328, 380634208, 300541536, 211356352, 115196864, 14397969, -88545520, -191040832, - -290462720, -384220896, -469827680, -544963968, -607541824, -655762304, -688166080, -703676928, - -701634816, -681819648, -644463424, -590250752, -520308160, -436181376, -339801440, -233440544, - -119658328, -1240033, 118872048, 237652048, 352067200, 459155616, 556103232, 640318080, - 709499520, 761700928, 795384128, 809463808, 803340864, 776923520, 730635776, 665412608, - 582681792, 484333184, 372675584, 250382144, 120426184, -13991622, -149522608, -282754144, - -410296096, -528867712, -635382464, -727028736, -801344512, -856283200, -890270272, -902247552, - -891705280, -858699904, -803857856, -728364736, -633940096, -522797984, -397595008, -261366368, - -117451720, 30587386, 179056320, 324220320, 462399104, 590061056, 703913984, 800990592, - 878726208, 935027008, 968326336, 977628096, 962536000, 923267520, 860652416, 776115520, - 671644160, 549741504, 413365632, 265857680, 110858864, -47779968, -206094880, -360108800, - -505932192, -639862208, -758477376, -858725824, -938004160, -994225728, -1025875712, -1032052032, - -1012490816, -967575808, -898331200, -806398464, -693996736, -563869056, -419215008, -263610912, - -100920864, 64800176, 229408368, 388775616, 538893952, 675977408, 796558208, 897575488, - 976453568, 1031168128, 1060298880, 1063066560, 1039353856, 989709440, 915335680, 818058560, - 700282816, 564931648, 415373344, 255336384, 88815592, -80029120, -246977680, -407857120, - -558646720, -695580608, -815240832, -914661376, -991426624, -1043686208, -1070172608, -1070248192, - -1043923520, -991857408, -915341120, -816266432, -697079168, -560719104, -410547744, -250265472, - -83820864, 84686600, 251107216, 411343136, 561449088, 697729408, 816829056, 915815936, - 992253184, 1044259072, 1070553344, 1070488704, 1044066752, 991938048, 915385920, 816295104, - 697105216, 560750656, 410588608, 250316144, 83879304, -84624008, -251044992, -411286048, - -561401792, -697695936, -816812672, -915819008, -992277056, -1044304128, -1070619200, -1070574144, - -1044169920, -992056576, -915517184, -816436096, -697252864, -560901952, -410740480, -250465744, - -84023984, 84486696, 250917232, 411169760, 561298496, 697607040, 816739008, 915761280, - 992235520, 1044278912, 1070609856, 1070580032, 1044190208, 992090048, 915562432, 816491584, - 697316864, 560972608, 410815936, 250544048, 84103240, -84408312, -250841440, -411098144, - -561232512, -697547840, -816687680, -915718464, -992201920, -1044254720, -1070595200, -1070574848, - -1044194112, -992102592, -915582912, -816519232, -697350784, -561011712, -410859200, -250590352, - -84151408, 84359424, 250792960, 411051168, 561188032, 697506752, 816650880, 915686656, - 992175616, 1044234432, 1070581248, 1070567360, 1044193024, 992107776, 915594112, 816535872, - 697372352, 561037568, 410888512, 250622304, 84185136, -84324824, -250758368, -411017408, - -561155904, -697477056, -816624192, -915663552, -992156544, -1044219712, -1070571008, -1070561728, - -1044192000, -992111168, -915601728, -816547392, -697387392, -561055616, -410909120, -250644896, - -84209144, 84299992, 250733312, 410992736, 561132224, 697454848, 816603968, 915645824, - 992141696, 1044208000, 1070562816, 1070557056, 1044191040, 992113920, 915607936, 816556928, - 697399936, 561070784, 410926464, 250663904, 84229272, -84279312, -250712656, -410972640, - -561113216, -697437440, -816588608, -915632832, -992131328, -1044200448, -1070558208, -1070555520, - -1044192384, -992118080, -915614784, -816566208, -697411328, -561084032, -410941184, -250679696, - -84245752, 84262552, 250696016, 410956544, 561098048, 697423552, 816576320, 915622464, - 992123200, 1044194816, 1070555200 -}; - -/************************ Q30 *******************************/ -const Word32 ivas_fb_fr_12band_1ms_im_fx[IVAS_FB_12_1MS_LEN] = { - -96495528, -286734272, -468692800, -637041216, -786562176, -912433280, -1009964416, -1075182976, -1098333440, - -1060972224, -954328512, -784950848, -567387776, -321857280, -71378072, 161019520, 355191072, - 496249664, 576290688, 595228096, 560553408, 486341472, 391112608, 296445024, 219833024, - 161425424, 113971872, 75074912, 43676944, 18947558, 106207, -13606639, -22959300, - -28697174, -31541624, -32158708, -31154358, -29054292, -26304144, -23261552, -20202826, - -17324756, -14756116, -12565362, -10774012, -9366401, -8302065, -7524551, -6970827, - -6577419, -6286071, -6046737, -5819771, -5576294, -5297871, -4975268, -4606808, - -4196583, -3752523, -3284873, -2804624, -2322651, -1848752, -1391471, -957667, - -552820, -180887, 155183, 453533, 712892, 932744, 1112922, 1253892, - 1356428, 1421957, 1452251, 1449752, 1417222, 1357998, 1275581, 1173833, - 1056523, 927513, 790325, 648358, 504521, 361522, 221574, 86743, - -41290, -160871, -270597, -368994, -454781, -526614, -583403, -624117, - -648145, -655120, -645267, -619210, -578251, -524110, -459110, -385841, - -307254, -226274, -145851, -68575, 3253, 67950, 124299, 171779, - 210318, 240423, 262847, 278659, 288884, 294565, 296445, 295082, - 290614, 282963, 271701, 256332, 236226, 210937, 180155, 143993, - 102888, 57812, 10083, -38529, -86081, -130429, -169562, -201608, - -225146, -239179, -243376, -237949, -223786, -202225, -175080, -144342, - -112142, -80430, -50955, -24990, -3380, 13628, 26240, 35170, - 41402, 46169, 50665, 56013, 62999, 72081, 83214, 95949, - 109364, 122266, 133211, 140767, 143575, 140609, 131207, 115267, - 93186, 65957, 34996, 2134, -30636, -61239, -87791, -108676, - -122781, -129495, 12356724, 36406252, 58390684, 76977432, 90719600, 98265728, - 98008264, 88608552, 62420976, 2547174, -98862584, -234978608, -391650304, -549723776, - -687929024, -785620992, -825677888, -796781568, -695135040, -525144384, -299188480, -36327380, - 239749920, 503413376, 729982272, 898556864, 994367488, 1010422464, 948197568, 817333696, - 634343104, 420516896, 199273200, -6719048, -178276784, -302004160, -371805248, -389615456, - -365008416, -315253344, -262675984, -217917568, -178521248, -143001072, -111343304, -83569488, - -59728692, -39750832, -23483756, -10668693, -980101, 5968707, 10589352, 13306198, - 14527738, 14637296, 13974127, 12830675, 11443325, 9996437, 8620832, 7402724, - 6386965, 5588127, 4995412, 4583292, 4315642, 4154179, 4060473, 4001515, - 3949354, 3884093, 3791711, 3665350, 3502261, 3304372, 3075215, 2820550, - 2545809, 2257129, 1959450, 1657946, 1356600, 1059795, 771079, 494646, - 234059, -6519, -223731, -414017, -575061, -704879, -803133, -870150, - -907983, -919252, -907936, -878057, -834296, -780659, -721070, -658192, - -594157, -529649, -464852, -398810, -330536, -258557, -182049, -100384, - -14134, 75538, 166137, 254665, 337160, 409716, 468199, 509317, - 530349, 530086, 508400, 466928, 408381, 336929, 257279, 174830, - 94651, 21581, -40724, -89563, -123905, -143909, -151339, -148811, - -139947, -128462, -118197, -112219, -112926, -121327, -137375, -159531, - -185372, -211440, -234054, -249316, -253979, -245431, -222426, -184880, - -134334, -73467, -6263, 62723, 128418, 186074, 231361, 261147, - 273444, 267948, 261810, 763373, 1198560, 1499796, 1578270, 1304628, - 517808, -987783, -3443484, -7111908, -12256820, -19143168, -27996048, -39000040, - -52248820, -67752040, -85376464, -104873664, -125808744, -147634944, -169591248, -190910720, - -210637232, -228834976, -242239792, -233744176, -184602112, -88256112, 52564248, 227312048, - 419154080, 607121280, 768828480, 883312000, 933778624, 909811200, 808862336, 636755584, - 407214048, 140391440, -139342896, -406167488, -635714880, -807834944, -908809408, -932820096, - -882419648, -768029696, -606446400, -418634368, -226977824, -52442412, 88143752, 184240560, - 233125792, 241364816, 227710480, 209276640, 189331712, 167814560, 145682224, 123701848, - 102633120, 83021960, 65302000, 49722020, 36415812, 25376218, 16511686, 9640718, - 4539034, 941445, -1420767, -2818065, -3495818, -3676385, -3542409, -3243683, - -2888735, -2555377, -2287831, -2108851, -2019462, -2010501, -2062586, -2155553, - -2267238, -2380241, -2479146, -2554886, -2600826, -2615545, -2598567, -2552488, - -2479078, -2381454, -2260948, -2119607, -1957826, -1777065, -1577959, -1362941, - -1134431, -897064, -655697, -417094, -187702, 25095, 215280, 377113, - 507239, 603471, 666470, 698219, 703186, 686502, 654728, 613906, - 570192, 528056, 491058, 460427, 436171, 416130, 397422, 375887, - 347709, 309014, 257411, 191469, 111939, 20899, -77459, -178052, - -274516, -360654, -430246, -478480, -501684, -498487, -469248, -416789, - -345433, -261310, -171090, -82033, -635, 67321, 117943, 148920, - 160318, 153895, 133448, 103776, 70703, 39859, 16616, 4954, - 7564, 25024, 56260, 98143, 146331, 195238, 239125, 272241, - 289930, 288679, 266989, 225117, 165550, 92349, 11219, -71466, - -148857, -214705, -263567, -291740, -297224, -280306, -243136, -189895, - -125985, -57873, 7933, 65157, 108741, 134971, 142193, 130597, - 102524, 61859, 13944, -35316, -79751, -113898, -133249, -135053, - -118286, -84087, -35339, 23302, 86186, 146930, 199365, 237874, - 258253, 257864, 236196, 194657, 136724, 67341, -7287, -80567, - -145896, -270343, -808574, -1340072, -1858807, -2358665, -2831742, -3270963, - -3669340, -4023521, -4333619, -4606985, -4857566, -5108708, -5390687, -5741295, - -6200425, -6807718, -7593886, -8575752, -9745172, -11063108, -12448231, -13772797, - -14853837, -15454158, -15279006, -13985197, -11185029, -6465256, 602227, 10431847, - 23410894, 39863840, 60045788, 84103768, 112100696, 143979968, 179711728, 219302416, - 264231232, 316950432, 366815488, 391499840, 373734272, 303947296, 180205328, 8607086, - -197450336, -418782432, -632721152, -815848960, -946877184, -1009294400, -993460928, -897898880, - -729596672, -503316064, -239947616, 35840880, 298430624, 524143840, 693923584, 795387200, - 824107840, 783846592, 685860544, 547189184, 388365568, 230527600, 92671240, -11219515, - -74492144, -105158200, -120261872, -127544112, -128388320, -124354624, -116661448, -106489408, - -94793200, -82429304, -70062176, -58237700, -47334588, -37619828, -29226616, -22202334, - -16501587, -12028281, -8635400, -6159899, -4423260, -3257870, -2504859, -2031762, - -1726474, -1507393, -1314142, -1112384, -883004, -624119, -340602, -45467, - 248842, 528315, 783713, 1007231, 1196662, 1351165, 1473983, 1568019, - 1637995, 1686519, 1716364, 1727429, 1719421, 1689696, 1636232, 1556028, - 1448006, 1311510, 1148760, 963094, 760758, 548770, 336091, 131254, - -56814, -221101, -355658, -457521, -525555, -561787, -569830, -555666, - -525766, -487535, -447411, -411297, -382938, -364634, -356100, -355594, - -359287, -362732, -360583, -348172, -321291, -277591, -216139, -138411, - -47457, 51579, 152676, 248783, 333218, 399646, 443388, 461240, - 452449, 418164, 361960, 288882, 205559, 118975, 36377, -35977, - -92851, -131037, -149092, -147929, -130154, -100234, -63486, -25973, - 6639, 29226, 38204, 31469, 9051, -27322, -73989, -126155, - -177996, -223678, -257577, -275273, -273644, -251592, -209808, -151108, - -79807, -1677, 76962, 149510, 210060, 253638, 277008, 278653, - 259231, -101021, -297456, -477733, -632297, -753728, -836696, -878615, - -879031, -839751, -763739, -654959, -517096, -353514, -166209, 43748, - 276781, 533724, 815969, 1123958, 1457300, 1813342, 2187857, 2574262, - 2965417, 3353797, 3734536, 4106324, 4475222, 4855377, 5272512, 5763051, - 6375849, 7168185, 8204533, 9548340, 11257436, 13371571, 15905385, 18833006, - 22081010, 25512624, 28924300, 32032662, 34478724, 35820256, 35546928, 33078728, - 27793346, 19027280, 6112874, -11628489, -34851840, -64232176, -100493888, -144608256, - -198909072, -270631488, -359662496, -448624032, -516131776, -543967680, -518454176, -432622496, - -287176640, -90768024, 140893552, 386715040, 622670976, 824595136, 971067648, 1045974272, - 1040467264, 954060352, 794731136, 578022784, 325234560, 60958056, -189791088, -404423968, - -565354624, -661869440, -691213888, -658569600, -576189312, -461441856, -334519392, -215323504, - -121182328, -57886044, -14972652, 16811060, 39759696, 55435020, 65035460, 69706136, - 70441104, 68189248, 63775032, 57948004, 51329736, 44447116, 37701544, 31399154, - 25736924, 20832988, 16723796, 13393488, 10776430, 8783249, 7304115, 6229334, - 5450365, 4874027, 4420041, 4029271, 3658127, 3282309, 2889391, 2480032, - 2060348, 1642421, 1237795, 858544, 512575, 205752, -60998, -288674, - -481834, -645256, -785054, -905653, -1011013, -1102347, -1179780, -1240896, - -1282805, -1301283, -1292960, -1254661, -1185341, -1085250, -957344, -806069, - -638185, -461195, -283738, -113885, 40607, 173836, 281340, 361227, - 413418, 440281, 445517, 434398, 412451, 385525, 358529, 335589, - 319068, 309999, 307515, 309612, 312947, 313829, 308220, 292759, - 264732, 222913, 167314, 99696, 23013, -58414, -139717, -215530, - -280898, -331372, -363803, -376281, -368659, -342216, -299851, -245477, - -183947, -120287, -59527, -210294, -218804, -207034, -170663, -107684, - -17542, 97483, 233628, 384636, 543572, 702055, 852320, 986414, - 1098210, 1182279, 1235630, 1256080, 1243695, 1198697, 1122785, 1016812, - 882318, 719277, 528144, 307851, 58485, -220576, -527549, -860384, - -1213683, -1581737, -1955989, -2329539, -2695405, -3052665, -3405215, -3769076, - -4170617, -4653891, -5276647, -6116192, -7261256, -8815022, -10881268, -13564073, - -16947616, -21093540, -26015144, -31675226, -37956612, -44665032, -51498380, -58060316, - -63829408, -68189520, -70395848, -69627624, -64938208, -55334156, -39669268, -16742548, - 15011598, 57892376, 121157856, 215274688, 334456672, 461378272, 576139200, 658546880, - 691230336, 661933376, 565469888, 404588960, 189999104, -60718748, -324979552, -577770304, - -794500352, -953869504, -1040332032, -1045906432, -971073600, -824675520, -622820672, -386923360, - -141145440, 90490632, 286893152, 432351840, 518213184, 543769536, 515984864, 448531552, - 359622208, 270636384, 198948336, 144668672, 100561448, 64293740, 34896780, 11649924, - -6117171, -19054578, -27836140, -33125540, -35583508, -35831208, -34449244, -31950346, - -28780702, -25304532, -21811144, -18510242, -15544263, -12991323, -10880449, -9198353, - -7904592, -6938712, -6232849, -5716818, -5326765, -5007114, -4715109, -4419761, - -4103101, -3757115, -3383050, -2987624, -2581751, -2177166, -1785567, -1416314, - -1076470, -769692, -497117, -257162, -46868, 137886, 301064, 446309, - 576003, 691438, 792390, 877665, 945087, 992265, 1016767, 1016861, - 991628, 941464, 867976, 774150, 663993, 542420, 414732, 286370, - 162380, 47204, -55707, -143950, -216326, -272693, -313915, -341561, - -357718, -364650, -364603, -359521, -350944, -339867, -326770, -311628, - -294057, -273429, -249069, -220397, -187092, -149183, -107127, -61803, - -14483, 33260, 79674, 122959, 161417, 193583, -137153, -86096, - -23462, 46165, 118296, 188311, 252569, 308033, 353183, 387345, - 411326, 426448, 434961, 438884, 440375, 440558, 440044, 437930, - 432614, 421046, 399869, 364878, 312384, 238720, 141646, 19702, - -126527, -295376, -483051, -684957, -894831, -1106337, -1312215, -1505978, - -1680884, -1831578, -1952736, -2040617, -2091372, -2102604, -2071473, -1996480, - -1875541, -1708206, -1493799, -1234127, -931547, -591976, -222473, 165877, - 561490, 950008, 1319512, 1659151, 1966270, 2245658, 2518227, 2819813, - 3210306, 3770160, 4608328, 5854141, 7662371, 10198175, 13638330, 18147660, - 23877010, 30930782, 39364468, 49144104, 60148836, 72123392, 84694024, 97312800, - 109298904, 119765360, 127705376, 131866912, 130934488, 123231464, 107234464, 75050672, - 9470806, -97677456, -239897616, -403333024, -569087680, -716066368, -823729024, -874943616, - -858298112, -769767616, -613463168, -401328448, -152012800, 111316600, 362752096, 579800640, - 754066560, 884317376, 967646720, 1002358976, 988932224, 930137792, 830908864, 698079680, - 539965760, 365883200, 185588480, 8720114, -155758112, -300047104, -417930816, -505075680, - -559213504, -580180096, -569826624, -531795520, -471193568, -394169856, -307444800, -217803664, - -131610264, -54348980, 9748328, 57999172, 89445504, 104945984, 107368432, 102279568, - 94596192, 85655480, 75877136, 65846368, 56016016, 46757852, 38321108, 30867838, - 24467266, 19124186, 14784349, 11357873, 8727069, 6764325, 5338255, 4325655, - 3614320, 3109507, 2733412, 2427369, 2148937, 1871452, 1580043, 1270071, - 943252, 606145, 267130, -64446, -380185, -672695, -936550, -1167777, - -1364195, -1524669, -1649207, -1738275, -1792904, -1814221, -1803670, -1762759, - -1693364, -1597596, -1478091, -1337881, -1180581, -1010189, -831132, -647987, - -465420, -287874, -119474, 36238, 176365, 298810, 402244, 486148, - 550683, 596630, 625208, 637968, 636614, 622900, 598511, 565006, - 523771, 476024, 422831, 365155, 303902, 239978, 174336, 108003, - 42099, -22177, -83566, -140800, -192647, -237981, -275829, -305435, - -326287, -338158, -341095, -335431, -321739, -300823, -273643, -241298, - -204944, -165780, -124974, -83660, -42880, 10137, 29849, 47985, - 63702, 76520, 86314, 93425, 98550, 102746, 107236, 113334, - 122202, 134769, 151505, 172398, 196816, 223585, 250966, 276853, - 298844, 314511, 321522, 317919, 302199, 273538, 231774, 177523, - 112040, 37218, -44643, -130911, -218896, -305922, -389579, -467717, - -538627, -600924, -653636, -695990, -727439, -747408, -755314, -750348, - -731559, -697715, -647504, -579487, -492405, -385195, -257342, -108895, - 59211, 245234, 446381, 659034, 878627, 1100007, 1317397, 1524851, - 1716231, 1885675, 2027510, 2136678, 2208531, 2239209, 2225330, 2164370, - 2054318, 1894140, 1683476, 1423258, 1115462, 763860, 373717, -47467, - -490570, -944379, -1396841, -1835173, -2248037, -2626382, -2966637, -3272111, - -3556917, -3847305, -4185583, -4630274, -5258922, -6165632, -7461554, -9268313, - -11715324, -14927984, -19021866, -24085232, -30171698, -37277344, -45335748, -54189964, - -63598244, -73198584, -82549584, -91078392, -98377112, -103118416, -100391208, -84628624, - -52954552, -4492618, 59827860, 137363792, 223933312, 314109568, 401591168, 479653696, - 541630720, 581410176, 593897728, 575427264, 524078976, 439891712, 324946016, 183315184, - 20883088, -154960944, -335730752, -512333504, -675605952, -816870016, -928462720, -1004220224, - -1039868736, -1033319296, -984830528, -897064000, -775182272, -627308096, -461708352, -284291552, - -100579392, 83598736, 262525088, 430732416, 583209600, 715532736, 824009920, 905775040, - 958871552, 982291840, 975995776, 940888192, 878773504, 792274432, 684731072, 560072576, - 422675872, 277208288, 128466608, -18787604, -159985744, -290901824, -407785088, -507474624, - -587489088, -646091776, -682326144, -696024192, -687785152, -658928000, -611418688, -547776704, - -470963680, -384259392, -291130144, -195094672, -99592464, -7860071, 77180528, 153017120, - 217622960, 269510560, 307761952, 332035072, 342546656, 340033376, 325693088, 301109632, - 268164672, 228941216, 185622192, 140390128, 95330560, 52345244, 13076479, -21151680, - -49376268, -71017224, -85881800, -94147080, -96327536, -93222768, -85856648, -75400496, - -63097824, -50176000, -37774988, -26857674, -18169908, -11863887, -7301392, -3914018, - -1479242, 185291, 1236420, 1817970, 2053955, 2052907, 1903852, 1679448, - 1434536, 1209401, 1029974, 911183, 857962, 868350, 934655, 1046022, - 1189342, 1351150, 1518125, 1678330, 1821294, 1938725, 2024278, 2073883, - 2085335, 2058391, 1994281, 1895693, 1766278, 1610593, 1433645, 1240831, - 1037545, 829139, 620601, 416556, 221024, 37473, -131344, -283279, - -416878, -531220, -625958, -701127, -757159, -794697, -814605, -817824, - -805400, -778384, -737905, -685103, -621229, -547610, -465741, -377252, - -283979, -187900, -91166, 4001, 95326, 180608, 257764, 324972, - 380709, 423871, 453787, 470280, 473637, 464613, 444338, 414280, - 376112, 331644, 282692, 231012, 178188, 125609, 74399, 25440, - -20646, -63433, -102670, -138199, -169921, -197722, -221454, -240892, - -255747, -265667, -270281, -269233, -262252, -249189, -230092, -205221, - -175099, -140492, -102411, -62059, -20785, 19997, 58880, 94556, - 125879, 151942, 172113, 186075, 193810, 195596, 191955, 183604, - 171377, 156168, 138843, 120200, 100900, 81458, 62216, 43368, - 24971, 6998, -10624, -27957, -45013, -61705, -77836, -93079, - -106999, -119067, -128714, -135370, -138532, -137806, -132971, -123999, - -111091, -94667, -75361, -53969, 10765, 32074, 52722, 72311, - 90486, 106963, 121523, 134027, 144392, 152600, 158658, 162605, - 164468, 164267, 161985, 157577, 150955, 142011, 130615, 116649, - 100019, 80692, 58704, 34200, 7431, -21221, -51265, -82083, - -112977, -143167, -171845, -198187, -221409, -240776, -255657, -265518, - -269970, -268744, -261725, -248915, -230452, -206572, -177616, -143996, - -106204, -64784, -20348, 26444, 74865, 124130, 173377, 221686, - 268054, 311432, 350709, 384766, 412472, 432751, 444591, 447117, - 439606, 421553, 392681, 352994, 302769, 242592, 173323, 96118, - 12366, -76299, -168083, -261025, -353085, -442152, -526117, -602884, - -670441, -726859, -770364, -799329, -812348, -808221, -786031, -745129, - -685209, -606288, -508783, -393474, -261578, -114689, 45155, 215561, - 393723, 576534, 760547, 942104, 1117306, 1282158, 1432549, 1564416, - 1673729, 1756688, 1809722, 1829726, 1814087, 1760970, 1669365, 1539414, - 1372449, 1171316, 940345, 685584, 414591, 136477, -138614, -399774, - -636264, -838162, -997771, -1110606, -1177191, -1204204, -1206433, -1207707, - -1242622, -1356751, -1607660, -2063815, -2804506, -3917005, -5495374, -7636020, - -10436517, -13992514, -18402674, -23818388, -30616280, -38795064, -47468192, -55465196, - -61624760, -64816688, -64030596, -58439904, -47471160, -30852034, -8650500, 18708296, - 50440096, 85421744, 122227560, 159185040, 194443776, 226058080, 252076752, 270638720, - 280067616, 278963616, 266285680, 241422224, 204245248, 155146128, 95049592, 25405990, - -51839956, -134302160, -219227456, -303587872, -384188544, -457786240, -521215424, -571515392, - -606054656, -622647040, -619654592, -596072512, -551593600, -486646944, -402411264, -300798944, - -184413264, -56477480, 79260352, 218645328, 357251200, 490529920, 613968768, 723250432, - 814409344, 883978944, 929123648, 947751552, 938601472, 901303104, 836405248, 745373248, - 630551936, 495099232, 342887840, 178382704, 6494100, -167583760, -338549120, -501169472, - -650463872, -781868416, -891402304, -975790912, -1032769600, -1061261696, -1060915456, -1031960960, - -975385600, -892916224, -786977856, -660620736, -517435968, -361449888, -197010624, -28662768, - 138980608, 301369056, 454141632, 593248768, 715063168, 816478784, 894992576, 948769664, - 976686784, 978356608, 954128576, 905069824, 832924288, 740053568, 629360000, 504194944, - 368255424, 225472400, 79893288, -64436384, -203589744, -333869568, -451910592, -554770112, - -640004160, -705727744, -750656768, -774131456, -776120512, -757206720, -718553856, -661857536, - -589281088, -503378688, -407008864, -303241088, -195258304, -86258672, 20640266, 122492392, - 216605760, 300615264, 372542752, 430843584, 474437952, 502727104, 515593600, 513386816, - 496894016, 467298720, 426127872, 375190336, 316508064, 252243568, 184625248, 115873648, - 48130852, -16604751, -76536328, -130117360, -176090096, -213512624, -241774240, -260598816, - -270036736, -270445792, -262462656, -246965456, -225030192, -197881696, -166842016, -133277536, - -98547200, -63953468, -30697916, 157309, 27720696, 51294532, 70389352, 84729480, - 94249824, 99084304, 99546808, 96105616, 89352656, 79969008, 68688296, 56259452, - 43410724, 30816176, 19066356, 8644033, -93590, -6926218, -11773978, -14694671, - -15872813, -15605618, -14280676, -12378042, -10430668, -8704424, -7182491, -5854782, - -4729147, -3804335, -3072066, -2516383, -2116394, -1847634, -1684290, -1600530, - -1572012, -1576721, -1595767, -1613665, -1618550, -1602016, -1558925, -1486975, - -1386301, -1258946, -1108416, -939180, -756297, -565028, -370575, -177839, - 8715, 185182, 348246, 495214, 623986, 733038, 821363, 888436, - 934161, 958831, 963086, 947887, 914478, 864367, 799293, 721209, - 632236, 534643, 430794, 323115, 214029, 105923, 1076, -98376, - -190504, -273617, -346304, -407458, -456294, -492355, -515505, -525917, - -524051, -510616, -486547, -452951, -411079, -362277, -307954, -249541, - -188465, -126117, -63839, -2894, 55536, 110376, 160649, 205502, - 244200, 276144, 300872, 318070, 327574, 329385, 323660, 310724, - 291059, 265298, 234214, 198698, 159739, 118393, 75754, 32922, - -9033, -49104, -86375, -120044, -149449, -174076, -193569, -207727, - -216503, -219983, -218381, -212007, -201261, -186599, -168524, -147564, - -124261, -99161, -72807, -45733, -18468, 8473, 34584, 59372, - 82359, 103090, 121141, 136131, 147730, 155680, 159803, 160015, - 156337, 148897, 137934, 123794, 106916, 87821, 67091, 45345, - 23216, 1326, -19743, -39465, 109887, 120382, 128416, 133765, - 136261, 135794, 132320, 125859, 116497, 104388, 89749, 72858, - 54047, 33695, 12222, -9922, -32266, -54329, -75626, -95683, - -114044, -130284, -144009, -154878, -162593, -166923, -167696, -164811, - -158239, -148026, -134294, -117244, -97153, -74370, -49314, -22469, - 5628, 34390, 63198, 91407, 118365, 143426, 165965, 185395, - 201183, 212860, 220042, 222435, 219848, 212195, 199508, 181929, - 159715, 133233, 102952, 69434, 33331, -4639, -43696, -83016, - -121744, -159013, -193957, -225733, -253530, -276597, -294249, -305894, - -311042, -309326, -300512, -284516, -261407, -231423, -194963, -152600, - -105060, -53228, 1881, 59128, 117284, 175043, 231069, 284005, - 332527, 375354, 411300, 439283, 458370, 467783, 466935, 455431, - 433101, 399985, 356360, 302726, 239820, 168592, 90219, 6068, - -82296, -173156, -264641, -354785, -441533, -522811, -596538, -660703, - -713385, -752830, -777471, -786003, -777391, -750944, -706300, -643488, - -562898, -465330, -351937, -224267, -84196, 66044, 223948, 386697, - 551263, 714370, 872609, 1022412, 1160192, 1282340, 1385409, 1466141, - 1521718, 1549819, 1548936, 1518450, 1458982, 1372447, 1262386, 1133907, - 993924, 850871, 714752, 596518, 507835, 460031, 463573, 526525, - 653821, 845263, 1094812, 1388217, 1702729, 2004387, 2248836, 2377871, - 2322716, 1997670, 1310909, 31361, -2276023, -5884963, -10790734, -16840258, - -23748608, -31120974, -38472224, -45255760, -50892408, -54804412, -56448304, -55348896, - -51129788, -43541476, -32483506, -18021422, -395893, 19975162, 42503072, 66442420, - 90913264, 114929960, 137436576, 157346768, 173587488, 185144144, 191106144, 190710336, - 183381248, 168765648, 146760624, 117533176, 81530704, 39481248, -7616625, -58514600, - -111745512, -165663824, -218494432, -268388400, -313484064, -351971232, -382156480, -402527424, - -411813344, -409040128, -393577504, -365176384, -323994752, -270611200, -206024384, -131639056, - -49237472, 39062252, 130860688, 223542656, 314352192, 400474784, 479124064, 547630784, - 603530816, 644649344, 669178624, 675746624, 663473536, 632014912, 581589056, 512987520, - 427568224, 327230528, 214373088, 91835128, -37177272, -169178032, -300498464, -427392512, - -546146752, -653191616, -745210944, -819245440, -872788352, -903868288, -911118272, -893827520, - -851974272, -786238976, -697996288, -589286400, -462766208, -321640832, -169578832, -10611593, - 150978672, 310780032, 464377088, 607478720, 736043264, 846397952, 935348160, 1000273472, - 1039207744, 1050900416, 1034856960, 991357632, 921452992, 826937088, 710298944, 574652800, - 423651328, 261382080, 92266240, -79072984, -248102448, -410503776, -562126720, -699092736, - -817911936, -915573376, -989624896, -1038234688, -1060238592, -1055167808, -1023259008, -965445760, - -883330880, -779142016, -655670144, -516193728, -364390176, -204236960, -39905496, 124349848, - 284304192, 435873248, 575219968, 698854144, 803721536, 887281600, 947570240, 983247040, - 993625152, 978684224, 939064256, 876042880, 791495168, 687838208, 567961280, 435144608, - 292968064, 145212944, -4240369, -151516576, -292848000, -424673056, -543728192, -647130176, - -732447680, -797759168, -841696640, -863474048, -862898880, -840368384, -796849536, -733844032, - -653339328, -557747648, -449833824, -332635680, -209377712, -83381528, 42024892, 163596368, - 278255872, 383173696, 475838368, 554117568, 616307264, 661168640, 687951104, 696401792, - 686761024, 659744256, 616512064, 558627584, 488004704, 406847392, 317582464, 222787984, - 125119136, 27233782, -68280144, -158973472, -242598960, -317167264, -380994112, -432737696, - -471425664, -496470656, -507674976, -505223904, -489668640, -461899200, -423108800, -374750624, - -318488480, -256143216, -189636144, -120931576, -51979948, 15336795, 79255984, 138179872, - 190714864, 235703648, 272249056, 299729728, 317807040, 326423456, 325792768, 316382656, - 298890368, 274212512, 243410272, 207670816, 168266608, 126513920, 83731472, 41200944, - 130175, -38379756, -73362784, -104010672, -129689920, -149952464, -164540112, -173382736, - -176590656, -174441552, -167362736, -155909328, -140739472, -122587248, -102234616, -80482928, - -58125464, -35921428, -14572560, 5297181, 23158150, 38587464, 51277008, 61037024, - 67795232, 71591800, 72570464, 70966328, 67090884, 61315048, 54050700, 45731812, - 36795552, 27664472, 18730052, 10338603, 2779584, -3722787, -9014984, -13015846, - -15715349, -17169656, -17493876, -16851572, -15443180, -13491852, -11229971, -8883501, - -6659666, -4731320, -3230436, -2179638, -1456508, -951706, -619736, -422906, - -328742, -307762, -334784, -388143, -450439, -507929, -550755, -572282, - -568989, -539768, -485654, -409163, -313997, -204481, -85334, 38748, - 163232, 284008, 397435, 500481, 590686, 666220, 725799, 768696, - 794640, 803805, 796717, 774237, 737483, 687817, 626774, 556060, - 477482, 392946, 304395, 213796, 123081, 34130, -51284, -131518, - -205101, -270753, -327424, -374293, -410797, -436619, -451696, -456198, - -450524, -435265, -411195, -379231, -340412, -295864, -246780, -194382, - -139908, -84576, -29579, 23948, 74940, 122415, 165488, 203392, - 235477, 261232, 280287, 292420, 297563, 295805, 287381, 272679, - 252217, 226642, 196699, 163225, 127113, 89298, 50723, 12319, - -25022, -60468, -93267, -122762, -148403, -169755, -186505, -198455, - -205529, -207755, -205269, -198296, -187147, -172200, -153899, -132733, - -109235, -83965, -57505, -30448, -3387, 23090, 48419, 72062, - 93519, 112344, 128152, 140629, 149540, 154739, 156171, 153875, - 147984, 138721, 126390, 111370, 94099, 75064, 54779, 33779, - 12593, -8262, -28303, -47084, 123494, 129971, 133493, 133924, - 131201, 125331, 116398, 104559, 90037, 73124, 54170, 33578, - 11793, -10702, -33406, -55797, -77356, -97567, -115939, -132009, - -145355, -155607, -162458, -165670, -165080, -160609, -152268, -140154, - -124457, -105454, -83508, -59060, -32622, -4767, 23884, 52680, - 80946, 108005, 133192, 155874, 175459, 191418, 203293, 210711, - 213394, 211167, 203964, 191828, 174916, 153495, 127939, 98723, - 66416, 31667, -4798, -42202, -79720, -116501, -151685, -184419, - -213882, -239294, -259946, -275209, -284560, -287590, -284024, -273728, - -256722, -233178, -203429, -167959, -127402, -82528, -34229, 16495, - 68562, 120826, 172104, 221199, 266929, 308151, 343787, 372847, - 394455, 407868, 412493, 407908, 393872, 370338, 337461, 295599, - 245318, 187388, 122773, 52620, -21757, -98901, -177232, -255084, - -330731, -402431, -468456, -527135, -576892, -616284, -644032, -659054, - -660495, -647746, -620468, -578601, -522379, -452338, -369318, -274467, - -169243, -55405, 64986, 189594, 315816, 440826, 561623, 675096, - 778120, 867669, 940959, 995619, 1029881, 1042792, 1034432, 1006137, - 960689, 902497, 837686, 774157, 721490, 690799, 694367, 745251, - 856581, 1040935, 1309312, 1670468, 2129651, 2688819, 3345656, 4105519, - 4976393, 5840188, 6459558, 6619945, 6147045, 4905821, 2810464, -169248, - -4002855, -8597662, -13799897, -19399282, -25136440, -30713178, -35805064, -40075928, - -43193604, -44846368, -44759276, -42709760, -38541820, -32178052, -23629058, -12999656, - -491521, 13597969, 28880844, 44887552, 61079704, 76866240, 91622528, 104711816, - 115508400, 123421568, 127919688, 128553392, 124977088, 116967832, 104440944, 87461480, - 66251100, 41189824, 12812431, -18200672, -51037968, -84776544, -118406512, -150859520, - -181040640, -207862576, -230281344, -247332144, -258164320, -262074240, -258534976, -247221616, - -228031216, -201096704, -166793872, -125740976, -78790864, -27015406, 28317512, 85773968, - 143790256, 200714592, 254853088, 304518720, 348082144, 384022272, 410975936, 427784064, - 433533952, 427595232, 409648832, 379707872, 338129120, 285614880, 223204848, 152257552, - 74422120, -8399482, -94098672, -180413920, -264990464, -345444480, -419429888, -484706304, - -539205312, -581094272, -608834752, -621234048, -617488768, -597217728, -560484416, -507806784, - -440154880, -358935456, -265963920, -163424032, -53816484, 60102860, 175393008, 289004832, - 397862624, 498948160, 589385088, 666520704, 728003904, 771855360, 796529472, 800965376, - 784625088, 747518528, 690213376, 613829888, 520020448, 410934048, 289166720, 157698512, - 19819390, -120954952, -260974400, -396551008, -524057792, -640027584, -741248576, -824854336, - -888405760, -929962176, -948139904, -942156672, -911859520, -857736896, -780912768, -683123584, - -566678912, -434405344, -289576544, -135830144, 22925716, 182614304, 339097376, 488284896, - 626244608, 749307648, 854168576, 937975616, 998409984, 1033750912, 1042925056, 1025539008, - 981893504, 912979136, 820453376, 706599552, 574268864, 426807104, 267967136, 101810936, - -67397744, -235305840, -397586848, -550055296, -688779008, -810183040, -911146880, -989084800, - -1042054592, -1068829184, -1068826112, -1042089792, -989328512, -911898304, -811770624, -691481728, - -554069376, -402995648, -242059584, -75301504, 93098968, 258928160, 418044256, 566481536, - 700549504, 816925696, 912738304, 985637504, 1033853888, 1056241408, 1052304960, 1022211200, - 966782848, 887476096, 786342208, 665974016, 529439200, 380201408, 222031488, 58911676, - -105065728, -265801808, -419294496, -561739072, -689623232, -799814720, -889638656, -956942720, - -1000149696, -1018294336, -1011044736, -978708096, -922219648, -843115968, -743493120, -625951040, - -493525056, -349607232, -197858608, -42115448, 113708584, 265721584, 410151424, 543440192, - 662332480, 763955904, 845890496, 906227200, 943612480, 957278400, 947058112, 913385664, - 857280704, 780318336, 684585088, 572622656, 447359776, 312035584, 170115056, 25199920, - -119063552, -259076960, -391380192, -512737632, -620217856, -711264960, -783759808, -836069184, - -867082944, -876236800, -863521472, -829477248, -775175296, -702184896, -612528832, -508627616, - -393234080, -269360256, -140198384, -9038325, 120816904, 246134720, 363834016, 471061440, - 565260864, 644234816, 706195520, 749805696, 774206528, 779033856, 764420928, 730989120, - 679825600, 612449984, 530770240, 437028800, 333741664, 223630656, 109551536, -5580210, - -118864264, -227488864, -328800992, -420371296, -500052800, -566030976, -616865088, -651519232, - -669382144, -670276608, -654456960, -622595968, -575760768, -515379648, -443199648, -361236896, - -271720576, -177032864, -79645232, 17945830, 113283088, 204010512, 287931712, 363063040, - 427680576, 480359328, 520004224, 545871936, 557583232, 555125952, 538848000, 509441632, - 467918976, 415579744, 353972064, 284847840, 210113616, 131778400, 51899980, -27469024, - -104333832, -176807568, -243157520, -301846336, -351567360, -391273184, -420196800, -437865024, - -444103968, -439036576, -423072480, -396890720, -361415584, -317786848, -267324960, -211492304, - -151851792, -90023688, -27642056, 33688092, 92431824, 147162464, 196595872, 239620272, - 275320544, 302996800, 322176864, 332622304, 334328064, 327516064, 312622880, 290282112, - 261301872, 226638432, 187366672, 144647984, 99697160, 53748436, 8022341, -36306296, - -78138080, -116475864, -150447968, -179327376, -202546304, -219706160, -230582416, -235124880, - -233452928, -225846496, -212732912, -194670144, -172327120, -146461568, -117896304, -87494416, - -56134348, -24685366, 6015840, 35186796, 62118600, 86192504, 106893400, 123819856, - 136690672, 145347696, 149755152, 149995552, 146262368, 138849824, 128140336, 114589888, - 98711832, 81059840, 62210316, 42744900, 23233612, 4218996, -13798199, -30371520, - -45119144, -57731856, -67978520, -75708944, -80854288, -83424880, -83505872, -81250776, - -76873240, -70637384, -62847076, -53834452, -43948188, -33541804, -22962404, -12540202, - -2579104, 6651381, 14922708, 22052188, 27906138, 32401252, 35504228, 37229756, - 37636996, 36824736, 34925464, 32098614, 28523208, 24390258, 19895138, 15230230, - 10578097, 6105390, 1957699, -1744518, -4908812, -7472372, -9402388, -10695210, - -11374340, -11487438, -11102430, -10302999, -9183557, -7844043, -6384651, -4900844, - -3478715, -2191066, -1094124, -225317, 398208, 779956, 943926, 936293, - 833844, 703157, 565034, 427621, 299915, 188242, 97070, 28671, - -16282, -38631, -40246, -23848, 7370, 49924, 100305, 155103, - 211184, 265743, 316398, 361188, 398601, 427542, 447320, 457596, - 458351, 449838, 432541, 407131, 374438, 335404, 291067, 242523, - 190911, 137380, 83081, 29131, -23391, -73477, -120193, -162709, - -200302, -232373, -258456, -278222, -291483, -298191, -298431, -292422, - -280496, -263099, -240767, -214119, -183837, -150654, -115335, -78667, - -41439, -4430, 31603, 65943, 97920, 126924, 152420, 173951, - 191152, 203753, 211586, 214590, 212809, 206390, 195581, 180724, - 162245, 140642, 116472, 90338, 62871, 34716, 6512, -21115, - -47577, -72327, -94874, -114790, -131717, -145374, -155554, -162130, - -165050, -164338, -160089, -152466, -141696, -128062, -111900, -93592, - -73557, -52247, -30134, -7706, 14546, 36139, 56604, 75501, - 92426, 107025, 118997, 128106, 134187, 137146, 136964, 133700, - 127480, 118502, 107020, 93345, 116040, 106373, 94004, 79158, - 62121, 43240, 22912, 1579, -20281, -42169, -63569, -83966, - -102856, -119760, -134234, -145882, -154369, -159426, -160859, -158557, - -152493, -142728, -129410, -112770, -93122, -70853, -46417, -20326, - 6860, 34548, 62118, 88942, 114393, 137861, 158767, 176575, - 190802, 201034, 206937, 208261, 204852, 196660, 183736, 166241, - 144442, 118709, 89511, 57407, 23039, -12886, -49603, -86311, - -122184, -156394, -188125, -216596, -241075, -260902, -275496, -284383, - -287194, -283688, -273753, -257415, -234835, -206316, -172290, -133320, - -90085, -43369, 5950, 56922, 108538, 159746, 209478, 256659, - 300236, 339190, 372562, 399462, 419103, 430808, 434043, 428427, - 413772, 390087, 357626, 316892, 268676, 214058, 154439, 91515, - 27295, -35962, -95765, -149503, -194502, -228208, -248287, -252875, - -240711, -211453, -165805, -105883, -35276, 40539, 114314, 176503, - 215759, 217978, 167946, 29216, -265669, -759935, -1454826, -2329191, - -3341857, -4434792, -5535889, -6563153, -7428902, -8044769, -8326572, -8199427, - -7602384, -6492797, -4849871, -2677498, -5997, 3107152, 6577829, 10296906, - 14133125, 17937022, 21545892, 24789544, 27496750, 29502072, 30652904, 30816402, - 29886096, 27787848, 24484978, 19982264, 14328683, 7618649, -8275, -8369346, - -17242212, -26370120, -35468600, -44233488, -52350068, -59503100, -65387360, -69718488, - -72243656, -72751784, -71082920, -67136432, -60877660, -52342804, -41641768, -28958772, - -14550630, 1257369, 18077938, 35470524, 52952152, 70010080, 86115976, 100741256, - 113373128, 123530864, 130781872, 134756976, 135164528, 131802696, 124569704, 113471440, - 98626208, 80266312, 58736392, 34488268, 8072537, -19873172, -48638900, -77459776, - -105535736, -132052984, -156206736, -177224544, -194389536, -207063008, -214705568, -216896176, - -213348592, -203924480, -188642880, -167685488, -141397504, -110283944, -75001352, -36344852, - 4768980, 47323316, 90225720, 132335712, 172494592, 209556688, 242421216, 270063936, - 291567712, 306150848, 313192864, 312256320, 303104480, 285713824, 260281152, 227224928, - 187180496, 140989248, 89681992, 34456540, -23349740, -82291968, -140853584, -197485040, - -250644464, -298839136, -340666720, -374855200, -400300192, -416098816, -421578912, -416322848, - -400184960, -373302304, -336098016, -289277056, -233814336, -170935472, -102090216, -28919474, - 46783608, 123117448, 198119696, 269817600, 336279616, 395667328, 446285568, 486630272, - 515431904, 531693952, 534724512, 524161024, 499986336, 462536352, 412498304, 350899776, - 279088736, 198704400, 111640296, 19999716, -73955136, -167859072, -259303504, -345898400, - -425334720, -495445856, -554266496, -600087168, -631503040, -647455744, -647266496, -630660352, - -597779904, -549188672, -485863232, -409174688, -320859648, -222981056, -117879984, -8119592, - 103577704, 214398032, 321507232, 422123680, 513590720, 593446784, 659491904, 709847616, - 743010112, 757894080, 753866240, 730767680, 688924608, 629145984, 552709376, 461334048, - 357142464, 242611072, 120511064, -6158985, -134247200, -260527344, -381780576, -494877952, - -596861632, -685022336, -756971776, -810707072, -844666432, -857773504, -849470528, -819737792, - -769099840, -698617600, -609866880, -504903104, -386213792, -256659104, -119402648, 22166518, - 164518080, 304069184, 437275360, 560721088, 671207872, 765837888, 842089984, 897887232, - 931653440, 942357376, 929543168, 893346752, 834496704, 754300416, 654615040, 537804480, - 406682912, 264446352, 114594352, -39157032, -192968032, -342971968, -485373120, -616543680, - -733116800, -832073664, -910822080, -967264896, -999856064, -1007642752, -990292800, -948106752, - -882013184, -793548800, -684822016, -558462848, -417558400, -265576992, -106281872, 56362708, - 218291040, 375438528, 523844608, 659753344, 779709440, 880646656, 959966976, 1015607872, - 1046096320, 1050588096, 1028890880, 981471296, 909444864, 814549696, 699104192, 565949568, - 418379808, 260058736, 94928648, -72889120, -239197984, -399832192, -550762240, -688196992, - -808680064, -909177600, -987155392, -1040643904, -1068288256, -1069383232, -1043891456, -992444800, - -916328960, -817451520, -698297344, -561877056, -411613792, -251225136, -84665176, 83959240, - 250492800, 410833184, 561032192, 697392512, 816558400, 915598016, 992075520, 1044110528, - 1070424512, 1070372096, 1043956672, 991830592, 915278784, 816187328, 696996800, 560642560, - 410482208, 250213232, 83781792, -84714288, -251126384, -411357152, -561461504, -697743552, - -816847808, -915841536, -992287296, -1044302592, -1070606528, -1070551232, -1044137856, -992016512, - -915470336, -816383744, -697196352, -560842560, -410679552, -250404528, -83963680, 84544936, - 250972336, 411220768, 561344576, 697647424, 816773248, 915788800, 992256192, 1044292480, - 1070616448, 1070579840, 1044183488, 992077376, 915544384, 816468800, 697290112, 560942720, - 410783712, 250510352, 84068912, -84442472, -250874656, -411129728, -561261824, -697574272, - -816710848, -915738048, -992217536, -1044266240, -1070602624, -1070578112, -1044193344, -992097920, - -915574656, -816507712, -697336256, -560994752, -410840192, -250569808, -84129840, 84381496, - 250815008, 411072672, 561208512, 697525760, 816667968, 915701504, 992187968, 1044243968, - 1070587840, 1070570944, 1044193664, 992105472, 915588992, 816528256, 697362432, 561025728, - 410875072, 250607648, 84169704, -84340632, -250774144, -411032768, -561170496, -697490560, - -816636288, -915674048, -992165248, -1044226432, -1070575744, -1070564352, -1044192576, -992109760, - -915598336, -816542272, -697380608, -561047424, -410899648, -250634432, -84197944, 84311648, - 250745136, 411004448, 561143488, 697465472, 816613632, 915654272, 992148736, 1044213504, - 1070566592, 1070559104, 1044191232, 992112320, 915604608, 816552064, 697393600, 561063296, - 410917984, 250654720, 84219640, -84289112, -250722352, -410981984, -561121984, -697445376, - -816595520, -915638656, -992135872, -1044203776, -1070560128, -1070556032, -1044191616, -992116032, - -915611456, -816561792, -697405888, -561077696, -410934112, -250672080, -84237752, 84270736, - 250704176, 410964480, 561105536, 697430400, 816582400, 915627520, 992127104, 1044197440, - 1070556416, 1070555008, 1044193216, 992120256, 915618176, 816570816, 697417024, 561090688, - 410948576, 250687680, 84254088 -}; - -#endif diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index e90ae83ac2f82687af9198058b061c4c4ce874ab..85bd01c215d49e21493dc19b814809a93ccc8c9d 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -87,7 +87,6 @@ extern const uint16_t ECSQ_tab_inverse[1 + ECSQ_SEGMENT_SIZE]; *----------------------------------------------------------------------------------*/ extern const float ica_sincInterp2[]; -extern const Word32 ica_sincInterp2_fx[]; extern const float ica_sincInterp4[]; extern const float ica_sincInterp6[]; @@ -96,38 +95,17 @@ extern const float ica_sincInterp6[]; *----------------------------------------------------------------------------------*/ extern const float icbwe_gsMapping_tbl[]; -extern const Word16 pow_10_icbwe_gsMapping_tbl_fx[]; extern const float icbwe_gsMappingDFT_tbl[]; -extern const Word16 pow_10_icbwe_gsMappingDFT_tbl_fx[]; /*----------------------------------------------------------------------------------* * TD Stereo ROM tables *----------------------------------------------------------------------------------*/ extern const float tdm_ratio_tabl[]; -extern const UWord32 tdm_ratio_tabl_fx[TDM_NQ + 1]; extern const float tdm_den_ratio_tabl[]; -extern const UWord32 tdm_den_ratio_tabl_fx[]; extern const int16_t tdm_bit_allc_tbl[5][6]; /* LSFs Intra-frame prediction tables */ -#ifdef IVAS_FLOAT_FIXED -extern const Word16 tdm_LSF_MEAN_RE_USE_OUT_fx[M]; -extern const Word16 tdm_LSF_MEAN_RE_USE_IN_fx[M]; -extern const Word16 tdm_LSF_MEAN_RE_USE_fx[M]; - -extern const Word16 tdm_Beta_Q1bit_re_use_13k2_fx[2]; -extern const Word16 tdm_Beta_Q1bit_re_use_16k4_fx[2]; -extern const Word16 tdm_Beta_Q1bit_re_use_24k4_32k_fx[2]; -extern const Word16 tdm_Beta_Q1bit_re_use_48k_fx[2]; - -extern const Word16 tdm_RE_USE_adaptive_beta_prd_diag_3_fx[15 + 16 + 15]; - -extern const Word16 tdm_LSF_MEAN_PRED_QNT_OUT_fx[M]; -extern const Word16 tdm_LSF_MEAN_PRED_QNT_IN_fx[M]; -extern const Word16 tdm_LSF_MEAN_PRED_QNT_fx[M]; -extern const Word16 tdm_PRED_QNT_fixed_beta_prd_diag_3_fx[15 + 16 + 15]; -#endif extern const float tdm_LSF_MEAN_RE_USE_OUT[M]; extern const float tdm_LSF_MEAN_RE_USE_IN[M]; extern const float tdm_LSF_MEAN_RE_USE[M]; @@ -166,22 +144,12 @@ extern const float dft_cng_coh_pred[][STEREO_DFT_COH_PRED_COEFFS]; extern const int16_t dft_cng_coh_u2i[9]; extern const int16_t dft_cng_coh_i2u[9]; extern const float dft_cng_alpha_bits[STEREO_DFT_N_COH_ALPHA_STEPS][STEREO_DFT_N_COH_ALPHA_LEVELS]; -#ifdef IVAS_FLOAT_FIXED -extern const Word16 dft_cng_alpha_bits_fx[STEREO_DFT_N_COH_ALPHA_STEPS][STEREO_DFT_N_COH_ALPHA_LEVELS]; -extern const Word16 dft_cng_coh_pred_fx[][STEREO_DFT_COH_PRED_COEFFS]; -#endif // IVAS_FLOAT_FIXED extern const int16_t dft_cng_coh_alpha_start[STEREO_DFT_N_COH_ALPHA_STEPS - 1]; /*----------------------------------------------------------------------------------* * DirAC ROM tables *----------------------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED -extern const Word32 diffuseness_reconstructions_fx[DIRAC_DIFFUSE_LEVELS]; -extern const Word32 diffuseness_thresholds_fx[DIRAC_DIFFUSE_LEVELS + 1]; -extern const Masa_Diffuseness_Ratios masa_diffuse_ratios[DIRAC_DIFFUSE_LEVELS][DIRAC_DIFFUSE_LEVELS]; -#endif - extern const float diffuseness_reconstructions[DIRAC_DIFFUSE_LEVELS]; extern const float diffuseness_thresholds[DIRAC_DIFFUSE_LEVELS + 1]; extern const int16_t DirAC_band_grouping_12[12 + 1]; @@ -215,12 +183,10 @@ extern const int16_t HOA_keep_ind_spar[IVAS_SPAR_MAX_CH]; extern const int16_t HOA_keep_ind_spar512[IVAS_SPAR_MAX_CH]; extern const float dtx_pd_real_min_max[2]; -extern const Word32 dtx_pd_real_min_max_fx[2]; extern const int16_t dtx_pd_real_q_levels[3][3]; extern const int16_t dtx_pr_real_q_levels[3][3]; extern const int16_t pr_pr_idx_pairs[3][3][2]; extern const int16_t pr_pd_idx_pairs[3][3][2]; -extern const Word32 one_by_q_level[64]; /*----------------------------------------------------------------------* * PCA ROM tables @@ -254,8 +220,6 @@ extern const int16_t Param_MC_index[MAX_CICP_CHANNELS]; extern const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS]; extern const float ivas_param_mc_quant_ild_5d1_48[PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; extern const float ivas_param_mc_quant_icc[PARAM_MC_SZ_ICC_QUANTIZER]; -extern const Word16 ivas_param_mc_quant_ild_5d1_48_fx[PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; -extern const Word16 ivas_param_mc_quant_icc_fx[PARAM_MC_SZ_ICC_QUANTIZER]; extern const uint16_t ivas_param_mc_cum_freq_ild_cicp6_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1]; extern const uint16_t ivas_param_mc_sym_freq_ild_cicp6_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; extern const uint16_t ivas_param_mc_cum_freq_ild_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; @@ -301,14 +265,6 @@ extern const int16_t bits_direction_masa[DIRAC_DIFFUSE_LEVELS]; extern const int16_t no_theta_masa[NO_SPHERICAL_GRIDS - 2]; extern const int16_t no_phi_masa[NO_SPHERICAL_GRIDS][MAX_NO_THETA]; -#ifdef IVAS_FLOAT_FIXED -extern const Word32 no_phi_masa_inv_fx[NO_SPHERICAL_GRIDS][MAX_NO_THETA]; -extern const Word32 azimuth_cb_fx[8]; -extern const Word32 delta_theta_masa_fx[NO_SPHERICAL_GRIDS - 2]; -extern const Word32 coherence_cb0_masa_fx[DIRAC_DIFFUSE_LEVELS * 2 * MASA_NO_CV_COH]; -extern const Word32 coherence_cb1_masa_fx[MASA_NO_CV_COH1 * MASA_MAXIMUM_CODING_SUBBANDS]; /* 25 */ -#endif - extern const float delta_theta_masa[NO_SPHERICAL_GRIDS - 2]; extern const float azimuth_cb[8]; @@ -356,30 +312,9 @@ extern const float ls_azimuth_CICP16[9]; extern const float ls_elevation_CICP16[9]; extern const float ls_azimuth_CICP19[11]; extern const float ls_elevation_CICP19[11]; -#ifdef IVAS_FLOAT_FIXED -extern const Word16 ls_azimuth_CICP2_idx[2]; -extern const Word16 ls_elevation_CICP2_idx[2]; -extern const Word16 ls_azimuth_CICP6_idx[5]; -extern const Word16 ls_elevation_CICP6_idx[5]; -extern const Word16 ls_azimuth_CICP12_idx[7]; -extern const Word16 ls_elevation_CICP12_idx[7]; -extern const Word16 ls_azimuth_CICP14_idx[7]; -extern const Word16 ls_elevation_CICP14_idx[7]; -extern const Word16 ls_azimuth_CICP16_idx[9]; -extern const Word16 ls_elevation_CICP16_idx[9]; -extern const Word16 ls_azimuth_CICP19_idx[11]; -extern const Word16 ls_elevation_CICP19_idx[11]; extern const float shoebox_sin_cos_tbl[11][2]; -extern const Word32 shoebox_sin_cos_tbl_fx[11][2]; -#endif extern const float cb_azi_chan[]; -extern const Word32 delta_phi_val[90]; -extern const Word32 inv_delta_phi_val[90]; -extern const Word32 dd_val[90]; -#ifdef IVAS_FLOAT_FIXED -extern const Word32 cb_azi_chan_fx[]; -#endif extern const float McMASA_LFEGain_vectors[64]; @@ -393,12 +328,6 @@ extern const float dct5[]; extern const float dct8[]; extern const float dct12[]; -#ifdef IVAS_FLOAT_FIXED -extern const Word32 dct4_fx[]; -extern const Word32 dct5_fx[]; -extern const Word32 dct8_fx[]; -extern const Word32 dct12_fx[]; -#endif /*----------------------------------------------------------------------------------* * ISM ROM tables *----------------------------------------------------------------------------------*/ @@ -406,11 +335,6 @@ extern const Word32 dct12_fx[]; extern const float ism_azimuth_borders[4]; extern const float ism_elevation_borders[4]; -#ifdef IVAS_FLOAT_FIXED -extern const Word32 ism_azimuth_borders_fx[4]; -extern const Word32 ism_elevation_borders_fx[4]; -#endif - /*----------------------------------------------------------------------------------* * Param ISM ROM tables *----------------------------------------------------------------------------------*/ @@ -428,27 +352,10 @@ extern const float ivas_lpf_2_butter_16k[IVAS_BIQUAD_FILT_LEN << 1]; extern const float ivas_lpf_2_butter_32k[IVAS_BIQUAD_FILT_LEN << 1]; extern const float ivas_lpf_2_butter_48k[IVAS_BIQUAD_FILT_LEN << 1]; -#ifdef IVAS_FLOAT_FIXED -extern const Word32 ivas_lpf_4_butter_16k_sos_fx[IVAS_BIQUAD_FILT_LEN << 2]; -extern const Word32 ivas_lpf_4_butter_32k_sos_fx[IVAS_BIQUAD_FILT_LEN << 2]; -extern const Word32 ivas_lpf_4_butter_48k_sos_fx[IVAS_BIQUAD_FILT_LEN << 2]; -extern const Word32 ivas_lpf_2_butter_16k_fx[IVAS_BIQUAD_FILT_LEN << 1]; -extern const Word32 ivas_lpf_2_butter_32k_fx[IVAS_BIQUAD_FILT_LEN << 1]; -extern const Word32 ivas_lpf_2_butter_48k_fx[IVAS_BIQUAD_FILT_LEN << 1]; -#endif - - extern const float ivas_lfe_window_coeff_48k[IVAS_LFE_FADE_LEN_48K]; extern const float ivas_lfe_window_coeff_32k[IVAS_LFE_FADE_LEN_32K]; extern const float ivas_lfe_window_coeff_16k[IVAS_LFE_FADE_LEN_16K]; -#ifdef IVAS_FLOAT_FIXED -extern const Word32 ivas_lfe_window_coeff_48k_fx[IVAS_LFE_FADE_LEN_48K]; -extern const Word32 ivas_lfe_window_coeff_32k_fx[IVAS_LFE_FADE_LEN_32K]; -extern const Word32 ivas_lfe_window_coeff_16k_fx[IVAS_LFE_FADE_LEN_16K]; -#endif - - extern const int16_t ivas_lfe_num_ele_in_coder_models[2][4]; extern const Word16 ivas_lfe_log2_num_ele_in_coder_models_fx[2][4]; extern const int16_t ivas_lfe_num_dct_pass_bins_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP]; @@ -456,11 +363,7 @@ extern const int16_t ivas_lfe_min_shift_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP]; extern const ivas_lfe_freq_models ivas_str_lfe_freq_models; extern const float ivas_lfe_lpf_delay[2]; extern const Word16 ivas_lfe_lpf_delay_Q15[2]; -#ifdef IVAS_FLOAT_FIXED -extern const UWord32 d_hamm_lfe_plc_fx[LFE_PLC_LENANA / 2]; -#else extern const double d_hamm_lfe_plc[LFE_PLC_LENANA / 2]; -#endif extern const float ivas_sin_twiddle_480[IVAS_480_PT_LEN >> 1]; extern const float ivas_cos_twiddle_480[IVAS_480_PT_LEN >> 1]; extern const float ivas_sin_twiddle_320[IVAS_320_PT_LEN >> 1]; @@ -482,27 +385,11 @@ extern const float ivas_mdft_coeff_cos_twid_40[IVAS_40_PT_LEN + 1]; extern const float ivas_mdft_coeff_cos_twid_960[IVAS_960_PT_LEN + 1]; extern const float ivas_mdft_coeff_cos_twid_640[IVAS_640_PT_LEN + 1]; extern const float ivas_mdft_coeff_cos_twid_320[IVAS_320_PT_LEN + 1]; -#ifdef IVAS_FLOAT_FIXED -extern const Word32 ivas_mdft_coeff_cos_twid_240_fx[IVAS_240_PT_LEN + 1]; -extern const Word32 ivas_mdft_coeff_cos_twid_160_fx[IVAS_160_PT_LEN + 1]; -extern const Word32 ivas_mdft_coeff_cos_twid_120_fx[IVAS_120_PT_LEN + 1]; -extern const Word32 ivas_mdft_coeff_cos_twid_80_fx[IVAS_80_PT_LEN + 1]; -extern const Word32 ivas_mdft_coeff_cos_twid_40_fx[IVAS_40_PT_LEN + 1]; -extern const Word32 ivas_mdft_coeff_cos_twid_960_fx[IVAS_960_PT_LEN + 1]; -extern const Word32 ivas_mdft_coeff_cos_twid_640_fx[IVAS_640_PT_LEN + 1]; -extern const Word32 ivas_mdft_coeff_cos_twid_320_fx[IVAS_320_PT_LEN + 1]; -#endif extern const int16_t dirac_gains_P_idx[16]; extern const float dirac_gains_norm_term[9]; extern const float dirac_gains_Pnm[91][9]; extern const float dirac_gains_trg_term[181][2]; -#ifdef IVAS_FLOAT_FIXED -extern const Word32 dirac_gains_norm_term_int[9]; -extern const Word32 dirac_gains_norm_term_fx[9]; -extern const Word32 dirac_gains_Pnm_int[91][9]; -extern const Word32 dirac_gains_trg_term_int[181][2]; -extern const Word32 dirac_gains_trg_term_fx[181][2]; -#endif + /*------------------------------------------------------------------------------------------* * FB ROM tables *------------------------------------------------------------------------------------------*/ @@ -525,23 +412,9 @@ extern const float ivas_fb_cf_1ms_32k[IVAS_FB_1MS_32K_SAMP]; extern const float ivas_fb_cf_4ms_16k[IVAS_FB_4MS_16K_SAMP]; extern const float ivas_fb_cf_1ms_16k[IVAS_FB_1MS_16K_SAMP]; -#ifdef IVAS_FLOAT_FIXED -extern const Word16 ivas_fb_cf_4ms_48k_fx[IVAS_FB_4MS_48K_SAMP]; -extern const Word16 ivas_fb_cf_1ms_48k_fx[IVAS_FB_1MS_48K_SAMP]; -extern const Word16 ivas_fb_cf_4ms_32k_fx[IVAS_FB_4MS_32K_SAMP]; -extern const Word16 ivas_fb_cf_1ms_32k_fx[IVAS_FB_1MS_32K_SAMP]; -extern const Word16 ivas_fb_cf_4ms_16k_fx[IVAS_FB_4MS_16K_SAMP]; -extern const Word16 ivas_fb_cf_1ms_16k_fx[IVAS_FB_1MS_16K_SAMP]; -#endif - extern const float ivas_fb_resp_cheby_ramp_32del[IVAS_FB_1MS_32K_SAMP + 1]; extern const float ivas_fb_resp_cheby_ramp_16del[IVAS_FB_1MS_16K_SAMP + 1]; -#ifdef IVAS_FLOAT_FIXED -extern const Word32 ivas_fb_resp_cheby_ramp_32del_fx[IVAS_FB_1MS_32K_SAMP + 1]; -extern const Word32 ivas_fb_resp_cheby_ramp_16del_fx[IVAS_FB_1MS_16K_SAMP + 1]; -#endif - extern const int16_t ivas_num_active_bands[FB - WB + 1]; /*------------------------------------------------------------------------------------------* @@ -556,10 +429,6 @@ extern const int16_t ivas_sns_cdbks_tcx10_bits[]; extern const float *const ivas_sns_cdbks_tcx20[]; extern const float *const ivas_sns_cdbks_tcx10[]; -#ifdef IVAS_FLOAT_FIXED -extern const Word16 *const ivas_sns_cdbks_tcx20_fx[]; -extern const Word16 *const ivas_sns_cdbks_tcx10_fx[]; -#endif extern const int16_t ivas_sns_cdbks_side_tcx20_levels[]; extern const int16_t ivas_sns_cdbks_side_tcx20_bits[]; @@ -568,10 +437,6 @@ extern const int16_t ivas_sns_cdbks_side_tcx10_bits[]; extern const float *const ivas_sns_cdbks_side_tcx20[]; extern const float *const ivas_sns_cdbks_side_tcx10[]; -#ifdef IVAS_FLOAT_FIXED -extern const Word16 *const ivas_sns_cdbks_side_tcx20_fx[]; -extern const Word16 *const ivas_sns_cdbks_side_tcx10_fx[]; -#endif /* means and codebooks for the split VQ in the 2-stage SNS VQ */ extern const int16_t sns_1st_cdbk[2][2][8 * 32]; @@ -588,24 +453,5 @@ extern const int16_t ivas_param_upmx_mx_qmap[33]; extern const ACPL_QUANT_TABLE ivas_mc_paramupmix_alpha_quant_table; extern const ACPL_QUANT_TABLE ivas_mc_paramupmix_beta_quant_table[9]; -#ifdef IVAS_FLOAT_FIXED -extern const ACPL_QUANT_TABLE_FX ivas_mc_paramupmix_alpha_quant_table_fx; -extern const ACPL_QUANT_TABLE_FX ivas_mc_paramupmix_beta_quant_table_fx[9]; -#endif // IVAS_FLOAT_FIXED - -#ifdef IVAS_FLOAT_FIXED -extern const Word32 ivas_han_win_48k_fx[L_FRAME32k]; -extern const Word32 ivas_han_win_32k_fx[L_FRAME32k]; -extern const Word32 ivas_han_win_16k_fx[L_FRAME32k]; - -extern const Word32 ivas_sine_delay_32_fx[32]; - -extern const Word32 ivas_sine_frame_len_640_del_32_fx[577]; -extern const Word32 ivas_sine_frame_len_640_del_16_fx[289]; - -extern const Word32 ivas_fb_fr_12band_1ms_re_fx[IVAS_FB_12_1MS_LEN]; -extern const Word32 ivas_fb_fr_12band_1ms_im_fx[IVAS_FB_12_1MS_LEN]; -#endif - /* IVAS_ROM_COM_H */ #endif diff --git a/lib_com/ivas_rom_com_fx.c b/lib_com/ivas_rom_com_fx.c index 0570d4f3c3f4af6beb991ece86efb194c7d80d11..31e156bcd5ff2e7767df5db1a44031a18cfe763c 100644 --- a/lib_com/ivas_rom_com_fx.c +++ b/lib_com/ivas_rom_com_fx.c @@ -1244,4 +1244,3732 @@ const Masa_Diffuseness_Ratios masa_diffuse_ratios[DIRAC_DIFFUSE_LEVELS][DIRAC_DI }; #endif +/*----------------------------------------------------------------------------------* + * Stereo ICA ROM tables + *----------------------------------------------------------------------------------*/ + +const Word32 ica_sincInterp2_fx[2 * SINC_ORDER1 + 1] = { + 0, -4988604, 0, 7486127, 0, + -12594991, 0, 20905753, 0, -33172179, 0, + 50472307, 0, -74575663, 0, 108767895, 0, + -160155039, 0, 247433071, 0, -439753119, 0, + 1361749503, 2147483647, 1361749503, 0, -439753119, 0, + 247433071, 0, -160155039, 0, 108767895, 0, + -74575663, 0, 50472307, 0, -33172179, 0, + 20905753, 0, -12594991, 0, 7486127, 0, + -4988604, 0 +}; + +/*----------------------------------------------------------------------------------* + * Stereo IC-BWE ROM tables + *----------------------------------------------------------------------------------*/ + +// Q14 +const Word16 pow_10_icbwe_gsMapping_tbl_fx[16] = { + 164, 733, 1793, 3195, 4524, 5875, 7438, 9155, 11101, 13053, 13945, 14602, 15647, 16384, + 17965, 19698 +}; + +// Q14 +const Word16 pow_10_icbwe_gsMappingDFT_tbl_fx[128] = { + 0, 1, 2, 5, 16, 52, 206, 464, 518, 585, 667, 688, 803, 899, + 1324, 1349, 1513, 1534, 1578, 1625, 1711, 1756, 1808, 1879, 1926, 2001, 2050, 2130, + 2191, 2280, 2366, 2394, 2456, 2574, 2643, 2726, 2796, 2850, 2869, 2908, 2962, 2991, + 3023, 3051, 3091, 3130, 3202, 3233, 3268, 3342, 3388, 3429, 3483, 3519, 3553, 3595, + 3651, 3706, 3738, 3795, 3844, 3890, 3946, 3990, 4028, 4075, 4119, 4166, 4214, 4259, + 4303, 4350, 4389, 4441, 4481, 4540, 4605, 4684, 4764, 4854, 4950, 5068, 5198, 5348, + 5519, 5692, 5881, 6073, 6273, 6473, 6676, 6883, 7124, 7364, 7616, 7852, 8097, 8370, + 8630, 8916, 9200, 9496, 9866, 10252, 10652, 11052, 11436, 11813, 12247, 12697, 13153, 13611, + 14072, 14503, 14936, 15336, 15702, 16032, 16384, 16664, 16980, 17253, 17550, 17866, 18206, 18594, + 19072, 19631 +}; + +/*----------------------------------------------------------------------------------* + * TD Stereo ROM tables + *----------------------------------------------------------------------------------*/ + +const UWord32 tdm_ratio_tabl_fx[TDM_NQ + 1] = { + 0, 0, 23407572, 52613348, 92771296, + 143881408, 205084688, 275736896, 355193792, 442596384, 536870912, + 636943680, 741955584, 850403520, 961428416, 1073741824, 1186055168, + 1297080064, 1405528064, 1510540032, 1610612736, 1704887296, 1792289792, + 1871746688, 1942398976, 2003602304, 2054712320, 2094870272, 2124076032, + 2147483647, 2147483647, 2147483647 +}; + +const UWord32 tdm_den_ratio_tabl_fx[TDM_NQ + 1] = { + 1073741824, 1073741824, 1097471488, 1127536256, 1170593280, + 1227179520, 1297939072, 1383409024, 1483374336, 1596009856, 1717986944, + 1842648320, 1960330496, 2058470400, 2124290816, 2147483647, 2124290816, + 2058470400, 1960330496, 1842648320, 1717986944, 1596009856, 1483374336, + 1383409024, 1297939072, 1227179520, 1170593280, 1127536256, 1097471488, + 1073741824, 1073741824, 1073741824 +}; + +/* LSFs Intra-frame prediction tables */ + +// 2.56 +const Word16 tdm_LSF_MEAN_RE_USE_OUT_fx[M] = { + 771, 1335, 2229, 3431, 4383, 5354, 6371, 7273, 8183, 9198, 10133, 10991, 12058, 13104, 14200, 15152 +}; + +// 2.56 +const Word16 tdm_LSF_MEAN_RE_USE_IN_fx[M] = { + 733, + 1337, + 2271, + 3451, + 4418, + 5382, + 6430, + 7304, + 8221, + 9247, + 10165, + 11079, + 12115, + 13197, + 14266, + 15269, +}; + +// 2.56 +const Word16 tdm_LSF_MEAN_RE_USE_fx[M] = { + 680, 1369, 2354, 3448, 4498, 5435, 6546, 7494, 8446, 9437, 10328, 11248, 12241, 13199, 14189, 15174 +}; + +// Q15 +const Word16 tdm_Beta_Q1bit_re_use_13k2_fx[2] = { 31784, 24576 }; + +// Q15 +const Word16 tdm_Beta_Q1bit_re_use_16k4_fx[2] = { 31129, 23265 }; + +// Q15 +const Word16 tdm_Beta_Q1bit_re_use_24k4_32k_fx[2] = { 30474, 23920 }; + +// Q15 +const Word16 tdm_Beta_Q1bit_re_use_48k_fx[2] = { 31784, 25231 }; + +// Q15 +const Word16 tdm_RE_USE_adaptive_beta_prd_diag_3_fx[15 + 16 + 15] = { + 29028, 6750, 1916, 27016, 7516, 1195, 26787, 5557, -196, 27796, 6753, 2172, 29434, 4446, 2175, 26053, 6337, 3063, 26043, 5521, 3633, 26082, + 5989, 3515, 25672, 5911, 4846, 24123, 6494, 4374, 24971, 6225, 6235, 24146, 5619, 5848, 23638, 5393, 6445, 22579, 4027, 6694, 20698, 1779, + 5789, 17681 +}; + +// 2.56 +const Word16 tdm_LSF_MEAN_PRED_QNT_fx[M] = { + 1002, 1558, 2478, 3467, 4377, 5326, 6274, 7160, 8182, 9099, 10022, 10967, 12051, 13081, 14148, 15113 +}; + +// 2.56 +const Word16 tdm_LSF_MEAN_PRED_QNT_IN_fx[M] = { + 739, 1371, 2303, 3436, 4431, 5394, 6378, 7321, 8293, 9282, 10221, 11153, 12166, 13193, 14252, 15290 +}; + +// 2.56 +const Word16 tdm_LSF_MEAN_PRED_QNT_OUT_fx[M] = { + 733, 1337, 2271, 3451, 4418, 5382, 6430, 7304, 8221, 9247, 10165, 11079, 12115, 13197, 14266, 15269 +}; + +// Q15 +const Word16 tdm_PRED_QNT_fixed_beta_prd_diag_3_fx[15 + 16 + 15] = { + 23067, 3941, -3666, 24050, 5907, 829, 21960, 6229, -6052, 25859, 9862, -1369, 28559, 6019, 108, 22658, 7844, 697, 22045, 7998, 2310, 24735, + 6497, 2464, 23434, 7120, 2903, 20194, 10049, 711, 26610, 6622, 5190, 23955, 5721, 3945, 23906, 6481, 4033, 24581, 4043, 5599, 20879, 3473, + 3909, 21541 +}; + +/*----------------------------------------------------------------------------------* + * Stereo DTX ROM tables + *----------------------------------------------------------------------------------*/ + +/*Q-13*/ +const Word16 dft_cng_coh_pred_fx[STEREO_DFT_N_COH_PRED][STEREO_DFT_COH_PRED_COEFFS] = { + { 4926, -827, 10396, 696, 2285, 5488, 668, 1547, -1416, 2633, 76, -690, 2967, -3495, 6212 }, + { 7007, 3446, 3385, -76, -3274, 11352, 101, -125, 1281, 4238, 1312, -2487, 3913, -4593, 11326 }, + { 1659, 399, 2157, 192, 753, 3241, 107, -91, 290, 7995, 81, 1334, 3139, -2994, 20764 }, + { 11416, -1076, 8105, 6048, 5602, 13, -1846, -99, 8885, -945, 183, -373, -2754, 3463, 4089 } +}; + +/*Q-15*/ +const Word16 dft_cng_alpha_bits_fx[STEREO_DFT_N_COH_ALPHA_STEPS][STEREO_DFT_N_COH_ALPHA_LEVELS] = { + { 3277 /*0.1f*/, 19661 /*0.6f*/ }, + { 3277 /*0.1f*/, 19661 /*0.6f*/ }, + { 3277 /*0.1f*/, 22938 /*0.7f*/ }, + { 3277 /*0.1f*/, 29491 /*0.9f*/ }, + { 6554 /*0.2f*/, 29491 /*0.9f*/ } +}; + +/*----------------------------------------------------------------------------------* + * DirAC ROM tables + *----------------------------------------------------------------------------------*/ + +// q = 30 +const Word32 diffuseness_reconstructions_fx[DIRAC_DIFFUSE_LEVELS] = { + 0, 42467328, 96206848, 170655744, 331087872, 508821504, 678952960, 912785408 +}; + +const Word32 diffuseness_thresholds_fx[DIRAC_DIFFUSE_LEVELS + 1] = { + 0, + 20447232, + 67633152, + 128188416, + 237502464, + 428605440, + 587988992, + 788791296, + MAX_32 /* out-of-range large value to make searching easier */ +}; + +/*------------------------------------------------------------------------------------------* + * SPAR ROM tables + *------------------------------------------------------------------------------------------*/ + +const Word32 dtx_pd_real_min_max_fx[2] = { + 0, 429496729 +}; + +const Word32 one_by_q_level[64] = { + 0, 2147483647, 1073741824, 715827904, 536870912, 429496736, + 357913952, 306783392, 268435456, 238609296, 214748368, + 195225792, 178956976, 165191056, 153391696, 143165584, + 134217728, 126322568, 119304648, 113025456, 107374184, + 102261128, 97612896, 93368856, 89478488, 85899344, + 82595528, 79536432, 76695848, 74051160, 71582792, + 69273664, 67108864, 65075264, 63161284, 61356676, + 59652324, 58040100, 56512728, 55063684, 53687092, + 52377648, 51130564, 49941480, 48806448, 47721860, + 46684428, 45691140, 44739244, 43826196, 42949672, + 42107524, 41297764, 40518560, 39768216, 39045156, + 38347924, 37675152, 37025580, 36398028, 35791396, + 35204648, 34636832, 34087044 +}; + +/*----------------------------------------------------------------------------------* + * Parametric MC ROM tables + *----------------------------------------------------------------------------------*/ + +// Q8 +const Word16 ivas_param_mc_quant_ild_5d1_48_fx[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] = { + -25600, -5120, -3328, -2560, -2048, -1408, -896, -384, 0, 384, 896, 1408, 2048, 2560, 3328, 5120 +}; + +// Q15 +const Word16 ivas_param_mc_quant_icc_fx[PARAM_MC_SZ_ICC_QUANTIZER] = { + -32440, -19300, 0, 12046, 19690, 27563, 30703, 32767 +}; + +/*----------------------------------------------------------------------------------* + * MASA ROM tables + *----------------------------------------------------------------------------------*/ + +/* from 1 to 11 bits*/ /*q factor = 8*/ +const Word32 no_phi_masa_inv_fx[NO_SPHERICAL_GRIDS][MAX_NO_THETA] = { + { 1073741824 }, + { 536870912 }, + { 536870912, 1073741824 }, + { 268435456, 536870912 }, + { 178956970, 306783378, 1073741824, 2147483647 }, + { 153391689, 165191049, 238609294, 1073741824, 2147483647 }, + { 97612893, 102261126, 126322567, 195225786, 715827882, 2147483647 }, + { 65075262, 67108864, 74051160, 93368854, 126322567, 238609294, 2147483647 }, + { 44739242, 45691141, 47721858, 52377649, 61356675, 76695844, 107374182, 178956970, 1073741824, 2147483647 }, + { 35791394, 35791394, 37025580, 38347922, 39768215, 42949672, 46684427, 52377649, 59652323, 71582788, 93368854, 126322567, 214748364, 2147483647 }, + { 24129029, 24129029, 24403223, 24970740, 25565281, 26512143, 27889398, 29417584, 31580641, 34087042, 37675151, 42107522, 48806446, 56512727, 71582788, 93368854, 143165576, 268435456, 2147483647 } +}; + +const Word32 azimuth_cb_fx[8] = { + 0, -754974720, -377487360, 377487360, -188743680, 188743680, -566231040, 566231040 +}; + +const Word32 delta_theta_masa_fx[NO_SPHERICAL_GRIDS - 2] = { + 188743680, 188743680, 150994944, 106954752, 83886080, 62914560, 45214596, 28101836, 20971520 +}; + +// q = 21 +const Word32 coherence_cb0_masa_fx[DIRAC_DIFFUSE_LEVELS * 2 * MASA_NO_CV_COH] = { + 100243, 534144, 1156579, 2068840, 2846464, 3531184, 4125936, 0, 253965, 864655, 1467377, + 2129448, 2977326, 3768791, 0, 0, 338480, 1189924, 2035915, 2872888, 3640026, 0, 0, 0, + 492621, 1532179, 2527278, 3470157, 0, 0, 0, 0, 499331, 1506803, 2465831, 3425697, 0, + 0, 0, 0, 503316, 1473668, 2392221, 3406404, 0, 0, 0, 0, 737778, 1970903, 3450654, 0, 0, + 0, 0, 0, 2097152, 0, 0, 0, 0, 0, 0, 0, 303038, 719742, 1122186, 1577897, 2117075, 2770337, + 3648834, 0, 419849, 932603, 1440533, 2011797, 2745172, 3571240, 0, 0, 548824, 1165177, + 1812987, 2555379, 3366138, 0, 0, 0, 695835, 1428160, 2190475, 3084910, 0, 0, 0, 0, 697093, + 1381603, 2092957, 2970406, 0, 0, 0, 0, 708417, 1396283, 2099039, 2992426, 0, 0, 0, 0, 835924, + 1728892, 2836607, 0, 0, 0, 0, 0, 2097152, 0, 0, 0, 0, 0, 0, 0 +}; + +// q = 21 +const Word32 coherence_cb1_masa_fx[MASA_NO_CV_COH1 * MASA_MAXIMUM_CODING_SUBBANDS] = { + -3984, 544630, -565392, 1314704, -1320157, -11534, 541484, -583847, 1357486, -1371118, + -6081, 525546, -551551, 1362729, -1371537, -838, 533934, -540855, 1436758, -1414109, + 3565, 528692, -519883, 1513514, -1500931 +}; + +/* Multi-channel input and output setups */ +const int16_t ls_azimuth_CICP2_idx[2] = { 1, 2 }; +const int16_t ls_elevation_CICP2_idx[2] = { 0, 0 }; + +const int16_t ls_azimuth_CICP6_idx[5] = { 1, 2, 0, 7, 8 }; +const int16_t ls_elevation_CICP6_idx[5] = { 0, 0, 0, 0, 0 }; + +const int16_t ls_azimuth_CICP12_idx[7] = { 1, 2, 0, 7, 8, 9, 10 }; +const int16_t ls_elevation_CICP12_idx[7] = { 0, 0, 0, 0, 0, 0, 0 }; + +const int16_t ls_azimuth_CICP14_idx[7] = { 1, 2, 0, 7, 8, 1, 2 }; +const int16_t ls_elevation_CICP14_idx[7] = { 0, 0, 0, 0, 0, 3, 4 }; + +const int16_t ls_azimuth_CICP16_idx[9] = { 1, 2, 0, 7, 8, 1, 2, 7, 8 }; +const int16_t ls_elevation_CICP16_idx[9] = { 0, 0, 0, 0, 0, 3, 3, 3, 3 }; + +const int16_t ls_azimuth_CICP19_idx[11] = { 1, 2, 0, 9, 10, 5, 6, 1, 2, 9, 10 }; +const int16_t ls_elevation_CICP19_idx[11] = { 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3 }; + +const Word32 shoebox_sin_cos_tbl_fx[11][2] = { { 0, 1073741824 }, // 0 + { 536870912, 929887680 }, + { -536870912, 929887680 }, // 30, -30 + { 615873024, 879557824 }, + { -615873024, 879557824 }, // 35, -35 + { 1073741824, 0 }, + { -1073741824, 0 }, // 90, -90 + { 1008987264, -367241312 }, + { -1008987264, -367241312 }, // 110,-110 + { 759250112, -759250112 }, + { -759250112, -759250112 } }; // 135, -135 //Q.30 + +const Word32 delta_phi_val[90] = { + 0, 1509949440, 754974720, 503316480, 377487360, 301989888, + 251658240, 215707056, 188743680, 167772160, 150994944, + 137268128, 125829120, 116149960, 107853528, 100663296, + 94371840, 88820552, 83886080, 79471024, 75497472, + 71902352, 68634064, 65649976, 62914560, 60397976, + 58074980, 55924052, 53926764, 52067224, 50331648, + 48708048, 47185920, 45756044, 44410276, 43141412, + 41943040, 40809444, 39735512, 38716652, 37748736, + 36828036, 35951176, 35115104, 34317032, 33554432, + 32824988, 32126584, 31457280, 30815294, 30198988, + 29606852, 29037490, 28489612, 27962026, 27453626, + 26963382, 26490342, 26033612, 25592364, 25165824, + 24753270, 24354024, 23967452, 23592960, 23229992, + 22878022, 22536558, 22205138, 21883326, 21570706, + 21266894, 20971520, 20684238, 20404722, 20132660, + 19867756, 19609732, 19358326, 19113284, 18874368, + 18641352, 18414018, 18192162, 17975588, 17764112, + 17557552, 17355740, 17158516, 16965724 +}; + +const Word32 inv_delta_phi_val[90] = { + 0, 5965232, 11930464, 17895697, 23860929, 29826161, + 35791394, 41756626, 47721858, 53687091, 59652323, + 65617555, 71582788, 77548020, 83513252, 89478485, + 95443717, 101408950, 107374182, 113339414, 119304647, + 125269879, 131235111, 137200344, 143165576, 149130808, + 155096041, 161061273, 167026505, 172991738, 178956970, + 184922203, 190887435, 196852667, 202817900, 208783132, + 214748364, 220713597, 226678829, 232644061, 238609294, + 244574526, 250539758, 256504991, 262470223, 268435456, + 274400688, 280365920, 286331153, 292296385, 298261617, + 304226850, 310192082, 316157314, 322122547, 328087779, + 334053011, 340018244, 345983476, 351948708, 357913941, + 363879173, 369844406, 375809638, 381774870, 387740103, + 393705335, 399670567, 405635800, 411601032, 417566264, + 423531497, 429496729, 435461961, 441427194, 447392426, + 453357659, 459322891, 465288123, 471253356, 477218588, + 483183820, 489149053, 495114285, 501079517, 507044750, + 513009982, 518975214, 524940447, 530905679 +}; + +const Word32 dd_val[90] = { + 0, 754974720, 377487360, 251658240, 188743680, 150994944, + 125829120, 107853528, 94371840, 83886080, 75497472, + 68634064, 62914560, 58074980, 53926764, 50331648, + 47185920, 44410276, 41943040, 39735512, 37748736, + 35951176, 34317032, 32824988, 31457280, 30198988, + 29037490, 27962026, 26963382, 26033612, 25165824, + 24354024, 23592960, 22878022, 22205138, 21570706, + 20971520, 20404722, 19867756, 19358326, 18874368, + 18414018, 17975588, 17557552, 17158516, 16777216, + 16412494, 16063292, 15728640, 15407647, 15099494, + 14803426, 14518745, 14244806, 13981013, 13726813, + 13481691, 13245171, 13016806, 12796182, 12582912, + 12376635, 12177012, 11983726, 11796480, 11614996, + 11439011, 11268279, 11102569, 10941663, 10785353, + 10633447, 10485760, 10342119, 10202361, 10066330, + 9933878, 9804866, 9679163, 9556642, 9437184, + 9320676, 9207009, 9096081, 8987794, 8882056, + 8778776, 8677870, 8579258, 8482862 +}; + +const Word32 cb_azi_chan_fx[] = { 0, 125829120, 461373440, 566231040 }; + +/*----------------------------------------------------------------------------------* + * MASA and ISM (OMASA) combined format ROM tables + *----------------------------------------------------------------------------------*/ + +const Word32 dct4_fx[4 * 4] = { + 1073741824, 1402951040, 1073741824, 581109056, + 1073741824, 581109056, -1073741824, -1402951040, + 1073741824, -581109056, -1073741824, 1402951040, + 1073741824, -1402951040, 1073741824, -581109056 +}; + +const Word32 dct5_fx[5 * 5] = { + 960354688, 1291711360, 1098867328, 798219648, 419618304, + 960354688, 798219648, -419618304, -1291711360, -1098867328, + 960354688, 0, -1358283392, 0, 1358283392, + 960354688, -798219648, -419618304, 1291711360, -1098867328, + 960354688, -1291711360, 1098867328, -798219648, 419618304 +}; + +const Word32 dct8_fx[8 * 8] = { + 759350208, 1053125952, 991922688, 892708928, 759350208, 596570944, 410813632, 209379648, + 759350208, 892708928, 410813632, -209379648, -759350208, -1053125952, -991922688, -596570944, + 759350208, 596570944, -410813632, -1053125952, -759350208, 209379648, 991922688, 892708928, + 759350208, 209379648, -991922688, -596570944, 759350208, 892708928, -410813632, -1053125952, + 759350208, -209379648, -991922688, 596570944, 759350208, -892708928, -410813632, 1053125952, + 759350208, -596570944, -410813632, 1053125952, -759350208, -209379648, 991922688, -892708928, + 759350208, -892708928, 410813632, 209379648, -759350208, 1053125952, -991922688, 596570944, + 759350208, -1053125952, 991922688, -892708928, 759350208, -596570944, 410813632, -209379648 +}; + +const Word32 dct12_fx[12 * 12] = { + 619978560, 869301376, 846752832, 810030848, 759350208, 695569984, 619978560, 533649696, 438301408, 335436960, 226989024, 114460880, + 619978560, 810030848, 619978560, 335436960, 0, -335436960, -619978560, -810030848, -876602816, -810030848, -619978560, -335436960, + 619978560, 695569984, 226989024, -335436960, -759350208, -869301376, -619978560, -114460880, 438301408, 810030848, 846752832, 533649696, + 619978560, 533649696, -226989024, -810030848, -759350208, -114460880, 619978560, 869301376, 438301408, -335436960, -846752832, -695569984, + 619978560, 335436960, -619978560, -810030848, 0, 810030848, 619978560, -335436960, -876602816, -335436960, 619978560, 810030848, 619978560, + 114460880, -846752832, -335436960, 759350208, 533649696, -619978560, -695569984, 438301408, 810030848, -226989024, -869301376, 619978560, + -114460880, -846752832, 335436960, 759350208, -533649696, -619978560, 695569984, 438301408, -810030848, -226989024, 869301376, 619978560, + -335436960, -619978560, 810030848, 0, -810030848, 619978560, 335436960, -876602816, 335436960, 619978560, -810030848, 619978560, -533649696, + -226989024, 810030848, -759350208, 114460880, 619978560, -869301376, 438301408, 335436960, -846752832, 695569984, 619978560, -695569984, + 226989024, 335436960, -759350208, 869301376, -619978560, 114460880, 438301408, -810030848, 846752832, -533649696, 619978560, -810030848, + 619978560, -335436960, 0, 335436960, -619978560, 810030848, -876602816, 810030848, -619978560, 335436960, 619978560, -869301376, 846752832, + -810030848, 759350208, -695569984, 619978560, -533649696, 438301408, -335436960, 226989024, -114460880 +}; + +/*----------------------------------------------------------------------------------* + * ISM ROM tables + *----------------------------------------------------------------------------------*/ + +const Word32 ism_azimuth_borders_fx[4] = { + ISM_AZIMUTH_MIN_FX, ISM_AZIMUTH_LOW_BORDER_FX, ISM_AZIMUTH_HIGH_BORDER_FX, ISM_AZIMUTH_MAX_FX +}; + +const Word32 ism_elevation_borders_fx[4] = { + ISM_ELEVATION_MIN_FX, ISM_ELEVATION_LOW_BORDER_FX, ISM_ELEVATION_HIGH_BORDER_FX, ISM_ELEVATION_MAX_FX +}; + +/*----------------------------------------------------------------------------------* + * LFE coding ROM tables + *----------------------------------------------------------------------------------*/ + +const Word32 ivas_lpf_4_butter_16k_sos_fx[IVAS_BIQUAD_FILT_LEN << 2] = { + 0x1ab, 0x356, 0x1ab, 0x40000000, + 0x85ec0b80, 0x3a3cb940, 0x40000000, 0x7fffffff, + 0x40000000, 0x40000000, 0x829d8180, 0x3d8c5e40 +}; + +const Word32 ivas_lpf_4_butter_32k_sos_fx[IVAS_BIQUAD_FILT_LEN << 2] = { + 0x1c, 0x37, 0x1c, 0x40000000, + 0x82fd4b80, 0x3d0d2280, 0x40000000, 0x7fffffff, + 0x40000000, 0x40000000, 0x81478600, 0x3ec30c00 +}; + +const Word32 ivas_lpf_4_butter_48k_sos_fx[IVAS_BIQUAD_FILT_LEN << 2] = { + 0x6, 0xb, 0x6, 0x40000000, + 0x81ffd700, 0x3e04d500, 0x40000000, 0x7fffff80, + 0x40000000, 0x40000000, 0x80d8b600, 0x3f2c0080 +}; + +const Word32 ivas_lpf_2_butter_16k_fx[IVAS_BIQUAD_FILT_LEN << 1] = { + 0xa4d0c, 0x149a17, 0xa4d0c, 0x40000000, 0x849e6300, 0x3b8ad140 +}; + +const Word32 ivas_lpf_2_butter_32k_fx[IVAS_BIQUAD_FILT_LEN << 1] = { + 0x53e1a, 0x29f0d, 0x40000000, 0x824f6000, 0x3dbb1c80, 0x29f0d +}; + +const Word32 ivas_lpf_2_butter_48k_fx[IVAS_BIQUAD_FILT_LEN << 1] = { + 0x12c07, 0x2580d, 0x12c07, 0x40000000, 0x818a4580, 0x3e7a6a80 +}; + +const Word32 ivas_lfe_window_coeff_48k_fx[IVAS_LFE_FADE_LEN_48K] = { + 0x0003a373, 0x000608f6, 0x000888a7, 0x000b3e1b, 0x000e34f1, 0x001174a2, 0x00150328, 0x0018e5e1, 0x001d21eb, 0x0021bc4d, 0x0026ba09, 0x002c202f, 0x0031f3dc, 0x00383a43, 0x003ef8ad, 0x0046347b, 0x004df325, 0x00563a3f, 0x005f0f74, 0x00687888, 0x00727b59, 0x007d1ddb, 0x0088661c, 0x00945a41, 0x00a10087, 0x00ae5f3d, 0x00bc7ccd, 0x00cb5fb3, 0x00db0e7d, 0x00eb8fd0, 0x00fcea61, 0x010f24f8, 0x0122466a, 0x013655a0, 0x014b598e, 0x01615936, 0x01785ba8, 0x01906800, 0x01a9855e, 0x01c3baf0, 0x01df0fee, 0x01fb8b90, 0x02193514, 0x023813c4, 0x02582ee4, 0x02798db8, 0x029c378c, 0x02c033a4, 0x02e58944, 0x030c3fa8, 0x03345e0c, 0x035deba0, 0x0388ef8c, 0x03b570f0, 0x03e376dc, 0x04130858, 0x04442c58, 0x0476e9b8, 0x04ab4760, 0x04e14c00, 0x0518fe48, 0x055264c8, 0x058d8600, 0x05ca6850, 0x06091200, 0x06498930, 0x068bd3f0, 0x06cff830, 0x0715fba8, 0x075de408, 0x07a7b6c8, 0x07f37940, 0x084130a0, 0x0890e200, 0x08e29220, 0x093645c0, 0x098c0150, 0x09e3c940, 0x0a3da180, 0x0a998e30, 0x0af792e0, 0x0b57b320, 0x0bb9f240, 0x0c1e5360, 0x0c84d940, 0x0ced8690, 0x0d585dc0, 0x0dc560f0, 0x0e349200, 0x0ea5f2b0, 0x0f198450, 0x0f8f4820, 0x10073f00, 0x10816980, 0x10fdc840, 0x117c5b00, 0x11fd21e0, 0x12801c60, 0x130549a0, 0x138ca8c0, 0x14163880, 0x14a1f740, 0x152fe320, 0x15bffa00, 0x16523980, 0x16e69ee0, 0x177d2700, 0x1815cec0, 0x18b09260, 0x194d6e00, 0x19ec5d60, 0x1a8d5c20, 0x1b306580, 0x1bd57440, 0x1c7c8300, 0x1d258c40, 0x1dd08a00, 0x1e7d7600, 0x1f2c49a0, 0x1fdcfe20, 0x208f8c40, 0x2143ed00, 0x21fa1840, 0x22b20680, 0x236baf40, 0x24270a00, 0x24e40e00, 0x25a2b280, 0x2662ee00, 0x2724b700, 0x27e80400, 0x28acca80, 0x297300c0, 0x2a3a9c00, 0x2b039180, 0x2bcdd680, 0x2c995fc0, 0x2d6621c0, 0x2e341140, 0x2f032240, 0x2fd34900, 0x30a47900, 0x3176a640, 0x3249c440, 0x331dc600, 0x33f29f40, 0x34c842c0, 0x359ea340, 0x3675b3c0, 0x374d66c0, 0x3825af00, 0x38fe7ec0, 0x39d7c880, 0x3ab17e40, 0x3b8b9240, 0x3c65f6c0, 0x3d409d80, 0x3e1b7880, 0x3ef679c0, 0x3fd19340, 0x40acb680, 0x4187d580, 0x4262e280, 0x433dce80, 0x44188c00, 0x44f30c80, 0x45cd4180, 0x46a71e00, 0x47809300, 0x48599300, 0x49320f80, 0x4a09fb80, 0x4ae14880, 0x4bb7e900, 0x4c8dcf80, 0x4d62ee80, 0x4e373880, 0x4f0aa080, 0x4fdd1900, 0x50ae9600, 0x517f0980, 0x524e6780, 0x531ca380, 0x53e9b100, 0x54b58400, 0x55801080, 0x56494b00, 0x57112800, 0x57d79c00, 0x589c9c00, 0x59601d00, 0x5a221480, 0x5ae27880, 0x5ba13e00, 0x5c5e5c00, 0x5d19c880, 0x5dd37a80, 0x5e8b6800, 0x5f418980, 0x5ff5d580, 0x60a84480, 0x6158ce00, 0x62076a80, 0x62b41280, 0x635ebf80, 0x64076a80, 0x64ae0d00, 0x6552a100, 0x65f52080, 0x66958680, 0x6733cd00, 0x67cff000, 0x6869ea80, 0x6901b880, 0x69975600, 0x6a2abf80, 0x6abbf200, 0x6b4aea80, 0x6bd7a680, 0x6c622300, 0x6cea5f80, 0x6d705900, 0x6df40f00, 0x6e758080, 0x6ef4ac80, 0x6f719300, 0x6fec3380, 0x70648f00, 0x70daa580, 0x714e7880, 0x71c00880, 0x722f5780, 0x729c6700, 0x73073980, 0x736fd100, 0x73d62f80, 0x743a5900, 0x749c5080, 0x74fc1880, 0x7559b600, 0x75b52b80, 0x760e7e80, 0x7665b280, 0x76bacc80, 0x770dd180, 0x775ec600, 0x77adb000, 0x77fa9480, 0x78457900, 0x788e6400, 0x78d55b80, 0x791a6500, 0x795d8780, 0x799ec900, 0x79de3100, 0x7a1bc580, 0x7a578d80, 0x7a919100, 0x7ac9d600, 0x7b006500, 0x7b354400, 0x7b687b80, 0x7b9a1300, 0x7bca1180, 0x7bf87f80, 0x7c256400, 0x7c50c780, 0x7c7ab180, 0x7ca32a00, 0x7cca3900, 0x7cefe600, 0x7d143900, 0x7d373a80, 0x7d58f280, 0x7d796800, 0x7d98a380, 0x7db6ad00, 0x7dd38c80, 0x7def4900, 0x7e09eb00, 0x7e237a00, 0x7e3bfd80, 0x7e537d80, 0x7e6a0180, 0x7e7f9080, 0x7e943200, 0x7ea7ed80, 0x7ebaca00, 0x7ecccf00, 0x7ede0300, 0x7eee6d00, 0x7efe1400, 0x7f0cfe80, 0x7f1b3380, 0x7f28b900, 0x7f359500, 0x7f41ce80, 0x7f4d6b80, 0x7f587180, 0x7f62e680, 0x7f6cd000, 0x7f763400, 0x7f7f1780, 0x7f878080, 0x7f8f7380, 0x7f96f580, 0x7f9e0b80, 0x7fa4bb00, 0x7fab0780, 0x7fb0f600, 0x7fb68b00, 0x7fbbca00, 0x7fc0b800, 0x7fc55880, 0x7fc9af80, 0x7fcdc080, 0x7fd18f00, 0x7fd51e80, 0x7fd87280, 0x7fdb8d80, 0x7fde7380, 0x7fe12700, 0x7fe3aa80, 0x7fe60100, 0x7fe82d00, 0x7fea3180, 0x7fec1000, 0x7fedcb00, 0x7fef6500, 0x7ff0e000, 0x7ff23e00, 0x7ff38080, 0x7ff4a980, 0x7ff5ba80, 0x7ff6b580, 0x7ff79c00, 0x7ff86e80, 0x7ff92f80, 0x7ff9e000, 0x7ffa8100, 0x7ffb1380, 0x7ffb9880, 0x7ffc1180, 0x7ffc7f80, 0x7ffce300, 0x7ffd3c80, 0x7ffd8d80, 0x7ffdd680, 0x7ffe1880, 0x7ffe5300, 0x7ffe8800, 0x7ffeb700, 0x7ffee100, 0x7fff0600, 0x7fff2700, 0x7fff4480, 0x7fff5e80, 0x7fff7500, 0x7fff8900, 0x7fff9a80, 0x7fffaa00, 0x7fffb780, 0x7fffc300, 0x7fffcd00, 0x7fffd580, 0x7fffdc80, 0x7fffe300, 0x7fffe880, 0x7fffec80, 0x7ffff080, 0x7ffff380, 0x7ffff680, 0x7ffff880, 0x7ffffa00, 0x7ffffb80, 0x7ffffc80, 0x7ffffd80, 0x7ffffe80, 0x7fffff00, 0x7fffff00, 0x7fffff80, 0x7fffff80, 0x7fffffff, 0x7fffffff +}; + +const Word32 ivas_lfe_window_coeff_32k_fx[IVAS_LFE_FADE_LEN_32K] = { + 0x000474c9, 0x0007fdfd, 0x000c0272, 0x0010a35b, 0x0015f4ae, 0x001c079e, 0x0022ecc2, 0x002ab4c6, 0x003370ac, 0x003d31e5, 0x00480a5f, 0x00540c87, 0x00614b4e, 0x006fda25, 0x007fccfb, 0x0091383a, 0x00a430c2, 0x00b8cbe7, 0x00cf1f67, 0x00e74167, 0x0101486c, 0x011d4b52, 0x013b614e, 0x015ba1d8, 0x017e24ae, 0x01a301c8, 0x01ca514e, 0x01f42b90, 0x0220a900, 0x024fe224, 0x0281ef88, 0x02b6e9c0, 0x02eee954, 0x032a06b4, 0x03685a34, 0x03a9fc00, 0x03ef0408, 0x043789f8, 0x0483a538, 0x04d36cd0, 0x0526f760, 0x057e5b20, 0x05d9adc0, 0x06390470, 0x069c73c0, 0x07040fa8, 0x076feb68, 0x07e01990, 0x0854abe0, 0x08cdb350, 0x094b4000, 0x09cd6120, 0x0a5424d0, 0x0adf9870, 0x0b6fc830, 0x0c04bf20, 0x0c9e8760, 0x0d3d29c0, 0x0de0ade0, 0x0e891a50, 0x0f367440, 0x0fe8bfa0, 0x109fff00, 0x115c33a0, 0x121d5d80, 0x12e37b00, 0x13ae8960, 0x147e8440, 0x155365c0, 0x162d26c0, 0x170bbe80, 0x17ef22e0, 0x18d74820, 0x19c42100, 0x1ab59f20, 0x1babb200, 0x1ca64840, 0x1da54e80, 0x1ea8b080, 0x1fb057e0, 0x20bc2d80, 0x21cc1800, 0x22dffd40, 0x23f7c1c0, 0x25134800, 0x26327200, 0x27552000, 0x287b30c0, 0x29a48280, 0x2ad0f180, 0x2c005940, 0x2d329440, 0x2e677c00, 0x2f9ee880, 0x30d8b100, 0x3214ac40, 0x3352afc0, 0x34929040, 0x35d421c0, 0x37173780, 0x385ba480, 0x39a13b00, 0x3ae7cc40, 0x3c2f2a00, 0x3d7724c0, 0x3ebf8d80, 0x40083400, 0x4150e980, 0x42997d80, 0x43e1c000, 0x45298180, 0x46709200, 0x47b6c280, 0x48fbe380, 0x4a3fc600, 0x4b823b80, 0x4cc31600, 0x4e022800, 0x4f3f4500, 0x507a4080, 0x51b2ee80, 0x52e92580, 0x541cba80, 0x554d8580, 0x567b5e00, 0x57a61d80, 0x58cd9e00, 0x59f1bb80, 0x5b125200, 0x5c2f3f00, 0x5d486280, 0x5e5d9d00, 0x5f6ecf80, 0x607bde00, 0x6184ad00, 0x62892280, 0x63892680, 0x6484a280, 0x657b8100, 0x666daf00, 0x675b1980, 0x6843b100, 0x69276680, 0x6a062d00, 0x6adff980, 0x6bb4c180, 0x6c847d80, 0x6d4f2680, 0x6e14b800, 0x6ed52e80, 0x6f908900, 0x7046c680, 0x70f7e880, 0x71a3f300, 0x724aea00, 0x72ecd300, 0x7389b680, 0x74219c80, 0x74b48f80, 0x75429b80, 0x75cbcc80, 0x76503100, 0x76cfd800, 0x774ad280, 0x77c13180, 0x78330780, 0x78a06880, 0x79096800, 0x796e1b80, 0x79ce9980, 0x7a2af880, 0x7a835000, 0x7ad7b800, 0x7b284980, 0x7b751c80, 0x7bbe4c00, 0x7c03f080, 0x7c462580, 0x7c850480, 0x7cc0a880, 0x7cf92c00, 0x7d2eaa80, 0x7d613e00, 0x7d910180, 0x7dbe0f80, 0x7de88300, 0x7e107600, 0x7e360300, 0x7e594280, 0x7e7a4f80, 0x7e994200, 0x7eb63280, 0x7ed13a00, 0x7eea6f00, 0x7f01e980, 0x7f17c000, 0x7f2c0800, 0x7f3ed780, 0x7f504280, 0x7f605d80, 0x7f6f3c00, 0x7f7cf100, 0x7f898e00, 0x7f952500, 0x7f9fc600, 0x7fa98200, 0x7fb26800, 0x7fba8680, 0x7fc1eb80, 0x7fc8a400, 0x7fcebd80, 0x7fd44380, 0x7fd94100, 0x7fddc180, 0x7fe1ce80, 0x7fe57180, 0x7fe8b400, 0x7feb9d80, 0x7fee3680, 0x7ff08600, 0x7ff29280, 0x7ff46300, 0x7ff5fc80, 0x7ff76500, 0x7ff8a180, 0x7ff9b600, 0x7ffaa780, 0x7ffb7900, 0x7ffc2e80, 0x7ffccb80, 0x7ffd5200, 0x7ffdc580, 0x7ffe2800, 0x7ffe7b80, 0x7ffec200, 0x7ffefd80, 0x7fff2f00, 0x7fff5880, 0x7fff7a80, 0x7fff9680, 0x7fffad80, 0x7fffc000, 0x7fffcf00, 0x7fffdb00, 0x7fffe480, 0x7fffeb80, 0x7ffff180, 0x7ffff580, 0x7ffff900, 0x7ffffb00, 0x7ffffd00, 0x7ffffe00, 0x7fffff00, 0x7fffff80, 0x7fffffff, 0x7fffffff +}; + +const Word32 ivas_lfe_window_coeff_16k_fx[IVAS_LFE_FADE_LEN_16K] = { + 0x00064d50, 0x000e283c, 0x0018b753, 0x00267552, 0x0037e397, 0x004d8c2b, 0x006801d2, 0x0087dfb9, 0x00adc8fc, 0x00da680b, 0x010e6df8, 0x014a91a0, 0x018f8ecc, 0x01de252a, 0x02371734, 0x029b2908, 0x030b1f1c, 0x0387bd00, 0x0411c3e8, 0x04a9f148, 0x0550fd60, 0x060799b0, 0x06ce6f88, 0x07a61e78, 0x088f3ad0, 0x098a4c30, 0x0a97cc00, 0x0bb82430, 0x0cebadd0, 0x0e32afe0, 0x0f8d5df0, 0x10fbd760, 0x127e2680, 0x14143f40, 0x15bdff00, 0x177b2bc0, 0x194b7440, 0x1b2e6f00, 0x1d239ae0, 0x1f2a5ee0, 0x21420ac0, 0x2369d700, 0x25a0e640, 0x27e64500, 0x2a38ebc0, 0x2c97bfc0, 0x2f019400, 0x31752b00, 0x33f13800, 0x36746180, 0x38fd42c0, 0x3b8a6cc0, 0x3e1a6a80, 0x40abc080, 0x433cf080, 0x45cc7c80, 0x4858e600, 0x4ae0b400, 0x4d627280, 0x4fdcb500, 0x524e1b00, 0x54b54e80, 0x57110880, 0x59601300, 0x5ba14800, 0x5dd39780, 0x5ff60500, 0x6207aa80, 0x6407ba80, 0x65f57e80, 0x67d05b00, 0x6997cc80, 0x6b4b6b00, 0x6ceae880, 0x6e761080, 0x6fecc980, 0x714f1280, 0x729d0480, 0x73d6ce80, 0x74fcb800, 0x760f1d80, 0x770e6e80, 0x77fb2f00, 0x78d5f280, 0x799f5b80, 0x7a581b80, 0x7b00ec80, 0x7b9a9480, 0x7c25df80, 0x7ca39e80, 0x7d14a680, 0x7d79ce00, 0x7dd3eb00, 0x7e23d180, 0x7e6a5180, 0x7ea83680, 0x7ede4580, 0x7f0d3a80, 0x7f35cb00, 0x7f58a180, 0x7f765e80, 0x7f8f9880, 0x7fa4db80, 0x7fb6a700, 0x7fc57100, 0x7fd1a400, 0x7fdb9f80, 0x7fe3b980, 0x7fea3e00, 0x7fef6f80, 0x7ff38900, 0x7ff6bc80, 0x7ff93500, 0x7ffb1780, 0x7ffc8300, 0x7ffd9080, 0x7ffe5500, 0x7ffee280, 0x7fff4580, 0x7fff8a00, 0x7fffb800, 0x7fffd580, 0x7fffe880, 0x7ffff400, 0x7ffffa00, 0x7ffffd80, 0x7fffff00, 0x7fffffff +}; + +// Q31 +const UWord32 d_hamm_lfe_plc_fx[LFE_PLC_LENANA / 2] = { + 171798691, 172140039, 173163845, 174869403, 177255533, 180320587, 184062447, 188478526, + 193565772, 199320670, 205739242, 212817053, 220549212, 228930373, 237954746, 247616094, + 257907739, 268822570, 280353042, 292491188, 305228618, 318556530, 332465713, 346946555, + 361989047, 377582794, 393717019, 410380572, 427561937, 445249239, 463430255, 482092421, + 501222838, 520808286, 540835229, 561289828, 582157945, 603425159, 625076772, 647097821, + 669473086, 692187106, 715224182, 738568392, 762203605, 786113486, 810281510, 834690976, + 859325014, 884166600, 909198565, 934403610, 959764316, 985263157, 1010882509, 1036604668, + 1062411858, 1088286242, 1114209939, 1140165034, 1166133589, 1192097656, 1218039293, 1243940572, + 1269783591, 1295550491, 1321223465, 1346784770, 1372216740, 1397501800, 1422622476, 1447561406, + 1472301355, 1496825225, 1521116069, 1545157098, 1568931699, 1592423440, 1615616087, 1638493611, + 1661040202, 1683240277, 1705078494, 1726539762, 1747609248, 1768272390, 1788514910, 1808322817, + 1827682422, 1846580346, 1865003529, 1882939237, 1900375077, 1917298998, 1933699304, 1949564660, + 1964884103, 1979647046, 1993843284, 2007463009, 2020496806, 2032935668, 2044771000, 2055994621, + 2066598775, 2076576133, 2085919801, 2094623320, 2102680676, 2110086301, 2116835076, 2122922337, + 2128343877, 2133095950, 2137175272, 2140579023, 2143304850, 2145350871, 2146715671, 2147398307 +}; + +/*------------------------------------------------------------------------------------------* + * MDFT/iMDFT ROM tables + *------------------------------------------------------------------------------------------*/ + +const Word32 ivas_mdft_coeff_cos_twid_960_fx[IVAS_960_PT_LEN + 1] = { + 2147483647, + 2147480832, 2147472128, 2147457792, 2147437696, + 2147411840, 2147380096, 2147342848, 2147299712, + 2147250816, 2147196160, 2147135872, 2147069696, + 2146997888, 2146920192, 2146836864, 2146747776, + 2146652928, 2146552320, 2146445952, 2146333824, + 2146216064, 2146092416, 2145963136, 2145827968, + 2145687168, 2145540608, 2145388288, 2145230208, + 2145066496, 2144896896, 2144721664, 2144540544, + 2144353792, 2144161280, 2143963008, 2143759104, + 2143549312, 2143333888, 2143112704, 2142885760, + 2142653056, 2142414592, 2142170496, 2141920512, + 2141664896, 2141403648, 2141136512, 2140863616, + 2140585088, 2140300800, 2140010752, 2139715072, + 2139413632, 2139106432, 2138793472, 2138474752, + 2138150400, 2137820288, 2137484544, 2137142912, + 2136795648, 2136442624, 2136083968, 2135719552, + 2135349376, 2134973440, 2134591872, 2134204544, + 2133811584, 2133412864, 2133008384, 2132598272, + 2132182400, 2131760896, 2131333632, 2130900608, + 2130461952, 2130017536, 2129567360, 2129111680, + 2128650112, 2128182912, 2127710080, 2127231488, + 2126747136, 2126257152, 2125761536, 2125260160, + 2124753152, 2124240384, 2123721984, 2123197824, + 2122668032, 2122132608, 2121591424, 2121044608, + 2120492032, 2119933824, 2119369984, 2118800384, + 2118225152, 2117644288, 2117057792, 2116465536, + 2115867648, 2115264128, 2114654848, 2114039936, + 2113419392, 2112793216, 2112161408, 2111523840, + 2110880640, 2110231808, 2109577344, 2108917248, + 2108251520, 2107580032, 2106903040, 2106220288, + 2105532032, 2104838016, 2104138496, 2103433216, + 2102722304, 2102005888, 2101283712, 2100556032, + 2099822592, 2099083648, 2098338944, 2097588736, + 2096832896, 2096071424, 2095304320, 2094531712, + 2093753344, 2092969472, 2092179968, 2091384832, + 2090584192, 2089777920, 2088966016, 2088148480, + 2087325440, 2086496768, 2085662464, 2084822656, + 2083977216, 2083126272, 2082269696, 2081407488, + 2080539776, 2079666560, 2078787712, 2077903232, + 2077013248, 2076117632, 2075216640, 2074309888, + 2073397760, 2072479872, 2071556608, 2070627712, + 2069693312, 2068753408, 2067807872, 2066856832, + 2065900288, 2064938240, 2063970560, 2062997504, + 2062018816, 2061034624, 2060044928, 2059049728, + 2058049024, 2057042688, 2056030976, 2055013760, + 2053990912, 2052962688, 2051928960, 2050889728, + 2049844992, 2048794752, 2047739008, 2046677888, + 2045611136, 2044539008, 2043461376, 2042378368, + 2041289728, 2040195712, 2039096192, 2037991296, + 2036880896, 2035764992, 2034643712, 2033516928, + 2032384768, 2031247104, 2030104064, 2028955520, + 2027801600, 2026642176, 2025477376, 2024307200, + 2023131520, 2021950464, 2020764032, 2019572096, + 2018374784, 2017172096, 2015964032, 2014750592, + 2013531648, 2012307328, 2011077760, 2009842688, + 2008602240, 2007356416, 2006105216, 2004848640, + 2003586816, 2002319488, 2001046912, 1999768832, + 1998485504, 1997196800, 1995902720, 1994603264, + 1993298560, 1991988480, 1990673152, 1989352320, + 1988026240, 1986694912, 1985358208, 1984016128, + 1982668800, 1981316224, 1979958272, 1978595072, + 1977226496, 1975852672, 1974473472, 1973089152, + 1971699456, 1970304384, 1968904192, 1967498624, + 1966087808, 1964671872, 1963250560, 1961823872, + 1960392064, 1958955008, 1957512704, 1956065152, + 1954612352, 1953154304, 1951691136, 1950222592, + 1948748928, 1947270016, 1945785856, 1944296576, + 1942801920, 1941302272, 1939797248, 1938287104, + 1936771840, 1935251328, 1933725568, 1932194688, + 1930658688, 1929117440, 1927571072, 1926019584, + 1924462848, 1922900992, 1921334016, 1919761920, + 1918184576, 1916602112, 1915014656, 1913421952, + 1911824128, 1910221184, 1908613248, 1907000064, + 1905381760, 1903758464, 1902130048, 1900496512, + 1898857856, 1897214208, 1895565312, 1893911552, + 1892252544, 1890588544, 1888919552, 1887245440, + 1885566208, 1883881984, 1882192768, 1880498432, + 1878799104, 1877094656, 1875385344, 1873670912, + 1871951488, 1870227072, 1868497536, 1866763136, + 1865023744, 1863279232, 1861529856, 1859775360, + 1858016000, 1856251648, 1854482304, 1852707968, + 1850928768, 1849144448, 1847355392, 1845561216, + 1843762176, 1841958144, 1840149248, 1838335360, + 1836516608, 1834692864, 1832864384, 1831030784, + 1829192448, 1827349120, 1825500928, 1823647744, + 1821789824, 1819927040, 1818059264, 1816186624, + 1814309248, 1812426880, 1810539776, 1808647680, + 1806750848, 1804849152, 1802942720, 1801031296, + 1799115136, 1797194112, 1795268352, 1793337728, + 1791402368, 1789462144, 1787517184, 1785567360, + 1783612800, 1781653504, 1779689344, 1777720576, + 1775746944, 1773768576, 1771785344, 1769797504, + 1767804928, 1765807616, 1763805440, 1761798656, + 1759787136, 1757771008, 1755750016, 1753724416, + 1751694080, 1749659008, 1747619328, 1745574912, + 1743525888, 1741472128, 1739413760, 1737350784, + 1735283072, 1733210752, 1731133696, 1729052160, + 1726965888, 1724875008, 1722779520, 1720679424, + 1718574720, 1716465408, 1714351616, 1712233088, + 1710109952, 1707982336, 1705850112, 1703713280, + 1701571968, 1699426048, 1697275648, 1695120640, + 1692961024, 1690796928, 1688628352, 1686455296, + 1684277632, 1682095488, 1679908864, 1677717632, + 1675522048, 1673321984, 1671117312, 1668908288, + 1666694656, 1664476672, 1662254208, 1660027264, + 1657795968, 1655560192, 1653319936, 1651075200, + 1648826240, 1646572672, 1644314752, 1642052480, + 1639785728, 1637514752, 1635239168, 1632959360, + 1630675200, 1628386560, 1626093568, 1623796352, + 1621494656, 1619188736, 1616878336, 1614563712, + 1612244736, 1609921408, 1607593856, 1605261952, + 1602925696, 1600585216, 1598240384, 1595891328, + 1593538048, 1591180416, 1588818560, 1586452480, + 1584082048, 1581707520, 1579328640, 1576945536, + 1574558336, 1572166784, 1569771136, 1567371136, + 1564967040, 1562558720, 1560146304, 1557729664, + 1555308800, 1552883712, 1550454656, 1548021248, + 1545583872, 1543142272, 1540696576, 1538246656, + 1535792768, 1533334656, 1530872448, 1528406272, + 1525935872, 1523461376, 1520982912, 1518500224, + 1516013568, 1513522816, 1511028096, 1508529280, + 1506026368, 1503519488, 1501008512, 1498493568, + 1495974656, 1493451648, 1490924672, 1488393728, + 1485858816, 1483319936, 1480777088, 1478230144, + 1475679360, 1473124608, 1470565888, 1468003328, + 1465436672, 1462866176, 1460291840, 1457713536, + 1455131264, 1452545152, 1449955200, 1447361280, + 1444763520, 1442161920, 1439556352, 1436947072, + 1434333824, 1431716864, 1429095936, 1426471296, + 1423842688, 1421210368, 1418574336, 1415934336, + 1413290624, 1410643200, 1407991808, 1405336832, + 1402678016, 1400015488, 1397349120, 1394679040, + 1392005248, 1389327744, 1386646528, 1383961600, + 1381272960, 1378580608, 1375884544, 1373184768, + 1370481408, 1367774336, 1365063552, 1362349184, + 1359631232, 1356909440, 1354184192, 1351455232, + 1348722688, 1345986560, 1343246720, 1340503424, + 1337756416, 1335005952, 1332251776, 1329494144, + 1326732928, 1323968128, 1321199744, 1318427904, + 1315652480, 1312873600, 1310091136, 1307305216, + 1304515712, 1301722880, 1298926464, 1296126464, + 1293323136, 1290516352, 1287705984, 1284892288, + 1282075136, 1279254528, 1276430464, 1273603072, + 1270772224, 1267937920, 1265100288, 1262259200, + 1259414784, 1256567040, 1253715840, 1250861312, + 1248003456, 1245142272, 1242277760, 1239409920, + 1236538624, 1233664128, 1230786432, 1227905280, + 1225020928, 1222133248, 1219242368, 1216348160, + 1213450624, 1210550016, 1207646080, 1204738816, + 1201828480, 1198914816, 1195998080, 1193078016, + 1190154752, 1187228416, 1184298752, 1181366016, + 1178430080, 1175491072, 1172548736, 1169603456, + 1166654976, 1163703296, 1160748544, 1157790720, + 1154829824, 1151865728, 1148898688, 1145928448, + 1142955136, 1139978880, 1136999552, 1134017024, + 1131031680, 1128043136, 1125051648, 1122057088, + 1119059584, 1116059136, 1113055616, 1110049152, + 1107039616, 1104027264, 1101011840, 1097993600, + 1094972288, 1091948032, 1088920960, 1085890944, + 1082857984, 1079822208, 1076783488, 1073741824, + 1070697344, 1067649984, 1064599744, 1061546688, + 1058490816, 1055432064, 1052370496, 1049306112, + 1046238912, 1043168960, 1040096192, 1037020608, + 1033942272, 1030861120, 1027777280, 1024690624, + 1021601280, 1018509184, 1015414336, 1012316800, + 1009216512, 1006113536, 1003007936, 999899584, + 996788544, 993674880, 990558528, 987439552, + 984317888, 981193600, 978066688, 974937152, + 971805056, 968670336, 965532992, 962393088, + 959250560, 956105536, 952957888, 949807744, + 946655040, 943499776, 940342016, 937181696, + 934018880, 930853632, 927685824, 924515520, + 921342784, 918167552, 914989888, 911809792, + 908627200, 905442176, 902254784, 899064960, + 895872704, 892678080, 889481024, 886281600, + 883079808, 879875648, 876669120, 873460288, + 870249088, 867035584, 863819712, 860601536, + 857381120, 854158336, 850933312, 847705984, + 844476352, 841244544, 838010432, 834774080, + 831535488, 828294656, 825051648, 821806400, + 818558976, 815309376, 812057536, 808803520, + 805547392, 802289088, 799028608, 795766016, + 792501312, 789234496, 785965504, 782694464, + 779421248, 776146048, 772868736, 769589312, + 766307840, 763024320, 759738816, 756451200, + 753161600, 749870016, 746576320, 743280704, + 739983104, 736683520, 733381952, 730078400, + 726772864, 723465472, 720156096, 716844800, + 713531520, 710216384, 706899392, 703580480, + 700259648, 696936960, 693612416, 690286016, + 686957760, 683627648, 680295744, 676961984, + 673626432, 670289024, 666949888, 663608960, + 660266240, 656921728, 653575488, 650227520, + 646877760, 643526272, 640173120, 636818176, + 633461568, 630103296, 626743296, 623381568, + 620018240, 616653248, 613286592, 609918336, + 606548352, 603176832, 599803648, 596428864, + 593052544, 589674560, 586295040, 582913920, + 579531264, 576147072, 572761280, 569374016, + 565985152, 562594816, 559203008, 555809664, + 552414848, 549018560, 545620736, 542221504, + 538820864, 535418720, 532015168, 528610176, + 525203776, 521795968, 518386752, 514976160, + 511564192, 508150848, 504736160, 501320096, + 497902720, 494483968, 491063936, 487642560, + 484219904, 480795936, 477370656, 473944128, + 470516320, 467087264, 463656960, 460225408, + 456792608, 453358592, 449923392, 446486944, + 443049344, 439610528, 436170528, 432729376, + 429287072, 425843616, 422399008, 418953280, + 415506432, 412058464, 408609376, 405159232, + 401707968, 398255648, 394802272, 391347808, + 387892320, 384435776, 380978208, 377519648, + 374060032, 370599456, 367137856, 363675296, + 360211744, 356747232, 353281760, 349815360, + 346348032, 342879744, 339410560, 335940448, + 332469472, 328997568, 325524800, 322051168, + 318576640, 315101280, 311625088, 308148064, + 304670208, 301191520, 297712032, 294231776, + 290750688, 287268864, 283786240, 280302848, + 276818752, 273333888, 269848288, 266361952, + 262874928, 259387184, 255898752, 252409632, + 248919840, 245429392, 241938272, 238446512, + 234954112, 231461072, 227967424, 224473168, + 220978304, 217482848, 213986816, 210490208, + 206993040, 203495312, 199997040, 196498224, + 192998896, 189499040, 185998688, 182497840, + 178996496, 175494672, 171992384, 168489632, + 164986416, 161482768, 157978704, 154474192, + 150969280, 147463968, 143958256, 140452144, + 136945680, 133438832, 129931632, 126424088, + 122916200, 119407992, 115899456, 112390608, + 108881464, 105372032, 101862312, 98352320, + 94842064, 91331552, 87820800, 84309816, + 80798600, 77287168, 73775528, 70263696, + 66751672, 63239472, 59727100, 56214568, + 52701888, 49189064, 45676112, 42163032, + 38649844, 35136552, 31623164, 28109692, + 24596146, 21082532, 17568864, 14055147, + 10541393, 7027612, 3513810, 0 +}; + +const Word32 ivas_mdft_coeff_cos_twid_640_fx[IVAS_640_PT_LEN + 1] = { + 2147483647, + 2147477120, 2147457792, 2147425408, 2147380096, + 2147321984, 2147250816, 2147166720, 2147069696, + 2146959744, 2146836864, 2146701056, 2146552320, + 2146390656, 2146216064, 2146028416, 2145827968, + 2145614592, 2145388288, 2145149056, 2144896896, + 2144631808, 2144353792, 2144062848, 2143759104, + 2143442304, 2143112704, 2142770048, 2142414592, + 2142046208, 2141664896, 2141270784, 2140863616, + 2140443648, 2140010752, 2139565056, 2139106432, + 2138634880, 2138150400, 2137653120, 2137142912, + 2136619904, 2136083968, 2135535104, 2134973440, + 2134398976, 2133811584, 2133211392, 2132598272, + 2131972352, 2131333632, 2130681984, 2130017536, + 2129340288, 2128650112, 2127947264, 2127231488, + 2126502912, 2125761536, 2125007360, 2124240384, + 2123460608, 2122668032, 2121862656, 2121044608, + 2120213632, 2119369984, 2118513536, 2117644288, + 2116762368, 2115867648, 2114960128, 2114039936, + 2113107072, 2112161408, 2111202944, 2110231808, + 2109248000, 2108251520, 2107242240, 2106220288, + 2105185792, 2104138496, 2103078528, 2102005888, + 2100920576, 2099822592, 2098712064, 2097588736, + 2096452864, 2095304320, 2094143232, 2092969472, + 2091783168, 2090584192, 2089372672, 2088148480, + 2086911744, 2085662464, 2084400640, 2083126272, + 2081839360, 2080539776, 2079227776, 2077903232, + 2076566144, 2075216640, 2073854464, 2072479872, + 2071092864, 2069693312, 2068281344, 2066856832, + 2065420032, 2063970560, 2062508800, 2061034624, + 2059548032, 2058049024, 2056537600, 2055013760, + 2053477504, 2051928960, 2050368000, 2048794752, + 2047209088, 2045611136, 2044000896, 2042378368, + 2040743424, 2039096192, 2037436800, 2035764992, + 2034081024, 2032384768, 2030676224, 2028955520, + 2027222528, 2025477376, 2023720064, 2021950464, + 2020168704, 2018374784, 2016568704, 2014750592, + 2012920192, 2011077760, 2009223168, 2007356416, + 2005477632, 2003586816, 2001683840, 1999768832, + 1997841792, 1995902720, 1993951616, 1991988480, + 1990013440, 1988026240, 1986027264, 1984016128, + 1981993216, 1979958272, 1977911424, 1975852672, + 1973782016, 1971699456, 1969604992, 1967498624, + 1965380480, 1963250560, 1961108736, 1958955008, + 1956789632, 1954612352, 1952423424, 1950222592, + 1948010112, 1945785856, 1943549952, 1941302272, + 1939042816, 1936771840, 1934489088, 1932194688, + 1929888768, 1927571072, 1925241856, 1922900992, + 1920548608, 1918184576, 1915809024, 1913421952, + 1911023360, 1908613248, 1906191616, 1903758464, + 1901313920, 1898857856, 1896390400, 1893911552, + 1891421184, 1888919552, 1886406400, 1883881984, + 1881346176, 1878799104, 1876240640, 1873670912, + 1871089920, 1868497536, 1865894016, 1863279232, + 1860653184, 1858016000, 1855367552, 1852707968, + 1850037248, 1847355392, 1844662272, 1841958144, + 1839242880, 1836516608, 1833779200, 1831030784, + 1828271360, 1825500928, 1822719360, 1819927040, + 1817123584, 1814309248, 1811483904, 1808647680, + 1805800704, 1802942720, 1800073856, 1797194112, + 1794303616, 1791402368, 1788490240, 1785567360, + 1782633728, 1779689344, 1776734336, 1773768576, + 1770792064, 1767804928, 1764807168, 1761798656, + 1758779648, 1755750016, 1752709760, 1749659008, + 1746597760, 1743525888, 1740443520, 1737350784, + 1734247424, 1731133696, 1728009600, 1724875008, + 1721730048, 1718574720, 1715409024, 1712233088, + 1709046784, 1705850112, 1702643200, 1699426048, + 1696198656, 1692961024, 1689713280, 1686455296, + 1683187072, 1679908864, 1676620416, 1673321984, + 1670013312, 1666694656, 1663366016, 1660027264, + 1656678656, 1653319936, 1649951232, 1646572672, + 1643184128, 1639785728, 1636377472, 1632959360, + 1629531392, 1626093568, 1622646016, 1619188736, + 1615721600, 1612244736, 1608758144, 1605261952, + 1601756032, 1598240384, 1594715264, 1591180416, + 1587636096, 1584082048, 1580518656, 1576945536, + 1573363072, 1569771136, 1566169600, 1562558720, + 1558938496, 1555308800, 1551669760, 1548021248, + 1544363648, 1540696576, 1537020288, 1533334656, + 1529639808, 1525935872, 1522222592, 1518500224, + 1514768768, 1511028096, 1507278336, 1503519488, + 1499751552, 1495974656, 1492188672, 1488393728, + 1484589824, 1480777088, 1476955264, 1473124608, + 1469285120, 1465436672, 1461579520, 1457713536, + 1453838720, 1449955200, 1446062848, 1442161920, + 1438252160, 1434333824, 1430406912, 1426471296, + 1422527104, 1418574336, 1414612992, 1410643200, + 1406664832, 1402678016, 1398682752, 1394679040, + 1390667008, 1386646528, 1382617728, 1378580608, + 1374535168, 1370481408, 1366419456, 1362349184, + 1358270848, 1354184192, 1350089472, 1345986560, + 1341875584, 1337756416, 1333629312, 1329494144, + 1325350912, 1321199744, 1317040640, 1312873600, + 1308698624, 1304515712, 1300325120, 1296126464, + 1291920128, 1287705984, 1283484160, 1279254528, + 1275017216, 1270772224, 1266519552, 1262259200, + 1257991296, 1253715840, 1249432832, 1245142272, + 1240844160, 1236538624, 1232225664, 1227905280, + 1223577472, 1219242368, 1214899840, 1210550016, + 1206192896, 1201828480, 1197456896, 1193078016, + 1188691968, 1184298752, 1179898496, 1175491072, + 1171076480, 1166654976, 1162226304, 1157790720, + 1153348224, 1148898688, 1144442240, 1139978880, + 1135508608, 1131031680, 1126547712, 1122057088, + 1117559680, 1113055616, 1108544768, 1104027264, + 1099503104, 1094972288, 1090434944, 1085890944, + 1081340416, 1076783488, 1072219968, 1067649984, + 1063073600, 1058490816, 1053901632, 1049306112, + 1044704320, 1040096192, 1035481792, 1030861120, + 1026234304, 1021601280, 1016962112, 1012316800, + 1007665408, 1003007936, 998344384, 993674880, + 988999360, 984317888, 979630464, 974937152, + 970238016, 965532992, 960822144, 956105536, + 951383104, 946655040, 941921216, 937181696, + 932436544, 927685824, 922929472, 918167552, + 913400128, 908627200, 903848768, 899064960, + 894275648, 889481024, 884681024, 879875648, + 875065024, 870249088, 865427968, 860601536, + 855769984, 850933312, 846091456, 841244544, + 836392512, 831535488, 826673472, 821806400, + 816934464, 812057536, 807175744, 802289088, + 797397632, 792501312, 787600256, 782694464, + 777783936, 772868736, 767948864, 763024320, + 758095232, 753161600, 748223424, 743280704, + 738333568, 733381952, 728425856, 723465472, + 718500672, 713531520, 708558144, 703580480, + 698598528, 693612416, 688622080, 683627648, + 678629056, 673626432, 668619712, 663608960, + 658594176, 653575488, 648552832, 643526272, + 638495872, 633461568, 628423488, 623381568, + 618335936, 613286592, 608233536, 603176832, + 598116480, 593052544, 587985024, 582913920, + 577839360, 572761280, 567679744, 562594816, + 557506496, 552414848, 547319808, 542221504, + 537119936, 532015168, 526907136, 521795968, + 516681632, 511564192, 506443680, 501320096, + 496193504, 491063936, 485931392, 480795936, + 475657568, 470516320, 465372256, 460225408, + 455075776, 449923392, 444768288, 439610528, + 434450112, 429287072, 424121440, 418953280, + 413782592, 408609376, 403433728, 398255648, + 393075168, 387892320, 382707136, 377519648, + 372329856, 367137856, 361943648, 356747232, + 351548672, 346348032, 341145280, 335940448, + 330733632, 325524800, 320314016, 315101280, + 309886688, 304670208, 299451872, 294231776, + 289009856, 283786240, 278560896, 273333888, + 268105200, 262874928, 257643056, 252409632, + 247174704, 241938272, 236700384, 231461072, + 226220368, 220978304, 215734912, 210490208, + 205244240, 199997040, 194748624, 189499040, + 184248320, 178996496, 173743584, 168489632, + 163234656, 157978704, 152721792, 147463968, + 142205248, 136945680, 131685280, 126424088, + 121162136, 115899456, 110636072, 105372032, + 100107344, 94842064, 89576208, 84309816, + 79042912, 73775528, 68507704, 63239472, + 57970852, 52701888, 47432604, 42163032, + 36893208, 31623164, 26352928, 21082532, + 15812011, 10541393, 5270713, 0 +}; + +const Word32 ivas_mdft_coeff_cos_twid_320_fx[IVAS_320_PT_LEN + 1] = { + 2147483647, + 2147457792, 2147380096, 2147250816, 2147069696, + 2146836864, 2146552320, 2146216064, 2145827968, + 2145388288, 2144896896, 2144353792, 2143759104, + 2143112704, 2142414592, 2141664896, 2140863616, + 2140010752, 2139106432, 2138150400, 2137142912, + 2136083968, 2134973440, 2133811584, 2132598272, + 2131333632, 2130017536, 2128650112, 2127231488, + 2125761536, 2124240384, 2122668032, 2121044608, + 2119369984, 2117644288, 2115867648, 2114039936, + 2112161408, 2110231808, 2108251520, 2106220288, + 2104138496, 2102005888, 2099822592, 2097588736, + 2095304320, 2092969472, 2090584192, 2088148480, + 2085662464, 2083126272, 2080539776, 2077903232, + 2075216640, 2072479872, 2069693312, 2066856832, + 2063970560, 2061034624, 2058049024, 2055013760, + 2051928960, 2048794752, 2045611136, 2042378368, + 2039096192, 2035764992, 2032384768, 2028955520, + 2025477376, 2021950464, 2018374784, 2014750592, + 2011077760, 2007356416, 2003586816, 1999768832, + 1995902720, 1991988480, 1988026240, 1984016128, + 1979958272, 1975852672, 1971699456, 1967498624, + 1963250560, 1958955008, 1954612352, 1950222592, + 1945785856, 1941302272, 1936771840, 1932194688, + 1927571072, 1922900992, 1918184576, 1913421952, + 1908613248, 1903758464, 1898857856, 1893911552, + 1888919552, 1883881984, 1878799104, 1873670912, + 1868497536, 1863279232, 1858016000, 1852707968, + 1847355392, 1841958144, 1836516608, 1831030784, + 1825500928, 1819927040, 1814309248, 1808647680, + 1802942720, 1797194112, 1791402368, 1785567360, + 1779689344, 1773768576, 1767804928, 1761798656, + 1755750016, 1749659008, 1743525888, 1737350784, + 1731133696, 1724875008, 1718574720, 1712233088, + 1705850112, 1699426048, 1692961024, 1686455296, + 1679908864, 1673321984, 1666694656, 1660027264, + 1653319936, 1646572672, 1639785728, 1632959360, + 1626093568, 1619188736, 1612244736, 1605261952, + 1598240384, 1591180416, 1584082048, 1576945536, + 1569771136, 1562558720, 1555308800, 1548021248, + 1540696576, 1533334656, 1525935872, 1518500224, + 1511028096, 1503519488, 1495974656, 1488393728, + 1480777088, 1473124608, 1465436672, 1457713536, + 1449955200, 1442161920, 1434333824, 1426471296, + 1418574336, 1410643200, 1402678016, 1394679040, + 1386646528, 1378580608, 1370481408, 1362349184, + 1354184192, 1345986560, 1337756416, 1329494144, + 1321199744, 1312873600, 1304515712, 1296126464, + 1287705984, 1279254528, 1270772224, 1262259200, + 1253715840, 1245142272, 1236538624, 1227905280, + 1219242368, 1210550016, 1201828480, 1193078016, + 1184298752, 1175491072, 1166654976, 1157790720, + 1148898688, 1139978880, 1131031680, 1122057088, + 1113055616, 1104027264, 1094972288, 1085890944, + 1076783488, 1067649984, 1058490816, 1049306112, + 1040096192, 1030861120, 1021601280, 1012316800, + 1003007936, 993674880, 984317888, 974937152, + 965532992, 956105536, 946655040, 937181696, + 927685824, 918167552, 908627200, 899064960, + 889481024, 879875648, 870249088, 860601536, + 850933312, 841244544, 831535488, 821806400, + 812057536, 802289088, 792501312, 782694464, + 772868736, 763024320, 753161600, 743280704, + 733381952, 723465472, 713531520, 703580480, + 693612416, 683627648, 673626432, 663608960, + 653575488, 643526272, 633461568, 623381568, + 613286592, 603176832, 593052544, 582913920, + 572761280, 562594816, 552414848, 542221504, + 532015168, 521795968, 511564192, 501320096, + 491063936, 480795936, 470516320, 460225408, + 449923392, 439610528, 429287072, 418953280, + 408609376, 398255648, 387892320, 377519648, + 367137856, 356747232, 346348032, 335940448, + 325524800, 315101280, 304670208, 294231776, + 283786240, 273333888, 262874928, 252409632, + 241938272, 231461072, 220978304, 210490208, + 199997040, 189499040, 178996496, 168489632, + 157978704, 147463968, 136945680, 126424088, + 115899456, 105372032, 94842064, 84309816, + 73775528, 63239472, 52701888, 42163032, + 31623164, 21082532, 10541393, 0 +}; + +const Word32 ivas_mdft_coeff_cos_twid_240_fx[IVAS_240_PT_LEN + 1] = { + 2147483647, + 2147437696, 2147299712, 2147069696, 2146747776, + 2146333824, 2145827968, 2145230208, 2144540544, + 2143759104, 2142885760, 2141920512, 2140863616, + 2139715072, 2138474752, 2137142912, 2135719552, + 2134204544, 2132598272, 2130900608, 2129111680, + 2127231488, 2125260160, 2123197824, 2121044608, + 2118800384, 2116465536, 2114039936, 2111523840, + 2108917248, 2106220288, 2103433216, 2100556032, + 2097588736, 2094531712, 2091384832, 2088148480, + 2084822656, 2081407488, 2077903232, 2074309888, + 2070627712, 2066856832, 2062997504, 2059049728, + 2055013760, 2050889728, 2046677888, 2042378368, + 2037991296, 2033516928, 2028955520, 2024307200, + 2019572096, 2014750592, 2009842688, 2004848640, + 1999768832, 1994603264, 1989352320, 1984016128, + 1978595072, 1973089152, 1967498624, 1961823872, + 1956065152, 1950222592, 1944296576, 1938287104, + 1932194688, 1926019584, 1919761920, 1913421952, + 1907000064, 1900496512, 1893911552, 1887245440, + 1880498432, 1873670912, 1866763136, 1859775360, + 1852707968, 1845561216, 1838335360, 1831030784, + 1823647744, 1816186624, 1808647680, 1801031296, + 1793337728, 1785567360, 1777720576, 1769797504, + 1761798656, 1753724416, 1745574912, 1737350784, + 1729052160, 1720679424, 1712233088, 1703713280, + 1695120640, 1686455296, 1677717632, 1668908288, + 1660027264, 1651075200, 1642052480, 1632959360, + 1623796352, 1614563712, 1605261952, 1595891328, + 1586452480, 1576945536, 1567371136, 1557729664, + 1548021248, 1538246656, 1528406272, 1518500224, + 1508529280, 1498493568, 1488393728, 1478230144, + 1468003328, 1457713536, 1447361280, 1436947072, + 1426471296, 1415934336, 1405336832, 1394679040, + 1383961600, 1373184768, 1362349184, 1351455232, + 1340503424, 1329494144, 1318427904, 1307305216, + 1296126464, 1284892288, 1273603072, 1262259200, + 1250861312, 1239409920, 1227905280, 1216348160, + 1204738816, 1193078016, 1181366016, 1169603456, + 1157790720, 1145928448, 1134017024, 1122057088, + 1110049152, 1097993600, 1085890944, 1073741824, + 1061546688, 1049306112, 1037020608, 1024690624, + 1012316800, 999899584, 987439552, 974937152, + 962393088, 949807744, 937181696, 924515520, + 911809792, 899064960, 886281600, 873460288, + 860601536, 847705984, 834774080, 821806400, + 808803520, 795766016, 782694464, 769589312, + 756451200, 743280704, 730078400, 716844800, + 703580480, 690286016, 676961984, 663608960, + 650227520, 636818176, 623381568, 609918336, + 596428864, 582913920, 569374016, 555809664, + 542221504, 528610176, 514976160, 501320096, + 487642560, 473944128, 460225408, 446486944, + 432729376, 418953280, 405159232, 391347808, + 377519648, 363675296, 349815360, 335940448, + 322051168, 308148064, 294231776, 280302848, + 266361952, 252409632, 238446512, 224473168, + 210490208, 196498224, 182497840, 168489632, + 154474192, 140452144, 126424088, 112390608, + 98352320, 84309816, 70263696, 56214568, + 42163032, 28109692, 14055147, 0 +}; + +const Word32 ivas_mdft_coeff_cos_twid_160_fx[IVAS_160_PT_LEN + 1] = { + 2147483647, + 2147380096, 2147069696, 2146552320, 2145827968, + 2144896896, 2143759104, 2142414592, 2140863616, + 2139106432, 2137142912, 2134973440, 2132598272, + 2130017536, 2127231488, 2124240384, 2121044608, + 2117644288, 2114039936, 2110231808, 2106220288, + 2102005888, 2097588736, 2092969472, 2088148480, + 2083126272, 2077903232, 2072479872, 2066856832, + 2061034624, 2055013760, 2048794752, 2042378368, + 2035764992, 2028955520, 2021950464, 2014750592, + 2007356416, 1999768832, 1991988480, 1984016128, + 1975852672, 1967498624, 1958955008, 1950222592, + 1941302272, 1932194688, 1922900992, 1913421952, + 1903758464, 1893911552, 1883881984, 1873670912, + 1863279232, 1852707968, 1841958144, 1831030784, + 1819927040, 1808647680, 1797194112, 1785567360, + 1773768576, 1761798656, 1749659008, 1737350784, + 1724875008, 1712233088, 1699426048, 1686455296, + 1673321984, 1660027264, 1646572672, 1632959360, + 1619188736, 1605261952, 1591180416, 1576945536, + 1562558720, 1548021248, 1533334656, 1518500224, + 1503519488, 1488393728, 1473124608, 1457713536, + 1442161920, 1426471296, 1410643200, 1394679040, + 1378580608, 1362349184, 1345986560, 1329494144, + 1312873600, 1296126464, 1279254528, 1262259200, + 1245142272, 1227905280, 1210550016, 1193078016, + 1175491072, 1157790720, 1139978880, 1122057088, + 1104027264, 1085890944, 1067649984, 1049306112, + 1030861120, 1012316800, 993674880, 974937152, + 956105536, 937181696, 918167552, 899064960, + 879875648, 860601536, 841244544, 821806400, + 802289088, 782694464, 763024320, 743280704, + 723465472, 703580480, 683627648, 663608960, + 643526272, 623381568, 603176832, 582913920, + 562594816, 542221504, 521795968, 501320096, + 480795936, 460225408, 439610528, 418953280, + 398255648, 377519648, 356747232, 335940448, + 315101280, 294231776, 273333888, 252409632, + 231461072, 210490208, 189499040, 168489632, + 147463968, 126424088, 105372032, 84309816, + 63239472, 42163032, 21082532, 0 +}; + +const Word32 ivas_mdft_coeff_cos_twid_120_fx[IVAS_120_PT_LEN + 1] = { + 2147483647, + 2147299712, 2146747776, 2145827968, 2144540544, + 2142885760, 2140863616, 2138474752, 2135719552, + 2132598272, 2129111680, 2125260160, 2121044608, + 2116465536, 2111523840, 2106220288, 2100556032, + 2094531712, 2088148480, 2081407488, 2074309888, + 2066856832, 2059049728, 2050889728, 2042378368, + 2033516928, 2024307200, 2014750592, 2004848640, + 1994603264, 1984016128, 1973089152, 1961823872, + 1950222592, 1938287104, 1926019584, 1913421952, + 1900496512, 1887245440, 1873670912, 1859775360, + 1845561216, 1831030784, 1816186624, 1801031296, + 1785567360, 1769797504, 1753724416, 1737350784, + 1720679424, 1703713280, 1686455296, 1668908288, + 1651075200, 1632959360, 1614563712, 1595891328, + 1576945536, 1557729664, 1538246656, 1518500224, + 1498493568, 1478230144, 1457713536, 1436947072, + 1415934336, 1394679040, 1373184768, 1351455232, + 1329494144, 1307305216, 1284892288, 1262259200, + 1239409920, 1216348160, 1193078016, 1169603456, + 1145928448, 1122057088, 1097993600, 1073741824, + 1049306112, 1024690624, 999899584, 974937152, + 949807744, 924515520, 899064960, 873460288, + 847705984, 821806400, 795766016, 769589312, + 743280704, 716844800, 690286016, 663608960, + 636818176, 609918336, 582913920, 555809664, + 528610176, 501320096, 473944128, 446486944, + 418953280, 391347808, 363675296, 335940448, + 308148064, 280302848, 252409632, 224473168, + 196498224, 168489632, 140452144, 112390608, + 84309816, 56214568, 28109692, 0 +}; + +const Word32 ivas_mdft_coeff_cos_twid_80_fx[IVAS_80_PT_LEN + 1] = { + 2147483647, + 2147069696, 2145827968, 2143759104, 2140863616, + 2137142912, 2132598272, 2127231488, 2121044608, + 2114039936, 2106220288, 2097588736, 2088148480, + 2077903232, 2066856832, 2055013760, 2042378368, + 2028955520, 2014750592, 1999768832, 1984016128, + 1967498624, 1950222592, 1932194688, 1913421952, + 1893911552, 1873670912, 1852707968, 1831030784, + 1808647680, 1785567360, 1761798656, 1737350784, + 1712233088, 1686455296, 1660027264, 1632959360, + 1605261952, 1576945536, 1548021248, 1518500224, + 1488393728, 1457713536, 1426471296, 1394679040, + 1362349184, 1329494144, 1296126464, 1262259200, + 1227905280, 1193078016, 1157790720, 1122057088, + 1085890944, 1049306112, 1012316800, 974937152, + 937181696, 899064960, 860601536, 821806400, + 782694464, 743280704, 703580480, 663608960, + 623381568, 582913920, 542221504, 501320096, + 460225408, 418953280, 377519648, 335940448, + 294231776, 252409632, 210490208, 168489632, + 126424088, 84309816, 42163032, 0 +}; + +const Word32 ivas_mdft_coeff_cos_twid_40_fx[IVAS_40_PT_LEN + 1] = { + 2147483647, + 2145827968, 2140863616, 2132598272, 2121044608, + 2106220288, 2088148480, 2066856832, 2042378368, + 2014750592, 1984016128, 1950222592, 1913421952, + 1873670912, 1831030784, 1785567360, 1737350784, + 1686455296, 1632959360, 1576945536, 1518500224, + 1457713536, 1394679040, 1329494144, 1262259200, + 1193078016, 1122057088, 1049306112, 974937152, + 899064960, 821806400, 743280704, 663608960, + 582913920, 501320096, 418953280, 335940448, + 252409632, 168489632, 84309816, 0 +}; + +// Q30 +const Word32 dirac_gains_norm_term_int[9] = { + 1073741824, 759250176, 1073741824, 438353280, 219176688, 1073741824, 309962528, 98018768, + 40015996 +}; + +// Q31 +const Word32 dirac_gains_norm_term_fx[9] = { + 2147483647, 1518500352, 2147483647, 876706560, 438353376, 2147483647, 619925056, 196037536, 80031992 +}; + +// Q27 +const Word32 dirac_gains_Pnm_int[91][9] = { + { -134217728, 0, 134217728, 0, 0, -134217728, 0, 0, 0 }, + { -134197288, 2342396, 134156400, -7026119, 122639, -134095104, 14049026, -613106, 10701 }, + { -134135976, 4684105, 133972536, -14043751, 490416, -133727536, 28061840, -2450586, 85575 }, + { -134033784, 7024438, 133666264, -21044428, 1102895, -133115936, 42002312, -5506921, 288606 }, + { -133890784, 9362478, 133238096, -28019012, 1959264, -132262040, 55833192, -9772457, 683351 }, + { -133706992, 11697809, 132688440, -34959892, 3058584, -131167848, 69520408, -15234719, 1332861 }, + { -133482480, 14029564, 132017976, -41858120, 4399464, -129836328, 83027720, -21876818, 2299344 }, + { -133217280, 16357047, 131227600, -48705360, 5980272, -128270864, 96320208, -29678480, 3644062 }, + { -132911536, 18679510, 130318176, -55493180, 7799064, -126475552, 109363520, -38615824, 5427104 }, + { -132565296, 20996256, 129290928, -62213284, 9853607, -124455056, 122123976, -48661468, 7707213 }, + { -132178656, 23306694, 128146968, -68857816, 12141505, -122214432, 134569248, -59785232, 10541761 }, + { -131751776, 25609964, 126887800, -75418320, 14659851, -119759704, 146666688, -71952528, 13986158 }, + { -131284736, 27905410, 125514928, -81886824, 17405570, -117097048, 158385376, -85126080, 18094094 }, + { -130777744, 30192412, 124030024, -88255768, 20375446, -114233392, 169695776, -99266128, 22917396 }, + { -130230888, 32470208, 122434848, -94517128, 23565774, -111176104, 180568608, -114328832, 28505376 }, + { -129644368, 34738112, 120731408, -100663320, 26972664, -107933048, 190976128, -130267952, 34905200 }, + { -129018344, 36995424, 118921736, -106686840, 30591964, -104512608, 200891728, -147034448, 42161440 }, + { -128353056, 39241452, 117008088, -112580368, 34419264, -100923608, 210290720, -164576576, 50316080 }, + { -127648640, 41475572, 114992728, -118336848, 38449984, -97175216, 219149232, -182840512, 59408524 }, + { -126905360, 43697012, 112878208, -123949000, 42679048, -93277184, 227444688, -201769248, 69474696 }, + { -126123408, 45905176, 110666976, -129410248, 47101484, -89239304, 235156848, -221304640, 80548296 }, + { -125303040, 48099312, 108361848, -134713792, 51711740, -85072152, 242266352, -241385344, 92659128 }, + { -124444528, 50278820, 105965584, -139853120, 56504308, -80786280, 248755776, -261949392, 105834368 }, + { -123548080, 52443040, 103481048, -144822272, 61473384, -76392608, 254609280, -282932704, 120097808 }, + { -122614016, 54591264, 100911328, -149614784, 66612780, -71902504, 259812912, -304269024, 135469312 }, + { -121642584, 56722880, 98259536, -154225168, 71916384, -67327280, 264354304, -325891904, 151965872 }, + { -120634104, 58837188, 95528944, -158647504, 77377552, -62678672, 268222720, -347732352, 169600480 }, + { -119588872, 60933588, 92722800, -162876704, 82989840, -57968464, 271409984, -369722464, 188383040 }, + { -118507224, 63011412, 89844624, -166907264, 88746208, -53208660, 273908992, -391791360, 208319200 }, + { -117389480, 65070028, 86897888, -170734608, 94639696, -48411356, 275714624, -413868832, 229411120 }, + { -116235952, 67108864, 83886096, -174353936, 100663296, -43588484, 276824064, -435884832, 251658240 }, + { -115047032, 69127240, 80812992, -177760784, 106809472, -38752388, 277236128, -457767936, 275054816 }, + { -113823072, 71124576, 77682296, -180951136, 113070880, -33915128, 276951296, -479447744, 299592224 }, + { -112564464, 73100224, 74497888, -183920976, 119439696, -29088994, 275972448, -500852768, 325257600 }, + { -111271560, 75053584, 71263600, -186666800, 125908272, -24285974, 274304128, -521913568, 352034976 }, + { -109944736, 76984136, 67983320, -189185120, 132468856, -19517968, 271952224, -542560640, 379905024 }, + { -108584440, 78891192, 64661120, -191472992, 139113184, -14796968, 268925472, -562724864, 408843424 }, + { -107191040, 80774240, 61300996, -193527600, 145833472, -10134552, 265233552, -582338944, 438823936 }, + { -105765016, 82632672, 57907084, -195346384, 152621264, -5542341, 260888528, -601335936, 469815200 }, + { -104306760, 84465968, 54483472, -196927072, 159468512, -1031517, 255903808, -619651456, 501783968 }, + { -102816736, 86273488, 51034412, -198267904, 166366624, 3386773, 250294992, -637221056, 534692032 }, + { -101295408, 88054736, 47564080, -199367280, 173307296, 7701825, 244078832, -653983232, 568498944 }, + { -99743224, 89809192, 44076620, -200223728, 180282192, 11903295, 237274256, -669879040, 603161856 }, + { -98160648, 91536272, 40576356, -200836160, 187282720, 15980983, 229901280, -684849728, 638632640 }, + { -96548144, 93235488, 37067500, -201203920, 194300432, 19925212, 221981760, -698840192, 674862144 }, + { -94906272, 94906272, 33554432, -201326592, 201326592, 23726568, 213539056, -711796992, 711796992 }, + { -93235488, 96548144, 30041364, -201203920, 208352752, 27376188, 204597888, -723670016, 749382016 }, + { -91536272, 98160648, 26532496, -200836160, 215370464, 30865648, 195183856, -734411520, 787559936 }, + { -89809200, 99743208, 23032272, -200223728, 222370864, 34186800, 185324752, -743976000, 826268864 }, + { -88054736, 101295408, 19544786, -199367280, 229345888, 37332284, 175048640, -752322176, 865447872 }, + { -86273488, 102816736, 16074439, -198268032, 236286560, 40294912, 164385440, -759410496, 905030144 }, + { -84465944, 104306784, 12625336, -196927072, 243184800, 43068320, 153365504, -765205632, 944950528 }, + { -82632672, 105765016, 9201773, -195346384, 250031920, 45646496, 142020480, -769675200, 985139200 }, + { -80774256, 107191032, 5807891, -193527600, 256819584, 48024044, 130382952, -772789696, 1025526400 }, + { -78891192, 108584440, 2447739, -191472992, 263540000, 50196224, 118485736, -774524480, 1066041600 }, + { -76984120, 109944720, -874438, -189185120, 270184320, 52158672, 106363224, -774856768, 1106610176 }, + { -75053584, 111271544, -4154720, -186666800, 276744864, 53907864, 94049432, -773768704, 1147159552 }, + { -73100224, 112564464, -7389016, -183920976, 283213504, 55440728, 81579720, -771245696, 1187614080 }, + { -71124568, 113823072, -10573435, -180951136, 289582400, 56754824, 68989160, -767276288, 1227898496 }, + { -69127232, 115047064, -13704140, -177760784, 295843776, 57848416, 56313356, -761853888, 1267938048 }, + { -67108880, 116235952, -16777203, -174353936, 301989888, 58720256, 43588536, -754974720, 1307654528 }, + { -65070028, 117389472, -19788994, -170734608, 308013440, 59369844, 30850226, -746639232, 1346972928 }, + { -63011400, 118507224, -22735772, -166907264, 313906944, 59797272, 18134762, -736851968, 1385816832 }, + { -60933588, 119588872, -25613950, -162876704, 319663424, 60003204, 5477891, -725620736, 1424110464 }, + { -58837172, 120634088, -28420080, -158647504, 325275584, 59989016, -7084927, -712957184, 1461778688 }, + { -56722868, 121642576, -31150674, -154225168, 330736768, 59756660, -19517928, -698877184, 1498746240 }, + { -54591276, 122613992, -33802452, -149614784, 336040384, 59308680, -31786382, -683399744, 1534940800 }, + { -52443040, 123548064, -36372160, -144822272, 341179712, 58648260, -43855684, -666547776, 1570288384 }, + { -50278848, 124444520, -38856688, -139853264, 346148864, 57779188, -55691916, -648348160, 1604717952 }, + { -48099324, 125303040, -41252988, -134713792, 350941376, 56705796, -67261816, -628830848, 1638160896 }, + { -45905160, 126123416, -43558124, -129410240, 355551744, 55433036, -78532848, -608029120, 1670546304 }, + { -43697012, 126905360, -45769332, -123949000, 359974080, 53966400, -89473440, -585980480, 1701810944 }, + { -41475560, 127648632, -47883864, -118336808, 364203168, 52311936, -100052728, -562724992, 1731889152 }, + { -39241464, 128353048, -49899212, -112580408, 368233856, 50476188, -110241232, -538305984, 1760719104 }, + { -36995424, 129018360, -51812888, -106686856, 372061216, 48466224, -120010336, -512769824, 1788240512 }, + { -34738100, 129644368, -53622532, -100663280, 375680512, 46289628, -129332608, -486166400, 1814398208 }, + { -32470208, 130230888, -55325984, -94517088, 379087360, 43954400, -138181984, -458547616, 1839134464 }, + { -30192412, 130777744, -56921148, -88255752, 382277728, 41469052, -146533552, -429968768, 1862399872 }, + { -27905450, 131284752, -58406064, -81886920, 385247552, 38842476, -154363936, -400487584, 1884144384 }, + { -25609950, 131751776, -59778952, -75418272, 387993376, 36083912, -161651424, -370163232, 1904324096 }, + { -23306666, 132178656, -61038128, -68857760, 390511712, 33203050, -168375472, -339058272, 1922894464 }, + { -20996270, 132565280, -62182040, -62213328, 392799456, 30209874, -174517136, -307236864, 1939817984 }, + { -18679498, 132911536, -63209344, -55493124, 394854208, 27114732, -180059392, -274765312, 1955057024 }, + { -16357021, 133217280, -64118736, -48705292, 396672992, 23928188, -184986656, -241711232, 1968580864 }, + { -14029578, 133482472, -64909128, -41858176, 398253664, 20661142, -189285248, -208144320, 1980359808 }, + { -11697849, 133706992, -65579560, -34960012, 399594624, 17324636, -192943088, -174134880, 1990369664 }, + { -9362556, 133890784, -66129224, -28019252, 400693888, 13929935, -195949824, -139755008, 1998589184 }, + { -7024411, 134033784, -66557432, -21044346, 401550304, 10488515, -198297168, -105077560, 2004999424 }, + { -4684126, 134135976, -66863648, -14043818, 402162752, 7011926, -199978640, -70176320, 2009588352 }, + { -2342414, 134197304, -67047540, -7026174, 402530496, 3511839, -200989440, -35125516, 2012346496 }, + { -5, 134217728, -67108864, -17, 402653184, 8, -201326592, -88, 2013265920 } +}; + +// Q30 +const Word32 dirac_gains_trg_term_int[181][2] = { + { -1073741824, 93 }, + { -1073578304, -18739436 }, + { -1073087680, -37473000 }, + { -1072270272, -56195404 }, + { -1071126272, -74900440 }, + { -1069655936, -93582656 }, + { -1067859776, -112236624 }, + { -1065738240, -130856168 }, + { -1063292288, -149436080 }, + { -1060522368, -167970160 }, + { -1057429248, -186453440 }, + { -1054014208, -204879600 }, + { -1050278016, -223243376 }, + { -1046221952, -241539408 }, + { -1041847104, -259761664 }, + { -1037154944, -277904896 }, + { -1032146880, -295963392 }, + { -1026824448, -313931616 }, + { -1021189120, -331804480 }, + { -1015242880, -349576096 }, + { -1008987264, -367241408 }, + { -1002424448, -384794592 }, + { -995556160, -402230656 }, + { -988384640, -419544416 }, + { -980912000, -436730112 }, + { -973140608, -453782944 }, + { -965072832, -470697376 }, + { -956710976, -487468704 }, + { -948057792, -504091296 }, + { -939115840, -520560224 }, + { -929887680, -536871040 }, + { -920376384, -553017856 }, + { -910584576, -568996544 }, + { -900515712, -584801664 }, + { -890172480, -600428672 }, + { -879557888, -615873088 }, + { -868675520, -631129536 }, + { -857528320, -646194048 }, + { -846120128, -661061376 }, + { -834454080, -675727744 }, + { -822533888, -690187904 }, + { -810363392, -704438016 }, + { -797945664, -718473536 }, + { -785285056, -732290112 }, + { -772385152, -745883904 }, + { -759250176, -759250176 }, + { -745883904, -772385152 }, + { -732290112, -785285056 }, + { -718473600, -797945664 }, + { -704438016, -810363392 }, + { -690187904, -822533888 }, + { -675727552, -834454144 }, + { -661061376, -846120128 }, + { -646194048, -857528320 }, + { -631129536, -868675392 }, + { -615873088, -879557760 }, + { -600428672, -890172352 }, + { -584801792, -900515712 }, + { -568996544, -910584576 }, + { -553017856, -920376384 }, + { -536871040, -929887680 }, + { -520560224, -939115776 }, + { -504091296, -948057792 }, + { -487468704, -956710976 }, + { -470697376, -965072832 }, + { -453782944, -973140608 }, + { -436730208, -980911936 }, + { -419544416, -988384640 }, + { -402230784, -995556160 }, + { -384794592, -1002424448 }, + { -367241280, -1008987264 }, + { -349576096, -1015242880 }, + { -331804480, -1021189120 }, + { -313931712, -1026824384 }, + { -295963392, -1032146880 }, + { -277904800, -1037154944 }, + { -259761664, -1041847104 }, + { -241539296, -1046221952 }, + { -223243488, -1050278016 }, + { -204879600, -1054014208 }, + { -186453328, -1057429248 }, + { -167970160, -1060522368 }, + { -149435984, -1063292288 }, + { -130856168, -1065738240 }, + { -112236624, -1067859776 }, + { -93582792, -1069655936 }, + { -74900448, -1071126272 }, + { -56195288, -1072270272 }, + { -37473008, -1073087680 }, + { -18739318, -1073578304 }, + { -46, -1073741824 }, + { 18739350, -1073578304 }, + { 37473052, -1073087680 }, + { 56195320, -1072270272 }, + { 74900480, -1071126272 }, + { 93582824, -1069655936 }, + { 112236512, -1067859776 }, + { 130856168, -1065738240 }, + { 149435984, -1063292288 }, + { 167970272, -1060522368 }, + { 186453328, -1057429248 }, + { 204879504, -1054014208 }, + { 223243488, -1050278016 }, + { 241539296, -1046221952 }, + { 259761664, -1041847104 }, + { 277904896, -1037154944 }, + { 295963392, -1032146880 }, + { 313931712, -1026824448 }, + { 331804480, -1021189120 }, + { 349576096, -1015242880 }, + { 367241408, -1008987264 }, + { 384794720, -1002424320 }, + { 402230784, -995556160 }, + { 419544320, -988384640 }, + { 436730112, -980912000 }, + { 453782848, -973140608 }, + { 470697504, -965072832 }, + { 487468576, -956710976 }, + { 504091296, -948057792 }, + { 520560352, -939115776 }, + { 536870912, -929887680 }, + { 553017920, -920376384 }, + { 568996544, -910584704 }, + { 584801664, -900515712 }, + { 600428800, -890172224 }, + { 615873088, -879557888 }, + { 631129536, -868675392 }, + { 646193920, -857528320 }, + { 661061504, -846120064 }, + { 675727616, -834454144 }, + { 690187904, -822533888 }, + { 704438016, -810363136 }, + { 718473536, -797945792 }, + { 732290176, -785285056 }, + { 745883776, -772385216 }, + { 759250176, -759250176 }, + { 772385216, -745883776 }, + { 785285056, -732290112 }, + { 797945664, -718473536 }, + { 810363264, -704438016 }, + { 822533888, -690187904 }, + { 834454144, -675727616 }, + { 846120128, -661061504 }, + { 857528320, -646193920 }, + { 868675392, -631129536 }, + { 879557888, -615873088 }, + { 890172352, -600428800 }, + { 900515712, -584801792 }, + { 910584704, -568996544 }, + { 920376384, -553017920 }, + { 929887680, -536870912 }, + { 939115776, -520560352 }, + { 948057792, -504091296 }, + { 956710976, -487468576 }, + { 965072832, -470697504 }, + { 973140608, -453782944 }, + { 980911936, -436730112 }, + { 988384640, -419544320 }, + { 995556160, -402230784 }, + { 1002424320, -384794592 }, + { 1008987264, -367241280 }, + { 1015242880, -349576096 }, + { 1021189120, -331804480 }, + { 1026824448, -313931712 }, + { 1032146880, -295963392 }, + { 1037154944, -277904800 }, + { 1041847104, -259761664 }, + { 1046221952, -241539296 }, + { 1050278016, -223243488 }, + { 1054014208, -204879600 }, + { 1057429248, -186453328 }, + { 1060522368, -167970272 }, + { 1063292288, -149435984 }, + { 1065738240, -130856168 }, + { 1067859776, -112236624 }, + { 1069655936, -93582760 }, + { 1071126272, -74900440 }, + { 1072270272, -56195308 }, + { 1073087680, -37473052 }, + { 1073578304, -18739382 }, + { 1073741824, 0 } +}; + +// Q31 +const Word32 dirac_gains_trg_term_fx[181][2] = { + { ( -2147483647 - 1 ), 187 }, + { -2147156608, -37478872 }, + { -2146175360, -74946000 }, + { -2144540544, -112390808 }, + { -2142252544, -149800880 }, + { -2139311872, -187165312 }, + { -2135719552, -224473248 }, + { -2131476480, -261712336 }, + { -2126584576, -298872160 }, + { -2121044736, -335940320 }, + { -2114858496, -372906880 }, + { -2108028416, -409759200 }, + { -2100556032, -446486752 }, + { -2092443904, -483078816 }, + { -2083694208, -519523328 }, + { -2074309888, -555809792 }, + { -2064293760, -591926784 }, + { -2053648896, -627863232 }, + { -2042378240, -663608960 }, + { -2030485760, -699152192 }, + { -2017974528, -734482816 }, + { -2004848896, -769589184 }, + { -1991112320, -804461312 }, + { -1976769280, -839088832 }, + { -1961824000, -873460224 }, + { -1946281216, -907565888 }, + { -1930145664, -941394752 }, + { -1913421952, -974937408 }, + { -1896115584, -1008182592 }, + { -1878231680, -1041120448 }, + { -1859775360, -1073742080 }, + { -1840752768, -1106035712 }, + { -1821169152, -1137993088 }, + { -1801031424, -1169603328 }, + { -1780344960, -1200857344 }, + { -1759115776, -1231746176 }, + { -1737351040, -1262259072 }, + { -1715056640, -1292388096 }, + { -1692240256, -1322122752 }, + { -1668908160, -1351455488 }, + { -1645067776, -1380375808 }, + { -1620726784, -1408876032 }, + { -1595891328, -1436947072 }, + { -1570570112, -1464580224 }, + { -1544770304, -1491767808 }, + { -1518500352, -1518500352 }, + { -1491767808, -1544770304 }, + { -1464580224, -1570570112 }, + { -1436947200, -1595891328 }, + { -1408876032, -1620726784 }, + { -1380375808, -1645067776 }, + { -1351455104, -1668908288 }, + { -1322122752, -1692240256 }, + { -1292388096, -1715056640 }, + { -1262259072, -1737350784 }, + { -1231746176, -1759115520 }, + { -1200857344, -1780344704 }, + { -1169603584, -1801031424 }, + { -1137993088, -1821169152 }, + { -1106035712, -1840752768 }, + { -1073742080, -1859775360 }, + { -1041120448, -1878231552 }, + { -1008182592, -1896115584 }, + { -974937408, -1913421952 }, + { -941394752, -1930145664 }, + { -907565888, -1946281216 }, + { -873460416, -1961823872 }, + { -839088832, -1976769280 }, + { -804461568, -1991112320 }, + { -769589184, -2004848896 }, + { -734482560, -2017974528 }, + { -699152192, -2030485760 }, + { -663608960, -2042378240 }, + { -627863424, -2053648768 }, + { -591926784, -2064293760 }, + { -555809600, -2074309888 }, + { -519523328, -2083694208 }, + { -483078592, -2092443904 }, + { -446486976, -2100556032 }, + { -409759200, -2108028416 }, + { -372906656, -2114858496 }, + { -335940320, -2121044736 }, + { -298871968, -2126584576 }, + { -261712336, -2131476480 }, + { -224473248, -2135719552 }, + { -187165584, -2139311872 }, + { -149800896, -2142252544 }, + { -112390576, -2144540544 }, + { -74946016, -2146175360 }, + { -37478636, -2147156608 }, + { -93, ( -2147483647 - 1 ) }, + { 37478700, -2147156608 }, + { 74946104, -2146175360 }, + { 112390640, -2144540544 }, + { 149800960, -2142252544 }, + { 187165648, -2139311872 }, + { 224473024, -2135719552 }, + { 261712336, -2131476480 }, + { 298871968, -2126584576 }, + { 335940544, -2121044736 }, + { 372906656, -2114858496 }, + { 409759008, -2108028416 }, + { 446486976, -2100556032 }, + { 483078592, -2092443904 }, + { 519523328, -2083694208 }, + { 555809792, -2074309888 }, + { 591926784, -2064293760 }, + { 627863424, -2053648896 }, + { 663608960, -2042378240 }, + { 699152192, -2030485760 }, + { 734482816, -2017974528 }, + { 769589440, -2004848640 }, + { 804461568, -1991112320 }, + { 839088640, -1976769280 }, + { 873460224, -1961824000 }, + { 907565696, -1946281216 }, + { 941395008, -1930145664 }, + { 974937152, -1913421952 }, + { 1008182592, -1896115584 }, + { 1041120704, -1878231552 }, + { 1073741824, -1859775360 }, + { 1106035840, -1840752768 }, + { 1137993088, -1821169408 }, + { 1169603328, -1801031424 }, + { 1200857600, -1780344448 }, + { 1231746176, -1759115776 }, + { 1262259072, -1737350784 }, + { 1292387840, -1715056640 }, + { 1322123008, -1692240128 }, + { 1351455232, -1668908288 }, + { 1380375808, -1645067776 }, + { 1408876032, -1620726272 }, + { 1436947072, -1595891584 }, + { 1464580352, -1570570112 }, + { 1491767552, -1544770432 }, + { 1518500352, -1518500352 }, + { 1544770432, -1491767552 }, + { 1570570112, -1464580224 }, + { 1595891328, -1436947072 }, + { 1620726528, -1408876032 }, + { 1645067776, -1380375808 }, + { 1668908288, -1351455232 }, + { 1692240256, -1322123008 }, + { 1715056640, -1292387840 }, + { 1737350784, -1262259072 }, + { 1759115776, -1231746176 }, + { 1780344704, -1200857600 }, + { 1801031424, -1169603584 }, + { 1821169408, -1137993088 }, + { 1840752768, -1106035840 }, + { 1859775360, -1073741824 }, + { 1878231552, -1041120704 }, + { 1896115584, -1008182592 }, + { 1913421952, -974937152 }, + { 1930145664, -941395008 }, + { 1946281216, -907565888 }, + { 1961823872, -873460224 }, + { 1976769280, -839088640 }, + { 1991112320, -804461568 }, + { 2004848640, -769589184 }, + { 2017974528, -734482560 }, + { 2030485760, -699152192 }, + { 2042378240, -663608960 }, + { 2053648896, -627863424 }, + { 2064293760, -591926784 }, + { 2074309888, -555809600 }, + { 2083694208, -519523328 }, + { 2092443904, -483078592 }, + { 2100556032, -446486976 }, + { 2108028416, -409759200 }, + { 2114858496, -372906656 }, + { 2121044736, -335940544 }, + { 2126584576, -298871968 }, + { 2131476480, -261712336 }, + { 2135719552, -224473248 }, + { 2139311872, -187165520 }, + { 2142252544, -149800880 }, + { 2144540544, -112390616 }, + { 2146175360, -74946104 }, + { 2147156608, -37478764 }, + { 2147483647, 0 } +}; + +/*------------------------------------------------------------------------------------------* + * FB ROM tables + *------------------------------------------------------------------------------------------*/ + +const Word16 ivas_fb_cf_4ms_48k_fx[IVAS_FB_4MS_48K_SAMP] = { + 0, 4, 13, 26, 44, 66, 92, 123, 158, 197, 241, 289, 341, 398, 458, 524, 593, 667, 744, 826, 913, 1003, 1097, 1196, 1298, 1405, 1516, 1630, 1749, 1871, 1998, 2128, 2262, 2400, 2541, 2687, 2836, 2988, 3144, 3304, 3467, 3634, 3804, 3977, 4154, 4334, 4517, 4704, 4893, 5086, 5282, 5480, 5682, 5886, 6094, 6304, 6516, 6732, 6949, 7170, 7393, 7618, 7846, 8076, 8308, 8542, 8779, 9017, 9258, 9500, 9744, 9990, 10238, 10487, 10738, 10990, 11244, 11499, 11756, 12014, 12273, 12533, 12794, 13056, 13319, 13582, 13847, 14112, 14378, 14644, 14911, 15178, 15446, 15713, 15981, 16249, 16518, 16786, 17054, 17321, 17589, 17856, 18123, 18389, 18655, 18920, 19185, 19448, 19711, 19973, 20234, 20494, 20753, 21011, 21268, 21523, 21777, 22029, 22280, 22529, 22777, 23023, 23267, 23509, 23750, 23988, 24225, 24459, 24691, 24921, 25149, 25374, 25597, 25818, 26035, 26251, 26463, 26673, 26881, 27085, 27287, 27485, 27681, 27874, 28063, 28250, 28433, 28613, 28790, 28963, 29133, 29300, 29463, 29623, 29779, 29931, 30080, 30226, 30367, 30505, 30639, 30769, 30896, 31018, 31137, 31251, 31362, 31469, 31571, 31670, 31764, 31854, 31941, 32023, 32100, 32174, 32243, 32309, 32369, 32426, 32478, 32526, 32570, 32609, 32644, 32675, 32701, 32723, 32741, 32754, 32763, 32767 +}; + +const Word16 ivas_fb_cf_4ms_32k_fx[IVAS_FB_4MS_32K_SAMP] = { + 1, 11, 30, 60, 99, 149, 208, 276, 355, 443, 541, 648, 765, 891, 1026, 1171, 1325, 1488, 1660, 1840, 2030, 2228, 2435, 2650, 2873, 3105, 3345, 3592, 3847, 4110, 4380, 4657, 4941, 5233, 5530, 5835, 6146, 6463, 6786, 7115, 7449, 7789, 8134, 8483, 8838, 9197, 9561, 9928, 10300, 10675, 11054, 11435, 11820, 12208, 12598, 12990, 13385, 13781, 14179, 14578, 14978, 15379, 15780, 16182, 16585, 16987, 17388, 17789, 18189, 18588, 18986, 19382, 19777, 20169, 20559, 20947, 21332, 21713, 22092, 22467, 22839, 23206, 23570, 23929, 24284, 24633, 24978, 25318, 25652, 25981, 26304, 26621, 26932, 27237, 27534, 27826, 28110, 28387, 28657, 28920, 29175, 29422, 29662, 29894, 30117, 30332, 30539, 30737, 30927, 31107, 31279, 31442, 31596, 31741, 31876, 32002, 32119, 32226, 32324, 32412, 32491, 32559, 32618, 32668, 32707, 32737, 32756, 32766 +}; + +const Word16 ivas_fb_cf_4ms_16k_fx[IVAS_FB_4MS_16K_SAMP] = { + 4, 44, 123, 241, 398, 593, 826, 1097, 1405, 1749, 2128, 2541, 2988, 3467, 3977, 4517, 5086, 5682, 6304, 6949, 7618, 8308, 9017, 9744, 10487, 11244, 12014, 12794, 13582, 14378, 15178, 15981, 16786, 17589, 18389, 19185, 19973, 20753, 21523, 22280, 23023, 23750, 24459, 25149, 25818, 26463, 27085, 27681, 28250, 28790, 29300, 29779, 30226, 30639, 31018, 31362, 31670, 31941, 32174, 32369, 32526, 32644, 32723, 32763 +}; + +const Word16 ivas_fb_cf_1ms_48k_fx[IVAS_FB_1MS_48K_SAMP] = { + 8, 78, 218, 427, 705, 1050, 1460, 1934, 2470, 3066, 3718, 4425, 5184, 5990, 6840, 7732, 8660, 9622, 10612, 11627, 12663, 13715, 14778, 15847, 16920, 17989, 19052, 20104, 21140, 22155, 23145, 24107, 25035, 25927, 26777, 27583, 28342, 29049, 29701, 30297, 30833, 31307, 31717, 32062, 32340, 32549, 32689, 32759 +}; + +const Word16 ivas_fb_cf_1ms_32k_fx[IVAS_FB_1MS_32K_SAMP] = { + 19, 177, 491, 957, 1573, 2330, 3224, 4244, 5381, 6624, 7960, 9378, 10864, 12403, 13979, 15580, 17187, 18788, 20364, 21903, 23389, 24807, 26143, 27386, 28523, 29543, 30437, 31194, 31810, 32276, 32590, 32748 +}; + +const Word16 ivas_fb_cf_1ms_16k_fx[IVAS_FB_1MS_16K_SAMP] = { + 78, 705, 1934, 3718, 5990, 8660, 11627, 14778, 17989, 21140, 24107, 26777, 29049, 30833, 32062, 32689 +}; + +/* Q Factor is 31*/ +const Word32 ivas_fb_resp_cheby_ramp_32del_fx[IVAS_FB_1MS_32K_SAMP + 1] = { + 21970992, 16097417, 21859084, 28772960, 36989692, 46636088, 57839904, 70755400, 85490472, + 102165872, 120908192, 141807584, 164922576, 190321136, 218072144, 248214064, 280795872, + 315834176, 353276992, 393021664, 435109696, 479474528, 525959424, 574472512, 624859584, + 676981248, 730657728, 785668096, 841854208, 899002688, 956860544, 1015180800, 1073741824 +}; + +/* Q Factor is 31*/ +const Word32 ivas_fb_resp_cheby_ramp_16del_fx[IVAS_FB_1MS_16K_SAMP + 1] = { + 23460896, 29872362, 47814248, 71691184, 102337872, 140498880, 186843680, 241748256, 305433120, + 377921280, 458893152, 547769792, 643727232, 745668672, 852315136, 962208832, 1073741824 +}; + +/*------------------------------------------------------------------------------------------* + * SNS MSVQ codebooks and means + *------------------------------------------------------------------------------------------*/ + +/*Q12*/ +const Word16 ivas_sns_cdbk_tcx20_stage1_fx[128 * 16] = { + -7498, -8552, -3948, 11493, 10929, 4767, 5696, 4985, 5673, 1825, -1927, -2174, -3321, -4771, -5964, -7214, + -10641, -13643, -7600, -1477, 6893, 10597, 4021, 919, -537, 684, 6146, 1349, 1375, 4748, 736, -3571, + 8121, 9016, 4721, 3315, 3543, 4759, 5279, 5578, 4435, 3410, 492, -2942, -8990, -12493, -13751, -14493, + 646, 4522, 1609, -2654, -4481, -4275, -4938, -4698, -4089, -1547, 1428, 4430, 5202, 4974, 3429, 441, + 1001, -2898, -4776, -4824, -1005, 1623, 4558, 5049, 5546, 4459, 3687, 3688, -126, -3430, -5243, -7311, + -3765, -762, -3030, -6261, -7149, -5194, -3869, 997, 5325, 6801, 5249, 4107, 2928, 2308, 1946, 369, + 10168, 5956, 3730, 2771, 2326, 2853, 3117, 2884, 1479, -133, -2832, -4621, -6076, -6372, -6981, -8269, + 9885, 6118, 4056, 3729, 2954, 2262, 382, -887, -2030, -1996, -3016, -3773, -4113, -4045, -4375, -5152, + -3335, 5139, 6949, 5817, 4078, 4678, 4112, 3805, 2705, 921, -2675, -4919, -5304, -5636, -7035, -9300, + -5726, 774, 1426, -213, -1582, -1060, -1381, -448, -337, 307, -78, 485, 1252, 2090, 2767, 1723, + 4376, 8005, 8723, 8483, 6453, 4642, 1740, -811, -3455, -4423, -5495, -5697, -5721, -5357, -5457, -6006, + 9786, 10280, 4686, 1498, -692, -958, 1101, 3151, 2236, 2122, -1101, -3777, -4952, -6004, -7796, -9579, + -5550, 5500, 6501, 7932, 2414, 2004, -724, -797, 465, 79, 1246, -954, -8806, -5066, -857, -3387, + 3592, -6275, -6564, -5666, -2347, -3624, -3711, -4039, -4858, -5538, -5004, -2044, 6173, 16714, 9046, 14147, + 16852, 13619, 9025, 4301, 605, -1497, -3065, -3483, -4472, -4221, -4897, -5230, -4820, -4121, -3894, -4701, + 3227, 10297, 4142, -3143, -5540, -3558, 1739, 5927, 5194, 4741, -1693, -3809, -3779, -3780, -3312, -6653, + -9100, -5057, -1642, 2448, -2023, 4879, 133, 5593, 1767, 4924, 6821, 2411, -1210, -4078, -4246, -1619, + -7619, -11980, 600, 2505, 2570, -5562, 1970, -1802, 2335, 4846, -4895, 3392, 5151, 6508, 2257, -277, + 8936, 11845, 11978, 10584, 9236, 7186, 3794, 1874, -708, -3953, -7322, -9670, -10750, -10778, -10917, -11335, + 8587, 838, -5142, -8197, -8172, -5767, -4419, -1944, -79, 1853, 3022, 3823, 4142, 4618, 3723, 3112, + -5283, 568, 1979, 2570, 2120, 2234, 1918, 2247, 1603, 2038, 1584, -93, -1478, -3355, -4339, -4312, + 3278, 2345, 280, -2908, -4330, -3770, -3036, -1236, 758, 3245, 3120, 2288, 1603, 916, -401, -2152, + 18828, 10647, 3579, -3906, -287, 10855, 5635, -3673, -6872, -5289, -2424, -5462, -6052, -2769, -4104, -8707, + -4121, 2761, 3751, 4035, 3218, -38, -1640, -513, -750, -12, -1597, -1672, -1522, -637, 42, -1302, + -5458, 2924, 6701, 9084, 6798, 7952, 4454, 5450, 5949, 5277, -2303, -8307, -11701, -10523, -8863, -7432, + 379, 6294, 8583, 7842, 6055, 3554, -1419, -894, -4610, -4731, -3777, -2242, -3681, -3172, -3323, -4856, + 9040, 14426, 8046, 2314, -89, 612, 655, 895, -4796, -4631, -1323, -264, -6051, -6580, -5728, -6526, + 10320, 9632, 5351, 853, -2496, -4459, -5580, -5161, -5476, -4380, -3281, -1752, -624, 1835, 2457, 2762, + 6230, 4286, 3054, 2103, 1411, 882, -116, -345, 353, 511, -1457, -2334, -2581, -2840, -3948, -5209, + -2351, -845, -4051, -7663, -8133, -6619, -6596, -5580, -3850, -278, 3739, 7371, 8632, 9397, 9551, 7277, + 14878, 8087, 1612, -2811, -4559, -4173, -3660, -2457, -1780, -938, -1082, -880, -541, 40, -680, -1056, + -357, 6763, 7507, 2217, 983, 5824, 3263, 5362, 4023, 5140, -7718, -7703, -6304, -5528, -5237, -8233, + -9056, -2879, 4548, 9096, 9567, 8235, 6713, 5876, 4240, 2331, -452, -3615, -6496, -8240, -9501, -10367, + -6591, -10319, -10037, 1092, 9508, 10608, 14496, -4303, -5138, -1136, 3886, 5677, 2912, -4172, -5188, -1298, + 3868, 10098, 10930, 8191, 5304, 4169, 3641, 2883, 1198, -205, -3154, -5928, -8536, -10323, -10806, -11331, + -580, -1263, -2402, -5074, -6014, -4529, -3202, -2168, -259, 2212, 3665, 5339, 5604, 4695, 3222, 754, + 1658, -3851, -5014, -4529, -1764, -300, 8217, 16396, 2000, 824, 665, -1713, -3175, -3034, -3057, -3324, + -11375, -8634, -6184, -6208, -4129, -150, 1519, 4345, 5629, 5310, 4007, 4455, 3926, 3560, 3104, 823, + 7473, 12120, 11294, 4728, 3568, 5501, 3688, 3508, 1692, -1661, -8566, -9762, -8843, -8001, -8086, -8653, + 8613, 5171, 4353, 3298, 925, -530, -1637, -2214, -3071, -2941, -3234, -2961, -2504, -1211, -880, -1176, + 621, 10589, 7196, 3759, 1529, -659, -1898, -893, -380, -88, -927, -1736, -2729, -3606, -4369, -6410, + -10687, -7849, -5755, -6353, -5913, -3150, -2865, -1183, -382, 1696, 2622, 5191, 7208, 8842, 10178, 8401, + -366, 8121, 9838, 5330, 503, 3640, 5493, 4385, 472, -837, -3977, -9982, -8797, -5441, -3061, -5319, + 10435, 576, -3431, -5099, -5048, -3131, -1414, 1467, 2492, 2334, 1243, 257, 1129, 1454, -1171, -2093, + -2408, 4154, 6243, 5033, 3118, 2477, 901, 862, 622, 627, -473, -1897, -2823, -3803, -5378, -7253, + 5751, -3944, -5457, -3268, 270, -185, -1373, -2563, -3758, -4024, -4052, -3460, -2709, -237, 9209, 19800, + 11172, 15303, 13936, 10936, 5606, 374, -3235, -4534, -5841, -5872, -6303, -6525, -6391, -6176, -6037, -6414, + 5173, 10429, 7690, -211, -4293, -3886, -1661, 896, 81, -608, -1808, -2380, -2191, -1905, -2123, -3203, + -8788, -1052, 5387, 6699, 5899, 3671, 3443, 3830, 4015, 2746, -536, -2438, -3985, -4693, -6124, -8075, + -8721, -8773, -1913, 3002, 5005, -1141, -1250, 4860, 3573, -249, 246, 1790, 3243, 3739, -189, -3222, + 12821, 11330, 7418, 6142, 4487, 3660, 3434, 2422, 898, -805, -4025, -7013, -9016, -9871, -10400, -11484, + 6459, 1432, -705, -1814, -2564, -2337, -2669, -1789, -1565, -767, -696, -14, 629, 1614, 2310, 2475, + 523, 864, 661, 262, 533, 1619, 2390, 2554, 2076, 1532, 248, -542, -1545, -2462, -3431, -5282, + 2754, 7840, 1531, -5320, -7337, -5059, -1828, 2415, 2801, 2414, 920, -54, -675, 295, 594, -1290, + 16459, 9353, 5397, 5154, 6401, 4035, 525, -1206, -2684, -3963, -5726, -6290, -6446, -6516, -6917, -7575, + 3331, 2764, 1820, 1449, 404, 197, -617, -518, -755, -625, -1250, -1192, -1278, -978, -1091, -1661, + 1202, 10867, 13999, 10573, 8667, 5713, 3901, 1699, -649, -3697, -6326, -8102, -9055, -9334, -9517, -9940, + 3105, 10471, 11637, 9256, 1588, -4373, -5838, -3257, -2501, -2719, -3963, -4248, -3642, -2230, -780, -2506, + 7036, 12562, 13320, 10158, 3016, -3341, -3328, 586, 1408, -1129, -5924, -5878, -5793, -6843, -7570, -8279, + 11292, 4466, 2522, 790, -1414, -1946, -1506, -261, 583, 802, -656, -1773, -2651, -2250, -3307, -4691, + 4319, 4371, 4567, 4600, 3221, 2633, 1994, 1398, 564, -536, -2662, -3664, -4402, -4565, -5348, -6489, + -7437, -5416, -5951, -7745, -7676, -4554, -4813, -2349, 668, 6481, 8239, 7629, 6574, 6530, 6295, 3525, + 13292, 11390, 5199, 2139, 489, -271, -644, -427, -1114, -1854, -3425, -4756, -5461, -5211, -4922, -4424, + 710, 9953, 9525, 5612, 1946, 2958, 298, -154, -1714, -3333, -6410, -9882, -5524, -2172, -432, -1382, + -10643, -8047, -2326, 2007, 3553, 2546, 4871, 5435, 4843, 4106, 2244, 1050, -497, -1808, -2878, -4457, + 294, -9337, -8427, -1045, 9093, 10411, 3417, 3239, 2068, -534, 1078, -1517, -2125, -1732, -2738, -2145, + 5432, 12777, 10582, 2772, -92, 2136, 2501, 4105, 2738, 3539, -1530, -8480, -9513, -8753, -8426, -9787, + 5972, 8255, 4335, -524, -2484, -2872, -3937, -3518, -3037, -774, 635, 1891, 1590, 660, -1520, -4672, + 6572, 3645, -218, -1090, 345, 2321, 3692, 4654, 4719, 3041, 2117, 459, -3402, -7045, -8640, -11170, + -5410, -344, -990, -3893, -5051, -2311, -77, 3918, 4679, 4822, 3303, 1776, 337, 305, 409, -1472, + 8389, 11222, 8707, 4721, 3131, 2061, 1130, 791, -354, -651, -3686, -5202, -6383, -7339, -7792, -8746, + 9298, 9362, 6305, 3177, 968, -72, -945, -819, -1079, -725, -2067, -2739, -3434, -4331, -5460, -7441, + 2704, 6870, 6571, 6294, 4511, 3348, 2296, 2931, 2159, 954, -1545, -3421, -5465, -7201, -9296, -11710, + 880, -1826, -3492, -4233, -3893, -2425, -1948, -823, -259, 657, 1000, 2107, 2906, 3603, 3958, 3790, + -196, 6860, 8581, 9562, 7277, 7244, 1471, 1946, -228, -338, -3115, -7547, -11656, -9838, -4686, -5339, + 8578, 4837, 2226, 754, -1817, -2201, 499, 2914, 3313, 3158, -527, -4733, -5791, -4100, -3403, -3706, + -4232, 6556, 1920, 6615, -946, 4468, 280, 2157, 766, -524, -922, -1974, -2072, -1600, -4968, -5524, + 7288, 2936, -1640, -4588, -6332, -6285, -6188, -5571, -5223, -3844, -1671, 2013, 5110, 8289, 8345, 7362, + 11493, 11342, 6954, 1821, -1692, -2612, -3300, -3319, -3814, -2738, -2931, -2814, -2479, -1890, -1719, -2303, + 8177, 11903, 6525, -1422, -3274, 251, 4220, 4653, 3045, -303, -5550, -5079, -5244, -5314, -5883, -6703, + -9438, -3031, 483, 1317, 1847, 1874, 3018, 2956, 788, 3090, 730, -1912, -1688, 122, 860, -1017, + -3693, -4977, -541, 2877, 3327, -2337, -4262, -2189, 699, 2375, 3310, 1962, 1504, 1017, 1319, -390, + 6065, 7469, 7234, 10424, 10658, 7912, 5388, 4640, 2156, -733, -4795, -9010, -11277, -11766, -11999, -12365, + 10932, 2437, -1845, -3262, -3753, -3716, -4031, -3422, -2848, -1620, -1167, 176, 1764, 2966, 3342, 4047, + -619, -1377, -1334, -455, -198, 333, 279, 702, 835, 1061, 505, 476, 127, 254, 270, -859, + 5215, 1197, -575, -1227, -2612, -2325, -649, 1885, 2691, 2793, 1163, -765, -1768, -1371, -1567, -2082, + 19164, 11491, 4615, -1985, -3389, 3234, 9530, 1792, -6657, -7546, -6135, -3576, -5395, -6848, -4207, -4089, + -5579, 2618, 4644, 1302, 270, 4372, 3748, 1797, -752, -937, -2728, -2859, -706, -865, -1022, -3304, + -1838, 6025, 10256, 11080, 7972, 1492, -1232, 2649, 3965, 3980, -6137, -7448, -7596, -7566, -6578, -9023, + 1944, 6450, 7024, 8636, 7062, 1810, -1661, -772, 542, -13, -3255, -4851, -5285, -5086, -5501, -7043, + 8123, 16086, 12234, 5222, 1088, 112, 327, 1928, -3259, -5187, -6713, -7464, -5697, -5814, -5336, -5649, + 859, 7375, 6059, 2544, 375, -1579, -3831, -3783, -3738, -2686, -2393, -1129, 29, 1048, 1033, -183, + 2101, 4211, 3442, 2574, 2178, 2151, 1104, 386, 135, -216, -2007, -2668, -2626, -2609, -3456, -4701, + -5046, -336, -968, -3416, -4451, -3637, -4472, -3410, -3255, -1874, -1058, 1763, 4855, 7351, 9606, 8347, + 19995, 9006, 2634, -634, -1483, -1947, -2216, -805, -298, -446, -2156, -3518, -3871, -4075, -4720, -5467, + -2272, 8650, 9022, 2896, -866, 3555, 4656, 4146, 4057, 5105, 893, -7960, -11942, -9282, -3999, -6659, + -3314, 4163, 6336, 8539, 7909, 6703, 4331, 4759, 3115, 1223, -1904, -4488, -6662, -8210, -10273, -12228, + -1219, -6996, -6238, 5560, 19256, 6948, 16806, -1718, -4399, -4432, 1743, -4434, -5576, -4824, -5420, -5055, + 7337, 7092, 7560, 9007, 7842, 4106, 2111, 1823, -310, -2228, -4758, -6480, -7636, -7833, -8350, -9284, + -127, -7162, -7239, -8124, -5968, -3470, -2064, 167, 1784, 2556, 3741, 6051, 7042, 5293, 3278, 4242, + -4837, -8327, -8445, -7964, -6737, -3635, 12584, 10749, 9489, 14113, 4466, -818, -963, -2829, -1662, -5183, + -9221, -7856, -8616, -9610, -8803, -4648, -2322, 3345, 7609, 8661, 7189, 7848, 6804, 4876, 3375, 1368, + 3370, 8415, 9491, 3696, 2112, 4195, 2535, 1216, -704, -2599, -4917, -4773, -4766, -4924, -5695, -6652, + 5033, 6480, 5225, 2803, 1389, 388, -1095, -1930, -1285, -783, -2330, -2783, -2299, -2271, -2847, -3696, + 6462, 10974, 9445, 5632, 3121, 338, -2526, -3512, -4157, -4256, -4496, -3576, -3213, -3003, -3042, -4191, + -8903, -5489, -3362, -3932, -2867, -42, -794, 1047, 1551, 2990, 1925, 1809, 2047, 3857, 5983, 4180, + -1078, 5534, 5668, 8546, 7579, 7727, 3515, 2403, 425, -3939, -7676, -10486, -4654, -3810, -5900, -3854, + 11241, 2333, -888, -2668, -601, 2056, 973, -782, -1134, -628, -1278, -1464, -1036, -1025, -2566, -2532, + 188, 993, 1510, 3746, 3964, 4113, 3912, 3774, 2904, 1760, -544, -2262, -3823, -5032, -6585, -8617, + 17244, 5164, -3514, -5803, -5740, -3512, -4264, -5949, -7105, -7263, -6297, -4203, 3488, 882, 9119, 17753, + 18572, 16918, 11329, 8930, 3706, 2301, -534, -4811, -6296, -6264, -6923, -7015, -7012, -7183, -7628, -8090, + 2776, 9267, 4870, -2407, -3332, 1594, 479, 626, -2334, -2117, -1714, -1452, -1892, -1016, -575, -2774, + -5418, -1560, 977, 3118, 4128, 4683, 3995, 3168, 1326, 367, -798, -1786, -2341, -2513, -3011, -4334, + -5417, -6011, -5325, -2432, 93, 2347, 2339, 1497, 2097, 3182, 2553, 1778, 1688, 2154, 997, -1540, + 9725, 13565, 12472, 9916, 5050, 2613, 1338, 621, -1049, -4212, -7066, -8072, -8504, -8673, -8645, -9079, + 3568, 2083, 779, -447, -1488, -1526, -2026, -1584, -1564, -893, -955, -362, 96, 991, 1665, 1663, + 4308, 2100, 967, 1304, 1477, 1636, 1557, 2064, 2234, 1529, -1013, -2413, -2782, -3000, -4202, -5767, + -2729, 7254, 5313, 626, -4368, -3106, 689, 2051, 1436, 577, 2137, -551, -4980, -1408, 137, -3079, + 15090, 13574, 8552, 4879, 2489, 603, 625, 413, -965, -1853, -5221, -7106, -7498, -7482, -7752, -8349, + 2370, 3151, 1957, 225, -516, -337, -392, 223, 813, 1307, 124, -276, -702, -1169, -2432, -4348, + -4031, 4338, 9696, 9577, 10361, 8623, 7730, 5093, 2251, -518, -3768, -6931, -9490, -10533, -10950, -11448, + 10303, 15787, 11780, 8011, -1234, -5671, -6127, -5176, -4588, -3477, -4783, -2583, -2036, -3150, -2990, -4066, + 1649, 10539, 12961, 10244, 5607, -356, -2601, -488, 30, -2077, -2877, -8331, -8515, -7727, -3810, -4247, + 8997, 5275, 2084, -488, -2018, -2461, -3081, -2315, -2223, -1654, -1778, -1155, -563, 285, 587, 507, + 2053, 8908, 7041, 522, -1083, 1920, 1555, 2991, 959, 1714, -3254, -3680, -2792, -4401, -4878, -7576, + -9455, -8989, -9057, -10160, -9541, -6763, -5661, -3200, -593, 3501, 6901, 10117, 10416, 11442, 11927, 9115, + 7190, 11877, 7889, 1661, -96, 1823, 1276, 741, -1950, -1969, -4935, -5445, -5084, -4151, -3666, -5162, + 923, 9232, 9280, 2340, -3138, -2558, 873, 5017, 3579, -513, -3936, -9898, -4597, -2889, -1289, -2425 +}; + +/*Q12*/ +const Word16 ivas_sns_cdbk_tcx20_stage2_fx[64 * 16] = { + -4739, -1952, 33, 1958, 1570, -310, -1531, -1209, -554, 53, 911, 1536, 1298, 855, 1041, 1042, + -1663, -904, -175, 651, -1032, -2713, -1113, 1177, 1464, 826, 214, -1494, -1846, 763, 2736, 3107, + 112, -859, -1631, -2224, -1919, -1030, -1104, -307, 1536, 3827, 3753, 1748, 107, -638, -468, -902, + 46, 1539, 3454, 2870, 2388, -2034, -3447, -1887, -692, -27, -310, -923, -859, -521, 27, 377, + 1736, 793, 312, 1806, 467, -1631, -500, 1432, 2116, -102, -2181, -280, 2082, -270, -2800, -2981, + -499, 628, 1238, 973, 1115, 3296, 3147, 1180, -225, -1217, -1869, -1759, -1756, -1809, -1438, -1005, + -814, -42, -125, -171, 215, 305, 107, -109, 761, 921, 805, 630, 183, -456, -1018, -1190, + 3133, 1965, 1284, 613, 952, 693, 240, -514, -738, -801, -702, -785, -963, -1364, -1554, -1460, + -2540, -1194, -624, 654, 1697, 2507, 1824, 793, -441, -1656, -427, 1665, 1549, -53, -1580, -2175, + -2612, -80, 1350, -1143, -868, 3411, 1168, -1279, -1792, -1401, -43, 224, 407, 470, 941, 1247, + -3135, -2208, -1570, -1618, -898, 791, 778, -354, -184, 553, 1861, 2776, 2413, 1232, 177, -614, + 1427, -894, 74, 274, 1641, 1416, -2247, -3524, -984, 2485, 916, -207, 570, 111, -306, -753, + 567, 223, 845, -469, -3177, -2357, 2872, 824, -1392, 757, 1566, -859, -167, 552, 315, -101, + -1017, -1966, -2969, -2645, -1036, 1791, 2595, 2648, 2209, 1368, 569, 1255, 1349, -305, -1605, -2241, + -180, -2117, -1548, 2748, 1044, -1910, -2213, -915, 378, 69, 1015, 1919, 2044, 1120, -379, -1075, + 61, 1450, 1443, -536, -2041, -2153, -241, 101, -1208, -1900, -710, 1553, 1938, 1209, 785, 249, + -871, -3584, -3398, -2068, -1304, -586, 802, 1195, 1173, 629, 692, 918, 1136, 1304, 1676, 2286, + -5190, 69, 1485, 2699, 2450, 2023, 739, 746, 653, -67, -772, -1497, -1398, -1046, -609, -285, + 436, 3227, 395, -2370, -1678, 289, 1631, 1271, 450, 574, 1098, 1346, 176, -1624, -2479, -2743, + -2034, 1082, 2695, 1685, 1183, 915, 636, -341, -486, 350, 1164, 625, -760, -1982, -2380, -2349, + 914, 1532, 886, -2080, -3920, -4687, -1446, 2800, 2748, 1303, 524, -634, -11, 747, 691, 632, + 1084, -467, -438, 1087, 2116, 2201, 1470, 691, 853, 987, 574, -224, -1366, -2404, -3041, -3123, + 3022, -593, -1542, -411, 421, 580, 276, -223, -67, -96, -91, -202, -250, -445, -371, -7, + 4287, 2796, 539, -861, -426, -868, -1334, -1937, -2448, -2081, -837, 139, 474, 386, 738, 1432, + -3717, -1050, 587, 144, -312, -549, -30, 857, 1641, 2410, 2657, 2049, 788, -915, -1966, -2594, + 1656, 90, 245, 2403, 4979, 1448, -716, -288, -387, -1023, -1625, -1371, -1425, -1584, -1505, -899, + 2943, -214, -1605, -563, 565, 838, 558, -616, -919, -1002, 498, 2396, 2264, -116, -2465, -2562, + 29, 1348, 1688, 136, -859, -273, -627, 84, 1360, 3635, 2904, -1691, -2928, -2031, -1197, -1576, + -3472, 1420, 442, -1499, -1990, -1702, -1566, -1104, 78, 1033, 1640, 1632, 1574, 1220, 1212, 1081, + 1953, -23, -627, -1383, -1259, 1004, 3624, 2500, -1346, -2634, -1795, -778, -511, -345, 456, 1163, + 4332, -964, -3948, -3470, 1285, 4835, 3224, 584, -77, -893, -848, -484, -428, -664, -1430, -1053, + -117, -1788, -833, 558, 730, 891, -108, -1659, -2651, -2745, -1081, 1583, 2809, 2204, 1191, 1018, + -1345, -373, -461, -1404, -2370, -2179, -1860, -1422, -886, -763, -387, 596, 1341, 2668, 4449, 4396, + 703, 1081, 785, 116, -226, 588, 371, 128, -841, -1511, -2399, -3059, -3098, -175, 3474, 4064, + 2514, -777, -1994, -1860, -1724, -1633, -1409, -1049, -426, 483, 1396, 1809, 1677, 1298, 934, 762, + -2407, 787, 1259, 1895, 1549, 339, -1486, -2126, -2176, -1736, -1109, -617, -109, 887, 2228, 2818, + -2370, -192, 160, -107, 141, -1165, -2137, 299, 2936, 3445, -1416, -1420, 1045, 1309, 500, -1029, + -803, 477, 733, 1105, 1659, 1199, 396, -525, -596, -699, -668, -547, -466, -585, -527, -153, + -854, -1179, -969, -484, 67, 243, 278, -137, -55, 12, 281, 514, 599, 462, 461, 759, + -555, 4717, 2129, -264, -987, -522, -88, -291, -391, -491, -515, -766, -855, -879, -331, 88, + -1373, -2671, -1199, 3480, 2467, 1443, 608, 260, -542, -1600, -1685, -1118, -694, -114, 750, 1987, + 934, 3323, 1049, -2373, 769, 3068, 503, -1591, -2364, -3449, -3986, -3071, 844, 5877, 941, -474, + -425, 228, -1215, -1583, -1505, -1579, -934, -791, -484, -477, 1056, 4177, 4488, 3123, -786, -3291, + 1305, -1331, -1055, 1844, 3061, 1077, -2285, -2600, 230, 4597, 1138, -3419, -3967, -827, 2157, 77, + 997, 210, -659, -997, -624, 153, 286, -62, -2489, 591, 3868, 1520, -1263, -1424, -494, 387, + 550, 1926, -1797, -3507, -2499, -447, 586, 751, 425, -141, -276, 149, 519, 762, 1372, 1626, + 4225, -2078, 205, 1305, -229, -2501, -1305, -231, 298, 233, -219, -284, -355, -157, 196, 896, + 1933, 2394, 2521, -320, -2587, -3794, -3666, -1887, -607, -128, 189, 577, 518, 1040, 1956, 1861, + -4582, -2223, -1479, -548, -20, 1204, 1867, 1627, 992, -767, -2361, -1057, 474, 2119, 2744, 2011, + -3537, -810, -278, -246, 338, 2203, 3, -278, -22, 2105, 1761, -1452, -2749, -633, 2262, 1334, + 2549, 1831, 1526, 633, -570, -1662, -2041, -1590, -568, 965, 2087, 1627, 325, -934, -1811, -2366, + -2625, 735, 4126, 1924, -1352, -1375, -67, -263, -332, -611, -223, 69, -41, -365, -50, 449, + 1945, -542, 862, 1501, -463, -3503, -3203, 3338, 4340, -1886, -1472, -176, -899, -1007, 153, 1012, + 1176, -2807, 927, 489, -701, -1222, 1377, 2025, 1740, 704, 835, 366, -857, -1584, -1462, -1007, + 1374, 1113, 165, -297, -35, -391, -815, -1221, -716, -497, -249, 51, 360, 245, 279, 635, + 4741, 2291, -661, -1808, -1569, -1013, -23, 449, 899, 914, -15, -826, -1123, -1159, -870, -227, + -3095, -3457, -326, 1213, 999, 1504, 2296, 1487, 1074, 733, 257, -216, -595, -863, -635, -376, + 1313, 1943, 2320, 2119, 1731, 1184, 521, -954, -2164, -2882, -2594, -1657, -957, -667, -49, 792, + -225, 2104, 1245, 2010, 1467, -381, -1564, -1777, -2347, -1964, -723, 1747, 2298, 1153, -937, -2106, + 1110, -1091, -1843, -326, 890, 1762, 1723, 1959, 2404, 1131, -1081, -2694, -2783, -1612, -483, 933, + -3280, 740, 493, -1621, -2458, -538, 3182, 2390, 1740, 648, 349, -246, -677, -725, -96, 98, + 1151, 1644, 2333, 571, -841, -749, 1667, 2880, 2249, 381, -1951, -2564, -2038, -1604, -1690, -1440, + 1322, -4374, -4684, 281, 3091, 1587, 369, -3, -524, 313, 1018, 1177, 314, -171, -81, 365, + 2499, -904, -2181, -489, 429, 669, -619, -1412, -1628, -1788, -978, 7, 230, 941, 2049, 3175 +}; + +/*Q12*/ +const Word16 ivas_sns_cdbk_tcx20_stage3_fx[32 * 16] = { + -496, -1325, -1064, 878, 1972, 607, -916, -1271, -543, 414, 1363, 1331, 679, -327, -664, -636, + 362, -60, -548, -1188, 3577, -1280, -794, 791, -404, 216, -537, -90, -322, -81, -302, 662, + -474, 1151, 1105, -431, -442, -1174, -1503, -1387, -649, 79, 712, 865, 1105, 707, 299, 37, + 334, 155, -1060, -1247, -263, 534, 1502, 1635, 1393, 587, -48, -494, -698, -945, -853, -533, + -102, -2580, 3220, -45, -520, -353, 93, 202, 19, -559, -404, 0, 267, 59, 248, 455, + -1614, 689, 1170, -355, -659, 214, 1065, 234, -205, -321, 68, 241, 302, -162, -349, -318, + 49, -471, -419, -290, 40, -128, -639, -61, 432, -165, -1970, -1140, 2419, 2709, 567, -934, + 1995, 749, -847, -723, -809, -1302, -1034, 36, 1174, 1053, 777, 479, 202, -226, -725, -798, + 503, -396, 223, 711, 939, 1443, 1651, 131, -658, -607, -422, -361, -558, -963, -997, -639, + -2380, -60, -1779, -303, 1247, 1476, 787, 528, 535, 131, -102, -243, -199, -125, 129, 359, + -480, 67, 624, 1594, 1140, -29, -302, -842, -1229, -1468, -958, -139, 349, 447, 512, 716, + -441, 257, -20, 524, -98, -901, -345, 1409, 932, -1626, -1328, 1998, 1784, -632, -919, -596, + 13, -162, 276, -73, -1083, 1249, 1237, -1331, -2051, 634, 2497, 636, -778, -595, 73, -539, + 150, -478, -1380, -2201, -557, 1248, 1317, -435, -672, -351, 51, 444, 824, 719, 625, 695, + -1787, -1936, -691, -455, -726, -586, 62, 521, 559, 532, 788, 935, 953, 717, 592, 523, + -307, 803, 537, -415, -32, -772, -200, 1387, 1056, -700, -1667, -1182, -198, 200, 611, 879, + -1136, -297, 1067, 1599, 933, 85, -496, -329, 704, 1505, 440, -791, -926, -846, -811, -698, + 554, 1640, -641, -1038, 1272, 2216, -1350, -1756, 606, 710, -732, -972, -109, -55, -189, -155, + -1245, 526, 853, -490, -1359, -1307, -459, 418, 1330, 1485, 1076, 66, -528, -675, -21, 330, + 1408, 1470, 1952, 558, -474, -218, 330, -50, -91, -404, -330, -556, -753, -1070, -1056, -717, + 48, -64, 1098, -961, -1463, 2614, -1256, 333, -225, 412, -110, -417, -56, -260, 2, 305, + -416, 207, 378, 157, -143, 675, 352, 15, -633, -373, 108, -981, -1789, -1138, 895, 2685, + -658, 135, 341, 217, -171, 367, 678, 235, -334, 875, 199, -2878, -1134, 2089, 1114, -1075, + 2544, 16, 331, 686, 339, -461, -853, -1260, -1021, -628, 3, 359, 463, 93, -282, -329, + 1673, -1600, -1453, 892, 900, -44, 456, 879, 586, -366, -785, -970, -549, -140, 126, 396, + -901, 3362, -1315, 487, -27, -544, 32, -54, -225, -100, 268, -6, -228, -277, -289, -183, + -605, -695, -453, 2594, -1649, -1440, 1218, 352, 100, -292, 42, 3, -89, 81, 342, 494, + -276, 125, 78, 668, 688, 152, 243, 303, 145, 226, 286, 252, 795, 844, -1302, -3227, + 522, -167, -889, -105, 51, -136, -646, 213, -785, -1079, 132, 3267, -1969, -884, 1495, 982, + 1886, 878, 347, -1000, -2044, -679, 1235, 203, -306, -879, -543, -38, 273, 119, 160, 390, + 733, -1286, -136, -112, -261, -483, -142, 25, 300, 298, 611, 560, 513, 71, -335, -353, + 546, -651, -903, -132, -317, -1043, -1323, -1071, 163, 760, 517, -177, -43, 546, 1305, 1823 +}; + +/*Q12*/ +const Word16 ivas_sns_cdbk_tcx20_stage4_fx[32 * 16] = { + -23, -162, 294, 1101, 1808, -336, -823, -38, 238, -260, -324, -210, -287, -282, -323, -372, + -49, -247, 49, 204, -183, 155, 406, 257, 91, -371, 16, 1575, 421, -2168, -1339, 1183, + -1457, 1563, 444, 336, 129, -10, -15, -113, -128, -394, -382, -424, -287, 33, 271, 436, + 157, 92, -904, 2169, -1450, 1225, -665, -162, 218, -301, -211, 88, 190, 121, -213, -353, + 311, -803, 192, -2, -217, -143, 781, 349, -660, -1220, -924, -287, 221, 635, 780, 987, + 337, 1084, -628, -576, -28, 247, -210, -956, -1165, -580, 325, 976, 847, 398, 61, -133, + 843, -807, 219, 110, -49, -191, -461, 246, 1392, 1370, -584, -1545, -895, 69, 341, -57, + 1408, -1582, -268, -301, -440, 153, 593, 65, 11, 367, 796, 421, -129, -246, -411, -437, + 526, 80, 669, 935, -656, -1721, -781, 354, 349, -93, 46, 56, -14, 78, -24, 196, + 112, 33, -306, 471, 9, -1712, 2296, -1177, 94, -317, -118, 790, 230, 22, -199, -227, + -152, 530, -1584, -390, 9, -51, 806, 1056, 519, -417, -360, 39, 581, 595, -314, -867, + 1217, 271, -1536, -330, 608, -3, -86, 55, -58, -462, -331, -230, -564, -248, 434, 1262, + -103, 98, -113, -4, 335, -551, -94, 2816, -1630, -504, 276, 178, -221, -60, -186, -238, + 60, 171, -102, 21, -326, -190, -116, 90, -469, -487, -171, -8, -1140, 1358, 2645, -1333, + -573, -82, 1285, -2182, 1292, 153, -175, -243, -223, -40, -30, 63, 315, 338, 48, 55, + -204, 94, -337, -350, 51, 63, -918, 640, -809, 2336, -1509, 298, 1930, -1470, 602, -418, + -702, -781, -877, -125, 396, -358, -395, 70, 355, 170, 242, 140, 333, 526, 492, 514, + -184, 25, 155, 70, 264, 34, -841, -103, 303, 255, -655, -1131, 1838, 578, -1675, 1067, + -612, 728, 94, -512, 2, 779, 158, -163, 387, 828, 919, 457, -331, -696, -1030, -1009, + -383, 115, -175, 222, 65, -691, -1245, -708, 283, 1251, 953, -372, 549, 1413, 150, -1428, + -820, -428, 172, 383, 42, 193, 1079, 977, 557, -176, -262, -564, -744, -413, -138, 143, + 600, 113, 1392, -21, -405, 175, -764, -1357, -582, 164, 149, -297, -490, -7, 387, 944, + 977, 1086, 140, 175, 207, 142, 499, 161, -74, -393, -441, -657, -705, -513, -398, -208, + -335, -210, -840, 473, 592, -45, -670, -209, 154, 998, 1575, 223, -1650, -900, 325, 520, + -1044, -1156, 804, 1184, 196, -140, 51, -475, -858, -334, 550, 669, 323, 208, 55, -32, + -278, 97, -45, -152, -784, 487, -82, -1620, 2324, -113, -981, 425, -194, 122, 307, 487, + 390, -32, 1476, -311, -835, 256, 628, 184, 17, -565, -603, 62, 717, 453, -600, -1235, + 262, -96, 317, -990, 168, 771, -1790, 1064, 1028, -1523, 167, 1061, 15, -183, -130, -142, + 104, 381, 464, -114, -36, -288, 116, -216, -800, -1336, 2780, -303, -616, -288, -113, 265, + -203, 637, -66, -1133, -1244, -550, 336, 402, 307, 157, 228, -16, -76, 160, 435, 626, + -177, -754, -187, -206, 868, 2171, 398, -527, -386, -355, -360, -395, -185, 90, -54, 58, + -7, -58, -198, -152, -389, -24, 1982, -716, -784, 2346, -775, -1081, 20, 278, -187, -254 +}; + +const Word16 *const ivas_sns_cdbks_tcx20_fx[SNS_MSVQ_NSTAGES_TCX20] = { + ivas_sns_cdbk_tcx20_stage1_fx, ivas_sns_cdbk_tcx20_stage2_fx, ivas_sns_cdbk_tcx20_stage3_fx, ivas_sns_cdbk_tcx20_stage4_fx +}; + +/*Q12*/ +const Word16 ivas_sns_cdbk_tcx10_stage1_fx[128 * 16] = { + 4155, 4844, 1339, -2626, -4982, -4674, -4721, -3645, -803, 3032, 4826, 4436, 3204, 1104, -1360, -4129, + -1594, -1284, -4844, -8342, -8548, -7606, -6706, -5389, -1713, 2074, 5231, 5641, 7605, 9627, 9427, 6422, + 1788, 7725, 11493, 9169, 6341, 587, 299, -4595, -4548, -3005, -1718, -3671, -4272, -3268, -4935, -7392, + 6395, 3818, 2406, 1897, 897, 256, -693, -1410, -1832, -2500, -2621, -2342, -1577, -1062, -856, -776, + 4150, 7919, 3439, -2033, -2704, -1557, 231, 1278, 3321, 2731, -93, -3269, -3781, -2586, -2807, -4238, + -3449, -354, 2017, 2387, 4764, 5609, 2963, 1108, 1421, 28, -950, -1353, -2415, -2770, -4077, -4929, + 8524, 7457, 4506, 1934, 338, -1987, -2756, -2266, -1957, -2240, -2375, -2413, -2097, -1743, -1348, -1577, + 7090, 5351, 2190, 948, 174, 15, 389, 653, 810, 817, 897, 265, -1778, -3881, -6266, -7674, + 6804, 11715, 7237, -532, -1146, 4914, 6089, 4999, 2534, -5124, -6431, -5499, -5543, -5359, -6419, -8238, + 7709, 2493, -2143, -6489, -5196, -3714, -2590, -832, -1060, 376, 749, 4940, 4149, -203, -522, 2334, + 2478, 4656, 6266, 8166, 8080, 7910, 7237, 5633, 3847, 82, -2972, -5614, -9294, -11465, -12330, -12680, + -3763, 439, 1331, -211, -1125, 837, 3525, 1259, 263, -714, -2457, -3123, -445, 2047, 1650, 487, + 4433, 3075, 1944, 16, -1183, -2102, -2546, -2683, -2426, -1757, -724, 250, 488, 152, 994, 2067, + -9469, -5101, -2893, -3433, -2063, 164, 2573, 3814, 3385, 1553, 818, -98, 1471, 3904, 3575, 1801, + 15946, 17207, 12819, 11001, 8646, 8327, 189, -5678, -6626, -8191, -8726, -8916, -9067, -9108, -8807, -9017, + -5510, -1763, 1586, 4321, 5956, 6915, 5607, 1816, -152, -948, -2191, -3237, -3324, -3026, -2853, -3196, + 8688, 10873, 8275, 4634, 1734, -557, -1294, -1577, -1538, -3121, -4044, -4288, -3973, -4095, -4377, -5339, + 8314, 381, -4203, -6906, -2427, 2895, 4683, -1276, -3574, -1537, 382, -1706, -1536, -1335, 2670, 5175, + 2014, 6901, 7450, 8391, 5660, 5349, 3318, 632, -1645, -7184, -11554, -6162, -2239, -4081, -3232, -3618, + 2463, 7959, 4852, -2086, -2118, 2942, 2680, 273, -1971, -3815, -4209, -3731, -1973, 228, 710, -2203, + 2203, 1934, 716, -1238, -808, -125, -35, 38, -139, -93, 845, 1853, 747, -583, -2071, -3245, + -8428, -9073, -4283, -324, 6076, 5438, -488, -2617, -275, 3550, -1050, -170, 4675, 4235, 2065, 669, + 11333, 11955, 6902, 1934, -1514, -2879, -3232, -4238, -3422, -2837, -2629, -2898, -2649, -2035, -2008, -1783, + 426, 4019, 4713, 3739, 3356, 3491, 3050, 1887, 1284, -268, -2029, -3494, -4307, -4440, -5214, -6212, + 2092, 5801, 8237, 9551, 6780, 3678, 2472, 1019, 1067, -1082, -3123, -5119, -7460, -7403, -7732, -8778, + 961, 1615, -886, -4376, -5548, -5310, -4982, -4885, -3665, -1478, 1198, 2863, 4755, 6850, 7462, 5426, + 12293, 13814, 11807, 11074, 9876, 10313, 5810, 199, -2989, -7493, -10043, -10534, -10988, -11237, -10950, -10951, + 250, 3000, 5233, 3533, 1034, 378, -553, -1707, -2133, -2878, -2837, -2353, -1841, -364, 705, 534, + 8771, 7295, 2905, -1528, -2797, -2224, -2434, -3707, -3996, -3372, -2464, -2340, 88, 2453, 2127, 1224, + -5356, -4080, -3178, -3415, -3409, -2987, -2237, -677, 1836, 4189, 5902, 5483, 3659, 2525, 1749, -4, + 8540, 13122, 10394, 3057, 1011, 2922, 1889, -673, -1284, -4815, -6548, -6657, -5605, -4808, -4643, -5902, + -904, 3036, 3724, 1024, 621, 2200, 3068, 4347, 4727, 939, -3049, -4688, -4457, -3259, -3173, -4155, + 7412, 8540, 3520, -908, -2046, -2396, -2247, -1458, -976, 74, -489, 690, 143, -3498, -4187, -2172, + -9034, -10692, -9925, -9020, -3884, 6891, 9607, 8744, 7840, 4174, 2713, 2569, 3504, 3316, -948, -5856, + 12528, 15782, 10788, 3495, -369, -2158, -2473, -3242, -3527, -5125, -5686, -5358, -4614, -3620, -2829, -3594, + 3762, 7050, 3669, -309, -1556, -2008, -2380, -2362, -2016, -1483, -971, -939, -639, 127, 288, -234, + 5466, 5096, 839, -4326, -4389, -495, 3962, 6525, 4641, 474, -1865, -1808, -2070, -3368, -3972, -4710, + -7682, -10419, -8678, 2804, 7231, 15597, 6455, -2426, -908, 2257, 7253, 5190, -3489, -5573, -6505, -1107, + 10313, 8489, 4954, 1234, -1203, -393, 1849, 1910, 915, -2272, -5380, -5480, -3449, -3573, -4108, -3807, + 9010, 7210, 5020, 3041, 1855, 1295, 314, -953, -2075, -2616, -2829, -2858, -3271, -3970, -4378, -4795, + 1460, 6841, 8628, 3136, 3143, 6063, 5972, 3426, 2223, -5238, -7341, -6357, -5904, -3889, -4715, -7448, + 1449, -1827, -4550, -6487, -5713, -2732, -660, 433, 1307, 2371, 2794, 3239, 3158, 2432, 2376, 2409, + 5243, 9630, 12091, 11941, 10590, 7240, 4378, 1797, -801, -6201, -9586, -10323, -9468, -8915, -8728, -8887, + -6934, -1067, 786, -193, 251, 625, 700, 418, 356, 314, 163, 106, 6, 1088, 1894, 1487, + 6060, 3896, 485, -2939, -4736, -3436, 282, 2032, 1869, -523, -3273, -3045, -833, -16, 1127, 3049, + -6670, -1890, 358, -230, 447, 2409, 3909, 6279, 5449, 1441, -878, -2018, -2272, -1424, -1908, -3000, + 11826, 16636, 13050, 6279, 1706, 781, 2337, -3227, -5169, -7375, -6710, -5822, -6503, -6377, -5089, -6343, + 485, 663, 700, 2165, 1981, 966, 376, 1834, 2298, 1627, 1114, 702, -758, -3039, -4935, -6179, + 15276, 10241, 6249, 2873, 783, 322, 994, 1738, 951, -1804, -4461, -5446, -5652, -6733, -7613, -7717, + -4421, -2251, -2182, -3670, -3227, -2064, -1880, -1860, -609, 307, 1234, 2129, 3532, 5592, 5516, 3853, + 3360, 7922, 10867, 9394, 6526, 1053, 1896, 2883, 1638, -5507, -7666, -7210, -7668, -4745, -5551, -7191, + 2467, 6411, 8292, 4274, 2274, 1209, -243, -1212, -1185, -2826, -3570, -3368, -3512, -3049, -2692, -3269, + 3028, 7338, 7308, 4275, 997, -2048, -3118, -4094, -3189, -2517, -1649, -1480, -692, 504, -1307, -3355, + -13713, -11806, -7131, -79, 6455, 6414, -589, -4681, -1922, 6331, 330, 637, 6245, 5108, 4653, 3749, + 14977, 9830, 6085, 2938, 1863, 1059, -553, -2267, -3180, -4394, -5086, -4951, -4163, -4237, -4011, -3909, + -1081, 3251, 6408, 7149, 4954, 5039, 4478, 4353, 4522, 680, -6756, -9382, -7832, -5831, -3856, -6094, + 7162, 7991, 4675, 976, 841, 2948, 4353, 3456, 2703, 451, -1709, -4266, -5937, -7074, -7860, -8711, + 7238, -605, -4007, 3, 8333, 1173, -2176, -5314, -6069, -5080, -4591, -4717, -2795, -241, 5388, 13461, + 10596, 12578, 13802, 10908, 7436, 2231, 2444, 1872, -2275, -7177, -9152, -9171, -8796, -8290, -8520, -8488, + -737, 2442, 485, -2808, -3574, -3229, -2953, -2353, -857, 704, 1697, 2241, 2025, 2311, 2655, 1952, + 12162, 6690, 2238, -2622, -4617, -5816, -5879, -5236, -4308, -2961, -1748, -1607, 1838, 2753, 3664, 5448, + -3077, 452, 1966, -389, -1269, 118, 175, 1055, 3620, 4579, 1375, -1234, -1480, -1197, -1718, -2974, + 15858, 15042, 10523, 5569, 4228, 4314, 3082, 654, -1725, -5657, -8057, -9036, -8888, -8704, -8514, -8690, + 1704, 1674, 529, 1843, 4216, 6144, 6034, 4105, 2177, -429, -2012, -2595, -4212, -5660, -6417, -7102, + 4241, 3011, -177, -3536, -4674, -3686, -1588, 992, 3180, 2882, 1972, 1063, 676, -379, -1461, -2516, + -10246, -9377, -9897, -10469, -9129, -5712, -3574, -1246, 1237, 4416, 7620, 7504, 9023, 11338, 10287, 8226, + 5873, 10679, 11753, 7933, 5561, 2214, 30, -1608, -3259, -6151, -6707, -5993, -5418, -4939, -4492, -5477, + 1703, 1720, 48, -171, 92, 1005, 1475, 1312, 659, -228, -981, -1903, -1549, -716, -784, -1681, + 534, 4872, 3894, -2429, -4953, -2172, 3168, 2622, 2251, 1388, -2147, -4094, -1110, 1384, -375, -2832, + -10365, -5877, -612, 3409, 4994, 5250, 3856, 2179, 1532, 1289, 947, 43, -882, -1327, -1874, -2562, + 7364, 8825, 6753, 3174, 1572, 1020, -1433, -3832, -4629, -5540, -5397, -4403, -2961, -1278, 255, 511, + 3616, 2982, 2441, 1531, 2154, 2980, 1762, 767, 272, -953, -1744, -2069, -2225, -2573, -3790, -5149, + 6016, 10717, 11396, 4773, 1867, 5061, 5183, 3833, 2366, -3588, -10444, -10907, -9023, -5516, -3941, -7793, + 6375, 1989, -1308, -3670, -4356, -4171, -3980, -3432, -2043, -587, 591, 1288, 2794, 3630, 3600, 3279, + 8179, 11466, 8560, 3788, 3482, 5771, 6843, 5604, 4908, 1374, -3903, -8790, -11546, -12047, -11857, -11832, + -3090, 661, 1382, -807, 2129, 5268, 1730, -823, -481, -2827, -4904, -3053, -219, 1606, 3077, 350, + 8949, 4159, 587, -2658, -2926, -2276, -1678, -1050, -331, -65, -22, -396, -501, -142, -463, -1189, + -5048, -1761, -1240, -3476, -3747, -2868, 162, 3168, 4073, 1904, 569, 468, 1695, 3016, 2504, 582, + 13457, 16793, 15820, 10226, 6095, -181, -2293, -4895, -6222, -6960, -7158, -7267, -7171, -6955, -6811, -6477, + -1163, 1485, 2929, 4720, 6317, 6894, 3387, -44, -1981, -2797, -3233, -2707, -2580, -3352, -3680, -4195, + 10024, 13762, 8664, 2406, 361, 330, 523, -3418, -2716, 1302, -192, -7081, -7539, -6126, -4791, -5509, + 221, -2249, -2660, -1660, -613, -278, -544, -655, 183, 1048, 1304, 660, 1055, 1496, 1247, 1445, + 846, 5133, 6934, 10757, 11411, 9325, 4488, 1331, -3265, -7057, -8303, -5003, -4657, -8262, -7258, -6419, + 9482, 12253, 6534, -607, -2653, -673, 306, -1178, -1765, -3207, -3766, -3761, -3142, -1768, -2113, -3942, + -550, 1425, 2011, 157, -1079, -1413, -1697, -1610, -686, 39, 810, 288, 848, 1801, 1010, -1353, + -10109, -11744, -7706, 379, 8248, 6559, 38, -828, 2185, 6885, 844, 754, 4769, 3153, -890, -2538, + 13503, 12466, 7450, 1458, -2178, -4645, -5771, -6295, -6474, -5971, -4508, -2899, 1290, 560, 405, 1608, + 4667, 8260, 6596, 1763, 3540, 6861, 3573, -969, -5225, -5388, -4163, -2503, -3545, -3940, -3641, -5886, + 5072, 10057, 11017, 4484, 3638, 2703, 2095, 2224, 2067, -2996, -4340, -4397, -7071, -7750, -8132, -8671, + 7076, 4469, 996, -4409, -7469, -8582, -7901, -7025, -4868, -1656, 2572, 4172, 4462, 5363, 6290, 6510, + 11515, 12880, 10465, 3540, 1874, 6237, 6698, 3799, -2308, -7772, -8623, -8541, -7869, -7144, -7664, -7087, + 1889, 3817, 3520, 1054, -342, -451, -2129, -3116, -3726, -5315, -4316, -2809, 54, 3440, 4742, 3688, + 12822, 7564, 3096, -1375, -2981, -3502, -2957, -2787, -2321, -2052, -2014, -1157, -656, -1499, -1036, 856, + -7298, -3128, -1459, -3766, -3686, -1244, 669, 2187, 5005, 6621, 4491, 1512, 782, 783, -274, -1196, + 12071, 12166, 10231, 7547, 4891, 1997, 167, -1868, -2940, -5141, -6998, -7442, -6793, -6155, -5653, -6081, + -1753, 1625, 4228, 3372, 2337, 4063, 4415, 1944, 491, -2688, -5614, -5677, -3836, -1216, -247, -1444, + 12512, 6411, 2980, 101, -359, -558, -915, -211, -81, -568, -1190, -2006, -2777, -3666, -4294, -5379, + -9543, -6774, -6214, -7549, -7059, -3854, -1628, 2101, 5622, 6976, 6572, 5418, 5229, 4875, 3740, 2087, + 8837, 12535, 11328, 7255, 2550, -2526, -4345, -6428, -5892, -7230, -7262, -4485, -1885, -283, -223, -1946, + 9129, 8498, 4366, 281, -3607, -5680, -5660, -5230, -3574, -1874, -344, -92, 1479, 1933, 516, -142, + 5256, 9433, 6759, -793, -3866, -459, 5206, 4388, 3690, -2799, -7970, -5691, -3094, -697, -2658, -6706, + -2216, -5889, -3568, 2955, 9741, 7436, 239, -1003, 1111, 4778, -1103, -1008, 1967, -1394, -4972, -7074, + 10789, 7440, 2779, -665, -2630, -3084, -1314, 514, 584, -2094, -4598, -5089, -1705, -879, -523, 474, + 6838, 5757, 5081, 5754, 4886, 2602, 782, 166, -233, -2235, -3851, -4886, -4905, -4949, -5029, -5777, + 3777, 8672, 7923, 2766, 875, 3035, 2111, 256, -660, -3765, -6885, -7930, -5724, -1376, 64, -3141, + 1043, 1116, -2723, -6588, -6935, -6723, -5310, 129, 5099, 4079, 3612, 2961, 2573, 4722, 2989, -43, + 1107, 6435, 9892, 10493, 10103, 8530, 4943, 5882, 5571, -2662, -9598, -11372, -11225, -10110, -8411, -9579, + -5006, -976, 1744, 1682, 136, -921, -1278, -2195, -2395, -1642, 74, 1034, 1476, 2263, 2966, 3036, + 5150, 4553, 3608, 1262, -1364, -913, 1595, 2380, 2112, -469, -3306, -3879, -2810, -2832, -2793, -2294, + -3555, -3199, -1984, -903, 897, 2488, 1905, 2582, 2162, 544, 447, 1148, 647, -112, -935, -2133, + 19565, 17281, 11036, 5756, 1904, 520, -2148, -4844, -5499, -5875, -6311, -6526, -6486, -6349, -6068, -5956, + -4564, 687, 4457, 4047, 2491, 1633, 917, 80, 46, 286, -541, -1798, -2353, -1410, -1770, -2208, + 10582, 8739, 6358, 4552, 5070, 5384, 3814, 1464, -830, -3127, -4787, -5934, -6628, -7437, -8195, -9024, + -8243, -6062, -5955, -6127, -4538, -1750, -708, 329, 1275, 2189, 2653, 2630, 4348, 7441, 7186, 5331, + 3524, 8176, 10617, 11183, 9097, 4548, 2951, -138, -2003, -4822, -9077, -10737, -10317, -6266, -1688, -5048, + -160, 2942, 5298, 6724, 7063, 1816, -1506, -2566, -575, -1613, -6146, -5214, -2667, -893, -655, -1848, + 1846, 4832, 4243, 1910, 516, -856, -1034, -742, -737, -953, -523, -41, -980, -1924, -2386, -3170, + -15228, -14072, -7488, 944, 6245, 6079, 828, -630, 1680, 6027, 390, 513, 5448, 5516, 2111, 1639, + 19563, 12033, 6609, 1145, -1338, -2373, -3214, -3154, -3135, -3507, -3551, -3495, -3191, -3941, -4145, -4305, + -3621, -2181, 970, 8464, 10422, 7881, 6143, 5042, 3015, 869, -2539, -3894, -5022, -7336, -8360, -9855, + 4589, 9181, 6169, 1082, 342, 359, 16, 127, 334, -1624, -2322, -2546, -2957, -3264, -4017, -5471, + 3606, -2296, -3662, -4758, -3791, -5478, -4900, -5253, -5389, -5139, -4257, -168, 6209, 6583, 9851, 18841, + 8752, 12363, 11875, 8625, 6928, 5159, 4395, 2087, 1077, -2569, -6852, -9550, -10394, -10712, -10636, -10548, + 1860, 2305, -375, -3366, -3658, -1668, 102, 33, -397, -793, -1050, -1026, 612, 3009, 3141, 1271, + 3601, 5629, 2769, -909, -3496, -4488, -4379, -4804, -4034, -2723, -478, 276, 2538, 4467, 3717, 2316, + -1091, -1227, -3638, -5036, -2839, 46, 2252, 4024, 4850, 4463, 2408, 276, -365, -206, -1119, -2800, + 13340, 14579, 9317, 4636, 1290, -97, 1113, -792, -1998, -3958, -3763, -4187, -6194, -6888, -7768, -8630, + -236, -1847, -3948, -2955, 848, 6018, 7872, 6895, 5707, 2744, 710, -1794, -4003, -4701, -5551, -5758 +}; + +/*Q12*/ +const Word16 ivas_sns_cdbk_tcx10_stage2_fx[32 * 16] = { + 1254, 2000, -111, -1953, -2171, -1043, -545, -612, -607, 355, 1181, 1127, 407, -72, 136, 651, + 1677, -181, -362, 1586, 2110, 1730, 1432, 1098, 154, -818, -1272, -1336, -1575, -1560, -1581, -1103, + -657, -1538, -1699, -507, 1053, 1212, 186, -178, -469, -827, 133, 2395, 4402, 1302, -1796, -3012, + -2950, 352, 1493, 317, -158, -83, 933, 969, -252, -2462, -2188, -58, 1292, 1447, 1121, 226, + 698, -549, -716, -673, -616, -664, 851, 3231, 3395, 1140, -408, -1086, -1210, -1305, -1243, -845, + 2743, 2575, 2092, 1507, 389, -1102, -1786, -2168, -2057, -1183, -331, 322, -167, -615, -313, 93, + -600, -1922, -1784, -461, 89, -257, -435, -978, -1404, -863, 41, 1077, 1513, 1868, 2050, 2065, + -2614, -1550, -493, 1920, 2469, 1658, 1322, 891, 120, 39, 375, 58, -816, -1117, -1258, -1006, + 4114, 141, -1496, -667, -717, -670, 81, 172, -377, -514, -566, -636, -562, -172, 483, 1384, + -1224, -232, 927, 1449, 1662, 219, -1358, -2391, -2453, -568, 1446, 1748, 514, -215, 94, 381, + -2542, -2686, -1605, -961, -430, -99, 429, 1125, 1378, 1174, 1221, 1454, 908, 258, 15, 360, + -990, 1611, 1860, -56, -115, 132, -143, 570, 2335, 1232, -117, -340, -953, -1048, -1653, -2325, + -1043, 825, 558, 90, 77, 1451, 1251, -180, -132, 1996, 1103, -2372, -3534, -1902, 879, 933, + 413, -20, 632, 2414, 2389, 615, -571, -1252, -1630, -1721, -1782, -2012, -990, 319, 1376, 1819, + -3559, -518, 1547, 1324, -401, -1236, -464, 286, 445, 417, 78, -85, -106, 81, 648, 1542, + 175, 86, 1305, 954, -1355, -3290, -3017, -1397, 49, 1139, 1881, 2013, 1238, 580, -71, -289, + -1374, 310, -1225, -3016, -2673, -729, 1486, 1715, 1031, 429, 124, -461, 110, 1435, 1736, 1102, + 1452, 2766, 1584, 39, -167, 368, 1002, 674, -710, -1804, -1906, -1640, -1156, -768, -151, 418, + 1743, 660, -478, -657, -589, -842, -315, -227, -806, -1840, -1270, 444, 2334, 2275, 464, -895, + -1221, -2116, -2089, -944, 1010, 2035, 1826, 1844, 652, -1037, -1405, -1030, -188, 323, 779, 1560, + 1345, 1687, 1678, 945, -1118, -3020, -1357, 854, 1198, 98, -913, -918, -434, -448, -201, 605, + -720, 1466, 2918, 2271, 1555, 1037, 3, -715, -816, -748, -566, -552, -1105, -1496, -1558, -972, + 769, -1385, -1653, -673, -1444, -2353, -1657, 161, 1159, 991, 469, -49, 638, 1195, 1616, 2213, + 921, -1842, -199, 2419, 2210, -340, -2057, -988, 955, 653, -182, 179, -79, -812, -707, -130, + 3529, 896, 163, 98, -379, -690, -478, 329, 251, 506, 958, 943, 23, -1379, -2370, -2398, + 2120, 592, -895, -1916, 1168, 4037, 176, -2475, -1664, 291, -325, -455, 71, 89, -566, -249, + 2005, -2001, -3131, -1768, -336, 467, 955, 603, 145, 776, 1259, 1064, 391, -96, -317, -16, + -458, 921, 2, -1318, -618, 1762, 2872, 1443, -494, -954, 625, 807, -263, -885, -1580, -1861, + -913, -1382, 280, 380, 190, 897, -146, 150, 2509, 2072, -1691, -2832, -2267, 665, 2229, -140, + -57, 1690, 1163, -536, -1436, -1521, -1073, -1169, -1491, -1688, -1247, -678, 313, 1668, 2955, 3108, + -3201, 226, 404, -1437, -1195, 554, 435, -1440, -1127, 652, 1406, 1076, 1635, 1724, 858, -571, + -834, -883, -668, -171, -455, -236, 160, 54, 711, 3068, 3870, 1834, -386, -1341, -2074, -2649 +}; + +/*Q12*/ +const Word16 ivas_sns_cdbk_tcx10_stage3_fx[8 * 16] = { + 623, -523, 384, -342, -1040, 513, 1226, -404, -1426, -997, -461, -246, 133, 636, 959, 965, + -665, -455, -1300, -1050, 567, 1223, 430, 481, 1090, 223, -598, -788, 171, 859, 304, -492, + -208, 605, -411, -1315, -717, -764, -1112, -319, 15, -176, 415, 1433, 1263, 414, 315, 561, + -784, -124, 922, 326, -1112, -803, 1144, 1435, 427, 25, 268, 478, 151, -534, -930, -887, + 1087, -853, -1027, 490, 1117, 729, -10, -523, -934, 31, 874, 798, 188, -485, -729, -753, + 1051, 1010, 416, -120, -588, -573, -850, -806, 717, 1704, 536, -841, -665, 167, -153, -1004, + -357, 94, 2, 303, 589, 278, 15, 480, 358, 5, -311, -465, -1287, -1594, -94, 1984, + -746, 246, 1015, 1707, 1184, -603, -843, -344, -247, -816, -723, -368, 46, 537, 328, -373 +}; + + +const Word16 *const ivas_sns_cdbks_tcx10_fx[SNS_MSVQ_NSTAGES_TCX10] = { + ivas_sns_cdbk_tcx10_stage1_fx, ivas_sns_cdbk_tcx10_stage2_fx, ivas_sns_cdbk_tcx10_stage3_fx +}; + +/*Q15*/ +const Word16 ivas_sns_cdbks_side_tcx20_stage1_fx[32 * 16] = { + -3728, -2160, 1376, 1464, 5856, -904, -10680, -6904, -1608, 416, 424, 496, 2688, 4152, 4160, 4952, + -560, 3056, 7720, 7344, 3520, 1648, 1304, -240, -1584, -2856, -2792, -3952, -3656, -3480, -2920, -2560, + -8728, 8968, 14888, 5968, 21344, 5920, 4776, -264, 8624, -1504, -17040, -5336, 1256, -10424, -14160, -14288, + -1448, -3424, -3008, -3480, -3088, 3056, 8840, 5432, 2032, 360, 712, -784, -1200, -1288, -1424, -1288, + 13432, 2072, -720, -472, -456, -608, -1712, -1696, -1040, -1144, -904, -1920, -1488, -1384, -1248, -704, + 80, 1008, 664, 448, -296, 424, 312, -992, -1584, -728, 392, -568, -376, -24, 392, 840, + 5688, 7336, 6456, -624, -9016, -17624, -10056, -1160, 24, -1624, 2464, 1712, 4152, 5344, 3976, 2960, + -10488, -9544, -8104, -5832, -4608, -3472, -4152, -3560, -2824, -2432, 1000, 5216, 8184, 10328, 13400, 16880, + -16272, -1104, 2744, 1400, 1136, 1768, 1136, 776, 1232, 1040, 928, 8, 936, 1008, 1448, 1816, + -1328, 736, 320, 1208, 1824, 1536, 1064, 2656, 3136, 1408, -288, -2120, -1880, -1544, -3200, -3528, + 8896, 12112, 13000, 12592, 9880, 7096, 5096, 3976, -264, -4192, -7528, -12816, -14632, -15344, -11792, -6072, + -10376, -9040, -7304, -6064, -5168, -3880, -1520, 1064, 3592, 5512, 6664, 5456, 6560, 6544, 4664, 3288, + -920, -896, -2184, -3256, -3448, -3456, -1864, 568, 2016, 2568, 2880, 1688, 1776, 1696, 1400, 1440, + -4720, -10120, -2584, 1744, 2104, 1056, 1888, 1904, 1680, 1368, 1768, 496, 944, 1104, 768, 608, + 16256, 14832, 9552, 5128, 1712, 576, -1640, -2176, -3552, -4936, -5616, -6728, -6040, -5752, -6296, -5320, + -184, -1008, -3024, -4136, -5216, -3936, -3624, -4376, -4232, -3232, 576, 4216, 7160, 8144, 6144, 6728, + -368, -2000, -1056, 5944, 2240, -4560, -3328, 56, -152, 320, 1032, -224, 144, 784, 568, 592, + -1480, -1800, -1408, 1760, 6952, 8256, 2920, -1120, -1624, -2040, -2016, -2568, -1720, -1448, -1512, -1160, + 2664, 6728, 1408, 3608, 12192, 14000, 10448, 6336, 512, -5864, -6624, -12560, -8152, -6744, -8048, -9928, + -13144, -6696, -1600, 616, -2632, 528, 4400, 8960, 11480, 11720, 6280, -1864, -3816, -5160, -4912, -4168, + 9056, 9144, 7344, 1176, -3360, -2016, -2800, -6504, -8400, -7448, -6560, -4112, -88, 2680, 4856, 7016, + -3744, -2248, 8016, -104, -1416, -1088, 800, -120, -736, 56, 608, -488, -336, 72, 224, 504, + 2632, 7816, 5536, 952, -1432, -3464, -2552, -1216, -208, -848, -1208, -2080, -1416, -1040, -1064, -408, + -2368, -5768, -9744, -11552, -11408, -8432, -6872, -6064, -3680, -1736, 3160, 10064, 12880, 18576, 13312, 9632, + -7928, -3608, -1672, 1288, -2016, -608, 360, 1408, -7064, -632, 304, 1576, 8632, 12056, 4336, -6424, + 5312, 5368, 4720, 3544, 2936, 3752, 3848, 3816, 4296, 3704, 696, -5192, -6936, -8968, -11080, -9816, + -4792, 2248, 8104, 12752, 10440, 8984, 6280, 4520, 2280, -616, -3800, -9336, -11736, -12464, -8504, -4352, + -21240, -19008, -5088, -2328, -2720, 320, 3480, 3464, 4584, 4256, 5712, 6032, 3072, 4104, 6776, 8592, + 2568, 5384, -472, -6848, -2944, 1408, 2200, 248, -1216, -960, -656, -1040, 120, 528, 504, 1176, + -776, -4680, -12008, -3696, 1384, 4616, 1360, 304, 1304, 1816, 2016, 1336, 1840, 2104, 1720, 1360, + 7576, 7056, 5488, 5128, 4136, 3440, 2848, 656, -1136, -4208, -6088, -9664, -8864, -5648, -2272, 1552, + -6416, -4792, -3704, -1832, -1704, -296, 752, -224, -1064, 56, 1488, 824, 1304, 2472, 5160, 7952 +}; + +/*Q15*/ +const Word16 ivas_sns_cdbks_side_tcx20_stage2_fx[32 * 16] = { + -456, 24, 560, 192, 1840, -2680, -9592, 128, 4608, 1272, 344, 1256, 1384, 680, 192, 248, + -2328, -3360, 1248, 3000, 3896, 4416, 1664, -3648, -4536, -6792, -8432, -4936, 1064, 2664, 5760, 10312, + 2344, 952, 640, 264, 768, 680, 1056, 720, 1136, 584, -1240, -4600, -7104, -3616, 1888, 5520, + -3544, -896, -2704, -2696, -2592, 1632, 3360, 7824, 8416, 1040, -5184, -4800, -264, -16, -472, 896, + -744, 920, 4624, -2216, -2408, 5328, -240, -2152, -936, -352, -784, 416, -192, -216, -464, -592, + -3192, -3016, -2016, -392, 216, 1368, 272, -576, -2792, -4120, -2064, 4488, 8256, 5024, 64, -1528, + -6632, 8864, 1944, 136, 728, -320, -872, -896, -1072, -552, -848, -48, -248, -312, 152, -32, + 2112, -8752, 4024, 840, -208, 144, 280, -56, 200, -232, -616, 392, 280, 328, 664, 600, + -24, -1232, -1192, -512, 184, -184, -96, 1072, 1560, 624, -344, 576, 416, 144, -440, -552, + 2272, 1736, 2000, 4384, 4400, 176, -3256, -6008, -7160, -2736, 664, 1928, 440, 376, 640, 136, + 120, -1656, -168, 6256, -6160, -1792, 16, -712, -64, 56, 136, 816, 728, 904, 888, 632, + 808, -136, -872, -2816, -2072, -2248, -2456, -1640, -2000, -200, 1848, 2896, 1928, 2208, 2544, 2208, + 4488, 2784, 2328, 1536, 808, 160, -352, -216, 464, -240, -1360, -888, -1360, -1992, -3040, -3120, + -5496, 2184, 5968, 2424, -656, 1816, 1280, -3936, -3536, 4040, 12432, 1072, -5288, -4992, -3456, -3848, + -432, -368, -1224, 88, -1520, -8008, 3272, 3624, 280, 336, 432, 1264, 544, 488, 632, 592, + 1448, 2544, -1144, -6016, 5152, 2008, -968, -616, -784, 24, -344, 288, -184, -304, -488, -616, + 4488, 368, -1096, -568, -2544, -4016, -2504, -568, 4672, 6984, 4776, 1056, -2744, -3944, -2496, -1880, + 968, -4008, -8112, 3112, 6192, 856, 424, 984, 296, -304, -840, 288, -80, -56, 288, -8, + -1264, -1272, -2912, -2256, 728, 3352, 4208, 2752, 2152, 2680, 2488, 1312, -1568, -3096, -3392, -3904, + 304, 1536, 2680, 1232, 208, -1256, -384, 9248, 912, -8256, -4200, 520, 376, -472, -1448, -1008, + 2088, 4072, 3128, -4384, -8616, -2072, 1088, 2160, 1592, 864, 192, 648, -96, -192, -24, -432, + -552, -1712, -1880, 264, -384, -2256, -2816, -536, -400, 1536, 5952, 8824, 4416, -800, -4176, -5480, + -720, -1768, -744, -16, 2360, 2736, 1856, -488, 928, 3080, 2008, -15984, -608, 5080, 1920, 352, + 12608, -1616, -2600, -824, -760, -680, 880, -16, -1720, -1112, -1520, -352, -592, -728, -528, -440, + -7816, -2128, -592, -112, 1320, 632, 600, 1008, 984, 936, 336, 1216, 704, 1144, 1152, 616, + 1264, 944, 848, 1416, 1144, -720, -1136, -640, -776, -3120, -4552, -1072, 448, 1928, 2120, 1896, + -488, 488, 416, 1488, 240, 2720, 5832, 1008, -3848, -2352, -1576, -232, -528, -800, -1088, -1272, + 2264, -1608, -7672, -10576, -5000, -928, 1928, 1832, 2824, 2688, 1712, 1792, 728, 2584, 4280, 3144, + -4408, -880, 3512, 5256, 4360, 1432, 288, 656, 1312, 576, -984, -816, -2224, -2840, -2504, -2744, + -640, -1960, -2008, 264, 1048, 2688, -1480, -8376, -904, 3448, 2056, 1536, 952, 1040, 1392, 936, + -1640, 2768, 8904, 1744, -2096, -4256, -2392, -1696, -1200, -48, -32, 712, 296, -24, -432, -608, + 2776, 6200, -5888, -520, -584, -712, 216, -248, -624, -352, -480, 464, 112, -184, -120, -56 +}; + +/*Q15*/ +const Word16 *const ivas_sns_cdbks_side_tcx20_fx[SNS_MSVQ_NSTAGES_SIDE] = { + ivas_sns_cdbks_side_tcx20_stage1_fx, ivas_sns_cdbks_side_tcx20_stage2_fx +}; + +/*Q15*/ +const Word16 ivas_sns_cdbks_side_tcx10_stage1_fx[32 * 16] = { + + -7848, -6656, -5840, -4312, -4040, -3144, -3504, -5424, -4896, -2480, 864, 3328, 5584, 9080, 12416, 16872, + 4224, 6824, 7512, 9824, 7952, 4744, 2576, 808, -2496, -6040, -8736, -10896, -9040, -4576, -1000, -1680, + -4640, -4360, -3664, -1224, -1248, 1688, 2408, 240, 1472, -768, -4040, -384, 9208, 7928, 2304, -4904, + 1752, 4024, 4568, 3272, 2560, 608, 1128, 3400, 2144, -992, -3240, -3264, -1968, -3920, -5976, -4080, + -1424, -1096, -2184, -2136, -1600, -3816, -6736, -6640, -5104, -32, 3400, 6944, 8000, 4760, 3232, 4416, + 1904, 7392, 3336, -2824, -2448, 1712, 1720, -1384, -2312, -1216, -792, -1032, -1048, -1328, -1248, -432, + 656, -1096, -4768, -13792, -6424, 1248, 872, 536, 1256, 1896, 2216, 2648, 2992, 3336, 3928, 4496, + 4480, 10016, 15456, 17952, 13048, 8872, 5768, 3016, -432, -5624, -10376, -13808, -17456, -15040, -8984, -6896, + -12776, -12320, -12112, -9552, -8552, -6528, -4960, -2968, -1336, 4376, 9872, 12640, 13320, 10192, 9832, 10872, + 11504, 17136, 13720, 4704, -1232, -4304, -6024, -5920, -5168, -5728, -5584, -4984, -2704, -2168, -2112, -1136, + -21904, -10168, -7024, -3928, -3384, 2632, 7144, 6840, 3328, 1080, -1440, 2560, 2400, 2544, 6792, 12520, + -5624, -3840, -1144, 1976, 5928, 11032, 12960, 8904, 4208, -1208, -5624, -6976, -6816, -5680, -4096, -4008, + -6144, -13096, -584, 3296, 1888, 928, 1800, 1400, 1360, 1536, 1368, 1792, 2032, 1032, 440, 936, + 11408, 7680, -1800, -5968, -9432, -10216, -9208, -6496, -5136, -2704, 992, 4472, 7248, 6808, 5392, 6960, + -1896, -3464, 2944, 9976, 6208, 4840, 2976, -688, -1752, -1456, -2336, -2912, -2616, -2816, -3208, -3800, + 5776, 8536, 7128, 6888, 6600, 9088, 7080, -40, -360, -3832, -7640, -5192, -2648, -2912, -11704, -16760, + -12496, -15912, -11792, -5288, -856, 296, -416, 1320, 3128, 5064, 5352, 6272, 6928, 6656, 5896, 5848, + 1912, 2064, 1344, 1048, 2592, 2200, -944, -1656, -816, -5840, -10576, -5456, -176, 1808, 3912, 8560, + 1568, -1384, -7912, -1256, 1728, 2248, 1904, 392, -456, -360, 656, 904, 1016, 760, 464, -264, + -120, 48, 448, 0, 696, 1096, 488, 152, 1864, 4400, 2848, -168, -2384, -3120, -3592, -2656, + -5232, -3632, -4264, -2352, -2128, -1848, -1512, -400, 1592, 1208, -16, -800, -424, 3016, 7024, 9784, + 18344, 5184, -408, -1416, -1904, -488, -704, -1256, -1104, -1232, -2264, -2504, -2088, -2120, -2776, -3272, + -1304, -1072, -992, -1688, -1168, -1344, -1280, 584, 1688, 456, -1464, -2000, -400, 2392, 4040, 3568, + 14784, 15304, 12752, 7616, 5384, 5928, 6856, 1112, -4496, -9040, -13088, -12584, -10176, -9328, -9488, -1528, + -2888, -7528, -13744, -16216, -13232, -9088, -7384, -4312, -1464, 3944, 8176, 10192, 17080, 15872, 10728, 9872, + 10880, 9704, 5888, 2192, 3280, 4544, 1144, -1072, -3952, -6872, -9712, -6848, -2696, -5512, -5248, 4304, + -14480, 576, 2424, 1096, 1448, 1544, 992, 1336, 1344, 752, 152, 616, 936, 616, -16, 680, + -12000, -7664, -2680, -496, -1608, 2592, 7576, 9280, 12576, 9576, 3256, -288, -3216, -5392, -6208, -5304, + -5584, -6016, -6232, -5184, -6632, -7168, -4296, 328, 3936, 8224, 8200, 6736, 4760, 4576, 3400, 952, + 2288, 2368, 5984, 832, -8112, -9376, -3656, -1216, 120, 1048, 1440, 1880, 2560, 2360, 936, 536, + 2568, 4440, 5712, 5072, 4120, -312, -4944, -6440, -6424, -3376, -1504, -856, 664, 784, 432, 48, + 8304, 7392, 7344, 5608, 5952, 5536, 5408, 6632, 5584, 848, -5448, -7904, -10480, -13136, -12536, -9104 +}; + +/*Q15*/ +const Word16 ivas_sns_cdbks_side_tcx10_stage2_fx[8 * 16] = { + -4584, -808, 4152, 912, 2192, 4200, 2456, -648, -1912, -2472, -2144, -1792, -1424, -208, 1120, 968, + -2200, -3752, -3208, -2992, -3992, -328, 3600, 3784, 1968, 1248, 672, 568, 792, 928, 1256, 1656, + 1808, 1000, 1280, 1904, 704, 1064, 1312, -288, -1832, -784, 1216, 2080, 888, -2416, -4176, -3776, + 3672, 6576, 1488, -3552, -4648, -2792, -1064, 1112, 1448, 216, -408, -608, -440, -344, -256, -400, + -1368, -2416, -4856, 696, 5248, 3904, 1832, 2648, 4112, 1776, -1008, -1336, -1976, -2336, -2544, -2376, + -2440, -1352, -1328, -2248, -1384, -1264, -1680, -2912, -1816, 1208, 2960, 2192, 2920, 4296, 2664, 176, + -1736, 1104, 5248, 5632, 808, -4352, -4568, -1376, 224, 664, 280, 48, -376, -992, -736, 128, + 6848, -368, -2784, -360, 1080, -432, -1896, -2328, -2192, -1848, -1568, -1144, -392, 1072, 2680, 3616 +}; + +const Word16 *const ivas_sns_cdbks_side_tcx10_fx[SNS_MSVQ_NSTAGES_SIDE] = { + ivas_sns_cdbks_side_tcx10_stage1_fx, ivas_sns_cdbks_side_tcx10_stage2_fx +}; + +/*----------------------------------------------------------------------* + * MC ParamUpmix ROM tables + *-----------------------------------------------------------------------*/ + +const ACPL_QUANT_TABLE_FX ivas_mc_paramupmix_alpha_quant_table_fx = { + 33, /* nquant */ + 16, /* offset */ + { + -536870912, -485700416, -439563072, -398458880, -362387872, -331350016, -305345344, + -284373824, -268435456, -252497104, -231525584, -205520896, -174483040, -138412032, + -97307856, -51170508, 0, 51170508, 97307856, 138412032, 174483040, + 205520896, 231525584, 252497104, 268435456, 284373824, 305345344, 331350016, + 362387872, 398458880, 439563072, 485700416, 536870912, 0, 0 } /* data in Q28 */ +}; + +const ACPL_QUANT_TABLE_FX ivas_mc_paramupmix_beta_quant_table_fx[9] = { + { + 9, /* nquant */ + 0, /* offset */ + { 0, 63753420, 147639504, 251658240, 375809632, 520093696, 684510400, 869059776, 1073741824 } /* data in Q28 */ + }, + { + /* Beta #2 */ + 9, /* nquant */ + 0, /* offset */ + { 0, 54638668, 126531672, 215678976, 322080672, 445736544, 586646912, 744811456, 920230272 } /* data in Q28 */ + }, + { + /* Beta #3 */ + 9, /* nquant */ + 0, /* offset */ + { 0, 46420464, 107500024, 183238656, 273636384, 378693184, 498409216, 632784256, 781818240 } /* data in Q28 */ + }, + { + /* Beta #4 */ + 9, /* nquant */ + 0, /* offset */ + { 0, 39098780, 90544544, 154337280, 230477024, 318963584, 419797344, 532978048, 658505728 } /* data in Q28 */ + }, + { + /* Beta #5 */ + 9, /* nquant */ + 0, /* offset */ + { 0, 32673642, 75665248, 128974864, 192602432, 266548032, 350811584, 445393216, 550292672 } /* data in Q28 */ + }, + { + /* Beta #6 */ + 9, /* nquant */ + 0, /* offset */ + { 0, 27144998, 62862136, 107151352, 160012704, 221446144, 291451648, 370029408, 457179136 } /* data in Q28 */ + }, + { + /* Beta #7 */ + 9, /* nquant */ + 0, /* offset */ + { 0, 22512928, 52135212, 88866816, 132707776, 183658096, 241717760, 306886688, 379165088 } /* data in Q28 */ + }, + { + /* Beta #8 */ + 9, /* nquant */ + 0, /* offset */ + { 0, 18777374, 43484452, 74121200, 110687696, 153183840, 201609712, 255965264, 316250528 } /* data in Q28 */ + }, + { + /* Beta #9 */ + 9, /* nquant */ + 0, /* offset */ + { 0, 15938355, 36909876, 62914560, 93952408, 130023424, 171127600, 217264944, 268435456 } /* data in Q28 */ + } +}; + +/* Q Factor is 31*/ +const Word32 ivas_han_win_48k_fx[L_FRAME32k] = { + 5760, 22976, 51712, 91904, 143552, 206784, 281408, 367552, 465216, + 574272, 694912, 826944, 970496, 1125504, 1292032, 1470016, 1659456, + 1860352, 2072704, 2296576, 2531904, 2778624, 3036864, 3306560, 3587648, + 3880256, 4184256, 4499712, 4826624, 5164992, 5514752, 5875968, 6248576, + 6632640, 7028096, 7434944, 7853248, 8282880, 8723968, 9176448, 9640320, + 10115584, 10602176, 11100224, 11609536, 12130304, 12662400, 13205824, 13760576, + 14326720, 14904192, 15492928, 16093056, 16704512, 17327232, 17961216, 18606592, + 19263168, 19931072, 20610240, 21300672, 22002368, 22715328, 23439488, 24174912, + 24921600, 25679424, 26448512, 27228800, 28020288, 28822976, 29636864, 30461888, + 31298048, 32145344, 33003840, 33873472, 34754176, 35646016, 36548992, 37463040, + 38388224, 39324416, 40271680, 41230016, 42199424, 43179840, 44171264, 45173696, + 46187200, 47211648, 48247104, 49293504, 50350848, 51419200, 52498432, 53588608, + 54689664, 55801664, 56924544, 58058304, 59202944, 60358400, 61524736, 62701888, + 63889856, 65088640, 66298176, 67518528, 68749632, 69991488, 71244096, 72507392, + 73781440, 75066176, 76361536, 77667648, 78984384, 80311744, 81649728, 82998400, + 84357568, 85727424, 87107776, 88498688, 89900160, 91312128, 92734656, 94167680, + 95611136, 97065088, 98529472, 100004288, 101489536, 102985152, 104491200, 106007552, + 107534336, 109071424, 110618816, 112176512, 113744512, 115322816, 116911296, 118510080, + 120119040, 121738240, 123367552, 125007104, 126656768, 128316608, 129986496, 131666496, + 133356608, 135056768, 136766976, 138487232, 140217408, 141957632, 143707840, 145467968, + 147238016, 149017984, 150807872, 152607616, 154417216, 156236672, 158065920, 159904960, + 161753728, 163612352, 165480640, 167358720, 169246464, 171143808, 173050880, 174967552, + 176893888, 178829760, 180775296, 182730304, 184694848, 186668928, 188652480, 190645504, + 192648000, 194659904, 196681216, 198711936, 200752000, 202801344, 204860032, 206928064, + 209005376, 211091904, 213187648, 215292672, 217406784, 219530048, 221662528, 223804096, + 225954752, 228114496, 230283264, 232461056, 234647872, 236843584, 239048320, 241262016, + 243484544, 245716032, 247956288, 250205440, 252463424, 254730112, 257005632, 259289856, + 261582784, 263884416, 266194688, 268513664, 270841216, 273177344, 275522048, 277875264, + 280237056, 282607296, 284986048, 287373184, 289768768, 292172672, 294584960, 297005632, + 299434560, 301871808, 304317312, 306771072, 309233024, 311703040, 314181312, 316667712, + 319162240, 321664832, 324175424, 326694080, 329220672, 331755200, 334297728, 336848192, + 339406528, 341972672, 344546688, 347128448, 349718080, 352315328, 354920384, 357533120, + 360153536, 362781568, 365417152, 368060352, 370711168, 373369408, 376035200, 378708416, + 381389120, 384077120, 386772608, 389475456, 392185536, 394902976, 397627648, 400359552, + 403098624, 405844928, 408598400, 411358976, 414126592, 416901312, 419683008, 422471680, + 425267392, 428070016, 430879552, 433695936, 436519232, 439349312, 442186112, 445029696, + 447880064, 450737088, 453600832, 456471168, 459348160, 462231616, 465121600, 468018176, + 470921280, 473830784, 476746688, 479668928, 482597632, 485532608, 488473856, 491421376, + 494375168, 497335168, 500301184, 503273472, 506251840, 509236288, 512226752, 515223296, + 518225728, 521234048, 524248320, 527268608, 530294592, 533326528, 536364096, 539407552, + 542456576, 545511296, 548571712, 551637888, 554709440, 557786624, 560869376, 563957504, + 567051264, 570150272, 573254656, 576364544, 579479616, 582600064, 585725696, 588856704, + 591992704, 595134080, 598280256, 601431680, 604588160, 607749632, 610916224, 614087680, + 617264128, 620445312, 623631488, 626822336, 630017984, 633218496, 636423616, 639633408, + 642847872, 646067008, 649290624, 652518784, 655751552, 658988672, 662230400, 665476352, + 668726784, 671981504, 675240576, 678503808, 681771264, 685042944, 688318784, 691598848, + 694882880, 698171072, 701463168, 704759296, 708059392, 711363328, 714671296, 717982976, + 721298560, 724617728, 727940864, 731267392, 734597760, 737931776, 741269376, 744610624, + 747955200, 751303488, 754655040, 758009984, 761368512, 764730240, 768095360, 771463616, + 774835200, 778209792, 781587840, 784968832, 788352896, 791740160, 795130304, 798523584, + 801919616, 805318784, 808720640, 812125312, 815532928, 818943168, 822356288, 825771840, + 829190272, 832611200, 836034816, 839460928, 842889472, 846320640, 849754112, 853190080, + 856628352, 860068992, 863511808, 866957056, 870404352, 873853696, 877305408, 880759104, + 884215040, 887672832, 891132736, 894594496, 898058112, 901523840, 904991232, 908460544, + 911931456, 915404288, 918878528, 922354560, 925832384, 929311616, 932792512, 936274816, + 939758720, 943243904, 946730624, 950218560, 953707840, 957198528, 960690368, 964183488, + 967677568, 971172992, 974669440, 978166912, 981665536, 985164992, 988665600, 992166912, + 995669248, 999172288, 1002676288, 1006180864, 1009686208, 1013192384, 1016698880, 1020206336, + 1023714176, 1027222656, 1030731584, 1034241024, 1037750784, 1041260928, 1044771584, 1048282368, + 1051793600, 1055304896, 1058816512, 1062328192, 1065839872, 1069351872, 1072863808, 1076375808, + 1079887744, 1083399680, 1086911488, 1090423168, 1093934592, 1097445760, 1100956928, 1104467584, + 1107977984, 1111488000, 1114997504, 1118506624, 1122015232, 1125523456, 1129031040, 1132538112, + 1136044544, 1139550336, 1143055360, 1146559616, 1150063104, 1153565696, 1157067648, 1160568576, + 1164068480, 1167567488, 1171065600, 1174562560, 1178058496, 1181553408, 1185046912, 1188539520, + 1192030720, 1195520768, 1199009408, 1202496768, 1205982720, 1209467008, 1212950144, 1216431744, + 1219911936, 1223390336, 1226867328, 1230342528, 1233816192, 1237288064, 1240758144, 1244226560, + 1247693056, 1251157760, 1254620416, 1258081152, 1261539968, 1264996864, 1268451712, 1271904384, + 1275355008, 1278803456, 1282249728, 1285693696, 1289135488, 1292574848, 1296011904, 1299446784, + 1302878976, 1306308736, 1309736064, 1313160960, 1316583296, 1320002944, 1323420032, 1326834304, + 1330246144, 1333655040, 1337061120, 1340464512, 1343865088, 1347262592, 1350657152, 1354048768, + 1357437440, 1360823168, 1364205824, 1367585280, 1370961664, 1374334720, 1377704704, 1381071360, + 1384434816, 1387794944, 1391151616, 1394504960, 1397854976, 1401201152, 1404544000, 1407883520, + 1411219328, 1414551552, 1417880064, 1421204992, 1424526080, 1427843456, 1431157120, 1434466944, + 1437772928, 1441074944, 1444373120, 1447667072, 1450957312, 1454243328, 1457525248, 1460803328, + 1464077056, 1467346688, 1470612096, 1473873408, 1477130240, 1480382848, 1483630976, 1486874752, + 1490114048, 1493348992, 1496579584, 1499805440, 1503026944, 1506243584, 1509455744, 1512663296, + 1515866112, 1519064192, 1522257536, 1525446144, 1528629760, 1531808512, 1534982272, 1538151296, + 1541315328, 1544474368, 1547628288, 1550777216, 1553921024, 1557059840, 1560193152, 1563321472, + 1566444672, 1569562240, 1572674816, 1575782016, 1578883584, 1581980032, 1585070848, 1588156416, + 1591236352, 1594310912, 1597379584, 1600442880, 1603500544, 1606552576, 1609598592 +}; + +/* Q Factor is 31*/ +const Word32 ivas_han_win_32k_fx[L_FRAME32k] = { + 12928, 51648, 116224, 206656, 322880, 464960, 632832, 826496, 1046016, + 1291328, 1562496, 1859392, 2182080, 2530560, 2904832, 3304832, 3730560, + 4182080, 4659328, 5162304, 5690944, 6245312, 6825344, 7431104, 8062464, + 8719488, 9402112, 10110336, 10844160, 11603520, 12388480, 13198976, 14034944, + 14896448, 15783424, 16695808, 17633664, 18596928, 19585536, 20599552, 21638912, + 22703552, 23793472, 24908672, 26049088, 27214720, 28405504, 29621504, 30862592, + 32128704, 33419968, 34736192, 36077440, 37443712, 38834816, 40250880, 41691776, + 43157504, 44648064, 46163328, 47703360, 49268032, 50857408, 52471296, 54109824, + 55772928, 57460416, 59172416, 60908800, 62669568, 64454656, 66264064, 68097664, + 69955456, 71837440, 73743488, 75673600, 77627712, 79605824, 81607808, 83633664, + 85683392, 87756864, 89854080, 91974912, 94119360, 96287424, 98478976, 100694016, + 102932416, 105194240, 107479296, 109787648, 112119232, 114473856, 116851584, 119252352, + 121676096, 124122688, 126592192, 129084480, 131599488, 134137088, 136697408, 139280192, + 141885440, 144513152, 147163264, 149835584, 152530176, 155246848, 157985728, 160746560, + 163529408, 166334144, 169160704, 172009024, 174879040, 177770752, 180683904, 183618624, + 186574720, 189552128, 192550848, 195570752, 198611840, 201673920, 204756992, 207860992, + 210985792, 214131392, 217297600, 220484480, 223691840, 226919680, 230167936, 233436416, + 236725120, 240033984, 243362880, 246711744, 250080512, 253469120, 256877440, 260305472, + 263753024, 267220096, 270706496, 274212288, 277737280, 281281408, 284844672, 288426880, + 292027904, 295647808, 299286464, 302943744, 306619456, 310313728, 314026368, 317757248, + 321506304, 325273472, 329058688, 332861760, 336682688, 340521408, 344377664, 348251520, + 352142784, 356051456, 359977344, 363920448, 367880640, 371857792, 375851840, 379862656, + 383890112, 387934272, 391994880, 396071936, 400165248, 404274816, 408400384, 412542016, + 416699584, 420872960, 425062016, 429266688, 433486912, 437722368, 441973248, 446239360, + 450520576, 454816704, 459127808, 463453696, 467794112, 472149248, 476518784, 480902784, + 485300992, 489713344, 494139840, 498580032, 503034304, 507502208, 511983808, 516478848, + 520987392, 525509120, 530044032, 534592000, 539153088, 543726912, 548313600, 552912832, + 557524608, 562148736, 566785408, 571434048, 576094784, 580767616, 585452224, 590148608, + 594856576, 599576192, 604307072, 609049344, 613802752, 618567296, 623342592, 628128896, + 632925888, 637733504, 642551552, 647380096, 652218752, 657067648, 661926400, 666795264, + 671673856, 676562176, 681459968, 686367232, 691283648, 696209536, 701144320, 706088192, + 711040768, 716002176, 720972224, 725950656, 730937472, 735932480, 740935808, 745947008, + 750966144, 755992960, 761027456, 766069504, 771118976, 776175680, 781239680, 786310528, + 791388416, 796472896, 801564288, 806662080, 811766400, 816876928, 821993792, 827116544, + 832245248, 837379776, 842520064, 847665856, 852817152, 857973696, 863135424, 868302208, + 873474048, 878650560, 883831808, 889017728, 894207936, 899402624, 904601216, 909804160, + 915010944, 920221696, 925435904, 930653952, 935875200, 941099776, 946327616, 951558592, + 956792384, 962029120, 967268416, 972510272, 977754624, 983001344, 988250112, 993501120, + 998753856, 1004008576, 1009264704, 1014522624, 1019781888, 1025042560, 1030304256, 1035566976, + 1040830784, 1046095232, 1051360384, 1056626048, 1061892224, 1067158592, 1072425280, 1077691776, + 1082958208, 1088224512, 1093490560, 1098755968, 1104020736, 1109284864, 1114548224, 1119810432, + 1125071616, 1130331520, 1135590272, 1140847232, 1146102912, 1151356544, 1156608512, 1161858304, + 1167106048, 1172351616, 1177594624, 1182835200, 1188073344, 1193308544, 1198541056, 1203770368, + 1208996736, 1214219648, 1219439232, 1224655488, 1229867904, 1235076736, 1240281472, 1245482240, + 1250679040, 1255871360, 1261059456, 1266243072, 1271421952, 1276596224, 1281765504, 1286929920, + 1292089088, 1297243008, 1302391552, 1307534592, 1312672000, 1317803520, 1322929280, 1328049152, + 1333162752, 1338270336, 1343371264, 1348465920, 1353553920, 1358635264, 1363709568, 1368776960, + 1373837312, 1378890496, 1383936256, 1388974336, 1394004992, 1399028224, 1404043264, 1409050496, + 1414049792, 1419040640, 1424023424, 1428997632, 1433963392, 1438920448, 1443868672, 1448808064, + 1453738496, 1458659328, 1463571328, 1468473856, 1473366912, 1478250240, 1483124096, 1487987968, + 1492841856, 1497685632, 1502519296, 1507342592, 1512155392, 1516957696, 1521749504, 1526530176, + 1531299968, 1536059008, 1540806912, 1545543424, 1550268672, 1554982528, 1559684864, 1564375168, + 1569053952, 1573720832, 1578375680, 1583018240, 1587648640, 1592266496, 1596872192, 1601464960, + 1606045312, 1610612736, 1615167488, 1619708672, 1624237184, 1628752384, 1633254272, 1637742464, + 1642217216, 1646678400, 1651125504, 1655558784, 1659978240, 1664383616, 1668774784, 1673151488, + 1677513856, 1681861760, 1686194816, 1690513408, 1694817024, 1699105792, 1703379200, 1707637760, + 1711880960, 1716108800, 1720321152, 1724518144, 1728699392, 1732865024, 1737014400, 1741148160, + 1745265792, 1749367296, 1753452288, 1757521152, 1761573632, 1765609344, 1769628416, 1773630976, + 1777616640, 1781585408, 1785536768, 1789471488, 1793388800, 1797288832, 1801171328, 1805036544, + 1808883968, 1812713728, 1816525824, 1820320000, 1824096000, 1827854208, 1831594112, 1835315968, + 1839019520, 1842704384, 1846370944, 1850018944, 1853648256, 1857258624, 1860850432, 1864423168, + 1867976960, 1871511296, 1875026688, 1878522880, 1881999616, 1885456896, 1888894720, 1892312832, + 1895711488, 1899089920, 1902448896, 1905787904, 1909106688, 1912405504, 1915684096, 1918942592, + 1922180480, 1925398016, 1928595200, 1931771904, 1934927616, 1938062848, 1941177344, 1944270848, + 1947343360, 1950395136, 1953425664, 1956434944, 1959422976, 1962389632, 1965335040, 1968259072, + 1971161344, 1974042368, 1976901504, 1979739008, 1982554624, 1985348352, 1988120320, 1990870272, + 1993597952, 1996303616, 1998987264, 2001648384, 2004287104, 2006903552, 2009497728, 2012069376, + 2014618112, 2017144576, 2019648256, 2022129024, 2024587136, 2027022336, 2029434624, 2031823872, + 2034190080, 2036533120, 2038853120, 2041149696, 2043423232, 2045673344, 2047900160, 2050103296, + 2052283136, 2054439552, 2056572160, 2058681216, 2060766464, 2062828160, 2064865920, 2066879744, + 2068869888, 2070835968, 2072778240, 2074696192, 2076590336, 2078460160, 2080305792, 2082127360, + 2083924608, 2085697536, 2087446016, 2089170304, 2090870144, 2092545280, 2094196096, 2095822336, + 2097424128, 2099001088, 2100553472, 2102081024, 2103584000, 2105062144, 2106515456, 2107943936, + 2109347584, 2110726272, 2112080000, 2113408768, 2114712448, 2115991168, 2117244672, 2118473216, + 2119676672, 2120854912, 2122007936, 2123135744, 2124238336, 2125315584, 2126367616, 2127394304, + 2128395520, 2129371648, 2130322048, 2131247232, 2132146944, 2133021184, 2133869824, 2134693120, + 2135490816, 2136263040, 2137009664, 2137730688, 2138426112, 2139095936, 2139740160, 2140358656, + 2140951552, 2141518720, 2142060288, 2142576128, 2143066112, 2143530496, 2143969152, 2144382080, + 2144769280, 2145130496, 2145466112, 2145775872, 2146060032, 2146318208, 2146550528, 2146757120, + 2146937984, 2147092992, 2147222016, 2147325440, 2147403008, 2147454592, 2147480448 +}; + +/* Q Factor is 31*/ +const Word32 ivas_han_win_16k_fx[L_FRAME32k] = { + 51584, 206336, 464192, 825216, 1289344, 1856512, 2526592, 3299648, 4175552, + 5154240, 6235584, 7419520, 8705856, 10094592, 11585472, 13178432, 14873280, + 16669824, 18568000, 20567552, 22668288, 24869952, 27172480, 29575488, 32078848, + 34682304, 37385600, 40188480, 43090624, 46091840, 49191808, 52390144, 55686656, + 59081024, 62572800, 66161792, 69847552, 73629824, 77508160, 81482176, 85551552, + 89715904, 93974784, 98327808, 102774528, 107314560, 111947456, 116672768, 121490048, + 126398720, 131398528, 136488832, 141669184, 146939136, 152298048, 157745600, 163281088, + 168904064, 174614016, 180410304, 186292480, 192259904, 198312000, 204448256, 210667968, + 216970688, 223355584, 229822336, 236370112, 242998400, 249706432, 256493632, 263359424, + 270303040, 277323904, 284421184, 291594368, 298842688, 306165440, 313562048, 321031552, + 328573440, 336186944, 343871360, 351625792, 359449600, 367342144, 375302528, 383329984, + 391423744, 399583168, 407807232, 416095424, 424446720, 432860480, 441335680, 449871744, + 458467776, 467122752, 475836160, 484606976, 493434496, 502317568, 511255744, 520247936, + 529293184, 538390784, 547539840, 556739456, 565988800, 575286848, 584632832, 594025792, + 603464960, 612949248, 622477568, 632049536, 641663872, 651319808, 661016192, 670752128, + 680527040, 690339584, 700189056, 710074240, 719994624, 729948800, 739936128, 749955328, + 760005760, 770086400, 780196224, 790334336, 800499328, 810690816, 820907648, 831148608, + 841412992, 851699584, 862007680, 872335936, 882683648, 893049664, 903433024, 913832832, + 924248064, 934677504, 945120256, 955575552, 966042176, 976519040, 987005248, 997499904, + 1008001792, 1018510080, 1029023552, 1039541440, 1050062528, 1060585984, 1071110720, 1081635456, + 1092159616, 1102681984, 1113201664, 1123717504, 1134228480, 1144733696, 1155232256, 1165722752, + 1176204288, 1186676224, 1197137280, 1207586432, 1218022656, 1228445184, 1238852864, 1249244416, + 1259619328, 1269976192, 1280314368, 1290632832, 1300930304, 1311205888, 1321458432, 1331687552, + 1341891840, 1352070400, 1362221952, 1372346112, 1382441472, 1392506880, 1402541952, 1412545280, + 1422516224, 1432453632, 1442356608, 1452224000, 1462054912, 1471848832, 1481604480, 1491320832, + 1500997120, 1510632320, 1520225536, 1529775744, 1539282176, 1548744192, 1558160256, 1567529728, + 1576852096, 1586125824, 1595350272, 1604524800, 1613648128, 1622719872, 1631738624, 1640703744, + 1649614592, 1658469888, 1667269376, 1676011520, 1684695808, 1693321472, 1701887616, 1710393344, + 1718837760, 1727220480, 1735540352, 1743796480, 1751988480, 1760115200, 1768175616, 1776169856, + 1784096256, 1791954688, 1799744000, 1807463424, 1815112576, 1822690048, 1830195968, 1837629184, + 1844988928, 1852274688, 1859485440, 1866620672, 1873679872, 1880662016, 1887566976, 1894393600, + 1901141248, 1907809536, 1914397696, 1920904960, 1927330816, 1933674624, 1939936000, 1946114048, + 1952208256, 1958218240, 1964142848, 1969982336, 1975735552, 1981401984, 1986981376, 1992472832, + 1997876224, 2003190656, 2008415744, 2013551360, 2018596352, 2023550720, 2028413824, 2033185152, + 2037864192, 2042450688, 2046944256, 2051344128, 2055650048, 2059861888, 2063978752, 2068000512, + 2071926784, 2075757056, 2079491072, 2083128576, 2086668928, 2090112128, 2093457408, 2096705024, + 2099854080, 2102904832, 2105856512, 2108709120, 2111462144, 2114115584, 2116668928, 2119122176, + 2121475072, 2123727104, 2125878528, 2127928576, 2129877504, 2131724800, 2133470464, 2135114496, + 2136656384, 2138096128, 2139433728, 2140668928, 2141801472, 2142831616, 2143758848, 2144583424, + 2145304960, 2145923584, 2146439168, 2146851840, 2147161344, 2147367680, 2147470848, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 +}; + +/* Q Factor is 30 */ +const Word32 ivas_sine_delay_32_fx[32] = { + 52686016, 105245104, 157550640, 209476640, 260898000, 311690784, 361732736, 410903232, 459083776, + 506158400, 552013632, 596539008, 639627264, 681174656, 721080960, 759250112, 795590272, + 830013632, 862437504, 892783744, 920979136, 946955776, 970651136, 992008064, 1010975232, + 1027506880, 1041563136, 1053110208, 1062120192, 1068571456, 1072448448, 1073741824 +}; + +/* Q Factor is 30 */ +const Word32 ivas_sine_frame_len_640_del_32_fx[577] = { + 1073737856, + 1073725888, 1073705984, 1073678144, 1073642368, 1073598592, 1073546880, 1073487168, 1073419584, + 1073343936, 1073260416, 1073168896, 1073069440, 1072962048, 1072846720, 1072723392, 1072592128, + 1072452928, 1072305792, 1072150656, 1071987648, 1071816640, 1071637696, 1071450816, 1071256000, + 1071053248, 1070842560, 1070623936, 1070397312, 1070162880, 1069920448, 1069670080, 1069411776, + 1069145536, 1068871424, 1068589376, 1068299392, 1068001472, 1067695680, 1067381952, 1067060288, + 1066730752, 1066393344, 1066047936, 1065694720, 1065333568, 1064964544, 1064587584, 1064202752, + 1063810048, 1063409472, 1063000960, 1062584576, 1062160384, 1061728256, 1061288320, 1060840448, + 1060384768, 1059921216, 1059449792, 1058970496, 1058483392, 1057988416, 1057485632, 1056974976, + 1056456512, 1055930240, 1055396096, 1054854144, 1054304384, 1053746816, 1053181440, 1052608256, + 1052027200, 1051438400, 1050841856, 1050237504, 1049625280, 1049005376, 1048377664, 1047742144, + 1047098944, 1046447936, 1045789184, 1045122624, 1044448384, 1043766400, 1043076672, 1042379200, + 1041674048, 1040961088, 1040240512, 1039512192, 1038776128, 1038032384, 1037280960, 1036521856, + 1035755008, 1034980544, 1034198464, 1033408640, 1032611200, 1031806016, 1030993280, 1030172864, + 1029344768, 1028509120, 1027665856, 1026814912, 1025956416, 1025090240, 1024216576, 1023335232, + 1022446400, 1021549888, 1020645824, 1019734208, 1018815104, 1017888384, 1016954112, 1016012288, + 1015062912, 1014106112, 1013141760, 1012169856, 1011190464, 1010203584, 1009209280, 1008207424, + 1007198144, 1006181376, 1005157120, 1004125440, 1003086336, 1002039744, 1000985792, 999924352, + 998855552, 997779328, 996695744, 995604736, 994506368, 993400640, 992287552, 991167104, + 990039296, 988904128, 987761664, 986611904, 985454784, 984290304, 983118592, 981939648, + 980753408, 979559872, 978359104, 977151040, 975935744, 974713216, 973483456, 972246528, + 971002304, 969750976, 968492480, 967226688, 965953792, 964673728, 963386496, 962092288, + 960790784, 959482176, 958166464, 956843648, 955513792, 954176832, 952832768, 951481600, + 950123456, 948758272, 947386048, 946006720, 944620480, 943227264, 941826944, 940419776, + 939005568, 937584384, 936156224, 934721152, 933279232, 931830336, 930374528, 928911808, + 927442176, 925965760, 924482432, 922992320, 921495296, 919991424, 918480832, 916963328, + 915439040, 913907968, 912370176, 910825600, 909274240, 907716160, 906151360, 904579840, + 903001664, 901416768, 899825216, 898226944, 896622016, 895010432, 893392256, 891767424, + 890136000, 888497984, 886853376, 885202176, 883544448, 881880128, 880209344, 878532032, + 876848192, 875157824, 873460992, 871757696, 870047872, 868331648, 866608960, 864879872, + 863144384, 861402496, 859654208, 857899584, 856138624, 854371264, 852597632, 850817600, + 849031296, 847238720, 845439808, 843634688, 841823296, 840005632, 838181760, 836351680, + 834515456, 832672960, 830824384, 828969600, 827108672, 825241600, 823368448, 821489152, + 819603840, 817712384, 815814912, 813911360, 812001728, 810086208, 808164608, 806237056, + 804303424, 802363904, 800418496, 798467072, 796509760, 794546560, 792577408, 790602432, + 788621568, 786634880, 784642368, 782644096, 780640000, 778630016, 776614336, 774592896, + 772565696, 770532864, 768494208, 766449856, 764399872, 762344192, 760282944, 758215936, + 756143424, 754065280, 751981504, 749892160, 747797248, 745696832, 743590848, 741479424, + 739362432, 737240000, 735112128, 732978752, 730839936, 728695744, 726546176, 724391168, + 722230784, 720065088, 717894080, 715717696, 713536000, 711349056, 709156864, 706959360, + 704756672, 702548672, 700335488, 698117184, 695893696, 693665024, 691431168, 689192192, + 686948224, 684699008, 682444864, 680185600, 677921280, 675651968, 673377536, 671098176, + 668813888, 666524608, 664230464, 661931328, 659627264, 657318400, 655004544, 652685952, + 650362432, 648034112, 645701056, 643363136, 641020480, 638673088, 636320896, 633964032, + 631602496, 629236224, 626865344, 624489792, 622109632, 619724800, 617335424, 614941504, + 612542976, 610139968, 607732352, 605320256, 602903680, 600482624, 598057152, 595627264, + 593192960, 590754240, 588311104, 585863680, 583411840, 580955712, 578495296, 576030528, + 573561536, 571088320, 568610816, 566129216, 563643264, 561153152, 558659008, 556160576, + 553658112, 551151488, 548640896, 546126144, 543607360, 541084480, 538557696, 536026848, + 533492096, 530953376, 528410656, 525864096, 523313568, 520759232, 518200960, 515638880, + 513073024, 510503328, 507929856, 505352608, 502771616, 500186880, 497598464, 495006400, + 492410624, 489811200, 487208128, 484601440, 481991200, 479377376, 476760000, 474139104, + 471514656, 468886720, 466255328, 463620448, 460982144, 458340480, 455695360, 453046880, + 450395040, 447739872, 445081408, 442419584, 439754496, 437086176, 434414624, 431739840, + 429061792, 426380672, 423696320, 421008864, 418318304, 415624576, 412927808, 410227968, + 407525120, 404819200, 402110304, 399398464, 396683616, 393965856, 391245120, 388521568, + 385795104, 383065760, 380333600, 377598592, 374860800, 372120256, 369376960, 366630848, + 363882080, 361130624, 358376480, 355619648, 352860192, 350098176, 347333536, 344566304, + 341796512, 339024192, 336249376, 333472064, 330692256, 327910016, 325125344, 322338304, + 319548832, 316756960, 313962784, 311166304, 308367488, 305566368, 302763008, 299957376, + 297149568, 294339552, 291527296, 288712928, 285896416, 283077792, 280257024, 277434208, + 274609376, 271782464, 268953568, 266122608, 263289760, 260454928, 257618144, 254779488, + 251938928, 249096480, 246252208, 243406128, 240558224, 237708512, 234857088, 232003888, + 229148976, 226292384, 223434080, 220574160, 217712592, 214849392, 211984608, 209118256, + 206250352, 203380944, 200510000, 197637584, 194763696, 191888352, 189011600, 186133440, + 183253936, 180373024, 177490800, 174607264, 171722416, 168836304, 165948944, 163060368, + 160170544, 157279584, 154387424, 151494128, 148599712, 145704176, 142807600, 139909920, + 137011232, 134111504, 131210816, 128309144, 125406504, 122502952, 119598480, 116693128, + 113786920, 110879856, 107971976, 105063288, 102153832, 99243616, 96332656, 93420992, + 90508624, 87595600, 84681920, 81767616, 78852704, 75937200, 73021144, 70104536, + 67187416, 64269804, 61351708, 58433156, 55514176, 52594776, 49674996, 46754840, + 43834344, 40913520, 37992392, 35070980, 32149316, 29227408, 26305284, 23382966, + 20460476, 17537830, 14615058, 11692176, 8769208, 5846174, 2923098, 0 +}; + + +const Word32 ivas_sine_frame_len_640_del_16_fx[289] = { + 1073725952, + 1073678400, 1073599104, 1073488064, 1073345344, 1073170880, 1072964736, 1072726912, 1072457408, 1072156160, 1071823296, + 1071458752, 1071062528, 1070634688, 1070175232, 1069684096, 1069161472, 1068607168, 1068021312, 1067403904, 1066755008, + 1066074560, 1065362624, 1064619200, 1063844352, 1063038016, 1062200320, 1061331264, 1060430848, 1059499072, 1058536000, + 1057541696, 1056516096, 1055459328, 1054371392, 1053252288, 1052102016, 1050920704, 1049708352, 1048465024, 1047190656, + 1045885376, 1044549184, 1043182208, 1041784320, 1040355712, 1038896320, 1037406272, 1035885568, 1034334272, 1032752448, + 1031140096, 1029497216, 1027824000, 1026120384, 1024386432, 1022622272, 1020827904, 1019003328, 1017148672, 1015264000, + 1013349248, 1011404608, 1009430080, 1007425792, 1005391680, 1003327872, 1001234432, 999111424, 996958848, 994776896, + 992565568, 990324864, 988054912, 985755712, 983427456, 981070144, 978683904, 976268672, 973824576, 971351808, + 968850240, 966320128, 963761408, 961174272, 958558720, 955914816, 953242752, 950542464, 947814144, 945057728, + 942273472, 939461440, 936621504, 933753984, 930858880, 927936192, 924986176, 922008896, 919004288, 915972544, + 912913664, 909827968, 906715264, 903575808, 900409728, 897217024, 893997760, 890752128, 887480128, 884181888, + 880857600, 877507328, 874131072, 870729024, 867301184, 863847744, 860368832, 856864448, 853334848, 849779968, + 846199936, 842594944, 838965120, 835310400, 831631104, 827927168, 824198848, 820446144, 816669184, 812868096, + 809043008, 805194048, 801321216, 797424768, 793504832, 789561344, 785594560, 781604608, 777591488, 773555456, + 769496640, 765414976, 761310656, 757183936, 753034880, 748863552, 744670080, 740454592, 736217216, 731958144, + 727677376, 723375232, 719051648, 714706752, 710340864, 705953920, 701546112, 697117632, 692668544, 688198976, + 683709056, 679198976, 674668864, 670118720, 665548800, 660959296, 656350208, 651721728, 647074048, 642407168, + 637721344, 633016704, 628293376, 623551488, 618791104, 614012480, 609215744, 604400960, 599568384, 594718080, + 589850176, 584964864, 580062272, 575142528, 570205824, 565252224, 560281984, 555295168, 550291904, 545272448, + 540236864, 535185280, 530117952, 525034944, 519936384, 514822496, 509693408, 504549248, 499390144, 494216384, + 489027968, 483825056, 478607904, 473376640, 468131360, 462872224, 457599424, 452313152, 447013472, 441700608, + 436374688, 431035904, 425684352, 420320224, 414943680, 409554848, 404153984, 398741152, 393316512, 387880320, + 382432576, 376973600, 371503488, 366022368, 360530464, 355027904, 349514848, 343991456, 338457920, 332914368, + 327360992, 321797952, 316225376, 310643520, 305052416, 299452352, 293843392, 288225792, 282599680, 276965152, + 271322528, 265671856, 260013344, 254347136, 248673408, 242992352, 237304096, 231608848, 225906752, 220197984, + 214482704, 208761088, 203033328, 197299552, 191559952, 185814672, 180063936, 174307856, 168546624, 162780432, + 157009424, 151233776, 145453648, 139669232, 133880696, 128088216, 122291928, 116492040, 110688704, 104882096, + 99072408, 93259768, 87444384, 81626424, 75806048, 69983424, 64158744, 58332160, 52503856, 46674000, + 40842768, 35010324, 29176854, 23342516, 17507490, 11671948, 5836060, 0 +}; + +/************************ Q30 *******************************/ +const Word32 ivas_fb_fr_12band_1ms_re_fx[IVAS_FB_12_1MS_LEN] = { + 1046768256, 1012312512, 944113536, 843565952, 712700800, 554033920, 370399360, 163534048, -67588040, + -313003296, -547361792, -745791424, -889130944, -964720960, -967822016, -901839040, -777730304, + -612432896, -426573984, -241764928, -77701744, 50405768, 134107528, 173698992, 183571312, + 181978912, 174963648, 163434880, 148881184, 132470640, 115304208, 98219512, 81912736, + 66862960, 53409868, 41724844, 31871182, 23797162, 17385436, 12455156, 8801240, + 6197829, 4427144, 3280128, 2575327, 2155348, 1897329, 1705752, 1516863, + 1289431, 1005694, 661856, 267796, -161263, -604780, -1043282, -1457411, + -1832285, -2155534, -2420027, -2621275, -2759126, -2835035, -2853297, -2818571, + -2737039, -2614376, -2456980, -2270381, -2060530, -1832512, -1591794, -1343094, + -1091494, -841376, -597362, -363290, -143021, 60510, 244561, 407408, + 547618, 664738, 758550, 829643, 878668, 906840, 915250, 905346, + 878343, 835721, 778738, 708948, 627794, 537107, 438729, 334948, + 228103, 120925, 16090, -83524, -175327, -256811, -326026, -381381, + -422046, -447703, -458837, -456405, -442013, -417522, -385138, -347000, + -305255, -261681, -217812, -174648, -132866, -92642, -53935, -16402, + 20279, 56463, 92235, 127494, 161728, 194173, 223691, 249012, + 268700, 281445, 286068, 281804, 268278, 245720, 214858, 177029, + 133974, 87839, 40901, -4492, -46220, -82436, -111817, -133546, + -147456, -153913, -153846, -148528, -139528, -128444, -116827, -105934, + -96699, -89563, -84536, -81138, -78561, -75704, -71400, -64501, + -54108, -39627, -20946, 1593, 27122, 54374, 81719, 107372, + 129497, 146446, 156855, 159848, 155068, 142780, 123803, 99496, + 71589, 42078, 8610925, 16407290, 31915518, 54983844, 85416624, 123087880, + 168063984, 221958576, 289536032, 364878560, 426914240, 455184448, 434995104, 358099712, + 224036640, 40240900, -178615296, -412308800, -637390400, -829991424, -968687232, -1037118016, + -1026013056, -934381184, -769721024, -547208704, -287987072, -16727445, 241188016, 462583776, + 629070144, 729071296, 758930560, 723116864, 633312128, 506752128, 363680000, 224696192, + 107612800, 25033840, -24212064, -54589336, -75035176, -87485160, -93580896, -94591848, + -91737704, -86038536, -78437624, -69711224, -60533488, -51423856, -42794000, -34920752, + -27987240, -22072318, -17188296, -13279352, -10254646, -7989723, -6353249, -5207335, + -4426934, -3897128, -3525509, -3236283, -2977071, -2710878, -2419337, -2094076, + -1738366, -1359253, -969076, -579170, -201992, 153445, 478767, 769398, + 1021418, 1233894, 1405828, 1538184, 1631253, 1686663, 1705249, 1689093, + 1639776, 1560317, 1453594, 1324024, 1175972, 1015086, 846649, 676618, + 509991, 351706, 205173, 73207, -43142, -143513, -229073, -301290, + -362531, -414799, -460247, -500043, -534968, -564551, -587849, -602888, + -607619, -599579, -576918, -538114, -482894, -411845, -327078, -231622, + -129783, -26319, 73437, 164513, 242258, 303205, 344935, 366711, + 369107, 354325, 325569, 287088, 243371, 199057, 158131, 123882, + 98274, 82114, 74715, 74333, 78122, 82791, 84734, 80757, + 68210, 45592, 12513, -29958, -79606, -133015, -186134, -234445, + -273650, -299897, -310406, -303565, -279332, -239075, -185665, -123028, + -55984, 10396, 12276729, 12693837, 13547048, 14871155, 16707203, 19094012, + 22050984, 25567530, 29581572, 33971516, 38534384, 42985632, 46940136, 49924776, + 51363228, 50604824, 46909464, 39493740, 27503144, 10070768, -13759776, -44999620, + -84980336, -136135984, -207135712, -303422240, -412817600, -514972896, -589851392, -619651584, + -591583168, -499579936, -345470464, -138966128, 103208400, 359174656, 604351488, 814326528, + 967700992, 1048627328, 1048680832, 967863296, 814603776, 604752128, 359708672, 103884792, + -138140928, -344495008, -498458752, -590328384, -618282624, -588395136, -513462144, -411289888, + -301917376, -205694144, -134796400, -83778624, -43967052, -12923312, 10688964, 27884292, + 39622020, 46770036, 50183460, 50644772, 48893804, 45580600, 41282912, 36475948, + 31549672, 26793770, 22418028, 18548592, 15250408, 12530037, 10357491, 8671122, + 7396225, 6448686, 5748701, 5221465, 4805724, 4451326, 4123487, 3798131, + 3463431, 3114322, 2752946, 2383612, 2013354, 1648090, 1293873, 954378, + 632818, 330406, 48532, -212349, -450755, -665332, -853410, -1012414, + -1138953, -1230412, -1284349, -1300013, -1277722, -1220043, -1130902, -1016282, + -883017, -739061, -592113, -449695, -317863, -201395, -102837, -23014, + 39453, 87271, 124545, 155673, 185224, 216854, 253275, 295449, + 342868, 393176, 442827, 487113, 521090, 539819, 539332, 516817, + 471355, 403816, 317194, 216106, 106711, -4112, -109126, -201659, + -275976, -328059, -355725, -359045, -340068, -302808, -252589, -195699, + -138533, -87141, -46428, -19866, -8984, -13439, -30918, -57611, + -88487, -118040, -140755, -151891, -147872, -126858, -88834, -35798, + 28549, 99021, 169585, 233841, 285797, 320360, 333987, 324942, + 293611, 242374, 175498, 98630, 18357, -58534, -125609, -177509, + -210361, -222240, -213241, -185532, -143021, -91031, -35654, 16794, + 60506, 90695, 104157, 99518, 77443, 40482, -7123, -59963, + -111945, -157005, -189668, -205697, -202469, -179335, -137639, -80671, + -13290, 58484, 128123, 189173, 235954, 264066, 270883, 255765, + 220174, 2505037, 2442157, 2316154, 2126672, 1874467, 1561489, 1192761, + 775600, 321304, -157412, -645618, -1131069, -1604363, -2065994, -2526609, + -3015154, -3577470, -4283816, -5223516, -6510031, -8269471, -10642073, -13763168, + -17761360, -22731886, -28733746, -35756756, -43722016, -52444716, -61644104, -70903304, + -79696304, -87342288, -93058336, -95895816, -94830640, -88641344, -76058616, -55443336, + -24863958, 24611116, 107440320, 224788944, 364047616, 507399776, 634242176, 724330048, + 760427264, 730852288, 631136576, 464936832, 243827808, -13803173, -284784032, -543737088, + -765995008, -930417472, -1021827456, -1032720576, -964074624, -825139200, -632243584, -406773696, + -172552176, 47020828, 231770176, 367063072, 445488224, 467504928, 441322720, 381553248, + 308519520, 243096544, 190940560, 146958368, 109144704, 76984176, 50110068, 28195132, + 10859917, -2331860, -11867127, -18267046, -22063578, -23780578, -23911906, -22907786, + -21160858, -19000796, -16689673, -14424574, -12340740, -10519832, -8997765, -7775391, + -6827615, -6113435, -5583605, -5187945, -4880011, -4620898, -4380691, -4139162, + -3884798, -3613535, -3326639, -3028821, -2726195, -2424818, -2129499, -1843272, + -1567228, -1300854, -1042591, -790584, -543428, -300799, -63891, 164435, + 379755, 576491, 748467, 889663, 994911, 1060624, 1085268, 1069727, + 1017300, 933554, 825817, 702603, 572797, 444929, 326372, 222801, + 137707, 72284, 25430, -5886, -26190, -40792, -55143, -74076, + -101256, -138661, -186386, -242548, -303550, -364410, -419384, -462555, + -488576, -493231, -474014, -430404, -364059, -278663, -179684, -73826, + 31531, 129079, 212203, 275656, 315980, 331857, 324141, 295780, + 251424, 196978, 138929, 83734, 37113, 3535, -14258, -15450, + -1229, 25423, 60045, 97246, 131265, 156654, 168829, 164631, + 142633, 103366, 49247, -15601, -85794, -155177, -217478, -266899, + -298743, -309847, -298949, -266783, -216054, -151145, -77727, -2174, + 69017, 702811, 654136, 559557, 424419, 255932, 62727, -146313, + -362395, -578054, -786994, -985086, -1169469, -1339221, -1493760, -1633415, + -1757450, -1864970, -1953010, -2018235, -2055396, -2060043, -2027296, -1955369, + -1844129, -1698799, -1527422, -1343910, -1163448, -1004247, -880298, -801810, + -765486, -754582, -727814, -620985, -336399, 251272, 1302991, 3002489, + 5560181, 9191239, 14115464, 20525480, 28584940, 38387408, 49958096, 63204572, + 77930464, 93777392, 110263472, 126708904, 142322784, 156083648, 166946144, 173586320, + 175308576, 166325584, 128680304, 48303544, -74757040, -231715952, -407042976, -580775616, + -731094848, -837272320, -882366976, -855569984, -753729472, -582012992, -353498368, -87845872, + 190881904, 456905760, 685667520, 856595200, 955419584, 975703808, 919454400, 796692096, + 624085824, 422776032, 215700912, 24714716, -132116288, -242736960, -302620672, -315365760, + -293500640, -258619744, -225315280, -194015376, -163910608, -135501680, -109209736, -85466480, + -64529184, -46551644, -31533836, -19377918, -9878438, -2769905, 2268515, 5573895, + 7492172, 8348992, 8445734, 8040905, 7351921, 6546074, 5747758, 5036624, + 4458304, 4026662, 3735443, 3561663, 3475902, 3444629, 3437763, 3428836, + 3399492, 3337488, 3238697, 3103696, 2938339, 2749967, 2547660, 2338971, + 2130630, 1926285, 1727949, 1534741, 1344902, 1155176, 962956, 765794, + 563232, 356016, 147339, -58398, -254956, -435840, -594040, -723684, + -819800, -879714, -902536, -890086, -845966, -775986, -686897, -586473, + -482133, -380953, -288451, -208799, -143979, -94350, -58234, -32830, + -14133, 1978, 19701, 42276, 72069, 109808, 154947, 205272, + 257581, 307614, 350943, 383061, 400284, 399785, 380309, 341971, + 286657, 217523, 139066, 56385, -24953, -99742, -163283, -212106, + -243951, -258230, -255733, -167174, -239722, -322173, -408810, -492821, + -566516, -622391, -653378, -653921, -619965, -549788, -443508, -303565, + -133727, 60691, 274135, 500595, 734943, 972407, 1209697, 1443978, + 1673718, 1897211, 2113333, 2319888, 2514652, 2693915, 2854207, 2991285, + 3102696, 3187122, 3247515, 3290252, 3328147, 3378477, 3464934, 3613501, + 3852565, 4205968, 4691138, 5309438, 6043184, 6844465, 7633047, 8285794, + 8638327, 8477588, 7550391, 5561188, 2190063, -2903797, -10053462, -19577218, + -31739716, -46747292, -64700276, -85602512, -109304912, -135555296, -163926944, -194002976, + -225285872, -258586768, -293477632, -315364832, -302650912, -242803328, -132218944, 24580560, + 215544720, 422611008, 623927680, 796557504, 919359168, 975661312, 955439360, 856681664, + 685819520, 457116384, 191139072, -87558504, -353200000, -581723904, -753469440, -855356160, + -882212736, -837186048, -731079168, -580827520, -407153984, -231873488, -74945544, 48100840, + 128479736, 166141328, 175151264, 173462112, 166856272, 156024384, 142286160, 126683672, + 110236760, 93736176, 77863432, 63103528, 49819328, 38212324, 28380444, 20303444, + 13891988, 8985083, 5391207, 2889572, 1262319, 294475, -203348, -398749, + -423662, -382151, -343523, -352875, -428668, -574135, -776792, -1018896, + -1276918, -1529859, -1757571, -1946540, -2086827, -2175642, -2213314, -2205436, + -2158564, -2081784, -1982822, -1869689, -1747600, -1621008, -1491391, -1359644, + -1224514, -1085096, -939557, -787433, -628324, -463767, -295726, -127991, + 35529, 189782, 330335, 452518, 553054, 629169, 679950, 705285, + 706896, 687113, 649626, 598183, 537192, 470470, 401849, 334088, + 269582, 209498, 154619, 104683, 59308, 17469, -21588, -58843, + -94673, -129406, -162639, -193876, -221997, -245959, -264363, -276167, + -280285, -276237, -263718, -243144, -215155, -181048, -225261, -273555, + -307889, -326103, -327476, -312684, -283609, -243038, -194256, -140631, + -85182, -30244, 22798, 73608, 122885, 172169, 223570, 279366, + 341593, 411622, 489814, 575248, 665622, 757256, 845294, 923987, + 987121, 1028456, 1042203, 1023430, 968397, 874758, 741642, 569587, + 360379, 116796, -157659, -459031, -783110, -1125546, -1481872, -1847416, + -2217186, -2585716, -2947037, -3294742, -3622346, -3923849, -4194709, -4432970, + -4640760, -4825675, -5002266, -5192922, -5428408, -5747161, -6193793, -6815752, + -7658969, -8761350, -10145511, -11809549, -13717971, -15791409, -17898084, -19845242, + -21374384, -22157722, -21800466, -19845174, -15783279, -9068449, 863064, 14571969, + 32592328, 55410852, 83458416, 117107272, 156758688, 202942128, 257651808, 325933440, + 402044000, 464971200, 494205696, 474891008, 398522784, 264288720, 79206760, -142533824, + -381224512, -613975168, -817483264, -970950784, -1058690624, -1072345920, -1012679872, -893613760, + -734287744, -546547584, -339769856, -124623176, 88170360, 288225568, 466194112, 614172160, + 726163904, 798321728, 829131584, 819397568, 772133120, 692285376, 586377152, 462039040, + 327503712, 191064064, 60554008, -57130884, -156432848, -233429280, -286014272, -313941504, + -318749984, -303544416, -272698496, -231426688, -185371904, -140057616, -100631488, -69996648, + -46622364, -28166424, -13810469, -2980571, 4834391, 10133794, 13384151, 15027667, + 15460742, 15036408, 14051635, 12751812, 11326396, 9916592, 8616869, 7484565, + 6544389, 5798046, 5229236, 4811721, 4513168, 4300801, 4143382, 4014381, + 3892172, 3761242, 3611156, 3436579, 3235728, 3009947, 2762235, 2496885, + 2218419, 1931526, 1640448, 1349202, 1061301, 780105, 508675, 250099, + 7326, -216639, -418984, -597023, -748502, -871609, -965247, -1029025, + -1063439, -1069768, -1050128, -1007269, -944511, -865478, -773983, -673761, + -568371, -460991, -354385, -250799, -152007, -59299, 26411, 104546, + 174730, 236744, 290418, 335608, 372145, 399853, 418548, 428095, + 428430, 419636, 401963, 375881, 342083, 301499, 255265, 204699, + 151239, 96397, 41685, -11436, -61625, -107696, -148661, -183744, + -212399, -234301, -249338, -257586, -259295, -171383, -167771, -160946, + -151648, -140875, -129741, -119346, -110602, -104127, -100108, -98276, + -97857, -97667, -96155, -91604, -82246, -66504, -43110, -11334, + 28976, 77253, 132282, 192171, 254555, 316653, 375561, 428343, + 472340, 505222, 525246, 531204, 522588, 499415, 462302, 412189, + 350367, 278167, 197008, 108113, 12645, -88501, -194453, -304491, + -417705, -533098, -649202, -764225, -875703, -980757, -1075829, -1157086, + -1220253, -1261142, -1275529, -1259757, -1210576, -1125738, -1003720, -844248, + -647867, -416383, -152288, 140834, 458975, 797247, 1150575, 1513140, + 1879071, 2241774, 2594688, 2930577, 3242477, 3523085, 3766061, 3965621, + 4118279, 4222622, 4281408, 4301274, 4294860, 4279931, 4280984, 4327080, + 4452293, 4691546, 5079427, 5643594, 6401946, 7353690, 8475606, 9711576, + 10969534, 12110916, 12950640, 13248182, 12713298, 10999818, 7719470, 2437137, + -5306709, -16007364, -30173754, -48382488, -71457888, -101754088, -140816912, -185763344, + -231466336, -272424224, -303010560, -318021792, -313081312, -285067456, -232401024, -155266144, + -55676148, 62564504, 194048000, 332049728, 468930560, 596597632, 707022848, 792757376, + 847434880, 866203136, 846081856, 786193920, 687883392, 554677120, 392130080, 207514704, + 9432382, -192707744, -389200480, -570675136, -728479808, -856350656, -952308800, -1015864832, + -1046220032, -1043342848, -1008126784, -942413952, -848923648, -731177152, -593366784, -440223744, + -276851936, -108565096, 59292484, 221513920, 373199296, 509904800, 627780928, 723682304, + 795257728, 841006144, 860308096, 853421632, 821452480, 766292160, 690533568, 597361024, + 490425248, 373702496, 251347920, 127544600, 6357648, -108405296, -213318272, -305445280, + -382425728, -442537280, -484731648, -508645408, -514583008, -503476768, -476822816, -436599136, + -385166592, -325160416, -259373680, -190640560, -121721768, -55198692, 6621388, 61783672, + 108746912, 146423216, 174197536, 191924704, 199906864, 198850976, 189810704, 174114128, + 153282784, 128943984, 102742896, 76256368, 50914548, 27932052, 8253544, -7485707, + -18981258, -26263536, -29686804, -29902128, -27874808, -24904632, -21873452, -18924710, + -16109369, -13513449, -11193274, -9184409, -7497119, -6124396, -5043505, -4222392, + -3622104, -3201531, -2919256, -2736657, -2618792, -2536063, -2464195, -2384826, + -2284834, -2156265, -1995319, -1801974, -1578908, -1331064, -1064692, -787000, + -505396, -227288, 40476, 291657, 521006, 724191, 898044, 1040397, + 1150221, 1227397, 1272778, 1287922, 1275099, 1237007, 1176756, 1097593, + 1002895, 895923, 779853, 657586, 531818, 404912, 279016, 155978, + 37491, -74965, -179989, -276315, -362698, -438012, -501167, -551237, + -587418, -609171, -616196, -608571, -586708, -551466, -504065, -446144, + -379632, -306754, -229859, -151391, -73706, 962, 70672, 133776, + 189046, 235630, 273114, 301432, 320873, 331952, 335393, 331988, + 322579, 307941, 288792, 265710, 239189, 209598, 177267, 142480, + 105576, 66945, 27114, -13271, -53400, -92348, -129065, -162474, + -191486, -215114, -232503, -243037, -246348, -242394, -231432, -214048, + -191082, -163619, -132881, -100182, -66814, -34004, -2809, 25897, + 51498, 73603, 92073, 106961, 118497, 127000, 132851, 136409, + 137987, 137791, 135930, 132384, 127051, 119749, 110286, 98485, + 84255, 67615, 48748, 27996, 5888, -16902, -39568, -61243, + -81031, -98099, -111715, -121326, -162998, -160088, -154357, -145969, + -135159, -122211, -107436, -91156, -73678, -55283, -36214, -16667, + 3198, 23260, 43411, 63547, 83543, 103238, 122414, 140790, + 158012, 173664, 187268, 198317, 206286, 210673, 211020, 206956, + 198214, 184663, 166317, 143347, 116078, 84982, 50655, 13802, + -24798, -64311, -103888, -142674, -179845, -214613, -246243, -274051, + -297418, -315773, -328608, -335464, -335942, -329700, -316476, -296086, + -268464, -233660, -191884, -143511, -89112, -29451, 34490, 101547, + 170354, 239401, 307043, 371566, 431212, 484258, 529040, 564034, + 587875, 599425, 597777, 582315, 552693, 508884, 451144, 380049, + 296447, 201490, 96577, -16612, -136189, -260017, -385787, -510997, + -633031, -749140, -856549, -952436, -1034059, -1098739, -1143998, -1167540, + -1167397, -1141901, -1089827, -1010351, -903194, -768558, -607272, -420711, + -210944, 19368, 266825, 527423, 796421, 1068545, 1337896, 1598264, + 1843121, 2066095, 2261075, 2422874, 2547443, 2632705, 2678810, 2689041, + 2669949, 2632165, 2590157, 2562709, 2571986, 2643435, 2803848, 3080521, + 3498078, 4076931, 4828788, 5754789, 6839761, 8050914, 9330877, 10598671, + 11740823, 12618964, 13055458, 12877144, 11632705, 8232321, 1712792, -8269488, + -21676128, -38124492, -56918448, -77081536, -97412152, -116545320, -133029752, -145407808, + -152301808, -152496656, -145019616, -129208872, -104771344, -71822984, -30912372, 16976826, + 70442824, 127704136, 186656480, 244947920, 300068000, 349448640, 390571840, 421080480, + 438886880, 442275104, 429992032, 401322976, 356148672, 294980192, 218969888, 129897104, + 30128484, -77446248, -189501472, -302382688, -412230048, -515113984, -607177664, -684781632, + -744644480, -783974400, -800586304, -792999936, -760514496, -703256576, -622199232, -519150624, + -396712160, -258207056, -107581408, 50718884, 211891600, 370936768, 522825024, 662669440, + 785895232, 888400000, 966700096, 1018056320, 1040574720, 1033278976, 996150976, 930138240, + 837128128, 719891072, 581993344, 427717504, 261968336, 89712808, -84335696, -255470448, + -419050304, -570668224, -706270592, -822273344, -915657792, -984053440, -1025798848, -1039984064, + -1026470080, -985886720, -919608064, -829707328, -718891392, -590417984, -447997504, -295682944, + -137750720, 21423548, 177490944, 326252736, 463778272, 586513216, 691375872, 775837824, + 837987456, 876574784, 891035520, 881494912, 848751424, 794240448, 719980032, 628500544, + 522760032, 406049152, 281887712, 153916800, 25789502, -98936256, -216899504, -325029824, + -420629824, -501444512, -565715328, -612217792, -640282304, -649796800, -641192896, -615415808, + -573878848, -518405728, -451161088, -374573216, -291251040, -203897664, -115224504, -27867474, + 55691216, 133193880, 202668432, 262478208, 311359200, 348444032, 373271968, 385785760, + 386315040, 375548096, 354492672, 324428128, 286850336, 243411744, 195858832, 145969024, + 95489384, 46079124, -742270, -43639588, -81497992, -113449472, -138889424, -157482720, + -169159888, -174103616, -172726688, -165642240, -153628176, -137586864, -118502264, -97395800, + -75283368, -53134364, -31835154, -12157406, 5266631, 19962188, 31621642, 40107016, + 45443876, 47808948, 47510056, 44961972, 40656428, 35131248, 28935710, 22599292, + 16597725, 11327856, 7077267, 4007588, 2004813, 698472, -159366, -668117, + -915026, -972592, -904574, -762742, -589613, -417127, -268777, -159451, + -97435, -84877, -119630, -195920, -305911, -440293, -589480, -743976, + -895177, -1035483, -1158746, -1260167, -1336478, -1385695, -1407139, -1401122, + -1368900, -1312362, -1233971, -1136502, -1023004, -896600, -760484, -617774, + -471538, -324684, -179997, -40056, 92731, 216208, 328430, 427747, + 512770, 582446, 636028, 673130, 693701, 698053, 686825, 660989, + 621793, 570758, 509593, 440184, 364504, 284586, 202444, 120043, + 39232, -38277, -110964, -177497, -236776, -287918, -330276, -363413, + -387116, -401358, -406302, -402269, -389735, -369301, -341693, -307732, + -268335, -224488, -177248, -127707, -76997, -26251, 23403, 70879, + 115146, 155262, 190393, 219846, 243073, 259708, 269557, 272617, + 269062, 259245, 243667, 222969, 197896, 169274, 137970, 104873, + 70854, 36751, 3337, -28682, -58696, -86176, -110690, -131889, + -149514, -163373, -173350, -179385, -181478, -179682, -174108, -164916, + -152331, -136632, -118169, -97351, -74653, -50603, -25781, -795, + 23721, 47148, 68883, 88374, 105138, 118782, 129014, 135661, + 138666, 138092, 134111, 126995, -72761, -56245, -38209, -19019, + 926, 21206, 41377, 60995, 79616, 96811, 112175, 125335, + 135964, 143783, 148571, 150171, 148491, 143510, 135276, 123908, + 109592, 92580, 73182, 51764, 28741, 4570, -20258, -45231, + -69817, -93477, -115679, -135902, -153653, -168473, -179953, -187739, + -191549, -191176, -186499, -177490, -164220, -146855, -125663, -101009, + -73349, -43220, -11236, 21933, 55569, 88924, 121238, 151753, + 179734, 204484, 225359, 241786, 253272, 259417, 259926, 254614, + 243416, 226386, 203704, 175675, 142727, 105408, 64381, 20414, + -25629, -72803, -120096, -166448, -210776, -251991, -289028, -320870, + -346577, -365309, -376354, -379149, -373302, -358603, -335043, -302817, + -262324, -214167, -159142, -98227, -32564, 36563, 107751, 179503, + 250256, 318414, 382371, 440551, 491426, 533563, 565640, 586488, + 595111, 590727, 572783, 540991, 495337, 436112, 363911, 279647, + 184541, 80117, -31824, -149225, -269813, -391137, -510624, -625621, + -733459, -831498, -917191, -988123, -1042078, -1077064, -1091376, -1083624, + -1052786, -998241, -919828, -817879, -693286, -547530, -382754, -201766, + -8088, 194084, 399903, 603998, 800600, 983813, 1147877, 1287596, + 1398749, 1478666, 1526731, 1545029, 1538843, 1517225, 1493308, 1484620, + 1512997, 1604428, 1788384, 2097022, 2563860, 3222329, 4104042, 5237042, + 6645377, 8348986, 10388584, 12857124, 15616492, 18195220, 20086854, 20833852, + 20030730, 17354698, 12586763, 5632648, -3464912, -14518786, -27198686, -41038776, + -55453300, -69758216, -83199240, -94984200, -104319184, -110446312, -112682200, -110454752, + -103337336, -91078120, -73623784, -51135812, -23998892, 7179643, 41579336, 78185368, + 115815920, 153157712, 188808416, 221324672, 249274288, 271290496, 286126560, 292708608, + 290184736, 277968256, 255773584, 223642784, 181961872, 131465504, 73229656, 8652162, + -60578956, -132528392, -205066832, -275933056, -342803008, -403363968, -455390976, -496823520, + -525839776, -540925440, -540935296, -525144960, -493290304, -445593920, -382776288, -306051584, + -217107424, -118068792, -11447024, 99925072, 212970192, 324453472, 431076864, 529578144, + 616831424, 689946368, 746362368, 783935232, 801012800, 796497984, 769895232, 721340928, + 651613760, 562127360, 454901984, 332518336, 198053008, 54997860, -92834592, -241417152, + -386622272, -524341152, -650604416, -761700160, -854286656, -925495040, -973019712, -995193152, + -991042688, -960327360, -903553472, -821968256, -717531648, -592866496, -451188992, -296220608, + -132085040, 36808156, 205888512, 370555840, 526312064, 668891968, 794386240, 899356480, + 980934400, 1036909248, 1065792000, 1066936320, 1040546496, 987467136, 909149824, 807691200, + 685777408, 546616256, 393851264, 231466848, 63682176, -105158952, -270702912, -428699744, + -575114688, -706232704, -818754752, -909882496, -977389312, -1019675904, -1035808896, -1025541568, + -989316224, -928248256, -844092096, -739190912, -616410240, -479058656, -330797152, -175539264, + -17346022, 139682832, 291517408, 434303488, 564462720, 678784448, 774506688, 849384640, + 901743936, 930519040, 935273728, 916205312, 874131520, 810461056, 727147968, 626633152, + 511772224, 385754272, 252012128, 114127448, -24266644, -159583088, -288375648, -407428352, + -513837376, -605083264, -679091392, -734279488, -769591104, -784513984, -779083840, -753872640, + -709962816, -648908288, -572682880, -483618976, -384336832, -277668320, -166575776, -54069264, + 56875640, 163397472, 262823600, 352738016, 431040544, 495996064, 546272512, 580966656, + 599617664, 602207872, 589151552, 561271552, 519765696, 466163232, 402273376, 330127520, + 251916672, 169926224, 86470040, 3825426, -75828792, -150469632, -218281248, -277698720, + -327443424, -366549120, -394378400, -410629056, -415330784, -408832544, -391780864, -365090688, + -329909184, -287574176, -239568528, -187472016, -132911848, -77513936, -22855780, 29577298, + 78431608, 122519032, 160844800, 192628240, 217316432, 234590304, 244363440, 246773968, + 242169824, 231088240, 214230352, 192431808, 166630544, 137832768, 107078304, 75406624, + 43824304, 13275079, -15386599, -41417940, -64205456, -83277544, -98311776, -109136888, + -115729656, -118206952, -116813448, -111905648, -103932808, -93415768, -80924248, -67053716, + -52402552, -37550280, -23037704, -9349536, 3099972, 13977919, 23039974, 30133750, + 35198404, 38260568, 39427008, 38874332, 36836352, 33589632, 29437968, 24696382, + 19675442, 14666438, 9928193, 5675861, 2072344, -777524, -2829749, -4100893, + -4665396, -4650187, -4237832, -3670417, -3111787, -2588999, -2111154, -1692910, + -1342761, -1064792, -858034, -718046, -637371, -606817, -616039, -654489, + -711863, -778707, -846654, -908726, -959364, -994500, -1011439, -1008780, + -986218, -944402, -884714, -809115, -719958, -619860, -511553, -397807, + -281326, -164706, -50372, 59439, 162717, 257679, 342798, 416803, + 478690, 527728, 563468, 585733, 594629, 590529, 574063, 546100, + 507723, 460200, 404950, 343501, 277458, 208453, 138112, 68013, + -346, -65582, -126442, -181831, -230824, -272671, -306807, -332846, + -350584, -359987, -361185, -354465, -340256, -319119, -291736, -258891, + -221458, -180384, -136669, -91350, -45474, -81, 43821, 85280, + 123419, 157461, 186741, 210730, 229036, 241421, 247797, 248224, + 242908, 232183, 216503, 196419, 172565, 145631, 116349, 85467, + 53736, 21886, -9380, -39409, -67596, -93402, -116356, -136059, + -152188, -164499, -172828, -177091, -177288, -173497, -165880, -154675, + -140195, -122823, -103005, -81242, -58073, -34073, -9827, 14076, + 37067, 58607, 78202, 95423, 109908, 121382, 129651, 134613, + 136254, 134645, 129937, 122348, -44011, -24892, -4829, 15720, + 36281, 56369, 75506, 93227, 109092, 122701, 133696, 141775, + 146697, 148290, 146451, 141157, 132459, 120486, 105445, 87616, + 67345, 45046, 21187, -3718, -29118, -54435, -79078, -102456, + -123992, -143137, -159380, -172271, -181421, -186524, -187359, -183802, + -175830, -163523, -147066, -126746, -102945, -76138, -46876, -15782, + 16466, 49153, 81535, 112860, 142385, 169387, 193186, 213156, + 228742, 239468, 244958, 244937, 239247, 227851, 210839, 188425, + 160956, 128901, 92851, 53506, 11664, -31790, -75908, -119691, + -162116, -202159, -238815, -271127, -298207, -319262, -333613, -340713, + -340163, -331730, -315348, -291129, -259362, -220512, -175214, -124263, + -68599, -9299, 52451, 115372, 178114, 239282, 297468, 351266, + 399319, 440334, 473120, 496614, 509913, 512295, 503248, 482484, + 449964, 405893, 350744, 285237, 210350, 127286, 37477, -57465, + -155750, -255468, -354592, -451046, -542708, -627478, -703289, -768173, + -820272, -857921, -879657, -884318, -871054, -839446, -789522, -721878, + -637689, -538829, -427837, -308012, -183306, -58351, 61766, 171575, + 265595, 338530, 385818, 403920, 391045, 347469, 276387, 184146, + 81162, -18121, -94264, -123407, -76036, 81568, 389991, 895519, + 1710701, 3002792, 4825273, 7109226, 9729646, 12512602, 15248433, 17702624, + 19630608, 20791430, 20963006, 19955790, 17626208, 13887624, 8719623, 2174045, + -5621665, -14464834, -24081046, -34131360, -44222504, -53920252, -62765096, -70290080, + -76039792, -79590136, -80567832, -78669104, -73676656, -65474260, -54058260, -39545472, + -22176940, -2317326, 19550376, 42834668, 66849928, 90834856, 113974736, 135426640, + 154347008, 169920736, 181390720, 188086896, 189453888, 185076096, 174699280, 158247904, + 135837376, 107780464, 74587640, 36960972, -4218522, -47909872, -92937136, -138019856, + -181808096, -222921312, -259989808, -291697568, -316825344, -334292320, -343195264, -342844000, + -332791264, -312856704, -283143456, -244046832, -196254272, -140736784, -78731208, -11714102, + 58632672, 130463552, 201817312, 270670080, 334992000, 392806176, 442247552, 481620896, + 509455360, 524554208, 526038368, 513381696, 486437344, 445453888, 391080448, 324360480, + 246714016, 159908576, 66019492, -32619810, -133476120, -233882016, -331106848, -422431424, + -505224224, -577016896, -635577152, -678976448, -705651136, -714454400, -704697856, -676181184, + -629208640, -564592384, -483640672, -388133216, -280282016, -162679760, -38236756, 89892360, + 218389968, 343862752, 462932736, 572329472, 668980864, 750100160, 813266368, 856496128, + 878304640, 877753856, 854486592, 808744960, 741372928, 653802560, 548023872, 426538944, + 292301664, 148644560, -806035, -152223392, -301680672, -445254848, -579131904, -699710144, + -803698816, -888209216, -950836352, -989727616, -1003637824, -991967616, -954785856, -892832832, + -807506624, -700830848, -575405568, -434342368, -281185056, -119818392, 45633172, 210913568, + 371747552, 523954144, 663558144, 786896576, 890717440, 972267648, 1029367616, 1060471360, + 1064709056, 1041912064, 992618752, 918061696, 820136128, 701350912, 564763136, 413905312, + 252702016, 85283768, -84153016, -251373152, -412193952, -562598208, -698834304, -817510976, + -915681728, -990918592, -1041372160, -1065817344, -1063683392, -1035067008, -980729024, -902074176, + -801114432, -680417408, -543040576, -392453440, -232449024, -67047936, 99603672, 263338768, + 420074528, 565914944, 697248640, 810838912, 903904448, 974187712, 1020010432, 1040314112, + 1034684224, 1003358720, 947219392, 867767552, 767083328, 647771264, 512892224, 365884480, + 210475200, 50585176, -109770824, -266585856, -415961728, -554206912, -677928256, -784115520, + -870214784, -934190464, -974573952, -990497408, -981711808, -948590080, -892113472, -813843264, + -715877760, -600795712, -471588352, -331581056, -184347104, -33615956, 116822016, 263211632, + 401927360, 529563904, 643020416, 739576448, 816957632, 873389632, 907638720, 919038784, + 907503104, 873521728, 818144448, 742948992, 649996672, 541776128, 421136352, 291211584, + 155339280, 16974000, -120401088, -253362480, -378632256, -493159552, -594195200, -679358336, + -746692608, -794711040, -822428992, -829383232, -815638016, -781777600, -728885632, -658512064, + -572628224, -473572352, -363985824, -246742688, -124873992, -1489180, 120303760, 237476976, + 347158464, 446702912, 533755744, 606308928, 662747520, 701884928, 722987456, 725786624, + 710479424, 677716736, 628580224, 564548800, 487455296, 399434400, 302864160, 200301680, + 94415504, -12084029, -116514408, -216288720, -308979968, -392380352, -464553824, -523880992, + -569095168, -599308544, -614028672, -613164032, -597019520, -566281600, -521994336, -465525920, + -398528192, -322889120, -240680240, -154100192, -65416176, 23095468, 109207648, 190798608, + 265904304, 332765472, 389868896, 435980928, 470173824, 491842976, 500715808, 496851904, + 480634304, 452752704, 414179264, 366137088, 310063456, 247567808, 180386464, 110334864, + 39258892, -31013516, -98719224, -162203968, -219962560, -270674336, -313232768, -346769088, + -370668672, -384580928, -388421408, -382367424, -366846528, -342518912, -310254080, -271102432, + -226263200, -177048848, -124847760, -71085712, -17187518, 35460372, 85545152, 131860032, + 173332944, 209050736, 238278608, 260474080, 275295552, 282605088, 282465888, 275134240, + 261046656, 240802480, 215142736, 184925744, 151100368, 114677616, 76701576, 38220244, + 257309, -36214540, -70298016, -101192744, -128213464, -150804368, -168549456, -181178720, + -188570000, -190746832, -187872144, -180238592, -168255376, -152432528, -133362752, -111701864, + -88148040, -63420712, -38239704, -13305140, 10721270, 33233146, 53694084, 71649704, + 86736888, 98689968, 107343928, 112634456, 114595192, 113352176, 109115832, 102170872, + 92864472, 81593048, 68788288, 54902676, 40395092, 25716910, 11298924, -2460449, + -15205434, -26631372, -36491212, -44599896, -50836640, -55145052, -57531268, -58060172, + -56849976, -54065368, -49909488, -44615140, -38435440, -31634326, -24477204, -17222048, + -10111227, -3364318, 2827930, 8308287, 12956318, 16690166, 19466890, 21281350, + 22163806, 22176328, 21408246, 19970784, 17991204, 15606606, 12957738, 10182934, + 7412561, 4764010, 2337587, 213264, -1551419, -2922471, -3889289, -4463602, + -4677182, -4578945, -4230953, -3704343, -3074240, -2415525, -1797252, -1280920, + -898770, -627791, -434755, -305164, -227603, -191690, -187557, -206218, + -239500, -280340, -322733, -361874, -394053, -416670, -428076, -427515, + -414945, -390943, -356535, -313106, -262250, -205705, -145243, -82626, + -19530, 42469, 101945, 157622, 208399, 253344, 291709, 322917, + 346571, 362440, 370466, 370745, 363530, 349215, 328325, 301500, + 269486, 233106, 193250, 150849, 106856, 62226, 17894, -25242, + -66343, -104637, -139433, -170137, -196253, -217395, -233281, -243746, + -248732, -248291, -242579, -231853, -216463, -196846, -173514, -147048, + -118082, -87293, -55383, -23069, 8934, 39937, 69279, 96351, + 120609, 141582, 158888, 172233, 181426, 186370, 187072, 183631, + 176235, 165155, 150734, 133374, 113527, 91685, 68363, 44092, + 19408, -5162, -29106, -51936, -73196, -92471, -109389, -123633, + -134942, -143118, -148026, -149603, -147856, -142863, -134772, -123799, + -110225, -94386, -76670, -57503, -37343, -16663, 4054, 24338, + 43732, 61811, 78191, 92535, 62535, 80267, 96515, 110869, + 122950, 132423, 139005, 142473, 142671, 139519, 133011, 123223, + 110309, 94503, 76111, 55508, 33131, 9465, -14962, -39597, + -63868, -87203, -109039, -128839, -146103, -160377, -171269, -178455, + -181688, -180805, -175730, -166482, -153172, -136001, -115264, -91340, + -64689, -35842, -5393, 26011, 57690, 88934, 119026, 147254, + 172929, 195397, 214061, 228390, 237937, 242348, 241373, 234879, + 222848, 205389, 182733, 155232, 123355, 87684, 48894, 7752, + -34905, -78188, -121168, -162899, -202440, -238873, -271320, -298971, + -321092, -337048, -346317, -348499, -343329, -330684, -310588, -283215, + -248890, -208087, -161430, -109684, -53754, 5325, 66401, 128208, + 189391, 248521, 304122, 354711, 398828, 435097, 462282, 479357, + 485586, 480607, 464520, 437982, 402277, 359398, 312090, 263877, + 219044, 182590, 160108, 157649, 181489, 237891, 332809, 471594, + 658900, 898625, 1197641, 1570523, 1996663, 2404745, 2717774, 2865679, + 2785718, 2427096, 1754169, 749686, -583221, -2219740, -4113328, -6196593, + -8383364, -10571665, -12647668, -14490343, -15976733, -16987568, -17413068, -17158614, + -16150145, -14338955, -11705745, -8263683, -4060347, 821616, 6265157, 12120884, + 18210488, 24331478, 30263100, 35773284, 40626432, 44591748, 47451940, 49011856, + 49106908, 47610828, 44442580, 39572032, 33024242, 24882062, 15286939, 4437778, + -7412170, -19960400, -32862134, -45739056, -58189596, -69800496, -80159352, -88867704, + -95554448, -99888904, -101593376, -100454560, -96333512, -89173816, -79007528, -65958664, + -50244076, -32171454, -12134525, 9394608, 31875820, 54713840, 77273336, 98895824, + 118918056, 136691248, 151600704, 163085296, 170656112, 173913744, 172563664, 166429120, + 155461200, 139745456, 119505000, 95099632, 67021116, 35884416, 2415097, -32566908, + -68166792, -103437232, -137402992, -169087216, -197538720, -221859376, -241231120, -254941424, + -262406848, -263193680, -257034992, -243843760, -223721280, -196960640, -164045024, -125640616, + -82584344, -35866404, 13391901, 63964612, 114551216, 163809728, 210391808, 252979168, + 290320064, 321265088, 344801344, 360083392, 366461088, 363502304, 351010944, 329038400, + 297889248, 258119712, 210529696, 156147840, 96210000, 32131786, -34524592, -102088152, + -168820816, -232961936, -292774464, -346591552, -392862560, -430196672, -457403712, -473530208, + -477890048, -470088800, -450040832, -417978368, -374452640, -320326336, -256757808, -185176992, + -107253736, -24859086, 59979564, 145128320, 228400464, 307612608, 380641824, 445482432, + 500300512, 543485312, 573695616, 589899584, 591407872, 577897856, 549428800, 506447456, + 449783328, 380634208, 300541536, 211356352, 115196864, 14397969, -88545520, -191040832, + -290462720, -384220896, -469827680, -544963968, -607541824, -655762304, -688166080, -703676928, + -701634816, -681819648, -644463424, -590250752, -520308160, -436181376, -339801440, -233440544, + -119658328, -1240033, 118872048, 237652048, 352067200, 459155616, 556103232, 640318080, + 709499520, 761700928, 795384128, 809463808, 803340864, 776923520, 730635776, 665412608, + 582681792, 484333184, 372675584, 250382144, 120426184, -13991622, -149522608, -282754144, + -410296096, -528867712, -635382464, -727028736, -801344512, -856283200, -890270272, -902247552, + -891705280, -858699904, -803857856, -728364736, -633940096, -522797984, -397595008, -261366368, + -117451720, 30587386, 179056320, 324220320, 462399104, 590061056, 703913984, 800990592, + 878726208, 935027008, 968326336, 977628096, 962536000, 923267520, 860652416, 776115520, + 671644160, 549741504, 413365632, 265857680, 110858864, -47779968, -206094880, -360108800, + -505932192, -639862208, -758477376, -858725824, -938004160, -994225728, -1025875712, -1032052032, + -1012490816, -967575808, -898331200, -806398464, -693996736, -563869056, -419215008, -263610912, + -100920864, 64800176, 229408368, 388775616, 538893952, 675977408, 796558208, 897575488, + 976453568, 1031168128, 1060298880, 1063066560, 1039353856, 989709440, 915335680, 818058560, + 700282816, 564931648, 415373344, 255336384, 88815592, -80029120, -246977680, -407857120, + -558646720, -695580608, -815240832, -914661376, -991426624, -1043686208, -1070172608, -1070248192, + -1043923520, -991857408, -915341120, -816266432, -697079168, -560719104, -410547744, -250265472, + -83820864, 84686600, 251107216, 411343136, 561449088, 697729408, 816829056, 915815936, + 992253184, 1044259072, 1070553344, 1070488704, 1044066752, 991938048, 915385920, 816295104, + 697105216, 560750656, 410588608, 250316144, 83879304, -84624008, -251044992, -411286048, + -561401792, -697695936, -816812672, -915819008, -992277056, -1044304128, -1070619200, -1070574144, + -1044169920, -992056576, -915517184, -816436096, -697252864, -560901952, -410740480, -250465744, + -84023984, 84486696, 250917232, 411169760, 561298496, 697607040, 816739008, 915761280, + 992235520, 1044278912, 1070609856, 1070580032, 1044190208, 992090048, 915562432, 816491584, + 697316864, 560972608, 410815936, 250544048, 84103240, -84408312, -250841440, -411098144, + -561232512, -697547840, -816687680, -915718464, -992201920, -1044254720, -1070595200, -1070574848, + -1044194112, -992102592, -915582912, -816519232, -697350784, -561011712, -410859200, -250590352, + -84151408, 84359424, 250792960, 411051168, 561188032, 697506752, 816650880, 915686656, + 992175616, 1044234432, 1070581248, 1070567360, 1044193024, 992107776, 915594112, 816535872, + 697372352, 561037568, 410888512, 250622304, 84185136, -84324824, -250758368, -411017408, + -561155904, -697477056, -816624192, -915663552, -992156544, -1044219712, -1070571008, -1070561728, + -1044192000, -992111168, -915601728, -816547392, -697387392, -561055616, -410909120, -250644896, + -84209144, 84299992, 250733312, 410992736, 561132224, 697454848, 816603968, 915645824, + 992141696, 1044208000, 1070562816, 1070557056, 1044191040, 992113920, 915607936, 816556928, + 697399936, 561070784, 410926464, 250663904, 84229272, -84279312, -250712656, -410972640, + -561113216, -697437440, -816588608, -915632832, -992131328, -1044200448, -1070558208, -1070555520, + -1044192384, -992118080, -915614784, -816566208, -697411328, -561084032, -410941184, -250679696, + -84245752, 84262552, 250696016, 410956544, 561098048, 697423552, 816576320, 915622464, + 992123200, 1044194816, 1070555200 +}; + +/************************ Q30 *******************************/ +const Word32 ivas_fb_fr_12band_1ms_im_fx[IVAS_FB_12_1MS_LEN] = { + -96495528, -286734272, -468692800, -637041216, -786562176, -912433280, -1009964416, -1075182976, -1098333440, + -1060972224, -954328512, -784950848, -567387776, -321857280, -71378072, 161019520, 355191072, + 496249664, 576290688, 595228096, 560553408, 486341472, 391112608, 296445024, 219833024, + 161425424, 113971872, 75074912, 43676944, 18947558, 106207, -13606639, -22959300, + -28697174, -31541624, -32158708, -31154358, -29054292, -26304144, -23261552, -20202826, + -17324756, -14756116, -12565362, -10774012, -9366401, -8302065, -7524551, -6970827, + -6577419, -6286071, -6046737, -5819771, -5576294, -5297871, -4975268, -4606808, + -4196583, -3752523, -3284873, -2804624, -2322651, -1848752, -1391471, -957667, + -552820, -180887, 155183, 453533, 712892, 932744, 1112922, 1253892, + 1356428, 1421957, 1452251, 1449752, 1417222, 1357998, 1275581, 1173833, + 1056523, 927513, 790325, 648358, 504521, 361522, 221574, 86743, + -41290, -160871, -270597, -368994, -454781, -526614, -583403, -624117, + -648145, -655120, -645267, -619210, -578251, -524110, -459110, -385841, + -307254, -226274, -145851, -68575, 3253, 67950, 124299, 171779, + 210318, 240423, 262847, 278659, 288884, 294565, 296445, 295082, + 290614, 282963, 271701, 256332, 236226, 210937, 180155, 143993, + 102888, 57812, 10083, -38529, -86081, -130429, -169562, -201608, + -225146, -239179, -243376, -237949, -223786, -202225, -175080, -144342, + -112142, -80430, -50955, -24990, -3380, 13628, 26240, 35170, + 41402, 46169, 50665, 56013, 62999, 72081, 83214, 95949, + 109364, 122266, 133211, 140767, 143575, 140609, 131207, 115267, + 93186, 65957, 34996, 2134, -30636, -61239, -87791, -108676, + -122781, -129495, 12356724, 36406252, 58390684, 76977432, 90719600, 98265728, + 98008264, 88608552, 62420976, 2547174, -98862584, -234978608, -391650304, -549723776, + -687929024, -785620992, -825677888, -796781568, -695135040, -525144384, -299188480, -36327380, + 239749920, 503413376, 729982272, 898556864, 994367488, 1010422464, 948197568, 817333696, + 634343104, 420516896, 199273200, -6719048, -178276784, -302004160, -371805248, -389615456, + -365008416, -315253344, -262675984, -217917568, -178521248, -143001072, -111343304, -83569488, + -59728692, -39750832, -23483756, -10668693, -980101, 5968707, 10589352, 13306198, + 14527738, 14637296, 13974127, 12830675, 11443325, 9996437, 8620832, 7402724, + 6386965, 5588127, 4995412, 4583292, 4315642, 4154179, 4060473, 4001515, + 3949354, 3884093, 3791711, 3665350, 3502261, 3304372, 3075215, 2820550, + 2545809, 2257129, 1959450, 1657946, 1356600, 1059795, 771079, 494646, + 234059, -6519, -223731, -414017, -575061, -704879, -803133, -870150, + -907983, -919252, -907936, -878057, -834296, -780659, -721070, -658192, + -594157, -529649, -464852, -398810, -330536, -258557, -182049, -100384, + -14134, 75538, 166137, 254665, 337160, 409716, 468199, 509317, + 530349, 530086, 508400, 466928, 408381, 336929, 257279, 174830, + 94651, 21581, -40724, -89563, -123905, -143909, -151339, -148811, + -139947, -128462, -118197, -112219, -112926, -121327, -137375, -159531, + -185372, -211440, -234054, -249316, -253979, -245431, -222426, -184880, + -134334, -73467, -6263, 62723, 128418, 186074, 231361, 261147, + 273444, 267948, 261810, 763373, 1198560, 1499796, 1578270, 1304628, + 517808, -987783, -3443484, -7111908, -12256820, -19143168, -27996048, -39000040, + -52248820, -67752040, -85376464, -104873664, -125808744, -147634944, -169591248, -190910720, + -210637232, -228834976, -242239792, -233744176, -184602112, -88256112, 52564248, 227312048, + 419154080, 607121280, 768828480, 883312000, 933778624, 909811200, 808862336, 636755584, + 407214048, 140391440, -139342896, -406167488, -635714880, -807834944, -908809408, -932820096, + -882419648, -768029696, -606446400, -418634368, -226977824, -52442412, 88143752, 184240560, + 233125792, 241364816, 227710480, 209276640, 189331712, 167814560, 145682224, 123701848, + 102633120, 83021960, 65302000, 49722020, 36415812, 25376218, 16511686, 9640718, + 4539034, 941445, -1420767, -2818065, -3495818, -3676385, -3542409, -3243683, + -2888735, -2555377, -2287831, -2108851, -2019462, -2010501, -2062586, -2155553, + -2267238, -2380241, -2479146, -2554886, -2600826, -2615545, -2598567, -2552488, + -2479078, -2381454, -2260948, -2119607, -1957826, -1777065, -1577959, -1362941, + -1134431, -897064, -655697, -417094, -187702, 25095, 215280, 377113, + 507239, 603471, 666470, 698219, 703186, 686502, 654728, 613906, + 570192, 528056, 491058, 460427, 436171, 416130, 397422, 375887, + 347709, 309014, 257411, 191469, 111939, 20899, -77459, -178052, + -274516, -360654, -430246, -478480, -501684, -498487, -469248, -416789, + -345433, -261310, -171090, -82033, -635, 67321, 117943, 148920, + 160318, 153895, 133448, 103776, 70703, 39859, 16616, 4954, + 7564, 25024, 56260, 98143, 146331, 195238, 239125, 272241, + 289930, 288679, 266989, 225117, 165550, 92349, 11219, -71466, + -148857, -214705, -263567, -291740, -297224, -280306, -243136, -189895, + -125985, -57873, 7933, 65157, 108741, 134971, 142193, 130597, + 102524, 61859, 13944, -35316, -79751, -113898, -133249, -135053, + -118286, -84087, -35339, 23302, 86186, 146930, 199365, 237874, + 258253, 257864, 236196, 194657, 136724, 67341, -7287, -80567, + -145896, -270343, -808574, -1340072, -1858807, -2358665, -2831742, -3270963, + -3669340, -4023521, -4333619, -4606985, -4857566, -5108708, -5390687, -5741295, + -6200425, -6807718, -7593886, -8575752, -9745172, -11063108, -12448231, -13772797, + -14853837, -15454158, -15279006, -13985197, -11185029, -6465256, 602227, 10431847, + 23410894, 39863840, 60045788, 84103768, 112100696, 143979968, 179711728, 219302416, + 264231232, 316950432, 366815488, 391499840, 373734272, 303947296, 180205328, 8607086, + -197450336, -418782432, -632721152, -815848960, -946877184, -1009294400, -993460928, -897898880, + -729596672, -503316064, -239947616, 35840880, 298430624, 524143840, 693923584, 795387200, + 824107840, 783846592, 685860544, 547189184, 388365568, 230527600, 92671240, -11219515, + -74492144, -105158200, -120261872, -127544112, -128388320, -124354624, -116661448, -106489408, + -94793200, -82429304, -70062176, -58237700, -47334588, -37619828, -29226616, -22202334, + -16501587, -12028281, -8635400, -6159899, -4423260, -3257870, -2504859, -2031762, + -1726474, -1507393, -1314142, -1112384, -883004, -624119, -340602, -45467, + 248842, 528315, 783713, 1007231, 1196662, 1351165, 1473983, 1568019, + 1637995, 1686519, 1716364, 1727429, 1719421, 1689696, 1636232, 1556028, + 1448006, 1311510, 1148760, 963094, 760758, 548770, 336091, 131254, + -56814, -221101, -355658, -457521, -525555, -561787, -569830, -555666, + -525766, -487535, -447411, -411297, -382938, -364634, -356100, -355594, + -359287, -362732, -360583, -348172, -321291, -277591, -216139, -138411, + -47457, 51579, 152676, 248783, 333218, 399646, 443388, 461240, + 452449, 418164, 361960, 288882, 205559, 118975, 36377, -35977, + -92851, -131037, -149092, -147929, -130154, -100234, -63486, -25973, + 6639, 29226, 38204, 31469, 9051, -27322, -73989, -126155, + -177996, -223678, -257577, -275273, -273644, -251592, -209808, -151108, + -79807, -1677, 76962, 149510, 210060, 253638, 277008, 278653, + 259231, -101021, -297456, -477733, -632297, -753728, -836696, -878615, + -879031, -839751, -763739, -654959, -517096, -353514, -166209, 43748, + 276781, 533724, 815969, 1123958, 1457300, 1813342, 2187857, 2574262, + 2965417, 3353797, 3734536, 4106324, 4475222, 4855377, 5272512, 5763051, + 6375849, 7168185, 8204533, 9548340, 11257436, 13371571, 15905385, 18833006, + 22081010, 25512624, 28924300, 32032662, 34478724, 35820256, 35546928, 33078728, + 27793346, 19027280, 6112874, -11628489, -34851840, -64232176, -100493888, -144608256, + -198909072, -270631488, -359662496, -448624032, -516131776, -543967680, -518454176, -432622496, + -287176640, -90768024, 140893552, 386715040, 622670976, 824595136, 971067648, 1045974272, + 1040467264, 954060352, 794731136, 578022784, 325234560, 60958056, -189791088, -404423968, + -565354624, -661869440, -691213888, -658569600, -576189312, -461441856, -334519392, -215323504, + -121182328, -57886044, -14972652, 16811060, 39759696, 55435020, 65035460, 69706136, + 70441104, 68189248, 63775032, 57948004, 51329736, 44447116, 37701544, 31399154, + 25736924, 20832988, 16723796, 13393488, 10776430, 8783249, 7304115, 6229334, + 5450365, 4874027, 4420041, 4029271, 3658127, 3282309, 2889391, 2480032, + 2060348, 1642421, 1237795, 858544, 512575, 205752, -60998, -288674, + -481834, -645256, -785054, -905653, -1011013, -1102347, -1179780, -1240896, + -1282805, -1301283, -1292960, -1254661, -1185341, -1085250, -957344, -806069, + -638185, -461195, -283738, -113885, 40607, 173836, 281340, 361227, + 413418, 440281, 445517, 434398, 412451, 385525, 358529, 335589, + 319068, 309999, 307515, 309612, 312947, 313829, 308220, 292759, + 264732, 222913, 167314, 99696, 23013, -58414, -139717, -215530, + -280898, -331372, -363803, -376281, -368659, -342216, -299851, -245477, + -183947, -120287, -59527, -210294, -218804, -207034, -170663, -107684, + -17542, 97483, 233628, 384636, 543572, 702055, 852320, 986414, + 1098210, 1182279, 1235630, 1256080, 1243695, 1198697, 1122785, 1016812, + 882318, 719277, 528144, 307851, 58485, -220576, -527549, -860384, + -1213683, -1581737, -1955989, -2329539, -2695405, -3052665, -3405215, -3769076, + -4170617, -4653891, -5276647, -6116192, -7261256, -8815022, -10881268, -13564073, + -16947616, -21093540, -26015144, -31675226, -37956612, -44665032, -51498380, -58060316, + -63829408, -68189520, -70395848, -69627624, -64938208, -55334156, -39669268, -16742548, + 15011598, 57892376, 121157856, 215274688, 334456672, 461378272, 576139200, 658546880, + 691230336, 661933376, 565469888, 404588960, 189999104, -60718748, -324979552, -577770304, + -794500352, -953869504, -1040332032, -1045906432, -971073600, -824675520, -622820672, -386923360, + -141145440, 90490632, 286893152, 432351840, 518213184, 543769536, 515984864, 448531552, + 359622208, 270636384, 198948336, 144668672, 100561448, 64293740, 34896780, 11649924, + -6117171, -19054578, -27836140, -33125540, -35583508, -35831208, -34449244, -31950346, + -28780702, -25304532, -21811144, -18510242, -15544263, -12991323, -10880449, -9198353, + -7904592, -6938712, -6232849, -5716818, -5326765, -5007114, -4715109, -4419761, + -4103101, -3757115, -3383050, -2987624, -2581751, -2177166, -1785567, -1416314, + -1076470, -769692, -497117, -257162, -46868, 137886, 301064, 446309, + 576003, 691438, 792390, 877665, 945087, 992265, 1016767, 1016861, + 991628, 941464, 867976, 774150, 663993, 542420, 414732, 286370, + 162380, 47204, -55707, -143950, -216326, -272693, -313915, -341561, + -357718, -364650, -364603, -359521, -350944, -339867, -326770, -311628, + -294057, -273429, -249069, -220397, -187092, -149183, -107127, -61803, + -14483, 33260, 79674, 122959, 161417, 193583, -137153, -86096, + -23462, 46165, 118296, 188311, 252569, 308033, 353183, 387345, + 411326, 426448, 434961, 438884, 440375, 440558, 440044, 437930, + 432614, 421046, 399869, 364878, 312384, 238720, 141646, 19702, + -126527, -295376, -483051, -684957, -894831, -1106337, -1312215, -1505978, + -1680884, -1831578, -1952736, -2040617, -2091372, -2102604, -2071473, -1996480, + -1875541, -1708206, -1493799, -1234127, -931547, -591976, -222473, 165877, + 561490, 950008, 1319512, 1659151, 1966270, 2245658, 2518227, 2819813, + 3210306, 3770160, 4608328, 5854141, 7662371, 10198175, 13638330, 18147660, + 23877010, 30930782, 39364468, 49144104, 60148836, 72123392, 84694024, 97312800, + 109298904, 119765360, 127705376, 131866912, 130934488, 123231464, 107234464, 75050672, + 9470806, -97677456, -239897616, -403333024, -569087680, -716066368, -823729024, -874943616, + -858298112, -769767616, -613463168, -401328448, -152012800, 111316600, 362752096, 579800640, + 754066560, 884317376, 967646720, 1002358976, 988932224, 930137792, 830908864, 698079680, + 539965760, 365883200, 185588480, 8720114, -155758112, -300047104, -417930816, -505075680, + -559213504, -580180096, -569826624, -531795520, -471193568, -394169856, -307444800, -217803664, + -131610264, -54348980, 9748328, 57999172, 89445504, 104945984, 107368432, 102279568, + 94596192, 85655480, 75877136, 65846368, 56016016, 46757852, 38321108, 30867838, + 24467266, 19124186, 14784349, 11357873, 8727069, 6764325, 5338255, 4325655, + 3614320, 3109507, 2733412, 2427369, 2148937, 1871452, 1580043, 1270071, + 943252, 606145, 267130, -64446, -380185, -672695, -936550, -1167777, + -1364195, -1524669, -1649207, -1738275, -1792904, -1814221, -1803670, -1762759, + -1693364, -1597596, -1478091, -1337881, -1180581, -1010189, -831132, -647987, + -465420, -287874, -119474, 36238, 176365, 298810, 402244, 486148, + 550683, 596630, 625208, 637968, 636614, 622900, 598511, 565006, + 523771, 476024, 422831, 365155, 303902, 239978, 174336, 108003, + 42099, -22177, -83566, -140800, -192647, -237981, -275829, -305435, + -326287, -338158, -341095, -335431, -321739, -300823, -273643, -241298, + -204944, -165780, -124974, -83660, -42880, 10137, 29849, 47985, + 63702, 76520, 86314, 93425, 98550, 102746, 107236, 113334, + 122202, 134769, 151505, 172398, 196816, 223585, 250966, 276853, + 298844, 314511, 321522, 317919, 302199, 273538, 231774, 177523, + 112040, 37218, -44643, -130911, -218896, -305922, -389579, -467717, + -538627, -600924, -653636, -695990, -727439, -747408, -755314, -750348, + -731559, -697715, -647504, -579487, -492405, -385195, -257342, -108895, + 59211, 245234, 446381, 659034, 878627, 1100007, 1317397, 1524851, + 1716231, 1885675, 2027510, 2136678, 2208531, 2239209, 2225330, 2164370, + 2054318, 1894140, 1683476, 1423258, 1115462, 763860, 373717, -47467, + -490570, -944379, -1396841, -1835173, -2248037, -2626382, -2966637, -3272111, + -3556917, -3847305, -4185583, -4630274, -5258922, -6165632, -7461554, -9268313, + -11715324, -14927984, -19021866, -24085232, -30171698, -37277344, -45335748, -54189964, + -63598244, -73198584, -82549584, -91078392, -98377112, -103118416, -100391208, -84628624, + -52954552, -4492618, 59827860, 137363792, 223933312, 314109568, 401591168, 479653696, + 541630720, 581410176, 593897728, 575427264, 524078976, 439891712, 324946016, 183315184, + 20883088, -154960944, -335730752, -512333504, -675605952, -816870016, -928462720, -1004220224, + -1039868736, -1033319296, -984830528, -897064000, -775182272, -627308096, -461708352, -284291552, + -100579392, 83598736, 262525088, 430732416, 583209600, 715532736, 824009920, 905775040, + 958871552, 982291840, 975995776, 940888192, 878773504, 792274432, 684731072, 560072576, + 422675872, 277208288, 128466608, -18787604, -159985744, -290901824, -407785088, -507474624, + -587489088, -646091776, -682326144, -696024192, -687785152, -658928000, -611418688, -547776704, + -470963680, -384259392, -291130144, -195094672, -99592464, -7860071, 77180528, 153017120, + 217622960, 269510560, 307761952, 332035072, 342546656, 340033376, 325693088, 301109632, + 268164672, 228941216, 185622192, 140390128, 95330560, 52345244, 13076479, -21151680, + -49376268, -71017224, -85881800, -94147080, -96327536, -93222768, -85856648, -75400496, + -63097824, -50176000, -37774988, -26857674, -18169908, -11863887, -7301392, -3914018, + -1479242, 185291, 1236420, 1817970, 2053955, 2052907, 1903852, 1679448, + 1434536, 1209401, 1029974, 911183, 857962, 868350, 934655, 1046022, + 1189342, 1351150, 1518125, 1678330, 1821294, 1938725, 2024278, 2073883, + 2085335, 2058391, 1994281, 1895693, 1766278, 1610593, 1433645, 1240831, + 1037545, 829139, 620601, 416556, 221024, 37473, -131344, -283279, + -416878, -531220, -625958, -701127, -757159, -794697, -814605, -817824, + -805400, -778384, -737905, -685103, -621229, -547610, -465741, -377252, + -283979, -187900, -91166, 4001, 95326, 180608, 257764, 324972, + 380709, 423871, 453787, 470280, 473637, 464613, 444338, 414280, + 376112, 331644, 282692, 231012, 178188, 125609, 74399, 25440, + -20646, -63433, -102670, -138199, -169921, -197722, -221454, -240892, + -255747, -265667, -270281, -269233, -262252, -249189, -230092, -205221, + -175099, -140492, -102411, -62059, -20785, 19997, 58880, 94556, + 125879, 151942, 172113, 186075, 193810, 195596, 191955, 183604, + 171377, 156168, 138843, 120200, 100900, 81458, 62216, 43368, + 24971, 6998, -10624, -27957, -45013, -61705, -77836, -93079, + -106999, -119067, -128714, -135370, -138532, -137806, -132971, -123999, + -111091, -94667, -75361, -53969, 10765, 32074, 52722, 72311, + 90486, 106963, 121523, 134027, 144392, 152600, 158658, 162605, + 164468, 164267, 161985, 157577, 150955, 142011, 130615, 116649, + 100019, 80692, 58704, 34200, 7431, -21221, -51265, -82083, + -112977, -143167, -171845, -198187, -221409, -240776, -255657, -265518, + -269970, -268744, -261725, -248915, -230452, -206572, -177616, -143996, + -106204, -64784, -20348, 26444, 74865, 124130, 173377, 221686, + 268054, 311432, 350709, 384766, 412472, 432751, 444591, 447117, + 439606, 421553, 392681, 352994, 302769, 242592, 173323, 96118, + 12366, -76299, -168083, -261025, -353085, -442152, -526117, -602884, + -670441, -726859, -770364, -799329, -812348, -808221, -786031, -745129, + -685209, -606288, -508783, -393474, -261578, -114689, 45155, 215561, + 393723, 576534, 760547, 942104, 1117306, 1282158, 1432549, 1564416, + 1673729, 1756688, 1809722, 1829726, 1814087, 1760970, 1669365, 1539414, + 1372449, 1171316, 940345, 685584, 414591, 136477, -138614, -399774, + -636264, -838162, -997771, -1110606, -1177191, -1204204, -1206433, -1207707, + -1242622, -1356751, -1607660, -2063815, -2804506, -3917005, -5495374, -7636020, + -10436517, -13992514, -18402674, -23818388, -30616280, -38795064, -47468192, -55465196, + -61624760, -64816688, -64030596, -58439904, -47471160, -30852034, -8650500, 18708296, + 50440096, 85421744, 122227560, 159185040, 194443776, 226058080, 252076752, 270638720, + 280067616, 278963616, 266285680, 241422224, 204245248, 155146128, 95049592, 25405990, + -51839956, -134302160, -219227456, -303587872, -384188544, -457786240, -521215424, -571515392, + -606054656, -622647040, -619654592, -596072512, -551593600, -486646944, -402411264, -300798944, + -184413264, -56477480, 79260352, 218645328, 357251200, 490529920, 613968768, 723250432, + 814409344, 883978944, 929123648, 947751552, 938601472, 901303104, 836405248, 745373248, + 630551936, 495099232, 342887840, 178382704, 6494100, -167583760, -338549120, -501169472, + -650463872, -781868416, -891402304, -975790912, -1032769600, -1061261696, -1060915456, -1031960960, + -975385600, -892916224, -786977856, -660620736, -517435968, -361449888, -197010624, -28662768, + 138980608, 301369056, 454141632, 593248768, 715063168, 816478784, 894992576, 948769664, + 976686784, 978356608, 954128576, 905069824, 832924288, 740053568, 629360000, 504194944, + 368255424, 225472400, 79893288, -64436384, -203589744, -333869568, -451910592, -554770112, + -640004160, -705727744, -750656768, -774131456, -776120512, -757206720, -718553856, -661857536, + -589281088, -503378688, -407008864, -303241088, -195258304, -86258672, 20640266, 122492392, + 216605760, 300615264, 372542752, 430843584, 474437952, 502727104, 515593600, 513386816, + 496894016, 467298720, 426127872, 375190336, 316508064, 252243568, 184625248, 115873648, + 48130852, -16604751, -76536328, -130117360, -176090096, -213512624, -241774240, -260598816, + -270036736, -270445792, -262462656, -246965456, -225030192, -197881696, -166842016, -133277536, + -98547200, -63953468, -30697916, 157309, 27720696, 51294532, 70389352, 84729480, + 94249824, 99084304, 99546808, 96105616, 89352656, 79969008, 68688296, 56259452, + 43410724, 30816176, 19066356, 8644033, -93590, -6926218, -11773978, -14694671, + -15872813, -15605618, -14280676, -12378042, -10430668, -8704424, -7182491, -5854782, + -4729147, -3804335, -3072066, -2516383, -2116394, -1847634, -1684290, -1600530, + -1572012, -1576721, -1595767, -1613665, -1618550, -1602016, -1558925, -1486975, + -1386301, -1258946, -1108416, -939180, -756297, -565028, -370575, -177839, + 8715, 185182, 348246, 495214, 623986, 733038, 821363, 888436, + 934161, 958831, 963086, 947887, 914478, 864367, 799293, 721209, + 632236, 534643, 430794, 323115, 214029, 105923, 1076, -98376, + -190504, -273617, -346304, -407458, -456294, -492355, -515505, -525917, + -524051, -510616, -486547, -452951, -411079, -362277, -307954, -249541, + -188465, -126117, -63839, -2894, 55536, 110376, 160649, 205502, + 244200, 276144, 300872, 318070, 327574, 329385, 323660, 310724, + 291059, 265298, 234214, 198698, 159739, 118393, 75754, 32922, + -9033, -49104, -86375, -120044, -149449, -174076, -193569, -207727, + -216503, -219983, -218381, -212007, -201261, -186599, -168524, -147564, + -124261, -99161, -72807, -45733, -18468, 8473, 34584, 59372, + 82359, 103090, 121141, 136131, 147730, 155680, 159803, 160015, + 156337, 148897, 137934, 123794, 106916, 87821, 67091, 45345, + 23216, 1326, -19743, -39465, 109887, 120382, 128416, 133765, + 136261, 135794, 132320, 125859, 116497, 104388, 89749, 72858, + 54047, 33695, 12222, -9922, -32266, -54329, -75626, -95683, + -114044, -130284, -144009, -154878, -162593, -166923, -167696, -164811, + -158239, -148026, -134294, -117244, -97153, -74370, -49314, -22469, + 5628, 34390, 63198, 91407, 118365, 143426, 165965, 185395, + 201183, 212860, 220042, 222435, 219848, 212195, 199508, 181929, + 159715, 133233, 102952, 69434, 33331, -4639, -43696, -83016, + -121744, -159013, -193957, -225733, -253530, -276597, -294249, -305894, + -311042, -309326, -300512, -284516, -261407, -231423, -194963, -152600, + -105060, -53228, 1881, 59128, 117284, 175043, 231069, 284005, + 332527, 375354, 411300, 439283, 458370, 467783, 466935, 455431, + 433101, 399985, 356360, 302726, 239820, 168592, 90219, 6068, + -82296, -173156, -264641, -354785, -441533, -522811, -596538, -660703, + -713385, -752830, -777471, -786003, -777391, -750944, -706300, -643488, + -562898, -465330, -351937, -224267, -84196, 66044, 223948, 386697, + 551263, 714370, 872609, 1022412, 1160192, 1282340, 1385409, 1466141, + 1521718, 1549819, 1548936, 1518450, 1458982, 1372447, 1262386, 1133907, + 993924, 850871, 714752, 596518, 507835, 460031, 463573, 526525, + 653821, 845263, 1094812, 1388217, 1702729, 2004387, 2248836, 2377871, + 2322716, 1997670, 1310909, 31361, -2276023, -5884963, -10790734, -16840258, + -23748608, -31120974, -38472224, -45255760, -50892408, -54804412, -56448304, -55348896, + -51129788, -43541476, -32483506, -18021422, -395893, 19975162, 42503072, 66442420, + 90913264, 114929960, 137436576, 157346768, 173587488, 185144144, 191106144, 190710336, + 183381248, 168765648, 146760624, 117533176, 81530704, 39481248, -7616625, -58514600, + -111745512, -165663824, -218494432, -268388400, -313484064, -351971232, -382156480, -402527424, + -411813344, -409040128, -393577504, -365176384, -323994752, -270611200, -206024384, -131639056, + -49237472, 39062252, 130860688, 223542656, 314352192, 400474784, 479124064, 547630784, + 603530816, 644649344, 669178624, 675746624, 663473536, 632014912, 581589056, 512987520, + 427568224, 327230528, 214373088, 91835128, -37177272, -169178032, -300498464, -427392512, + -546146752, -653191616, -745210944, -819245440, -872788352, -903868288, -911118272, -893827520, + -851974272, -786238976, -697996288, -589286400, -462766208, -321640832, -169578832, -10611593, + 150978672, 310780032, 464377088, 607478720, 736043264, 846397952, 935348160, 1000273472, + 1039207744, 1050900416, 1034856960, 991357632, 921452992, 826937088, 710298944, 574652800, + 423651328, 261382080, 92266240, -79072984, -248102448, -410503776, -562126720, -699092736, + -817911936, -915573376, -989624896, -1038234688, -1060238592, -1055167808, -1023259008, -965445760, + -883330880, -779142016, -655670144, -516193728, -364390176, -204236960, -39905496, 124349848, + 284304192, 435873248, 575219968, 698854144, 803721536, 887281600, 947570240, 983247040, + 993625152, 978684224, 939064256, 876042880, 791495168, 687838208, 567961280, 435144608, + 292968064, 145212944, -4240369, -151516576, -292848000, -424673056, -543728192, -647130176, + -732447680, -797759168, -841696640, -863474048, -862898880, -840368384, -796849536, -733844032, + -653339328, -557747648, -449833824, -332635680, -209377712, -83381528, 42024892, 163596368, + 278255872, 383173696, 475838368, 554117568, 616307264, 661168640, 687951104, 696401792, + 686761024, 659744256, 616512064, 558627584, 488004704, 406847392, 317582464, 222787984, + 125119136, 27233782, -68280144, -158973472, -242598960, -317167264, -380994112, -432737696, + -471425664, -496470656, -507674976, -505223904, -489668640, -461899200, -423108800, -374750624, + -318488480, -256143216, -189636144, -120931576, -51979948, 15336795, 79255984, 138179872, + 190714864, 235703648, 272249056, 299729728, 317807040, 326423456, 325792768, 316382656, + 298890368, 274212512, 243410272, 207670816, 168266608, 126513920, 83731472, 41200944, + 130175, -38379756, -73362784, -104010672, -129689920, -149952464, -164540112, -173382736, + -176590656, -174441552, -167362736, -155909328, -140739472, -122587248, -102234616, -80482928, + -58125464, -35921428, -14572560, 5297181, 23158150, 38587464, 51277008, 61037024, + 67795232, 71591800, 72570464, 70966328, 67090884, 61315048, 54050700, 45731812, + 36795552, 27664472, 18730052, 10338603, 2779584, -3722787, -9014984, -13015846, + -15715349, -17169656, -17493876, -16851572, -15443180, -13491852, -11229971, -8883501, + -6659666, -4731320, -3230436, -2179638, -1456508, -951706, -619736, -422906, + -328742, -307762, -334784, -388143, -450439, -507929, -550755, -572282, + -568989, -539768, -485654, -409163, -313997, -204481, -85334, 38748, + 163232, 284008, 397435, 500481, 590686, 666220, 725799, 768696, + 794640, 803805, 796717, 774237, 737483, 687817, 626774, 556060, + 477482, 392946, 304395, 213796, 123081, 34130, -51284, -131518, + -205101, -270753, -327424, -374293, -410797, -436619, -451696, -456198, + -450524, -435265, -411195, -379231, -340412, -295864, -246780, -194382, + -139908, -84576, -29579, 23948, 74940, 122415, 165488, 203392, + 235477, 261232, 280287, 292420, 297563, 295805, 287381, 272679, + 252217, 226642, 196699, 163225, 127113, 89298, 50723, 12319, + -25022, -60468, -93267, -122762, -148403, -169755, -186505, -198455, + -205529, -207755, -205269, -198296, -187147, -172200, -153899, -132733, + -109235, -83965, -57505, -30448, -3387, 23090, 48419, 72062, + 93519, 112344, 128152, 140629, 149540, 154739, 156171, 153875, + 147984, 138721, 126390, 111370, 94099, 75064, 54779, 33779, + 12593, -8262, -28303, -47084, 123494, 129971, 133493, 133924, + 131201, 125331, 116398, 104559, 90037, 73124, 54170, 33578, + 11793, -10702, -33406, -55797, -77356, -97567, -115939, -132009, + -145355, -155607, -162458, -165670, -165080, -160609, -152268, -140154, + -124457, -105454, -83508, -59060, -32622, -4767, 23884, 52680, + 80946, 108005, 133192, 155874, 175459, 191418, 203293, 210711, + 213394, 211167, 203964, 191828, 174916, 153495, 127939, 98723, + 66416, 31667, -4798, -42202, -79720, -116501, -151685, -184419, + -213882, -239294, -259946, -275209, -284560, -287590, -284024, -273728, + -256722, -233178, -203429, -167959, -127402, -82528, -34229, 16495, + 68562, 120826, 172104, 221199, 266929, 308151, 343787, 372847, + 394455, 407868, 412493, 407908, 393872, 370338, 337461, 295599, + 245318, 187388, 122773, 52620, -21757, -98901, -177232, -255084, + -330731, -402431, -468456, -527135, -576892, -616284, -644032, -659054, + -660495, -647746, -620468, -578601, -522379, -452338, -369318, -274467, + -169243, -55405, 64986, 189594, 315816, 440826, 561623, 675096, + 778120, 867669, 940959, 995619, 1029881, 1042792, 1034432, 1006137, + 960689, 902497, 837686, 774157, 721490, 690799, 694367, 745251, + 856581, 1040935, 1309312, 1670468, 2129651, 2688819, 3345656, 4105519, + 4976393, 5840188, 6459558, 6619945, 6147045, 4905821, 2810464, -169248, + -4002855, -8597662, -13799897, -19399282, -25136440, -30713178, -35805064, -40075928, + -43193604, -44846368, -44759276, -42709760, -38541820, -32178052, -23629058, -12999656, + -491521, 13597969, 28880844, 44887552, 61079704, 76866240, 91622528, 104711816, + 115508400, 123421568, 127919688, 128553392, 124977088, 116967832, 104440944, 87461480, + 66251100, 41189824, 12812431, -18200672, -51037968, -84776544, -118406512, -150859520, + -181040640, -207862576, -230281344, -247332144, -258164320, -262074240, -258534976, -247221616, + -228031216, -201096704, -166793872, -125740976, -78790864, -27015406, 28317512, 85773968, + 143790256, 200714592, 254853088, 304518720, 348082144, 384022272, 410975936, 427784064, + 433533952, 427595232, 409648832, 379707872, 338129120, 285614880, 223204848, 152257552, + 74422120, -8399482, -94098672, -180413920, -264990464, -345444480, -419429888, -484706304, + -539205312, -581094272, -608834752, -621234048, -617488768, -597217728, -560484416, -507806784, + -440154880, -358935456, -265963920, -163424032, -53816484, 60102860, 175393008, 289004832, + 397862624, 498948160, 589385088, 666520704, 728003904, 771855360, 796529472, 800965376, + 784625088, 747518528, 690213376, 613829888, 520020448, 410934048, 289166720, 157698512, + 19819390, -120954952, -260974400, -396551008, -524057792, -640027584, -741248576, -824854336, + -888405760, -929962176, -948139904, -942156672, -911859520, -857736896, -780912768, -683123584, + -566678912, -434405344, -289576544, -135830144, 22925716, 182614304, 339097376, 488284896, + 626244608, 749307648, 854168576, 937975616, 998409984, 1033750912, 1042925056, 1025539008, + 981893504, 912979136, 820453376, 706599552, 574268864, 426807104, 267967136, 101810936, + -67397744, -235305840, -397586848, -550055296, -688779008, -810183040, -911146880, -989084800, + -1042054592, -1068829184, -1068826112, -1042089792, -989328512, -911898304, -811770624, -691481728, + -554069376, -402995648, -242059584, -75301504, 93098968, 258928160, 418044256, 566481536, + 700549504, 816925696, 912738304, 985637504, 1033853888, 1056241408, 1052304960, 1022211200, + 966782848, 887476096, 786342208, 665974016, 529439200, 380201408, 222031488, 58911676, + -105065728, -265801808, -419294496, -561739072, -689623232, -799814720, -889638656, -956942720, + -1000149696, -1018294336, -1011044736, -978708096, -922219648, -843115968, -743493120, -625951040, + -493525056, -349607232, -197858608, -42115448, 113708584, 265721584, 410151424, 543440192, + 662332480, 763955904, 845890496, 906227200, 943612480, 957278400, 947058112, 913385664, + 857280704, 780318336, 684585088, 572622656, 447359776, 312035584, 170115056, 25199920, + -119063552, -259076960, -391380192, -512737632, -620217856, -711264960, -783759808, -836069184, + -867082944, -876236800, -863521472, -829477248, -775175296, -702184896, -612528832, -508627616, + -393234080, -269360256, -140198384, -9038325, 120816904, 246134720, 363834016, 471061440, + 565260864, 644234816, 706195520, 749805696, 774206528, 779033856, 764420928, 730989120, + 679825600, 612449984, 530770240, 437028800, 333741664, 223630656, 109551536, -5580210, + -118864264, -227488864, -328800992, -420371296, -500052800, -566030976, -616865088, -651519232, + -669382144, -670276608, -654456960, -622595968, -575760768, -515379648, -443199648, -361236896, + -271720576, -177032864, -79645232, 17945830, 113283088, 204010512, 287931712, 363063040, + 427680576, 480359328, 520004224, 545871936, 557583232, 555125952, 538848000, 509441632, + 467918976, 415579744, 353972064, 284847840, 210113616, 131778400, 51899980, -27469024, + -104333832, -176807568, -243157520, -301846336, -351567360, -391273184, -420196800, -437865024, + -444103968, -439036576, -423072480, -396890720, -361415584, -317786848, -267324960, -211492304, + -151851792, -90023688, -27642056, 33688092, 92431824, 147162464, 196595872, 239620272, + 275320544, 302996800, 322176864, 332622304, 334328064, 327516064, 312622880, 290282112, + 261301872, 226638432, 187366672, 144647984, 99697160, 53748436, 8022341, -36306296, + -78138080, -116475864, -150447968, -179327376, -202546304, -219706160, -230582416, -235124880, + -233452928, -225846496, -212732912, -194670144, -172327120, -146461568, -117896304, -87494416, + -56134348, -24685366, 6015840, 35186796, 62118600, 86192504, 106893400, 123819856, + 136690672, 145347696, 149755152, 149995552, 146262368, 138849824, 128140336, 114589888, + 98711832, 81059840, 62210316, 42744900, 23233612, 4218996, -13798199, -30371520, + -45119144, -57731856, -67978520, -75708944, -80854288, -83424880, -83505872, -81250776, + -76873240, -70637384, -62847076, -53834452, -43948188, -33541804, -22962404, -12540202, + -2579104, 6651381, 14922708, 22052188, 27906138, 32401252, 35504228, 37229756, + 37636996, 36824736, 34925464, 32098614, 28523208, 24390258, 19895138, 15230230, + 10578097, 6105390, 1957699, -1744518, -4908812, -7472372, -9402388, -10695210, + -11374340, -11487438, -11102430, -10302999, -9183557, -7844043, -6384651, -4900844, + -3478715, -2191066, -1094124, -225317, 398208, 779956, 943926, 936293, + 833844, 703157, 565034, 427621, 299915, 188242, 97070, 28671, + -16282, -38631, -40246, -23848, 7370, 49924, 100305, 155103, + 211184, 265743, 316398, 361188, 398601, 427542, 447320, 457596, + 458351, 449838, 432541, 407131, 374438, 335404, 291067, 242523, + 190911, 137380, 83081, 29131, -23391, -73477, -120193, -162709, + -200302, -232373, -258456, -278222, -291483, -298191, -298431, -292422, + -280496, -263099, -240767, -214119, -183837, -150654, -115335, -78667, + -41439, -4430, 31603, 65943, 97920, 126924, 152420, 173951, + 191152, 203753, 211586, 214590, 212809, 206390, 195581, 180724, + 162245, 140642, 116472, 90338, 62871, 34716, 6512, -21115, + -47577, -72327, -94874, -114790, -131717, -145374, -155554, -162130, + -165050, -164338, -160089, -152466, -141696, -128062, -111900, -93592, + -73557, -52247, -30134, -7706, 14546, 36139, 56604, 75501, + 92426, 107025, 118997, 128106, 134187, 137146, 136964, 133700, + 127480, 118502, 107020, 93345, 116040, 106373, 94004, 79158, + 62121, 43240, 22912, 1579, -20281, -42169, -63569, -83966, + -102856, -119760, -134234, -145882, -154369, -159426, -160859, -158557, + -152493, -142728, -129410, -112770, -93122, -70853, -46417, -20326, + 6860, 34548, 62118, 88942, 114393, 137861, 158767, 176575, + 190802, 201034, 206937, 208261, 204852, 196660, 183736, 166241, + 144442, 118709, 89511, 57407, 23039, -12886, -49603, -86311, + -122184, -156394, -188125, -216596, -241075, -260902, -275496, -284383, + -287194, -283688, -273753, -257415, -234835, -206316, -172290, -133320, + -90085, -43369, 5950, 56922, 108538, 159746, 209478, 256659, + 300236, 339190, 372562, 399462, 419103, 430808, 434043, 428427, + 413772, 390087, 357626, 316892, 268676, 214058, 154439, 91515, + 27295, -35962, -95765, -149503, -194502, -228208, -248287, -252875, + -240711, -211453, -165805, -105883, -35276, 40539, 114314, 176503, + 215759, 217978, 167946, 29216, -265669, -759935, -1454826, -2329191, + -3341857, -4434792, -5535889, -6563153, -7428902, -8044769, -8326572, -8199427, + -7602384, -6492797, -4849871, -2677498, -5997, 3107152, 6577829, 10296906, + 14133125, 17937022, 21545892, 24789544, 27496750, 29502072, 30652904, 30816402, + 29886096, 27787848, 24484978, 19982264, 14328683, 7618649, -8275, -8369346, + -17242212, -26370120, -35468600, -44233488, -52350068, -59503100, -65387360, -69718488, + -72243656, -72751784, -71082920, -67136432, -60877660, -52342804, -41641768, -28958772, + -14550630, 1257369, 18077938, 35470524, 52952152, 70010080, 86115976, 100741256, + 113373128, 123530864, 130781872, 134756976, 135164528, 131802696, 124569704, 113471440, + 98626208, 80266312, 58736392, 34488268, 8072537, -19873172, -48638900, -77459776, + -105535736, -132052984, -156206736, -177224544, -194389536, -207063008, -214705568, -216896176, + -213348592, -203924480, -188642880, -167685488, -141397504, -110283944, -75001352, -36344852, + 4768980, 47323316, 90225720, 132335712, 172494592, 209556688, 242421216, 270063936, + 291567712, 306150848, 313192864, 312256320, 303104480, 285713824, 260281152, 227224928, + 187180496, 140989248, 89681992, 34456540, -23349740, -82291968, -140853584, -197485040, + -250644464, -298839136, -340666720, -374855200, -400300192, -416098816, -421578912, -416322848, + -400184960, -373302304, -336098016, -289277056, -233814336, -170935472, -102090216, -28919474, + 46783608, 123117448, 198119696, 269817600, 336279616, 395667328, 446285568, 486630272, + 515431904, 531693952, 534724512, 524161024, 499986336, 462536352, 412498304, 350899776, + 279088736, 198704400, 111640296, 19999716, -73955136, -167859072, -259303504, -345898400, + -425334720, -495445856, -554266496, -600087168, -631503040, -647455744, -647266496, -630660352, + -597779904, -549188672, -485863232, -409174688, -320859648, -222981056, -117879984, -8119592, + 103577704, 214398032, 321507232, 422123680, 513590720, 593446784, 659491904, 709847616, + 743010112, 757894080, 753866240, 730767680, 688924608, 629145984, 552709376, 461334048, + 357142464, 242611072, 120511064, -6158985, -134247200, -260527344, -381780576, -494877952, + -596861632, -685022336, -756971776, -810707072, -844666432, -857773504, -849470528, -819737792, + -769099840, -698617600, -609866880, -504903104, -386213792, -256659104, -119402648, 22166518, + 164518080, 304069184, 437275360, 560721088, 671207872, 765837888, 842089984, 897887232, + 931653440, 942357376, 929543168, 893346752, 834496704, 754300416, 654615040, 537804480, + 406682912, 264446352, 114594352, -39157032, -192968032, -342971968, -485373120, -616543680, + -733116800, -832073664, -910822080, -967264896, -999856064, -1007642752, -990292800, -948106752, + -882013184, -793548800, -684822016, -558462848, -417558400, -265576992, -106281872, 56362708, + 218291040, 375438528, 523844608, 659753344, 779709440, 880646656, 959966976, 1015607872, + 1046096320, 1050588096, 1028890880, 981471296, 909444864, 814549696, 699104192, 565949568, + 418379808, 260058736, 94928648, -72889120, -239197984, -399832192, -550762240, -688196992, + -808680064, -909177600, -987155392, -1040643904, -1068288256, -1069383232, -1043891456, -992444800, + -916328960, -817451520, -698297344, -561877056, -411613792, -251225136, -84665176, 83959240, + 250492800, 410833184, 561032192, 697392512, 816558400, 915598016, 992075520, 1044110528, + 1070424512, 1070372096, 1043956672, 991830592, 915278784, 816187328, 696996800, 560642560, + 410482208, 250213232, 83781792, -84714288, -251126384, -411357152, -561461504, -697743552, + -816847808, -915841536, -992287296, -1044302592, -1070606528, -1070551232, -1044137856, -992016512, + -915470336, -816383744, -697196352, -560842560, -410679552, -250404528, -83963680, 84544936, + 250972336, 411220768, 561344576, 697647424, 816773248, 915788800, 992256192, 1044292480, + 1070616448, 1070579840, 1044183488, 992077376, 915544384, 816468800, 697290112, 560942720, + 410783712, 250510352, 84068912, -84442472, -250874656, -411129728, -561261824, -697574272, + -816710848, -915738048, -992217536, -1044266240, -1070602624, -1070578112, -1044193344, -992097920, + -915574656, -816507712, -697336256, -560994752, -410840192, -250569808, -84129840, 84381496, + 250815008, 411072672, 561208512, 697525760, 816667968, 915701504, 992187968, 1044243968, + 1070587840, 1070570944, 1044193664, 992105472, 915588992, 816528256, 697362432, 561025728, + 410875072, 250607648, 84169704, -84340632, -250774144, -411032768, -561170496, -697490560, + -816636288, -915674048, -992165248, -1044226432, -1070575744, -1070564352, -1044192576, -992109760, + -915598336, -816542272, -697380608, -561047424, -410899648, -250634432, -84197944, 84311648, + 250745136, 411004448, 561143488, 697465472, 816613632, 915654272, 992148736, 1044213504, + 1070566592, 1070559104, 1044191232, 992112320, 915604608, 816552064, 697393600, 561063296, + 410917984, 250654720, 84219640, -84289112, -250722352, -410981984, -561121984, -697445376, + -816595520, -915638656, -992135872, -1044203776, -1070560128, -1070556032, -1044191616, -992116032, + -915611456, -816561792, -697405888, -561077696, -410934112, -250672080, -84237752, 84270736, + 250704176, 410964480, 561105536, 697430400, 816582400, 915627520, 992127104, 1044197440, + 1070556416, 1070555008, 1044193216, 992120256, 915618176, 816570816, 697417024, 561090688, + 410948576, 250687680, 84254088 +}; + + /* clang-format on */ diff --git a/lib_com/ivas_rom_com_fx.h b/lib_com/ivas_rom_com_fx.h index 80f98bb353348b99eae91c0172d1163282e2249c..26940e6765802c9073f6bcf06e0d87e78f91689d 100644 --- a/lib_com/ivas_rom_com_fx.h +++ b/lib_com/ivas_rom_com_fx.h @@ -40,6 +40,8 @@ #include "stat_com.h" #include "ivas_stat_com.h" +#ifdef IVAS_FLOAT_FIXED + extern const Word16 ivas_sin_twiddle_480_fx[IVAS_480_PT_LEN >> 1]; extern const Word16 ivas_cos_twiddle_480_fx[IVAS_480_PT_LEN >> 1]; extern const Word16 ivas_sin_twiddle_320_fx[IVAS_320_PT_LEN >> 1]; @@ -81,10 +83,203 @@ extern const Word32 ls_elevation_CICP16_fx[9]; extern const Word32 ls_azimuth_CICP19_fx[11]; extern const Word32 ls_elevation_CICP19_fx[11]; extern const Word16 pow_10_q11[128]; -#ifdef IVAS_FLOAT_FIXED extern const Word32 pow_10_q23[14]; -#endif extern const Word16 ivas_sin_az_fx[361]; extern const Word16 ivas_sine_panning_tbl_fx[601]; extern const Word16 ivas_tan_panning_gain_dirac_tbl_fx[601]; + +/*----------------------------------------------------------------------------------* + * Stereo ICA ROM tables + *----------------------------------------------------------------------------------*/ + +extern const Word32 ica_sincInterp2_fx[]; + +/*----------------------------------------------------------------------------------* + * Stereo IC-BWE ROM tables + *----------------------------------------------------------------------------------*/ + +extern const Word16 pow_10_icbwe_gsMapping_tbl_fx[]; +extern const Word16 pow_10_icbwe_gsMappingDFT_tbl_fx[]; + +/*----------------------------------------------------------------------------------* + * TD Stereo ROM tables + *----------------------------------------------------------------------------------*/ + +extern const UWord32 tdm_ratio_tabl_fx[TDM_NQ + 1]; +extern const UWord32 tdm_den_ratio_tabl_fx[]; + +/* LSFs Intra-frame prediction tables */ +extern const Word16 tdm_LSF_MEAN_RE_USE_OUT_fx[M]; +extern const Word16 tdm_LSF_MEAN_RE_USE_IN_fx[M]; +extern const Word16 tdm_LSF_MEAN_RE_USE_fx[M]; + +extern const Word16 tdm_Beta_Q1bit_re_use_13k2_fx[2]; +extern const Word16 tdm_Beta_Q1bit_re_use_16k4_fx[2]; +extern const Word16 tdm_Beta_Q1bit_re_use_24k4_32k_fx[2]; +extern const Word16 tdm_Beta_Q1bit_re_use_48k_fx[2]; + +extern const Word16 tdm_RE_USE_adaptive_beta_prd_diag_3_fx[15 + 16 + 15]; + +extern const Word16 tdm_LSF_MEAN_PRED_QNT_OUT_fx[M]; +extern const Word16 tdm_LSF_MEAN_PRED_QNT_IN_fx[M]; +extern const Word16 tdm_LSF_MEAN_PRED_QNT_fx[M]; +extern const Word16 tdm_PRED_QNT_fixed_beta_prd_diag_3_fx[15 + 16 + 15]; + +/*----------------------------------------------------------------------------------* + * Stereo DTX ROM tables + *----------------------------------------------------------------------------------*/ + +extern const Word16 dft_cng_alpha_bits_fx[STEREO_DFT_N_COH_ALPHA_STEPS][STEREO_DFT_N_COH_ALPHA_LEVELS]; +extern const Word16 dft_cng_coh_pred_fx[][STEREO_DFT_COH_PRED_COEFFS]; + +/*----------------------------------------------------------------------------------* + * DirAC ROM tables + *----------------------------------------------------------------------------------*/ + +extern const Word32 diffuseness_reconstructions_fx[DIRAC_DIFFUSE_LEVELS]; +extern const Word32 diffuseness_thresholds_fx[DIRAC_DIFFUSE_LEVELS + 1]; +extern const Masa_Diffuseness_Ratios masa_diffuse_ratios[DIRAC_DIFFUSE_LEVELS][DIRAC_DIFFUSE_LEVELS]; + +/*------------------------------------------------------------------------------------------* + * SPAR ROM tables + *------------------------------------------------------------------------------------------*/ + +extern const Word32 dtx_pd_real_min_max_fx[2]; +extern const Word32 one_by_q_level[64]; + +/*----------------------------------------------------------------------------------* + * Parametric MC ROM tables + *----------------------------------------------------------------------------------*/ + +extern const Word16 ivas_param_mc_quant_ild_5d1_48_fx[PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; +extern const Word16 ivas_param_mc_quant_icc_fx[PARAM_MC_SZ_ICC_QUANTIZER]; + +/*----------------------------------------------------------------------------------* + * MASA ROM tables + *----------------------------------------------------------------------------------*/ + +extern const Word32 no_phi_masa_inv_fx[NO_SPHERICAL_GRIDS][MAX_NO_THETA]; +extern const Word32 azimuth_cb_fx[8]; +extern const Word32 delta_theta_masa_fx[NO_SPHERICAL_GRIDS - 2]; +extern const Word32 coherence_cb0_masa_fx[DIRAC_DIFFUSE_LEVELS * 2 * MASA_NO_CV_COH]; +extern const Word32 coherence_cb1_masa_fx[MASA_NO_CV_COH1 * MASA_MAXIMUM_CODING_SUBBANDS]; /* 25 */ + +/* Multi-channel input and output setups */ +extern const Word16 ls_azimuth_CICP2_idx[2]; +extern const Word16 ls_elevation_CICP2_idx[2]; +extern const Word16 ls_azimuth_CICP6_idx[5]; +extern const Word16 ls_elevation_CICP6_idx[5]; +extern const Word16 ls_azimuth_CICP12_idx[7]; +extern const Word16 ls_elevation_CICP12_idx[7]; +extern const Word16 ls_azimuth_CICP14_idx[7]; +extern const Word16 ls_elevation_CICP14_idx[7]; +extern const Word16 ls_azimuth_CICP16_idx[9]; +extern const Word16 ls_elevation_CICP16_idx[9]; +extern const Word16 ls_azimuth_CICP19_idx[11]; +extern const Word16 ls_elevation_CICP19_idx[11]; + +extern const Word32 shoebox_sin_cos_tbl_fx[11][2]; + +extern const Word32 delta_phi_val[90]; +extern const Word32 inv_delta_phi_val[90]; +extern const Word32 dd_val[90]; +extern const Word32 cb_azi_chan_fx[]; + +/*----------------------------------------------------------------------------------* + * MASA and ISM (OMASA) combined format ROM tables + *----------------------------------------------------------------------------------*/ + +extern const Word32 dct4_fx[]; +extern const Word32 dct5_fx[]; +extern const Word32 dct8_fx[]; +extern const Word32 dct12_fx[]; + +/*----------------------------------------------------------------------------------* + * ISM ROM tables + *----------------------------------------------------------------------------------*/ + +extern const Word32 ism_azimuth_borders_fx[4]; +extern const Word32 ism_elevation_borders_fx[4]; + +/*----------------------------------------------------------------------------------* + * LFE coding ROM tables + *----------------------------------------------------------------------------------*/ + +extern const Word32 ivas_lpf_4_butter_16k_sos_fx[IVAS_BIQUAD_FILT_LEN << 2]; +extern const Word32 ivas_lpf_4_butter_32k_sos_fx[IVAS_BIQUAD_FILT_LEN << 2]; +extern const Word32 ivas_lpf_4_butter_48k_sos_fx[IVAS_BIQUAD_FILT_LEN << 2]; +extern const Word32 ivas_lpf_2_butter_16k_fx[IVAS_BIQUAD_FILT_LEN << 1]; +extern const Word32 ivas_lpf_2_butter_32k_fx[IVAS_BIQUAD_FILT_LEN << 1]; +extern const Word32 ivas_lpf_2_butter_48k_fx[IVAS_BIQUAD_FILT_LEN << 1]; + +extern const Word32 ivas_lfe_window_coeff_48k_fx[IVAS_LFE_FADE_LEN_48K]; +extern const Word32 ivas_lfe_window_coeff_32k_fx[IVAS_LFE_FADE_LEN_32K]; +extern const Word32 ivas_lfe_window_coeff_16k_fx[IVAS_LFE_FADE_LEN_16K]; + +extern const UWord32 d_hamm_lfe_plc_fx[LFE_PLC_LENANA / 2]; + +/*------------------------------------------------------------------------------------------* + * MDFT/iMDFT ROM tables + *------------------------------------------------------------------------------------------*/ + +extern const Word32 ivas_mdft_coeff_cos_twid_240_fx[IVAS_240_PT_LEN + 1]; +extern const Word32 ivas_mdft_coeff_cos_twid_160_fx[IVAS_160_PT_LEN + 1]; +extern const Word32 ivas_mdft_coeff_cos_twid_120_fx[IVAS_120_PT_LEN + 1]; +extern const Word32 ivas_mdft_coeff_cos_twid_80_fx[IVAS_80_PT_LEN + 1]; +extern const Word32 ivas_mdft_coeff_cos_twid_40_fx[IVAS_40_PT_LEN + 1]; +extern const Word32 ivas_mdft_coeff_cos_twid_960_fx[IVAS_960_PT_LEN + 1]; +extern const Word32 ivas_mdft_coeff_cos_twid_640_fx[IVAS_640_PT_LEN + 1]; +extern const Word32 ivas_mdft_coeff_cos_twid_320_fx[IVAS_320_PT_LEN + 1]; +extern const Word32 dirac_gains_norm_term_int[9]; +extern const Word32 dirac_gains_norm_term_fx[9]; +extern const Word32 dirac_gains_Pnm_int[91][9]; +extern const Word32 dirac_gains_trg_term_int[181][2]; +extern const Word32 dirac_gains_trg_term_fx[181][2]; + +/*------------------------------------------------------------------------------------------* + * FB ROM tables + *------------------------------------------------------------------------------------------*/ + +extern const Word16 ivas_fb_cf_4ms_48k_fx[IVAS_FB_4MS_48K_SAMP]; +extern const Word16 ivas_fb_cf_1ms_48k_fx[IVAS_FB_1MS_48K_SAMP]; +extern const Word16 ivas_fb_cf_4ms_32k_fx[IVAS_FB_4MS_32K_SAMP]; +extern const Word16 ivas_fb_cf_1ms_32k_fx[IVAS_FB_1MS_32K_SAMP]; +extern const Word16 ivas_fb_cf_4ms_16k_fx[IVAS_FB_4MS_16K_SAMP]; +extern const Word16 ivas_fb_cf_1ms_16k_fx[IVAS_FB_1MS_16K_SAMP]; + +extern const Word32 ivas_fb_resp_cheby_ramp_32del_fx[IVAS_FB_1MS_32K_SAMP + 1]; +extern const Word32 ivas_fb_resp_cheby_ramp_16del_fx[IVAS_FB_1MS_16K_SAMP + 1]; + +/*------------------------------------------------------------------------------------------* + * SNS MSVQ codebooks and means + *------------------------------------------------------------------------------------------*/ + +extern const Word16 *const ivas_sns_cdbks_tcx20_fx[]; +extern const Word16 *const ivas_sns_cdbks_tcx10_fx[]; + +extern const Word16 *const ivas_sns_cdbks_side_tcx20_fx[]; +extern const Word16 *const ivas_sns_cdbks_side_tcx10_fx[]; + +/*----------------------------------------------------------------------* + * MC ParamUpmix ROM tables + *-----------------------------------------------------------------------*/ + +extern const ACPL_QUANT_TABLE_FX ivas_mc_paramupmix_alpha_quant_table_fx; +extern const ACPL_QUANT_TABLE_FX ivas_mc_paramupmix_beta_quant_table_fx[9]; + +extern const Word32 ivas_han_win_48k_fx[L_FRAME32k]; +extern const Word32 ivas_han_win_32k_fx[L_FRAME32k]; +extern const Word32 ivas_han_win_16k_fx[L_FRAME32k]; + +extern const Word32 ivas_sine_delay_32_fx[32]; + +extern const Word32 ivas_sine_frame_len_640_del_32_fx[577]; +extern const Word32 ivas_sine_frame_len_640_del_16_fx[289]; + +extern const Word32 ivas_fb_fr_12band_1ms_re_fx[IVAS_FB_12_1MS_LEN]; +extern const Word32 ivas_fb_fr_12band_1ms_im_fx[IVAS_FB_12_1MS_LEN]; + +#endif + + #endif diff --git a/lib_com/ivas_sba_config.c b/lib_com/ivas_sba_config.c index 23096223fb3a1ab1423d3fed5ec17a6cafce9c63..c5860c1c8287da6dfcd9cf0cc39df4512dddb0da 100644 --- a/lib_com/ivas_sba_config.c +++ b/lib_com/ivas_sba_config.c @@ -127,15 +127,15 @@ void ivas_sba_config_fx( ) { test(); - IF( ( LT_16( sba_order, 0 ) ) && ( LT_16( nb_channels, 0 ) ) ) + IF( sba_order < 0 && nb_channels < 0 ) { assert( 0 && "Either order or number of channels must be positive" ); } - ELSE IF( LT_16( sba_order, 0 ) ) + ELSE IF( sba_order < 0 ) { sba_order = ivas_sba_get_order_fx( nb_channels, sba_planar ); } - ELSE IF( LT_16( nb_channels, 0 ) ) + ELSE IF( nb_channels < 0 ) { nb_channels = ivas_sba_get_nchan_fx( sba_order, sba_planar ); } @@ -154,9 +154,12 @@ void ivas_sba_config_fx( IF( nchan_transport != NULL ) { *nchan_transport = ivas_get_sba_num_TCs_fx( sba_total_brate, sba_order ); + move16(); } /* Configure core coder number of elements*/ + test(); + test(); IF( nchan_transport != NULL && nSCE != NULL && nCPE != NULL ) { IF( EQ_16( *nchan_transport, 1 ) ) @@ -227,6 +230,22 @@ Word16 ivas_sba_get_order_fx( /* sba_order = (int16_t) sqrtf( (float) nb_channels ) - 1 */ Word16 sba_order_non_sba_planar[MAX_INPUT_CHANNELS] = { 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3 }; + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); IF( sba_planar ) { diff --git a/lib_com/ivas_sns_com_fx.c b/lib_com/ivas_sns_com_fx.c index 12f546ef38ce81b0fcea000c7a4bd237d80543c7..d053e957ff1d0a281af475524815344c2d27024e 100644 --- a/lib_com/ivas_sns_com_fx.c +++ b/lib_com/ivas_sns_com_fx.c @@ -58,21 +58,29 @@ void sns_compute_scf_fx( Word32 *scf, Word16 q ) { - Word16 i, n, k; + Word16 i, n, k, exp; Word32 x[FDNS_NPTS], xs[FDNS_NPTS], mean, xl4[SNS_NPTS], nf, xl[FDNS_NPTS]; Word64 sum; Word32 L_tmp; const Word16 *pow_tilt; const UWord8 nBands = pPsychParams->nBands; + move16(); const UWord8 *bandLengths = pPsychParams->bandLengths; Word8 bw = 0; + move16(); const Word16 w_0 = 2730; // (1.0f / 12.0f) in Q15 + move16(); const Word16 w_1 = 5461; // (2.0f / 12.0f) in Q15 + move16(); const Word16 w_2 = 8192; // 0.25f ( 3.0f / 12.0f ) in Q15 + move16(); const Word16 w_3 = w_2; + move16(); const Word16 w_4 = w_1; + move16(); const Word16 w_5 = w_0; + move16(); assert( nBands == FDNS_NPTS ); @@ -81,42 +89,62 @@ void sns_compute_scf_fx( IF( bandLengths == NULL ) { bw = (Word8) shr( L_frame, 6 ); + move16(); /* Energy per band */ k = 0; + move16(); FOR( i = 0; i < nBands; ++i ) { x[i] = 0; + move32(); FOR( n = 0; n < bw; ( ++n, ++k ) ) { x[i] = L_add_sat( x[i], spectrum[k] ); + move32(); } - x[i] /= bw; + exp = 15; + move16(); + Word16 inv_bw = Invert16( bw, &exp ); + inv_bw = shl( inv_bw, exp ); + x[i] = Mpy_32_16_1( x[i], inv_bw ); + move32(); } } ELSE { /* Energy per band */ k = 0; + move32(); FOR( i = 0; i < nBands; ++i ) { x[i] = 0; + move32(); FOR( n = 0; n < bandLengths[i]; ( ++n, ++k ) ) { x[i] = L_add_sat( x[i], spectrum[k] ); + move32(); } - x[i] /= bandLengths[i]; + exp = 15; + move16(); + Word16 inv_bw = Invert16( bandLengths[i], &exp ); + inv_bw = shl( inv_bw, exp ); + x[i] = Mpy_32_16_1( x[i], inv_bw ); + move32(); } } /* Smoothing */ xs[0] = L_add( Mpy_32_16_1( x[0], 24576 /* 0.75 in Q15 */ ), Mpy_32_16_1( x[1], 8192 /* 0.25 in Q15 */ ) ); + move32(); FOR( i = 1; i < FDNS_NPTS - 1; i++ ) { xs[i] = L_add( L_add( Mpy_32_16_1( x[i], 16384 /* 0.5 in Q15 */ ), Mpy_32_16_1( x[i - 1], 8192 /* 0.25 in Q15 */ ) ), Mpy_32_16_1( x[i + 1], 8192 /* 0.25 in Q15 */ ) ); + move32(); } xs[FDNS_NPTS - 1] = L_add( Mpy_32_16_1( x[FDNS_NPTS - 1], 24576 /* 0.75 in Q15 */ ), Mpy_32_16_1( x[FDNS_NPTS - 2], 8192 /* 0.25 in Q15 */ ) ); + move32(); /* Pre-emphasis */ SWITCH( L_frame ) @@ -138,16 +166,20 @@ void sns_compute_scf_fx( FOR( i = 0; i < FDNS_NPTS; i++ ) { xs[i] = Mpy_32_16_1( xs[i], pow_tilt[i] ); + move32(); xs[i] = L_shl( xs[i], Q4 ); // xs => Q8 + move32(); } /* Noise floor at -40dB */ sum = 0; - for ( Word16 ind = 0; ind < FDNS_NPTS; ind++ ) + move64(); + FOR( Word16 ind = 0; ind < FDNS_NPTS; ind++ ) { - sum += (Word64) xs[ind]; + sum = W_add( sum, (Word64) xs[ind] ); } - mean = (Word32) ( sum >> 6 ); + mean = (Word32) W_shr( sum, 6 ); + move32(); nf = Mpy_32_16_1( mean, 3 ); // 3 => powf( 10.0f, -4.0f ) in Q15 nf = L_max( nf, 0 ); // 0 => powf( 2.0f, -32.0f ) in Q15 @@ -158,6 +190,7 @@ void sns_compute_scf_fx( if ( LT_32( xs[i], nf ) ) { xs[i] = nf; + move32(); } } @@ -169,6 +202,7 @@ void sns_compute_scf_fx( e_tmp = sub( sub( 30, e_tmp ), q ); /* Note: Mpy_32_16 is used temporarily for this computation, It needs to be replaced with appropriate BASOP. */ xl[i] = Mpy_32_16( e_tmp, f_tmp, 16384 ); /* Q16 */ + move32(); } /* Downsampling */ @@ -180,10 +214,11 @@ void sns_compute_scf_fx( L_tmp = Madd_32_16( L_tmp, xl[3], w_4 ); L_tmp = Madd_32_16( L_tmp, xl[4], w_5 ); xl4[0] = L_tmp; + move32(); FOR( n = 1; n < SNS_NPTS - 1; n++ ) { - int16_t n4 = 4 * n; + Word16 n4 = shl( n, 2 ); L_tmp = L_deposit_l( 0 ); L_tmp = Madd_32_16( L_tmp, xl[n4 - 1], w_0 ); @@ -193,6 +228,7 @@ void sns_compute_scf_fx( L_tmp = Madd_32_16( L_tmp, xl[n4 + 3], w_4 ); L_tmp = Madd_32_16( L_tmp, xl[n4 + 4], w_5 ); xl4[n] = L_tmp; + move32(); } L_tmp = L_deposit_l( 0 ); @@ -206,15 +242,17 @@ void sns_compute_scf_fx( /* Remove mean and scaling */ sum = 0; - for ( Word16 ind = 0; ind < SNS_NPTS; ind++ ) + move64(); + FOR( Word16 ind = 0; ind < SNS_NPTS; ind++ ) { - sum += (Word64) xl4[ind]; + sum = W_add( sum, (Word64) xl4[ind] ); } - mean = (Word32) ( sum >> 4 ); + mean = (Word32) W_shr( sum, 4 ); FOR( i = 0; i < SNS_NPTS; i++ ) { scf[i] = Mpy_32_16_1( L_sub( xl4[i], mean ), 27853 /* 0.85 in in Q15 */ ); + move32(); } return; @@ -242,10 +280,10 @@ void sns_interpolate_scalefactors_fx( FOR( n = 0; n <= M - 2; n++ ) { - scf_int[n * 4 + 2] = L_add( scf[n], Mpy_32_16_1( L_sub( scf[n + 1], scf[n] ), 4096 ) ); /* 4096 -> 1/8 in Q15 */ - scf_int[n * 4 + 3] = L_add( scf[n], Mpy_32_16_1( L_sub( scf[n + 1], scf[n] ), 12288 ) ); /* 12288 -> 3/8 in Q15 */ - scf_int[n * 4 + 4] = L_add( scf[n], Mpy_32_16_1( L_sub( scf[n + 1], scf[n] ), 20480 ) ); /* 20480 -> 5/8 in Q15 */ - scf_int[n * 4 + 5] = L_add( scf[n], Mpy_32_16_1( L_sub( scf[n + 1], scf[n] ), 28672 ) ); /* 28672 -> 7/8 in Q15 */ + scf_int[add( n * 4, 2 )] = L_add( scf[n], Mpy_32_16_1( L_sub( scf[n + 1], scf[n] ), 4096 ) ); /* 4096 -> 1/8 in Q15 */ + scf_int[add( n * 4, 3 )] = L_add( scf[n], Mpy_32_16_1( L_sub( scf[n + 1], scf[n] ), 12288 ) ); /* 12288 -> 3/8 in Q15 */ + scf_int[add( n * 4, 4 )] = L_add( scf[n], Mpy_32_16_1( L_sub( scf[n + 1], scf[n] ), 20480 ) ); /* 20480 -> 5/8 in Q15 */ + scf_int[add( n * 4, 5 )] = L_add( scf[n], Mpy_32_16_1( L_sub( scf[n + 1], scf[n] ), 28672 ) ); /* 28672 -> 7/8 in Q15 */ } scf_int[FDNS_NPTS - 2] = L_add( scf[M - 1], Mpy_32_16_1( L_sub( scf[M - 1], scf[M - 2] ), 4096 ) ); @@ -257,6 +295,7 @@ void sns_interpolate_scalefactors_fx( FOR( n = 0; n < FDNS_NPTS; n++ ) { scf_int[n] = L_negate( scf_int[n] ); + move32(); } } @@ -266,6 +305,7 @@ void sns_interpolate_scalefactors_fx( L_tmp = BASOP_util_Pow2( scf_int[n], Q15, &exp ); exp = sub( 15, exp ); scf_int[n] = L_shr( L_tmp, exp ); + move32(); } return; @@ -288,77 +328,98 @@ void sns_shape_spectrum_fx( Word16 *length ) { Word16 i, n, k, tmp_k, bw, q_tmp = 0, shift, min_shift = 63; + move16(); + move16(); Word64 L64_tmp[L_FRAME48k]; const UWord8 nBands = pPsychParams->nBands; + move16(); const UWord8 *bandLengths = pPsychParams->bandLengths; IF( bandLengths == NULL ) { - bw = L_frame / nBands; + bw = divide3216( shl( L_frame, 1 ), nBands ); /* Shape spectrum */ k = 0; + move16(); FOR( i = 0; i < nBands; ++i ) { FOR( n = 0; n < bw; ( ++n, ++k ) ) { L64_tmp[k] = W_mult_32_32( spectrum[k], scf_int[i] ); // Q = q_spectrum + q_scf_int + 1 + move64(); shift = W_norm( L64_tmp[k] ); IF( LT_16( shift, min_shift ) ) { min_shift = shift; + move16(); } } } tmp_k = k; + move16(); if ( length != NULL ) { *length = k; + move16(); } q_tmp = sub( add( add( *q_spectrum, q_scf_int ), min_shift ), 32 ); - IF( GT_16( q_tmp, 30 ) ) + if ( GT_16( q_tmp, 30 ) ) { q_tmp = 30; + move16(); } FOR( k = 0; k < tmp_k; k++ ) { L64_tmp[k] = W_shr( L64_tmp[k], sub( add( *q_spectrum, q_scf_int ), q_tmp ) ); + move64(); spectrum[k] = W_sat_l( L64_tmp[k] ); // Q = q_tmp + move64(); } *q_spectrum = q_tmp; + move16(); } ELSE { /* Shape spectrum */ k = 0; + move16(); FOR( i = 0; i < nBands; ++i ) { FOR( n = 0; n < bandLengths[i]; ( ++n, ++k ) ) { L64_tmp[k] = W_mult_32_32( spectrum[k], scf_int[i] ); // Q = q_spectrum + q_scf_int + 1 + move64(); shift = W_norm( L64_tmp[k] ); IF( LT_16( shift, min_shift ) && NE_64( L64_tmp[k], 0 ) ) { min_shift = shift; + move16(); } } } tmp_k = k; + move16(); if ( length != NULL ) { *length = k; + move16(); } q_tmp = sub( add( add( *q_spectrum, q_scf_int ), min_shift ), 32 ); - IF( GT_16( q_tmp, 30 ) ) + if ( GT_16( q_tmp, 30 ) ) { q_tmp = 30; + move16(); } FOR( k = 0; k < tmp_k; k++ ) { L64_tmp[k] = W_shr( L64_tmp[k], sub( add( *q_spectrum, q_scf_int ), q_tmp ) ); + move64(); spectrum[k] = W_sat_l( L64_tmp[k] ); // Q = q_tmp + move64(); } *q_spectrum = q_tmp; + move16(); } return; diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index 0b4639a3e7a2fdfbdd118d4cabfe07e0abac8a79..36938507a21808b4f96c83a81bc46fe51dd8e9ac 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -49,6 +49,9 @@ #ifdef IVAS_FLOAT_FIXED #include "ivas_prot_fx.h" #endif +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif /*------------------------------------------------------------------------------------------* diff --git a/lib_com/ivas_spar_com_quant_util.c b/lib_com/ivas_spar_com_quant_util.c index 859f1ee2440c8cd9210aa848202d35552d53a4e8..667d21b7f0627d1217a589d654b8edbe5e0fa0fd 100644 --- a/lib_com/ivas_spar_com_quant_util.c +++ b/lib_com/ivas_spar_com_quant_util.c @@ -41,6 +41,9 @@ #include #include "wmc_auto.h" #include "prot_fx1.h" +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif /*-----------------------------------------------------------------------------------------* @@ -91,44 +94,50 @@ void ivas_quantise_real_values( void ivas_quantise_real_values_fx( const Word32 *values_fx, - const int16_t q_levels, + const Word16 q_levels, const Word32 min_value_fx, const Word32 max_value_fx, - int16_t *index, + Word16 *index, Word32 *quant_fx, - const int16_t dim ) + const Word16 dim ) { - int16_t i; + Word16 i; Word32 q_step_fx, one_by_q_step_fx; - if ( q_levels == 1 ) + test(); + IF( EQ_16( q_levels, 1 ) ) { - for ( i = 0; i < dim; i++ ) + FOR( i = 0; i < dim; i++ ) { quant_fx[i] = 0; + move32(); index[i] = 0; + move16(); } } - else if ( q_levels && max_value_fx != min_value_fx ) + ELSE IF( q_levels && NE_32( max_value_fx, min_value_fx ) ) { - Word16 nor_q_level = norm_l( q_levels - 1 ); - Word32 one_by_q_levels = divide3232( L_shl( 1, ( nor_q_level ) ), L_shl( ( q_levels - 1 ), ( nor_q_level ) ) ); + Word16 nor_q_level = norm_l( sub( q_levels, 1 ) ); + Word32 one_by_q_levels = divide3232( L_shl( 1, ( nor_q_level ) ), L_shl( sub( q_levels, 1 ), ( nor_q_level ) ) ); one_by_q_levels = L_shl( one_by_q_levels, 16 ); - q_step_fx = Mpy_32_32( ( max_value_fx - min_value_fx ), one_by_q_levels ); - Word32 one_by_max_min = divide3232( ONE_IN_Q28, L_sub( max_value_fx, min_value_fx ) ); - one_by_q_step_fx = ( q_levels - 1 ) * one_by_max_min; + q_step_fx = Mpy_32_32( L_sub( max_value_fx, min_value_fx ), one_by_q_levels ); + Word16 one_by_max_min = divide3232( ONE_IN_Q28, L_sub( max_value_fx, min_value_fx ) ); + one_by_q_step_fx = L_mult0( sub( q_levels, 1 ), one_by_max_min ); Word32 val_fx; - for ( i = 0; i < dim; i++ ) + FOR( i = 0; i < dim; i++ ) { - val_fx = max( min_value_fx, min( values_fx[i], max_value_fx ) ); - index[i] = (int16_t) L_shr( Mpy_32_32( one_by_q_step_fx, val_fx ), 12 ); - quant_fx[i] = index[i] * q_step_fx; + val_fx = L_max( min_value_fx, L_min( values_fx[i], max_value_fx ) ); + index[i] = extract_l( L_shr( Mpy_32_32( one_by_q_step_fx, val_fx ), 12 ) ); + move16(); + quant_fx[i] = imult3216( q_step_fx, index[i] ); + move16(); } } - else + ELSE { - for ( i = 0; i < dim; i++ ) + FOR( i = 0; i < dim; i++ ) { quant_fx[i] = values_fx[i]; + move32(); } } return; @@ -242,13 +251,13 @@ void ivas_spar_get_uniform_quant_strat_fx( Pc_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][3]; move16(); - if ( active_w ) + IF( active_w ) { pSpar_md_com_cfg->quant_strat[i].PR.q_levels[0] = PQ_q_lvl; move16(); pSpar_md_com_cfg->quant_strat[i].PR.q_levels[1] = PQ_q_lvl; move16(); - pSpar_md_com_cfg->quant_strat[i].PR.min_fx = L_negate( 322122547 ); // -1.2*Q28 + pSpar_md_com_cfg->quant_strat[i].PR.min_fx = -322122547; // -1.2*Q28 move32(); pSpar_md_com_cfg->quant_strat[i].PR.max_fx = 322122547; // 1.2*Q28 move32(); @@ -257,7 +266,7 @@ void ivas_spar_get_uniform_quant_strat_fx( move16(); pSpar_md_com_cfg->quant_strat[i].C.q_levels[1] = C_q_lvl; move16(); - pSpar_md_com_cfg->quant_strat[i].C.min_fx = L_negate( 214748364 ); //-.8*Q28 + pSpar_md_com_cfg->quant_strat[i].C.min_fx = -214748364; //-.8*Q28 move32(); pSpar_md_com_cfg->quant_strat[i].C.max_fx = 214748364; //.8*Q28 move32(); @@ -275,12 +284,12 @@ void ivas_spar_get_uniform_quant_strat_fx( move16(); pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[1] = Pc_q_lvl; move16(); - pSpar_md_com_cfg->quant_strat[i].P_c.min_fx = L_negate( 214748364 ); //-.8*Q28 + pSpar_md_com_cfg->quant_strat[i].P_c.min_fx = -214748364; //-.8*Q28 move32(); pSpar_md_com_cfg->quant_strat[i].P_c.max_fx = 214748364; //.8*Q28 move32(); } - else + ELSE { pSpar_md_com_cfg->quant_strat[i].PR.q_levels[0] = PQ_q_lvl; move16(); @@ -288,7 +297,7 @@ void ivas_spar_get_uniform_quant_strat_fx( move16(); pSpar_md_com_cfg->quant_strat[i].PR.max_fx = ONE_IN_Q28; // Q28 move32(); - pSpar_md_com_cfg->quant_strat[i].PR.min_fx = L_negate( ONE_IN_Q28 ); // Q28 + pSpar_md_com_cfg->quant_strat[i].PR.min_fx = -ONE_IN_Q28; // Q28 move32(); pSpar_md_com_cfg->quant_strat[i].C.q_levels[0] = C_q_lvl; @@ -297,7 +306,7 @@ void ivas_spar_get_uniform_quant_strat_fx( move16(); pSpar_md_com_cfg->quant_strat[i].C.max_fx = ONE_IN_Q29; // Q28 move32(); - pSpar_md_com_cfg->quant_strat[i].C.min_fx = L_negate( ONE_IN_Q29 ); // Q28 + pSpar_md_com_cfg->quant_strat[i].C.min_fx = -ONE_IN_Q29; // Q28 move32(); pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[0] = Pr_q_lvl; @@ -315,7 +324,7 @@ void ivas_spar_get_uniform_quant_strat_fx( move16(); pSpar_md_com_cfg->quant_strat[i].P_c.max_fx = ONE_IN_Q27; // Q28 move32(); - pSpar_md_com_cfg->quant_strat[i].P_c.min_fx = L_negate( ONE_IN_Q27 ); // Q28 + pSpar_md_com_cfg->quant_strat[i].P_c.min_fx = -ONE_IN_Q27; // Q28 move32(); } } @@ -334,58 +343,61 @@ void ivas_spar_get_uniform_quant_strat_fx( void ivas_map_prior_coeffs_quant( ivas_spar_md_prev_t *pSpar_md_prior, ivas_spar_md_com_cfg *pSpar_md_cfg, - const int16_t qsi, - const int16_t nB ) + const Word16 qsi, + const Word16 nB ) { - int16_t i, j; + Word16 i, j; - if ( qsi != pSpar_md_cfg->prev_quant_idx ) + IF( NE_16( qsi, pSpar_md_cfg->prev_quant_idx ) ) { ivas_quant_strat_t qs = pSpar_md_cfg->quant_strat[qsi]; ivas_quant_strat_t prev_qs = pSpar_md_cfg->quant_strat[pSpar_md_cfg->prev_quant_idx]; - // float one_by_q_lvl_PR = 1.0f / max( prev_qs.PR.q_levels[0] - 1, 1 ); - Word32 one_by_q_lvl_PR_fx = one_by_q_level[max( prev_qs.PR.q_levels[0] - 1, 1 )]; - // float one_by_q_lvl_C = 1.0f / max( prev_qs.C.q_levels[0] - 1, 1 ); - Word32 one_by_q_lvl_C_fx = one_by_q_level[max( prev_qs.C.q_levels[0] - 1, 1 )]; - // float one_by_q_lvl_P_r = 1.0f / max( prev_qs.P_r.q_levels[0] - 1, 1 ); - Word32 one_by_q_lvl_P_r_fx = one_by_q_level[max( prev_qs.P_r.q_levels[0] - 1, 1 )]; - for ( i = 0; i < nB; i++ ) + Word32 one_by_q_lvl_PR_fx = one_by_q_level[s_max( sub( prev_qs.PR.q_levels[0], 1 ), 1 )]; + move32(); + Word32 one_by_q_lvl_C_fx = one_by_q_level[s_max( sub( prev_qs.C.q_levels[0], 1 ), 1 )]; + move32(); + Word32 one_by_q_lvl_P_r_fx = one_by_q_level[s_max( sub( prev_qs.P_r.q_levels[0], 1 ), 1 )]; + move32(); + FOR( i = 0; i < nB; i++ ) { - for ( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) + FOR( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) { - Word32 trial1 = ( qs.PR.q_levels[0] - 1 ) * pSpar_md_prior->band_coeffs_idx[i].pred_index_re[j]; - trial1 = trial1 << 16; + Word32 trial1 = L_mult0( sub( qs.PR.q_levels[0], 1 ), pSpar_md_prior->band_coeffs_idx[i].pred_index_re[j] ); + trial1 = L_shl( trial1, 16 ); trial1 = round_fx( Mpy_32_32( trial1, one_by_q_lvl_PR_fx ) ); - // pSpar_md_prior->band_coeffs_idx_mapped[i].pred_index_re[j] = (int16_t) round( ( qs.PR.q_levels[0] - 1 ) * pSpar_md_prior->band_coeffs_idx[i].pred_index_re[j] * one_by_q_lvl_PR ); pSpar_md_prior->band_coeffs_idx_mapped[i].pred_index_re[j] = extract_l( trial1 ); - Word32 trial2 = ( qs.P_r.q_levels[0] - 1 ) * pSpar_md_prior->band_coeffs_idx[i].decd_index_re[j]; - trial2 = trial2 << 16; + move16(); + Word32 trial2 = L_mult0( sub( qs.P_r.q_levels[0], 1 ), pSpar_md_prior->band_coeffs_idx[i].decd_index_re[j] ); + trial2 = L_shl( trial2, 16 ); trial2 = round_fx( Mpy_32_32( trial2, one_by_q_lvl_P_r_fx ) ); - // pSpar_md_prior->band_coeffs_idx_mapped[i].decd_index_re[j] = (int16_t) round( ( qs.P_r.q_levels[0] - 1 ) * pSpar_md_prior->band_coeffs_idx[i].decd_index_re[j] * one_by_q_lvl_P_r ); pSpar_md_prior->band_coeffs_idx_mapped[i].decd_index_re[j] = extract_l( trial2 ); + move16(); } - for ( j = 0; j < IVAS_SPAR_MAX_C_COEFF; j++ ) + FOR( j = 0; j < IVAS_SPAR_MAX_C_COEFF; j++ ) { - Word32 trial1 = ( qs.C.q_levels[0] - 1 ) * pSpar_md_prior->band_coeffs_idx[i].drct_index_re[j]; - trial1 = trial1 << 16; + Word32 trial1 = L_mult0( sub( qs.C.q_levels[0], 1 ), pSpar_md_prior->band_coeffs_idx[i].drct_index_re[j] ); + trial1 = L_shl( trial1, 16 ); trial1 = round_fx( Mpy_32_32( trial1, one_by_q_lvl_C_fx ) ); - // pSpar_md_prior->band_coeffs_idx_mapped[i].drct_index_re[j] = (int16_t) round( ( qs.C.q_levels[0] - 1 ) * pSpar_md_prior->band_coeffs_idx[i].drct_index_re[j] * one_by_q_lvl_C ); pSpar_md_prior->band_coeffs_idx_mapped[i].drct_index_re[j] = extract_l( trial1 ); + move16(); } } } - else + ELSE { - for ( i = 0; i < nB; i++ ) + FOR( i = 0; i < nB; i++ ) { - for ( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) + FOR( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) { pSpar_md_prior->band_coeffs_idx_mapped[i].pred_index_re[j] = pSpar_md_prior->band_coeffs_idx[i].pred_index_re[j]; + move16(); pSpar_md_prior->band_coeffs_idx_mapped[i].decd_index_re[j] = pSpar_md_prior->band_coeffs_idx[i].decd_index_re[j]; + move16(); } - for ( j = 0; j < IVAS_SPAR_MAX_C_COEFF; j++ ) + FOR( j = 0; j < IVAS_SPAR_MAX_C_COEFF; j++ ) { pSpar_md_prior->band_coeffs_idx_mapped[i].drct_index_re[j] = pSpar_md_prior->band_coeffs_idx[i].drct_index_re[j]; + move16(); } } } @@ -461,7 +473,9 @@ void ivas_spar_quant_dtx_init_fx( Word32 *min_max ) { spar_md->min_max_fx[0] = min_max[0]; + move32(); spar_md->min_max_fx[1] = min_max[1]; + move32(); return; } @@ -549,7 +563,7 @@ void ivas_clear_band_coeffs_fx( { UWord16 i; - for ( i = 0; i < num_bands; i++ ) + FOR( i = 0; i < num_bands; i++ ) { set32_fx( (Word32 *) pband_coeffs[i].C_re_fx, 0, ( IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS ) * ( IVAS_SPAR_MAX_DMX_CHS - 1 ) ); set32_fx( (Word32 *) pband_coeffs[i].P_re_fx, 0, ( IVAS_SPAR_MAX_CH - 1 ) ); @@ -572,9 +586,8 @@ void ivas_clear_band_coeff_idx( ivas_band_coeffs_ind_t *pband_coeff_idx, const UWord16 num_bands ) { - UWord16 i = 0; - - for ( i = 0; i < num_bands; i++ ) + UWord16 i; + FOR( i = 0; i < num_bands; i++ ) { set16_fx( pband_coeff_idx[i].pred_index_re, 0, ( sub( IVAS_SPAR_MAX_CH, 1 ) ) ); set16_fx( pband_coeff_idx[i].drct_index_re, 0, IVAS_SPAR_MAX_C_COEFF ); diff --git a/lib_com/ivas_stereo_ica_com_fx.c b/lib_com/ivas_stereo_ica_com_fx.c index deee92b719df10824542d0b6bcdd313a730875b2..0b3920c8ef7b9727c1a0ffefd9f7665221a8e560 100644 --- a/lib_com/ivas_stereo_ica_com_fx.c +++ b/lib_com/ivas_stereo_ica_com_fx.c @@ -43,6 +43,9 @@ #include "wmc_auto.h" #include "rom_com.h" #include "ivas_rom_com.h" +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif /*--------------------------------------------------------------- * interpTargetChannel_fx() diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index 2ca004b6ecb45b47d511a706e3664d8e43ffadb6..7378308270226bd71c91c592d96d582d38aaf56d 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -45,6 +45,9 @@ #include "prot_fx2.h" #include "ivas_prot_fx.h" #endif +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif /*-------------------------------------------------------------------* diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index 9454e80f525bb2c6163f54280dc0091c24354898..c0f7bd613b0bdba16ec5bb4634f881aec93ac07e 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -178,6 +178,7 @@ void E_LPC_a_isp_conversion( const Word16 a[], Word16 isp[], const Word16 old_is Word32 f[2][NC_MAX + 1]; Word32 t0, t1; Word16 scale = 1024; + move16(); #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif @@ -437,10 +438,11 @@ void E_LPC_f_isp_a_conversion( const Word16 *isp, Word16 *a, const Word16 m ) DO { - + test(); /* a[0] = 1.0 */ a[0] = shl( 256, q ); move16(); + j = sub( m, 1 ); FOR( i = 1; i < nc; i++ ) { @@ -448,11 +450,13 @@ void E_LPC_f_isp_a_conversion( const Word16 *isp, Word16 *a, const Word16 m ) t0 = L_add( f1[i], f2[i] ); /* f1[i] + f2[i] */ t0 = L_shl( t0, q ); a[i] = round_fx( t0 ); /* from Q23 to Q12 and * 0.5 */ + move16(); /* a[j] = 0.5*(f1[i] - f2[i]) */ t0 = L_sub( f1[i], f2[i] ); /* f1[i] - f2[i] */ t0 = L_shl( t0, q ); a[j] = round_fx( t0 ); /* from Q23 to Q12 and * 0.5 */ + move16(); j = sub( j, 1 ); } @@ -478,11 +482,11 @@ void E_LPC_f_isp_a_conversion( const Word16 *isp, Word16 *a, const Word16 m ) WHILE( t0n == 0 || t0p == 0 ); /*in case of overflow, recalculate coefficients*/ a[nc] = round_fx( t0 ); /* from Q23 to Q12 and * 0.5 */ - + move16(); /* a[m] = isp[m-1] */ t0 = L_mult( a[0], isp[m - 1] ); /* from Q15 to Q12 */ a[m] = round_fx( t0 ); - + move16(); return; } @@ -1440,12 +1444,15 @@ void lsp_weights_fx( FOR( i = 0; i < lpcOrder; i++ ) { w[i] = round_fx( L_shl( Lsum1[i], sub( norm[i], n_max + 1 ) ) ); /* Q( 9-n_max) */ + move16(); } IF( lpcOrder != LPC_SHB_ORDER_WB ) { w[3] = round_fx( L_shl( L_mult( w[3], 18022 ), 1 ) ); /* Q( 9-n_max) */ w[4] = round_fx( L_shl( L_mult( w[4], 18022 ), 1 ) ); /* Q( 9-n_max) */ + move16(); + move16(); } *Qout = 9 - n_max; @@ -1700,6 +1707,7 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */ L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[j], &Overflow ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */ f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */ + move16(); #else L_tmp1 = L_mac( L_tmp1, tmp, f_fx[j] ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */ L_tmp1 = L_shr( L_tmp1, exp ); /* bringing to true Q28 */ @@ -1842,6 +1850,7 @@ ivas_error lsf_allocate_fx( ivas_error error; error = IVAS_ERR_OK; + move16(); cumleft = nBits; move16(); @@ -1995,6 +2004,7 @@ ivas_error find_pred_mode( ivas_error error; error = IVAS_ERR_OK; + move16(); /* bwidth = 0(NB), 1 (WB), 2(WB2); line index in predmode_tab[][] */ idx = bwidth; @@ -2002,6 +2012,7 @@ ivas_error find_pred_mode( if ( GT_16( idx, 1 ) ) { idx = 1; + move16(); } IF( EQ_32( int_fs, INT_FS_16k ) ) { @@ -2048,10 +2059,12 @@ ivas_error find_pred_mode( IF( *predmode > 0 ) { *p_mode_lvq_p = *p_mode_lvq; + move16(); } ELSE { *p_mode_lvq_p = -1; + move16(); } } } @@ -2470,6 +2483,7 @@ void lsp2lsf_fx( L_tmp = L_shr( L_mult0( extract_l( L_tmp ), 5 ), 2 ); } lsf[i] = extract_l( L_tmp ); + move16(); } } /*===========================================================================*/ @@ -2878,9 +2892,12 @@ void lsf_syn_mem_backup_fx( *btilt_code_fx = hLPDmem->tilt_code; + move16(); *gc_threshold_fx = hLPDmem->gc_threshold; + move16(); Copy( st_fx->clip_var_fx, clip_var_bck_fx, 6 ); *next_force_sf_bck_fx = st_fx->next_force_safety_net_fx; + move16(); return; diff --git a/lib_com/lsp_conv_poly_fx.c b/lib_com/lsp_conv_poly_fx.c index 2685a127e1e98cf47d5b6541382ecd35e5296010..0cda281eaa64f36ebdc362f643cc933700f085f7 100644 --- a/lib_com/lsp_conv_poly_fx.c +++ b/lib_com/lsp_conv_poly_fx.c @@ -561,6 +561,8 @@ static void spectautocorr_fx( *---------------------------------------------------------------------*/ r[1] = L_deposit_l( 0 ); + move32(); + r[2] = -G[imid]; move32(); @@ -569,6 +571,7 @@ static void spectautocorr_fx( r[i] = L_deposit_l( 0 ); r[i + 1] = -r[i - 1]; move32(); + move32(); } /*---------------------------------------------------------------------* @@ -738,8 +741,10 @@ static void zeros2poly_fx( { Mpy_32_16_ss( R[j - 1], xr, &mh, &ml ); R[j] = L_add( R[j], mh ); + move32(); Mpy_32_16_ss( S[j - 1], xs, &mh, &ml ); S[j] = L_add( S[j], mh ); + move32(); } } diff --git a/lib_com/modif_fs.c b/lib_com/modif_fs.c index e07eb02aa8cf8a6ef604edf10033cb93772dac49..b4552998dec623f5b6e1033642a14079af1b2ad3 100644 --- a/lib_com/modif_fs.c +++ b/lib_com/modif_fs.c @@ -541,34 +541,46 @@ void Interpolate_allpass_steep_32( FOR( k = 0; k < N; k++ ) { temp_fx[0] = L_add( mem_fx[0], Mpy_32_16_1( in_fx[k], AP2_STEEP_FX[0] ) ); + move32(); mem_fx[0] = L_sub( in_fx[k], Mpy_32_16_1( temp_fx[0], AP2_STEEP_FX[0] ) ); + move32(); /* for better performance, unroll this loop */ FOR( n = 1; n < ALLPASSSECTIONS_STEEP - 1; n++ ) { temp_fx[n] = L_add( mem_fx[n], Mpy_32_16_1( temp_fx[n - 1], AP2_STEEP_FX[n] ) ); + move32(); mem_fx[n] = L_sub( temp_fx[n - 1], Mpy_32_16_1( temp_fx[n], AP2_STEEP_FX[n] ) ); + move32(); } out_fx[2 * k + 1] = L_add( mem_fx[ALLPASSSECTIONS_STEEP - 1], Mpy_32_16_1( temp_fx[ALLPASSSECTIONS_STEEP - 2], AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1] ) ); + move32(); mem_fx[ALLPASSSECTIONS_STEEP - 1] = L_sub( temp_fx[ALLPASSSECTIONS_STEEP - 2], Mpy_32_16_1( out_fx[2 * k + 1], AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1] ) ); + move32(); } /* lower allpass filter chain */ FOR( k = 0; k < N; k++ ) { temp_fx[0] = L_add( mem_fx[ALLPASSSECTIONS_STEEP], Mpy_32_16_1( in_fx[k], AP1_STEEP_FX[0] ) ); + move32(); mem_fx[ALLPASSSECTIONS_STEEP] = L_sub( in_fx[k], Mpy_32_16_1( temp_fx[0], AP1_STEEP_FX[0] ) ); + move32(); /* for better performance, unroll this loop */ FOR( n = 1; n < ALLPASSSECTIONS_STEEP - 1; n++ ) { temp_fx[n] = L_add( mem_fx[ALLPASSSECTIONS_STEEP + n], Mpy_32_16_1( temp_fx[n - 1], AP1_STEEP_FX[n] ) ); + move32(); mem_fx[ALLPASSSECTIONS_STEEP + n] = L_sub( temp_fx[n - 1], Mpy_32_16_1( temp_fx[n], AP1_STEEP_FX[n] ) ); + move32(); } out_fx[2 * k] = L_add( mem_fx[2 * ALLPASSSECTIONS_STEEP - 1], Mpy_32_16_1( temp_fx[ALLPASSSECTIONS_STEEP - 2], AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1] ) ); + move32(); mem_fx[2 * ALLPASSSECTIONS_STEEP - 1] = L_sub( temp_fx[ALLPASSSECTIONS_STEEP - 2], Mpy_32_16_1( out_fx[2 * k], AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1] ) ); + move32(); } return; @@ -676,54 +688,74 @@ void Decimate_allpass_steep_fx32( FOR( k = 0; k < N / 2; k++ ) { temp[0] = L_add( mem[0], Mpy_32_16_1( in[2 * k], AP1_STEEP_FX[0] ) ); + move32(); mem[0] = L_sub( in[2 * k], Mpy_32_16_1( temp[0], AP1_STEEP_FX[0] ) ); + move32(); temp[1] = L_add( mem[1], Mpy_32_16_1( temp[0], AP1_STEEP_FX[1] ) ); + move32(); mem[1] = L_sub( temp[0], Mpy_32_16_1( temp[1], AP1_STEEP_FX[1] ) ); + move32(); out[k] = L_add( mem[ALLPASSSECTIONS_STEEP - 1], Mpy_32_16_1( temp[ALLPASSSECTIONS_STEEP - 2], AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1] ) ); + move32(); mem[ALLPASSSECTIONS_STEEP - 1] = L_sub( temp[ALLPASSSECTIONS_STEEP - 2], Mpy_32_16_1( out[k], AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1] ) ); + move32(); } /* lower allpass filter chain */ temp[0] = L_add( mem[ALLPASSSECTIONS_STEEP], Mpy_32_16_1( mem[2 * ALLPASSSECTIONS_STEEP], AP2_STEEP_FX[0] ) ); + move32(); mem[ALLPASSSECTIONS_STEEP] = L_sub( mem[2 * ALLPASSSECTIONS_STEEP], Mpy_32_16_1( temp[0], AP2_STEEP_FX[0] ) ); + move32(); /* for better performance, unroll this loop */ FOR( n = 1; n < ALLPASSSECTIONS_STEEP - 1; n++ ) { temp[n] = L_add( mem[ALLPASSSECTIONS_STEEP + n], Mpy_32_16_1( temp[n - 1], AP2_STEEP_FX[n] ) ); + move32(); /*if ( fabs( temp[n] ) < 1e-12 ) { temp[n] = sign( temp[n] ) * 1e-12f; }*/ mem[ALLPASSSECTIONS_STEEP + 1] = L_sub( temp[n - 1], Mpy_32_16_1( temp[n], AP2_STEEP_FX[n] ) ); + move32(); } temp[ALLPASSSECTIONS_STEEP - 1] = L_add( mem[2 * ALLPASSSECTIONS_STEEP - 1], Mpy_32_16_1( temp[ALLPASSSECTIONS_STEEP - 2], AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1] ) ); + move32(); mem[2 * ALLPASSSECTIONS_STEEP - 1] = L_sub( temp[ALLPASSSECTIONS_STEEP - 2], Mpy_32_16_1( temp[ALLPASSSECTIONS_STEEP - 1], AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1] ) ); out[0] = L_add( out[0], Mpy_32_16_1( temp[ALLPASSSECTIONS_STEEP - 1], 16384 ) ); + move32(); + move32(); FOR( k = 1; k < N / 2; k++ ) { temp[0] = L_add( mem[ALLPASSSECTIONS_STEEP], Mpy_32_16_1( in[2 * k - 1], AP2_STEEP_FX[0] ) ); + move32(); mem[ALLPASSSECTIONS_STEEP] = L_sub( in[2 * k - 1], Mpy_32_16_1( temp[0], AP2_STEEP_FX[0] ) ); + move32(); /* for better performance, unroll this loop */ FOR( n = 1; n < ALLPASSSECTIONS_STEEP - 1; n++ ) { temp[n] = L_add( mem[ALLPASSSECTIONS_STEEP + n], Mpy_32_16_1( temp[n - 1], AP2_STEEP_FX[n] ) ); + move32(); /*if ( fabs( temp[n] ) < 1e-12 ) { temp[n] = sign( temp[n] ) * 1e-12f; }*/ mem[ALLPASSSECTIONS_STEEP + n] = L_sub( temp[n - 1], Mpy_32_16_1( temp[n], AP2_STEEP_FX[n - 1] ) ); + move32(); } temp[ALLPASSSECTIONS_STEEP - 1] = L_add( mem[2 * ALLPASSSECTIONS_STEEP - 1], Mpy_32_16_1( temp[ALLPASSSECTIONS_STEEP - 2], AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1] ) ); + move32(); mem[2 * ALLPASSSECTIONS_STEEP - 1] = L_sub( temp[ALLPASSSECTIONS_STEEP - 2], Mpy_32_16_1( temp[ALLPASSSECTIONS_STEEP - 1], AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1] ) ); + move32(); out[k] = L_add( out[k], Mpy_32_16_1( temp[ALLPASSSECTIONS_STEEP - 1], 16384 ) ); + move32(); } /* z^(-1) */ @@ -824,8 +856,11 @@ void interpolate_3_over_2_allpass_32( { /* Upper branch */ Vu[0] = L_add( mem[0], Mpy_32_16_1( ( input[i] - mem[1] ), filt_coeff[0] ) ); + move32(); Vu[1] = L_add( mem[1], Mpy_32_16_1( ( Vu[0] - mem[2] ), filt_coeff[1] ) ); + move32(); mem[3] = L_add( mem[2], Mpy_32_16_1( ( Vu[1] - mem[3] ), filt_coeff[2] ) ); + move32(); mem[1] = Vu[0]; move32(); @@ -836,8 +871,11 @@ void interpolate_3_over_2_allpass_32( /* Middle branch */ Vm[0] = L_add( mem[0], Mpy_32_16_1( ( input[i] - mem[4] ), filt_coeff[3] ) ); + move32(); Vm[1] = L_add( mem[4], Mpy_32_16_1( ( Vm[0] - mem[5] ), filt_coeff[4] ) ); + move32(); mem[6] = L_add( mem[5], Mpy_32_16_1( ( Vm[1] - mem[6] ), filt_coeff[5] ) ); + move32(); mem[4] = Vm[0]; move32(); @@ -848,8 +886,11 @@ void interpolate_3_over_2_allpass_32( /* Lower branch */ Vl[0] = L_add( mem[0], Mpy_32_16_1( ( input[i] - mem[7] ), filt_coeff[6] ) ); + move32(); Vl[1] = L_add( mem[7], Mpy_32_16_1( ( Vl[0] - mem[8] ), filt_coeff[7] ) ); + move32(); mem[9] = L_add( mem[8], Mpy_32_16_1( ( Vl[1] - mem[9] ), filt_coeff[8] ) ); + move32(); mem[0] = input[i]; move32(); @@ -1032,7 +1073,7 @@ void interpolate_3_over_1_allpass( return; } - +#ifdef IVAS_FLOAT_FIXED void interpolate_3_over_1_allpass_32( const Word32 *input, /* i : input signal */ const Word16 len, /* i : number of input samples */ @@ -1052,30 +1093,46 @@ void interpolate_3_over_1_allpass_32( { /* Upper branch */ Vu[0] = L_add_sat( mem[0], Mpy_32_16_1( L_sub( input[i], mem[1] ), filt_coeff[0] ) ); + move32(); Vu[1] = L_add_sat( mem[1], Mpy_32_16_1( L_sub( Vu[0], mem[2] ), filt_coeff[1] ) ); + move32(); mem[3] = L_add_sat( mem[2], Mpy_32_16_1( L_sub( Vu[1], mem[3] ), filt_coeff[2] ) ); + move32(); mem[1] = Vu[0]; + move32(); mem[2] = Vu[1]; + move32(); *out1++ = mem[3]; /* Middle branch */ Vm[0] = L_add_sat( mem[0], Mpy_32_16_1( L_sub( input[i], mem[4] ), filt_coeff[3] ) ); + move32(); Vm[1] = L_add_sat( mem[4], Mpy_32_16_1( L_sub( Vm[0], mem[5] ), filt_coeff[4] ) ); + move32(); mem[6] = L_add_sat( mem[5], Mpy_32_16_1( L_sub( Vm[1], mem[6] ), filt_coeff[5] ) ); + move32(); mem[4] = Vm[0]; + move32(); mem[5] = Vm[1]; + move32(); *out1++ = mem[6]; /* Lower branch */ Vl[0] = L_add_sat( mem[0], Mpy_32_16_1( L_sub( input[i], mem[7] ), filt_coeff[6] ) ); + move32(); Vl[1] = L_add_sat( mem[7], Mpy_32_16_1( L_sub( Vl[0], mem[8] ), filt_coeff[7] ) ); + move32(); mem[9] = L_add_sat( mem[8], Mpy_32_16_1( L_sub( Vl[1], mem[9] ), filt_coeff[8] ) ); + move32(); mem[0] = input[i]; + move32(); mem[7] = Vl[0]; + move32(); mem[8] = Vl[1]; + move32(); *out1++ = mem[9]; } @@ -1083,15 +1140,20 @@ void interpolate_3_over_1_allpass_32( FOR( i = 0; i < len * 3; i++ ) { mem_temp = out[i]; + move32(); out[i] = L_sub_sat( Mpy_32_16_1( L_add_sat( mem[12], mem[11] ), 18768 ), Mpy_32_16_1( L_add_sat( mem_temp, mem[10] ), 2424 ) ); + move32(); mem[10] = mem[11]; + move32(); mem[11] = mem[12]; + move32(); mem[12] = mem_temp; + move32(); } return; } - +#endif /*-------------------------------------------------------------------* * retro_interp4_5() diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index 85be57a43461aa0b7627b23d5875091d1f492864..fa12252ad3f05abe34c972676f7b2e6782ddebc1 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -68,9 +68,11 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ Word32 t0, t1, t2, L_tmp; /* temporary variables */ Word32 LepsP[M + 1]; Word16 flag_low_order = 0; + move16(); Word16 filt_len_tmp; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; + move32(); #endif const Resampling_cfg *cfg_ptr_fx; @@ -291,6 +293,7 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ IF( EQ_16( fac_num, 8 ) ) { num_den = 26214; + move16(); FOR( i = 0; i < lg_out; i++ ) { sigOut_fx[i] = mult_r( sigOut_fx[i], num_den ); /*Q-1*/ @@ -648,6 +651,7 @@ void Decimate_allpass_steep_fx( Word16 sum = 0; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; + move32(); #endif move16(); @@ -673,6 +677,7 @@ void Decimate_allpass_steep_fx( mem[0] = extract_h( Lacc1 ); /* Qx */ temp[0] = temp1; move16(); + move16(); Lacc1 = L_deposit_h( mem[1] ); /* Q16+Qx */ #ifdef BASOP_NOGLOB @@ -690,12 +695,15 @@ void Decimate_allpass_steep_fx( mem[1] = extract_h( Lacc ); /* Qx */ temp[1] = temp2; move16(); + move16(); Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ #ifdef BASOP_NOGLOB - out_fx[k] = extract_h( L_mac_o( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ) ); /* Qx format */ + out_fx[k] = extract_h( L_mac_o( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ) ); /* Qx format */ + move16(); mem[ALLPASSSECTIONS_STEEP - 1] = extract_h( L_msu_o( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[k], &Overflow ) ); /* Qx */ + move16(); #else out_fx[k] = extract_h( L_mac( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ mem[ALLPASSSECTIONS_STEEP - 1] = extract_h( L_msu( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[k] ) ); /* Qx */ @@ -736,7 +744,7 @@ void Decimate_allpass_steep_fx( Lacc = L_msu( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ #endif mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */ - + move16(); Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ #ifdef BASOP_NOGLOB @@ -745,13 +753,14 @@ void Decimate_allpass_steep_fx( Lacc = L_mac( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ #endif temp[2] = extract_h( Lacc ); /* temp[2] in Qx */ + move16(); #ifdef BASOP_NOGLOB Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /* Q(16+x) */ #else Lacc1 = L_msu( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); /* Q(16+x) */ #endif mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */ - + move16(); sum = mult_r( out_fx[0], 16384 ); /* Qx */ #ifdef BASOP_NOGLOB out_fx[0] = add_sat( sum, mult_r( temp[ALLPASSSECTIONS_STEEP - 1], 16384 ) ); /* Qx */ @@ -780,6 +789,7 @@ void Decimate_allpass_steep_fx( #endif mem[ALLPASSSECTIONS_STEEP] = extract_h( Lacc1 ); /* Qx */ + move16(); temp[0] = temp1; move16(); @@ -819,6 +829,7 @@ void Decimate_allpass_steep_fx( sum = mult_r( out_fx[k], 16384 ); /* Qx */ #ifdef BASOP_NOGLOB out_fx[k] = add_sat( sum, mult_r( temp[ALLPASSSECTIONS_STEEP - 1], 16384 ) ); + move16(); #else out_fx[k] = add( sum, mult_r( temp[ALLPASSSECTIONS_STEEP - 1], 16384 ) ); #endif @@ -850,6 +861,7 @@ void Interpolate_allpass_steep_fx( Word16 temp1, temp2; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; + move32(); #endif /*** State in Q0,in_fx Q0, AP1_STEEP in Q15 AP2_STEEP in Q15 OP in Q0 ************/ /*upper allpass filter chain */ @@ -869,6 +881,7 @@ void Interpolate_allpass_steep_fx( Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */ mem[0] = round_fx_o( Lacc1, &Overflow ); + move16(); #else temp1 = round_fx( Lacc ); /* Qx */ Lacc1 = L_msu( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */ @@ -887,6 +900,7 @@ void Interpolate_allpass_steep_fx( temp2 = round_fx_o( Lacc1, &Overflow ); /* Qx */ Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */ mem[1] = round_fx_o( Lacc, &Overflow ); /* Qx */ + move16(); #else temp2 = round_fx( Lacc1 ); /* Qx */ Lacc = L_msu( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ @@ -896,8 +910,10 @@ void Interpolate_allpass_steep_fx( Lacc1 = L_deposit_h( temp2 ); Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ #ifdef BASOP_NOGLOB - out_fx[2 * k + 1] = round_fx_o( L_mac_o( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ), &Overflow ); /* Qx format */ + out_fx[2 * k + 1] = round_fx_o( L_mac_o( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ), &Overflow ); /* Qx format */ + move16(); mem[ALLPASSSECTIONS_STEEP - 1] = round_fx_o( L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k + 1], &Overflow ), &Overflow ); /* Qx */ + move16(); #else out_fx[2 * k + 1] = round_fx( L_mac( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ mem[ALLPASSSECTIONS_STEEP - 1] = round_fx( L_msu( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k + 1] ) ); /* Qx */ @@ -948,8 +964,10 @@ void Interpolate_allpass_steep_fx( Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */ Lacc1 = L_deposit_h( temp2 ); #ifdef BASOP_NOGLOB - out_fx[2 * k] = round_fx_o( L_mac_o( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ), &Overflow ); /* Qx format */ + out_fx[2 * k] = round_fx_o( L_mac_o( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ), &Overflow ); /* Qx format */ + move16(); mem[2 * ALLPASSSECTIONS_STEEP - 1] = round_fx_o( L_msu_o( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k], &Overflow ), &Overflow ); /* Qx */ + move16(); #else out_fx[2 * k] = round_fx( L_mac( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ mem[2 * ALLPASSSECTIONS_STEEP - 1] = round_fx( L_msu( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k] ) ); /* Qx */ diff --git a/lib_com/mslvq_com_fx.c b/lib_com/mslvq_com_fx.c index 9a5014b4f5226dfabe05ddd20c3d89da7753ce6a..b2e0e0b2387d5d9d54af6956f42d58b0036f267d 100644 --- a/lib_com/mslvq_com_fx.c +++ b/lib_com/mslvq_com_fx.c @@ -51,7 +51,7 @@ static void idx2c_fx( Word16 n, Word16 *p, Word16 k, Word16 val ); static void divide_64_32_fx( Word16 *xs, Word32 y, Word32 *result, Word32 *rem ); static Word16 decode_indexes_fx( Word16 *index, Word16 no_bits, const Word16 *p_scales, Word16 *p_no_scales, Word32 *p_offset_scale1, Word32 *p_offset_scale2, Word16 *x_lvq, Word16 mode_glb, Word16 *scales ); -static int16_t decode_indexes_ivas_fx( +static Word16 decode_indexes_ivas_fx( Word16 *index, const Word16 no_bits, const Word16 *p_scales, // Q11 @@ -62,7 +62,7 @@ static int16_t decode_indexes_ivas_fx( ); static Word32 divide_32_32_fx( Word32 y, Word32 x, Word32 *rem ); static Word16 divide_16_16_fx( Word16 y, Word16 x, Word16 *rem ); -static int16_t decode_indexes_ivas_fx( +static Word16 decode_indexes_ivas_fx( Word16 *index, const Word16 no_bits, const Word16 *p_scales, // Q11 @@ -180,6 +180,7 @@ static void make_offset_scale_fx( Word16 i; offset_scale[j][0] = L_deposit_l( 1 ); + move32(); FOR( i = 1; i <= no_scl; i++ ) { offset_scale[j][i] = L_add( offset_scale[j][sub( i, 1 )], tab_no_cv[no_ld[sub( i, 1 )]] ); @@ -239,7 +240,10 @@ decode_indexes_fx( ) { Word32 index1 = 0, index2 = 0; + move32(); + move32(); Word16 len_scales = MAX_NO_SCALES * 2, no_modes; + move16(); Word16 i, im1, idx_scale; Word16 tmp; @@ -264,8 +268,11 @@ decode_indexes_fx( { set16_fx( x_lvq, 0, 2 * LATTICE_DIM ); scales_mslvq[0] = 0; + move16(); scales_mslvq[1] = 0; + move16(); index[i] = 0; + move16(); return 1; } } @@ -290,6 +297,7 @@ decode_indexes_fx( move16(); } scales_mslvq[0] = 0; + move16(); } ELSE { @@ -298,7 +306,9 @@ decode_indexes_fx( /* safety check in case of bit errors */ set16_fx( x_lvq, 0, 2 * LATTICE_DIM ); scales_mslvq[0] = 0; + move16(); scales_mslvq[1] = 0; + move16(); return 1; } @@ -324,6 +334,7 @@ decode_indexes_fx( im1 = sub( i, 1 ); decode_comb_fx( L_sub( index1, table_no_cv_fx[im1] ), x_lvq, im1 ); scales_mslvq[0] = p_scales[mode_glb * len_scales + idx_scale]; + move16(); } /* second subvector */ @@ -365,7 +376,7 @@ decode_indexes_fx( return 0; } -static int16_t decode_indexes_ivas_fx( +static Word16 decode_indexes_ivas_fx( Word16 *index, const Word16 no_bits, const Word16 *p_scales, // Q11 @@ -375,31 +386,29 @@ static int16_t decode_indexes_ivas_fx( Word16 *scales_mslvq /* o: scale values for the decoded MSLVQ LSF codevector Q11*/ ) { - // UWord32 index1 = 0, index2, idx_scale; Word32 index1 = 0, index2, idx_scale; - // uint16_t i; + move32(); Word16 i; - // float scale; - // Word16 scale; Word16 len_scales = i_mult( MAX_NO_SCALES, 2 ); UWord32 offset_scale1[MAX_NO_SCALES + 1], offset_scale2[MAX_NO_SCALES + 1]; - if ( no_bits <= 2 * LEN_INDICE ) /* the third short is not used */ + IF( LE_16( no_bits, 2 * LEN_INDICE ) ) /* the third short is not used */ { index[2] = 0; - if ( no_bits <= LEN_INDICE ) + move16(); + if ( LE_16( no_bits, LEN_INDICE ) ) { index[1] = 0; + move16(); } } /* safety check in case of bit errors */ - for ( i = 0; i < 3; i++ ) + FOR( i = 0; i < 3; i++ ) { - if ( index[i] < 0 ) + IF( index[i] < 0 ) { - // set_f(x_lvq, 0.0f, 2 * LATTICE_DIM); set_s( x_lvq, 0, 2 * LATTICE_DIM ); #ifdef MSAN_FIX scales_mslvq[0] = 0; @@ -414,22 +423,22 @@ static int16_t decode_indexes_ivas_fx( create_offset( offset_scale1, offset_scale2, mode_glb, prediction_flag ); /* first subvector */ - if ( offset_scale2[MAX_NO_SCALES - 1] > 0 ) + IF( offset_scale2[MAX_NO_SCALES - 1] > 0 ) { - // divide_64_32(index, offset_scale2[MAX_NO_SCALES], &index1, &index2); divide_64_32_fx( index, offset_scale2[MAX_NO_SCALES], &index1, &index2 ); } - else + ELSE { index1 = (UWord32) ( index[0] ); /* this is for very low bitrates, so there is no loss in truncation */ + move32(); index2 = 0; + move32(); } - if ( index1 == 0 ) + IF( index1 == 0 ) { - for ( i = 0; i < LATTICE_DIM; i++ ) + FOR( i = 0; i < LATTICE_DIM; i++ ) { - // x_lvq[i] = 0.0; x_lvq[i] = 0; #ifdef MSAN_FIX scales_mslvq[0] = 0; @@ -437,12 +446,11 @@ static int16_t decode_indexes_ivas_fx( #endif } } - else + ELSE { - if ( index1 >= (Word32) offset_scale1[MAX_NO_SCALES] ) + IF( GE_32( index1, (Word32) offset_scale1[MAX_NO_SCALES] ) ) { /* safety check in case of bit errors */ - // set_f(x_lvq, 0.0f, 2 * LATTICE_DIM); set_s( x_lvq, 0, 2 * LATTICE_DIM ); #ifdef MSAN_FIX scales_mslvq[0] = 0; @@ -455,23 +463,25 @@ static int16_t decode_indexes_ivas_fx( /* find idx_scale */ i = 1; - while ( (int16_t) i <= MAX_NO_SCALES && index1 >= (Word32) offset_scale1[i] ) + test(); + WHILE( LE_16( (Word16) i, MAX_NO_SCALES ) && GE_32( index1, (Word32) offset_scale1[i] ) ) { i++; } idx_scale = i - 1; - index1 -= offset_scale1[idx_scale]; + index1 = L_sub( index1, offset_scale1[idx_scale] ); /* find idx_leader */ i = 1; - while ( index1 >= (Word32) table_no_cv[i] ) + move16(); + WHILE( GE_32( index1, (Word32) table_no_cv[i] ) ) { i++; } - // decode_comb((Word32)(index1 - table_no_cv[i - 1]), x_lvq, i - 1); decode_comb_fx( (Word32) ( index1 - table_no_cv[i - 1] ), x_lvq, i - 1 ); scales_mslvq[0] = p_scales[mode_glb * len_scales + idx_scale]; + move16(); // for (i = 0; i < LATTICE_DIM; i++) //{ // //x_lvq[i] *= scale; @@ -480,40 +490,44 @@ static int16_t decode_indexes_ivas_fx( } /* second subvector */ - if ( index2 == 0 ) + IF( index2 == 0 ) { - for ( i = LATTICE_DIM; i < 2 * LATTICE_DIM; i++ ) + FOR( i = LATTICE_DIM; i < 2 * LATTICE_DIM; i++ ) { // x_lvq[i] = 0.0; x_lvq[i] = 0; + move16(); } #ifdef MSAN_FIX scales_mslvq[1] = 0; move16(); #endif } - else + ELSE { /* find the index for the scale/truncation */ i = 1; - while ( index2 >= (Word32) offset_scale2[i] ) + move16(); + WHILE( GE_32( index2, (Word32) offset_scale2[i] ) ) { i++; } idx_scale = i - 1; - index2 -= offset_scale2[idx_scale]; + move16(); + index2 = L_sub( index2, offset_scale2[idx_scale] ); /* find the index of the leader vector */ i = 1; - while ( index2 >= (Word32) table_no_cv[i] ) + move16(); + WHILE( GE_32( index2, (Word32) table_no_cv[i] ) ) { i++; } - // decode_comb((Word32)(index2 - table_no_cv[i - 1]), &x_lvq[LATTICE_DIM], i - 1); decode_comb_fx( (Word32) ( index2 - table_no_cv[i - 1] ), &x_lvq[LATTICE_DIM], i - 1 ); scales_mslvq[1] = p_scales[mode_glb * len_scales + MAX_NO_SCALES + idx_scale]; + move16(); // for (i = LATTICE_DIM; i < 2 * LATTICE_DIM; i++) //{ // //x_lvq[i] *= scale; @@ -629,28 +643,26 @@ Word16 deindex_lvq_ivas_fx( IF( EQ_16( sf_flag, 1 ) ) { - // mode_glb = add(offset_lvq_modes_SN_fx[mode], offset_in_lvq_mode_SN_fx[mode][sub(no_bits, min_lat_bits_SN_fx[mode])]); - if ( mode < 6 ) /* for NB */ + IF( LT_16( mode, 6 ) ) /* for NB */ { - mode_glb = offset_lvq_modes_SN[mode] + offset_in_lvq_mode_SN[mode][no_bits - min_lat_bits_SN[mode]]; + mode_glb = add( offset_lvq_modes_SN[mode], offset_in_lvq_mode_SN[mode][sub( no_bits, min_lat_bits_SN[mode] )] ); } - else + ELSE { - mode_glb = offset_lvq_modes_SN[mode] + no_bits - min_lat_bits_SN[mode]; /* there is granularity of 1 bit */ + mode_glb = add( offset_lvq_modes_SN[mode], sub( no_bits, min_lat_bits_SN[mode] ) ); /* there is granularity of 1 bit */ } p_scales = &scales_ivas_fx[0][0]; // Q11 move16(); } ELSE { - // mode_glb = add(offset_lvq_modes_pred_fx[mode], offset_in_lvq_mode_pred_fx[mode][sub(no_bits,min_lat_bits_pred_fx[mode])]); - if ( ( mode < 6 ) || ( mode == 12 ) ) /* for NB */ + IF( ( LT_16( mode, 6 ) ) || ( EQ_16( mode, 12 ) ) ) /* for NB */ { - mode_glb = offset_lvq_modes_pred[mode] + offset_in_lvq_mode_pred[mode][no_bits - min_lat_bits_pred[mode]]; + mode_glb = add( offset_lvq_modes_pred[mode], offset_in_lvq_mode_pred[mode][sub( no_bits, min_lat_bits_pred[mode] )] ); } - else + ELSE { - mode_glb = offset_lvq_modes_pred[mode] + no_bits - min_lat_bits_pred[mode]; + mode_glb = add( offset_lvq_modes_pred[mode], sub( no_bits, min_lat_bits_pred[mode] ) ); } p_scales = &scales_p_ivas_fx[0][0]; // Q11 move16(); @@ -678,6 +690,7 @@ Word16 deindex_lvq_ivas_fx( /* Increase calculation accuracy by shifting more to the left and using rounding instead of truncation*/ L_tmp = L_shl( Mult_32_16( L_tmp, shl( sigma_MSLVQ_fx[mode][i], 3 ) ), 15 ); /* Q13 + Q2 +x2.56 -Q15 */ x_lvq[i] = round_fx( L_tmp ); + move16(); } } IF( scales_mslvq[1] ) @@ -687,6 +700,7 @@ Word16 deindex_lvq_ivas_fx( L_tmp = L_mult( x_lvq[i], scales_mslvq[1] ); /* Q1+Q11+Q1 = Q13 */ L_tmp = L_shl( Mult_32_16( L_tmp, shl( sigma_MSLVQ_fx[mode][i], 3 ) ), 15 ); /* Q13 + Q2 +x2.56 -Q15 */ x_lvq[i] = round_fx( L_tmp ); + move16(); } } } @@ -700,6 +714,7 @@ Word16 deindex_lvq_ivas_fx( L_tmp = L_mult( x_lvq[i], scales_mslvq[0] ); /* Q1+Q11+Q1 = Q13 */ L_tmp = L_shl( Mult_32_16( L_tmp, shl( sigma_p_ivas_fx[mode][i], 3 ) ), 15 ); /* Q13 + Q2 +x2.56 -Q15 */ x_lvq[i] = round_fx( L_tmp ); + move16(); } } IF( scales_mslvq[1] ) @@ -709,6 +724,7 @@ Word16 deindex_lvq_ivas_fx( L_tmp = L_mult( x_lvq[i], scales_mslvq[1] ); /* Q1+Q11+Q1 = Q13 */ L_tmp = L_shl( Mult_32_16( L_tmp, shl( sigma_p_ivas_fx[mode][i], 3 ) ), 15 ); /* Q13 + Q2 +x2.56 -Q15 */ x_lvq[i] = round_fx( L_tmp ); + move16(); } } } @@ -757,12 +773,14 @@ Word16 deindex_lvq_cng_fx( L_tmp = L_mult( x_lvq[i], scales_mslvq[0] ); /* Q1+Q11+Q1 = Q13 */ L_tmp = L_shl( Mult_32_16( L_tmp, shl( sigma_MSLVQ_fx[mode][i], 3 ) ), 15 ); /* Q13 + Q2 +x2.56 -Q15 */ x_lvq[i] = round_fx( L_tmp ); + move16(); } FOR( i = LATTICE_DIM; i < 2 * LATTICE_DIM; i++ ) { L_tmp = L_mult( x_lvq[i], scales_mslvq[1] ); /* Q1+Q11+Q1 = Q13 */ L_tmp = L_shl( Mult_32_16( L_tmp, shl( sigma_MSLVQ_fx[mode][i], 3 ) ), 15 ); /* Q13 + Q2 +x2.56 -Q15 */ x_lvq[i] = round_fx( L_tmp ); + move16(); } /* check if permutting needed */ @@ -815,12 +833,14 @@ Word16 deindex_lvq_cng_ivas_fx( L_tmp = L_mult( x_lvq[i], scales_mslvq[0] ); /* Q1+Q11+Q1 = Q13 */ L_tmp = L_shl( Mult_32_16( L_tmp, shl( sigma_MSLVQ_fx[mode][i], 3 ) ), 15 ); /* Q13 + Q2 +x2.56 -Q15 */ x_lvq[i] = round_fx( L_tmp ); + move16(); } FOR( i = LATTICE_DIM; i < 2 * LATTICE_DIM; i++ ) { L_tmp = L_mult( x_lvq[i], scales_mslvq[1] ); /* Q1+Q11+Q1 = Q13 */ L_tmp = L_shl( Mult_32_16( L_tmp, shl( sigma_MSLVQ_fx[mode][i], 3 ) ), 15 ); /* Q13 + Q2 +x2.56 -Q15 */ x_lvq[i] = round_fx( L_tmp ); + move16(); } /* check if permutting needed */ @@ -1248,29 +1268,31 @@ void deindex_lvq_SHB_fx( { /* create offsets */ offsets[0] = 0; + move32(); FOR( i = 0; i < MAX_NO_SCALES; i++ ) { offsets[i + 1] = table_no_cv[p_no_lead[i]] + offsets[i]; + move32(); } /* find idx_scale */ idx_scale = 0; WHILE( (Word16) i <= MAX_NO_SCALES && index >= offsets[idx_scale] ) { - idx_scale++; + idx_scale = add( idx_scale, 1 ); } - idx_scale--; - index -= offsets[idx_scale]; + idx_scale = sub( idx_scale, 1 ); + index = L_sub( index, offsets[idx_scale] ); /* find idx_leader */ i = 1; - WHILE( index > table_no_cv[i] ) + WHILE( GT_32( index, table_no_cv[i] ) ) { - i++; + i = add( i, 1 ); } - i = i - 1; + i = sub( i, 1 ); - decode_comb_fx( (Word32) ( index - table_no_cv[i] - 1 ), out, i ); + decode_comb_fx( (Word32) ( L_sub( L_sub( index, table_no_cv[i] ), 1 ) ), out, i ); scale = p_scales[idx_scale]; FOR( i = 0; i < LATTICE_DIM; i++ ) diff --git a/lib_com/nelp_fx.c b/lib_com/nelp_fx.c index 841280fa006e5958f5847a6f2df847be3fe36c60..f0420e3dbf30cbd1cd9bd0c2bd74bec7b429285b 100644 --- a/lib_com/nelp_fx.c +++ b/lib_com/nelp_fx.c @@ -71,7 +71,9 @@ Word16 dequantize_uvg_fx( Word16 frac, exp, sc; Word32 L_tmp; Word16 Q_gain = 0; + move16(); + test(); IF( EQ_16( bwidth_fx, NB ) ) { UVG1CB = UVG1CB_NB_FX; @@ -92,6 +94,7 @@ Word16 dequantize_uvg_fx( move16(); } + test(); IF( !do_scale ) { sc = 11; @@ -126,6 +129,7 @@ Word16 dequantize_uvg_fx( frac = L_Extract_lc( L_tmp, &exp ); frac = extract_l( Pow2( 14, frac ) ); G[i * 5 + k] = round_fx( L_shl( L_mult( frac, UVG2CB1[iG2[i]][k] ), exp - sc ) ); /* Q0 */ + move16(); } ELSE IF( EQ_16( i, 1 ) ) { @@ -134,6 +138,7 @@ Word16 dequantize_uvg_fx( frac = L_Extract_lc( L_tmp, &exp ); frac = extract_l( Pow2( 14, frac ) ); G[i * 5 + k] = round_fx( L_shl( L_mult( frac, UVG2CB2[iG2[i]][k] ), exp - sc ) ); /* Q0 */ + move16(); } } } @@ -235,6 +240,7 @@ void generate_nelp_excitation_fx( L16 = mult_r( L16, 0x6EDA ); /* Q13 */ output[i * 25 + I[j]] = round_fx( L_shl( L_mult( L16, Gains[i] ), 2 ) ); /* Q_exc */ + move16(); } FOR( ; j < len; j++ ) { diff --git a/lib_com/phase_dispersion_fx.c b/lib_com/phase_dispersion_fx.c index 5a1c3d5108b0f3748e0c53e84bcfab0e317ccbe1..74ae7708c645fb5e067e09b8aab574f80b17cbd6 100644 --- a/lib_com/phase_dispersion_fx.c +++ b/lib_com/phase_dispersion_fx.c @@ -110,6 +110,7 @@ void phase_dispersion( FOR( i = 0; i < L_subfr; i++ ) { x32[i] = L_deposit_h( code[i] ); + move32(); } BASOP_rfft( x32, L_subfr, &j, -1 ); diff --git a/lib_com/pred_lt4_fx.c b/lib_com/pred_lt4_fx.c index 7047d643f596decc0ff942cc3533d7517ef4f90c..a6672c2b221e24e4768449b60f2653ec8cf061fe 100644 --- a/lib_com/pred_lt4_fx.c +++ b/lib_com/pred_lt4_fx.c @@ -164,6 +164,7 @@ void pred_lt4_tc_fx( #ifdef BASOP_NOGLOB L_sum = L_shl_o( L_sum, 1, &Overflow ); /*Q0h */ excO[j] = round_fx_o( L_sum, &Overflow ); + move16(); #else L_sum = L_shl( L_sum, 1 ); /*Q0h */ diff --git a/lib_com/preemph.c b/lib_com/preemph.c index 89064782f79ea2282394d32d37669a41bb53ad77..decc73f999c246123c1b9bc99dba3302e874d118 100644 --- a/lib_com/preemph.c +++ b/lib_com/preemph.c @@ -85,13 +85,17 @@ void preemph_ivas_fx( Word32 temp; temp = signal[L - 1]; + move32(); FOR( i = L - 1; i > 0; i-- ) { signal[i] = L_sub( signal[i], Mpy_32_16_1( signal[i - 1], mu ) ); + move32(); } signal[0] = L_sub( signal[0], Mpy_32_16_1( *mem, mu ) ); + move32(); *mem = temp; + move32(); return; } diff --git a/lib_com/preemph_fx.c b/lib_com/preemph_fx.c index 21dd047ce330a9e6c07b0710fc45c4b06608d12b..e610e9fd784e70c861195804ace9161d905b2275 100644 --- a/lib_com/preemph_fx.c +++ b/lib_com/preemph_fx.c @@ -66,6 +66,7 @@ void E_UTIL_f_preemph2( Word16 shift, Word16 *signal, const Word16 mu, const Wor Word32 L_tmp; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; + move32(); #endif temp = signal[lg - 1]; move16(); @@ -77,6 +78,7 @@ void E_UTIL_f_preemph2( Word16 shift, Word16 *signal, const Word16 mu, const Wor L_tmp = L_msu0_o( L_tmp, signal[i - 1], mu, &Overflow ); L_tmp = L_shl_o( L_tmp, add( shift, 1 ), &Overflow ); signal[i] = round_fx_o( L_tmp, &Overflow ); + move16(); #else L_tmp = L_msu0( L_tmp, signal[i - 1], mu ); L_tmp = L_shl( L_tmp, add( shift, 1 ) ); @@ -89,6 +91,7 @@ void E_UTIL_f_preemph2( Word16 shift, Word16 *signal, const Word16 mu, const Wor L_tmp = L_msu0_o( L_tmp, *mem, mu, &Overflow ); L_tmp = L_shl_o( L_tmp, add( shift, 1 ), &Overflow ); signal[0] = round_fx_o( L_tmp, &Overflow ); + move16(); #else L_tmp = L_msu0( L_tmp, *mem, mu ); L_tmp = L_shl( L_tmp, add( shift, 1 ) ); @@ -143,13 +146,14 @@ Word16 E_UTIL_f_preemph3( Word16 *signal, const Word16 mu, const Word16 lg, Word L_tmp = L_msu( L_tmp, signal[i - 1], mus ); L_tmp = L_shl( L_tmp, Q_new ); signal[i] = round_fx( L_tmp ); + move16(); } L_tmp = L_mult( signal[0], QVal ); L_tmp = L_msu( L_tmp, *mem, mus ); L_tmp = L_shl( L_tmp, Q_new ); signal[0] = round_fx( L_tmp ); - + move16(); *mem = tmp_fixed; move16(); diff --git a/lib_com/pvq_com_fx.c b/lib_com/pvq_com_fx.c index fe4842a05a4eb634bc79781832eb12c63a0ac637..2a7e9a8ecdabb3544f45d50353e2d5688ca32780 100644 --- a/lib_com/pvq_com_fx.c +++ b/lib_com/pvq_com_fx.c @@ -55,16 +55,21 @@ static void nearProjQ15_fx( ) { const Word16 a[4] = { 14967, -25518, 3415, 32351 }; + move16(); + move16(); + move16(); + move16(); Word32 b; UWord16 lsb; b = L_deposit_l( a[0] ); - b = L_shl( (Word32) add( a[1], extract_h( L_mult0( (Word16) b, x ) ) ), 1 ); + b = L_shl( L_deposit_l( add( a[1], extract_h( L_mult0( extract_l( b ), x ) ) ) ), 1 ); Mpy_32_16_ss( b, x, &b, &lsb ); - b = L_add( (Word32) a[2], b ); + b = L_add( L_deposit_l( a[2] ), b ); Mpy_32_16_ss( b, x, &b, &lsb ); - b = L_add( (Word32) a[3], b ); + b = L_add( L_deposit_l( a[3] ), b ); *result = extract_l( b ); + move16(); return; } @@ -82,13 +87,14 @@ void obtainEnergyQuantizerDensity_fx( Word16 Rnrg, den, n; den = sub( shl( L, 1 ), 1 ); - IF( den <= 67 ) + IF( LE_16( den, 67 ) ) { Rnrg = extract_l( intLimCDivPos_fx( L_deposit_l( R ), den ) ); } ELSE { n = norm_s( den ); + move16(); Rnrg = shr( div_s( R, shl( den, n ) ), sub( 15, n ) ); } Rnrg = add( Rnrg, 28 ); @@ -98,6 +104,7 @@ void obtainEnergyQuantizerDensity_fx( Rnrg = s_max( Rnrg, 3 ); *Density = obtainEnergyQuantizerDensity_f[Rnrg]; + move16(); return; } @@ -113,6 +120,7 @@ void dsDirac2Dirac_fx( ) { *diracs = dsDiracsTab[dsDiracIndex]; + move16(); return; } @@ -132,17 +140,17 @@ void dsDiracPerQuanta_fx( sv = frQuanta[td]; nsv = sv[0]; - + move16(); t_quanta_o = sub( t_quanta, QUANTAQ3OFFSET ); - IF( GE_16( t_quanta_o, sv[nsv] ) ) + if ( GE_16( t_quanta_o, sv[nsv] ) ) { *DsIdx = nsv; move16(); return; } - IF( LE_16( t_quanta_o, sv[1] ) ) + if ( LE_16( t_quanta_o, sv[1] ) ) { *DsIdx = 1; move16(); @@ -151,11 +159,11 @@ void dsDiracPerQuanta_fx( dsIndex = shl( 1, frQuanta[0][td] ); - if ( GT_16( t_quanta_o, sv[shr( nsv, 1 )] ) ) + IF( GT_16( t_quanta_o, sv[shr( nsv, 1 )] ) ) { dsIndex = sub( nsv, dsIndex ); } - FOR( i = sub( frQuanta[0][td], 1 ); i >= 0; i-- ) + FOR( i = frQuanta[0][td] - 1; i >= 0; i-- ) { dsIndex = add( dsIndex, shl( sub( shl( lshr( sub( sv[dsIndex], t_quanta_o ), 15 ), 1 ), 1 ), i ) ); } @@ -163,13 +171,14 @@ void dsDiracPerQuanta_fx( dsIndex = add( dsIndex, lshr( sub( sv[dsIndex], t_quanta_o ), 15 ) ); dsIndex = sub( dsIndex, lshr( sub( 1, dsIndex ), 15 ) ); - IF( EQ_16( dsm, PVQ_CONS ) ) + if ( EQ_16( dsm, PVQ_CONS ) ) { *DsIdx = dsIndex; move16(); return; } *DsIdx = add( dsIndex, lshr( sub( add( sv[add( dsIndex, 1 )], sv[dsIndex] ), shl( t_quanta_o, 1 ) ), 15 ) ); + move16(); return; } @@ -188,6 +197,7 @@ void QuantaPerDsDirac_fx( move16(); } *Quanta = add( *Quanta, QUANTAQ3OFFSET ); + move16(); return; } @@ -212,7 +222,7 @@ void conservativeL1Norm_fx( frQuantaL = hBitsN[L]; *Qreservplus = add( Qreserv, sub( Qvec, QUANTAQ3OFFSET ) ); - + move16(); dsDiracPerQuanta_fx( L, Qvec, Fcons, hBitsN, &Minit ); Mprime = Minit; @@ -222,6 +232,7 @@ void conservativeL1Norm_fx( Qtestminus = (short) frQuantaL[Mprime]; move16(); *Qspare = sub( Qavail, Qtestminus ); + move16(); Mprime = sub( Mprime, 1 ); } WHILE( ( Mprime >= 0 ) && LT_16( *Qspare, QUANTAQ3OFFSET ) ); @@ -229,12 +240,16 @@ void conservativeL1Norm_fx( if ( Mprime < 0 ) { *Qspare = add( Qavail, QUANTAQ3OFFSET ); /* single op */ + move16(); } dsDirac2Dirac_fx( add( Mprime, 1 ), Dvec ); *Dspecplus = add( Dspec, *Dvec ); + move16(); *Qreservplus = sub( *Qreservplus, (short) frQuantaL[Minit] ); + move16(); *Qspare = sub( *Qspare, QUANTAQ3OFFSET ); + move16(); return; } @@ -265,17 +280,23 @@ void bandBitsAdjustment_fx( L_tmp = L_deposit_l( sub( Breserv, Bff ) ); Btemp = extract_l( intLimCDivSigned_fx( L_tmp, s_min( D, 3 ) ) ); /* result always fits in Word16 */ *Breservplus = add( Bband, Breserv ); + move16(); } ELSE { Btemp = 0; move16(); *Breservplus = add( Bband, Bff ); + move16(); } *Bband_adj = s_min( extract_l( L_mult( L, 40 ) ), Bband ); + move16(); *Brem = sub( Bavail, Bff ); + move16(); *Bband_adj = s_min( *Brem, add( *Bband_adj, Btemp ) ); + move16(); *Bband_adj = s_max( 0, *Bband_adj ); + move16(); return; } @@ -315,6 +336,7 @@ static void Ratio_rQ3_fx( tmp = add( 1 << 7, Ratio_base2Q11_fx( opp, near ) ); *result = shr( tmp, 8 ); + move16(); return; } @@ -331,6 +353,7 @@ void densityAngle2RmsProjDec_fx( Word16 oppTail, nearTail; phiQ14q = (Word16) intLimCDivPos_fx( L_shl( L_deposit_l( indexphi ), 13 ), shr( D, 1 ) ); + move16(); if ( indexphi < 0 ) { phiQ14q = 1 << 13; /* one op */ @@ -343,8 +366,11 @@ void densityAngle2RmsProjDec_fx( IF( s_or( oppTail, nearTail ) < 0 ) { *oppQ15 = s_and( oppTail, ( 1 << 15 ) - 1 ); + move16(); *nearQ15 = s_and( nearTail, ( 1 << 15 ) - 1 ); + move16(); *oppRatioQ3 = shl( add( 1, shl( nearTail, 1 ) ), 14 ); + move16(); } ELSE { @@ -366,6 +392,7 @@ void densityAngle2RmsProjEnc_fx( ) { *indexphi = mult_r( shl( D, 1 ), phiQ14uq ); + move16(); if ( s_and( D, 1 ) > 0 ) { *indexphi = -1; /* one op */ @@ -409,7 +436,7 @@ void NearOppSplitAdjustment_fx( move16(); IF( GT_16( Nhead, 1 ) ) { - qavg = extract_h( L_shl( intLimCDivSigned_fx( (Word32) qboth, Np ), 16 ) ); /* qboth may be negative */ + qavg = extract_h( L_shl( intLimCDivSigned_fx( L_deposit_l( qboth ), Np ), 16 ) ); /* qboth may be negative */ dsDiracPerQuanta_fx( Ntail, qavg, FlagCons, hBitsN, &Midx ); QuantaPerDsDirac_fx( Nhead, Midx, hBitsN, &qmin ); qskew = sub( qavg, qmin ); @@ -425,6 +452,7 @@ void NearOppSplitAdjustment_fx( L_QIb = (Word32) intLimCDivPos_fx( L_qnum, QIa ); } *qnear = qboth; + move16(); #ifdef BASOP_NOGLOB QIb = extract_h( L_shl_o( L_QIb, 16, &Overflow ) ); /* may saturate */ #else @@ -433,9 +461,12 @@ void NearOppSplitAdjustment_fx( if ( LE_16( QIb, qboth ) ) { *qnear = QIb; + move16(); } *qopp = sub( qboth, *qnear ); + move16(); *qglobalupd = sub( qglobal, sub( qac, qzero ) ); + move16(); return; } @@ -462,7 +493,7 @@ void apply_gain_fx( FOR( band = 0; band < num_sfm; band++ ) { g = gains[ord[band]]; - + move16(); FOR( i = band_start[band]; i < band_end[band]; i++ ) { /*xq[i] *= g; */ @@ -500,11 +531,13 @@ void fine_gain_quant_fx( UWord16 lsb; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; + move32(); #endif FOR( band = 0; band < num_sfm; band++ ) { gbits = gain_bits[ord[band]]; + move16(); test(); IF( fg_pred[band] != 0 && gbits > 0 ) { @@ -539,6 +572,7 @@ void fine_gain_quant_fx( L_tmp = L_mult0( fg_pred[band], tmp1 ); /*12+exp1 */ fg_pred[band] = round_fx( L_shl( L_tmp, sub( 16, exp1 ) ) ); /*12+exp1+16-exp1-16=12 */ + move16(); } } diff --git a/lib_com/range_com_fx.c b/lib_com/range_com_fx.c index 4fb29bd5883446d5ed6433dcb0545554ce64eb06..0b46d73359df1e3dd8f21d53ad9c87138e1ba06f 100644 --- a/lib_com/range_com_fx.c +++ b/lib_com/range_com_fx.c @@ -48,6 +48,7 @@ void rangeCoderFinalizationFBits_fx( if ( x >= 0 ) { L_Bq15 = (Word32) UL_lshr( INTrc, x ); + move32(); } E = 2; @@ -58,10 +59,12 @@ void rangeCoderFinalizationFBits_fx( UL_tmp = UL_lshl( UL_deposit_l( Bq15ui16 ), 1 ); Mpy_32_16_uu( UL_tmp, Bq15ui16, &h, &l ); L_Bq15 = (Word32) h; + move32(); E = add( shl( B, 1 ), extract_l( L_lshr( L_sub( ( ( 1L << 16 ) - 1L ), L_Bq15 ), 31 ) ) ); B = E; move16(); } *FBits = sub( *FBits, B ); + move16(); return; } diff --git a/lib_com/residu.c b/lib_com/residu.c index 0f1cdb33d645c5aea8fff65a18e9aaf95466032b..2a3ad964dec02f3f27063c67509577323bd961a7 100644 --- a/lib_com/residu.c +++ b/lib_com/residu.c @@ -87,16 +87,18 @@ void residu_ivas_fx( ) { Word32 s; - int16_t i, j; + Word16 i, j; - for ( i = 0; i < l; i++ ) + FOR( i = 0; i < l; i++ ) { s = x[i]; - for ( j = 1; j <= m; j++ ) + move32(); + FOR( j = 1; j <= m; j++ ) { - s = L_add( s, L_shl( Mpy_32_16_1( x[i - j], a[j] ), Q15 - a_exp ) ); + s = L_add( s, L_shl( Mpy_32_16_1( x[sub( i, j )], a[j] ), sub( Q15, a_exp ) ) ); } y[i] = s; + move32(); } return; diff --git a/lib_com/trans_inv_fx.c b/lib_com/trans_inv_fx.c index 2cc68314e210f41d6f483d0962da57b0ea3dd0b0..70746dba9196e5e2f26a9f06a239f1c5d2856732 100644 --- a/lib_com/trans_inv_fx.c +++ b/lib_com/trans_inv_fx.c @@ -104,7 +104,7 @@ void preecho_sb_fx( framelength_m1 = sub( framelength, 1 ); nb_flag = 0; move16(); - if ( EQ_16( bwidth, NB ) ) + if ( ( bwidth == NB ) ) { nb_flag = 1; move16(); diff --git a/lib_dec/acelp_core_switch_dec_fx.c b/lib_dec/acelp_core_switch_dec_fx.c index 31af985cbddfb2e7b1c9e507c1243b315b2070e7..76b8b8ed23a1cfca50c008502fd99089ae63321e 100644 --- a/lib_dec/acelp_core_switch_dec_fx.c +++ b/lib_dec/acelp_core_switch_dec_fx.c @@ -52,6 +52,7 @@ ivas_error acelp_core_switch_dec_fx( ivas_error error; error = IVAS_ERR_OK; + move32(); FOR( i = 0; i < CLDFB_NO_COL_MAX_SWITCH; i++ ) { @@ -72,7 +73,7 @@ ivas_error acelp_core_switch_dec_fx( Copy( st_fx->old_Aq_12_8_fx, Aq, M + 1 ); Copy( st_fx->old_Aq_12_8_fx, Aq + ( M + 1 ), M + 1 ); - set16_fx( mem_synth, 0, add( NS2SA( 16000, DELAY_CLDFB_NS ), 2 ) ); + set16_fx( mem_synth, 0, NS2SA( 16000, DELAY_CLDFB_NS ) + 2 ); set16_fx( synth_subfr_out, 0, SWITCH_MAX_GAP ); /* avoid valgrind complaining about uninitialized memory in core_switching_OLA_fx() */ /* set multiplication factor according to the sampling rate */ @@ -90,7 +91,7 @@ ivas_error acelp_core_switch_dec_fx( test(); test(); test(); - IF( core_switching_flag && EQ_16( st_fx->last_L_frame, st_fx->last_L_frame_ori ) && ( ( EQ_16( st_fx->last_core, ACELP_CORE ) ) || ( EQ_16( st_fx->last_core, AMR_WB_CORE ) ) ) ) + IF( core_switching_flag && EQ_16( st_fx->last_L_frame, st_fx->last_L_frame_ori ) && ( ( ( st_fx->last_core == ACELP_CORE ) ) || ( EQ_16( st_fx->last_core, AMR_WB_CORE ) ) ) ) { exc = old_exc + L_EXC_MEM_DEC; Copy( st_fx->old_exc_fx, old_exc, L_EXC_MEM_DEC ); /*scaling of exc from previous frame*/ @@ -139,7 +140,7 @@ ivas_error acelp_core_switch_dec_fx( Rescale_mem( st_fx->Q_exc, &st_fx->prev_Q_syn, &st_fx->Q_syn, st_fx->mem_syn2_fx, st_fx->mem_syn_clas_estim_fx, 4, &st_fx->mem_deemph_fx, hBPF->pst_old_syn_fx, &hBPF->pst_mem_deemp_err_fx, &st_fx->agc_mem_fx[1], st_fx->hPFstat, 1, 0, NULL ); - syn_12k8_fx( shl( L_SUBFR, 1 ), Aq, exc, synth_intFreq, st_fx->mem_syn2_fx, 1, st_fx->Q_exc, st_fx->Q_syn ); + syn_12k8_fx( 2 * L_SUBFR, Aq, exc, synth_intFreq, st_fx->mem_syn2_fx, 1, st_fx->Q_exc, st_fx->Q_syn ); IF( st_fx->hPFstat->on && ( EQ_16( st_fx->last_bwidth, NB ) ) ) { @@ -150,20 +151,20 @@ ivas_error acelp_core_switch_dec_fx( pitch_buf_tmp[i] = L_SUBFR; move16(); } - nb_post_filt_fx( shl( L_SUBFR, 1 ), st_fx->hPFstat, &tmp_noise, 0, synth_intFreq, Aq, pitch_buf_tmp, AUDIO, st_fx->BER_detect, 0 ); + nb_post_filt_fx( 2 * L_SUBFR, st_fx->hPFstat, &tmp_noise, 0, synth_intFreq, Aq, pitch_buf_tmp, AUDIO, st_fx->BER_detect, 0 ); } IF( EQ_16( L_frame_for_cs, L_FRAME ) ) { - deemph_fx( synth_intFreq, PREEMPH_FAC, shl( L_SUBFR, 1 ), &( st_fx->mem_deemph_fx ) ); + deemph_fx( synth_intFreq, PREEMPH_FAC, 2 * L_SUBFR, &( st_fx->mem_deemph_fx ) ); } ELSE { - deemph_fx( synth_intFreq, PREEMPH_FAC_16k, shl( L_SUBFR, 1 ), &( st_fx->mem_deemph_fx ) ); + deemph_fx( synth_intFreq, PREEMPH_FAC_16k, 2 * L_SUBFR, &( st_fx->mem_deemph_fx ) ); } - unscale_AGC( synth_intFreq, st_fx->Q_syn, syn_fx_tmp + M, st_fx->agc_mem_fx, shl( L_SUBFR, 1 ) ); - Copy( syn_fx_tmp + M, synth_intFreq, shl( L_SUBFR, 1 ) ); + unscale_AGC( synth_intFreq, st_fx->Q_syn, syn_fx_tmp + M, st_fx->agc_mem_fx, 2 * L_SUBFR ); + Copy( syn_fx_tmp + M, synth_intFreq, 2 * L_SUBFR ); test(); IF( st_fx->hPFstat->on && ( NE_16( st_fx->last_bwidth, NB ) ) ) @@ -173,16 +174,16 @@ ivas_error acelp_core_switch_dec_fx( Residu3_fx( Aq, bpf_error_signal + M, exc, L_SUBFR, 1 ); E_UTIL_synthesis( 1, Aq, exc, bpf_error_signal, L_SUBFR, st_fx->hPFstat->mem_stp + L_SYN_MEM - M, 0, M ); scale_st_fx( synth_intFreq, bpf_error_signal, &st_fx->hPFstat->gain_prec, L_SUBFR ); - Copy( bpf_error_signal, synth_intFreq, shr( L_SUBFR, 1 ) ); - blend_subfr2_fx( bpf_error_signal + shr( L_SUBFR, 1 ), synth_intFreq + shr( L_SUBFR, 1 ), synth_intFreq + shr( L_SUBFR, 1 ) ); + Copy( bpf_error_signal, synth_intFreq, L_SUBFR / 2 ); + blend_subfr2_fx( bpf_error_signal + L_SUBFR / 2, synth_intFreq + L_SUBFR / 2, synth_intFreq + L_SUBFR / 2 ); } st_fx->hPFstat->on = 0; move16(); - IF( NE_16( st_fx->flag_cna, 0 ) ) + IF( st_fx->flag_cna ) { - generate_masking_noise_fx( synth_intFreq, st_fx->Q_syn, st_fx->hFdCngDec->hFdCngCom, shl( L_SUBFR, 1 ), 0 ); + generate_masking_noise_fx( synth_intFreq, st_fx->Q_syn, st_fx->hFdCngDec->hFdCngCom, 2 * L_SUBFR, 0 ); } /*----------------------------------------------------------------* @@ -190,11 +191,11 @@ ivas_error acelp_core_switch_dec_fx( * Bass post-filter *----------------------------------------------------------------*/ - bass_psfilter_fx( st_fx->hBPF, st_fx->Opt_AMR_WB, synth_intFreq, shl( L_SUBFR, 1 ), NULL, + bass_psfilter_fx( st_fx->hBPF, st_fx->Opt_AMR_WB, synth_intFreq, 2 * L_SUBFR, NULL, st_fx->bpf_off, st_fx->stab_fac_fx, &st_fx->stab_fac_smooth_fx, GENERIC, st_fx->Q_syn, bpf_error_signal ); - IF( ( error = cldfb_save_memory( st_fx->cldfbAna ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = cldfb_save_memory( st_fx->cldfbAna ) ), IVAS_ERR_OK ) ) { return error; } @@ -207,13 +208,13 @@ ivas_error acelp_core_switch_dec_fx( move16(); /* CLDFB analysis and add the BPF error signal */ - IF( ( error = cldfb_save_memory( st_fx->cldfbBPF ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = cldfb_save_memory( st_fx->cldfbBPF ) ), IVAS_ERR_OK ) ) { return error; } i = 0; move16(); - IF( EQ_16( st_fx->bpf_off, 0 ) ) + if ( st_fx->bpf_off == 0 ) { i = CLDFB_NO_COL_MAX_SWITCH; move16(); @@ -226,7 +227,7 @@ ivas_error acelp_core_switch_dec_fx( scaleFactor.hb_scale = scaleFactor.lb_scale; move16(); - IF( ( error = cldfb_save_memory( st_fx->cldfbSyn ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = cldfb_save_memory( st_fx->cldfbSyn ) ), IVAS_ERR_OK ) ) { return error; } @@ -249,7 +250,9 @@ ivas_error acelp_core_switch_dec_fx( { /* Decoding of BWE */ d1m = (Word16) get_next_indice( st_fx, AUDIODELAYBITS ); + move16(); ind1 = (Word16) get_next_indice( st_fx, NOOFGAINBITS1 ); + move16(); gain = usdequant_fx( ind1, MINVALUEOFFIRSTGAIN_FX, shr( DELTAOFFIRSTGAIN_FX, 3 ) ); /*Q13*/ decode_bwe = 1; move16(); @@ -260,7 +263,7 @@ ivas_error acelp_core_switch_dec_fx( test(); IF( decode_bwe && !( ( EQ_16( output_frame, L_FRAME16k ) && EQ_16( st_fx->last_L_frame, L_FRAME16k ) ) || EQ_16( output_frame, L_FRAME8k ) ) ) { - set16_fx( tmp_mem2, 0, shl( L_FILT48k, 1 ) ); + set16_fx( tmp_mem2, 0, 2 * L_FILT48k ); hp_filter = hp16000_48000_fx; fdelay = 48; @@ -299,7 +302,7 @@ ivas_error acelp_core_switch_dec_fx( /* safety check in case of bit errors */ i = MAX_D1M_16k; move16(); - IF( EQ_16( st_fx->last_L_frame, L_FRAME ) ) + if ( EQ_16( st_fx->last_L_frame, L_FRAME ) ) { i = MAX_D1M_12k8; move16(); @@ -314,7 +317,7 @@ ivas_error acelp_core_switch_dec_fx( move16(); } - i = NS2SA_fx2( st_fx->output_Fs, L_sub( FRAME_SIZE_NS, L_add( ACELP_LOOK_NS, DELAY_BWE_TOTAL_NS ) ) ); + i = NS2SA_fx2( st_fx->output_Fs, FRAME_SIZE_NS - ACELP_LOOK_NS - DELAY_BWE_TOTAL_NS ); move16(); Copy( st_fx->old_synth_sw_fx, hb_synth_tmp, i ); set16_fx( hb_synth_tmp + i, 0, NS2SA_fx2( st_fx->output_Fs, 10000000L ) - i ); @@ -331,6 +334,7 @@ ivas_error acelp_core_switch_dec_fx( { #ifdef BASOP_NOGLOB *pt1++ = round_fx_sat( L_shl_sat( L_mult_sat( ( *pt2++ ), gain ), 2 ) ); + move16(); #else *pt1++ = round_fx( L_shl( L_mult( ( *pt2++ ), gain ), 2 ) ); #endif @@ -391,6 +395,7 @@ ivas_error acelp_core_switch_dec_bfi_fx( hMusicPF = st_fx->hMusicPF; hBPF = st_fx->hBPF; error = IVAS_ERR_OK; + move32(); FOR( i = 0; i < CLDFB_NO_COL_MAX_SWITCH_BFI; i++ ) { @@ -425,8 +430,8 @@ ivas_error acelp_core_switch_dec_bfi_fx( exc2 = old_exc2 + L_EXC_MEM; IF( st_fx->hBWE_TD != NULL ) { - Copy( st_fx->hBWE_TD->old_bwe_exc_fx, old_bwe_exc, shl( PIT16k_MAX, 1 ) ); - bwe_exc = old_bwe_exc + shl( PIT16k_MAX, 1 ); + Copy( st_fx->hBWE_TD->old_bwe_exc_fx, old_bwe_exc, PIT16k_MAX * 2 ); + bwe_exc = old_bwe_exc + PIT16k_MAX * 2; } ELSE { @@ -439,7 +444,7 @@ ivas_error acelp_core_switch_dec_bfi_fx( move16(); /* SC-VBR */ - IF( EQ_16( st_fx->last_nelp_mode_dec, 1 ) ) + if ( EQ_16( st_fx->last_nelp_mode_dec, 1 ) ) { st_fx->nelp_mode_dec = 1; move16(); @@ -568,7 +573,7 @@ ivas_error acelp_core_switch_dec_bfi_fx( * Resamping to the output sampling frequency *----------------------------------------------------------------*/ /* CLDFB analysis of the synthesis at internal sampling rate */ - IF( ( error = cldfb_save_memory( st_fx->cldfbAna ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = cldfb_save_memory( st_fx->cldfbAna ) ), IVAS_ERR_OK ) ) { return error; } @@ -580,7 +585,7 @@ ivas_error acelp_core_switch_dec_bfi_fx( move16(); /* CLDFB synthesis of the combined signal */ - IF( ( error = cldfb_save_memory( st_fx->cldfbSyn ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = cldfb_save_memory( st_fx->cldfbSyn ) ), IVAS_ERR_OK ) ) { return error; } @@ -637,6 +642,7 @@ ivas_error acelp_core_switch_dec_bfi_ivas_fx( hMusicPF = st_fx->hMusicPF; hBPF = st_fx->hBPF; error = IVAS_ERR_OK; + move16(); FOR( i = 0; i < CLDFB_NO_COL_MAX_SWITCH_BFI; i++ ) { @@ -685,7 +691,7 @@ ivas_error acelp_core_switch_dec_bfi_ivas_fx( move16(); /* SC-VBR */ - IF( EQ_16( st_fx->last_nelp_mode_dec, 1 ) ) + if ( EQ_16( st_fx->last_nelp_mode_dec, 1 ) ) { st_fx->nelp_mode_dec = 1; move16(); @@ -815,7 +821,7 @@ ivas_error acelp_core_switch_dec_bfi_ivas_fx( /* CLDFB analysis of the synthesis at internal sampling rate */ Qtmp = sub( 11, st_fx->Q_syn ); Copy_Scale_sig_16_32( syn, syn32, L_FRAME16k, Qtmp ); - IF( ( error = cldfb_save_memory_ivas_fx( st_fx->cldfbAna ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = cldfb_save_memory_ivas_fx( st_fx->cldfbAna ) ), IVAS_ERR_OK ) ) { return error; } @@ -827,7 +833,7 @@ ivas_error acelp_core_switch_dec_bfi_ivas_fx( // scaleFactor.hb_scale = scaleFactor.lb_scale; /* CLDFB synthesis of the combined signal */ - IF( ( error = cldfb_save_memory_ivas_fx( st_fx->cldfbSyn ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = cldfb_save_memory_ivas_fx( st_fx->cldfbSyn ) ), IVAS_ERR_OK ) ) { return error; } @@ -916,7 +922,7 @@ static void decod_gen_voic_core_switch_fx( * Find the adaptive codebook vector. *--------------------------------------------------------------*/ - pred_lt4( &exc[0], &exc[0], T0, T0_frac, add( L_SUBFR, 1 ), pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); + pred_lt4( &exc[0], &exc[0], T0, T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); /*--------------------------------------------------------------* * LP filtering of the adaptive excitation @@ -949,6 +955,7 @@ static void decod_gen_voic_core_switch_fx( /* _ (Word16*) gain_inov : gain of the innovation (used for normalization) (Q12) */ /* _ (Word32*) norm_gain_code : norm. gain of the codebook excitation (Q16) */ st_fx->tilt_code_fx = est_tilt_fx( exc, gain_pit, code, gain_code, &voice_fac, *Q_exc ); /*Q15*/ + move16(); /*----------------------------------------------------------------------* * Find the total excitation @@ -982,6 +989,7 @@ static void decod_gen_voic_core_switch_fx( /*exc2_fx[i+i_subfr] = round_fx(L_tmp);*/ /*Q_exc*/ L_tmp = L_add( L_tmp, L_shl( L_mult( gain_code16, code[i] ), 6 ) ); /*Q16+Q_exc*/ exc[i] = round_fx( L_tmp ); /*Q_exc*/ + move16(); } /*-----------------------------------------------------------------* @@ -994,6 +1002,7 @@ static void decod_gen_voic_core_switch_fx( FOR( i = 0; i < L_SUBFR; i++ ) { ( *pt1 ) = round_fx( L_shl( L_mult( *pt1, gain_pit ), 1 ) ); /*Q_exc + Q14 +1 +1 -16*/ + move16(); pt1++; } diff --git a/lib_dec/amr_wb_dec_fx.c b/lib_dec/amr_wb_dec_fx.c index 616b760937d89250b0b8b6df7da66e7b1335b901..e1ffd2adf57b5ac0245601ea39f5807f5214d433 100644 --- a/lib_dec/amr_wb_dec_fx.c +++ b/lib_dec/amr_wb_dec_fx.c @@ -72,6 +72,7 @@ ivas_error amr_wb_dec_fx( Word8 flag_cna; Word8 waveadj_rec = 0; + move16(); Word16 avoid_lpc_burst_on_recovery; Word16 delta_mem_scale; @@ -155,7 +156,7 @@ ivas_error amr_wb_dec_fx( st_fx->fscale = sr2fscale_fx( st_fx->sr_core ); /* Initialization in case that the first frame is the good received AMR-WB (IO) frame */ - IF( EQ_16( st_fx->ini_frame, 0 ) ) + IF( st_fx->ini_frame == 0 ) { st_fx->last_core = AMR_WB_CORE; move16(); @@ -170,7 +171,7 @@ ivas_error amr_wb_dec_fx( } /* Updates in case of EVS -> AMR-WB IO switching */ - IF( ( error = core_switching_pre_dec_fx( st_fx, output_frame ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = core_switching_pre_dec_fx( st_fx, output_frame ) ), IVAS_ERR_OK ) ) { return error; } @@ -188,7 +189,7 @@ ivas_error amr_wb_dec_fx( Copy( st_fx->old_exc_fx, old_exc_fx, L_EXC_MEM_DEC ); exc_fx = old_exc_fx + L_EXC_MEM_DEC; /* reset post-filter in case of switching */ - IF( EQ_16( st_fx->hPFstat->on, 0 ) ) + if ( st_fx->hPFstat->on == 0 ) { st_fx->hPFstat->reset = 1; move16(); @@ -196,6 +197,7 @@ ivas_error amr_wb_dec_fx( IF( GT_16( st_fx->bfi, 0 ) ) { st_fx->nbLostCmpt = add( st_fx->nbLostCmpt, 1 ); + move16(); } ELSE { @@ -216,6 +218,7 @@ ivas_error amr_wb_dec_fx( FOR( i = 0; i < hTcxDec->L_frameTCX; i++ ) { hHQ_core->old_out_fx[i] = shl( mult_r( hHQ_core->old_out_fx[i], st_fx->plcInfo.recovery_gain ), 1 ); + move16(); } } @@ -223,7 +226,7 @@ ivas_error amr_wb_dec_fx( move16(); test(); test(); - IF( st_fx->last_con_tcx && ( NE_16( st_fx->L_frameTCX_past, st_fx->L_frame ) ) && ( NE_16( st_fx->last_core, 0 ) ) ) + if ( st_fx->last_con_tcx && ( NE_16( st_fx->L_frameTCX_past, st_fx->L_frame ) ) && ( ( st_fx->last_core != 0 ) ) ) { avoid_lpc_burst_on_recovery = 1; move16(); @@ -242,7 +245,7 @@ ivas_error amr_wb_dec_fx( st_fx->bpf_off = 1; move16(); - IF( NE_16( st_fx->hPFstat->on, 0 ) ) + IF( st_fx->hPFstat->on ) { Word16 mem_syn_r_size_old, mem_syn_r_size_new; @@ -300,13 +303,13 @@ ivas_error amr_wb_dec_fx( FOR( i = sub( NB_SUBFR16k, NB_SUBFR ); i < NB_SUBFR16k; i++ ) { - st_fx->old_pitch_buf_fx[sub( i, 1 )] = Mpy_32_16_1( st_fx->old_pitch_buf_fx[i], tmp16 ); + st_fx->old_pitch_buf_fx[i - 1] = Mpy_32_16_1( st_fx->old_pitch_buf_fx[i], tmp16 ); move32(); } FOR( i = sub( shl( NB_SUBFR16k, 1 ), NB_SUBFR ); i < shl( NB_SUBFR16k, 1 ); i++ ) { - st_fx->old_pitch_buf_fx[sub( i, 2 )] = Mpy_32_16_1( st_fx->old_pitch_buf_fx[i], tmp16 ); + st_fx->old_pitch_buf_fx[i - 2] = Mpy_32_16_1( st_fx->old_pitch_buf_fx[i], tmp16 ); move32(); } } @@ -333,6 +336,7 @@ ivas_error amr_wb_dec_fx( move16(); } st_fx->bfi_pitch_fx = mult_r( tmp16, st_fx->bfi_pitch_fx ); + move16(); st_fx->bfi_pitch_frame = L_FRAME; move16(); } @@ -343,13 +347,13 @@ ivas_error amr_wb_dec_fx( { /* reset the unvoiced/audio signal improvement memories */ E_LPC_f_isp_a_conversion( st_fx->lsp_old_fx, st_fx->hAmrwb_IO->old_Aq_fx, M ); - Copy( st_fx->hAmrwb_IO->old_Aq_fx, st_fx->hAmrwb_IO->old_Aq_fx + add( M, 1 ), add( M, 1 ) ); - Copy( st_fx->hAmrwb_IO->old_Aq_fx, st_fx->hAmrwb_IO->old_Aq_fx + i_mult( 2, add( M, 1 ) ), add( M, 1 ) ); - Copy( st_fx->hAmrwb_IO->old_Aq_fx, st_fx->hAmrwb_IO->old_Aq_fx + i_mult( 3, add( M, 1 ) ), add( M, 1 ) ); + Copy( st_fx->hAmrwb_IO->old_Aq_fx, st_fx->hAmrwb_IO->old_Aq_fx + M + 1, M + 1 ); + Copy( st_fx->hAmrwb_IO->old_Aq_fx, st_fx->hAmrwb_IO->old_Aq_fx + i_mult( 2, M + 1 ), M + 1 ); + Copy( st_fx->hAmrwb_IO->old_Aq_fx, st_fx->hAmrwb_IO->old_Aq_fx + i_mult( 3, M + 1 ), M + 1 ); } /*End of _DIFF_FLOAT_FIX_*/ test(); - IF( EQ_16( st_fx->last_bwidth, NB ) && NE_16( st_fx->ini_frame, 0 ) ) + if ( EQ_16( st_fx->last_bwidth, NB ) && NE_16( st_fx->ini_frame, 0 ) ) { st_fx->rate_switching_reset = 1; move16(); @@ -390,7 +394,8 @@ ivas_error amr_wb_dec_fx( delta_mem_scale = 3; move16(); - IF( LT_32( st_fx->lp_ener_fx, 40 ) ) /* very low energy frames, less than 0.3125 */ + test(); + if ( LT_32( st_fx->lp_ener_fx, 40 ) ) /* very low energy frames, less than 0.3125 */ { delta_mem_scale = 0; move16(); @@ -405,8 +410,8 @@ ivas_error amr_wb_dec_fx( Copy_Scale_sig( exc2_fx, exc2_fx, st_fx->L_frame, sub( st_fx->Q_exc, i ) ); /* update past excitation signals for LD music post-filter */ - Copy( hMusicPF->dct_post_old_exc_fx + L_FRAME, hMusicPF->dct_post_old_exc_fx, sub( DCT_L_POST, add( L_FRAME, OFFSET2 ) ) ); - Copy( exc2_fx, hMusicPF->dct_post_old_exc_fx + sub( DCT_L_POST, add( L_FRAME, OFFSET2 ) ), L_FRAME ); + Copy( hMusicPF->dct_post_old_exc_fx + L_FRAME, hMusicPF->dct_post_old_exc_fx, DCT_L_POST - L_FRAME - OFFSET2 ); + Copy( exc2_fx, hMusicPF->dct_post_old_exc_fx + ( DCT_L_POST - L_FRAME - OFFSET2 ), L_FRAME ); /* synthesis at 12k8 Hz sampling rate */ syn_12k8_fx( L_FRAME, Aq_fx, exc2_fx, syn_fx, st_fx->mem_syn2_fx, 1, st_fx->Q_exc, st_fx->Q_syn ); @@ -429,7 +434,7 @@ ivas_error amr_wb_dec_fx( st_fx->psf_lp_noise_fx = round_fx( L_mac( L_mult( 32440, st_fx->psf_lp_noise_fx ), 328, frame_e_fx ) ); /*Q8*/ } /* update old synthesis for classification */ - Copy( syn_fx + sub( L_FRAME, L_SYN_MEM_CLAS_ESTIM ), st_fx->mem_syn_clas_estim_fx, L_SYN_MEM_CLAS_ESTIM ); + Copy( syn_fx + L_FRAME - L_SYN_MEM_CLAS_ESTIM, st_fx->mem_syn_clas_estim_fx, L_SYN_MEM_CLAS_ESTIM ); /* Update music post processing values */ /* Filter energies update */ @@ -466,10 +471,11 @@ ivas_error amr_wb_dec_fx( *------------------------------------------------------------*/ vad_flag = (Word16) get_next_indice( st_fx, 1 ); + move16(); st_fx->coder_type = GENERIC; move16(); - IF( EQ_16( vad_flag, 0 ) ) + if ( vad_flag == 0 ) { st_fx->coder_type = INACTIVE; move16(); @@ -508,11 +514,13 @@ ivas_error amr_wb_dec_fx( { L_tmp = L_mult( 3277, lsp_new_fx[i] ); st_fx->lspCNG_fx[i] = round_fx( L_mac( L_tmp, 29491, st_fx->lspCNG_fx[i] ) ); + move16(); } } ELSE { st_fx->unv_cnt = add( st_fx->unv_cnt, 1 ); + move16(); } } ELSE @@ -552,9 +560,9 @@ ivas_error amr_wb_dec_fx( 0, 0, 0, st_fx->last_core_brate, -1 ); /* update past excitation signals for LD music post-filter */ - Copy( hMusicPF->dct_post_old_exc_fx + L_FRAME, hMusicPF->dct_post_old_exc_fx, sub( DCT_L_POST, add( L_FRAME, OFFSET2 ) ) ); - Copy( exc2_fx, hMusicPF->dct_post_old_exc_fx + sub( DCT_L_POST, add( L_FRAME, OFFSET2 ) ), L_FRAME ); - Copy( hMusicPF->dct_post_old_exc_fx, exc_buffer_fx, sub( DCT_L_POST, OFFSET2 ) ); + Copy( hMusicPF->dct_post_old_exc_fx + L_FRAME, hMusicPF->dct_post_old_exc_fx, DCT_L_POST - L_FRAME - OFFSET2 ); + Copy( exc2_fx, hMusicPF->dct_post_old_exc_fx + ( DCT_L_POST - L_FRAME - OFFSET2 ), L_FRAME ); + Copy( hMusicPF->dct_post_old_exc_fx, exc_buffer_fx, DCT_L_POST - OFFSET2 ); IF( NE_16( output_frame, L_FRAME8k ) ) { @@ -563,12 +571,13 @@ ivas_error amr_wb_dec_fx( frame_energy_fx( L_FRAME, pitch_buf_fx, syn_fx, 0, &frame_e_fx, st_fx->Q_syn ); /*st->psf_lp_noise = 0.99f * st->psf_lp_noise + 0.01f * frame_e; */ st_fx->psf_lp_noise_fx = round_fx( L_mac( L_mult( 32440, st_fx->psf_lp_noise_fx ), 328, frame_e_fx ) ); /*Q8*/ + move16(); } } test(); test(); - IF( NE_16( amr_io_class, UNVOICED_CLAS ) && NE_16( st_fx->coder_type, INACTIVE ) && LT_16( st_fx->psf_lp_noise_fx, shl( 15, 8 ) ) ) + IF( NE_16( amr_io_class, UNVOICED_CLAS ) && NE_16( st_fx->coder_type, INACTIVE ) && LT_16( st_fx->psf_lp_noise_fx, 15 << 8 ) ) { tmp_coder_type = AUDIO; move16(); @@ -602,6 +611,7 @@ ivas_error amr_wb_dec_fx( { /*st->filt_lfE[i] = 0.3f + 0.7f * st->filt_lfE[i] ;*/ hMusicPF->filt_lfE_fx[i] = round_fx( L_mac( L_deposit_h( 1229 ), 22938, hMusicPF->filt_lfE_fx[i] ) ); + move16(); } } @@ -639,7 +649,7 @@ ivas_error amr_wb_dec_fx( { /* long burst frame erasures */ test(); - IF( GT_16( st_fx->nbLostCmpt, 5 ) && GE_16( st_fx->clas_dec, VOICED_CLAS ) ) + if ( GT_16( st_fx->nbLostCmpt, 5 ) && GE_16( st_fx->clas_dec, VOICED_CLAS ) ) { st_fx->last_good = VOICED_TRANSITION; move16(); @@ -672,7 +682,7 @@ ivas_error amr_wb_dec_fx( /* Update circular buffer, keep last energy difference unchanged */ FOR( i = 1; i < MAX_LT; i++ ) { - hMusicPF->LDm_lt_diff_etot_fx[sub( i, 1 )] = hMusicPF->LDm_lt_diff_etot_fx[i]; + hMusicPF->LDm_lt_diff_etot_fx[i - 1] = hMusicPF->LDm_lt_diff_etot_fx[i]; move16(); } /* Filter energies update */ @@ -680,6 +690,7 @@ ivas_error amr_wb_dec_fx( { /*st->filt_lfE[i] = 0.3f + 0.7f * st->filt_lfE[i];*/ hMusicPF->filt_lfE_fx[i] = round_fx( L_mac( L_deposit_h( 1229 ), 22938, hMusicPF->filt_lfE_fx[i] ) ); + move16(); } Rescale_mem( st_fx->Q_exc, &st_fx->prev_Q_syn, &st_fx->Q_syn, st_fx->mem_syn2_fx, st_fx->mem_syn_clas_estim_fx, 4, &st_fx->mem_deemph_fx, @@ -689,7 +700,7 @@ ivas_error amr_wb_dec_fx( syn_12k8_fx( L_FRAME, Aq_fx, exc2_fx, syn_fx, st_fx->mem_syn2_fx, 1, st_fx->Q_exc, st_fx->Q_syn ); /* update old synthesis for classification */ - Copy( syn_fx + sub( L_FRAME, L_SYN_MEM_CLAS_ESTIM ), st_fx->mem_syn_clas_estim_fx, L_SYN_MEM_CLAS_ESTIM ); + Copy( syn_fx + L_FRAME - L_SYN_MEM_CLAS_ESTIM, st_fx->mem_syn_clas_estim_fx, L_SYN_MEM_CLAS_ESTIM ); FOR( i = 0; i < NB_SUBFR; i++ ) @@ -742,7 +753,7 @@ ivas_error amr_wb_dec_fx( *-----------------------------------------------------------------*/ /* update old synthesis buffer - needed for ACELP internal sampling rate switching */ - Copy( syn_fx + sub( L_FRAME, L_SYN_MEM ), st_fx->mem_syn_r, L_SYN_MEM ); + Copy( syn_fx + L_FRAME - L_SYN_MEM, st_fx->mem_syn_r, L_SYN_MEM ); deemph_fx( syn_fx, PREEMPH_FAC, L_FRAME, &( st_fx->mem_deemph_fx ) ); @@ -750,8 +761,8 @@ ivas_error amr_wb_dec_fx( Copy( syn_fx_tmp2, syn_fx, L_FRAME ); /* TCX=Q-1, ACELP2 Q0 */ - Copy_Scale_sig( syn_fx + shr( L_FRAME, 1 ), hTcxDec->old_syn_Overl, shr( L_FRAME, 1 ), sub( -1, st_fx->Q_syn ) ); /*Q_syn*/ - Copy_Scale_sig( syn_fx + sub( L_FRAME, add( M, 1 ) ), st_fx->syn, add( M, 1 ), sub( 0, st_fx->Q_syn ) ); /*Q0*/ + Copy_Scale_sig( syn_fx + L_FRAME / 2, hTcxDec->old_syn_Overl, L_FRAME / 2, sub( -1, st_fx->Q_syn ) ); /*Q_syn*/ + Copy_Scale_sig( syn_fx + L_FRAME - M - 1, st_fx->syn, M + 1, sub( 0, st_fx->Q_syn ) ); /*Q0*/ /*------------------------------------------------------------------* * Formant post-filter @@ -763,7 +774,7 @@ ivas_error amr_wb_dec_fx( st_fx->hPFstat->on = 1; move16(); test(); - formant_post_filt_fx( st_fx->hPFstat, tmp_buffer_fx + L_SYN_MEM, Aq_fx, syn_fx, L_FRAME, L_shl( st_fx->psf_lp_noise_fx, 15 ), st_fx->total_brate, (Word16) EQ_16( sub( amr_io_class, AUDIO_CLAS ), 0 ) ); + formant_post_filt_fx( st_fx->hPFstat, tmp_buffer_fx + L_SYN_MEM, Aq_fx, syn_fx, L_FRAME, L_shl( st_fx->psf_lp_noise_fx, 15 ), st_fx->total_brate, sub( amr_io_class, AUDIO_CLAS ) == 0 ); } /*----------------------------------------------------------------* @@ -773,7 +784,7 @@ ivas_error amr_wb_dec_fx( flag_cna = 0; move16(); test(); - IF( ( GE_16( st_fx->psf_lp_noise_fx, shl( 15, 8 ) ) ) || EQ_16( st_fx->coder_type, INACTIVE ) ) + IF( ( GE_16( st_fx->psf_lp_noise_fx, ( 15 << 8 ) ) ) || EQ_16( st_fx->coder_type, INACTIVE ) ) { /*VAD only for non inactive frame*/ test(); @@ -809,7 +820,7 @@ ivas_error amr_wb_dec_fx( move16(); test(); - IF( st_fx->flag_cna && GE_16( st_fx->psf_lp_noise_fx, shl( 15, 8 ) ) ) + IF( st_fx->flag_cna && GE_16( st_fx->psf_lp_noise_fx, 15 << 8 ) ) { flag_cna = 1; move16(); @@ -828,14 +839,14 @@ ivas_error amr_wb_dec_fx( } - IF( EQ_16( flag_cna, 0 ) ) + IF( !flag_cna ) { test(); test(); test(); IF( EQ_16( st_fx->last_flag_cna, 1 ) && ( ( EQ_16( st_fx->last_core, ACELP_CORE ) && NE_16( st_fx->last_coder_type, AUDIO ) ) || EQ_16( st_fx->last_core, AMR_WB_CORE ) ) ) { - FOR( i = 0; i < shr( L_FRAME, 1 ); i++ ) + FOR( i = 0; i < L_FRAME / 2; i++ ) { syn_fx[i] = add( syn_fx[i], shr_r( st_fx->hFdCngDec->hFdCngCom->olapBufferSynth2[add( i, shr( i_mult( 5, L_FRAME ), 2 ) )], -st_fx->Q_syn ) ); move16(); @@ -858,9 +869,10 @@ ivas_error amr_wb_dec_fx( resampleCldfb( st_fx->cldfbAna, newCldfbBands, L_FRAME, 0 ); resampleCldfb( st_fx->cldfbBPF, newCldfbBands, L_FRAME, 0 ); - IF( GT_16( st_fx->ini_frame, 0 ) ) + if ( st_fx->ini_frame > 0 ) { st_fx->cldfbSyn->bandsToZero = sub( st_fx->cldfbSyn->no_channels, st_fx->cldfbAna->no_channels ); + move16(); } } @@ -876,7 +888,7 @@ ivas_error amr_wb_dec_fx( /* CLDFB analysis and add the BPF error signal */ i = 0; move16(); - IF( EQ_16( st_fx->bpf_off, 0 ) ) + if ( st_fx->bpf_off == 0 ) { i = CLDFB_NO_COL_MAX; move16(); @@ -947,7 +959,7 @@ ivas_error amr_wb_dec_fx( updt_dec_fx( st_fx, old_exc_fx, pitch_buf_fx, 0, Aq_fx, lsf_new_fx, lsp_new_fx, voice_factors_fx, dummy_buf_fx, gain_buf ); /* update old_Aq[] - needed in improv_amr_wb_gs_fx() */ - Copy( Aq_fx, st_fx->hAmrwb_IO->old_Aq_fx, NB_SUBFR * add( M, 1 ) ); + Copy( Aq_fx, st_fx->hAmrwb_IO->old_Aq_fx, NB_SUBFR * ( M + 1 ) ); test(); test(); @@ -957,7 +969,7 @@ ivas_error amr_wb_dec_fx( test(); test(); test(); - IF( !st_fx->bfi && st_fx->prev_bfi && GE_32( st_fx->last_total_brate, HQ_48k ) && EQ_16( st_fx->last_codec_mode, MODE2 ) && ( EQ_16( st_fx->last_core_bfi, TCX_20_CORE ) || EQ_16( st_fx->last_core_bfi, TCX_10_CORE ) ) && EQ_16( st_fx->plcInfo.concealment_method, TCX_NONTONAL ) && LT_32( st_fx->plcInfo.nbLostCmpt, 4 ) ) + if ( !st_fx->bfi && st_fx->prev_bfi && GE_32( st_fx->last_total_brate, HQ_48k ) && EQ_16( st_fx->last_codec_mode, MODE2 ) && ( EQ_16( st_fx->last_core_bfi, TCX_20_CORE ) || EQ_16( st_fx->last_core_bfi, TCX_10_CORE ) ) && EQ_16( st_fx->plcInfo.concealment_method, TCX_NONTONAL ) && LT_32( st_fx->plcInfo.nbLostCmpt, 4 ) ) { waveadj_rec = 1; move16(); @@ -1003,7 +1015,7 @@ ivas_error amr_wb_dec_fx( IF( st_fx->bfi ) { /* calculate another loss frame to fill gap in case of switching frame loss */ - IF( ( error = acelp_core_switch_dec_bfi_fx( st_fx, hHQ_core->fer_samples_fx, st_fx->coder_type ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = acelp_core_switch_dec_bfi_fx( st_fx, hHQ_core->fer_samples_fx, st_fx->coder_type ) ), IVAS_ERR_OK ) ) { return error; } @@ -1041,7 +1053,7 @@ ivas_error amr_wb_dec_fx( FOR( i = 0; i < tmps; i++ ) { #ifdef BASOP_NOGLOB - synth_out_fx[i + delay_comp] = msu_r_sat( L_mult( synth_out_fx[i + delay_comp], alpha ), hHQ_core->old_out_fx[i + nz], add( alpha, -32768 ) ); + synth_out_fx[add( i, delay_comp )] = msu_r_sat( L_mult( synth_out_fx[add( i, delay_comp )], alpha ), hHQ_core->old_out_fx[add( i, nz )], add( alpha, -32768 ) ); #else synth_out_fx[i + delay_comp] = msu_r( L_mult( synth_out_fx[i + delay_comp], alpha ), hHQ_core->old_out_fx[i + nz], add( alpha, -32768 ) ); #endif @@ -1058,7 +1070,7 @@ ivas_error amr_wb_dec_fx( /* Delay ACELP synthesis by DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS delay */ IF( GE_16( output_frame, L_FRAME16k ) ) { - tmps = NS2SA_fx2( st_fx->output_Fs, L_sub( DELAY_BWE_TOTAL_NS, DELAY_CLDFB_NS ) ); + tmps = NS2SA_fx2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ); Scale_sig( st_fx->prev_synth_buffer_fx, tmps, sub( st_fx->Q_syn2, st_fx->Qprev_synth_buffer_fx ) ); delay_signal( synth_out_fx, output_frame, st_fx->prev_synth_buffer_fx, tmps ); } @@ -1084,7 +1096,7 @@ ivas_error amr_wb_dec_fx( hp20( synth_out_fx, 1 /*stride*/, output_frame, st_fx->L_mem_hp_out_fx, L_mult0( output_frame, 50 ) ); /* save synthesis for core switching */ - Copy_Scale_sig( synth_out_fx + NS2SA_fx2( st_fx->output_Fs, L_add( ACELP_LOOK_NS, DELAY_BWE_TOTAL_NS ) ), st_fx->old_synth_sw_fx, NS2SA_fx2( st_fx->output_Fs, L_sub( FRAME_SIZE_NS, L_add( ACELP_LOOK_NS, DELAY_BWE_TOTAL_NS ) ) ), sub( hHQ_core->Q_old_postdec, st_fx->Q_syn2 ) ); + Copy_Scale_sig( synth_out_fx + NS2SA_fx2( st_fx->output_Fs, ACELP_LOOK_NS + DELAY_BWE_TOTAL_NS ), st_fx->old_synth_sw_fx, NS2SA_fx2( st_fx->output_Fs, FRAME_SIZE_NS - ACELP_LOOK_NS - DELAY_BWE_TOTAL_NS ), sub( hHQ_core->Q_old_postdec, st_fx->Q_syn2 ) ); { /* TCX-LTP Postfilter: used in AMR-WB IO to update memories and to avoid discontinuities when the past frame was TCX */ @@ -1121,17 +1133,17 @@ void amr_wb_dec_init_fx( /* Improvement of unvoiced and audio signals in AMR-WB IO mode */ hAmrwb_IO->UV_cnt_fx = 30; move16(); - hAmrwb_IO->LT_UV_cnt_fx = shl( 60, 6 ); + hAmrwb_IO->LT_UV_cnt_fx = ( 60 << 6 ); move16(); set16_fx( hAmrwb_IO->lt_diff_etot_fx, 0, MAX_LT ); hAmrwb_IO->Last_ener_fx = 0; move16(); - set16_fx( hAmrwb_IO->old_Aq_fx, 0, i_mult( NB_SUBFR, add( M, 1 ) ) ); + set16_fx( hAmrwb_IO->old_Aq_fx, 0, i_mult( NB_SUBFR, M + 1 ) ); hAmrwb_IO->old_Aq_fx[0] = 16384; - hAmrwb_IO->old_Aq_fx[add( M, 1 )] = 16384; - hAmrwb_IO->old_Aq_fx[i_mult( 2, add( M, 1 ) )] = 16384; - hAmrwb_IO->old_Aq_fx[i_mult( 3, add( M, 1 ) )] = 16384; + hAmrwb_IO->old_Aq_fx[M + 1] = 16384; + hAmrwb_IO->old_Aq_fx[2 * ( M + 1 )] = 16384; + hAmrwb_IO->old_Aq_fx[3 * ( M + 1 )] = 16384; move16(); move16(); move16(); diff --git a/lib_dec/ari_dec_fx.c b/lib_dec/ari_dec_fx.c index 26390d6e0987048fc16d3ae410e083ded3d416e0..78d7b799ce1814277729d1619bd2be5130ac69fb 100644 --- a/lib_dec/ari_dec_fx.c +++ b/lib_dec/ari_dec_fx.c @@ -34,6 +34,7 @@ void ari_start_decoding_14bits_fx( val = L_and( L_deposit_l( get_next_indice( st, cbitsnew ) ), 0xffffL ); s->low = L_deposit_l( 0 ); + move32(); s->high = L_add( ari_q4new, 1 ); move32(); s->value = val; @@ -62,6 +63,7 @@ Word16 ari_start_decoding_14bits_prm_fx( } } s->low = L_deposit_l( 0 ); + move32(); s->high = L_add( ari_q4new, 1 ); move32(); s->value = val; @@ -354,7 +356,7 @@ static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base ) Word16 k; range = L_sub( s->high, s->low ); - cum = L_add( L_shl( L_sub( s->value, s->low ), stat_bitsnew ), sub( shl( 1, stat_bitsnew ), 1 ) ); + cum = L_add( L_shl( L_sub( s->value, s->low ), stat_bitsnew ), ( ( 1 << stat_bitsnew ) - 1 ) ); range_h = extract_l( L_shr( range, 15 ) ); range_l = extract_l( L_and( range, 0x7FFF ) ); @@ -377,11 +379,11 @@ static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base ) { highlim = testval; move16(); - pows[k] = mult_r( pows[sub( k, 1 )], pows[sub( k, 1 )] ); + pows[k] = mult_r( pows[k - 1], pows[k - 1] ); move16(); testval = mult_r( pows[k], base ); - IF( LE_32( L_multi31x16_X2( range_h, range_l, shr( testval, 1 ) ), cum ) ) /* found! big range is [lowlim,testval], (now narrow it down) */ + IF( LE_32( L_multi31x16_X2( range_h, range_l, testval >> 1 ), cum ) ) /* found! big range is [lowlim,testval], (now narrow it down) */ { lowlim = testval; move16(); @@ -397,7 +399,7 @@ static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base ) { testval = mult_r( highlim, pows[k + 1] ); - IF( LE_32( L_multi31x16_X2( range_h, range_l, shr( testval, 1 ) ), cum ) ) + IF( LE_32( L_multi31x16_X2( range_h, range_l, testval >> 1 ), cum ) ) { lowlim = testval; move16(); diff --git a/lib_dec/ari_hm_dec.c b/lib_dec/ari_hm_dec.c index e2d5e8de7603ac33715507017bf83b26e7f332c2..fc45166c11ef11a1272a29ac59d1c4dcc29364e8 100644 --- a/lib_dec/ari_hm_dec.c +++ b/lib_dec/ari_hm_dec.c @@ -99,6 +99,7 @@ DecodeIndex_fx( *PeriodicityIndex = kLtpHmFlag; move16(); *PeriodicityIndex = s_or( *PeriodicityIndex, get_next_indice_fx( st, NumRatioBits[Bandwidth][LtpPitchIndex] ) ); + move16(); *PeriodicityIndex = add( *PeriodicityIndex, 1 ); move16(); *PeriodicityIndex = s_or( *PeriodicityIndex, shl( LtpPitchIndex, 9 ) ); @@ -155,9 +156,10 @@ static Word16 tcx_hm_dequantize_gain_fx( /* safety check in case of bit errors */ test(); - IF( !( LE_16( 0, gain_idx ) && LT_16( gain_idx, shl( 1, kTcxHmNumGainBits ) ) ) ) + IF( !( 0 <= gain_idx && LT_16( gain_idx, ( 1 << kTcxHmNumGainBits ) ) ) ) { *gain = 0; + move16(); return 1; } diff --git a/lib_dec/arith_coder_dec.c b/lib_dec/arith_coder_dec.c index 36710096533d9e2169e90de6382a096e74a37cb3..0bffd69633fe573a9bfaabcdff73bd84eb7b7a65 100644 --- a/lib_dec/arith_coder_dec.c +++ b/lib_dec/arith_coder_dec.c @@ -157,17 +157,20 @@ static Word16 tcx_arith_decode_ivas_fx( /* decode line magnitude */ bp = ari_decode_14bits_pow_ivas( prm, bp, target_bits, &q, &as, exp_k ); - IF( NE_16( q, 0 ) ) + IF( q ) { /* line is non-zero, decode sign */ bp = ari_decode_14bits_sign_ivas( prm, bp, target_bits, &s, &as ); q_spectrum[k] = L_mult( q, sub( 3, shl( s, 1 ) ) ); + move32(); q_spectrum[k] = L_shl( q_spectrum[k], 30 - SPEC_EXP_DEC ); + move32(); } ELSE { /* line is zero, no sign needed */ q_spectrum[k] = L_deposit_l( 0 ); + move32(); } IF( LE_32( as.high, as.low ) ) @@ -331,7 +334,7 @@ void tcx_arith_decode_envelope_ivas_fx( IF( GT_16( L_spec, N_MAX_ARI ) || ( EQ_16( st->element_mode, EVS_MONO ) && GT_16( target_bits, ( ACELP_13k20 / FRAMES_PER_SEC ) ) ) || ( EQ_16( st->element_mode, IVAS_SCE ) && ( GT_16( st->bits_frame_nominal, ( LPC_SHAPED_ARI_MAX_RATE / FRAMES_PER_SEC ) ) ) ) || ( GT_16( st->element_mode, IVAS_SCE ) && ( GT_16( st->bits_frame_nominal, ( LPC_SHAPED_ARI_MAX_RATE_CPE / FRAMES_PER_SEC ) ) ) ) || - ( LE_16( target_bits, 0 ) ) ) + ( target_bits <= 0 ) ) { /* this could happen in case of bit errors */ st->BER_detect = 1; @@ -362,13 +365,13 @@ void tcx_arith_decode_envelope_ivas_fx( tcx_arith_render_envelope_flt( A_ind, L_frame, L_spec, hTcxCfg->preemph_fac, gamma_w, gamma_uw, env ); #undef WMC_TOOL_SKIP - IF( NE_16( use_hm, 0 ) ) + IF( use_hm != 0 ) { IF( NE_16( prm_hm[0], 0 ) ) { tcx_hm_decode( L_spec, env, target_bits, st->coder_type, prm_hm, tcxltp_pitch, &hm_bits ); - IF( LT_16( hm_bits, 0 ) ) + IF( hm_bits < 0 ) { st->BER_detect = 1; move16(); @@ -381,7 +384,7 @@ void tcx_arith_decode_envelope_ivas_fx( return; } } - else + ELSE { hm_bits = 1; move16(); @@ -404,7 +407,7 @@ void tcx_arith_decode_envelope_ivas_fx( move16(); /* safety check in case of bit errors */ - IF( LT_16( *arith_bits, 0 ) ) + IF( *arith_bits < 0 ) { st->BER_detect = 1; move16(); diff --git a/lib_dec/arith_coder_dec_fx.c b/lib_dec/arith_coder_dec_fx.c index ee9208b4e9ead5e9844b6d0f43fdee04a922f47e..ddd4ac4782aeeab90815a458478ef8c376662a62 100644 --- a/lib_dec/arith_coder_dec_fx.c +++ b/lib_dec/arith_coder_dec_fx.c @@ -42,7 +42,7 @@ static Word16 tcx_arith_decode_fx( L_tmp = L_deposit_l( 0 ); FOR( k = 0; k < L_frame; k++ ) { - IF( EQ_16( envelope[k], 0 ) ) /* safety check in case of bit errors */ + IF( envelope[k] == 0 ) /* safety check in case of bit errors */ { set32_fx( q_spectrum, 0, L_frame ); return -1; @@ -54,11 +54,12 @@ static Word16 tcx_arith_decode_fx( /* decode line magnitude */ bp = ari_decode_14bits_pow_fx( prm, bp, target_bits, &q, &as, exp_k ); - IF( EQ_16( q, 0 ) ) + IF( q == 0 ) { q_spectrum[k] = L_deposit_l( 0 ); + move32(); } - IF( NE_16( q, 0 ) ) /* line is non-zero, decode sign */ + IF( q != 0 ) /* line is non-zero, decode sign */ { bp = ari_decode_14bits_sign_fx( prm, bp, target_bits, &s, &as ); @@ -77,7 +78,7 @@ static Word16 tcx_arith_decode_fx( IF( ari_decode_overflow_fx( &as ) ) { - IF( LT_16( bp, target_bits ) ) /* safety check in case of bit errors */ + if ( LT_16( bp, target_bits ) ) /* safety check in case of bit errors */ { bp = -1; move16(); @@ -92,7 +93,7 @@ static Word16 tcx_arith_decode_fx( /* noise filling seed */ *nf_seed = extract_l( L_tmp ); - + move16(); return bp; } @@ -137,7 +138,7 @@ void tcx_arith_decode_envelope_fx( IF( GT_16( L_spec, N_MAX_ARI ) || ( EQ_16( st->element_mode, EVS_MONO ) && GT_16( target_bits, ( ACELP_13k20 / FRAMES_PER_SEC ) ) ) || ( EQ_16( st->element_mode, IVAS_SCE ) && ( GT_16( st->bits_frame_nominal, ( LPC_SHAPED_ARI_MAX_RATE / FRAMES_PER_SEC ) ) ) ) || ( GT_16( st->element_mode, IVAS_SCE ) && ( GT_16( st->bits_frame_nominal, ( LPC_SHAPED_ARI_MAX_RATE_CPE / FRAMES_PER_SEC ) ) ) ) || - LE_16( target_bits, 0 ) ) + ( target_bits <= 0 ) ) { /* this could happen in case of bit errors */ st->BER_detect = 1; @@ -165,13 +166,13 @@ void tcx_arith_decode_envelope_fx( tcx_arith_render_envelope( A_ind, L_frame, L_spec, tcx_cfg->preemph_fac, gamma_w, gamma_uw, env ); - IF( NE_16( use_hm, 0 ) ) + IF( use_hm ) { - IF( NE_16( prm_hm[0], 0 ) ) + IF( prm_hm[0] ) { tcx_hm_decode( L_spec, env, target_bits, tcx_cfg->coder_type, prm_hm, tcxltp_pitch, &hm_bits ); - IF( LT_16( hm_bits, 0 ) ) + IF( hm_bits < 0 ) { st->BER_detect = 1; move16(); @@ -211,7 +212,7 @@ void tcx_arith_decode_envelope_fx( move16(); /* safety check in case of bit errors */ - IF( LT_16( *arith_bits, 0 ) ) + IF( *arith_bits < 0 ) { st->BER_detect = 1; move16(); diff --git a/lib_dec/avq_dec_fx.c b/lib_dec/avq_dec_fx.c index 68d3e9549cccd2b3915223db003c4b1448e80bf0..d4351b1a541d81e562b443c7620f8ebb94704573 100644 --- a/lib_dec/avq_dec_fx.c +++ b/lib_dec/avq_dec_fx.c @@ -60,7 +60,7 @@ void AVQ_demuxdec_fx( move16(); dummy_bits = 0; move16(); - svOrder[Nsv - 1] = trgtSvPos; + svOrder[sub( Nsv, 1 )] = trgtSvPos; move16(); svOrder[0] = 0; move16(); @@ -133,6 +133,7 @@ void AVQ_demuxdec_fx( DO { nq[k] = add( nq[k], 1 ); + move16(); // IF ( 5 * nq[k] + 4 == bits ) IF( EQ_16( add( add( shl( nq[k], 2 ), nq[k] ), 4 ), bits ) ) @@ -142,7 +143,7 @@ void AVQ_demuxdec_fx( } WHILE( get_next_indice_1( st ) ); - IF( EQ_16( add( add( shl( nq[k], 2 ), nq[k] ), 4 ), bits ) ) /* check the overflow */ + if ( EQ_16( add( add( shl( nq[k], 2 ), nq[k] ), 4 ), bits ) ) /* check the overflow */ { bits = add( bits, 1 ); /* overflow stop bit */ } @@ -166,6 +167,7 @@ void AVQ_demuxdec_fx( IF( GT_16( nq[k], 0 ) ) { nq[k] = add( nq[k], 1 ); + move16(); } /* read codebook indices (rank I and event. Voronoi index kv) */ @@ -174,9 +176,9 @@ void AVQ_demuxdec_fx( } /* for */ /* Bit Saving Solution */ - IF( GT_16( avq_bit_sFlag, 0 ) && GT_16( bits, 8 ) ) + IF( ( avq_bit_sFlag > 0 ) && GT_16( bits, 8 ) ) { - i = svOrder[Nsv - 1]; + i = svOrder[sub( Nsv, 1 )]; nq[i] = 0; move16(); bitsMod = bits % 5; @@ -186,7 +188,7 @@ void AVQ_demuxdec_fx( move16(); FOR( j = i; j < sub( Nsv, 1 ); j++ ) { - IF( EQ_16( nq[svOrder[j]], 0 ) ) + if ( ( nq[svOrder[j]] == 0 ) ) { nullVec = add( nullVec, 1 ); } @@ -204,14 +206,14 @@ void AVQ_demuxdec_fx( test(); test(); test(); - IF( ( GT_16( bitsMod, 0 ) || ( EQ_16( nullVec, 4 ) && EQ_16( nq_est, 5 ) ) ) && NE_16( bitsMod, 4 ) && GE_16( add( bits, nullVec ), ( add( add( shl( nq_est, 2 ), nq_est ), 4 ) ) ) && EQ_16( nq[svOrder[sub( Nsv, 2 )]], 0 ) ) /* dummy bits */ + IF( ( ( bitsMod > 0 ) || ( EQ_16( nullVec, 4 ) && EQ_16( nq_est, 5 ) ) ) && NE_16( bitsMod, 4 ) && GE_16( add( bits, nullVec ), ( add( add( shl( nq_est, 2 ), nq_est ), 4 ) ) ) && ( nq[svOrder[sub( Nsv, 2 )]] == 0 ) ) /* dummy bits */ { dummy_bits = sub( 5, bitsMod ); bits = add( bits, dummy_bits ); /* add dummy bits */ bitsMod = 0; move16(); } - ELSE IF( GT_16( nq_est, 4 ) && ( ( EQ_16( bitsMod, 0 ) && GT_16( nullVec, 3 ) && LT_16( nullVec, 6 ) ) || ( EQ_16( bitsMod, 4 ) && EQ_16( nullVec, 5 ) ) ) && EQ_16( nq[svOrder[sub( Nsv, 2 )]], 0 ) ) /* wasted bits 4, 5 for nq 6,7..*/ + ELSE IF( GT_16( nq_est, 4 ) && ( ( ( bitsMod == 0 ) && GT_16( nullVec, 3 ) && LT_16( nullVec, 6 ) ) || ( EQ_16( bitsMod, 4 ) && EQ_16( nullVec, 5 ) ) ) && ( nq[svOrder[Nsv - 2]] == 0 ) ) /* wasted bits 4, 5 for nq 6,7..*/ { underflow = 0; move16(); @@ -252,13 +254,13 @@ void AVQ_demuxdec_fx( unusedbitsFlag = 0; move16(); - IF( EQ_16( dummy_bits, 0 ) ) + IF( ( dummy_bits == 0 ) ) { test(); test(); test(); test(); - IF( EQ_16( unused_bits_idx, 0 ) && GT_16( bits, BIT_SAVING_LOW_THR ) ) + IF( ( unused_bits_idx == 0 ) && GT_16( bits, BIT_SAVING_LOW_THR ) ) { unusedbitsFlag = 1; move16(); @@ -273,7 +275,7 @@ void AVQ_demuxdec_fx( /*Compute AVQ code book number from unused Bits */ tmp = (Word16) ( sub( bits, add( add( shl( add( unusedbitsFlag, unused_bits_idx ), 2 ), unusedbitsFlag ), unused_bits_idx ) ) ); nq_est = idiv1616( tmp, 5 ); - IF( EQ_16( ( tmp % 5 ), 0 ) ) + IF( ( ( tmp % 5 ) == 0 ) ) { nq_est = nq_est; move16(); @@ -282,7 +284,7 @@ void AVQ_demuxdec_fx( { nq_est = add( nq_est, 1 ); } - IF( EQ_16( nq_est, 1 ) ) + if ( EQ_16( nq_est, 1 ) ) { nq_est = 0; move16(); @@ -291,7 +293,7 @@ void AVQ_demuxdec_fx( bits = sub( bits, unused_bits_idx ); - IF( NE_16( nq_est, 0 ) ) + if ( ( nq_est != 0 ) ) { bits = sub( bits, 1 ); } @@ -299,11 +301,11 @@ void AVQ_demuxdec_fx( nq[i] = nq_est; move16(); /* read codebook indices (rank I and event. Voronoi index kv) */ - read_cv_fx( st, &I[i], &kv[shl( i, 3 )], nq[i], &bits ); + read_cv_fx( st, &I[i], &kv[i * 8], nq[i], &bits ); bits = sub( bits, dummy_bits ); - IF( NE_16( bitsMod, 4 ) ) + if ( NE_16( bitsMod, 4 ) ) { bits = add( bits, bitsMod ); } @@ -318,7 +320,8 @@ void AVQ_demuxdec_fx( /* write decoded RE8 vector to decoded subvector #i */ FOR( j = 0; j < 8; j++ ) { - xriq[add( shl( i, 3 ), j )] = code[j]; + xriq[add( i * 8, j )] = code[j]; + move16(); } } move16(); @@ -357,7 +360,7 @@ void AVQ_dec_lpc( /* decode all subvectors */ - FOR( l = sub( Nsv, 1 ); l >= 0; l-- ) + FOR( l = Nsv - 1; l >= 0; l-- ) { nq = indx[l]; /* quantizer number (0,2,3..n) */ move16(); @@ -389,8 +392,7 @@ void AVQ_dec_lpc( FOR( i = 7; i >= 0; i-- ) { - kv[i] = shl( kv[i], 1 ); - kv[i] = add( kv[i], s_and( ival, 0x01 ) ); + kv[i] = add( ( kv[i] << 1 ), s_and( ival, 0x01 ) ); move16(); ival = shr( ival, 1 ); } @@ -442,40 +444,47 @@ static void read_cv_fx( bits = *nbits; move16(); /* read codebook indices (rank I and event. Voronoi index kv) */ - IF( EQ_16( nq, 0 ) ) /* Q0 */ + IF( ( nq == 0 ) ) /* Q0 */ { /* nothing to read */ } ELSE IF( LT_16( nq, 5 ) ) /* Q2, Q3, Q4 */ { *I = get_next_indice( st, shl( nq, 2 ) ); + move32(); bits = sub( bits, shl( nq, 2 ) ); } - ELSE IF( EQ_16( s_and( nq, 1 ), 0 ) ) /* Q4 + Voronoi extensions r=1,2,3,... */ + ELSE IF( ( s_and( nq, 1 ) == 0 ) ) /* Q4 + Voronoi extensions r=1,2,3,... */ { *I = get_next_indice( st, 16 ); + move32(); bits = sub( bits, 16 ); order_v = (Word16) sub( shr( nq, 1 ), 2 ); + move32(); FOR( j = 0; j < 8; j++ ) { kv[j] = get_next_indice( st, order_v ); + move16(); } - bits = sub( bits, shl( order_v, 3 ) ); + bits = sub( bits, ( shl( order_v, 3 ) ) ); } ELSE /* Q3 + Voronoi extensions r=1,2,3,... */ { *I = get_next_indice( st, 12 ); + move32(); bits = sub( bits, 12 ); order_v = (Word16) sub( shr( nq, 1 ), 1 ); FOR( j = 0; j < 8; j++ ) { kv[j] = get_next_indice( st, order_v ); + move32(); } bits = sub( bits, shl( order_v, 3 ) ); } *nbits = bits; + move16(); return; } diff --git a/lib_dec/bass_psfilter.c b/lib_dec/bass_psfilter.c index b721487fbad77d166dfefe70d090fca0244ecb0b..13c822522a7f4d82c0e9ff392e167f696ce5ab5b 100644 --- a/lib_dec/bass_psfilter.c +++ b/lib_dec/bass_psfilter.c @@ -715,11 +715,7 @@ Word16 res_bpf_adapt_ivas_fx( shift = W_norm( W_tmp ); W_tmp = W_shl( W_tmp, shift ); res_hb_nrg = W_extract_h( W_tmp ); - IF( GT_16( add( Q24, shift ), 32 ) ) - { - res_hb_nrg = L_shr( res_hb_nrg, sub( add( Q24, shift ), 32 ) ); // Q0 - } - + res_hb_nrg = L_shr( res_hb_nrg, sub( add( Q24, shift ), 32 ) ); // Q0 res_hb_nrg = Mpy_32_16_1( res_hb_nrg, bw_inv ); res_hb_nrg = L_add( Mpy_32_16_1( res_hb_nrg, STEREO_DFT_BPF_ADAPT_ALPHA_FX ), Mpy_32_16_1( hStereoDft->res_hb_nrg_mem_fx, sub( MAX_16, STEREO_DFT_BPF_ADAPT_ALPHA_FX ) ) ); hStereoDft->res_hb_nrg_mem_fx = res_hb_nrg; @@ -732,26 +728,29 @@ Word16 res_bpf_adapt_ivas_fx( { tmp = L_sub( bpf_error_signal_8k[i], hStereoDft->bpf_error_signal_last_fx ); error_nrg = Madd_32_32( error_nrg, tmp, tmp ); - hStereoDft->bpf_error_signal_last_fx = bpf_error_signal_8k[add( i, sub( STEREO_DFT_L_SUBFR_8k, 1 ) )]; + hStereoDft->bpf_error_signal_last_fx = bpf_error_signal_8k[add( i, ( STEREO_DFT_L_SUBFR_8k - 1 ) )]; move32(); } - error_nrg = L_shr( error_nrg, 1 ); // Q0 + error_nrg = L_shl( error_nrg, 1 ); // Q0 error_nrg = Mpy_32_16_1( error_nrg, 6553 /* 0.2f in Q15 */ ); /* Division by 5 for average value */ /* Form decision variable and apply limit */ IF( LT_32( ( L_shr( error_nrg, 1 ) ), res_hb_nrg ) ) { - bpf_error_ratio = (Word16) ( L_shl( ( L_shl( error_nrg, Q5 ) / res_hb_nrg ), Q8 ) ); - move16(); + Word16 temp; + bpf_error_ratio = BASOP_Util_Divide3232_Scale( error_nrg, res_hb_nrg, &temp ); + bpf_error_ratio = shl( bpf_error_ratio, sub( 13, sub( 15, temp ) ) ); } ELSE { - bpf_error_ratio = shl( ONE_IN_Q12, 1 ); + bpf_error_ratio = ONE_IN_Q14; // Q13 + move16(); } - bpf_error_ratio = add( mult( STEREO_DFT_BPF_ADAPT_BETA_FX, bpf_error_ratio ), mult( sub( MAX_16, STEREO_DFT_BPF_ADAPT_BETA_FX ), hStereoDft->bpf_error_ratio_mem_fx ) ); + bpf_error_ratio = add( mult( STEREO_DFT_BPF_ADAPT_BETA_FX, bpf_error_ratio ), mult( ( MAX_16 - STEREO_DFT_BPF_ADAPT_BETA_FX ), hStereoDft->bpf_error_ratio_mem_fx ) ); hStereoDft->bpf_error_ratio_mem_fx = bpf_error_ratio; move16(); res_bpf_flag = (Word16) LT_16( bpf_error_ratio, ONE_IN_Q13 ); + move16(); return res_bpf_flag; } @@ -848,17 +847,17 @@ void bpf_pitch_coherence_ivas_fx( test(); IF( GT_16( st->clas_dec, UNVOICED_CLAS ) && NE_16( st->element_mode, EVS_MONO ) ) { - pc = L_abs( L_sub( L_add( st->old_pitch_buf_fx[add( nb_subfr, 3 )], st->old_pitch_buf_fx[add( nb_subfr, 2 )] ), L_add( st->old_pitch_buf_fx[nb_subfr], st->old_pitch_buf_fx[add( nb_subfr, 1 )] ) ) ); + pc = L_abs( L_sub( L_add( st->old_pitch_buf_fx[nb_subfr + 3], st->old_pitch_buf_fx[nb_subfr + 2] ), L_add( st->old_pitch_buf_fx[nb_subfr], st->old_pitch_buf_fx[nb_subfr + 1] ) ) ); pc = Mpy_32_32( pc, scaled_inv_L_frame ); pcn1 = L_add( Mpy_32_32( pc, K_PC_DEC_FX32 ), C_PC_DEC_FX ); pcn1 = L_max( L_min( pcn1, 4096 ), 0 ); - pc = L_abs( L_sub( L_add( pitch_buf[sub( nb_subfr, 1 )], pitch_buf[sub( nb_subfr, 2 )] ), L_add( pitch_buf[1], pitch_buf[0] ) ) ); + pc = L_abs( L_sub( L_add( pitch_buf[nb_subfr - 1], pitch_buf[nb_subfr - 2] ), L_add( pitch_buf[1], pitch_buf[0] ) ) ); pc = Mpy_32_32( pc, scaled_inv_L_frame ); pcn2 = L_add( Mpy_32_32( pc, K_PC_DEC_FX32 ), C_PC_DEC_FX ); pcn2 = L_max( L_min( pcn2, 4096 ), 0 ); - pc = L_abs( L_sub( L_add( st->old_pitch_buf_fx[add( nb_subfr, 3 )], st->old_pitch_buf_fx[add( nb_subfr, 2 )] ), L_add( pitch_buf[1], pitch_buf[0] ) ) ); + pc = L_abs( L_sub( L_add( st->old_pitch_buf_fx[nb_subfr + 3], st->old_pitch_buf_fx[nb_subfr + 2] ), L_add( pitch_buf[1], pitch_buf[0] ) ) ); pc = Mpy_32_32( pc, scaled_inv_L_frame ); pcn3 = L_add( Mpy_32_32( pc, K_PC_DEC_FX32 ), C_PC_DEC_FX ); pcn3 = L_max( L_min( pcn3, 4096 ), 0 ); diff --git a/lib_dec/bass_psfilter_fx.c b/lib_dec/bass_psfilter_fx.c index c8287c00c3afa585800f3b2b1ea72f122d616f3e..d3984a7e477c078c1cf7ab0cc329afd52455e601 100644 --- a/lib_dec/bass_psfilter_fx.c +++ b/lib_dec/bass_psfilter_fx.c @@ -107,6 +107,7 @@ void bass_psfilter_fx( Word16 nb_subfr; Word16 delta_v_stab; Word16 T_update = 0; + move16(); Word16 dist_pit_diff, idx_pit_min, idx_pit_max, vibrato, Track_on; Word16 loc_pit_max, loc_pit_min, diff_pit; Word16 TrackOnR, vibratR, alp_tmp; @@ -158,7 +159,7 @@ void bass_psfilter_fx( { FOR( i = L_TRACK_HIST - 1; i > 0; i-- ) { - hBPF->mem_mean_pit_fx[i] = hBPF->mem_mean_pit_fx[sub( i, 1 )]; + hBPF->mem_mean_pit_fx[i] = hBPF->mem_mean_pit_fx[i - 1]; move16(); /*Q6 */ } Ltmp = L_deposit_l( 0 ); @@ -190,7 +191,7 @@ void bass_psfilter_fx( test(); test(); test(); - IF( NE_16( coder_type, INACTIVE ) && GE_16( diff_pit, shl( 2, 4 ) ) && LT_16( diff_pit, shl( 10, 4 ) ) && GE_16( dist_pit_diff, 3 ) ) + IF( ( coder_type != INACTIVE ) && GE_16( diff_pit, ( 2 << 4 ) ) && LT_16( diff_pit, ( 10 << 4 ) ) && GE_16( dist_pit_diff, 3 ) ) { vibrato = 1; move16(); @@ -221,18 +222,21 @@ void bass_psfilter_fx( { /**psf_att = add(mult_r(1638,alp_tmp),mult_r(31130,*psf_att)); //Q15 */ hBPF->psf_att_fx = round_fx( L_mac( L_mult( 1638, alp_tmp ), 31130, hBPF->psf_att_fx ) ); /*Q15 */ + move16(); } ELSE { /**psf_att = add(mult_r(13107,alp_tmp),mult_r(19661,*psf_att)); //Q15 */ hBPF->psf_att_fx = round_fx( L_mac( L_mult( 13107, alp_tmp ), 19661, hBPF->psf_att_fx ) ); /*Q15 */ + move16(); } test(); IF( pitch_buf_fx == NULL || bpf_off ) { /* do not use BPF for HQ core */ T_update = 80; - IF( EQ_16( L_frame, L_FRAME8k ) ) + move16(); + if ( EQ_16( L_frame, L_FRAME8k ) ) { T_update = 40; move16(); @@ -260,6 +264,7 @@ void bass_psfilter_fx( tmp = add( shr( pitch_buf_fx[i], 1 ), 32 ); } T_sf[i] = shr( tmp, 6 ); + move16(); test(); IF( EQ_16( L_frame, L_FRAME16k ) || EQ_16( L_frame, L_FRAME8k ) ) { @@ -273,7 +278,7 @@ void bass_psfilter_fx( } } - T = T_sf[sub( i, 1 )]; + T = T_sf[i - 1]; move16(); syn_fx = &syn_buf_fx[add( nbpsf_pit_max, L_frame )]; sigPtr = syn_fx - T; @@ -295,14 +300,14 @@ void bass_psfilter_fx( syn_fx = &syn_buf_fx[add( nbpsf_pit_max, i_subfr )]; syn2_fx = &syn2_buf_fx[i_subfr]; - IF( NE_16( T, 0 ) ) + IF( T ) { test(); IF( GE_16( T, PIT_MIN ) && Opt_AMR_WB ) { T = Pit_track_fx( syn_fx, T ); - IF( NE_16( T, T_sf[subfr_pos] ) ) + if ( NE_16( T, T_sf[subfr_pos] ) ) { Track_on = 1; move16(); @@ -366,14 +371,14 @@ void bass_psfilter_fx( #else tmp2 = round_fx( L_shl( Lener, exp2 ) ); #endif - IF( GT_16( tmp, tmp2 ) ) + if ( GT_16( tmp, tmp2 ) ) { exp = sub( exp, 1 ); } exp2 = sub( exp, exp2 ); /* exponent num - exponent denom */ /* gain = corr / ener */ gain = div_s( round_fx( L_shl( Ltmp, exp ) ), tmp2 ); - IF( LT_32( Lcorr, 0 ) ) + if ( Lcorr < 0 ) { gain = sub( 0, gain ); } @@ -416,7 +421,7 @@ void bass_psfilter_fx( #else tmp2 = round_fx( L_shl( Lener, exp2 ) ); #endif - IF( GT_16( tmp, tmp2 ) ) + if ( GT_16( tmp, tmp2 ) ) { exp = sub( exp, 1 ); } @@ -427,7 +432,7 @@ void bass_psfilter_fx( #else alpha = shr( div_s( round_fx( L_shl( Ltmp, exp ) ), tmp2 ), exp2 ); /*Q15 */ #endif - IF( LT_32( Lcorr, 0 ) ) + if ( Lcorr < 0 ) { alpha = sub( 0, alpha ); } @@ -499,7 +504,7 @@ void bass_psfilter_fx( Lener = L_mac0( Lener, err[i], err[i] ); #endif } - exp2 = sub( -1, 2 ); + exp2 = -1 - 2; move16(); /* 'Lener' is divided by 2 */ IF( EQ_32( Lener, 2147483647L ) ) @@ -548,7 +553,7 @@ void bass_psfilter_fx( Track_on = 0; move16(); - IF( EQ_16( coder_type, AUDIO ) ) /* GSC mode without temporal component */ + if ( EQ_16( coder_type, AUDIO ) ) /* GSC mode without temporal component */ { Track_on = 1; move16(); @@ -601,14 +606,14 @@ void bass_psfilter_fx( exp2 = norm_l( Lener ); tmp2 = round_fx( L_shl( Lener, exp2 ) ); #endif - IF( GT_16( tmp, tmp2 ) ) + if ( GT_16( tmp, tmp2 ) ) { exp = sub( exp, 1 ); } exp2 = sub( exp, exp2 ); /* exponent num - exponent denom */ /* gain = corr / ener */ gain = div_s( round_fx( L_shl( Ltmp, exp ) ), tmp2 ); - IF( LT_32( Lcorr, 0 ) ) + if ( Lcorr < 0 ) { gain = sub( 0, gain ); } @@ -647,7 +652,7 @@ void bass_psfilter_fx( #else tmp2 = round_fx( L_shl( Lener, exp2 ) ); #endif - IF( GT_16( tmp, tmp2 ) ) + if ( GT_16( tmp, tmp2 ) ) { exp = sub( exp, 1 ); } @@ -684,14 +689,14 @@ void bass_psfilter_fx( Lener = L_mac0( Lener, err[i], err[i] ); #endif } - exp2 = sub( -1, 2 ); + exp2 = -1 - 2; move16(); /* 'Lener' is divided by 2 */ IF( EQ_32( Lener, 2147483647L ) ) { Lener = L_deposit_h( -32768 ); - sigPtr = err + shr( subfr_len, 1 ); - FOR( i = 0; i < shr( subfr_len, 1 ); i++ ) + sigPtr = err + subfr_len / 2; + FOR( i = 0; i < subfr_len / 2; i++ ) { Lener0 = L_mult0( sigPtr[i], sigPtr[i] ); #ifdef BASOP_NOGLOB @@ -729,11 +734,11 @@ void bass_psfilter_fx( * update memory for next frame *-------------------------------------------------------*/ - FOR( i = sub( L_TRACK_HIST, 1 ); i > 0; i-- ) + FOR( i = L_TRACK_HIST - 1; i > 0; i-- ) { - hBPF->Track_on_hist[i] = hBPF->Track_on_hist[sub( i, 1 )]; + hBPF->Track_on_hist[i] = hBPF->Track_on_hist[i - 1]; move16(); - hBPF->vibrato_hist[i] = hBPF->vibrato_hist[sub( i, 1 )]; + hBPF->vibrato_hist[i] = hBPF->vibrato_hist[i - 1]; move16(); } @@ -801,7 +806,7 @@ static Word16 Pit_track_fx( /* o : Pitch Lener0 = L_mult0( *v1, *v1 ); Ltmp0 = L_mult0( *v2, *v2 ); Lcorr0 = L_mult0( *v1++, *v2++ ); - FOR( i = 1; i < idiv1616( add( L_HALFR16k, NBPSF_L_EXTRA ), 14 ); i++ ) + FOR( i = 1; i < ( ( L_HALFR16k + NBPSF_L_EXTRA ) / 14 ); i++ ) { #ifdef BASOP_NOGLOB Lener0 = L_mac0_sat( Lener0, *v1, *v1 ); @@ -819,7 +824,7 @@ static Word16 Pit_track_fx( /* o : Pitch test(); IF( EQ_32( Lener0, 2147483647L ) || EQ_32( Ltmp0, 2147483647L ) || - EQ_32( Lcorr0, 2147483647L ) || EQ_32( Lcorr0, L_add( -2147483647, -1L ) ) ) + EQ_32( Lcorr0, 2147483647L ) || EQ_32( Lcorr0, ( -2147483647 - 1L ) ) ) { v1 -= i; move16(); @@ -879,7 +884,7 @@ static Word16 Pit_track_fx( /* o : Pitch Ltmp = L_shl( Ltmp, exp1 ); #endif /* cn = normalized correlation of pitch/2 */ - IF( GT_32( Ltmp, 2040109466L ) ) /* 0.95f in Q31 */ + if ( GT_32( Ltmp, 2040109466L ) ) /* 0.95f in Q31 */ { T = T2; move16(); @@ -920,6 +925,7 @@ void addBassPostFilter_fx( Word32 cldfbBufferImag[CLDFB_NO_COL_MAX][20]; nChan = cldfbBank_bpf_Fx->no_channels; + move16(); scale1 = scale2 = 0; move16(); move16(); @@ -947,7 +953,7 @@ void addBassPostFilter_fx( /* now do the subtraction */ - IF( GT_16( nTimeSlots, 0 ) ) + IF( nTimeSlots > 0 ) { /* Find common scale. */ b = s_max( cldfb_scale->lb_scale, scale.lb_scale ); diff --git a/lib_dec/cng_dec_fx.c b/lib_dec/cng_dec_fx.c index cfaf7af5ee38983d4f4c967606640cc2e2bcae30..ab41059c5352f6d6462113dab6949167dea89e4c 100644 --- a/lib_dec/cng_dec_fx.c +++ b/lib_dec/cng_dec_fx.c @@ -83,6 +83,7 @@ void CNG_dec_fx( TD_CNG_DEC_HANDLE hTdCngDec; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; + move32(); #endif hTdCngDec = st_fx->hTdCngDec; @@ -95,16 +96,16 @@ void CNG_dec_fx( IF( EQ_32( st_fx->core_brate, SID_1k75 ) || EQ_32( st_fx->core_brate, SID_2k40 ) ) { /* de-quantize the LSF vector */ - IF( NE_16( st_fx->Opt_AMR_WB, 0 ) ) + IF( st_fx->Opt_AMR_WB != 0 ) { /* Flt function */ isf_dec_amr_wb_fx( st_fx, Aq, lsf_new, lsp_new ); /* check IF ISPs may trigger too much synthesis energy */ E_LPC_f_isp_a_conversion( lsp_new, Aq_tmp, M ); - enr_new = Enr_1_Az_fx( Aq_tmp, shl( L_SUBFR, 1 ) ); + enr_new = Enr_1_Az_fx( Aq_tmp, 2 * L_SUBFR ); - IF( GT_16( shr( enr_new, 14 ), 0 ) ) + IF( ( shr( enr_new, 14 ) > 0 ) ) { /* Use old LSP vector */ Copy( st_fx->lsp_old_fx, lsp_new, M ); @@ -122,9 +123,9 @@ void CNG_dec_fx( /* check IF LSPs may trigger too much synthesis energy */ E_LPC_f_lsp_a_conversion( lsp_new, Aq_tmp, M ); - enr_new = Enr_1_Az_fx( Aq_tmp, shl( L_SUBFR, 1 ) ); + enr_new = Enr_1_Az_fx( Aq_tmp, 2 * L_SUBFR ); - IF( GT_16( shr( enr_new, 14 ), 0 ) ) + IF( shr( enr_new, 14 ) > 0 ) { /* Use old LSP vector */ Copy( st_fx->lsp_old_fx, lsp_new, M ); @@ -140,7 +141,7 @@ void CNG_dec_fx( } /* Initialize the CNG spectral envelope in case of the very first CNG frame */ - IF( EQ_16( st_fx->first_CNG, 0 ) ) + IF( st_fx->first_CNG == 0 ) { Copy( st_fx->lsp_old_fx, st_fx->lspCNG_fx, M ); } @@ -156,7 +157,7 @@ void CNG_dec_fx( { istep = ISTEP_AMR_WB_SID_FX; move16(); - IF( EQ_32( st_fx->core_brate, SID_2k40 ) ) + if ( EQ_32( st_fx->core_brate, SID_2k40 ) ) { istep = ISTEP_SID_FX; move16(); @@ -165,7 +166,7 @@ void CNG_dec_fx( /* initialize the energy quantization parameters */ num_bits = 6; move16(); - IF( EQ_16( st_fx->Opt_AMR_WB, 0 ) ) + if ( st_fx->Opt_AMR_WB == 0 ) { num_bits = 7; move16(); @@ -187,7 +188,7 @@ void CNG_dec_fx( L_enr_index = tmp1; move16(); L_enr_index = s_min( L_enr_index, 127 ); - IF( NE_16( st_fx->Opt_AMR_WB, 0 ) ) + IF( st_fx->Opt_AMR_WB ) { L_enr_index = s_min( L_enr_index, 63 ); } @@ -207,7 +208,7 @@ void CNG_dec_fx( hTdCngDec->old_enr_index = L_enr_index; move16(); - IF( EQ_16( L_enr_index, 0 ) ) + if ( !L_enr_index ) { L_enr_index = -5; move16(); @@ -222,13 +223,15 @@ void CNG_dec_fx( /* find the new energy value */ hTdCngDec->Enew_fx = Pow2( ener_int, ener_fra ); + move32(); IF( EQ_32( st_fx->core_brate, SID_2k40 ) ) { burst_ho_cnt = get_next_indice( st_fx, 3 ); /* 3bit */ *sid_bw = get_next_indice( st_fx, 1 ); - IF( EQ_16( *sid_bw, 0 ) ) + move16(); + IF( *sid_bw == 0 ) { env_idx[0] = get_next_indice( st_fx, 6 ); move16(); @@ -237,6 +240,7 @@ void CNG_dec_fx( FOR( i = 0; i < NUM_ENV_CNG; i++ ) { q_env[i] = L_deposit_l( CNG_details_codebook_fx[env_idx[0]][i] ); + move32(); } } } @@ -259,8 +263,8 @@ void CNG_dec_fx( test(); IF( LE_32( st_fx->last_core_brate, SID_2k40 ) ) { - /* Reset hangover counter IF not first SID period */ - IF( GT_32( st_fx->core_brate, FRAME_NO_DATA ) ) + /* Reset hangover counter if not first SID period */ + if ( GT_32( st_fx->core_brate, FRAME_NO_DATA ) ) { hTdCngDec->num_ho = 0; move16(); @@ -272,7 +276,7 @@ void CNG_dec_fx( FOR( i = 0; i < M; i++ ) { /* AR low-pass filter */ - st_fx->lspCNG_fx[i] = mac_r( L_mult( CNG_ISF_FACT_FX, st_fx->lspCNG_fx[i] ), 3277, lsp_new[i] ); + st_fx->lspCNG_fx[i] = mac_r( L_mult( CNG_ISF_FACT_FX, st_fx->lspCNG_fx[i] ), 32768 - CNG_ISF_FACT_FX, lsp_new[i] ); move16(); /* Q15 (15+15+1-16) */ } } @@ -303,7 +307,7 @@ void CNG_dec_fx( move16(); s_ptr = add( sub( hTdCngDec->ho_circ_ptr, burst_ho_cnt ), 1 ); move16(); - IF( LT_16( s_ptr, 0 ) ) + IF( s_ptr < 0 ) { s_ptr = add( s_ptr, hTdCngDec->ho_circ_size ); } @@ -311,7 +315,8 @@ void CNG_dec_fx( FOR( ll = burst_ho_cnt; ll > 0; ll-- ) { hTdCngDec->ho_hist_ptr = add( hTdCngDec->ho_hist_ptr, 1 ); - IF( EQ_16( hTdCngDec->ho_hist_ptr, HO_HIST_SIZE ) ) + move16(); + if ( EQ_16( hTdCngDec->ho_hist_ptr, HO_HIST_SIZE ) ) { hTdCngDec->ho_hist_ptr = 0; move16(); @@ -330,25 +335,27 @@ void CNG_dec_fx( Copy( &( hTdCngDec->ho_lsp_circ_fx[i_mult( s_ptr, M )] ), &( hTdCngDec->ho_lsp_hist_fx[i_mult( hTdCngDec->ho_hist_ptr, M )] ), M ); Copy32( &( hTdCngDec->ho_ener_circ_fx[s_ptr] ), &( hTdCngDec->ho_ener_hist_fx[hTdCngDec->ho_hist_ptr] ), 1 ); hTdCngDec->ho_sid_bw = L_shl( L_and( hTdCngDec->ho_sid_bw, (Word32) 0x3fffffffL ), 1 ); + move32(); Copy32( &( hTdCngDec->ho_env_circ_fx[i_mult( s_ptr, NUM_ENV_CNG )] ), &( hTdCngDec->ho_env_hist_fx[i_mult( hTdCngDec->ho_hist_ptr, NUM_ENV_CNG )] ), NUM_ENV_CNG ); hTdCngDec->ho_hist_size = add( hTdCngDec->ho_hist_size, 1 ); + move16(); - IF( GT_16( hTdCngDec->ho_hist_size, HO_HIST_SIZE ) ) + if ( GT_16( hTdCngDec->ho_hist_size, HO_HIST_SIZE ) ) { hTdCngDec->ho_hist_size = HO_HIST_SIZE; move16(); } s_ptr = add( s_ptr, 1 ); - IF( EQ_16( s_ptr, hTdCngDec->ho_circ_size ) ) + if ( EQ_16( s_ptr, hTdCngDec->ho_circ_size ) ) { s_ptr = 0; move16(); } } - IF( GT_16( hTdCngDec->ho_hist_size, 0 ) ) /* can be -1 at init MODE1_DTX_IN_CODEC_B_FIX */ + IF( hTdCngDec->ho_hist_size > 0 ) /* can be -1 at init MODE1_DTX_IN_CODEC_B_FIX */ { /* *allow_cn_step |= ( st_fx->ho_ener_hist[st_fx->ho_hist_ptr] > 4.0f * st_fx->lp_ener );*/ L_tmp1 = L_shr( hTdCngDec->ho_ener_hist_fx[hTdCngDec->ho_hist_ptr], 2 ); @@ -359,6 +366,7 @@ void CNG_dec_fx( IF( ( GT_32( L_tmp1, 0 ) && ( st_fx->first_CNG || EQ_16( st_fx->element_mode, EVS_MONO ) ) ) ) { *allow_cn_step = s_or( *allow_cn_step, 1 ); + move16(); } } IF( EQ_16( last_element_mode, IVAS_CPE_TD ) ) @@ -375,7 +383,7 @@ void CNG_dec_fx( Copy( &( hTdCngDec->ho_lsp_hist_fx[i_mult( ptr, M )] ), tmp, M ); m1 = 0; move16(); - IF( EQ_32( L_and( hTdCngDec->ho_sid_bw, (Word32) 0x1 ), 0 ) ) + IF( L_and( hTdCngDec->ho_sid_bw, (Word32) 0x1 ) == 0 ) { Copy32( &hTdCngDec->ho_env_hist_fx[i_mult( ptr, NUM_ENV_CNG )], tmp_env, NUM_ENV_CNG ); m1 = 1; @@ -390,7 +398,7 @@ void CNG_dec_fx( FOR( k = 1; k < hTdCngDec->ho_hist_size; k++ ) { ptr = sub( ptr, 1 ); - IF( LT_16( ptr, 0 ) ) + if ( ptr < 0 ) { ptr = sub( HO_HIST_SIZE, 1 ); move16(); @@ -424,7 +432,7 @@ void CNG_dec_fx( L_enr = L_shl( L_tmp1, add( exp, 1 ) ); /* Q6 */ st_fx->lp_ener_fx = L_enr; /* Q6 */ - + move32(); set32_fx( max_val, 0, 2 ); set16_fx( max_idx, 0, 2 ); @@ -434,9 +442,9 @@ void CNG_dec_fx( { lsp2lsf_fx( &tmp[i_mult( i, M )], lsf_tmp, M, INT_FS_FX ); ftmp_fx = 964; - move16(); /*X2.56 */ - tmpv = sub( 16384, add( lsf_tmp[sub( M, 1 )], ftmp_fx ) ); /*QX2.56*/ - L_tmp = L_mult0( tmpv, tmpv ); /*QX6.5536*/ + move16(); /*X2.56 */ + tmpv = sub( 16384, add( lsf_tmp[( M - 1 )], ftmp_fx ) ); /*QX2.56*/ + L_tmp = L_mult0( tmpv, tmpv ); /*QX6.5536*/ } ELSE { @@ -449,10 +457,10 @@ void CNG_dec_fx( tmpv = sub( lsf_tmp[0], ftmp_fx ); /*QX2.56*/ L_tmp = L_mac0( L_tmp, tmpv, tmpv ); /*QX6.5536*/ - FOR( j = 0; j < sub( M, 1 ); j++ ) + FOR( j = 0; j < M - 1; j++ ) { - tmpv = sub( sub( lsf_tmp[add( j, 1 )], lsf_tmp[j] ), ftmp_fx ); /*QX2.56*/ - L_tmp = L_mac0( L_tmp, tmpv, tmpv ); /*QX6.5536*/ + tmpv = sub( sub( lsf_tmp[j + 1], lsf_tmp[j] ), ftmp_fx ); /*QX2.56*/ + L_tmp = L_mac0( L_tmp, tmpv, tmpv ); /*QX6.5536*/ } C[i] = Mpy_32_16_1( L_tmp, 1928 ); /*QX6.5536*/ @@ -496,6 +504,7 @@ void CNG_dec_fx( tmpv = div_s( 1, sub( m, 1 ) ); /*Q15*/ L_tmp1 = Mpy_32_16_1( L_tmp1, tmpv ); /*Q15*/ lsp_tmp[i] = extract_l( L_tmp1 ); /*Q15*/ + move16(); } } ELSE @@ -513,6 +522,7 @@ void CNG_dec_fx( tmpv = div_s( 1, sub( m, 2 ) ); /*Q15*/ L_tmp1 = Mpy_32_16_1( L_tmp1, tmpv ); /*Q15*/ lsp_tmp[i] = extract_l( L_tmp1 ); /*Q15*/ + move16(); } } @@ -528,7 +538,7 @@ void CNG_dec_fx( #else dist = add( dist, dev ); /*Q15*/ #endif - IF( GT_16( dev, max_dev ) ) + if ( GT_16( dev, max_dev ) ) { max_dev = dev; move16(); @@ -550,9 +560,10 @@ void CNG_dec_fx( { /* AR low-pass filter */ st_fx->lspCNG_fx[i] = add( mult_r( 26214, lsp_tmp[i] ), mult_r( 6554, lsp_new[i] ) ); + move16(); } } - IF( GT_16( m1, 0 ) ) + IF( m1 > 0 ) { FOR( i = 0; i < NUM_ENV_CNG; i++ ) { @@ -605,14 +616,15 @@ void CNG_dec_fx( /* Update hangover memory during CNG */ test(); #ifdef BASOP_NOGLOB - IF( EQ_16( *allow_cn_step, 0 ) && LT_32( hTdCngDec->Enew_fx, L_add_sat( st_fx->lp_ener_fx, L_shr( st_fx->lp_ener_fx, 1 ) ) ) ) + IF( ( *allow_cn_step == 0 ) && LT_32( hTdCngDec->Enew_fx, L_add_sat( st_fx->lp_ener_fx, L_shr( st_fx->lp_ener_fx, 1 ) ) ) ) #else IF( *allow_cn_step == 0 && LT_32( hTdCngDec->Enew_fx, L_add( st_fx->lp_ener_fx, L_shr( st_fx->lp_ener_fx, 1 ) ) ) ) #endif { /* update the pointer to circular buffer of old LSP vectors */ hTdCngDec->ho_hist_ptr = add( hTdCngDec->ho_hist_ptr, 1 ); - IF( EQ_16( hTdCngDec->ho_hist_ptr, HO_HIST_SIZE ) ) + move16(); + if ( EQ_16( hTdCngDec->ho_hist_ptr, HO_HIST_SIZE ) ) { hTdCngDec->ho_hist_ptr = 0; move16(); @@ -625,7 +637,7 @@ void CNG_dec_fx( hTdCngDec->ho_ener_hist_fx[hTdCngDec->ho_hist_ptr] = hTdCngDec->Enew_fx; move32(); test(); - IF( EQ_32( st_fx->core_brate, SID_2k40 ) && EQ_16( *sid_bw, 0 ) ) + IF( EQ_32( st_fx->core_brate, SID_2k40 ) && ( *sid_bw == 0 ) ) { /* enr1 = (float)log10( st->Enew*L_frame + 0.1f ) / (float)log10( 2.0f );*/ exp = norm_l( hTdCngDec->Enew_fx ); @@ -658,16 +670,20 @@ void CNG_dec_fx( move32(); } hTdCngDec->ho_sid_bw = L_shl( L_and( hTdCngDec->ho_sid_bw, (Word32) 0x3fffffffL ), 1 ); + move32(); Copy32( env, &( hTdCngDec->ho_env_hist_fx[i_mult( hTdCngDec->ho_hist_ptr, NUM_ENV_CNG )] ), NUM_ENV_CNG ); } - ELSE IF( NE_16( *sid_bw, 0 ) ) + ELSE IF( ( *sid_bw != 0 ) ) { hTdCngDec->ho_sid_bw = L_shl( L_and( hTdCngDec->ho_sid_bw, (Word32) 0x3fffffffL ), 1 ); + move32(); hTdCngDec->ho_sid_bw = L_or( hTdCngDec->ho_sid_bw, 0x1L ); + move32(); } hTdCngDec->ho_hist_size = add( hTdCngDec->ho_hist_size, 1 ); - IF( GT_16( hTdCngDec->ho_hist_size, HO_HIST_SIZE ) ) + move16(); + if ( GT_16( hTdCngDec->ho_hist_size, HO_HIST_SIZE ) ) { hTdCngDec->ho_hist_size = HO_HIST_SIZE; move16(); @@ -677,7 +693,7 @@ void CNG_dec_fx( st_fx->last_CNG_L_frame = st_fx->L_frame; move16(); - IF( NE_32( st_fx->core_brate, SID_1k75 ) ) + if ( NE_32( st_fx->core_brate, SID_1k75 ) ) { hTdCngDec->num_ho = m; move16(); @@ -748,7 +764,8 @@ void swb_CNG_dec_fx( st_fx->last_vad_fx = 1; move16(); st_fx->hTdCngDec->burst_cnt = add( st_fx->hTdCngDec->burst_cnt, 1 ); - IF( GT_16( st_fx->hTdCngDec->burst_cnt, 10 ) ) + move16(); + if ( GT_16( st_fx->hTdCngDec->burst_cnt, 10 ) ) { st_fx->hTdCngDec->burst_cnt = 0; move16(); @@ -788,7 +805,7 @@ void swb_CNG_dec_ivas_fx( st_fx->last_vad_fx = 1; move16(); st_fx->hTdCngDec->burst_cnt = add_sat( st_fx->hTdCngDec->burst_cnt, 1 ); // saturation reached? - IF( GT_16( st_fx->hTdCngDec->burst_cnt, 10 ) ) + if ( GT_16( st_fx->hTdCngDec->burst_cnt, 10 ) ) { st_fx->hTdCngDec->burst_cnt = 0; move16(); @@ -836,18 +853,19 @@ static void shb_CNG_decod_fx( Word32 L_tmp; Word16 tmp2; Word16 allow_cn_step_fx = 0; + move16(); Word16 q; TD_BWE_DEC_HANDLE hBWE_TD; hBWE_TD = st_fx->hBWE_TD; - IF( EQ_16( st_fx->bfi, 0 ) ) + IF( st_fx->bfi == 0 ) { test(); IF( EQ_32( st_fx->core_brate, SID_2k40 ) && EQ_16( sid_bw, 1 ) ) { idx_ener_fx = get_next_indice( st_fx, 4 ); - IF( EQ_16( idx_ener_fx, 0 ) ) + if ( !idx_ener_fx ) { idx_ener_fx = -15; move16(); @@ -857,6 +875,7 @@ static void shb_CNG_decod_fx( /* de-quantization of SHB CNG parameters */ L_tmp = L_mult( idx_ener_fx, 27400 ); /*Q14 */ st_fx->last_shb_cng_ener_fx = extract_l( L_shr( L_sub( L_tmp, 295924 ), 6 ) ); /*Q8 */ + move16(); } ELSE { @@ -864,6 +883,7 @@ static void shb_CNG_decod_fx( /* de-quantization of SHB CNG parameters */ To be verified L_tmp = L_mult( idx_ener_fx, 17615 ); /*Q13*/ st_fx->last_shb_cng_ener_fx = extract_l( L_shr( L_sub( L_tmp, 147962 ), 5 ) ); /*Q8 */ + move16(); #endif } } @@ -888,15 +908,16 @@ static void shb_CNG_decod_fx( IF( NE_16( st_fx->element_mode, IVAS_CPE_DFT ) ) { - IF( LT_16( st_fx->shb_dtx_count_fx, 1000 ) ) + if ( LT_16( st_fx->shb_dtx_count_fx, 1000 ) ) { st_fx->shb_dtx_count_fx = add( st_fx->shb_dtx_count_fx, 1 ); + move16(); } } E_LPC_lsf_lsp_conversion( shb_lspCNG_fx, tmp_lsp, LPC_SHB_ORDER ); /*Q14*/ E_LPC_f_lsp_a_conversion( tmp_lsp, shb_lpcCNG_fx, LPC_SHB_ORDER ); - Copy_Scale_sig( shb_lpcCNG_fx, shb_lpcCNG_fx, add( LPC_SHB_ORDER, 1 ), sub( norm_s( shb_lpcCNG_fx[0] ), 2 ) ); /* Q12 */ + Copy_Scale_sig( shb_lpcCNG_fx, shb_lpcCNG_fx, LPC_SHB_ORDER + 1, sub( norm_s( shb_lpcCNG_fx[0] ), 2 ) ); /* Q12 */ #ifdef IVAS_CODE_CNG // mvr2r(shb_lpcCNG, st->hTdCngDec->shb_lpcCNG, LPC_SHB_ORDER + 1); @@ -912,12 +933,12 @@ static void shb_CNG_decod_fx( exp = sub( 30, add( exp, shl( Qsyn, 1 ) ) ); wb_ener_fx = Mpy_32_16( exp, fra, LG10 ); wb_ener16_fx = round_fx( L_shl( wb_ener_fx, 10 ) ); /*wb_ener_fx in Q8 */ - IF( EQ_16( st_fx->first_CNG, 0 ) ) + if ( !st_fx->first_CNG ) { st_fx->wb_cng_ener_fx = wb_ener16_fx; move16(); /*Q8 */ } - IF( GT_16( abs_s( sub( wb_ener16_fx, st_fx->wb_cng_ener_fx ) ), 3072 ) ) + if ( GT_16( abs_s( sub( wb_ener16_fx, st_fx->wb_cng_ener_fx ) ), 3072 ) ) { allow_cn_step_fx = 1; move16(); @@ -936,12 +957,12 @@ static void shb_CNG_decod_fx( } test(); test(); - IF( EQ_32( st_fx->core_brate, SID_2k40 ) && EQ_16( sid_bw, 1 ) && EQ_16( st_fx->bfi, 0 ) ) + IF( EQ_32( st_fx->core_brate, SID_2k40 ) && EQ_16( sid_bw, 1 ) && ( st_fx->bfi == 0 ) ) { st_fx->last_wb_cng_ener_fx = st_fx->wb_cng_ener_fx; move16(); - IF( EQ_16( st_fx->first_CNG, 0 ) ) + if ( !st_fx->first_CNG ) { st_fx->shb_cng_ener_fx = st_fx->last_shb_cng_ener_fx; move16(); @@ -949,7 +970,7 @@ static void shb_CNG_decod_fx( } gain_fx = sub( st_fx->wb_cng_ener_fx, st_fx->last_wb_cng_ener_fx ); /*8 */ - IF( GT_16( gain_fx, 15 ) ) + if ( GT_16( gain_fx, 15 ) ) { gain_fx = 15; move16(); @@ -959,10 +980,12 @@ static void shb_CNG_decod_fx( IF( EQ_16( allow_cn_step_fx, 1 ) || GT_32( st_fx->last_core_brate, SID_2k40 ) ) { st_fx->shb_cng_ener_fx = add( st_fx->shb_cng_ener_fx, step_fx ); + move16(); } ELSE { st_fx->shb_cng_ener_fx = add( st_fx->shb_cng_ener_fx, mult( 8192, step_fx ) ); /*Q8 */ + move16(); } /* generate white noise excitation */ FOR( i = 0; i < L_FRAME16k; i++ ) @@ -1000,7 +1023,7 @@ static void shb_CNG_decod_fx( ener_fx = st_fx->shb_cng_ener_fx; move16(); /*Q8 */ - IF( GT_16( st_fx->trans_cnt_fx, 0 ) ) + IF( st_fx->trans_cnt_fx > 0 ) { i = extract_l( L_mult0( st_fx->trans_cnt_fx, 17 ) ); /*Q0 */ #ifdef BASOP_NOGLOB @@ -1009,13 +1032,14 @@ static void shb_CNG_decod_fx( ener_fx = add( st_fx->shb_cng_ener_fx, mult( sin_table256_fx[i], sub( st_fx->last_shb_ener_fx, st_fx->shb_cng_ener_fx ) ) ); /*Q8 */ #endif st_fx->trans_cnt_fx = sub( st_fx->trans_cnt_fx, 1 ); + move16(); } tmp = mult( 3277, ener_fx ); /*Q8 */ L_tmp = L_mult( 27213, tmp ); /*Q22, 27213=3.321928 in Q13 */ L_tmp = L_shr( L_tmp, 6 ); /*Q16 */ L_tmp = L_add( L_tmp, 10 << 16 ); - IF( LT_32( L_tmp, 0 ) ) + if ( L_tmp < 0 ) { L_tmp = 0; move32(); @@ -1027,7 +1051,7 @@ static void shb_CNG_decod_fx( L_tmp = L_shl( Pow2( exp, fra ), 5 ); /*Q5 */ #endif L_tmp = L_shr( L_tmp, 10 ); - IF( EQ_32( L_tmp, 0 ) ) + if ( !L_tmp ) { L_tmp = 1; /*Q5 */ } @@ -1046,14 +1070,15 @@ static void shb_CNG_decod_fx( tmp = div_s( fra, tmp ); /*Q15*/ L_tmp = L_deposit_h( tmp ); /*Q31 */ - tmp = -( q + exp1 ) + ( 5 + exp ); + tmp = sub( add( 5, exp ), add( q, exp1 ) ); L_gain_fx = Isqrt_lc( L_tmp, &tmp ); /*Q31-Qtmp */ #ifdef IVAS_CODE_CNG st->hTdCngDec->shb_cng_gain = ener_fx; #endif FOR( i = 0; i < L_FRAME16k; i++ ) { - shb_syn16k_fx[i] = extract_l( L_shr( Mpy_32_16_1( L_gain_fx, excSHB_fx[i] ), 5 - tmp ) ); /*Q3 = 31-Qtmp-8-15-5+Qtmp */ + shb_syn16k_fx[i] = extract_l( L_shr( Mpy_32_16_1( L_gain_fx, excSHB_fx[i] ), sub( 5, tmp ) ) ); /*Q3 = 31-Qtmp-8-15-5+Qtmp */ + move16(); } test(); @@ -1066,9 +1091,10 @@ static void shb_CNG_decod_fx( move32(); } - FOR( i = 0; i < shl( ALLPASSSECTIONS_STEEP, 1 ); i++ ) + FOR( i = 0; i < 2 * ALLPASSSECTIONS_STEEP; i++ ) { hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx[i] = shr( hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx[i], st_fx->prev_Q_bwe_syn2 ); + move16(); } } GenSHBSynth_fx( shb_syn16k_fx, shb_synth_fx, hBWE_TD->genSHBsynth_Hilbert_Mem_fx, hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx, st_fx->L_frame, &( hBWE_TD->syn_dm_phase ) ); @@ -1116,6 +1142,7 @@ static void shb_CNG_decod_ivas_fx( Word16 fra; Word32 L_tmp; Word16 allow_cn_step_fx = 0; + move16(); Word16 q; TD_BWE_DEC_HANDLE hBWE_TD; hBWE_TD = st->hBWE_TD; @@ -1136,10 +1163,12 @@ static void shb_CNG_decod_ivas_fx( IF( EQ_16( st->element_mode, EVS_MONO ) ) { st->hTdCngDec->last_shb_cng_ener_fx_32 = L_sub( L_mult0( idx_ener, 6850 ), 36991 ); // Q11 + move32(); } ELSE { st->hTdCngDec->last_shb_cng_ener_fx_32 = L_sub( L_mult0( idx_ener, 8807 ), 36991 ); // Q11 + move32(); } } } @@ -1155,11 +1184,13 @@ static void shb_CNG_decod_ivas_fx( FOR( i = 0; i < LPC_SHB_ORDER; i++ ) { shb_lspCNG_fx[i] = add( mult_r( interp_fx, st->hTdCngDec->lsp_shb_prev_fx[i] ), mult_r( sub( 32767, interp_fx ), st->hTdCngDec->lsp_shb_prev_prev_fx[i] ) ); // Q14 + move16(); } IF( LE_16( st->hTdCngDec->shb_dtx_count, 1000 ) ) { st->hTdCngDec->shb_dtx_count = add( st->hTdCngDec->shb_dtx_count, 1 ); + move16(); } E_LPC_lsf_lsp_conversion( shb_lspCNG_fx, tmp_lsp, LPC_SHB_ORDER ); /*Q14*/ @@ -1186,12 +1217,12 @@ static void shb_CNG_decod_ivas_fx( wb_ener_fx = Mpy_32_16( exp, fra, LG10 ); wb_ener16_fx = round_fx( L_shl( wb_ener_fx, 10 ) ); /*wb_ener_fx in Q8 */ Word32 wb_ener32_fx = L_shl( wb_ener16_fx, 3 ); /*wb_ener_fx in Q11 */ - IF( EQ_16( st->first_CNG, 0 ) ) + if ( EQ_16( st->first_CNG, 0 ) ) { st->hTdCngDec->wb_cng_ener_fx_32 = wb_ener32_fx; move32(); /*Q11 */ } - IF( GT_32( L_abs( L_sub( wb_ener32_fx, st->hTdCngDec->wb_cng_ener_fx_32 ) ), 24576 ) ) + if ( GT_32( L_abs( L_sub( wb_ener32_fx, st->hTdCngDec->wb_cng_ener_fx_32 ) ), 24576 ) ) { allow_cn_step_fx = 1; move16(); @@ -1207,6 +1238,7 @@ static void shb_CNG_decod_ivas_fx( tmp = L_sub( wb_ener32_fx, st->hTdCngDec->wb_cng_ener_fx_32 ); /*Q11 */ tmp = Mpy_32_16_1( tmp, 29491 ); /*Q11 */ st->hTdCngDec->wb_cng_ener_fx_32 = L_add( st->hTdCngDec->wb_cng_ener_fx_32, tmp ); /*Q11 */ + move32(); } test(); test(); @@ -1215,7 +1247,7 @@ static void shb_CNG_decod_ivas_fx( st->hTdCngDec->last_wb_cng_ener_fx_32 = st->hTdCngDec->wb_cng_ener_fx_32; move32(); - IF( EQ_16( st->first_CNG, 0 ) ) + if ( !st->first_CNG ) { st->hTdCngDec->shb_cng_ener_fx_32 = st->hTdCngDec->last_shb_cng_ener_fx_32; move32(); @@ -1223,7 +1255,7 @@ static void shb_CNG_decod_ivas_fx( } gain_fx = L_sub( st->hTdCngDec->wb_cng_ener_fx_32, st->hTdCngDec->last_wb_cng_ener_fx_32 ); /*Q11 */ - IF( GT_32( gain_fx, 30720 ) ) + if ( GT_32( gain_fx, 30720 ) ) { gain_fx = 30720; move32(); @@ -1233,10 +1265,12 @@ static void shb_CNG_decod_ivas_fx( IF( EQ_16( allow_cn_step_fx, 1 ) || GT_32( st->last_core_brate, SID_2k40 ) ) { st->hTdCngDec->shb_cng_ener_fx_32 = L_add( st->hTdCngDec->shb_cng_ener_fx_32, step_fx ); + move32(); } ELSE { st->hTdCngDec->shb_cng_ener_fx_32 = L_add( st->hTdCngDec->shb_cng_ener_fx_32, L_shr( step_fx, 2 ) ); /*Q11 */ + move32(); } /* generate white noise excitation */ FOR( i = 0; i < L_FRAME16k; i++ ) @@ -1269,7 +1303,7 @@ static void shb_CNG_decod_ivas_fx( st->hTdCngDec->trans_cnt = 0; move16(); test(); - IF( GT_16( st->hTdCngDec->burst_cnt, 3 ) && NE_16( st->last_core, HQ_CORE ) ) + if ( GT_16( st->hTdCngDec->burst_cnt, 3 ) && NE_16( st->last_core, HQ_CORE ) ) { st->hTdCngDec->trans_cnt = 5; move16(); @@ -1283,6 +1317,7 @@ static void shb_CNG_decod_ivas_fx( i = extract_l( L_mult0( st->hTdCngDec->trans_cnt, 17 ) ); /*Q0 */ ener_fx = L_add( st->hTdCngDec->shb_cng_ener_fx_32, Mpy_32_16_1( L_sub( st->hTdCngDec->last_shb_ener_fx, st->hTdCngDec->shb_cng_ener_fx_32 ), sin_table256_fx[i] ) ); /*Q11 */ st->hTdCngDec->trans_cnt = sub( st->hTdCngDec->trans_cnt, 1 ); + move16(); } tmp = L_shr( Mpy_32_16_1( ener_fx, 3277 ), 3 ); /*Q8 */ @@ -1292,7 +1327,7 @@ static void shb_CNG_decod_ivas_fx( L_tmp = L_mult( 27213, tmp_16 ); /*Q22, 27213=3.321928 in Q13 */ L_tmp = L_shr( L_tmp, 6 ); /*Q16 */ L_tmp = L_add( L_tmp, L_shl( 10, 16 ) ); - IF( LT_32( L_tmp, 0 ) ) + if ( ( L_tmp < 0 ) ) { L_tmp = 0; move32(); @@ -1300,7 +1335,7 @@ static void shb_CNG_decod_ivas_fx( fra = L_Extract_lc( L_tmp, &exp ); L_tmp = L_shl( Pow2( exp, fra ), 5 ); /*Q5 */ L_tmp = L_shr( L_tmp, 10 ); - IF( EQ_32( L_tmp, 0 ) ) + if ( !L_tmp ) { L_tmp = 1; move32(); /*Q5 */ @@ -1320,13 +1355,14 @@ static void shb_CNG_decod_ivas_fx( tmp_16 = div_s( fra, tmp_16 ); /*Q15*/ L_tmp = L_deposit_h( tmp_16 ); /*Q31 */ - tmp_16 = -( q + exp1 ) + ( 5 + exp ); + tmp_16 = sub( add( 5, exp ), add( q, exp1 ) ); L_gain_fx = Isqrt_lc( L_tmp, &tmp_16 ); /*Q31-Qtmp */ st->hTdCngDec->shb_cng_gain_fx_32 = ener_fx; move32(); FOR( i = 0; i < L_FRAME16k; i++ ) { - shb_syn16k_fx[i] = extract_l( L_shr( Mpy_32_16_1( L_gain_fx, excSHB_fx[i] ), 5 - tmp_16 ) ); /*Q3 = 31-Qtmp-8-15-5+Qtmp */ + shb_syn16k_fx[i] = extract_l( L_shr( Mpy_32_16_1( L_gain_fx, excSHB_fx[i] ), sub( 5, tmp_16 ) ) ); /*Q3 = 31-Qtmp-8-15-5+Qtmp */ + move16(); } test(); @@ -1342,6 +1378,7 @@ static void shb_CNG_decod_ivas_fx( FOR( i = 0; i < 2 * ALLPASSSECTIONS_STEEP; i++ ) { hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx[i] = shr( hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx[i], st->prev_Q_bwe_syn2 ); + move16(); } } GenSHBSynth_fx( shb_syn16k_fx, shb_synth_fx, hBWE_TD->genSHBsynth_Hilbert_Mem_fx, hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx, st->L_frame, &( hBWE_TD->syn_dm_phase ) ); @@ -1381,6 +1418,7 @@ void td_cng_dec_init_fx( hTdCngDec->old_enr_index = -1; move16(); hTdCngDec->Enew_fx = L_deposit_l( 0 ); + move16(); hTdCngDec->last_allow_cn_step = 0; move16(); #ifdef IVAS_CODE_CNG @@ -1400,6 +1438,7 @@ void td_cng_dec_init_fx( hTdCngDec->ho_hist_ptr = -1; move16(); hTdCngDec->ho_sid_bw = L_deposit_l( 0 ); + move16(); set16_fx( hTdCngDec->ho_lsp_hist_fx, 0, HO_HIST_SIZE * M ); set32_fx( hTdCngDec->ho_ener_hist_fx, 0, HO_HIST_SIZE ); set32_fx( hTdCngDec->ho_env_hist_fx, 0, HO_HIST_SIZE * NUM_ENV_CNG ); @@ -1531,10 +1570,12 @@ void td_cng_dec_init_ivas_fx( IF( NE_16( st->element_mode, EVS_MONO ) ) { hTdCngDec->lsp_shb_prev_fx[i] = ivas_lsp_shb_prev_tbl_fx[i]; + move16(); } ELSE { hTdCngDec->lsp_shb_prev_fx[i] = lsp_shb_prev_tbl_fx[i]; + move16(); } hTdCngDec->lsp_shb_prev_prev_fx[i] = hTdCngDec->lsp_shb_prev_fx[i]; move16(); diff --git a/lib_dec/core_dec_init_fx.c b/lib_dec/core_dec_init_fx.c index 7acc450f9b4f9586521c0fccfbb4a8fce5547c19..684b21fb2271a8426e56d81e7dba23e0de9b6607 100644 --- a/lib_dec/core_dec_init_fx.c +++ b/lib_dec/core_dec_init_fx.c @@ -55,23 +55,29 @@ void open_decoder_LPD_fx( #ifndef NEW_IVAS_OPEN_DEC st->total_brate = total_brate; + move32(); #endif - IF( NE_16( st->codec_mode, MODE1 ) ) /*already updated in MODE1*/ + if ( NE_16( st->codec_mode, MODE1 ) ) /*already updated in MODE1*/ { st->fscale_old = st->fscale; + move16(); } st->sr_core = getCoreSamplerateMode2( st->element_mode, st->total_brate, bwidth, st->flag_ACELP16k, st->rf_flag, st->is_ism_format ); + move32(); st->fscale = sr2fscale_fx( st->sr_core ); + move16(); fscaleFB = sr2fscale_fx( st->output_Fs ); /* initializing variables for frame lengths etc. right in the beginning */ st->L_frame = extract_l( Mult_32_16( st->sr_core, 0x0290 ) ); + move16(); #ifndef NEW_IVAS_OPEN_DEC hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) ); + move16(); #endif - IF( EQ_16( st->ini_frame, 0 ) ) + IF( st->ini_frame == 0 ) { st->last_L_frame = st->L_frame_past = st->L_frame; move16(); @@ -85,9 +91,10 @@ void open_decoder_LPD_fx( IF( st->hTcxDec != NULL ) { hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) ); - IF( EQ_16( st->ini_frame, 0 ) ) + IF( st->ini_frame == 0 ) { st->L_frameTCX_past = st->hTcxDec->L_frameTCX; + move16(); } } #endif @@ -114,7 +121,7 @@ void open_decoder_LPD_fx( IF( ( EQ_16( st->element_mode, EVS_MONO ) && EQ_16( st->L_frame, L_FRAME16k ) && LE_32( st->total_brate, 32000 ) ) || ( GT_16( st->element_mode, EVS_MONO ) && EQ_16( st->L_frame, L_FRAME16k ) && LE_32( total_brate, MAX_ACELP_BRATE ) ) || - ( NE_16( st->tcxonly, 0 ) && ( EQ_32( st->sr_core, 32000 ) || EQ_32( st->sr_core, 16000 ) ) ) ) + ( ( st->tcxonly != 0 ) && ( EQ_32( st->sr_core, 32000 ) || EQ_32( st->sr_core, 16000 ) ) ) ) { st->nb_subfr = NB_SUBFR16k; move16(); @@ -122,15 +129,17 @@ void open_decoder_LPD_fx( /* (float)st->L_frame/(float)st->fscale * (float)FSCALE_DENOM/128.0f * (float)st->total_brate */ st->bits_frame = extract_l( L_shr( Mpy_32_16_1( L_shl( st->total_brate, 1 ), 20972 ), 6 ) ); /* 20972 = 0.01 * 64 * 32768 */ + move16(); assert( FSCALE_DENOM == 512 ); assert( st->fscale == 2 * st->L_frame ); /* this assumption is true if operated in 20ms frames with FSCALE_DENOM == 512, which is the current default */ assert( st->bits_frame == (int) ( (float) st->L_frame / (float) st->fscale * (float) FSCALE_DENOM / 128.0f * (float) st->total_brate / 100.0f + 0.49f ) ); st->TcxBandwidth = getTcxBandwidth( bwidth ); + move16(); st->narrowBand = 0; move16(); - IF( EQ_16( bwidth, NB ) ) + if ( EQ_16( bwidth, NB ) ) { st->narrowBand = 1; move16(); @@ -149,22 +158,28 @@ void open_decoder_LPD_fx( #endif i = mult_r( hTcxDec->L_frameTCX, getInvFrameLen( L_FRAME ) ); hTcxDec->pit_max_TCX = extract_l( L_shr( L_mult( st->pit_max, i ), 7 ) ); + move16(); hTcxDec->pit_min_TCX = extract_l( L_shr( L_mult( st->pit_min, i ), 7 ) ); + move16(); } } ELSE { st->pit_res_max = initPitchLagParameters( st->sr_core, &st->pit_min, &st->pit_fr1, &st->pit_fr1b, &st->pit_fr2, &st->pit_max ); + move16(); IF( hTcxDec != NULL ) { i = mult_r( hTcxDec->L_frameTCX, getInvFrameLen( st->L_frame ) ); hTcxDec->pit_max_TCX = extract_l( L_shr( L_mult( st->pit_max, i ), 7 ) ); + move16(); hTcxDec->pit_min_TCX = extract_l( L_shr( L_mult( st->pit_min, i ), 7 ) ); + move16(); } } - IF( EQ_16( st->ini_frame, 0 ) ) + if ( !st->ini_frame ) { st->pit_res_max_past = st->pit_res_max; + move16(); } /*Preemphasis param*/ @@ -200,14 +215,15 @@ void open_decoder_LPD_fx( st->lpcQuantization = 0; move16(); test(); - IF( EQ_16( st->tcxonly, 0 ) && LE_32( st->sr_core, INT_FS_16k ) ) + if ( ( st->tcxonly == 0 ) && LE_32( st->sr_core, INT_FS_16k ) ) { st->lpcQuantization = 1; + move16(); } st->numlpc = 2; move16(); - IF( EQ_16( st->tcxonly, 0 ) ) + if ( st->tcxonly == 0 ) { st->numlpc = 1; move16(); @@ -215,11 +231,13 @@ void open_decoder_LPD_fx( /* Initialize TBE */ st->prev_coder_type = GENERIC; + move16(); IF( st->hBWE_TD != NULL ) { - set16_fx( hBWE_TD->prev_lsf_diff_fx, 16384, sub( LPC_SHB_ORDER, 2 ) ); + set16_fx( hBWE_TD->prev_lsf_diff_fx, 16384, LPC_SHB_ORDER - 2 ); hBWE_TD->prev_tilt_para_fx = 0; - set16_fx( hBWE_TD->cur_sub_Aq_fx, 0, add( M, 1 ) ); + move16(); + set16_fx( hBWE_TD->cur_sub_Aq_fx, 0, M + 1 ); } /*TCX config*/ @@ -229,7 +247,7 @@ void open_decoder_LPD_fx( st->hTcxCfg->tcx_mdct_window_length_old = st->hTcxCfg->tcx_mdct_window_length; move16(); init_TCX_config( st->hTcxCfg, st->L_frame, st->fscale, hTcxDec->L_frameTCX, fscaleFB ); // TEMPORARY should be rename to init_TCX_config - IF( EQ_16( st->ini_frame, 0 ) ) + IF( st->ini_frame == 0 ) { st->hTcxCfg->tcx_last_overlap_mode = st->hTcxCfg->tcx_curr_overlap_mode = ALDO_WINDOW; move16(); @@ -238,25 +256,31 @@ void open_decoder_LPD_fx( /* TCX Offset */ st->hTcxCfg->tcx_offset = shr( st->hTcxCfg->tcx_mdct_window_delay, 1 ); + move16(); st->hTcxCfg->tcx_offsetFB = shr( st->hTcxCfg->tcx_mdct_window_delayFB, 1 ); + move16(); /* Initialize FAC */ st->hTcxCfg->lfacNext = sub( st->hTcxCfg->tcx_offset, shr( st->L_frame, 2 ) ); + move16(); st->hTcxCfg->lfacNextFB = sub( st->hTcxCfg->tcx_offsetFB, shr( hTcxDec->L_frameTCX, 2 ) ); + move16(); /* set number of coded lines */ st->hTcxCfg->tcx_coded_lines = getNumTcxCodedLines( st->bwidth ); + move16(); /* TNS in TCX */ st->hTcxCfg->pCurrentTnsConfig = NULL; st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( st->total_brate, st->igf, st->element_mode ); + move16(); IF( st->hTcxCfg->fIsTNSAllowed != 0 ) { InitTnsConfigs( st->bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFDec->infoIGFStopFreq, st->total_brate, st->element_mode, 0 /*is_mct*/ ); } /*Constraint for adaptive BPF, otherwise parameter estimation and post-processing not time aligned*/ - IF( EQ_16( st->tcxonly, 0 ) ) + if ( st->tcxonly == 0 ) { assert( 0 == ( st->hTcxCfg->lfacNext > 0 ? st->hTcxCfg->lfacNext : 0 ) ); } @@ -280,7 +304,8 @@ void open_decoder_LPD_fx( #else - IF( st->hIGFDec != NULL ){ + if ( st->hIGFDec != NULL ) + { PMT( "To be done" ) // IF (!is_init || st->element_mode != IVAS_CPE_MDCT) //{ @@ -308,20 +333,21 @@ void open_decoder_LPD_fx( /* Initialize decoder delay */ - IF( NE_16( st->element_mode, IVAS_SCE ) ) + if ( NE_16( st->element_mode, IVAS_SCE ) ) { st->flag_cna = 0; move16(); } - IF( EQ_16( st->ini_frame, 0 ) ) + IF( st->ini_frame == 0 ) { st->flag_cna = 0; st->last_flag_cna = 0; move16(); + move16(); } /* Static vectors to zero */ - IF( EQ_16( st->ini_frame, 0 ) ) + IF( st->ini_frame == 0 ) { st->last_is_cng = 0; @@ -360,6 +386,7 @@ void open_decoder_LPD_fx( { /* Reset old_synth in case of core sampling rate switching and codec switching*/ test(); + test(); IF( st->hTcxDec != NULL && ( ( NE_16( st->L_frame, st->last_L_frame ) ) || ( EQ_16( st->last_codec_mode, MODE1 ) ) ) ) { set16_fx( hTcxDec->old_synth, 0, OLD_SYNTH_INTERNAL_DEC ); @@ -407,14 +434,14 @@ void open_decoder_LPD_fx( test(); test(); test(); - IF( ( NE_16( st->element_mode, IVAS_CPE_DFT ) || ( EQ_16( st->element_mode, IVAS_CPE_DFT ) && st->prev_bfi ) ) && EQ_16( st->last_codec_mode, MODE1 ) && EQ_16( st->last_core, ACELP_CORE ) ) + IF( ( NE_16( st->element_mode, IVAS_CPE_DFT ) || ( EQ_16( st->element_mode, IVAS_CPE_DFT ) && st->prev_bfi ) ) && EQ_16( st->last_codec_mode, MODE1 ) && ( st->last_core == ACELP_CORE ) ) { st->last_core_bfi = ACELP_CORE; move16(); /*PLC*/ #ifndef NEW_IVAS_OPEN_DEC - IF( NE_16( st->prev_bfi, 0 ) ) + IF( st->prev_bfi != 0 ) { PWord16 const *w; Word16 W1, W2, nz, delay_comp; @@ -423,7 +450,6 @@ void open_decoder_LPD_fx( move16(); W2 = shr( st->hTcxCfg->tcx_mdct_window_lengthFB, 1 ); w = st->hTcxCfg->tcx_mdct_windowFB; /*pointer - no need to instrument*/ - move16(); nz = NS2SA_fx2( st->output_Fs, N_ZERO_MDCT_NS ); move16(); @@ -442,13 +468,15 @@ void open_decoder_LPD_fx( FOR( i = 0; i < W2; i++ ) { - hHQ_core->old_out_fx[add( i, nz )] = round_fx( Mpy_32_16_1( L_mult( w[i].v.re, w[i].v.re ), hHQ_core->old_out_fx[add( i, nz )] ) ); + hHQ_core->old_out_fx[i + nz] = round_fx( Mpy_32_16_1( L_mult( w[i].v.re, w[i].v.re ), hHQ_core->old_out_fx[i + nz] ) ); + move16(); } FOR( ; i < W1; i++ ) { - hHQ_core->old_out_fx[add( i, nz )] = round_fx( Mpy_32_16_1( L_mult( w[sub( W2, add( 1, sub( i, W2 ) ) )].v.im, w[sub( W2, add( 1, sub( i, W2 ) ) )].v.im ), hHQ_core->old_out_fx[add( i, nz )] ) ); + hHQ_core->old_out_fx[i + nz] = round_fx( Mpy_32_16_1( L_mult( w[sub( W2, add( 1, sub( i, W2 ) ) )].v.im, w[sub( W2, add( 1, sub( i, W2 ) ) )].v.im ), hHQ_core->old_out_fx[i + nz] ) ); + move16(); } - set16_fx( &hHQ_core->old_out_fx[add( W1, nz )], 0, nz ); + set16_fx( &hHQ_core->old_out_fx[W1 + nz], 0, nz ); lerp( hHQ_core->old_out_fx, hHQ_core->old_out_LB_fx, st->L_frame, hTcxDec->L_frameTCX ); @@ -474,8 +502,8 @@ void open_decoder_LPD_fx( test(); IF( EQ_16( st->last_codec_mode, MODE2 ) && NE_16( st->L_frame, st->last_L_frame ) && - ( ( EQ_16( st->m_frame_type, SID_FRAME ) && GT_16( st->last_core, ACELP_CORE ) ) || - ( GT_16( st->last_core, ACELP_CORE ) && GT_16( st->core, ACELP_CORE ) ) || + ( ( EQ_16( st->m_frame_type, SID_FRAME ) && ( st->last_core > ACELP_CORE ) ) || + ( ( st->last_core > ACELP_CORE ) && ( st->core > ACELP_CORE ) ) || st->prev_bfi ) ) { lerp( hHQ_core->old_out_LB_fx, hHQ_core->old_out_LB_fx, st->L_frame, st->last_L_frame ); @@ -501,10 +529,10 @@ void open_decoder_LPD_fx( /*OLA -> zero */ IF( st->hTcxDec != NULL ) { - set16_fx( hTcxDec->old_syn_Overl, 0, shr( L_FRAME32k, 1 ) ); /*HQ-CORE(bfi)->TCX don't need it*/ - set16_fx( hTcxDec->syn_Overl_TDAC, 0, shr( L_FRAME32k, 1 ) ); /*HQ-CORE(bfi)->TCX don't need it*/ - set16_fx( hTcxDec->syn_Overl_TDACFB, 0, shr( L_FRAME_MAX, 1 ) ); /*HQ-CORE(bfi)->TCX don't need it*/ - set16_fx( hTcxDec->syn_Overl, 0, shr( L_FRAME32k, 1 ) ); /*HQ-CORE(bfi)->TCX don't need it*/ + set16_fx( hTcxDec->old_syn_Overl, 0, L_FRAME32k / 2 ); /*HQ-CORE(bfi)->TCX don't need it*/ + set16_fx( hTcxDec->syn_Overl_TDAC, 0, L_FRAME32k / 2 ); /*HQ-CORE(bfi)->TCX don't need it*/ + set16_fx( hTcxDec->syn_Overl_TDACFB, 0, L_FRAME_MAX / 2 ); /*HQ-CORE(bfi)->TCX don't need it*/ + set16_fx( hTcxDec->syn_Overl, 0, L_FRAME32k / 2 ); /*HQ-CORE(bfi)->TCX don't need it*/ #if 0 PMT("to be moved to reset_tcx_overl_buf") #endif @@ -552,7 +580,7 @@ void open_decoder_LPD_fx( /* convert quantized LSP vector */ st->rate_switching_reset = lsp_convert_poly_fx( st->lsp_old_fx, st->L_frame, 0 ); - IF( EQ_16( st->tcxonly, 0 ) ) + IF( st->tcxonly == 0 ) { lsp2lsf_fx( st->lsp_old_fx, st->lsf_old_fx, M, st->sr_core ); } @@ -586,12 +614,12 @@ void open_decoder_LPD_fx( { set16_fx( st->old_exc_fx, 0, L_EXC_MEM_DEC ); } - set16_fx( st->old_Aq_12_8_fx, 0, add( M, 1 ) ); + set16_fx( st->old_Aq_12_8_fx, 0, M + 1 ); /*Resamp others memories*/ /*Size of LPC syn memory*/ lerp( st->mem_syn_r + sub( L_SYN_MEM, mem_syn_r_size_old ), st->mem_syn_r + sub( L_SYN_MEM, mem_syn_r_size_new ), mem_syn_r_size_new, mem_syn_r_size_old ); - Copy( st->mem_syn_r + sub( L_SYN_MEM, M ), st->mem_syn2_fx, M ); + Copy( st->mem_syn_r + L_SYN_MEM - M, st->mem_syn2_fx, M ); /*Untouched memories : st->syn */ } @@ -611,7 +639,9 @@ void open_decoder_LPD_fx( IF( st->hTcxDec != NULL ) { hTcxDec->old_synth_len = shl( st->L_frame, 1 ); + move16(); hTcxDec->old_synth_lenFB = shl( hTcxDec->L_frameTCX, 1 ); + move16(); } /* bass pf reset */ st->bpf_gain_param = 0; @@ -621,18 +651,18 @@ void open_decoder_LPD_fx( set16_fx( hBPF->pst_old_syn_fx, 0, NBPSF_PIT_MAX ); } /* Formant postfilter */ - IF( EQ_16( st->ini_frame, 0 ) ) + IF( st->ini_frame == 0 ) { /*do nothing*/ } ELSE IF( EQ_16( st->last_codec_mode, MODE2 ) ) { - IF( EQ_16( st->tcxonly, 0 ) ) + IF( st->tcxonly == 0 ) { - IF( NE_16( st->hPFstat->on, 0 ) ) + IF( st->hPFstat->on != 0 ) { - lerp( st->hPFstat->mem_stp + sub( L_SYN_MEM, mem_syn_r_size_old ), st->hPFstat->mem_stp + sub( L_SYN_MEM, mem_syn_r_size_new ), mem_syn_r_size_new, mem_syn_r_size_old ); - lerp( st->hPFstat->mem_pf_in + sub( L_SYN_MEM, mem_syn_r_size_old ), st->hPFstat->mem_pf_in + sub( L_SYN_MEM, mem_syn_r_size_new ), mem_syn_r_size_new, mem_syn_r_size_old ); + lerp( st->hPFstat->mem_stp + L_SYN_MEM - mem_syn_r_size_old, st->hPFstat->mem_stp + L_SYN_MEM - mem_syn_r_size_new, mem_syn_r_size_new, mem_syn_r_size_old ); + lerp( st->hPFstat->mem_pf_in + L_SYN_MEM - mem_syn_r_size_old, st->hPFstat->mem_pf_in + L_SYN_MEM - mem_syn_r_size_new, mem_syn_r_size_new, mem_syn_r_size_old ); } ELSE { @@ -644,10 +674,10 @@ void open_decoder_LPD_fx( move16(); } } - ELSE IF( NE_16( st->hPFstat->on, 0 ) ) + ELSE IF( st->hPFstat->on != 0 ) { - lerp( st->hPFstat->mem_stp + sub( L_SYN_MEM, mem_syn_r_size_old ), st->hPFstat->mem_stp + sub( L_SYN_MEM, mem_syn_r_size_new ), mem_syn_r_size_new, mem_syn_r_size_old ); - lerp( st->hPFstat->mem_pf_in + sub( L_SYN_MEM, mem_syn_r_size_old ), st->hPFstat->mem_pf_in + sub( L_SYN_MEM, mem_syn_r_size_new ), mem_syn_r_size_new, mem_syn_r_size_old ); + lerp( st->hPFstat->mem_stp + L_SYN_MEM - mem_syn_r_size_old, st->hPFstat->mem_stp + L_SYN_MEM - mem_syn_r_size_new, mem_syn_r_size_new, mem_syn_r_size_old ); + lerp( st->hPFstat->mem_pf_in + L_SYN_MEM - mem_syn_r_size_old, st->hPFstat->mem_pf_in + L_SYN_MEM - mem_syn_r_size_new, mem_syn_r_size_new, mem_syn_r_size_old ); } } ELSE @@ -660,14 +690,14 @@ void open_decoder_LPD_fx( { st->hPFstat->reset = 1; move16(); - IF( NE_16( st->hPFstat->on, 0 ) ) + IF( st->hPFstat->on != 0 ) { st->hPFstat->reset = 0; move16(); Scale_sig( st->hPFstat->mem_pf_in, L_SUBFR, negate( st->Q_syn ) ); /* WB post_filter mem */ Scale_sig( st->hPFstat->mem_stp, L_SUBFR, negate( st->Q_syn ) ); /* WB post_filter mem */ - lerp( st->hPFstat->mem_stp + sub( L_SYN_MEM, mem_syn_r_size_old ), st->hPFstat->mem_stp + sub( L_SYN_MEM, mem_syn_r_size_new ), mem_syn_r_size_new, mem_syn_r_size_old ); - lerp( st->hPFstat->mem_pf_in + sub( L_SYN_MEM, mem_syn_r_size_old ), st->hPFstat->mem_pf_in + sub( L_SYN_MEM, mem_syn_r_size_new ), mem_syn_r_size_new, mem_syn_r_size_old ); + lerp( st->hPFstat->mem_stp + L_SYN_MEM - mem_syn_r_size_old, st->hPFstat->mem_stp + L_SYN_MEM - mem_syn_r_size_new, mem_syn_r_size_new, mem_syn_r_size_old ); + lerp( st->hPFstat->mem_pf_in + L_SYN_MEM - mem_syn_r_size_old, st->hPFstat->mem_pf_in + L_SYN_MEM - mem_syn_r_size_new, mem_syn_r_size_new, mem_syn_r_size_old ); } } } @@ -680,21 +710,21 @@ void open_decoder_LPD_fx( Scale_sig( st->hPFstat->mem_stp, L_SUBFR, negate( st->Q_syn ) ); /* NB post_filter mem */ } /*feed last value old_synth as it is used for pre-emphasis mem*/ - IF( st->hTcxDec != NULL ) + if ( st->hTcxDec != NULL ) { - hTcxDec->old_synth[sub( hTcxDec->old_synth_len, 1 )] = st->syn[M]; + hTcxDec->old_synth[hTcxDec->old_synth_len - 1] = st->syn[M]; + move16(); } - move16(); - IF( st->hBPF != NULL ) + if ( st->hBPF != NULL ) { - hBPF->pst_old_syn_fx[sub( NBPSF_PIT_MAX, 1 )] = st->syn[M]; + hBPF->pst_old_syn_fx[NBPSF_PIT_MAX - 1] = st->syn[M]; + move16(); } - move16(); } } /* lsf and lsp initialization */ - IF( EQ_16( st->ini_frame, 0 ) ) + IF( st->ini_frame == 0 ) { Copy( st->lsp_old_fx, st->lspold_uw, M ); Copy( st->lsf_old_fx, st->lsfold_uw, M ); @@ -707,7 +737,9 @@ void open_decoder_LPD_fx( st->past_gpit = 0; move16(); st->past_gcode = L_deposit_l( 0 ); + move32(); st->gc_threshold_fx = L_deposit_l( 0 ); + move32(); E_LPC_lsf_lsp_conversion( st->lsf_cng, st->lspold_cng, M ); E_LPC_f_lsp_a_conversion( st->lspold_cng, st->Aq_cng, M ); @@ -719,31 +751,31 @@ void open_decoder_LPD_fx( Copy( st->lsp_old_fx, st->old_lsp_q_cng, M ); set16_fx( st->mem_syn_unv_back, 0, M ); - st->last_gain_syn_deemph = 16384; + st->last_gain_syn_deemph = 32768 / 2; move16(); st->last_gain_syn_deemph_e = 1; move16(); test(); - IF( EQ_16( st->last_codec_mode, MODE1 ) || EQ_16( st->ini_frame, 0 ) ) + IF( EQ_16( st->last_codec_mode, MODE1 ) || st->ini_frame == 0 ) { /* this assumes that MODE1 fades out in the frequency domain - otherwise some data from MODE1 would be needed here */ - st->last_concealed_gain_syn_deemph = 16384; + st->last_concealed_gain_syn_deemph = 32768 / 2; move16(); st->last_concealed_gain_syn_deemph_e = 1; move16(); - IF( hTcxDec != NULL ) + if ( hTcxDec != NULL ) { - hTcxDec->conceal_eof_gain = 16384; /*Q14*/ + hTcxDec->conceal_eof_gain = 32768 / 2; /*Q14*/ move16(); } } /* Post processing */ - set16_fx( st->mem_Aq, 0, i_mult( NB_SUBFR16k, add( M, 1 ) ) ); + set16_fx( st->mem_Aq, 0, i_mult( NB_SUBFR16k, ( M + 1 ) ) ); st->lp_ener_FER_fx = 15360; move16(); /*60 in Q8*/ - IF( EQ_16( st->ini_frame, 0 ) ) + IF( st->ini_frame == 0 ) { st->prev_bfi = 0; move16(); @@ -762,7 +794,7 @@ void open_decoder_LPD_fx( st->clas_dec = UNVOICED_CLAS; move16(); move16(); - IF( !st->last_con_tcx ) + if ( !st->last_con_tcx ) { move16(); st->old_enr_LP = 0; /* LP filter E of last good voiced frame or local LP filter E in TD TCX PLC */ @@ -786,13 +818,16 @@ void open_decoder_LPD_fx( st->last_good = UNVOICED_CLAS; /* last good received frame for concealment */ move16(); st->enr_old_fx = L_deposit_l( 0 ); /* energy at the end of the previous frame */ + move32(); } st->Mode2_lp_gainc = L_deposit_l( 0 ); + move32(); st->Mode2_lp_gainp = L_deposit_l( 0 ); + move32(); st->prev_widow_left_rect = 0; move16(); - IF( st->hTcxDec != NULL ) + if ( st->hTcxDec != NULL ) { #ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT /* Todo: should be considered for other stereo modes as well */ @@ -810,7 +845,8 @@ void open_decoder_LPD_fx( #else hTcxDec->conCngLevelBackgroundTrace = PLC_MIN_CNG_LEV_Q21; /*Q21*/ move16(); - hTcxDec->conNoiseLevelIndex = sub( PLC_MIN_STAT_BUFF_SIZE, 1 ); + hTcxDec->conNoiseLevelIndex = PLC_MIN_STAT_BUFF_SIZE - 1; + move16(); hTcxDec->conCurrLevelIndex = 0; move16(); hTcxDec->conLastFrameLevel = PLC_MIN_CNG_LEV; /*Q15*/ @@ -823,18 +859,20 @@ void open_decoder_LPD_fx( move16(); hTcxDec->cummulative_damping_tcx = 32767 /*1.0f Q15*/; + move16(); #endif } move16(); st->cummulative_damping = 32767 /*1.0f Q15*/; move16(); - FOR( i = 0; i < add( shl( NB_SUBFR16k, 1 ), 2 ); i++ ) + FOR( i = 0; i < 2 * NB_SUBFR16k + 2; i++ ) { st->old_pitch_buf_fx[i] = L_deposit_h( st->pit_min ); + move16(); } - FOR( i = 0; i < add( shl( NB_SUBFR16k, 1 ), 2 ); i++ ) + FOR( i = 0; i < 2 * NB_SUBFR16k + 2; i++ ) { st->mem_pitch_gain[i] = 16384 /*1.f Q14*/; /*Q14*/ move16(); @@ -842,8 +880,10 @@ void open_decoder_LPD_fx( st->old_fpitch = L_deposit_h( st->pit_min ); + move32(); #ifndef NEW_IVAS_OPEN_DEC st->old_fpitchFB = L_deposit_h( hTcxDec->pit_min_TCX ); + move32(); #endif st->rate_switching_init = 1; move16(); @@ -853,6 +893,7 @@ void open_decoder_LPD_fx( /* For phase dispersion */ st->dm_fx.prev_gain_code = L_deposit_l( 0 ); + move32(); set16_fx( st->dm_fx.prev_gain_pit, 0, 6 ); st->dm_fx.prev_state = 0; move16(); @@ -861,9 +902,10 @@ void open_decoder_LPD_fx( move16(); /* TCX-LTP */ - IF( hTcxLtpDec != NULL ) + if ( hTcxLtpDec != NULL ) { hTcxLtpDec->tcxltp = getTcxLtp( st->sr_core ); + move16(); } move16(); @@ -878,12 +920,13 @@ void open_decoder_LPD_fx( move16(); hTcxLtpDec->tcxltp_pitch_fr = 0; move16(); - IF( hTcxDec != NULL ) + if ( hTcxDec != NULL ) { hTcxDec->tcxltp_last_gain_unmodified = 0; + move16(); } move16(); - IF( EQ_16( st->ini_frame, 0 ) ) + IF( st->ini_frame == 0 ) { set16_fx( hTcxLtpDec->tcxltp_mem_in, 0, TCXLTP_MAX_DELAY ); set16_fx( hTcxLtpDec->tcxltp_mem_out, 0, L_FRAME48k ); @@ -903,6 +946,7 @@ void open_decoder_LPD_fx( { st->lp_error_ener = Mpy_32_16_1( L_shl( hBPF->pst_lp_ener_fx, 8 ), 0x2a86 ); /* convert from 7Q8 10*log10 -> 15Q16, log2 */ + move32(); } ELSE { @@ -910,7 +954,9 @@ void open_decoder_LPD_fx( move16(); } st->mem_error = L_deposit_l( 0 ); + move32(); st->hTcxCfg->ctx_hm = getCtxHm( st->element_mode, total_brate, st->rf_flag ); + move16(); st->last_ctx_hm_enabled = 0; move16(); @@ -922,13 +968,13 @@ void open_decoder_LPD_fx( IF( hTcxDec != NULL ) { hTcxDec->tcx_lpc_shaped_ari = getTcxLpcShapedAri( total_brate, st->rf_flag, st->element_mode ); - + move16(); hTcxDec->envWeighted = 0; + move16(); } - move16(); st->p_bpf_noise_buf = NULL; - IF( EQ_16( st->tcxonly, 0 ) ) + if ( st->tcxonly == 0 ) { st->p_bpf_noise_buf = st->bpf_noise_buf; } @@ -964,6 +1010,8 @@ void open_decoder_LPD_fx( st->enablePlcWaveadjust = 0; move16(); + test(); + test(); IF( st->hTcxDec != NULL && GE_32( st->total_brate, 48000 ) && EQ_16( st->element_mode, EVS_MONO ) ) { st->enablePlcWaveadjust = 1; @@ -982,6 +1030,8 @@ void open_decoder_LPD_fx( PMT("handle to tonalMDCTconceal is missing") #endif //#ifdef ADD_IVAS_HTONALMDCTCONC + test(); + test(); IF( /*st->ADD_IVAS_HTONALMDCTCONC != NULL &&*/ !( GT_16( st->element_mode, EVS_MONO ) && NE_16( st->ini_frame, 0 ) && EQ_16( st->tonalMDCTconceal.nSamples, st->hTcxDec->L_frameTCX ) ) ) { st->tonalMDCTconceal.nScaleFactors = 0; @@ -998,8 +1048,11 @@ void open_decoder_LPD_fx( TonalMDCTConceal_Init_ivas_fx( &st->tonalMDCTconceal, hTcxDec->L_frameTCX, st->L_frame, FDNS_NPTS, st->hTcxCfg ); } st->last_tns_active = 0; + move16(); st->second_last_tns_active = 0; + move16(); st->second_last_core = -1; + move16(); #ifdef NEW_IVAS_OPEN_DEC IF( st->hTcxCfg != NULL && NE_16( st->element_mode, EVS_MONO ) ) { @@ -1050,7 +1103,7 @@ void open_decoder_LPD_fx( st->hTcxCfg->na_scale = 32767 /*1.0f Q15*/; move16(); #endif - IF( hTcxLtpDec != NULL ) + if ( hTcxLtpDec != NULL ) { hTcxLtpDec->tcxltp_gain = 0; move16(); @@ -1080,7 +1133,7 @@ void tcxltp_dec_init_fx( hTcxLtpDec->tcxltp_pitch_fr = 0; move16(); - IF( EQ_16( ini_frame, 0 ) ) + IF( ini_frame == 0 ) { set16_fx( hTcxLtpDec->tcxltp_mem_in, 0, TCXLTP_MAX_DELAY ); set16_fx( hTcxLtpDec->tcxltp_mem_out, 0, L_FRAME48k ); @@ -1111,8 +1164,7 @@ void acelp_plc_mdct_transition_fx( Word16 i; /*PLC*/ - test(); - IF( NE_16( st->prev_bfi, 0 ) && st->hTcxCfg != NULL ) + IF( st->prev_bfi != 0 && st->hTcxCfg != NULL ) { W1 = st->hTcxCfg->tcx_mdct_window_lengthFB; move16(); @@ -1134,13 +1186,15 @@ void acelp_plc_mdct_transition_fx( FOR( i = 0; i < W2; i++ ) { - st->hHQ_core->old_out_fx[add( i, nz )] = round_fx( Mpy_32_16_1( L_mult( w[i].v.re, w[i].v.re ), st->hHQ_core->old_out_fx[add( i, nz )] ) ); + st->hHQ_core->old_out_fx[i + nz] = round_fx( Mpy_32_16_1( L_mult( w[i].v.re, w[i].v.re ), st->hHQ_core->old_out_fx[i + nz] ) ); + move16(); } FOR( ; i < W1; i++ ) { - st->hHQ_core->old_out_fx[add( i, nz )] = round_fx( Mpy_32_16_1( L_mult( w[sub( W2, add( 1, sub( i, W2 ) ) )].v.im, w[sub( W2, add( 1, sub( i, W2 ) ) )].v.im ), st->hHQ_core->old_out_fx[add( i, nz )] ) ); + st->hHQ_core->old_out_fx[i + nz] = round_fx( Mpy_32_16_1( L_mult( w[W2 - 1 - ( i - W2 )].v.im, w[W2 - 1 - ( i - W2 )].v.im ), st->hHQ_core->old_out_fx[i + nz] ) ); + move16(); } - set16_fx( &st->hHQ_core->old_out_fx[add( W1, nz )], 0, nz ); + set16_fx( &st->hHQ_core->old_out_fx[W1 + nz], 0, nz ); lerp( st->hHQ_core->old_out_fx, st->hHQ_core->old_out_LB_fx, st->L_frame, st->hTcxDec->L_frameTCX ); Copy( st->hHQ_core->old_out_fx + nz, st->hTcxDec->syn_Overl_TDACFB, shr( st->hTcxDec->L_frameTCX, 1 ) ); @@ -1149,6 +1203,7 @@ void acelp_plc_mdct_transition_fx( move16(); Copy( st->hHQ_core->old_out_LB_fx + nz, st->hTcxDec->syn_Overl_TDAC, shr( st->L_frame, 1 ) ); st->hHQ_core->Q_old_wtda_LB = st->hHQ_core->Q_old_wtda; + move16(); } return; @@ -1189,29 +1244,35 @@ void open_decoder_LPD_ivas_fx( hTcxLtpDec = st->hTcxLtpDec; hTcxDec = st->hTcxDec; - IF( NE_16( st->codec_mode, MODE1 ) ) /*already updated in MODE1*/ + if ( NE_16( st->codec_mode, MODE1 ) ) /*already updated in MODE1*/ { st->fscale_old = st->fscale; move16(); } st->sr_core = getCoreSamplerateMode2( st->element_mode, total_brate, bwidth, st->flag_ACELP16k, st->rf_flag, st->is_ism_format ); + move16(); st->fscale = sr2fscale_fx( st->sr_core ); + move16(); fscaleFB = sr2fscale_fx( st->output_Fs ); + move16(); /* initializing variables for frame lengths etc. right in the beginning */ st->L_frame = extract_l( Mult_32_16( st->sr_core, 0x0290 ) ); - IF( EQ_16( st->ini_frame, 0 ) ) + move16(); + if ( st->ini_frame == 0 ) { st->last_L_frame = st->L_frame_past = st->L_frame; move16(); + move16(); } IF( st->hTcxDec != NULL ) { st->hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) ); + move16(); st->output_frame_fx = st->hTcxDec->L_frameTCX; move16(); - IF( EQ_16( st->ini_frame, 0 ) ) + if ( ( st->ini_frame == 0 ) ) { st->L_frameTCX_past = st->hTcxDec->L_frameTCX; move16(); @@ -1233,7 +1294,7 @@ void open_decoder_LPD_ivas_fx( test(); IF( ( EQ_16( st->element_mode, EVS_MONO ) && EQ_16( st->L_frame, L_FRAME16k ) && LE_32( st->total_brate, 32000 ) ) || ( GT_16( st->element_mode, EVS_MONO ) && EQ_16( st->L_frame, L_FRAME16k ) && LE_32( total_brate, MAX_ACELP_BRATE ) ) || - ( NE_16( st->tcxonly, 0 ) && ( EQ_32( st->sr_core, 32000 ) || EQ_32( st->sr_core, 16000 ) ) ) ) + ( ( st->tcxonly != 0 ) && ( EQ_32( st->sr_core, 32000 ) || EQ_32( st->sr_core, 16000 ) ) ) ) { st->nb_subfr = NB_SUBFR16k; move16(); @@ -1243,14 +1304,16 @@ void open_decoder_LPD_ivas_fx( st->nb_subfr = NB_SUBFR; move16(); } + move16(); st->bits_frame = extract_l( L_shr( Mpy_32_16_1( L_shl( st->total_brate, 1 ), 20972 ), 6 ) ); /* 20972 = 0.01 * 64 * 32768 */ // assert(FSCALE_DENOM == 512); // assert(st->fscale == 2 * st->L_frame); /* this assumption is true if operated in 20ms frames with FSCALE_DENOM == 512, which is the current default */ // assert(st->bits_frame == (int16_t)(((float)st->L_frame / (float)st->fscale) * (float)FSCALE_DENOM / 128.0f * (float)total_brate / 100.0f + 0.49f)); st->TcxBandwidth = getTcxBandwidth( bwidth ); + move16(); st->narrowBand = 0; move16(); - IF( EQ_16( bwidth, NB ) ) + if ( EQ_16( bwidth, NB ) ) { st->narrowBand = 1; move16(); @@ -1259,11 +1322,14 @@ void open_decoder_LPD_ivas_fx( IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) ) { st->pit_res_max = initPitchLagParameters( INT_FS_12k8, &st->pit_min, &st->pit_fr1, &st->pit_fr1b, &st->pit_fr2, &st->pit_max ); + move16(); IF( hTcxDec != NULL ) { i = mult_r( hTcxDec->L_frameTCX, getInvFrameLen( L_FRAME ) ); hTcxDec->pit_max_TCX = extract_l( L_shr( L_mult( st->pit_max, i ), 7 ) ); + move16(); hTcxDec->pit_min_TCX = extract_l( L_shr( L_mult( st->pit_min, i ), 7 ) ); + move16(); } } ELSE @@ -1277,7 +1343,7 @@ void open_decoder_LPD_ivas_fx( } } - IF( EQ_16( st->ini_frame, 0 ) ) + if ( ( st->ini_frame == 0 ) ) { st->pit_res_max_past = st->pit_res_max; move16(); @@ -1337,7 +1403,7 @@ void open_decoder_LPD_ivas_fx( move16(); } - IF( EQ_16( st->tcxonly, 0 ) ) + IF( ( st->tcxonly == 0 ) ) { st->numlpc = 1; move16(); @@ -1353,10 +1419,9 @@ void open_decoder_LPD_ivas_fx( move16(); IF( st->hBWE_TD != NULL ) { - set16_fx( hBWE_TD->prev_lsf_diff_fx, 16384, sub( LPC_SHB_ORDER, 2 ) ); + set16_fx( hBWE_TD->prev_lsf_diff_fx, 16384, LPC_SHB_ORDER - 2 ); hBWE_TD->prev_tilt_para_fx = 0; - move16(); - set16_fx( hBWE_TD->cur_sub_Aq_fx, 0, add( M, 1 ) ); + set16_fx( hBWE_TD->cur_sub_Aq_fx, 0, M + 1 ); } IF( st->hIGFDec != NULL ) @@ -1378,7 +1443,7 @@ void open_decoder_LPD_ivas_fx( IF( st->hTECDec != NULL ) { /*constraint for adaptive bpf, otherwise parameter estimation and post-processing not time aligned*/ - IF( EQ_16( st->tcxonly, 0 ) ) + if ( ( st->tcxonly == 0 ) ) { // To be added later // assert(0 == (st->hTcxCfg->lfacnext > 0 ? st->hTcxCfg->lfacnext : 0)); @@ -1387,12 +1452,12 @@ void open_decoder_LPD_ivas_fx( resetTecDec_Fx( st->hTECDec ); } - IF( NE_16( st->element_mode, IVAS_SCE ) ) + if ( NE_16( st->element_mode, IVAS_SCE ) ) { st->flag_cna = 0; move16(); } - IF( EQ_16( st->ini_frame, 0 ) ) + IF( st->ini_frame == 0 ) { st->flag_cna = 0; move16(); @@ -1401,7 +1466,7 @@ void open_decoder_LPD_ivas_fx( } /* Static vectors to zero */ - IF( EQ_16( st->ini_frame, 0 ) ) + IF( ( st->ini_frame == 0 ) ) { st->last_is_cng = 0; move16(); @@ -1412,13 +1477,13 @@ void open_decoder_LPD_ivas_fx( IF( st->hTcxDec != NULL ) { reset_tcx_overl_buf_fx( st->hTcxDec ); - set16_fx( hTcxDec->syn_OverlFB, 0, shr( L_FRAME_MAX, 1 ) ); + set16_fx( hTcxDec->syn_OverlFB, 0, L_FRAME_MAX / 2 ); set16_fx( hTcxDec->old_synth, 0, OLD_SYNTH_INTERNAL_DEC ); - set16_fx( hTcxDec->synth_history_fx, 0, add( L_PROT48k, L_FRAME_MAX ) ); + set16_fx( hTcxDec->synth_history_fx, 0, L_PROT48k + L_FRAME_MAX ); hTcxDec->q_synth_history_fx = 0; move16(); } - set16_fx( st->syn, 0, add( M, 1 ) ); + set16_fx( st->syn, 0, M + 1 ); set16_fx( st->mem_syn_r, 0, L_SYN_MEM ); mem_syn_r_size_old = 0; /* just to avoid MSVC warnings */ @@ -1433,6 +1498,7 @@ void open_decoder_LPD_ivas_fx( { /* Reset old_synth in case of core sampling rate switching and Mode 1/2 switching*/ test(); + test(); IF( st->hTcxDec != NULL && ( NE_16( st->L_frame, st->last_L_frame ) || ( EQ_16( st->last_codec_mode, MODE1 ) && EQ_16( st->element_mode, EVS_MONO ) ) ) ) { set16_fx( hTcxDec->old_synth, 0, OLD_SYNTH_INTERNAL_DEC ); @@ -1480,7 +1546,7 @@ void open_decoder_LPD_ivas_fx( test(); test(); test(); - IF( ( NE_16( st->element_mode, IVAS_CPE_DFT ) || ( EQ_16( st->element_mode, IVAS_CPE_DFT ) && st->prev_bfi ) ) && EQ_16( st->last_codec_mode, MODE1 ) && EQ_16( st->last_core, ACELP_CORE ) ) + IF( ( NE_16( st->element_mode, IVAS_CPE_DFT ) || ( EQ_16( st->element_mode, IVAS_CPE_DFT ) && st->prev_bfi ) ) && EQ_16( st->last_codec_mode, MODE1 ) && ( st->last_core == ACELP_CORE ) ) { /* Switching from Mode 1 ACELP */ st->last_core_bfi = ACELP_CORE; @@ -1489,13 +1555,17 @@ void open_decoder_LPD_ivas_fx( { acelp_plc_mdct_transition_fx( st ); *Q_syn_Overl_TDAC = sub( *Q_fer_samples, 1 ); + move16(); *Q_syn_Overl = *Q_fer_samples; move16(); *Q_syn_Overl_TDACFB = sub( *Q_fer_samples, 1 ); + move16(); *Q_syn_OverlFB = *Q_fer_samples; move16(); *Q_old_out = sub( *Q_fer_samples, 1 ); + move16(); *Q_old_outLB = sub( *Q_fer_samples, 1 ); + move16(); } } test(); @@ -1504,8 +1574,8 @@ void open_decoder_LPD_ivas_fx( test(); test(); IF( EQ_16( st->last_codec_mode, MODE2 ) && NE_16( st->L_frame, st->last_L_frame ) && - ( ( EQ_16( st->m_frame_type, SID_FRAME ) && GT_16( st->last_core, ACELP_CORE ) ) || - ( GT_16( st->last_core, ACELP_CORE ) && GT_16( st->core, ACELP_CORE ) ) || st->prev_bfi ) ) + ( ( EQ_16( st->m_frame_type, SID_FRAME ) && ( st->last_core > ACELP_CORE ) ) || + ( ( st->last_core > ACELP_CORE ) && ( st->core > ACELP_CORE ) ) || st->prev_bfi ) ) { lerp( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_out_LB_fx, st->L_frame, st->last_L_frame ); } @@ -1527,7 +1597,7 @@ void open_decoder_LPD_ivas_fx( st->tilt_code_fx = TILT_CODE; move16(); set16_fx( st->old_exc_fx, 0, L_EXC_MEM_DEC ); - set16_fx( st->syn, 0, add( 1, M ) ); + set16_fx( st->syn, 0, 1 + M ); set16_fx( st->mem_syn2_fx, 0, M ); /*OLA -> zero */ @@ -1579,6 +1649,7 @@ void open_decoder_LPD_ivas_fx( /* convert quantized LSP vector */ st->rate_switching_reset = lsp_convert_poly_fx( st->lsp_old_fx, st->L_frame, 0 ); + move16(); IF( EQ_16( st->tcxonly, 0 ) ) { lsp2lsf_fx( st->lsp_old_fx, st->lsf_old_fx, M, st->sr_core ); @@ -1612,12 +1683,12 @@ void open_decoder_LPD_ivas_fx( { set16_fx( st->old_exc_fx, 0, L_EXC_MEM_DEC ); } - set16_fx( st->old_Aq_12_8_fx, 0, add( M, 1 ) ); + set16_fx( st->old_Aq_12_8_fx, 0, M + 1 ); /*Resamp others memories*/ /*Size of LPC syn memory*/ lerp( st->mem_syn_r + sub( L_SYN_MEM, mem_syn_r_size_old ), st->mem_syn_r + sub( L_SYN_MEM, mem_syn_r_size_new ), mem_syn_r_size_new, mem_syn_r_size_old ); - Copy( st->mem_syn_r + sub( L_SYN_MEM, M ), st->mem_syn2_fx, M ); + Copy( st->mem_syn_r + L_SYN_MEM - M, st->mem_syn2_fx, M ); } /* update of lsf_old only needed in BASOP */ /* ELSE IF( !st->tcxonly && (st->L_frame == L_FRAME16k) && (st->last_total_brate > ACELP_32k) ) */ @@ -1627,7 +1698,7 @@ void open_decoder_LPD_ivas_fx( } test(); test(); - IF( EQ_16( st->last_bwidth, NB ) && NE_16( st->bwidth, NB ) && NE_16( st->ini_frame, 0 ) ) + if ( EQ_16( st->last_bwidth, NB ) && NE_16( st->bwidth, NB ) && ( st->ini_frame != 0 ) ) { st->rate_switching_reset = 1; move16(); @@ -1648,7 +1719,7 @@ void open_decoder_LPD_ivas_fx( } /* Formant postfilter */ - IF( EQ_16( st->ini_frame, 0 ) ) + IF( ( st->ini_frame == 0 ) ) { /* do nothing */ } @@ -1658,8 +1729,8 @@ void open_decoder_LPD_ivas_fx( { IF( st->hPFstat->on ) { - lerp( st->hPFstat->mem_stp + sub( L_SYN_MEM, mem_syn_r_size_old ), st->hPFstat->mem_stp + sub( L_SYN_MEM, mem_syn_r_size_new ), mem_syn_r_size_new, mem_syn_r_size_old ); - lerp( st->hPFstat->mem_pf_in + sub( L_SYN_MEM, mem_syn_r_size_old ), st->hPFstat->mem_pf_in + sub( L_SYN_MEM, mem_syn_r_size_new ), mem_syn_r_size_new, mem_syn_r_size_old ); + lerp( st->hPFstat->mem_stp + L_SYN_MEM - mem_syn_r_size_old, st->hPFstat->mem_stp + L_SYN_MEM - mem_syn_r_size_new, mem_syn_r_size_new, mem_syn_r_size_old ); + lerp( st->hPFstat->mem_pf_in + L_SYN_MEM - mem_syn_r_size_old, st->hPFstat->mem_pf_in + L_SYN_MEM - mem_syn_r_size_new, mem_syn_r_size_new, mem_syn_r_size_old ); } ELSE { @@ -1672,8 +1743,8 @@ void open_decoder_LPD_ivas_fx( } ELSE IF( st->hPFstat->on ) { - lerp( st->hPFstat->mem_stp + sub( L_SYN_MEM, mem_syn_r_size_old ), st->hPFstat->mem_stp + sub( L_SYN_MEM, mem_syn_r_size_new ), mem_syn_r_size_new, mem_syn_r_size_old ); - lerp( st->hPFstat->mem_pf_in + sub( L_SYN_MEM, mem_syn_r_size_old ), st->hPFstat->mem_pf_in + sub( L_SYN_MEM, mem_syn_r_size_new ), mem_syn_r_size_new, mem_syn_r_size_old ); + lerp( st->hPFstat->mem_stp + L_SYN_MEM - mem_syn_r_size_old, st->hPFstat->mem_stp + L_SYN_MEM - mem_syn_r_size_new, mem_syn_r_size_new, mem_syn_r_size_old ); + lerp( st->hPFstat->mem_pf_in + L_SYN_MEM - mem_syn_r_size_old, st->hPFstat->mem_pf_in + L_SYN_MEM - mem_syn_r_size_new, mem_syn_r_size_new, mem_syn_r_size_old ); } } ELSE @@ -1687,7 +1758,7 @@ void open_decoder_LPD_ivas_fx( { st->hPFstat->reset = 1; move16(); - IF( NE_16( st->hPFstat->on, 0 ) ) + IF( st->hPFstat->on != 0 ) { st->hPFstat->reset = 0; move16(); @@ -1695,8 +1766,8 @@ void open_decoder_LPD_ivas_fx( // Scale_sig(st->hPFstat->mem_pf_in, L_SUBFR, negate(st->Q_syn)); /* WB post_filter mem */ // Scale_sig(st->hPFstat->mem_stp, L_SUBFR, negate(st->Q_syn)); /* WB post_filter mem */ //-------------- - lerp( st->hPFstat->mem_stp + sub( L_SYN_MEM, mem_syn_r_size_old ), st->hPFstat->mem_stp + sub( L_SYN_MEM, mem_syn_r_size_new ), mem_syn_r_size_new, mem_syn_r_size_old ); - lerp( st->hPFstat->mem_pf_in + sub( L_SYN_MEM, mem_syn_r_size_old ), st->hPFstat->mem_pf_in + sub( L_SYN_MEM, mem_syn_r_size_new ), mem_syn_r_size_new, mem_syn_r_size_old ); + lerp( st->hPFstat->mem_stp + L_SYN_MEM - mem_syn_r_size_old, st->hPFstat->mem_stp + L_SYN_MEM - mem_syn_r_size_new, mem_syn_r_size_new, mem_syn_r_size_old ); + lerp( st->hPFstat->mem_pf_in + L_SYN_MEM - mem_syn_r_size_old, st->hPFstat->mem_pf_in + L_SYN_MEM - mem_syn_r_size_new, mem_syn_r_size_new, mem_syn_r_size_old ); } } } @@ -1711,19 +1782,21 @@ void open_decoder_LPD_ivas_fx( //} //------------------ /*feed last value old_synth as it is used for pre-emphasis mem*/ - IF( st->hTcxDec != NULL ) + if ( st->hTcxDec != NULL ) { - st->hTcxDec->old_synth[sub( st->hTcxDec->old_synth_len, 1 )] = st->syn[M]; + st->hTcxDec->old_synth[st->hTcxDec->old_synth_len - 1] = st->syn[M]; + move16(); } - IF( st->hBPF != NULL ) + if ( st->hBPF != NULL ) { - st->hBPF->pst_old_syn_fx[sub( NBPSF_PIT_MAX, 1 )] = st->syn[M]; + st->hBPF->pst_old_syn_fx[NBPSF_PIT_MAX - 1] = st->syn[M]; + move16(); } } } /* lsf and lsp initialization */ - IF( EQ_16( st->ini_frame, 0 ) ) + IF( ( st->ini_frame == 0 ) ) { Copy( st->lsp_old_fx, st->lspold_uw, M ); Copy( st->lsf_old_fx, st->lsfold_uw, M ); @@ -1735,7 +1808,9 @@ void open_decoder_LPD_ivas_fx( st->past_gpit = 0; move16(); st->past_gcode = L_deposit_l( 0 ); + move32(); st->gc_threshold_fx = L_deposit_l( 0 ); + move32(); E_LPC_lsf_lsp_conversion( st->lsf_cng, st->lspold_cng, M ); E_LPC_f_lsp_a_conversion( st->lspold_cng, st->Aq_cng, M ); @@ -1746,22 +1821,23 @@ void open_decoder_LPD_ivas_fx( Copy( st->lsp_old_fx, st->lsp_q_cng, M ); Copy( st->lsp_old_fx, st->old_lsp_q_cng, M ); set16_fx( st->mem_syn_unv_back, 0, M ); - st->last_gain_syn_deemph = 16384; /* 1.f Q14*/ - test(); - IF( EQ_16( st->last_codec_mode, MODE1 ) || EQ_16( st->ini_frame, 0 ) ) + st->last_gain_syn_deemph = 32768 / 2; /* 1.f Q14*/ + + IF( EQ_16( st->last_codec_mode, MODE1 ) || ( st->ini_frame == 0 ) ) { /* this assumes that MODE1 fades out in the frequency domain - otherwise some data from MODE1 would be needed here */ - st->last_concealed_gain_syn_deemph = 16384; + st->last_concealed_gain_syn_deemph = 32768 / 2; + move16(); st->last_concealed_gain_syn_deemph_e = 1; move16(); - IF( hTcxDec != NULL ) + if ( hTcxDec != NULL ) { - hTcxDec->conceal_eof_gain = 16384; /*Q14*/ + hTcxDec->conceal_eof_gain = 32768 / 2; /*Q14*/ } } /* Post processing */ - set16_fx( st->mem_Aq, 0, i_mult( NB_SUBFR16k, add( M, 1 ) ) ); + set16_fx( st->mem_Aq, 0, i_mult( NB_SUBFR16k, ( M + 1 ) ) ); st->lp_ener_FER_fx = 15360; /*60.0f Q8*/ move16(); @@ -1771,7 +1847,7 @@ void open_decoder_LPD_ivas_fx( move16(); st->last_core_bfi = -1; move16(); - IF( st->hTcxDec != NULL ) + if ( st->hTcxDec != NULL ) { hTcxDec->tcxConceal_recalc_exc = 0; move16(); @@ -1798,7 +1874,7 @@ void open_decoder_LPD_ivas_fx( st->clas_dec = UNVOICED_CLAS; move16(); - IF( !st->last_con_tcx ) + if ( !st->last_con_tcx ) { st->old_enr_LP = 0; move16(); /* LP filter E of last good voiced frame or local LP filter E in TD TCX PLC */ @@ -1819,11 +1895,16 @@ void open_decoder_LPD_ivas_fx( st->last_good = UNVOICED_CLAS; move16(); /* last good received frame for concealment */ st->enr_old_fx = L_deposit_l( 0 ); /* energy at the end of the previous frame */ + move32(); } st->Mode2_lp_gainc = L_deposit_l( 0 ); + move32(); st->Mode2_lp_gainp = L_deposit_l( 0 ); + move32(); st->lp_gainc_fx = (Word16) L_deposit_l( 0 ); + move16(); st->lp_gainp_fx = (Word16) L_deposit_l( 0 ); + move16(); IF( st->hTcxDec != NULL ) { @@ -1834,17 +1915,20 @@ void open_decoder_LPD_ivas_fx( test(); IF( is_init || MCT_flag || !( EQ_16( st->element_mode, IVAS_CPE_MDCT ) && EQ_16( st->element_mode, last_element_mode ) ) ) { - st->hTcxDec->NoiseLevelIndex_bfi = sub( PLC_MIN_STAT_BUFF_SIZE, 1 ); + st->hTcxDec->NoiseLevelIndex_bfi = PLC_MIN_STAT_BUFF_SIZE - 1; + move16(); st->hTcxDec->CurrLevelIndex_bfi = 0; + move16(); st->hTcxDec->LastFrameLevel_bfi_fx = PLC_MIN_CNG_LEV; + move16(); set16_fx( st->hTcxDec->conNoiseLevelMemory, PLC_MIN_CNG_LEV, PLC_MIN_STAT_BUFF_SIZE ); set16_fx( st->hTcxDec->conNoiseLevelMemory_e, 0, PLC_MIN_STAT_BUFF_SIZE ); st->hTcxDec->cummulative_damping_tcx = 32767 /*1.0f Q15*/; - + move16(); hTcxDec->conCngLevelBackgroundTrace = PLC_MIN_CNG_LEV_Q21; /*Q21*/ move16(); - hTcxDec->conNoiseLevelIndex = sub( PLC_MIN_STAT_BUFF_SIZE, 1 ); + hTcxDec->conNoiseLevelIndex = PLC_MIN_STAT_BUFF_SIZE - 1; move16(); hTcxDec->conCurrLevelIndex = 0; move16(); @@ -1864,17 +1948,19 @@ void open_decoder_LPD_ivas_fx( st->cummulative_damping = 32767 /*1.0f Q15*/; move16(); - FOR( i = 0; i < add( shl( NB_SUBFR16k, 1 ), 2 ); i++ ) + FOR( i = 0; i < 2 * NB_SUBFR16k + 2; i++ ) { st->old_pitch_buf_fx[i] = L_deposit_h( st->pit_min ); + move32(); } - FOR( i = 0; i < add( shl( NB_SUBFR16k, 1 ), 2 ); i++ ) + FOR( i = 0; i < 2 * NB_SUBFR16k + 2; i++ ) { - st->mem_pitch_gain[i] = 16384 /*1.f Q14*/; - move16(); /*Q14*/ + st->mem_pitch_gain[i] = 16384 /*1.f Q14*/; /*Q14*/ + move16(); } st->old_fpitch = L_deposit_h( st->pit_min ); + move32(); st->rate_switching_init = 1; move16(); @@ -1883,10 +1969,12 @@ void open_decoder_LPD_ivas_fx( /* For phase dispersion */ st->dm_fx.prev_gain_code = L_deposit_l( 0 ); + move32(); set16_fx( st->dm_fx.prev_gain_pit, 0, 6 ); st->dm_fx.prev_state = 0; move16(); st->voice_fac = -1; + move16(); /* TCX-LTP */ IF( hTcxLtpDec != NULL ) @@ -1898,9 +1986,10 @@ void open_decoder_LPD_ivas_fx( IF( hTcxDec != NULL ) { st->old_fpitchFB = L_deposit_h( hTcxDec->pit_min_TCX ); + move32(); test(); test(); - IF( EQ_16( st->ini_frame, 0 ) || ( EQ_16( st->last_codec_mode, MODE1 ) && EQ_16( st->element_mode, EVS_MONO ) ) ) + IF( ( st->ini_frame == 0 ) || ( EQ_16( st->last_codec_mode, MODE1 ) && EQ_16( st->element_mode, EVS_MONO ) ) ) { hTcxDec->tcxltp_last_gain_unmodified = 0; move16(); @@ -1908,7 +1997,7 @@ void open_decoder_LPD_ivas_fx( /* TCX */ hTcxDec->tcx_lpc_shaped_ari = getTcxLpcShapedAri( total_brate, st->rf_flag, st->element_mode ); - + move16(); hTcxDec->envWeighted = 0; move16(); } @@ -1916,6 +2005,7 @@ void open_decoder_LPD_ivas_fx( IF( st->hBPF != NULL ) { st->lp_error_ener = Mpy_32_16_1( L_shl( hBPF->pst_lp_ener_fx, 8 ), 0x2a86 ); /* convert from 7Q8 10*log10 -> 15Q16, log2 */ + move32(); hBPF->pst_mem_deemp_err_fx = 0; move16(); } @@ -1990,7 +2080,7 @@ void open_decoder_LPD_ivas_fx( test(); test(); test(); - IF( st->hTonalMDCTConc != NULL && !( GT_16( st->element_mode, EVS_MONO ) && NE_16( st->ini_frame, 0 ) && EQ_16( st->hTonalMDCTConc->nSamples, st->hTcxDec->L_frameTCX ) ) ) + IF( st->hTonalMDCTConc != NULL && !( GT_16( st->element_mode, EVS_MONO ) && ( st->ini_frame != 0 ) && EQ_16( st->hTonalMDCTConc->nSamples, st->hTcxDec->L_frameTCX ) ) ) { st->hTonalMDCTConc->nScaleFactors = 0; move16(); @@ -2014,7 +2104,18 @@ void open_decoder_LPD_ivas_fx( IF( st->hTcxCfg != NULL && NE_16( st->element_mode, EVS_MONO ) ) { - st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( is_init ? total_brate : L_mult( st->bits_frame_nominal, ( FRAMES_PER_SEC >> 1 ) ), st->igf, st->element_mode ); + Word32 gettns_temp; + IF( is_init ) + { + gettns_temp = total_brate; + move32(); + } + ELSE + { + gettns_temp = L_mult( st->bits_frame_nominal, ( FRAMES_PER_SEC >> 1 ) ); + } + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( gettns_temp, st->igf, st->element_mode ); + move16(); } IF( hTcxDec != NULL ) { diff --git a/lib_dec/core_dec_reconf_fx.c b/lib_dec/core_dec_reconf_fx.c index 5682809484e7700f131eb4c1c3bb02c6649e6e13..c347fbe8df726bfab3721c805b7706c755853a53 100644 --- a/lib_dec/core_dec_reconf_fx.c +++ b/lib_dec/core_dec_reconf_fx.c @@ -65,20 +65,22 @@ void reconfig_decoder_LPD_ivas_fx( IF( NE_16( st->element_mode, IVAS_SCE ) ) { st->flag_cna = getCnaPresent_fx( st->element_mode, st->element_brate, total_brate, bwidth ); + move16(); } /* TCX-LTP */ IF( hTcxLtpDec != NULL ) { hTcxLtpDec->tcxltp = getTcxLtp( st->sr_core ); + move16(); } - move16(); /*Scale TCX for non-active frames to adjust loudness with ACELP*/ IF( st->hTcxCfg != NULL ) { Word16 i; st->hTcxCfg->na_scale = 32767 /*1.0f Q15*/; + move16(); test(); IF( ( LT_16( bwidth, SWB ) ) && !( st->tcxonly ) ) { @@ -90,7 +92,7 @@ void reconfig_decoder_LPD_ivas_fx( ( GE_32( total_brate, scaleTcxTable[i].bitrateFrom ) ) && ( LT_32( total_brate, scaleTcxTable[i].bitrateTo ) ) ) { - IF( st->rf_flag ) + if ( st->rf_flag ) { i = sub( i, 1 ); } @@ -102,7 +104,7 @@ void reconfig_decoder_LPD_ivas_fx( } } /*if its not the first frame resample overlap buffer to new sampling rate */ - IF( NE_16( st->ini_frame, 0 ) ) + IF( ( st->ini_frame != 0 ) ) { test(); test(); @@ -135,7 +137,7 @@ void reconfig_decoder_LPD_ivas_fx( lerp( hTcxDec->syn_Overl, hTcxDec->syn_Overl, newLen, oldLen ); test(); - IF( st->prev_bfi && EQ_16( st->last_core_bfi, ACELP_CORE ) ) + IF( st->prev_bfi && ( st->last_core_bfi == ACELP_CORE ) ) { lerp( hTcxDec->syn_Overl_TDAC, hTcxDec->syn_Overl_TDAC, newLen, oldLen ); } @@ -177,14 +179,15 @@ void reconfig_decoder_LPD_ivas_fx( IF( GT_16( st->element_mode, IVAS_SCE ) ) { lowrate_tcxlpc_max_br = LOWRATE_TCXLPC_MAX_BR_CPE; + move32(); } hTcxDec->enableTcxLpc = EQ_16( st->numlpc, 1 ) && EQ_16( st->lpcQuantization, 1 ) && ( LE_32( total_brate, lowrate_tcxlpc_max_br ) /*LOWRATE_TCXLPC_MAX_BR*/ || st->rf_flag ); + move16(); - IF( EQ_16( st->ini_frame, 0 ) ) + IF( ( st->ini_frame == 0 ) ) { hTcxDec->envWeighted = 0; move16(); - move16(); } return; @@ -250,15 +253,15 @@ void reconfig_decoder_LPD_fx( IF( NE_16( st->element_mode, IVAS_SCE ) ) { st->flag_cna = (Word8) getCnaPresent_fx( st->element_mode, st->element_brate, total_brate, bwidth ); + move16(); } - move16(); /* TCX-LTP */ IF( hTcxLtpDec != NULL ) { hTcxLtpDec->tcxltp = getTcxLtp( st->sr_core ); + move16(); } - move16(); IF( st->hTcxCfg != NULL ) { @@ -282,6 +285,7 @@ void reconfig_decoder_LPD_fx( IF( st->rf_flag ) { i = sub( i, 1 ); + move16(); } st->hTcxCfg->na_scale = scaleTcxTable[i].scale; move16(); @@ -292,7 +296,7 @@ void reconfig_decoder_LPD_fx( } /*if its not the first frame resample overlap buffer to new sampling rate */ - IF( NE_16( st->ini_frame, 0 ) ) + IF( ( st->ini_frame != 0 ) ) { test(); test(); @@ -372,6 +376,7 @@ void reconfig_decoder_LPD_fx( move16(); } hTcxDec->enableTcxLpc = EQ_16( st->numlpc, 1 ) && EQ_16( st->lpcQuantization, 1 ) && ( LE_32( total_brate, lowrate_tcxlpc_max_br ) /*LOWRATE_TCXLPC_MAX_BR*/ || st->rf_flag ); + move16(); IF( EQ_16( st->ini_frame, 0 ) ) { hTcxDec->envWeighted = 0; diff --git a/lib_dec/core_dec_switch_fx.c b/lib_dec/core_dec_switch_fx.c index 2316e9c096a242e91f89b3700f40f46aadab2afa..6aaad23ef40e7fd098f9a8c1a0c0b34eba56d021 100644 --- a/lib_dec/core_dec_switch_fx.c +++ b/lib_dec/core_dec_switch_fx.c @@ -47,7 +47,7 @@ void mode_switch_decoder_LPD_fx( bSwitchFromAmrwbIO = 0; move16(); - IF( EQ_16( st->last_core, AMR_WB_CORE ) ) + if ( EQ_16( st->last_core, AMR_WB_CORE ) ) { bSwitchFromAmrwbIO = 1; move16(); @@ -60,6 +60,7 @@ void mode_switch_decoder_LPD_fx( /* set number of coded lines */ st->hTcxCfg->tcx_coded_lines = getNumTcxCodedLines( bwidth ); + move16(); test(); test(); IF( ( ( GE_16( bwidth, WB ) ) && ( EQ_16( fscale, 640 ) ) && ( EQ_16( fscale, st->fscale ) ) ) ) @@ -67,7 +68,7 @@ void mode_switch_decoder_LPD_fx( test(); test(); test(); - IF( ( ( GT_32( total_brate, 32000 ) ) && ( EQ_16( st->tcxonly, 0 ) ) ) || ( ( LE_32( total_brate, 32000 ) ) && ( NE_16( st->tcxonly, 0 ) ) ) ) + IF( ( ( GT_32( total_brate, 32000 ) ) && ( ( st->tcxonly == 0 ) ) ) || ( ( LE_32( total_brate, 32000 ) ) && ( ( st->tcxonly != 0 ) ) ) ) { switchWB = 1; move16(); @@ -75,17 +76,19 @@ void mode_switch_decoder_LPD_fx( } test(); - IF( GT_16( st->last_L_frame, L_FRAME16k ) && LE_32( total_brate, ACELP_32k ) ) + if ( GT_16( st->last_L_frame, L_FRAME16k ) && LE_32( total_brate, ACELP_32k ) ) { switchWB = 1; move16(); } st->igf = getIgfPresent_fx( st->element_mode, total_brate, bwidth, st->rf_flag ); + move16(); IF( st->hIGFDec != NULL ) { st->hIGFDec->infoIGFStopFreq = -1; + move16(); } move16(); test(); @@ -100,7 +103,7 @@ void mode_switch_decoder_LPD_fx( test(); test(); test(); - IF( NE_16( fscale, st->fscale ) || NE_16( switchWB, 0 ) || NE_16( bSwitchFromAmrwbIO, 0 ) || EQ_16( st->last_codec_mode, MODE1 ) || st->force_lpd_reset ) + IF( NE_16( fscale, st->fscale ) || ( switchWB != 0 ) || ( bSwitchFromAmrwbIO != 0 ) || EQ_16( st->last_codec_mode, MODE1 ) || st->force_lpd_reset ) { #ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT open_decoder_LPD_fx( st, total_brate, last_total_brate, bwidth, MCT_flag, last_element_mode, 0 ); @@ -124,11 +127,14 @@ void mode_switch_decoder_LPD_fx( IF( hTcxDec != NULL ) { hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) ); + move16(); } IF( st->hTcxCfg != NULL ) { st->hTcxCfg->ctx_hm = getCtxHm( st->element_mode, total_brate, st->rf_flag ); + move16(); st->hTcxCfg->resq = getResq( total_brate ); + move16(); } move16(); @@ -136,20 +142,20 @@ void mode_switch_decoder_LPD_fx( st->narrowBand = 0; move16(); - IF( EQ_16( bwidth, NB ) ) + if ( EQ_16( bwidth, NB ) ) { st->narrowBand = 1; move16(); } st->TcxBandwidth = getTcxBandwidth( bwidth ); - + move16(); IF( st->hTcxCfg != NULL ) { st->hTcxCfg->pCurrentTnsConfig = NULL; st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( total_brate, st->igf, st->element_mode ); move16(); - IF( NE_16( st->hTcxCfg->fIsTNSAllowed, 0 ) && st->hIGFDec != NULL ) + IF( ( st->hTcxCfg->fIsTNSAllowed != 0 ) && st->hIGFDec != NULL ) { InitTnsConfigs( bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFDec->infoIGFStopFreq, total_brate, st->element_mode, 0 /* 0 should be replaced with MCT_flag*/ ); #ifdef IVAS_CODE @@ -165,7 +171,7 @@ void mode_switch_decoder_LPD_fx( reconfig_decoder_LPD_fx( st, frame_size, bwidth, total_brate, st->last_L_frame ); test(); - IF( NE_16( hTcxDec->envWeighted, 0 ) && EQ_16( hTcxDec->enableTcxLpc, 0 ) ) + IF( hTcxDec->envWeighted != 0 && hTcxDec->enableTcxLpc == 0 ) { Copy( st->lspold_uw, st->lsp_old_fx, M ); Copy( st->lsfold_uw, st->lsf_old_fx, M ); @@ -174,7 +180,7 @@ void mode_switch_decoder_LPD_fx( } /* update PLC LSF memories */ - IF( EQ_16( st->tcxonly, 0 ) ) + IF( st->tcxonly == 0 ) { lsp2lsf_fx( st->lsp_old_fx, st->lsfoldbfi1_fx, M, extract_l( st->sr_core ) ); } @@ -185,7 +191,7 @@ void mode_switch_decoder_LPD_fx( Copy( st->lsfoldbfi1_fx, st->lsfoldbfi0_fx, M ); Copy( st->lsfoldbfi1_fx, st->lsf_adaptive_mean_fx, M ); - IF( NE_16( st->igf, 0 ) && hBWE_TD != NULL ) + IF( st->igf != 0 && hBWE_TD != NULL ) { test(); test(); @@ -213,11 +219,12 @@ void mode_switch_decoder_LPD_fx( } } + test(); test(); test(); IF( ( EQ_16( bwidth, SWB ) ) && ( EQ_32( total_brate, ACELP_16k40 ) || EQ_32( total_brate, ACELP_24k40 ) ) && EQ_16( st->element_mode, EVS_MONO ) ) { - IF( EQ_16( st->tec_tfa, 0 ) ) + if ( st->tec_tfa == 0 ) { set16_fx( st->hTECDec->loBuffer, 0, MAX_TEC_SMOOTHING_DEG ); } @@ -309,7 +316,7 @@ void mode_switch_decoder_LPD_ivas_fx( test(); test(); test(); - IF( ( ( GT_32( total_brate, ACELP_32k ) ) && ( EQ_16( st->tcxonly, 0 ) ) ) || ( ( LE_32( total_brate, ACELP_32k ) ) && EQ_16( st->tcxonly, 1 ) ) ) + IF( ( ( GT_32( total_brate, ACELP_32k ) ) && ( ( st->tcxonly == 0 ) ) ) || ( ( LE_32( total_brate, ACELP_32k ) ) && EQ_16( st->tcxonly, 1 ) ) ) { switchWB = 1; move16(); @@ -324,6 +331,7 @@ void mode_switch_decoder_LPD_ivas_fx( } st->igf = getIgfPresent_fx( st->element_mode, total_brate, bwidth, st->rf_flag ); + move16(); IF( st->hIGFDec != NULL ) { @@ -334,7 +342,7 @@ void mode_switch_decoder_LPD_ivas_fx( move16(); test(); test(); - IF( st->igf && ( EQ_16( st->idchan, 0 ) || EQ_16( st->element_mode, IVAS_CPE_MDCT ) ) ) + IF( st->igf && ( ( st->idchan == 0 ) || EQ_16( st->element_mode, IVAS_CPE_MDCT ) ) ) { /* switch IGF configuration */ IGFDecSetMode_ivas_fx( st->hIGFDec, total_brate, bwidth, st->element_mode, -1, -1, st->rf_flag ); @@ -357,9 +365,11 @@ void mode_switch_decoder_LPD_ivas_fx( st->fscale = fscale; move16(); st->L_frame = extract_l( Mult_32_16( st->sr_core, 0x0290 ) ); + move16(); IF( st->hTcxDec != NULL ) { st->hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) ); + move16(); st->output_frame_fx = st->hTcxDec->L_frameTCX; move16(); } @@ -367,7 +377,9 @@ void mode_switch_decoder_LPD_ivas_fx( IF( st->hTcxCfg != NULL ) { st->hTcxCfg->ctx_hm = getCtxHm( st->element_mode, total_brate, st->rf_flag ); + move16(); st->hTcxCfg->resq = getResq( total_brate ); + move16(); } move16(); @@ -383,8 +395,10 @@ void mode_switch_decoder_LPD_ivas_fx( ELSE { st->narrowBand = 0; + move16(); } st->TcxBandwidth = getTcxBandwidth( bwidth ); + move16(); IF( st->hTcxCfg != NULL ) { @@ -451,6 +465,7 @@ void mode_switch_decoder_LPD_ivas_fx( } test(); test(); + test(); IF( EQ_16( bwidth, SWB ) && ( EQ_32( total_brate, ACELP_16k40 ) || EQ_32( total_brate, ACELP_24k40 ) ) && EQ_16( st->element_mode, EVS_MONO ) ) { IF( EQ_16( st->tec_tfa, 0 ) && st->hTECDec != NULL ) diff --git a/lib_dec/ivas_lfe_plc_fx.c b/lib_dec/ivas_lfe_plc_fx.c index 25a3444ec011d85fed64fe3be3fb1b3c49885503..003392ca908cbf93caa1abe97ff2e79e61f4d52b 100644 --- a/lib_dec/ivas_lfe_plc_fx.c +++ b/lib_dec/ivas_lfe_plc_fx.c @@ -42,6 +42,9 @@ #ifdef IVAS_FLOAT_FIXED #include "ivas_prot_fx.h" #endif +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif /*------------------------------------------------------------------------------------------* * Local constants diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index b8d3fac665c03af8dcb19ba140227b4acbd2c496..9b35fb7c9265eac624fb4bc1ad3bfd828f990fb5 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -49,6 +49,9 @@ #include "math.h" #include "wmc_auto.h" #include "rom_dec.h" +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif #ifdef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------* diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index cb1460ea2e7fa06db32ad8f707ffc697ea656f6a..7332f26f16b6c4f76311d2960c8b87d0d122c3aa 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -44,6 +44,9 @@ #include "prot_fx1.h" #include "prot_fx2.h" #include "ivas_prot_fx.h" +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif /*-----------------------------------------------------------------------* * Local function prototypes diff --git a/lib_dec/ivas_qspherical_dec.c b/lib_dec/ivas_qspherical_dec.c index 40fdbdc5e110950185f986581d140ea2319d10fc..f64051f188fc05cfb4a3310e23f2de133d88f33e 100644 --- a/lib_dec/ivas_qspherical_dec.c +++ b/lib_dec/ivas_qspherical_dec.c @@ -38,6 +38,9 @@ #include "ivas_stat_dec.h" #include "wmc_auto.h" #include "prot.h" +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif /*-------------------------------------------------------------------* diff --git a/lib_dec/ivas_sns_dec_fx.c b/lib_dec/ivas_sns_dec_fx.c index 8d5e1f007c38105182f43ccffccef6b68ee6a970..f240029b3e17df8949b83c1379a700dee9283459 100644 --- a/lib_dec/ivas_sns_dec_fx.c +++ b/lib_dec/ivas_sns_dec_fx.c @@ -42,6 +42,9 @@ #ifdef IVAS_FLOAT_FIXED #include "prot_fx1.h" #include "prot_fx2.h" +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif /*------------------------------------------------------------------- * sns_1st_dec_fx() diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 4d5d54195c66005efa32f5b9a84b88232a43de71..50ca91a304cc1b7d5683bf09a7f253ca7ef6d840 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -46,6 +46,9 @@ #include "ivas_prot_fx.h" #endif // IVAS_FLOAT_FIXED #ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif +#ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------------------------* * Local constants diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index 0e77aa9e40d2773ed4c0128261e0c2b36b38b941..48394bd86677cb3973a0d2eae65968c04bb8475e 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -44,6 +44,10 @@ #include "prot_fx1.h" #include "prot_fx2.h" #endif +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif + /*------------------------------------------------------------------- * Local constants *-------------------------------------------------------------------*/ diff --git a/lib_dec/ivas_stereo_icbwe_dec.c b/lib_dec/ivas_stereo_icbwe_dec.c index 80f9655bf933077628dc594e9210c53c4b832a1b..ca3159f3e576f1456bb7ba9781a9a6b805b8d28c 100644 --- a/lib_dec/ivas_stereo_icbwe_dec.c +++ b/lib_dec/ivas_stereo_icbwe_dec.c @@ -44,6 +44,9 @@ #include "wmc_auto.h" #include "rom_com.h" #include "ivas_rom_com.h" +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif #define Q_icBWE 16 diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 232675e4b135df9fd26c1a6c402f53e1f4cb7f4a..7337086579ff713fbdc5eb63e5c48d6c425ca7dc 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -45,6 +45,9 @@ #include #include "prot_fx2.h" #include "ivas_prot_fx.h" +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif /*-------------------------------------------------------------------* * Local constants diff --git a/lib_dec/ivas_stereo_td_dec.c b/lib_dec/ivas_stereo_td_dec.c index d9401f6654676cd1f70903e53948e4f480d97522..129857e0d71f4f6cd28d67af48548cac7984e50d 100644 --- a/lib_dec/ivas_stereo_td_dec.c +++ b/lib_dec/ivas_stereo_td_dec.c @@ -42,6 +42,9 @@ #include "ivas_rom_com.h" #include "ivas_cnst.h" #include "wmc_auto.h" +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c index 2dc9d607c7aeaf942dd64f531db5f57d9901110f..d08241540eba965e145c48aa0a098dc4b141c0c6 100644 --- a/lib_enc/ivas_core_pre_proc_front.c +++ b/lib_enc/ivas_core_pre_proc_front.c @@ -928,8 +928,9 @@ static void calculate_energy_buffer( Word16 temp_q2 = norm_s( hCPE->hStereoDft->NFFT ); band_res_dft_fx = div_l( L_shl( input_Fs, temp_q1 ), shl( hCPE->hStereoDft->NFFT, temp_q2 ) ); + /* chan_width_f = 24000.f / CLDFB_NO_CHANNELS_MAX; */ chan_width_f_fx = 24000 / CLDFB_NO_CHANNELS_MAX; - chan_width_bins_fx = L_shl( (Word32) div_s( chan_width_f_fx, band_res_dft_fx ), ( sub( add( temp_q1, 1 ), temp_q2 ) ) ); // Q16 + chan_width_bins_fx = L_shl( (Word32) div_s( chan_width_f_fx, band_res_dft_fx ), ( sub( temp_q1, temp_q2 ) ) ); // Q16 pDFT_DMX = hCPE->hStereoDft->DFT[0]; // to be removed start = 1; diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 12f70c3b23ce4c93a999eaee52cf3f2e240266ac..8eaf2d7a0f60b92bbe9e0d4dab15b2027ec8621c 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -46,6 +46,9 @@ #ifdef IVAS_FLOAT_FIXED #include "ivas_prot_fx.h" #endif +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif /*-----------------------------------------------------------------------* diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index c3a0881f616304e643548e2bfc8d1f194452c60e..10efa2f167d92f76e028f28654293aab3a085d94 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -43,6 +43,9 @@ #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "wmc_auto.h" +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif /*------------------------------------------------------------------------- * Local function definitions diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 4cc597b980eaeb94a5e463e0002089ef7784bc0a..6c2d569af9752a7b5b4ce7c9128823e8de833632 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -46,6 +46,9 @@ #include "prot_fx2.h" #include "ivas_prot_fx.h" #endif +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif /*-----------------------------------------------------------------------* diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index bc6e1f9de024cc326711587ca5ae47321a28c710..37d72eda5c4227ac71717502154aecd87e815aff 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -45,6 +45,9 @@ #include "prot_fx1.h" #include "prot_fx2.h" #include "ivas_prot_fx.h" +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif /*-----------------------------------------------------------------------* * Local function prototypes diff --git a/lib_rend/ivas_allrad_dec.c b/lib_rend/ivas_allrad_dec.c index d99b2a1e760d40af54cdba0b48e27095905d7836..6ba37df9e3e93a0dcc53741cf42f80e0fc401e8e 100644 --- a/lib_rend/ivas_allrad_dec.c +++ b/lib_rend/ivas_allrad_dec.c @@ -182,6 +182,7 @@ ivas_error ivas_sba_get_hoa_dec_matrix_fx( ivas_error error; error = IVAS_ERR_OK; + move16(); /* Allocate memory */ assert( *hoa_dec_mtx == NULL && "hoa_dec_mtx != NULL" ); @@ -192,6 +193,7 @@ ivas_error ivas_sba_get_hoa_dec_matrix_fx( /* Initialization by zeroing all SH coeff up to 3rd order (IVAS convention) */ num_spk = hOutSetup.nchan_out_woLFE; + move16(); p_dec_mtx = *hoa_dec_mtx; FOR( i = 0; i < num_spk; i++ ) @@ -199,24 +201,30 @@ ivas_error ivas_sba_get_hoa_dec_matrix_fx( FOR( j = 0; j < SBA_NHARM_HOA3; j++ ) { *( p_dec_mtx++ ) = 0; + move32(); } } - IF( hOutSetup.output_config == IVAS_AUDIO_CONFIG_MONO ) + IF( EQ_32( hOutSetup.output_config, IVAS_AUDIO_CONFIG_MONO ) ) { ( *hoa_dec_mtx )[0] = ONE_IN_Q29; // 1.f in Q29 + move32(); } - ELSE IF( hOutSetup.output_config == IVAS_AUDIO_CONFIG_STEREO ) + ELSE IF( EQ_32( hOutSetup.output_config, IVAS_AUDIO_CONFIG_STEREO ) ) { ( *hoa_dec_mtx )[0] = ONE_IN_Q28; // 0.5f in Q29 ( *hoa_dec_mtx )[1] = ONE_IN_Q28; // 0.5f in Q29 ( *hoa_dec_mtx )[SBA_NHARM_HOA3] = ONE_IN_Q28; // 0.5f in Q29 ( *hoa_dec_mtx )[SBA_NHARM_HOA3 + 1] = -ONE_IN_Q28; // 0.5f in Q29 + move32(); + move32(); + move32(); + move32(); } ELSE IF( hOutSetup.is_loudspeaker_setup ) { /* init EFIP */ - IF( ( error = efap_init_data_fx( &( hEFAP ), hOutSetup.ls_azimuth_fx, hOutSetup.ls_elevation_fx, num_spk, EFAP_MODE_EFIP ) ) != IVAS_ERR_OK ) + IF( NE_16( ( error = efap_init_data_fx( &( hEFAP ), hOutSetup.ls_azimuth_fx, hOutSetup.ls_elevation_fx, num_spk, EFAP_MODE_EFIP ) ), IVAS_ERR_OK ) ) { return error; } @@ -225,6 +233,7 @@ ivas_error ivas_sba_get_hoa_dec_matrix_fx( /* Get t-design values */ num_td = SBA_T_DESIGN_11_SIZE; + move16(); t_design_azi = t_design_11_azimuth_int; t_design_ele = t_design_11_elevation_int; @@ -232,13 +241,39 @@ ivas_error ivas_sba_get_hoa_dec_matrix_fx( FOR( i = 0; i < num_td; i++ ) { /* spherical harmonics response for t-design, corresponding to ambisonic order */ - ivas_dirac_dec_get_response_fx( - ( (Word16) L_shr( t_design_azi[i], 22 ) ) > 0 ? ( (Word16) L_shr( t_design_azi[i], 22 ) ) : ( (Word16) L_shr( t_design_azi[i], 22 ) ) + 1, - ( (Word16) L_shr( t_design_ele[i], 22 ) ) > 0 ? ( (Word16) L_shr( t_design_ele[i], 22 ) ) : ( (Word16) L_shr( t_design_ele[i], 22 ) ) + 1, - Y_td_int, ambisonics_order, Q29 ); + IF( L_shr( t_design_azi[i], 22 ) > 0 ) + { + IF( L_shr( t_design_ele[i], 22 ) > 0 ) + { + ivas_dirac_dec_get_response_fx( extract_l( L_shr( t_design_azi[i], 22 ) ), extract_l( L_shr( t_design_ele[i], 22 ) ), Y_td_int, ambisonics_order, Q29 ); + } + ELSE + { + ivas_dirac_dec_get_response_fx( + extract_l( L_shr( t_design_azi[i], 22 ) ), add( extract_l( L_shr( t_design_ele[i], 22 ) ), 1 ), + Y_td_int, ambisonics_order, Q29 ); + } + } + ELSE + { + IF( L_shr( t_design_ele[i], 22 ) > 0 ) + { + ivas_dirac_dec_get_response_fx( add( extract_l( L_shr( t_design_azi[i], 22 ) ), 1 ), + extract_l( L_shr( t_design_ele[i], 22 ) ), + Y_td_int, ambisonics_order, Q29 ); + } + ELSE + { + ivas_dirac_dec_get_response_fx( + add( extract_l( L_shr( t_design_azi[i], 22 ) ), 1 ), + add( extract_l( L_shr( t_design_ele[i], 22 ) ), 1 ), + Y_td_int, ambisonics_order, Q29 ); + } + } FOR( j = 0; j < num_harm; j++ ) { Y_td_int[j] = L_shl( Mpy_32_32( Y_td_int[j], norm_sn3d_hoa3_int[j] ), Q1 ); // Q28 + move32(); } /* t-design to real LS panning gains */ @@ -248,29 +283,34 @@ ivas_error ivas_sba_get_hoa_dec_matrix_fx( FOR( j = 0; j < num_spk; j++ ) { Word32 dec_mtx_temp = 0; + move32(); FOR( k = 0; k < num_harm; k++ ) { dec_mtx_temp = Mpy_32_32( G_td_int[j], Y_td_int[k] ); // Q27 *p_dec_mtx = L_add( *p_dec_mtx, L_shr( dec_mtx_temp, 2 ) ); // Q25 + move32(); // printf( "\n%f", ((float)*p_dec_mtx)/ ONE_IN_Q25 ); p_dec_mtx++; } - p_dec_mtx += ( SBA_NHARM_HOA3 - num_harm ); + p_dec_mtx += sub( SBA_NHARM_HOA3, num_harm ); } } tmp_val = TEMP_VAL; + move32(); p_dec_mtx = *hoa_dec_mtx; FOR( i = 0; i < num_spk; i++ ) { Word32 dec_mtx_temp_scale = 0; + move32(); FOR( j = 0; j < num_harm; j++ ) { dec_mtx_temp_scale = Mpy_32_32( tmp_val, norm_sn3d_hoa3_int[j] ); // Q35 *p_dec_mtx = Mpy_32_32( *p_dec_mtx, dec_mtx_temp_scale ); // Q29 + move32(); p_dec_mtx++; } - p_dec_mtx += ( SBA_NHARM_HOA3 - num_harm ); + p_dec_mtx += sub( SBA_NHARM_HOA3, num_harm ); } /* free EFAP handle */ diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index c50a45f7b96bdc75f2d2ffd07bcd8ef519e4f13b..2d737022cb55b4b94312c4223512b81b87d69d7e 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -73,7 +73,7 @@ ivas_error ivas_hrtf_init( hHrtf->max_num_ir = 0; hHrtf->max_num_iterations = 0; hHrtf->index_frequency_max_diffuse = 0; - move16(); + move32(); move16(); move16(); move16(); @@ -229,7 +229,8 @@ static void ivas_hrtf_close( HRTFS_HANDLE *hHrtf /* i/o: HRTF handle */ ) { - if ( hHrtf == NULL || *hHrtf == NULL ) + test(); + IF( hHrtf == NULL || *hHrtf == NULL ) { return; } @@ -263,11 +264,14 @@ static ivas_error ivas_rend_initCrend_fx( hHrtf = pCrend->hHrtfCrend; /* Do all error checks up front so that the nested if later is easier */ - IF( NE_16( inConfigType, IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) && NE_16( inConfigType, IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) + test(); + IF( inConfigType != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED && NE_16( inConfigType, IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Encountered unsupported input config in Crend" ); } + test(); + test(); IF( NE_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL ) && NE_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) && NE_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Encountered unsupported output type in Crend" ); @@ -288,16 +292,17 @@ static ivas_error ivas_rend_initCrend_fx( hHrtf->max_num_ir = nchan_in; move16(); - IF( LE_16( hHrtf->max_num_ir, 0 ) ) + IF( hHrtf->max_num_ir <= 0 ) { return IVAS_ERR_INTERNAL_FATAL; } IF( hSetOfHRTF == NULL ) { - IF( EQ_16( inConfigType, IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) + IF( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { hHrtf->max_num_ir = sub( hHrtf->max_num_ir, 1 ); /* subtract LFE */ + move16(); hHrtf->gain_lfe_fx = GAIN_LFE_FX; move16(); @@ -975,9 +980,10 @@ static ivas_error ivas_rend_initCrend_fx( } ELSE { - IF( EQ_16( inConfigType, IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) + IF( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { - hHrtf->max_num_ir -= 1; /* subtract LFE */ + hHrtf->max_num_ir = sub( hHrtf->max_num_ir, 1 ); /* subtract LFE */ + move16(); hHrtf->gain_lfe_fx = GAIN_LFE_FX; move16(); @@ -2035,6 +2041,8 @@ static ivas_error ivas_shoebox_output_init( hShoeboxOutput->n_sources = 0; hShoeboxOutput->n_ref = 0; + move16(); + move16(); IF( ( error = ivas_shoebox_data_init( &hShoeboxOutput->times ) ) != IVAS_ERR_OK ) { @@ -2219,7 +2227,7 @@ static ivas_error ivas_shoebox_obj_init( hShoeboxObj->min_wall_dist_fx = 0; hShoeboxObj->soundspeed_fx = 0; hShoeboxObj->air_coeff_fx = 0; - move32(); + move16(); move32(); move32(); move32(); @@ -2315,6 +2323,8 @@ static ivas_error ivas_er_init_handle( move16(); move16(); move16(); + move16(); + move32(); move32(); move32(); FOR( i = 0; i < 75; i++ ) @@ -2325,11 +2335,11 @@ static ivas_error ivas_er_init_handle( FOR( i = 0; i < 3; i++ ) { reflections->user_origin_fx[i] = 0; - move16(); - IF( EQ_16( i, 2 ) ) + move32(); + if ( EQ_16( i, 2 ) ) { - reflections->user_origin_fx[i] = (Word32) ER_LIST_HEIGHT_FX; - move16(); + reflections->user_origin_fx[i] = ER_LIST_HEIGHT_FX; + move32(); } } reflections->circ_buffers = NULL; @@ -2555,6 +2565,7 @@ ivas_error ivas_rend_openCrend( ivas_error error; error = IVAS_ERR_OK; + move16(); IF( ( error = ivas_rend_initCrendWrapper( pCrend ) ) != IVAS_ERR_OK ) { @@ -2602,7 +2613,7 @@ ivas_error ivas_rend_openCrend( max_total_ir_len = imult1616( (Word16) hHrtf->num_iterations_diffuse[0], subframe_length ); - IF( GT_16( max_total_ir_len, 0 ) ) + IF( max_total_ir_len > 0 ) { IF( ( hCrend->freq_buffer_re_diffuse_fx = (Word32 *) malloc( sizeof( Word32 ) * max_total_ir_len ) ) == NULL ) { @@ -2622,7 +2633,7 @@ ivas_error ivas_rend_openCrend( } max_total_ir_len = add( extract_l( L_shr( L_add( L_shl( Mult_32_32( hHrtf->latency_s_fx, output_Fs ), 1 ), 1 ), 1 ) ), subframe_length ); /*(int16_t) ( hHrtf->latency_s * output_Fs + 0.5f ) + subframe_length;*/ - IF( GT_16( max_total_ir_len, 0 ) ) + IF( max_total_ir_len > 0 ) { IF( ( hCrend->lfe_delay_line_fx = (Word32 *) malloc( sizeof( Word32 ) * max_total_ir_len ) ) == NULL ) { @@ -2658,12 +2669,16 @@ ivas_error ivas_rend_openCrend( hCrend->reflections->use_er = hRendCfg->roomAcoustics.use_er; hCrend->reflections->lowComplexity = hRendCfg->roomAcoustics.lowComplexity; + move16(); + move32(); /* Set sample rate and frame size */ - hCrend->reflections->output_Fs_fx = (Word32) output_Fs; + hCrend->reflections->output_Fs_fx = output_Fs; + move32(); hCrend->reflections->max_frame_size = extract_l( Mult_32_16( output_Fs, INV_FRAME_PER_SEC_Q15 ) ); + move32(); /* Init Shoebox */ ivas_shoebox_config_init( &hCrend->reflections->shoebox_lib.cal, hRendCfg ); @@ -2685,6 +2700,7 @@ ivas_error ivas_rend_openCrend( } ( *pCrend )->binaural_latency_ns = Mult_32_32( ( *pCrend )->hHrtfCrend->latency_s_fx, (Word32) 1000000000 ); + move32(); } ( *pCrend )->hCrend = hCrend; @@ -3099,12 +3115,12 @@ static ivas_error ivas_rend_crendConvolver( hCrend = pCrend->hCrend; - IF( NE_32( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ), IVAS_ERR_OK ) ) + IF( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ) != IVAS_ERR_OK ) { return error; } - IF( NE_32( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ), IVAS_ERR_OK ) ) + IF( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ) != IVAS_ERR_OK ) { return error; } @@ -3114,7 +3130,7 @@ static ivas_error ivas_rend_crendConvolver( lfe_idx_in = -1; move16(); - IF( EQ_32( getAudioConfigType( inConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) + IF( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { IF( NE_32( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { @@ -3127,8 +3143,8 @@ static ivas_error ivas_rend_crendConvolver( } } - offset = imult1616( hCrend->delay_line_rw_index, subframe_length ); /* subframe_length * ( pCrend->hHrtfCrend->max_num_iterations - 1 ); */ - offset_diffuse = hCrend->diffuse_delay_line_rw_index * subframe_length; /* subframe_length *( pCrend->hHrtfCrend->num_iterations_diffuse[0] - 1 ); */ + offset = imult1616( hCrend->delay_line_rw_index, subframe_length ); /* subframe_length * ( pCrend->hHrtfCrend->max_num_iterations - 1 ); */ + offset_diffuse = imult1616( hCrend->diffuse_delay_line_rw_index, subframe_length ); /* subframe_length *( pCrend->hHrtfCrend->num_iterations_diffuse[0] - 1 ); */ IF( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 ) { @@ -3140,9 +3156,9 @@ static ivas_error ivas_rend_crendConvolver( move16(); FOR( idx_in = 0; idx_in < nchan_in; idx_in++ ) { - pIn = &pcm_in[idx_in][i_ts * subframe_length]; + pIn = &pcm_in[idx_in][imult1616( i_ts, subframe_length )]; - IF( idx_in != lfe_idx_in ) + IF( NE_16( idx_in, lfe_idx_in ) ) { IF( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 ) { @@ -3154,6 +3170,8 @@ static ivas_error ivas_rend_crendConvolver( { pFreq_buf_re[k] = L_add( Mpy_32_16_r( pFreq_filt_re[k], pCrend->hHrtfCrend->inv_diffuse_weight_fx[i] ), pFreq_buf_re[k] ); pFreq_buf_im[k] = L_add( Mpy_32_16_r( pFreq_filt_im[k], pCrend->hHrtfCrend->inv_diffuse_weight_fx[i] ), pFreq_buf_im[k] ); + move32(); + move32(); } } pFreq_buf_re = &hCrend->freq_buffer_re_fx[i][offset]; @@ -3185,6 +3203,7 @@ static ivas_error ivas_rend_crendConvolver( { offset_in = add( add( hCrend->delay_line_rw_index, sub( pCrend->hHrtfCrend->max_num_iterations, pCrend->hHrtfCrend->num_iterations[i][j] ) ), add( m, 1 ) ); offset_in = offset_in % ( pCrend->hHrtfCrend->max_num_iterations ); + move16(); offset_in = imult1616( offset_in, subframe_length ); pFreq_buf_re = &hCrend->freq_buffer_re_fx[i][offset_in]; pFreq_buf_im = &hCrend->freq_buffer_im_fx[i][offset_in]; @@ -3193,8 +3212,10 @@ static ivas_error ivas_rend_crendConvolver( FOR( k = 0; k < pCrend->hHrtfCrend->pIndex_frequency_max[i][j][m]; k++ ) { - tmp_out_re[k] = L_add( Msub_32_32( Mpy_32_32( pFreq_buf_re[k], pFreq_filt_re[k] ), pFreq_buf_im[k], pFreq_filt_im[k] ) << 2, tmp_out_re[k] ); - tmp_out_im[k] = L_add( Madd_32_32( Mpy_32_32( pFreq_buf_re[k], pFreq_filt_im[k] ), pFreq_buf_im[k], pFreq_filt_re[k] ) << 2, tmp_out_im[k] ); + tmp_out_re[k] = L_add( L_shl( Msub_32_32( Mpy_32_32( pFreq_buf_re[k], pFreq_filt_re[k] ), pFreq_buf_im[k], pFreq_filt_im[k] ), 2 ), tmp_out_re[k] ); + tmp_out_im[k] = L_add( L_shl( Madd_32_32( Mpy_32_32( pFreq_buf_re[k], pFreq_filt_im[k] ), pFreq_buf_im[k], pFreq_filt_re[k] ), 2 ), tmp_out_im[k] ); + move32(); + move32(); } offset = add( offset, k ); } @@ -3208,6 +3229,7 @@ static ivas_error ivas_rend_crendConvolver( { offset_diffuse = add( hCrend->diffuse_delay_line_rw_index, add( m, 1 ) ); offset_diffuse = offset_diffuse % pCrend->hHrtfCrend->num_iterations_diffuse[0]; + move16(); offset_diffuse = imult1616( offset_diffuse, subframe_length ); pFreq_buf_re = &hCrend->freq_buffer_re_diffuse_fx[offset_diffuse]; pFreq_buf_im = &hCrend->freq_buffer_im_diffuse_fx[offset_diffuse]; @@ -3217,6 +3239,8 @@ static ivas_error ivas_rend_crendConvolver( { tmp_out_re[k] = L_add( Msub_32_32( Mpy_32_32( pFreq_buf_re[k], pFreq_filt_re[k] ), pFreq_buf_im[k], pFreq_filt_im[k] ), tmp_out_re[k] ); tmp_out_im[k] = L_add( Madd_32_32( Mpy_32_32( pFreq_buf_re[k], pFreq_filt_im[k] ), pFreq_buf_im[k], pFreq_filt_re[k] ), tmp_out_im[k] ); + move32(); + move32(); } offset = add( offset, k ); } @@ -3226,20 +3250,26 @@ static ivas_error ivas_rend_crendConvolver( #ifdef DUMPS_ENABLED dbgwrite_txt( pOut, subframe_length << 1, "Fixed_imdft_out.txt", NULL ); #endif - pFreq_buf_re = &pcm_out[j][i_ts * subframe_length]; + pFreq_buf_re = &pcm_out[j][imult1616( i_ts, subframe_length )]; FOR( k = 0; k < subframe_length; k++ ) { pFreq_buf_re[k] = L_add( pOut[k], hCrend->prev_out_buffer_fx[j][k] ); - hCrend->prev_out_buffer_fx[j][k] = pOut[k + subframe_length]; + hCrend->prev_out_buffer_fx[j][k] = pOut[add( k, subframe_length )]; + move32(); + move32(); } } hCrend->delay_line_rw_index = add( hCrend->delay_line_rw_index, 1 ); hCrend->delay_line_rw_index = hCrend->delay_line_rw_index % ( pCrend->hHrtfCrend->max_num_iterations ); + move16(); + move16(); IF( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 ) { hCrend->diffuse_delay_line_rw_index = add( hCrend->diffuse_delay_line_rw_index, 1 ); hCrend->diffuse_delay_line_rw_index = hCrend->diffuse_delay_line_rw_index % ( pCrend->hHrtfCrend->num_iterations_diffuse[0] ); + move16(); + move16(); } return IVAS_ERR_OK; @@ -3448,13 +3478,15 @@ ivas_error ivas_rend_crendProcess( hCrend = pCrend->hCrend; combinedOrientationEnabled = 0; + move16(); IF( hCombinedOrientationData != NULL ) { FOR( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ ) { - IF( NE_16( hCombinedOrientationData->enableCombinedOrientation[subframe_idx], 0 ) ) + IF( hCombinedOrientationData->enableCombinedOrientation[subframe_idx] != 0 ) { combinedOrientationEnabled = 1; + move16(); BREAK; } } @@ -3505,13 +3537,14 @@ ivas_error ivas_rend_crendProcess( test(); IF( EQ_16( hCrend->reflections->use_er, 1 ) && EQ_16( hCrend->reflections->is_ready, 1 ) ) { - IF( NE_32( ( error = ivas_er_process( hCrend->reflections, subframe_len, subframe_idx, output_fx, inConfig ) ), IVAS_ERR_OK ) ) + IF( ( error = ivas_er_process( hCrend->reflections, subframe_len, subframe_idx, output_fx, inConfig ) ) != IVAS_ERR_OK ) { return error; } } } + test(); IF( hDecoderConfig && combinedOrientationEnabled ) { /* Orientation tracking */ @@ -3521,6 +3554,8 @@ ivas_error ivas_rend_crendProcess( SBA SPAR -> BINAURAL or BINAURAL_ROOM */ test(); + test(); + test(); IF( EQ_16( inConfig, IVAS_AUDIO_CONFIG_FOA ) || EQ_16( inConfig, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_16( inConfig, IVAS_AUDIO_CONFIG_HOA3 ) ) { rotateFrame_shd( hCombinedOrientationData, output_fx, subframe_len, *hIntSetup, subframe_idx ); @@ -3556,7 +3591,7 @@ ivas_error ivas_rend_crendProcess( /* move to output */ FOR( i = 0; i < nchan_out; i++ ) { - mvr2r_Word32( pcm_tmp_fx[i], output_fx[i], num_subframes * subframe_len ); + mvr2r_Word32( pcm_tmp_fx[i], output_fx[i], imult1616( num_subframes, subframe_len ) ); } pop_wmops(); @@ -3722,23 +3757,25 @@ ivas_error ivas_rend_crendProcessSubframe( hCrend = pCrend->hCrend; combinedOrientationEnabled = 0; + move16(); IF( hCombinedOrientationData != NULL ) { - IF( NE_16( hCombinedOrientationData->enableCombinedOrientation[0], 0 ) ) + if ( hCombinedOrientationData->enableCombinedOrientation[0] != 0 ) { combinedOrientationEnabled = 1; + move16(); } } push_wmops( "ivas_rend_crendProcessSubframe" ); inConfigType = getAudioConfigType( inConfig ); - IF( NE_32( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ), IVAS_ERR_OK ) ) + IF( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ) != IVAS_ERR_OK ) { return error; } - IF( NE_32( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ), IVAS_ERR_OK ) ) + IF( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ) != IVAS_ERR_OK ) { return error; } @@ -3752,9 +3789,10 @@ ivas_error ivas_rend_crendProcessSubframe( p_pcm_tmp_fx[ch] = pcm_tmp_fx[ch]; } slot_size = hTcBuffer->n_samples_granularity; + move16(); /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ - slots_to_render = min( hTcBuffer->num_slots - hTcBuffer->slots_rendered, n_samples_to_render / slot_size ); + slots_to_render = s_min( sub( hTcBuffer->num_slots, hTcBuffer->slots_rendered ), idiv1616( n_samples_to_render, slot_size ) ); first_sf = hTcBuffer->subframes_rendered; move16(); last_sf = first_sf; @@ -3771,21 +3809,26 @@ ivas_error ivas_rend_crendProcessSubframe( /* Early Reflections */ IF( hCrend->reflections != NULL ) { - IF( hCrend->reflections->use_er == 1 && hCrend->reflections->is_ready == 1 ) + test(); + IF( EQ_32( hCrend->reflections->use_er, 1 ) && EQ_32( hCrend->reflections->is_ready, 1 ) ) { - IF( NE_32( ( error = ivas_er_process( hCrend->reflections, subframe_len, 0, tc_local_fx, inConfig ) ), IVAS_ERR_OK ) ) + IF( ( error = ivas_er_process( hCrend->reflections, subframe_len, 0, tc_local_fx, inConfig ) ) != IVAS_ERR_OK ) { return error; } } } + test(); IF( hDecoderConfig && combinedOrientationEnabled ) { /* Rotation in SHD for: MC with elevation (5_1_2 / 5_1_4 / 7_1_4) -> BINAURAL SBA SPAR -> BINAURAL or BINAURAL_ROOM */ + test(); + test(); + test(); IF( EQ_32( inConfig, IVAS_AUDIO_CONFIG_FOA ) || EQ_32( inConfig, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( inConfig, IVAS_AUDIO_CONFIG_HOA3 ) ) { rotateFrame_shd( hCombinedOrientationData, tc_local_fx, subframe_len, *hIntSetup, 0 ); @@ -3797,10 +3840,11 @@ ivas_error ivas_rend_crendProcessSubframe( } } + test(); IF( EQ_32( inConfigType, IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) || EQ_32( inConfigType, IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) { - IF( NE_32( ( error = ivas_rend_crendConvolver( pCrend, inConfig, outConfig, tc_local_fx, p_pcm_tmp_fx, output_Fs, 0 ) ), IVAS_ERR_OK ) ) + IF( ( error = ivas_rend_crendConvolver( pCrend, inConfig, outConfig, tc_local_fx, p_pcm_tmp_fx, output_Fs, 0 ) ) != IVAS_ERR_OK ) { return error; @@ -3808,7 +3852,7 @@ ivas_error ivas_rend_crendProcessSubframe( IF( pCrend->hCrend->hReverb != NULL ) { - IF( NE_32( ( error = ivas_reverb_process_fx( pCrend->hCrend->hReverb, inConfig, 1, tc_local_fx, p_pcm_tmp_fx, 0 ) ), IVAS_ERR_OK ) ) + IF( ( error = ivas_reverb_process_fx( pCrend->hCrend->hReverb, inConfig, 1, tc_local_fx, p_pcm_tmp_fx, 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -3822,6 +3866,7 @@ ivas_error ivas_rend_crendProcessSubframe( p_pcm_tmp_fx[ch] += subframe_len; } hTcBuffer->slots_rendered = add( hTcBuffer->subframe_nbslots[subframe_idx], hTcBuffer->slots_rendered ); + move16(); } ELSE { @@ -3832,12 +3877,14 @@ ivas_error ivas_rend_crendProcessSubframe( } IF( pCrend->hCrend->hReverb != NULL ) { - *pCrend->p_io_qfactor -= 2; + *pCrend->p_io_qfactor = sub( *pCrend->p_io_qfactor, 2 ); + move16(); FOR( Word16 i = nchan_out; i < nchan_in; i++ ) { FOR( Word16 j = 0; j < n_samples_to_render; j++ ) { - output[i][j] = (Word32) L_shr( output[i][j], 2 ); + output[i][j] = L_shr( output[i][j], 2 ); + move32(); } } } @@ -3848,6 +3895,7 @@ ivas_error ivas_rend_crendProcessSubframe( } hTcBuffer->subframes_rendered = last_sf; + move16(); pop_wmops(); return IVAS_ERR_OK; diff --git a/lib_rend/ivas_dirac_ana.c b/lib_rend/ivas_dirac_ana.c index 8e52a997a062c6baa1b1ffa891311048be39a7ac..534f59551a1a96ee86b222177d2055ecd97382d5 100644 --- a/lib_rend/ivas_dirac_ana.c +++ b/lib_rend/ivas_dirac_ana.c @@ -76,6 +76,7 @@ ivas_error ivas_dirac_ana_open_fx( ivas_error error; error = IVAS_ERR_OK; + move16(); IF( ( hDirAC = (DIRAC_ANA_HANDLE) malloc( sizeof( DIRAC_ANA_DATA ) ) ) == NULL ) { @@ -519,7 +520,7 @@ static void ivas_dirac_param_est_ana_fx( { io_q = Q7; // Input Q of data_fx move16(); - cldfbAnalysis_ts_fx_fixed_q( &( data_fx[i][l_ts * ts] ), Foa_RealBuffer_fx[i], Foa_ImagBuffer_fx[i], l_ts, hDirAC->cldfbAnaEnc[i], &io_q ); + cldfbAnalysis_ts_fx_fixed_q( &( data_fx[i][imult1616( l_ts, ts )] ), Foa_RealBuffer_fx[i], Foa_ImagBuffer_fx[i], l_ts, hDirAC->cldfbAnaEnc[i], &io_q ); } scale_fact = getScaleFactor32( (const Word32 *) Foa_RealBuffer_fx, FOA_CHANNELS * CLDFB_NO_CHANNELS_MAX ); scale_fact = s_min( getScaleFactor32( (const Word32 *) Foa_ImagBuffer_fx, FOA_CHANNELS * CLDFB_NO_CHANNELS_MAX ), scale_fact ); @@ -557,6 +558,7 @@ static void ivas_dirac_param_est_ana_fx( // exp2 = sub( shl( scale_fact, 1 ), 31 ); /* Fill buffers of length "averaging_length" time slots for intensity and energy */ hDirAC->index_buffer_intensity = add( ( hDirAC->index_buffer_intensity % DIRAC_NO_COL_AVG_DIFF ), 1 ); /* averaging_length = 32 */ + move16(); index = hDirAC->index_buffer_intensity; move16(); Word16 guard_bits = find_guarded_bits_fx( DIRAC_NO_COL_AVG_DIFF ); @@ -608,7 +610,7 @@ static void ivas_dirac_param_est_ana_fx( q_factor_energy = add( sub( shl( scale_fact, 1 ), 31 ), sub( scale_fact2, guard_bits ) ); } - IF( NE_16( q_factor_intensity_old, 0 ) ) + IF( q_factor_intensity_old != 0 ) { IF( LT_16( q_factor_intensity_old, q_factor_intensity ) ) @@ -640,7 +642,7 @@ static void ivas_dirac_param_est_ana_fx( } } } - IF( NE_16( q_factor_energy_old, 0 ) ) + IF( q_factor_energy_old != 0 ) { IF( LT_16( q_factor_energy_old, q_factor_energy ) ) @@ -663,7 +665,7 @@ static void ivas_dirac_param_est_ana_fx( { FOR( Word16 k = 0; k < num_freq_bands; k++ ) { - hDirAC->buffer_energy_fx[i * j + k] = L_shr( hDirAC->buffer_energy_fx[i * j + k], sub( q_factor_energy_old, q_factor_energy_old ) ); + hDirAC->buffer_energy_fx[add( imult1616( i, j ), k )] = L_shr( hDirAC->buffer_energy_fx[add( imult1616( i, j ), k )], sub( q_factor_energy_old, q_factor_energy_old ) ); move32(); } } @@ -676,7 +678,7 @@ static void ivas_dirac_param_est_ana_fx( /* only real part needed */ Copy32( intensity_real_fx[i], &( hDirAC->buffer_intensity_real_fx[i][index - 1][0] ), num_freq_bands ); } - Copy32( reference_power_fx[ts], &( hDirAC->buffer_energy_fx[( index - 1 ) * num_freq_bands] ), num_freq_bands ); + Copy32( reference_power_fx[ts], &( hDirAC->buffer_energy_fx[imult1616( sub( index, 1 ), num_freq_bands )] ), num_freq_bands ); computeDiffuseness_fx( hDirAC->buffer_intensity_real_fx, hDirAC->buffer_energy_fx, num_freq_bands, diffuseness_vector_fx, q_factor_intensity, q_factor_energy, diffuseness_vector_exp ); q_factor_intensity_old = q_factor_intensity; @@ -685,7 +687,7 @@ static void ivas_dirac_param_est_ana_fx( move16(); FOR( j = 0; j < MASA_FREQUENCY_BANDS; j++ ) { - IF( LT_16( diffuseness_vector_exp[j], 10 ) ) + if ( LT_16( diffuseness_vector_exp[j], 10 ) ) { diffuseness_vector_fx[j] = 0; move16(); diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 59b022eff553431d360c3526bb1b9b0c3f3f5a01..4c52699c932bf806ffbca7083b417264a09b82fa 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -402,6 +402,7 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( nBins = st_ivas->hSpatParamRendCom->num_freq_bands; move16(); renderer_type = st_ivas->renderer_type; + move32(); FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { @@ -432,6 +433,7 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( set16_fx( hDiracDecBin->ChCrossReOutPrev_e, 0, nBins ); set16_fx( hDiracDecBin->ChCrossImOutPrev_e, 0, nBins ); hDiracDecBin->renderStereoOutputInsteadOfBinaural = 0; + move16(); hDiracDecBin->q_processMtx = Q15; hDiracDecBin->q_processMtxSCCR = Q15; @@ -439,6 +441,12 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( hDiracDecBin->q_processMtxPrevSCCR = Q15; hDiracDecBin->q_processMtxDec = Q15; hDiracDecBin->q_processMtxDecPrev = Q15; + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); FOR( bin = 0; bin < nBins; bin++ ) { @@ -449,11 +457,14 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( { tmp = shl( tmp, tmp_e ); /*q15*/ tmp_e = 0; + move16(); } - tmpFloat_fx = s_max( 0, sub( shl_sat( 1, 15 - tmp_e ), tmp ) ) /*max( 0.0f, 1.0f - binCenterFreq / 2700.0f )*/; /*Q30*/ + tmpFloat_fx = s_max( 0, sub( shl_sat( 1, sub( 15, tmp_e ) ), tmp ) ) /*max( 0.0f, 1.0f - binCenterFreq / 2700.0f )*/; /*Q30*/ tmp2 = extract_l( Mult_32_32( binCenterFreq_fx, 1952258 /*=2^31*180/(550)/360*/ ) % 32767 ); //*binCenterFreq_fx * EVS_PI / 550.0f*/ hDiracDecBin->diffuseFieldCoherence_fx[bin] = L_shl( L_mult0( divide3232( tmpFloat_fx, Mult_32_16( binCenterFreq_fx, 187 /*2^15*pi/550*/ ) ), getSineWord16R2( tmp2 ) ), tmp_e ); /*tmpFloat * sinf( binCenterFreq * EVS_PI / 550.0f ) / ( binCenterFreq * EVS_PI / 550.0f );*/ hDiracDecBin->diffuseFieldCoherence_fx[bin] = L_shl( hDiracDecBin->diffuseFieldCoherence_fx[bin], 1 ); + move32(); + move32(); } FOR( bin = 0; bin < BINAURAL_COHERENCE_DIFFERENCE_BINS; bin++ ) @@ -461,21 +472,28 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( hDiracDecBin->diffuseFieldCoherenceX_fx[bin] = L_add( hDiracDecBin->diffuseFieldCoherence_fx[bin], diffuseFieldCoherenceDifferenceX_fx[bin] ); hDiracDecBin->diffuseFieldCoherenceY_fx[bin] = L_add( hDiracDecBin->diffuseFieldCoherence_fx[bin], diffuseFieldCoherenceDifferenceY_fx[bin] ); hDiracDecBin->diffuseFieldCoherenceZ_fx[bin] = L_add( hDiracDecBin->diffuseFieldCoherence_fx[bin], diffuseFieldCoherenceDifferenceZ_fx[bin] ); + move32(); + move32(); + move32(); } IF( EQ_32( renderer_type, RENDERER_BINAURAL_PARAMETRIC ) ) /* Indication of binaural rendering without room effect */ { set32_fx( hDiracDecBin->earlyPartEneCorrection_fx, ONE_IN_Q28, CLDFB_NO_CHANNELS_MAX ); hDiracDecBin->q_earlyPartEneCorrection = Q28; + move16(); hDiracDecBin->hReverb = NULL; } ELSE IF( EQ_32( renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) /* Indication of binaural rendering with room effect */ { Copy32( hHrtfParambin->parametricEarlyPartEneCorrection_fx, hDiracDecBin->earlyPartEneCorrection_fx, nBins ); hDiracDecBin->q_earlyPartEneCorrection = Q28; + move16(); /* reconfiguration needed when Reverb. parameters are changed -> close and open the handle again */ - IF( hDiracDecBin->hReverb != NULL && ( ( hDiracDecBin->hReverb->numBins != nBins ) || - ( hDiracDecBin->hReverb->blockSize != CLDFB_SLOTS_PER_SUBFRAME ) ) ) + test(); + test(); + IF( hDiracDecBin->hReverb != NULL && ( ( NE_16( hDiracDecBin->hReverb->numBins, nBins ) ) || + ( NE_16( hDiracDecBin->hReverb->blockSize, CLDFB_SLOTS_PER_SUBFRAME ) ) ) ) { ivas_binaural_reverb_close_fx( &( hDiracDecBin->hReverb ) ); } @@ -495,6 +513,8 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( hDiracDecBin->q_earlyPartEneCorrection = Q28; hDiracDecBin->hReverb = NULL; hDiracDecBin->renderStereoOutputInsteadOfBinaural = 1; + move16(); + move16(); } ELSE /* Not valid renderer type for this renderer */ { @@ -503,9 +523,10 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( hDiracDecBin->hDiffuseDist = NULL; /* Memory is allocated from stack during runtime when needed */ - IF( hDiracDecBin->hTdDecorr == NULL ) + if ( hDiracDecBin->hTdDecorr == NULL ) { hDiracDecBin->useTdDecorr = 0; + move16(); } IF( hDiracDecBin->h_freq_domain_decorr_ap_params != NULL ) @@ -518,6 +539,8 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( return error; } + test(); + test(); IF( !hDiracDecBin->useTdDecorr && !( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) && EQ_32( st_ivas->ism_mode, ISM_MODE_PARAM ) ) ) { Word16 frequency_axis_fx[CLDFB_NO_CHANNELS_MAX]; @@ -538,6 +561,7 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( } hDiracDecBin->reqularizationFactor_fx = configure_reqularization_factor_fx( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); + move16(); st_ivas->hDiracDecBin = hDiracDecBin; @@ -548,15 +572,19 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( Word16 n_samples_granularity; nchan_to_allocate = 2 * BINAURAL_CHANNELS; - IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) + move16(); + if ( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) { nchan_to_allocate = 2 * BINAURAL_CHANNELS + 2; + move16(); } - n_samples_granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); + n_samples_granularity = NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); + test(); + test(); IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) { - n_samples_granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); /* Use the same granularity as tdrend */ + n_samples_granularity = NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); /* Use the same granularity as tdrend */ } IF( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_RENDERER, ivas_jbm_dec_get_num_tc_channels( st_ivas ), nchan_to_allocate, nchan_to_allocate, n_samples_granularity ) ) != IVAS_ERR_OK ) @@ -579,6 +607,7 @@ void ivas_dirac_dec_close_binaural_data( ) { + test(); IF( hBinaural == NULL || *hBinaural == NULL ) { return; @@ -640,6 +669,7 @@ ivas_error ivas_dirac_dec_binaural_copy_hrtfs_fx( ) { Word16 i, j; + test(); IF( hHrtfParambin != NULL && *hHrtfParambin != NULL ) { /* Tables already loaded from file */ @@ -676,25 +706,26 @@ ivas_error ivas_dirac_dec_binaural_copy_hrtfs( HRTFS_PARAMBIN_HANDLE *hHrtfParambin /* i/o: HRTF structure for rendering */ ) { - int16_t i, j; - if ( hHrtfParambin != NULL && *hHrtfParambin != NULL ) + Word16 i, j; + test(); + IF( hHrtfParambin != NULL && *hHrtfParambin != NULL ) { /* Tables already loaded from file */ return IVAS_ERR_OK; } - else + ELSE { /* Initialise tables from ROM */ HRTFS_PARAMBIN *hrtfParambin; - if ( ( hrtfParambin = (HRTFS_PARAMBIN *) malloc( sizeof( HRTFS_PARAMBIN ) ) ) == NULL ) + IF( ( hrtfParambin = (HRTFS_PARAMBIN *) malloc( sizeof( HRTFS_PARAMBIN ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for parametric binauralizer HRTF tables" ); } - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) + FOR( i = 0; i < BINAURAL_CHANNELS; i++ ) { - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + FOR( j = 0; j < HRTF_SH_CHANNELS; j++ ) { Copy( hrtfShCoeffsRe_fx[i][j], hrtfParambin->hrtfShCoeffsRe_fx[i][j], HRTF_NUM_BINS ); Copy( hrtfShCoeffsIm_fx[i][j], hrtfParambin->hrtfShCoeffsIm_fx[i][j], HRTF_NUM_BINS ); @@ -850,6 +881,7 @@ void ivas_dirac_dec_binaural_render_fx( hSpatParamRendCom = st_ivas->hSpatParamRendCom; nchan_out = BINAURAL_CHANNELS; + move16(); FOR( ch = 0; ch < nchan_out; ch++ ) { output_fx_local[ch] = output_fx_local_buff[ch]; @@ -859,16 +891,20 @@ void ivas_dirac_dec_binaural_render_fx( /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ slots_to_render = s_min( sub( hSpatParamRendCom->num_slots, hSpatParamRendCom->slots_rendered ), idiv1616( (Word16) nSamplesAsked, (Word16) slot_size ) ); *nSamplesRendered = imult1616( slots_to_render, slot_size ); + move16(); first_sf = hSpatParamRendCom->subframes_rendered; last_sf = first_sf; + move16(); + move16(); WHILE( GT_16( slots_to_render, 0 ) ) { slots_to_render = sub( slots_to_render, hSpatParamRendCom->subframe_nbslots[last_sf] ); - last_sf++; + last_sf = add( last_sf, 1 ); } output_length = 0; + move16(); FOR( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { Word16 n_samples_sf = imult1616( slot_size, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); @@ -893,9 +929,11 @@ void ivas_dirac_dec_binaural_render_fx( IF( EQ_16( hSpatParamRendCom->slots_rendered, hSpatParamRendCom->num_slots ) ) { hSpatParamRendCom->dirac_read_idx = add( hSpatParamRendCom->dirac_read_idx, DEFAULT_JBM_SUBFRAMES_5MS ) % hSpatParamRendCom->dirac_md_buffer_length; + move16(); } *nSamplesAvailable = imult1616( sub( hSpatParamRendCom->num_slots, hSpatParamRendCom->slots_rendered ), slot_size ); + move16(); return; } @@ -1219,6 +1257,7 @@ static void ivas_dirac_dec_binaural_internal_fx( { #if 1 Word16 q_input = 11; + move16(); #ifdef MSAN_FIX_ Word16 nchan_tc; @@ -1237,19 +1276,22 @@ static void ivas_dirac_dec_binaural_internal_fx( IF( st_ivas->hSCE[0] ) { Word16 shift = getScaleFactor32( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN ); - IF( LT_16( sub( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift ), 4 ) ) + if ( LT_16( sub( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift ), 4 ) ) { shift = sub( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, 4 ); } scale_sig32( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, shift ); st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = sub( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift ); + move16(); } Word16 q_cldfb[6][CLDFB_SLOTS_PER_SUBFRAME] = { 0 }; + move16(); FOR( Word16 ind = 0; ind < 6; ind++ ) { FOR( Word16 ind2 = 0; ind2 < 4; ind2++ ) { q_cldfb[ind][ind2] = q_input; + move16(); } } #endif @@ -1270,22 +1312,39 @@ static void ivas_dirac_dec_binaural_internal_fx( assert( hDiracDecBin ); hSpatParamRendCom = st_ivas->hSpatParamRendCom; nBins = hSpatParamRendCom->num_freq_bands; - offsetSamples = hSpatParamRendCom->slots_rendered * nBins; + move16(); + offsetSamples = imult1616( hSpatParamRendCom->slots_rendered, nBins ); /* Setup internal config */ config_data.separateCenterChannelRendering = st_ivas->hOutSetup.separateChannelEnabled; move16(); config_data.ivas_format = st_ivas->ivas_format; + move32(); config_data.mc_mode = st_ivas->mc_mode; + move32(); config_data.ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; move32(); config_data.nchan_transport = st_ivas->nchan_transport; move16(); - config_data.qualityBasedSmFactor_fx = st_ivas->hMasa != NULL ? L_deposit_h( st_ivas->hMasa->data.dir_decode_quality_fx ) : ONE_IN_Q31; + IF( st_ivas->hMasa != NULL ) + { + config_data.qualityBasedSmFactor_fx = L_deposit_h( st_ivas->hMasa->data.dir_decode_quality_fx ); + } + ELSE + { + config_data.qualityBasedSmFactor_fx = ONE_IN_Q31; + } move32(); - config_data.processReverb = st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ? 1 : 0; + IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) + { + config_data.processReverb = 1; + } + ELSE + { + config_data.processReverb = 0; + } move16(); - IF( st_ivas->ivas_format == MASA_ISM_FORMAT ) + IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) { config_data.ism_mode = st_ivas->ism_mode; } @@ -1293,14 +1352,22 @@ static void ivas_dirac_dec_binaural_internal_fx( { config_data.ism_mode = ISM_MODE_NONE; } + move32(); /* The input channel number at this processing function (not nchan_transport) */ numInChannels = BINAURAL_CHANNELS; - IF( config_data.separateCenterChannelRendering || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) ) + move16(); + test(); + test(); + test(); + test(); + test(); + test(); + IF( config_data.separateCenterChannelRendering || ( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && ( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) ) ) ) { numInChannels = add( numInChannels, 1 ); } - ELSE IF( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) + ELSE IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) && ( EQ_32( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { numInChannels = add( numInChannels, st_ivas->nchan_ism ); } @@ -1339,17 +1406,18 @@ static void ivas_dirac_dec_binaural_internal_fx( { FOR( ch = 0; ch < numInChannels; ch++ ) { - IF( ch == 0 || nchan_transport == 2 ) + test(); + IF( ch == 0 || EQ_16( nchan_transport, 2 ) ) { q_cldfb[ch][slot] = q_input; move16(); cldfbAnalysis_ts_fx_fixed_q( - &( st_ivas->hTcBuffer->tc_fx[ch][nBins * slot + offsetSamples] ), + &( st_ivas->hTcBuffer->tc_fx[ch][add( imult1616( nBins, slot ), offsetSamples )] ), Cldfb_RealBuffer_in_fx[ch][slot], Cldfb_ImagBuffer_in_fx[ch][slot], nBins, st_ivas->cldfbAnaDec[ch], &q_cldfb[ch][slot] ); } - ELSE IF( config_data.nchan_transport == 2 ) /* Stereo signal transmitted as mono with DFT stereo */ + ELSE IF( EQ_16( config_data.nchan_transport, 2 ) ) /* Stereo signal transmitted as mono with DFT stereo */ { /* At mono input duplicate the channel to dual-mono */ mvl2l( Cldfb_RealBuffer_in_fx[0][slot], Cldfb_RealBuffer_in_fx[1][slot], nBins ); @@ -1360,6 +1428,7 @@ static void ivas_dirac_dec_binaural_internal_fx( ELSE /* when nchan_transport == 1 and ch == 1 */ { /* CNA and HB FD-CNG*/ + test(); IF( st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ) { Word16 numCoreBands, b; @@ -1390,15 +1459,19 @@ static void ivas_dirac_dec_binaural_internal_fx( /* LB: Copy first channel + LB-CNG to first and second channels with same scaling (dual-mono)*/ FOR( b = 0; b < numCoreBands; b++ ) { - Cldfb_RealBuffer_in_fx[0][slot][b] = Mpy_32_16_1( L_add( L_shr( Cldfb_RealBuffer_in_fx[0][slot][b], q_cldfb[0][slot] - q_input + 5 ), L_shr( Cldfb_RealBuffer_in_fx[2][slot][b], q_cldfb[2][slot] - q_input + 5 ) ), 23170 /* INV_SQRT2 in Q15*/ ); + Cldfb_RealBuffer_in_fx[0][slot][b] = Mpy_32_16_1( L_add( L_shr( Cldfb_RealBuffer_in_fx[0][slot][b], add( sub( q_cldfb[0][slot], q_input ), 5 ) ), L_shr( Cldfb_RealBuffer_in_fx[2][slot][b], add( sub( q_cldfb[2][slot], q_input ), 5 ) ) ), 23170 /* INV_SQRT2 in Q15*/ ); Cldfb_RealBuffer_in_fx[1][slot][b] = Cldfb_RealBuffer_in_fx[0][slot][b]; move32(); - Cldfb_ImagBuffer_in_fx[0][slot][b] = Mpy_32_16_1( L_add( L_shr( Cldfb_ImagBuffer_in_fx[0][slot][b], q_cldfb[0][slot] - q_input + 5 ), L_shr( Cldfb_ImagBuffer_in_fx[2][slot][b], q_cldfb[2][slot] - q_input + 5 ) ), 23170 ); + move32(); + Cldfb_ImagBuffer_in_fx[0][slot][b] = Mpy_32_16_1( L_add( L_shr( Cldfb_ImagBuffer_in_fx[0][slot][b], add( sub( q_cldfb[0][slot], q_input ), 5 ) ), L_shr( Cldfb_ImagBuffer_in_fx[2][slot][b], add( sub( q_cldfb[2][slot], q_input ), 5 ) ) ), 23170 ); Cldfb_ImagBuffer_in_fx[1][slot][b] = Cldfb_ImagBuffer_in_fx[0][slot][b]; move32(); + move32(); } - q_cldfb[1][slot] = q_input - 5; - q_cldfb[0][slot] = q_input - 5; + q_cldfb[1][slot] = sub( q_input, 5 ); + q_cldfb[0][slot] = sub( q_input, 5 ); + move16(); + move16(); /* HB: Copy first channel to second channel and add HB-CNGs with different scalings*/ FOR( ; b < nBins; b++ ) { @@ -1409,6 +1482,12 @@ static void ivas_dirac_dec_binaural_internal_fx( Cldfb_ImagBuffer_in_fx[0][slot][b] = Mpy_32_16_1( Cldfb_ImagBuffer_in_fx[0][slot][b], 23170 ); Cldfb_ImagBuffer_in_fx[1][slot][b] = L_add( Cldfb_ImagBuffer_in_fx[0][slot][b], L_shr( Cldfb_ImagBuffer_in_fx[1][slot][b], 1 ) ); Cldfb_ImagBuffer_in_fx[0][slot][b] = L_add( Cldfb_ImagBuffer_in_fx[0][slot][b], L_shr( Cldfb_ImagBuffer_in_fx[2][slot][b], 1 ) ); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); } } ELSE @@ -1431,13 +1510,16 @@ static void ivas_dirac_dec_binaural_internal_fx( FOR( ch = BINAURAL_CHANNELS; ch < ( 2 * BINAURAL_CHANNELS ); ch++ ) { q_cldfb[ch][slot] = q_input; + move16(); cldfbAnalysis_ts_fx_fixed_q( &( st_ivas->hTcBuffer->tc_fx[ch][nBins * slot + offsetSamples] ), Cldfb_RealBuffer_in_fx[ch][slot], Cldfb_ImagBuffer_in_fx[ch][slot], nBins, st_ivas->cldfbAnaDec[ch], &q_cldfb[ch][slot] ); - IF( config_data.nchan_transport == 1 && - ( config_data.ivas_format == SBA_FORMAT || config_data.ivas_format == SBA_ISM_FORMAT ) ) + test(); + test(); + IF( EQ_16( config_data.nchan_transport, 1 ) && + ( EQ_32( config_data.ivas_format, SBA_FORMAT ) || EQ_32( config_data.ivas_format, SBA_ISM_FORMAT ) ) ) { v_multc_fixed_16( Cldfb_RealBuffer_in_fx[ch][slot], 23170, Cldfb_RealBuffer_in_fx[ch][slot], nBins ); v_multc_fixed_16( Cldfb_ImagBuffer_in_fx[ch][slot], 23170, Cldfb_ImagBuffer_in_fx[ch][slot], nBins ); @@ -1446,7 +1528,8 @@ static void ivas_dirac_dec_binaural_internal_fx( } } - IF( config_data.ivas_format == SBA_FORMAT || config_data.ivas_format == SBA_ISM_FORMAT ) + test(); + IF( EQ_32( config_data.ivas_format, SBA_FORMAT ) || EQ_32( config_data.ivas_format, SBA_ISM_FORMAT ) ) { hDiracDecBin->hDiffuseDist = &diffuseDistData; ivas_spar_param_to_masa_param_mapping_fx( st_ivas, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, q_cldfb, subframe ); @@ -1455,17 +1538,18 @@ static void ivas_dirac_dec_binaural_internal_fx( FOR( int idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { - Scale_sig32( st_ivas->hSpar->hFbMixer->pFb->fb_bin_to_band.pp_cldfb_weights_per_spar_band_fx[idx], IVAS_MAX_NUM_FB_BANDS, sub( Q31, Q22 ) ); + Scale_sig32( st_ivas->hSpar->hFbMixer->pFb->fb_bin_to_band.pp_cldfb_weights_per_spar_band_fx[idx], IVAS_MAX_NUM_FB_BANDS, Q31 - Q22 ); } #endif ivas_sba_prototype_renderer_fx( st_ivas, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, q_cldfb, subframe ); FOR( int idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { - Scale_sig32( st_ivas->hSpar->hFbMixer->pFb->fb_bin_to_band.pp_cldfb_weights_per_spar_band_fx[idx], IVAS_MAX_NUM_FB_BANDS, sub( Q22, Q31 ) ); + Scale_sig32( st_ivas->hSpar->hFbMixer->pFb->fb_bin_to_band.pp_cldfb_weights_per_spar_band_fx[idx], IVAS_MAX_NUM_FB_BANDS, Q22 - Q31 ); } } Word16 q_inp = Q6; + move16(); FOR( Word16 cha = 0; cha < 6; cha++ ) { FOR( slot = 0; slot < 4; slot++ ) @@ -1475,7 +1559,10 @@ static void ivas_dirac_dec_binaural_internal_fx( } } - IF( st_ivas->ivas_format == MASA_ISM_FORMAT && nchan_transport == 2 && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) + test(); + test(); + test(); + IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_16( nchan_transport, 2 ) && NE_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) && NE_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) { /* Un-tested function. No test-case is hitting.*/ ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( st_ivas, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, &q_inp, nBins, subframe ); @@ -1488,6 +1575,7 @@ static void ivas_dirac_dec_binaural_internal_fx( FOR( j = 0; j < 3; j++ ) { Rmat_fx[i][j] = hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx][i][j]; // Q30// + move32(); } } @@ -1499,6 +1587,7 @@ static void ivas_dirac_dec_binaural_internal_fx( } Word16 shift = 31; + move16(); Word32 Cldfb_RealBuffer_inTmp_fx[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Cldfb_ImagBuffer_inTmp_fx[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; FOR( i = 0; i < 2; i++ ) { @@ -1509,7 +1598,7 @@ static void ivas_dirac_dec_binaural_internal_fx( } } - Word16 q = q_inp + shift; + Word16 q = add( q_inp, shift ); FOR( i = 0; i < 2; i++ ) { @@ -1519,6 +1608,8 @@ static void ivas_dirac_dec_binaural_internal_fx( { Cldfb_RealBuffer_inTmp_fx[i][j][k] = L_shl( Cldfb_RealBuffer_in_fx[i][j][k], shift ); Cldfb_ImagBuffer_inTmp_fx[i][j][k] = L_shl( Cldfb_ImagBuffer_in_fx[i][j][k], shift ); + move32(); + move32(); } } } @@ -1526,7 +1617,7 @@ static void ivas_dirac_dec_binaural_internal_fx( ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices_fx( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_inTmp_fx, Cldfb_ImagBuffer_inTmp_fx, Rmat_fx, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, st_ivas->hMasaIsmData, q ); - IF( config_data.ivas_format == ISM_FORMAT ) + IF( EQ_32( config_data.ivas_format, ISM_FORMAT ) ) { max_band_decorr = 0; move16(); @@ -1545,12 +1636,18 @@ static void ivas_dirac_dec_binaural_internal_fx( nchanSeparateChannels = 0; move16(); - IF( config_data.separateCenterChannelRendering || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) ) + test(); + test(); + test(); + test(); + test(); + test(); + IF( config_data.separateCenterChannelRendering || ( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && ( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) ) ) ) { nchanSeparateChannels = 1; move16(); } - ELSE IF( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) + ELSE IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) && ( EQ_32( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { nchanSeparateChannels = (UWord8) st_ivas->nchan_ism; move16(); @@ -1561,9 +1658,11 @@ static void ivas_dirac_dec_binaural_internal_fx( #if 1 q_inp = Q6; + move16(); FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { st_ivas->cldfbSynDec[ch]->Q_cldfb_state = Q11; + move16(); } #endif @@ -1610,9 +1709,11 @@ static void ivas_dirac_dec_binaural_internal_fx( hSpatParamRendCom->slots_rendered = add( hSpatParamRendCom->slots_rendered, hSpatParamRendCom->subframe_nbslots[subframe] ); hSpatParamRendCom->subframes_rendered = add( hSpatParamRendCom->subframes_rendered, 1 ); + move16(); + move16(); FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - scale_sig32( output_fx[ch], imult1616( nBins, hSpatParamRendCom->subframe_nbslots[subframe] ), 11 - q_out ); // Scaling to Q11 + scale_sig32( output_fx[ch], imult1616( nBins, hSpatParamRendCom->subframe_nbslots[subframe] ), sub( 11, q_out ) ); // Scaling to Q11 scale_sig32( st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->cldfb_size, sub( Q11, st_ivas->cldfbSynDec[ch]->Q_cldfb_state ) ); st_ivas->cldfbSynDec[ch]->Q_cldfb_state = Q11; move16(); @@ -1696,15 +1797,19 @@ static void ivas_dirac_dec_decorrelate_slot_fx( Word32 protoFrame_fx[2 * BINAURAL_CHANNELS * CLDFB_NO_CHANNELS_MAX]; /* 2 ch, real + imag, 60 bins */ Word16 q_decorrelatedFrameInterleaved, q_protoFrame; const Word16 protoIndexDir[BINAURAL_CHANNELS] = { 0, 1 }; + move16(); q_protoFrame = q_inp; + move16(); /* Decorrelation needs interleaved data. Copy left and right signals to proto_frame_f */ FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { offset = imult1616( imult1616( num_freq_bands, BINAURAL_CHANNELS ), ch ); FOR( bin = 0; bin < num_freq_bands; bin++ ) { - protoFrame_fx[( bin * BINAURAL_CHANNELS ) + offset] = inRe[ch][slot][bin]; - protoFrame_fx[( bin * BINAURAL_CHANNELS ) + offset + 1] = inIm[ch][slot][bin]; + protoFrame_fx[add( imult1616( bin, BINAURAL_CHANNELS ), offset )] = inRe[ch][slot][bin]; + protoFrame_fx[add( imult1616( bin, BINAURAL_CHANNELS ), add( offset, 1 ) )] = inIm[ch][slot][bin]; + move32(); + move32(); } } @@ -1727,11 +1832,13 @@ static void ivas_dirac_dec_decorrelate_slot_fx( /* De-interleave decorrelated signals*/ FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - offset = num_freq_bands * BINAURAL_CHANNELS * ch; + offset = imult1616( imult1616( num_freq_bands, BINAURAL_CHANNELS ), ch ); FOR( bin = 0; bin < num_freq_bands; bin++ ) { - decRe[ch][bin] = decorrelatedFrameInterleaved_fx[( bin * BINAURAL_CHANNELS ) + offset]; - decIm[ch][bin] = decorrelatedFrameInterleaved_fx[( bin * BINAURAL_CHANNELS ) + offset + 1]; + decRe[ch][bin] = decorrelatedFrameInterleaved_fx[add( imult1616( bin, BINAURAL_CHANNELS ), offset )]; + decIm[ch][bin] = decorrelatedFrameInterleaved_fx[add( imult1616( bin, BINAURAL_CHANNELS ), add( offset, 1 ) )]; + move32(); + move32(); } } // q_decorrelatedFrameInterleaved will be same as q_inp/q_protoFrame // @@ -2242,12 +2349,15 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric separateCenterChannelRendering = hConfig->separateCenterChannelRendering; move16(); ivas_format = hConfig->ivas_format; + move32(); mc_mode = hConfig->mc_mode; + move32(); ivas_total_brate = hConfig->ivas_total_brate; move32(); nchan_transport = hConfig->nchan_transport; move16(); qualityBasedSmFactor_fx = hConfig->qualityBasedSmFactor_fx; + move32(); qualityBasedSmFactor_fx = Mpy_32_32( qualityBasedSmFactor_fx, qualityBasedSmFactor_fx ); nBins = hSpatParamRendCom->num_freq_bands; /* Actually bins */ @@ -2256,6 +2366,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric q_earlyPartEneCorrection = s_min( Q31, add( getScaleFactor32( hDiracDecBin->earlyPartEneCorrection_fx, nBins ), hDiracDecBin->q_earlyPartEneCorrection ) ); scale_sig32( hDiracDecBin->earlyPartEneCorrection_fx, nBins, sub( q_earlyPartEneCorrection, hDiracDecBin->q_earlyPartEneCorrection ) ); hDiracDecBin->q_earlyPartEneCorrection = q_earlyPartEneCorrection; + move16(); set32_fx( hDiracDecBin->ChCrossRe_fx, 0, nBins ); set32_fx( hDiracDecBin->ChCrossIm_fx, 0, nBins ); @@ -2286,14 +2397,19 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Determine EQ for low bit rates (13.2 and 16.4 kbps) */ applyLowBitRateEQ = 0; - IF( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && LT_32( ivas_total_brate, MASA_STEREO_MIN_BITRATE ) ) + move16(); + test(); + test(); + IF( ( EQ_32( ivas_format, MASA_FORMAT ) || EQ_32( ivas_format, MC_FORMAT ) ) && LT_32( ivas_total_brate, MASA_STEREO_MIN_BITRATE ) ) { applyLowBitRateEQ = 1; + move16(); IF( EQ_32( ivas_total_brate, IVAS_16k4 ) ) { FOR( bin = 0; bin < LOW_BIT_RATE_BINAURAL_EQ_BINS; bin++ ) { lowBitRateEQ_fx[bin + LOW_BIT_RATE_BINAURAL_EQ_OFFSET] = L_add( L_shr( lowBitRateBinauralEQ_fx[bin], 1 ), ONE_IN_Q30 ); // Q31 + move32(); } } ELSE @@ -2326,6 +2442,12 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric inIm_fx[0][slot][bin] = L_shr( inIm_fx[0][slot][bin], 2 ); inIm_fx[1][slot][bin] = L_shr( inIm_fx[1][slot][bin], 2 ); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { Word32 instEne_fx; @@ -2334,6 +2456,8 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric instEne_fx = L_add( instEne_fx, Mpy_32_32( inIm_fx[ch][slot][bin], inIm_fx[ch][slot][bin] ) ); // 2q - 31 hDiracDecBin->ChEne_fx[ch][bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChEne_fx[ch][bin], hDiracDecBin->ChEne_e[ch][bin], instEne_fx, sub( 66, shl( q, 1 ) ), &hDiracDecBin->ChEne_e[ch][bin] ); subFrameTotalEne_fx[bin] = L_add( subFrameTotalEne_fx[bin], instEne_fx ); // 2q - 31 + move32(); + move32(); } } } @@ -2342,21 +2466,25 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric q_subFrameTotalEne = sub( shl( q, 1 ), 31 ); /* Apply EQ at low bit rates */ - IF( NE_16( applyLowBitRateEQ, 0 ) ) + IF( applyLowBitRateEQ != 0 ) { Word16 lastEqBin = LOW_BIT_RATE_BINAURAL_EQ_OFFSET + LOW_BIT_RATE_BINAURAL_EQ_BINS - 1; FOR( bin = LOW_BIT_RATE_BINAURAL_EQ_OFFSET; bin < lastEqBin; bin++ ) { subFrameTotalEne_fx[bin] = Mpy_32_32( subFrameTotalEne_fx[bin], lowBitRateEQ_fx[bin] ); // 2q -31 + move32(); } FOR( ; bin < nBins; bin++ ) { subFrameTotalEne_fx[bin] = Mpy_32_32( subFrameTotalEne_fx[bin], lowBitRateEQ_fx[lastEqBin] ); // 2q -31 + move32(); } } - IF( ( ivas_format == SBA_FORMAT || ivas_format == SBA_ISM_FORMAT ) && nchan_transport == 2 ) + test(); + test(); + IF( ( EQ_32( ivas_format, SBA_FORMAT ) || EQ_32( ivas_format, SBA_ISM_FORMAT ) ) && EQ_16( nchan_transport, 2 ) ) { Word32 tempRe, tempIm; Word32 subFrameSumEne_fx[CLDFB_NO_CHANNELS_MAX]; @@ -2372,11 +2500,13 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric tempRe = L_add( inRe_fx[0][slot][bin], inRe_fx[1][slot][bin] ); // q tempIm = L_add( inIm_fx[0][slot][bin], inIm_fx[1][slot][bin] ); // q subFrameSumEne_fx[bin] = L_add( subFrameSumEne_fx[bin], L_add( L_shr( Mpy_32_32( tempRe, tempRe ), 1 ), L_shr( Mpy_32_32( tempIm, tempIm ), 1 ) ) ); // 2q -31 + move32(); } } FOR( bin = 0; bin < nBins; bin++ ) { subFrameTotalEne_fx[bin] = L_max( subFrameTotalEne_fx[bin], subFrameSumEne_fx[bin] ); // 2q -31 + move32(); } } @@ -2392,6 +2522,10 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric Word16 q_meanEnePerCh; Word16 q_diffEne, q_dirEne; Word16 dirIndex; + move16(); + move16(); + move32(); + move32(); /* When BINAURAL_ROOM is not indicated, hBinaural->earlyPartEneCorrection[bin] values are all 1.0f. * When BINAURAL_ROOM is indicated, the binaural audio output is based on combined use of the @@ -2408,8 +2542,11 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric Word32 lRealpTmp_fx, lImagpTmp_fx, rRealpTmp_fx, rImagpTmp_fx; Word32 hrtfEne_fx[BINAURAL_CHANNELS], hrtfCrossRe_fx, hrtfCrossIm_fx, ratio_fx; UWord8 isIsmDirection = 0; + move16(); - IF( EQ_16( dirIndex, 0 ) ) /* For first of the two simultaneous directions */ + test(); + test(); + IF( dirIndex == 0 ) /* For first of the two simultaneous directions */ { aziDeg = hSpatParamRendCom->azimuth[dirac_read_idx][bin]; move16(); @@ -2422,7 +2559,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric gainCacheBaseIndex = 0; move16(); } - ELSE IF( ivas_format != MASA_ISM_FORMAT || ( ivas_format == MASA_ISM_FORMAT && LT_16( dirIndex, hSpatParamRendCom->numParametricDirections ) ) ) /* For second of the two simultaneous directions */ + ELSE IF( NE_32( ivas_format, MASA_ISM_FORMAT ) || ( EQ_32( ivas_format, MASA_ISM_FORMAT ) && LT_16( dirIndex, hSpatParamRendCom->numParametricDirections ) ) ) /* For second of the two simultaneous directions */ { IF( LT_32( ( ratio_fx = hSpatParamRendCom->energy_ratio2_fx[dirac_read_idx][bin] ), 10737418 /* 0.01 in Q30 */ ) ) { @@ -2471,7 +2608,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric diffuseness_fx = L_sub( diffuseness_fx, ratio_fx ); /* diffuseness = 1 - ratio1 - ratio2 */ - IF( LT_32( diffuseness_fx, 0 ) ) + if ( diffuseness_fx < 0 ) { diffuseness_fx = 0; move32(); @@ -2493,15 +2630,18 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric Word16 azi_scaled, ele_scaled; Word32 doaVectorX_fx, num, den; Word16 e = 0, spatialAngleDeg_fx, altSpreadCoh_fx; + move16(); azi_scaled = i_mult( aziDeg, 91 ); ele_scaled = i_mult( eleDeg, 91 ); doaVectorX_fx = L_mult( getCosWord16R2( azi_scaled ), getCosWord16R2( ele_scaled ) ); num = Sqrt32( L_sub( ONE_IN_Q31, Mpy_32_32( doaVectorX_fx, doaVectorX_fx ) ), &e ); den = doaVectorX_fx; + move32(); spatialAngleDeg_fx = BASOP_util_atan2( num, den, e ); // Q13 Word16 numr, num_e = 0, denr, den_e; - num_e = norm_s( spatialAngleDeg_fx ) - 1; + move16(); + num_e = sub( norm_s( spatialAngleDeg_fx ), 1 ); numr = shl( spatialAngleDeg_fx, num_e ); denr = 17157; move16(); @@ -2515,7 +2655,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric Word16 q_lr = Q28; move16(); - IF( hDiracDecBin->renderStereoOutputInsteadOfBinaural ) + if ( hDiracDecBin->renderStereoOutputInsteadOfBinaural ) { /* Synthesizing spread coherence is not needed for stereo loudspeaker output, * as directional sound is reproduced with two loudspeakers in any case */ @@ -2562,7 +2702,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric rImagp_fx = Mpy_32_32( rImagp_fx, centerMul_fx ); // Q25 /* Apply the gain for the left source of the three coherent sources */ - getDirectPartGains_fx( bin, aziDeg + 30, eleDeg, &lRealpTmp_fx, &lImagpTmp_fx, &rRealpTmp_fx, &rImagpTmp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat_fx, &gainCache[gainCacheBaseIndex + 1], isHeadtracked ); + getDirectPartGains_fx( bin, add( aziDeg, 30 ), eleDeg, &lRealpTmp_fx, &lImagpTmp_fx, &rRealpTmp_fx, &rImagpTmp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat_fx, &gainCache[gainCacheBaseIndex + 1], isHeadtracked ); hrtfEneSides_fx = L_add( Mpy_32_32( lRealpTmp_fx, lRealpTmp_fx ), // Q25 L_add( Mpy_32_32( lImagpTmp_fx, lImagpTmp_fx ), // Q25 @@ -2614,7 +2754,8 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric w3_fx = shl( sub( spreadCoh_fx, 16384 ), 1 ); } - IF( ( ivas_format == MC_FORMAT && mc_mode == MC_MODE_MCMASA ) ) + test(); + IF( ( EQ_32( ivas_format, MC_FORMAT ) && EQ_32( mc_mode, MC_MODE_MCMASA ) ) ) { idx = s_min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); @@ -2634,8 +2775,9 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Equalize the spread coherent combined HRTFs */ Word16 tmp, tmp_e; tmp_e = eneCorrectionFactor_e; + move16(); tmp = Sqrt16( eneCorrectionFactor_fx, &tmp_e ); - IF( shr( tmp, sub( 15, tmp_e ) ) >= 4 ) + IF( GE_16( shr( tmp, sub( 15, tmp_e ) ), 4 ) ) { eq_fx = 32767; // Q13 move16(); @@ -2653,8 +2795,10 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric move16(); } - hrtfEne_fx[0] = L_add( Mpy_32_32( lRealp_fx, lRealp_fx ), Mpy_32_32( lImagp_fx, lImagp_fx ) ); // Q( 2*q_lr - 31 ) - hrtfEne_fx[1] = L_add( Mpy_32_32( rRealp_fx, rRealp_fx ), Mpy_32_32( rImagp_fx, rImagp_fx ) ); // Q( 2*q_lr - 31 ) + hrtfEne_fx[0] = L_add( Mpy_32_32( lRealp_fx, lRealp_fx ), Mpy_32_32( lImagp_fx, lImagp_fx ) ); // Q( 2*q_lr - 31 ) + hrtfEne_fx[1] = L_add( Mpy_32_32( rRealp_fx, rRealp_fx ), Mpy_32_32( rImagp_fx, rImagp_fx ) ); // Q( 2*q_lr - 31 ) + move32(); + move32(); hrtfCrossRe_fx = L_add( Mpy_32_32( lRealp_fx, rRealp_fx ), Mpy_32_32( lImagp_fx, rImagp_fx ) ); // Q( 2*q_lr - 31 ) hrtfCrossIm_fx = L_add( Mpy_32_32( -lImagp_fx, rRealp_fx ), Mpy_32_32( lRealp_fx, rImagp_fx ) ); // Q( 2*q_lr - 31 ) @@ -2664,10 +2808,14 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric dirEne_fx = L_shl( dirEne_fx, shift ); q_dirEne = add( sub( q_meanEnePerCh, 1 ), shift ); - hDiracDecBin->ChEneOut_fx[0][bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChEneOut_fx[0][bin], hDiracDecBin->ChEneOut_e[0][bin], Mpy_32_32( dirEne_fx, hrtfEne_fx[0] ), sub( 31, q_dirEne + shl( q_lr, 1 ) - 62 ), &hDiracDecBin->ChEneOut_e[0][bin] ); /* Dir ene part*/ - hDiracDecBin->ChEneOut_fx[1][bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChEneOut_fx[1][bin], hDiracDecBin->ChEneOut_e[1][bin], Mpy_32_32( dirEne_fx, hrtfEne_fx[1] ), sub( 31, q_dirEne + shl( q_lr, 1 ) - 62 ), &hDiracDecBin->ChEneOut_e[1][bin] ); - hDiracDecBin->ChCrossReOut_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossReOut_fx[bin], hDiracDecBin->ChCrossReOut_e[bin], Mpy_32_32( dirEne_fx, hrtfCrossRe_fx ), sub( 31, q_dirEne + shl( q_lr, 1 ) - 62 ), &hDiracDecBin->ChCrossReOut_e[bin] ); /* Dir cross re */ - hDiracDecBin->ChCrossImOut_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossImOut_fx[bin], hDiracDecBin->ChCrossImOut_e[bin], Mpy_32_32( dirEne_fx, hrtfCrossIm_fx ), sub( 31, q_dirEne + shl( q_lr, 1 ) - 62 ), &hDiracDecBin->ChCrossImOut_e[bin] ); /* Dir cross im */ + hDiracDecBin->ChEneOut_fx[0][bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChEneOut_fx[0][bin], hDiracDecBin->ChEneOut_e[0][bin], Mpy_32_32( dirEne_fx, hrtfEne_fx[0] ), sub( 31, sub( add( q_dirEne, shl( q_lr, 1 ) ), 62 ) ), &hDiracDecBin->ChEneOut_e[0][bin] ); /* Dir ene part*/ + hDiracDecBin->ChEneOut_fx[1][bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChEneOut_fx[1][bin], hDiracDecBin->ChEneOut_e[1][bin], Mpy_32_32( dirEne_fx, hrtfEne_fx[1] ), sub( 31, sub( add( q_dirEne, shl( q_lr, 1 ) ), 62 ) ), &hDiracDecBin->ChEneOut_e[1][bin] ); + hDiracDecBin->ChCrossReOut_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossReOut_fx[bin], hDiracDecBin->ChCrossReOut_e[bin], Mpy_32_32( dirEne_fx, hrtfCrossRe_fx ), sub( 31, sub( add( q_dirEne, shl( q_lr, 1 ) ), 62 ) ), &hDiracDecBin->ChCrossReOut_e[bin] ); /* Dir cross re */ + hDiracDecBin->ChCrossImOut_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossImOut_fx[bin], hDiracDecBin->ChCrossImOut_e[bin], Mpy_32_32( dirEne_fx, hrtfCrossIm_fx ), sub( 31, sub( add( q_dirEne, shl( q_lr, 1 ) ), 62 ) ), &hDiracDecBin->ChCrossImOut_e[bin] ); /* Dir cross im */ + move32(); + move32(); + move32(); + move32(); } /* Add diffuse / ambient part covariance matrix */ @@ -2684,7 +2832,8 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric diffEneValForDecorrelationReduction_fx = Mpy_32_32( diffusenessValForDecorrelationReduction_fx, meanEnePerCh_fx ); // Q(2q - 32) q_diffEneValForDecorrelationReduction = sub( shl( q, 1 ), 32 ); - IF( ( ivas_format == MC_FORMAT && mc_mode == MC_MODE_MCMASA ) ) + test(); + IF( ( EQ_32( ivas_format, MC_FORMAT ) && EQ_32( mc_mode, MC_MODE_MCMASA ) ) ) { IF( !hDiracDecBin->renderStereoOutputInsteadOfBinaural ) { @@ -2703,14 +2852,19 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric hDiracDecBin->ChEneOut_fx[0][bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChEneOut_fx[0][bin], hDiracDecBin->ChEneOut_e[0][bin], diffEne_fx, sub( 31, q_diffEne ), &hDiracDecBin->ChEneOut_e[0][bin] ); /* Diff ene part*/ hDiracDecBin->ChEneOut_fx[1][bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChEneOut_fx[1][bin], hDiracDecBin->ChEneOut_e[1][bin], diffEne_fx, sub( 31, q_diffEne ), &hDiracDecBin->ChEneOut_e[1][bin] ); + move32(); + move32(); IF( hDiracDecBin->renderStereoOutputInsteadOfBinaural ) { /* When rendering stereo, ambience (except for surround coherent sound) has zero ICC. */ hDiracDecBin->ChCrossReOut_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossReOut_fx[bin], hDiracDecBin->ChCrossReOut_e[bin], Mpy_32_16_1( diffEne_fx, surCoh_fx ), sub( 31, q_diffEne ), &hDiracDecBin->ChCrossReOut_e[bin] ); + move32(); } ELSE /* When rendering binaural, ambience has frequency dependent ICC. */ { - IF( ( ivas_format == SBA_FORMAT || ivas_format == SBA_ISM_FORMAT ) && LT_16( bin, BINAURAL_COHERENCE_DIFFERENCE_BINS ) ) + test(); + test(); + IF( ( EQ_32( ivas_format, SBA_FORMAT ) || EQ_32( ivas_format, SBA_ISM_FORMAT ) ) && LT_16( bin, BINAURAL_COHERENCE_DIFFERENCE_BINS ) ) { Word32 diffuseFieldCoherence_fx; diffuseFieldCoherence_fx = L_add( L_add( Mpy_32_32( hDiracDecBin->hDiffuseDist->diffuseRatioX_fx[bin], hDiracDecBin->diffuseFieldCoherenceX_fx[bin] ), Mpy_32_32( hDiracDecBin->hDiffuseDist->diffuseRatioY_fx[bin], hDiracDecBin->diffuseFieldCoherenceY_fx[bin] ) ), Mpy_32_32( hDiracDecBin->hDiffuseDist->diffuseRatioZ_fx[bin], hDiracDecBin->diffuseFieldCoherenceZ_fx[bin] ) ); @@ -2720,11 +2874,14 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric { hDiracDecBin->ChCrossReOut_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossReOut_fx[bin], hDiracDecBin->ChCrossReOut_e[bin], Mpy_32_32( L_add( Mpy_32_16_1( hDiracDecBin->diffuseFieldCoherence_fx[bin], sub( 32767, surCoh_fx ) ), L_shl( surCoh_fx, 16 ) ), diffEne_fx ), sub( 31, q_diffEne ), &hDiracDecBin->ChCrossReOut_e[bin] ); } + move32(); } /* Store parameters for formulating average diffuseness over frame */ hDiracDecBin->frameMeanDiffuseness_fx[bin] = L_add( hDiracDecBin->frameMeanDiffuseness_fx[bin], L_shl( diffEneValForDecorrelationReduction_fx, sub( q_meanEnePerCh, q_diffEneValForDecorrelationReduction ) ) ); // Q(q_meanEnePerCh) frameMeanDiffusenessEneWeight_fx[bin] = L_add( frameMeanDiffusenessEneWeight_fx[bin], meanEnePerCh_fx ); + move32(); + move32(); } /* Formulate average diffuseness over frame */ @@ -2734,11 +2891,14 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric e = 0; move16(); hDiracDecBin->frameMeanDiffuseness_fx[bin] = BASOP_Util_Divide3232_Scale( hDiracDecBin->frameMeanDiffuseness_fx[bin], L_max( EPSILLON_FX, frameMeanDiffusenessEneWeight_fx[bin] ), &e ); - hDiracDecBin->frameMeanDiffuseness_fx[bin] = L_shl( hDiracDecBin->frameMeanDiffuseness_fx[bin], 14 + e ); // Q29 + hDiracDecBin->frameMeanDiffuseness_fx[bin] = L_shl( hDiracDecBin->frameMeanDiffuseness_fx[bin], add( 14, e ) ); // Q29 + move32(); + move32(); } + test(); /* Temporal IIR-type smoothing of covariance matrices. Also apply encoding quality based smoothing factor. */ - IF( ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) + IF( EQ_32( ivas_format, MASA_FORMAT ) && LT_32( ivas_total_brate, MASA_STEREO_MIN_BITRATE ) ) { IIReneLimiterFactor_fx = L_add( L_shl( 16, Q26 ), L_sub( L_shl( 1, Q26 ), L_shr( qualityBasedSmFactor_fx, 5 ) ) ); // Q26 } @@ -2764,9 +2924,10 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric den = L_max( 1, den ); IIReneLimiter_fx = BASOP_Util_Divide3232_Scale_cadence( num, den, &e ); e = add( sub( num_e, den_e ), add( 5, e ) ); - IF( L_shr_sat( IIReneLimiter_fx, 31 - e ) > 0 ) + if ( L_shr_sat( IIReneLimiter_fx, sub( 31, e ) ) > 0 ) { IIReneLimiter_fx = ONE_IN_Q31; + move32(); } ELSE { @@ -2777,22 +2938,34 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric hDiracDecBin->ChCrossIm_fx[bin] = Mpy_32_32( hDiracDecBin->ChCrossIm_fx[bin], qualityBasedSmFactor_fx ); hDiracDecBin->ChCrossReOut_fx[bin] = Mpy_32_32( hDiracDecBin->ChCrossReOut_fx[bin], qualityBasedSmFactor_fx ); hDiracDecBin->ChCrossImOut_fx[bin] = Mpy_32_32( hDiracDecBin->ChCrossImOut_fx[bin], qualityBasedSmFactor_fx ); + move32(); + move32(); + move32(); + move32(); FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { hDiracDecBin->ChEne_fx[ch][bin] = Mpy_32_32( hDiracDecBin->ChEne_fx[ch][bin], qualityBasedSmFactor_fx ); hDiracDecBin->ChEneOut_fx[ch][bin] = Mpy_32_32( hDiracDecBin->ChEneOut_fx[ch][bin], qualityBasedSmFactor_fx ); + move32(); + move32(); } hDiracDecBin->ChCrossRe_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossRe_fx[bin], hDiracDecBin->ChCrossRe_e[bin], Mpy_32_32( hDiracDecBin->ChCrossRePrev_fx[bin], IIReneLimiter_fx ), hDiracDecBin->ChCrossRePrev_e[bin], &hDiracDecBin->ChCrossRe_e[bin] ); hDiracDecBin->ChCrossIm_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossIm_fx[bin], hDiracDecBin->ChCrossIm_e[bin], Mpy_32_32( hDiracDecBin->ChCrossImPrev_fx[bin], IIReneLimiter_fx ), hDiracDecBin->ChCrossImPrev_e[bin], &hDiracDecBin->ChCrossIm_e[bin] ); hDiracDecBin->ChCrossReOut_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossReOut_fx[bin], hDiracDecBin->ChCrossReOut_e[bin], Mpy_32_32( hDiracDecBin->ChCrossReOutPrev_fx[bin], IIReneLimiter_fx ), hDiracDecBin->ChCrossReOutPrev_e[bin], &hDiracDecBin->ChCrossReOut_e[bin] ); hDiracDecBin->ChCrossImOut_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossImOut_fx[bin], hDiracDecBin->ChCrossImOut_e[bin], Mpy_32_32( hDiracDecBin->ChCrossImOutPrev_fx[bin], IIReneLimiter_fx ), hDiracDecBin->ChCrossImOutPrev_e[bin], &hDiracDecBin->ChCrossImOut_e[bin] ); + move32(); + move32(); + move32(); + move32(); FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { hDiracDecBin->ChEne_fx[ch][bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChEne_fx[ch][bin], hDiracDecBin->ChEne_e[ch][bin], Mpy_32_32( hDiracDecBin->ChEnePrev_fx[ch][bin], IIReneLimiter_fx ), hDiracDecBin->ChEnePrev_e[ch][bin], &hDiracDecBin->ChEne_e[ch][bin] ); hDiracDecBin->ChEneOut_fx[ch][bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChEneOut_fx[ch][bin], hDiracDecBin->ChEneOut_e[ch][bin], Mpy_32_32( hDiracDecBin->ChEneOutPrev_fx[ch][bin], IIReneLimiter_fx ), hDiracDecBin->ChEneOutPrev_e[ch][bin], &hDiracDecBin->ChEneOut_e[ch][bin] ); + move32(); + move32(); } /* Store energy values and coefficients for next round */ @@ -3087,17 +3260,19 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( Word16 q_processMtx[CLDFB_NO_CHANNELS_MAX], q_processMtxPrev[CLDFB_NO_CHANNELS_MAX]; Word16 q_processMtx_SCCR[CLDFB_NO_CHANNELS_MAX], q_processMtxPrev_SCCR[CLDFB_NO_CHANNELS_MAX]; Word16 q_processMtxDec[CLDFB_NO_CHANNELS_MAX], q_processMtxDecPrev[CLDFB_NO_CHANNELS_MAX]; - set_s( q_processMtx, hDiracDecBin->q_processMtx, CLDFB_NO_CHANNELS_MAX ); - set_s( q_processMtxPrev, hDiracDecBin->q_processMtxPrev, CLDFB_NO_CHANNELS_MAX ); - set_s( q_processMtx_SCCR, hDiracDecBin->q_processMtx, CLDFB_NO_CHANNELS_MAX ); - set_s( q_processMtxPrev_SCCR, hDiracDecBin->q_processMtxPrev, CLDFB_NO_CHANNELS_MAX ); - set_s( q_processMtxDec, hDiracDecBin->q_processMtxDec, CLDFB_NO_CHANNELS_MAX ); - set_s( q_processMtxDecPrev, hDiracDecBin->q_processMtxDecPrev, CLDFB_NO_CHANNELS_MAX ); + set16_fx( q_processMtx, hDiracDecBin->q_processMtx, CLDFB_NO_CHANNELS_MAX ); + set16_fx( q_processMtxPrev, hDiracDecBin->q_processMtxPrev, CLDFB_NO_CHANNELS_MAX ); + set16_fx( q_processMtx_SCCR, hDiracDecBin->q_processMtx, CLDFB_NO_CHANNELS_MAX ); + set16_fx( q_processMtxPrev_SCCR, hDiracDecBin->q_processMtxPrev, CLDFB_NO_CHANNELS_MAX ); + set16_fx( q_processMtxDec, hDiracDecBin->q_processMtxDec, CLDFB_NO_CHANNELS_MAX ); + set16_fx( q_processMtxDecPrev, hDiracDecBin->q_processMtxDecPrev, CLDFB_NO_CHANNELS_MAX ); ivas_format = hConfig->ivas_format; + move32(); separateCenterChannelRendering = extract_l( GT_16( nchanSeparateChannels, 0 ) ); move16(); mc_mode = hConfig->mc_mode; + move32(); ivas_total_brate = hConfig->ivas_total_brate; move32(); nchan_transport = hConfig->nchan_transport; @@ -3106,6 +3281,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( move16(); ism_mode = hConfig->ism_mode; + move32(); dirac_read_idx = hSpatParamRendCom->render_to_md_map[subframe]; move16(); @@ -3125,7 +3301,9 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( Word32 CrCrossRe_fx, CrCrossIm_fx; Word32 Mre_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], Mim_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], MdecRe_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], MdecIm_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; /* M = mixing matrix; Mdec = residual decorrelated signal mixing matrix */ Word32 prototypeMtx_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS] = { { ONE_IN_Q31, 107374182 }, { 107374182, ONE_IN_Q31 } }; + move32(); Word16 q_M, q_Cx, q_tmp, q_res, q_CrEne, q_CrCross, q_Mdec = 0; + move16(); Word32 tmp1, tmp2, res1, res2; Word16 q_tmp1, q_tmp2, q_realizedOutputEne, q_targetOutputEne, q_missingOutputEne, q_gain; Word16 exp1, exp2, q_processMtx_bin, q_processMtxDec_bin; @@ -3140,52 +3318,62 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( IF( GT_16( hDiracDecBin->ChEne_e[0][bin], hDiracDecBin->ChEne_e[1][bin] ) ) { hDiracDecBin->ChEne_fx[1][bin] = L_shr( hDiracDecBin->ChEne_fx[1][bin], sub( hDiracDecBin->ChEne_e[0][bin], hDiracDecBin->ChEne_e[1][bin] ) ); - hDiracDecBin->q_ChEne = 31 - hDiracDecBin->ChEne_e[0][bin]; + hDiracDecBin->q_ChEne = sub( 31, hDiracDecBin->ChEne_e[0][bin] ); hDiracDecBin->ChEne_e[1][bin] = hDiracDecBin->ChEne_e[0][bin]; } ELSE { hDiracDecBin->ChEne_fx[0][bin] = L_shr( hDiracDecBin->ChEne_fx[0][bin], sub( hDiracDecBin->ChEne_e[1][bin], hDiracDecBin->ChEne_e[0][bin] ) ); - hDiracDecBin->q_ChEne = 31 - hDiracDecBin->ChEne_e[1][bin]; + hDiracDecBin->q_ChEne = sub( 31, hDiracDecBin->ChEne_e[1][bin] ); hDiracDecBin->ChEne_e[0][bin] = hDiracDecBin->ChEne_e[1][bin]; } + move32(); + move16(); + IF( GT_16( hDiracDecBin->ChEneOut_e[0][bin], hDiracDecBin->ChEneOut_e[1][bin] ) ) { hDiracDecBin->ChEneOut_fx[1][bin] = L_shr( hDiracDecBin->ChEneOut_fx[1][bin], sub( hDiracDecBin->ChEneOut_e[0][bin], hDiracDecBin->ChEneOut_e[1][bin] ) ); - hDiracDecBin->q_ChEneOut = 31 - hDiracDecBin->ChEneOut_e[0][bin]; + hDiracDecBin->q_ChEneOut = sub( 31, hDiracDecBin->ChEneOut_e[0][bin] ); hDiracDecBin->ChEneOut_e[1][bin] = hDiracDecBin->ChEneOut_e[0][bin]; } ELSE { hDiracDecBin->ChEneOut_fx[0][bin] = L_shr( hDiracDecBin->ChEneOut_fx[0][bin], sub( hDiracDecBin->ChEneOut_e[1][bin], hDiracDecBin->ChEneOut_e[0][bin] ) ); - hDiracDecBin->q_ChEneOut = 31 - hDiracDecBin->ChEneOut_e[1][bin]; + hDiracDecBin->q_ChEneOut = sub( 31, hDiracDecBin->ChEneOut_e[1][bin] ); hDiracDecBin->ChEneOut_e[0][bin] = hDiracDecBin->ChEneOut_e[1][bin]; } + move32(); + move16(); IF( GT_16( hDiracDecBin->ChCrossRe_e[bin], hDiracDecBin->ChCrossIm_e[bin] ) ) { hDiracDecBin->ChCrossIm_fx[bin] = L_shr( hDiracDecBin->ChCrossIm_fx[bin], sub( hDiracDecBin->ChCrossRe_e[bin], hDiracDecBin->ChCrossIm_e[bin] ) ); - hDiracDecBin->q_ChCross = 31 - hDiracDecBin->ChCrossRe_e[bin]; + hDiracDecBin->q_ChCross = sub( 31, hDiracDecBin->ChCrossRe_e[bin] ); hDiracDecBin->ChCrossIm_e[bin] = hDiracDecBin->ChCrossRe_e[bin]; } ELSE { hDiracDecBin->ChCrossRe_fx[bin] = L_shr( hDiracDecBin->ChCrossRe_fx[bin], sub( hDiracDecBin->ChCrossIm_e[bin], hDiracDecBin->ChCrossRe_e[bin] ) ); - hDiracDecBin->q_ChCross = 31 - hDiracDecBin->ChCrossIm_e[bin]; + hDiracDecBin->q_ChCross = sub( 31, hDiracDecBin->ChCrossIm_e[bin] ); hDiracDecBin->ChCrossRe_e[bin] = hDiracDecBin->ChCrossIm_e[bin]; } + move32(); + move16(); + IF( GT_16( hDiracDecBin->ChCrossReOut_e[bin], hDiracDecBin->ChCrossImOut_e[bin] ) ) { hDiracDecBin->ChCrossImOut_fx[bin] = L_shr( hDiracDecBin->ChCrossImOut_fx[bin], sub( hDiracDecBin->ChCrossReOut_e[bin], hDiracDecBin->ChCrossImOut_e[bin] ) ); - hDiracDecBin->q_ChCrossOut = 31 - hDiracDecBin->ChCrossReOut_e[bin]; + hDiracDecBin->q_ChCrossOut = sub( 31, hDiracDecBin->ChCrossReOut_e[bin] ); hDiracDecBin->ChCrossImOut_e[bin] = hDiracDecBin->ChCrossReOut_e[bin]; } ELSE { hDiracDecBin->ChCrossReOut_fx[bin] = L_shr( hDiracDecBin->ChCrossReOut_fx[bin], sub( hDiracDecBin->ChCrossImOut_e[bin], hDiracDecBin->ChCrossReOut_e[bin] ) ); - hDiracDecBin->q_ChCrossOut = 31 - hDiracDecBin->ChCrossImOut_e[bin]; + hDiracDecBin->q_ChCrossOut = sub( 31, hDiracDecBin->ChCrossImOut_e[bin] ); hDiracDecBin->ChCrossReOut_e[bin] = hDiracDecBin->ChCrossImOut_e[bin]; } + move32(); + move16(); formulate2x2MixingMatrix_fx( hDiracDecBin->ChEne_fx[0][bin], hDiracDecBin->ChEne_fx[1][bin], hDiracDecBin->q_ChEne, @@ -3309,6 +3497,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( * by determining an energy-suppressed residual covariance matrix that is a control parameter * that guides the processing of the decorrelated sound to a residual signal. * The procedure improves quality in e.g. double-talk 2-direction rendering situations.*/ + test(); IF( EQ_16( ivas_format, MASA_FORMAT ) && LT_32( ivas_total_brate, MASA_STEREO_MIN_BITRATE ) ) { decorrelationReductionFactor_fx = ONE_IN_Q30; @@ -3318,7 +3507,8 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( } ELSE IF( L_or( L_and( EQ_16( ivas_format, MC_FORMAT ), EQ_16( mc_mode, MC_MODE_MCMASA ) ), L_and( EQ_16( ivas_format, MASA_FORMAT ), EQ_16( nchan_transport, 1 ) ) ) ) { - exp = sub( 31, 29 ); + exp = 31 - 29; + move16(); decorrelationReductionFactor_fx = Sqrt32( L_max( 0, hDiracDecBin->frameMeanDiffuseness_fx[bin] ), &exp ); q_decorrelationReductionFactor = sub( 31, exp ); } @@ -3437,18 +3627,20 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( } q_M = sub( add( q_M, q_gain ), 31 ); - exp = s_min( L_norm_arr( Mre_fx[0], i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ) ), L_norm_arr( Mim_fx[0], i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ) ) ); - scale_sig32( Mre_fx[0], i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ), exp ); - scale_sig32( Mim_fx[0], i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ), exp ); + exp = s_min( L_norm_arr( Mre_fx[0], BINAURAL_CHANNELS * BINAURAL_CHANNELS ), L_norm_arr( Mim_fx[0], BINAURAL_CHANNELS * BINAURAL_CHANNELS ) ); + scale_sig32( Mre_fx[0], BINAURAL_CHANNELS * BINAURAL_CHANNELS, exp ); + scale_sig32( Mim_fx[0], BINAURAL_CHANNELS * BINAURAL_CHANNELS, exp ); q_M = add( q_M, exp ); - exp = s_min( L_norm_arr( MdecRe_fx[0], i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ) ), L_norm_arr( MdecIm_fx[0], i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ) ) ); - scale_sig32( MdecRe_fx[0], i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ), exp ); - scale_sig32( MdecIm_fx[0], i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ), exp ); + exp = s_min( L_norm_arr( MdecRe_fx[0], BINAURAL_CHANNELS * BINAURAL_CHANNELS ), L_norm_arr( MdecIm_fx[0], BINAURAL_CHANNELS * BINAURAL_CHANNELS ) ); + scale_sig32( MdecRe_fx[0], BINAURAL_CHANNELS * BINAURAL_CHANNELS, exp ); + scale_sig32( MdecIm_fx[0], BINAURAL_CHANNELS * BINAURAL_CHANNELS, exp ); q_Mdec = add( q_Mdec, exp ); q_processMtx_bin = q_processMtx[bin]; q_processMtxDec_bin = q_processMtxDec[bin]; + move16(); + move16(); /* Store processing matrices */ FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { @@ -3512,6 +3704,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( q_gain = sub( add( q_tmp_sq, 31 ), 31 ); q_processMtx_bin = q_processMtx_SCCR[bin]; + move16(); FOR( chB = 0; chB < nchanSeparateChannels; chB++ ) { @@ -3582,7 +3775,9 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( minimum_s( q_processMtxPrev_SCCR, nBins, &hDiracDecBin->q_processMtxPrevSCCR ); } hDiracDecBin->q_processMtx = s_min( hDiracDecBin->q_processMtx, hDiracDecBin->q_processMtxSCCR ); + move16(); hDiracDecBin->q_processMtxPrev = s_min( hDiracDecBin->q_processMtxPrev, hDiracDecBin->q_processMtxPrevSCCR ); + move16(); hDiracDecBin->q_processMtxSCCR = hDiracDecBin->q_processMtx; move16(); hDiracDecBin->q_processMtxPrevSCCR = hDiracDecBin->q_processMtxPrev; @@ -3658,6 +3853,9 @@ static void ivas_dirac_dec_binaural_process_output_fx( nBins = hSpatParamRendCom->num_freq_bands; offsetSamples = 0; nSlots = hSpatParamRendCom->subframe_nbslots[subframe]; + move16(); + move16(); + move16(); Word32 decSlotRe_fx[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX], decSlotIm_fx[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; Word32 outSlotRe_fx[CLDFB_NO_CHANNELS_MAX], outSlotIm_fx[CLDFB_NO_CHANNELS_MAX]; @@ -3668,6 +3866,7 @@ static void ivas_dirac_dec_binaural_process_output_fx( Word32 *decSlotRePointer_fx; Word32 *decSlotImPointer_fx; Word16 q_inp_mix, q_reverb = 31; + move16(); IF( processReverb ) @@ -3680,15 +3879,19 @@ static void ivas_dirac_dec_binaural_process_output_fx( // input scaling is to maintain precision in ivas_dirac_dec_decorrelate_slot fn// Word16 shift = s_min( L_norm_arr( cldfbSynDec[0]->cldfb_state_fx, cldfbSynDec[0]->p_filter_length ), L_norm_arr( cldfbSynDec[1]->cldfb_state_fx, cldfbSynDec[1]->p_filter_length ) ); q_inp_mix = 31; + move16(); FOR( Word16 i = 0; i < 6; i++ ) { FOR( Word16 j = 0; j < nSlots; j++ ) { q_inp[i][j] = s_min( L_norm_arr( inRe_fx[i][j], nBins ), L_norm_arr( inIm_fx[i][j], nBins ) ); - IF( ( processReverb ) && ( i < 2 ) ) + move16(); + test(); + IF( ( processReverb ) && LT_16( i, 2 ) ) { q_reverb = s_min( L_norm_arr( reverbRe_fx[i][j], CLDFB_NO_CHANNELS_MAX ), L_norm_arr( reverbIm_fx[i][j], CLDFB_NO_CHANNELS_MAX ) ); q_inp[i][j] = s_min( q_reverb, q_inp[i][j] ); + move16(); } q_inp_mix = s_min( q_inp[i][j], q_inp_mix ); } @@ -3699,8 +3902,9 @@ static void ivas_dirac_dec_binaural_process_output_fx( Word16 cldfb_state_shift = sub( add( add( q_inp_mix, q_mat ), sub( q_input, 16 ) ), cldfbSynDec[0]->Q_cldfb_state ); IF( GT_16( cldfb_state_shift, shift ) ) { - q_inp_mix = q_inp_mix + shift - cldfb_state_shift; + q_inp_mix = sub( add( q_inp_mix, shift ), cldfb_state_shift ); cldfb_state_shift = shift; + move16(); } FOR( Word16 i = 0; i < 6; i++ ) @@ -3710,7 +3914,8 @@ static void ivas_dirac_dec_binaural_process_output_fx( scale_sig32( inRe_fx[i][j], nBins, q_inp_mix ); scale_sig32( inIm_fx[i][j], nBins, q_inp_mix ); - IF( processReverb && ( i < 2 ) ) + test(); + IF( processReverb && LT_16( i, 2 ) ) { scale_sig32( reverbRe_fx[i][j], CLDFB_NO_CHANNELS_MAX, sub( add( q_inp_mix, q_mat ), 15 ) ); scale_sig32( reverbIm_fx[i][j], CLDFB_NO_CHANNELS_MAX, sub( add( q_inp_mix, q_mat ), 15 ) ); @@ -3723,13 +3928,18 @@ static void ivas_dirac_dec_binaural_process_output_fx( cldfbSynDec[0]->Q_cldfb_state = add( cldfbSynDec[0]->Q_cldfb_state, cldfb_state_shift ); scale_sig32( cldfbSynDec[1]->cldfb_state_fx, cldfbSynDec[1]->p_filter_length, cldfb_state_shift ); cldfbSynDec[1]->Q_cldfb_state = add( cldfbSynDec[1]->Q_cldfb_state, cldfb_state_shift ); + move16(); + move16(); q_inp_mix = add( q_inp_mix, q_input ); interpVal_fx = 0; + move16(); Word16 q_result = sub( add( q_inp_mix, q_mat ), 15 ); // setting it prior// cldfbSynDec[0]->Q_cldfb_state = sub( q_result, 1 ); cldfbSynDec[1]->Q_cldfb_state = sub( q_result, 1 ); + move16(); + move16(); FOR( slot = 0; slot < nSlots; slot++ ) { @@ -3740,7 +3950,9 @@ static void ivas_dirac_dec_binaural_process_output_fx( ELSE { interpVal_fx = 32767; + move16(); } + test(); IF( !hDiracDecBin->useTdDecorr && ( GT_16( max_band_decorr, 0 ) ) ) { ivas_dirac_dec_decorrelate_slot_fx( hDiracDecBin, nBins, slot, inRe_fx, inIm_fx, q_inp_mix, decSlotRe_fx, decSlotIm_fx ); @@ -3789,6 +4001,8 @@ static void ivas_dirac_dec_binaural_process_output_fx( outSlotRe_fx[bin] = L_add( outSlotRe_fx[bin], Mpy_32_16_1( inRe_fx[chB][slot][bin], gain ) ); // q_inp_mix-4//q_result outSlotIm_fx[bin] = L_add( outSlotIm_fx[bin], Mpy_32_16_1( inIm_fx[chB][slot][bin], gain ) ); // q_inp_mix-4//q_result + move32(); + move32(); gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxImPrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxIm_fx[chA][chB][bin] ) ); // Q11 @@ -3796,19 +4010,26 @@ static void ivas_dirac_dec_binaural_process_output_fx( outSlotRe_fx[bin] = L_sub( outSlotRe_fx[bin], Mpy_32_16_1( inIm_fx[chB][slot][bin], gain ) ); // q_inp_mix-4//q_result outSlotIm_fx[bin] = L_add( outSlotIm_fx[bin], Mpy_32_16_1( inRe_fx[chB][slot][bin], gain ) ); // q_inp_mix-4//q_result + move32(); + move32(); /* Mixing decorrelated signals using the formulated residual processing matrix Mdec */ - IF( bin < max_band_decorr && chB < 2 ) + test(); + IF( LT_16( bin, max_band_decorr ) && LT_16( chB, 2 ) ) { gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxDecRePrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxDecRe_fx[chA][chB][bin] ) ); // interpVal * hDiracDecBin->processMtxDecRe[chA][chB][bin]; outSlotRe_fx[bin] = L_add( outSlotRe_fx[bin], Mpy_32_16_1( decSlotRePointer_fx[bin], gain ) ); // q_inp_mix-4//q_result outSlotIm_fx[bin] = L_add( outSlotIm_fx[bin], Mpy_32_16_1( decSlotImPointer_fx[bin], gain ) ); // q_inp_mix-4//q_result + move32(); + move32(); gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxDecImPrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxDecIm_fx[chA][chB][bin] ) ); outSlotRe_fx[bin] = L_sub( outSlotRe_fx[bin], Mpy_32_16_1( decSlotImPointer_fx[bin], gain ) ); // q_inp_mix-4//q_result outSlotIm_fx[bin] = L_add( outSlotIm_fx[bin], Mpy_32_16_1( decSlotRePointer_fx[bin], gain ) ); // q_inp_mix-4//q_result + move32(); + move32(); } } } @@ -3827,9 +4048,11 @@ static void ivas_dirac_dec_binaural_process_output_fx( cldfbSynthesis_ivas_fx( &outSlotRePr_fx, &outSlotImPr_fx, &( output_fx[chA][nBins * slot + offsetSamples] ), nBins, cldfbSynDec[chA] ); cldfbSynDec[chA]->Q_cldfb_state = sub( q_result, 1 ); + move16(); } } *q_out = sub( q_result, 1 ); + move16(); return; } @@ -3980,6 +4203,8 @@ static void adaptTransportSignalsHeadtracked_fx( Word16 q_chEneIIR = 0, q_procChEneIIR = 0; Word32 temp_div; Word16 e_div; + move16(); + move16(); FOR( Word16 i = 0; i < 6; i++ ) { @@ -4005,11 +4230,13 @@ static void adaptTransportSignalsHeadtracked_fx( { mono_factor_rotation = L_shl( mono_factor_rotation, 3 ); // Q31 } + move32(); /* Adapt transport signals in frequency bands */ /* optimization grouping CLDFB bins into MASA bands (they are readily available in ROM and suitable for the task) AND group CLDFB slots into sub-frames */ max_band = 0; + move16(); WHILE( max_band < MASA_FREQUENCY_BANDS && MASA_band_grouping_24[max_band] < nBins ) { max_band = add( max_band, 1 ); @@ -4018,7 +4245,7 @@ static void adaptTransportSignalsHeadtracked_fx( shift = sub( shift, 5 ); // 5 is gaurded bits needed// Word32 re, img, temp; - Word16 q_temp = 2 * ( q_inp + shift ) - 31; + Word16 q_temp = sub( imult1616( 2, add( q_inp, shift ) ), 31 ); FOR( band_idx = 0; band_idx < max_band; band_idx++ ) { Word32 ch_nrg[2]; /* storage for input signal channel energies */ @@ -4028,6 +4255,7 @@ static void adaptTransportSignalsHeadtracked_fx( FOR( ch = 0; ch < 2; ch++ ) { ch_nrg[ch] = 0; + move32(); FOR( slot = 0; slot < nSlots; slot++ ) { FOR( bin = bin_lo; bin < bin_hi; bin++ ) @@ -4036,9 +4264,11 @@ static void adaptTransportSignalsHeadtracked_fx( img = L_shl( inIm_fx[ch][slot][bin], shift ); ch_nrg[ch] = L_add( ch_nrg[ch], ( L_add( Mpy_32_32( re, re ), Mpy_32_32( img, img ) ) ) ); // 2(q_inp +shift) -31 + move32(); } } hHeadTrackData->chEneIIR_fx[ch][band_idx] = Mpy_32_16_1( hHeadTrackData->chEneIIR_fx[ch][band_idx], ADAPT_HTPROTO_IIR_FAC_FX ); + move32(); temp = Mpy_32_16_1( ch_nrg[ch], sub( 32767, ADAPT_HTPROTO_IIR_FAC_FX ) ); IF( LT_16( hHeadTrackData->q_chEneIIR, q_temp ) ) { @@ -4048,6 +4278,7 @@ static void adaptTransportSignalsHeadtracked_fx( { hHeadTrackData->chEneIIR_fx[ch][band_idx] = L_add( L_shr( hHeadTrackData->chEneIIR_fx[ch][band_idx], sub( hHeadTrackData->q_chEneIIR, q_temp ) ), temp ); } + move32(); } q_chEneIIR = s_min( hHeadTrackData->q_chEneIIR, q_temp ); /* Determine ILD */ @@ -4055,16 +4286,21 @@ static void adaptTransportSignalsHeadtracked_fx( IF( EQ_32( L_max( 1, hHeadTrackData->chEneIIR_fx[0][band_idx] ), L_max( 1, hHeadTrackData->chEneIIR_fx[1][band_idx] ) ) ) { ILD = 0; + move32(); } ELSE { temp_div = L_deposit_h( BASOP_Util_Divide3232_Scale( L_max( 1, hHeadTrackData->chEneIIR_fx[0][band_idx] ), L_max( 1, hHeadTrackData->chEneIIR_fx[1][band_idx] ), &e_div ) ); temp = BASOP_Util_Log2( temp_div ); // Q25 - IF( GE_16( e_div, 0 ) ) - temp = L_add( temp, L_shl( e_div, 25 ) ); // Q25 + IF( e_div > 0 ) + { + temp = L_add( temp, L_shl( e_div, 25 ) ); // Q25 + } ELSE + { temp = L_sub( temp, L_shl( abs( e_div ), 25 ) ); // Q25 + } temp = Mpy_32_32( temp, 646462464 ); // logx base 10 = 0.30103* logx base 2// ILD = L_abs( Mpy_32_16_1( temp, 20480 ) ); // Q21 @@ -4077,6 +4313,7 @@ static void adaptTransportSignalsHeadtracked_fx( { louderCh = 0; } + move16(); /* Determine ILD-based mono factor */ mono_factor_ILD = Mpy_32_16_1( L_sub( ILD, ONE_IN_Q21 ), 10911 ); // Q23 @@ -4084,9 +4321,14 @@ static void adaptTransportSignalsHeadtracked_fx( mono_factor_ILD = L_max( 0, L_min( ONE_IN_Q21, mono_factor_ILD ) ); IF( EQ_32( mono_factor_ILD, ONE_IN_Q21 ) ) - mono_factor_ILD = ONE_IN_Q31; + { + mono_factor_ILD = ONE_IN_Q31; + move32(); + } ELSE + { mono_factor_ILD = L_shl( mono_factor_ILD, 10 ); // Q31 + } /* Combine mono factors */ mono_factor = Mpy_32_32( mono_factor_ILD, mono_factor_rotation ); // Q31 @@ -4097,6 +4339,7 @@ static void adaptTransportSignalsHeadtracked_fx( IF( NE_16( ch, louderCh ) ) { Word32 band_nrg = 0; + move32(); FOR( slot = 0; slot < nSlots; slot++ ) { @@ -4105,12 +4348,15 @@ static void adaptTransportSignalsHeadtracked_fx( /* mono sum signal with the computed weight + rest from the original channel */ inRe_fx[ch][slot][bin] = L_add( ( Mpy_32_32( mono_factor, L_add( inRe_fx[0][slot][bin], inRe_fx[1][slot][bin] ) ) ), ( Mpy_32_32( L_sub( ONE_IN_Q31, mono_factor ), inRe_fx[ch][slot][bin] ) ) ); inIm_fx[ch][slot][bin] = L_add( ( Mpy_32_32( mono_factor, L_add( inIm_fx[0][slot][bin], inIm_fx[1][slot][bin] ) ) ), ( Mpy_32_32( L_sub( ONE_IN_Q31, mono_factor ), inIm_fx[ch][slot][bin] ) ) ); + move32(); + move32(); re = L_shl( inRe_fx[ch][slot][bin], shift ); img = L_shl( inIm_fx[ch][slot][bin], shift ); band_nrg = L_add( band_nrg, ( L_add( Mpy_32_32( re, re ), Mpy_32_32( img, img ) ) ) ); // 2(q_inp +shift) -31 } } hHeadTrackData->procChEneIIR_fx[ch][band_idx] = Mpy_32_16_1( hHeadTrackData->procChEneIIR_fx[ch][band_idx], ADAPT_HTPROTO_IIR_FAC_FX ); + move32(); temp = Mpy_32_16_1( band_nrg, sub( 32767, ADAPT_HTPROTO_IIR_FAC_FX ) ); IF( LT_16( hHeadTrackData->q_procChEneIIR, q_temp ) ) @@ -4121,11 +4367,13 @@ static void adaptTransportSignalsHeadtracked_fx( { hHeadTrackData->procChEneIIR_fx[ch][band_idx] = L_add( L_shr( hHeadTrackData->procChEneIIR_fx[ch][band_idx], sub( hHeadTrackData->q_procChEneIIR, q_temp ) ), temp ); } + move32(); } ELSE { /* processed signal is input. use the original channel, so no need to compute new signals or signal energy */ hHeadTrackData->procChEneIIR_fx[ch][band_idx] = Mpy_32_16_1( hHeadTrackData->procChEneIIR_fx[ch][band_idx], ADAPT_HTPROTO_IIR_FAC_FX ); + move32(); temp = Mpy_32_16_1( ch_nrg[ch], sub( 32767, ADAPT_HTPROTO_IIR_FAC_FX ) ); IF( LT_16( hHeadTrackData->q_procChEneIIR, q_temp ) ) @@ -4136,6 +4384,7 @@ static void adaptTransportSignalsHeadtracked_fx( { hHeadTrackData->procChEneIIR_fx[ch][band_idx] = L_add( L_shr( hHeadTrackData->procChEneIIR_fx[ch][band_idx], sub( hHeadTrackData->q_procChEneIIR, q_temp ) ), temp ); } + move32(); } } @@ -4147,13 +4396,16 @@ static void adaptTransportSignalsHeadtracked_fx( ene_proc = L_add( hHeadTrackData->procChEneIIR_fx[0][band_idx], hHeadTrackData->procChEneIIR_fx[1][band_idx] ); // q_procChEneIIR// temp_div = L_deposit_h( BASOP_Util_Divide3232_Scale( ene_target, L_max( 1, ene_proc ), &e_div ) ); - e_div = e_div + ( q_procChEneIIR - q_chEneIIR ); + e_div = add( e_div, sub( q_procChEneIIR, q_chEneIIR ) ); eqVal = Sqrt32( temp_div, &e_div ); Word16 comp_flag = BASOP_Util_Cmp_Mant32Exp( 1073741824, 3, eqVal, e_div ); IF( EQ_16( comp_flag, -1 ) ) - eqVal = 1073741824; // 4inQ28 + { + eqVal = 1073741824; // 4inQ28 + move32(); + } ELSE { eqVal = L_shl( eqVal, sub( e_div, 3 ) ); // Q28 @@ -4165,10 +4417,14 @@ static void adaptTransportSignalsHeadtracked_fx( { FOR( bin = bin_lo; bin < bin_hi; bin++ ) { - if ( ( ch == 0 && slot == 0 ) ) + test(); + IF( ( ch == 0 && slot == 0 ) ) { - if ( bin == 1 ) + if ( EQ_16( bin, 1 ) ) + { bin = bin; + move16(); + } } Word16 temp_shift = s_min( norm_l( inRe_fx[ch][slot][bin] ), norm_l( inIm_fx[ch][slot][bin] ) ); @@ -4179,6 +4435,8 @@ static void adaptTransportSignalsHeadtracked_fx( img = L_shr( Mpy_32_32( img, eqVal ), sub( temp_shift, 3 ) ); inRe_fx[ch][slot][bin] = re; // q_inp inIm_fx[ch][slot][bin] = img; // q_inp + move32(); + move32(); } } } @@ -4187,6 +4445,8 @@ static void adaptTransportSignalsHeadtracked_fx( hHeadTrackData->q_chEneIIR = q_chEneIIR; hHeadTrackData->q_procChEneIIR = q_procChEneIIR; + move16(); + move16(); return; } @@ -4319,19 +4579,25 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx( Word16 slot, bin, ch; Word32 tmpVal; Word16 norm, e_div, shift = 31; + move16(); Word32 Re, Im, temp_div; /* When not currently in prototype signal left-right switching procedure, check if such switching is needed */ - IF( EQ_16( (Word16) hHeadTrackData->lrSwitchedNext, (Word16) hHeadTrackData->lrSwitchedCurrent ) ) + IF( EQ_16( hHeadTrackData->lrSwitchedNext, hHeadTrackData->lrSwitchedCurrent ) ) { Word32 thresholdDotProduct = 182536112; // 0.17 in Q30// /* Corresponds to 10-degree switching threshold */ - IF( EQ_16( (Word16) hHeadTrackData->lrSwitchedCurrent, 0 ) && ( LT_32( Rmat_fx[1][1], L_negate( thresholdDotProduct ) ) ) ) + move32(); + test(); + if ( hHeadTrackData->lrSwitchedCurrent == 0 && ( LT_32( Rmat_fx[1][1], L_negate( thresholdDotProduct ) ) ) ) { hHeadTrackData->lrSwitchedNext = 1; + move16(); } - IF( EQ_16( (Word16) hHeadTrackData->lrSwitchedCurrent, 1 ) && ( GT_32( Rmat_fx[1][1], thresholdDotProduct ) ) ) + test(); + if ( EQ_16( hHeadTrackData->lrSwitchedCurrent, 1 ) && ( GT_32( Rmat_fx[1][1], thresholdDotProduct ) ) ) { hHeadTrackData->lrSwitchedNext = 0; + move16(); } } @@ -4346,7 +4612,7 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx( shift = sub( shift, 3 ); // guard bits// /* When currently in interpolation */ - IF( NE_16( (Word16) hHeadTrackData->lrSwitchedNext, (Word16) hHeadTrackData->lrSwitchedCurrent ) ) + IF( NE_16( hHeadTrackData->lrSwitchedNext, hHeadTrackData->lrSwitchedCurrent ) ) { FOR( slot = 0; slot < nSlots; slot++ ) { @@ -4354,12 +4620,15 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx( Word16 e_switchOrderFactor, e_origOrderFactor; hHeadTrackData->lrSwitchInterpVal_fx = L_add( hHeadTrackData->lrSwitchInterpVal_fx, 2684354 /* 0.0025f in Q30 */ ); /* Corresponds to 0.5 seconds interpolation time */ /* Q30 */ + move32(); IF( GT_32( hHeadTrackData->lrSwitchInterpVal_fx, 1072668096 /* 0.999f in Q30 */ ) ) { /* Stop interpolation, reset values */ hHeadTrackData->lrSwitchInterpVal_fx = 0; hHeadTrackData->lrSwitchedCurrent = hHeadTrackData->lrSwitchedNext; + move32(); + move16(); } /* Gains for determining portion of switched channel order and original channel order */ @@ -4368,8 +4637,13 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx( e_switchOrderFactor = 0; e_origOrderFactor = 0; + move16(); + move16(); IF( EQ_32( tmpVal, 32768 ) ) - tmpVal = ONE_IN_Q31; + { + tmpVal = ONE_IN_Q31; + move32(); + } ELSE tmpVal = L_shl( tmpVal, 16 ); // Q31 switchOrderFactor = Sqrt32( tmpVal, &e_switchOrderFactor ); @@ -4387,6 +4661,10 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx( re2[ch] = Mpy_32_32( inRe_fx[1 - ch][slot][bin], switchOrderFactor ); // q_inp im1[ch] = Mpy_32_32( inIm_fx[ch][slot][bin], origOrderFactor ); // q_inp im2[ch] = Mpy_32_32( inIm_fx[1 - ch][slot][bin], switchOrderFactor ); // q_inp + move32(); + move32(); + move32(); + move32(); } FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) @@ -4397,6 +4675,10 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx( re2[ch] = L_shl( re2[ch], shift ); // q_inp+shift// im1[ch] = L_shl( im1[ch], shift ); // q_inp+shift// im2[ch] = L_shl( im2[ch], shift ); // q_inp+shift// + move32(); + move32(); + move32(); + move32(); /* Interpolate / mix original and switched order signals */ Re = L_add( re1[ch], re2[ch] ); // q_inp+shift// @@ -4413,7 +4695,10 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx( Word16 comp_flag = BASOP_Util_Cmp_Mant32Exp( 1073741824, 3, eq, e_div ); IF( EQ_16( comp_flag, -1 ) ) - eq = 1073741824; // 4inQ28 + { + eq = 1073741824; // 4inQ28 + move32(); + } ELSE { eq = L_shl( eq, sub( e_div, 3 ) ); // Q28 @@ -4424,6 +4709,8 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx( inRe_fx[ch][slot][bin] = Re; inIm_fx[ch][slot][bin] = Im; + move32(); + move32(); } } } @@ -4431,7 +4718,7 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx( ELSE { /* If not in interpolation, but in switched prototype situation, then switch left and right channels */ - IF( hHeadTrackData->lrSwitchedCurrent == 1 ) + IF( EQ_16( hHeadTrackData->lrSwitchedCurrent, 1 ) ) { FOR( slot = 0; slot < nSlots; slot++ ) { @@ -4443,8 +4730,12 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx( tmpVal = inIm_fx[0][slot][bin]; inIm_fx[0][slot][bin] = inIm_fx[1][slot][bin]; inIm_fx[1][slot][bin] = tmpVal; - } - } + move32(); + move32(); + move32(); + move32(); + } + } } } @@ -4650,6 +4941,8 @@ static void eig2x2_fx( Word16 q_crossSquare, q_tmp1, q_tmp2, exp_tmp3, exp, q_e, q_c, q_U_1, q_U_2; Word32 epsilon_mant = 1180591621; Word16 epsilon_exp = -39; + move32(); + move16(); pm_fx = 0; move32(); @@ -4684,7 +4977,7 @@ static void eig2x2_fx( pm_fx = 0.5f * sqrtf(max(0.0f, a_fx)) add_fx = 0.5f * (e1 + e2)*/ - IF( L_and( EQ_32( c_re, 0 ), EQ_32( c_im, 0 ) ) ) + IF( L_and( c_re == 0, c_im == 0 ) ) { /* if c_re = 0 and c_im = 0, then crossSquare_fx = (c_re * c_re) + (c_im * c_im) = 0 a_fx = (E1 - E2)^2 @@ -4705,17 +4998,21 @@ static void eig2x2_fx( { /* if e1 - e2 = 0, then a_fx = 4 * crossSquare_fx pm_fx = 0.5 * sqrt(max(0, 4 * crossSquare_fx)) = sqrt(0, crossSquare_fx)*/ + test(); + test(); IF( EQ_32( c_re, 0 ) || LT_32( abs( c_re ), ONE_IN_Q15 ) ) { /* if c_re = 0, then crossSquare_fx = c_im^2 => pm_fx = max(0, c_im) */ pm_fx = L_max( 0, L_abs( c_im ) ); q_tmp2 = q_c; + move16(); } - ELSE IF( EQ_32( c_im, 0 ) || LT_32( abs( c_im ), ONE_IN_Q15 ) ) + ELSE IF( c_im == 0 || LT_32( abs( c_im ), ONE_IN_Q15 ) ) { /* if c_im = 0, then crossSquare_fx = c_re^2 => pm_fx = max(0, c_re) */ pm_fx = L_max( 0, L_abs( c_re ) ); q_tmp2 = q_c; + move16(); } ELSE { @@ -4739,6 +5036,7 @@ static void eig2x2_fx( ELSE { tmp2 = crossSquare_fx; + move32(); q_tmp2 = sub( q_crossSquare, 2 ); // crossSquare_fx = 4 * crossSquare_fx; tmp1 = Mpy_32_32( L_sub( e1, e2 ), L_sub( e1, e2 ) ); @@ -4748,7 +5046,7 @@ static void eig2x2_fx( q_tmp2 = sub( 31, q_tmp2 ); exp = sub( 31, q_tmp2 ); - pm_fx = Sqrt32( L_max( 0, a_fx - 1 ), &exp ); + pm_fx = Sqrt32( L_max( 0, L_sub( a_fx, 1 ) ), &exp ); pm_fx = L_shr( pm_fx, 1 ); q_tmp2 = sub( 31, exp ); } @@ -4757,6 +5055,7 @@ static void eig2x2_fx( // add_fx = 0.5 * (e1 + e2) add_fx = L_shr( L_add( e1, e2 ), 1 ); q_tmp1 = q_e; + move16(); IF( LT_16( q_tmp1, q_tmp2 ) ) { @@ -4825,147 +5124,173 @@ static void eig2x2_fx( q_U_1 = 0; q_U_2 = 0; + move16(); + move16(); /* Eigenvectors */ - FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ){ - IF( LT_16( *q_D, q_e ) ){ + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + IF( LT_16( *q_D, q_e ) ) + { tmp1 = L_sub( D_fx[ch], L_shr( e1, sub( q_e, *q_D ) ) ); - tmp2 = L_sub( D_fx[ch], L_shr( e2, sub( q_e, *q_D ) ) ); - q_tmp1 = *q_D; - move16(); -} -ELSE -{ - tmp1 = L_sub( L_shr( D_fx[ch], sub( *q_D, q_e ) ), e1 ); - tmp2 = L_sub( L_shr( D_fx[ch], sub( *q_D, q_e ) ), e2 ); - q_tmp1 = q_e; - move16(); -} + tmp2 = L_sub( D_fx[ch], L_shr( e2, sub( q_e, *q_D ) ) ); + q_tmp1 = *q_D; + move16(); + } + ELSE + { + tmp1 = L_sub( L_shr( D_fx[ch], sub( *q_D, q_e ) ), e1 ); + tmp2 = L_sub( L_shr( D_fx[ch], sub( *q_D, q_e ) ), e2 ); + q_tmp1 = q_e; + move16(); + } -IF( GT_32( abs( tmp2 ), abs( tmp1 ) ) ) -{ - s_fx = tmp2; - move32(); - exp = sub( norm_l( s_fx ), 1 ); - tmp2 = Mpy_32_32( s_fx, s_fx ); - q_tmp2 = sub( add( q_tmp1, q_tmp1 ), 31 ); + IF( GT_32( abs( tmp2 ), abs( tmp1 ) ) ) + { + s_fx = tmp2; + move32(); + exp = sub( norm_l( s_fx ), 1 ); + tmp2 = Mpy_32_32( s_fx, s_fx ); + q_tmp2 = sub( add( q_tmp1, q_tmp1 ), 31 ); - tmp2 = BASOP_Util_Add_Mant32Exp( crossSquare_fx, sub( 31, q_crossSquare ), tmp2, sub( 31, q_tmp2 ), &q_tmp2 ); - q_tmp2 = sub( 31, q_tmp2 ); + tmp2 = BASOP_Util_Add_Mant32Exp( crossSquare_fx, sub( 31, q_crossSquare ), tmp2, sub( 31, q_tmp2 ), &q_tmp2 ); + q_tmp2 = sub( 31, q_tmp2 ); - tmp3 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), epsilon_mant, epsilon_exp, &exp_tmp3 ); + tmp3 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), epsilon_mant, epsilon_exp, &exp_tmp3 ); - tmp2 = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, tmp3, &exp ); - exp = sub( exp, sub( Q30, sub( 31, exp_tmp3 ) ) ); - normVal_fx = Sqrt32( tmp2, &exp ); - q_tmp2 = sub( 31, exp ); + tmp2 = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, tmp3, &exp ); + exp = sub( exp, sub( Q30, sub( 31, exp_tmp3 ) ) ); + normVal_fx = Sqrt32( tmp2, &exp ); + q_tmp2 = sub( 31, exp ); - IF( LT_16( q_tmp1, q_c ) ) - { - c_re = L_shr( c_re, sub( q_c, q_tmp1 ) ); - c_im = L_shr( c_im, sub( q_c, q_tmp1 ) ); - q_c = q_tmp1; - move16(); - } - ELSE - { - s_fx = L_shr( s_fx, sub( q_tmp1, q_c ) ); - q_tmp1 = q_c; - move16(); - } + IF( LT_16( q_tmp1, q_c ) ) + { + c_re = L_shr( c_re, sub( q_c, q_tmp1 ) ); + c_im = L_shr( c_im, sub( q_c, q_tmp1 ) ); + q_c = q_tmp1; + move16(); + } + ELSE + { + s_fx = L_shr( s_fx, sub( q_tmp1, q_c ) ); + q_tmp1 = q_c; + move16(); + } - Ure_fx[0][ch] = Mpy_32_32( s_fx, normVal_fx ); - move32(); - Ure_fx[1][ch] = Mpy_32_32( c_re, normVal_fx ); - move32(); - Uim_fx[1][ch] = Mpy_32_32( c_im, normVal_fx ); - move32(); - q_U_1 = sub( add( q_tmp1, q_tmp2 ), 31 ); + Ure_fx[0][ch] = Mpy_32_32( s_fx, normVal_fx ); + move32(); + Ure_fx[1][ch] = Mpy_32_32( c_re, normVal_fx ); + move32(); + Uim_fx[1][ch] = Mpy_32_32( c_im, normVal_fx ); + move32(); + q_U_1 = sub( add( q_tmp1, q_tmp2 ), 31 ); - IF( q_U_2 != 0 ) - { - IF( LT_16( q_U_1, q_U_2 ) ) - { - Ure_fx[1][ch - 1] = L_shr( Ure_fx[1][ch - 1], sub( q_U_2, q_U_1 ) ); - Ure_fx[0][ch - 1] = L_shr( Ure_fx[0][ch - 1], sub( q_U_2, q_U_1 ) ); - Uim_fx[0][ch - 1] = L_shr( Uim_fx[0][ch - 1], sub( q_U_2, q_U_1 ) ); + IF( q_U_2 != 0 ) + { + IF( LT_16( q_U_1, q_U_2 ) ) + { + Ure_fx[1][ch - 1] = L_shr( Ure_fx[1][ch - 1], sub( q_U_2, q_U_1 ) ); + Ure_fx[0][ch - 1] = L_shr( Ure_fx[0][ch - 1], sub( q_U_2, q_U_1 ) ); + Uim_fx[0][ch - 1] = L_shr( Uim_fx[0][ch - 1], sub( q_U_2, q_U_1 ) ); + q_U_2 = q_U_1; + move32(); + move32(); + move32(); + move16(); + } + ELSE IF( GT_16( q_U_1, q_U_2 ) ) + { + Ure_fx[1][ch] = L_shr( Ure_fx[1][ch], sub( q_U_1, q_U_2 ) ); + Ure_fx[0][ch] = L_shr( Ure_fx[0][ch], sub( q_U_1, q_U_2 ) ); + Uim_fx[1][ch] = L_shr( Uim_fx[1][ch], sub( q_U_1, q_U_2 ) ); + q_U_1 = q_U_2; + move32(); + move32(); + move32(); + move16(); + } + } q_U_2 = q_U_1; + move16(); } - ELSE IF( GT_16( q_U_1, q_U_2 ) ) + ELSE { - Ure_fx[1][ch] = L_shr( Ure_fx[1][ch], sub( q_U_1, q_U_2 ) ); - Ure_fx[0][ch] = L_shr( Ure_fx[0][ch], sub( q_U_1, q_U_2 ) ); - Uim_fx[1][ch] = L_shr( Uim_fx[1][ch], sub( q_U_1, q_U_2 ) ); - q_U_1 = q_U_2; - } - } - q_U_2 = q_U_1; -} -ELSE -{ - s_fx = tmp1; - move32(); + s_fx = tmp1; + move32(); - exp = sub( norm_l( s_fx ), 1 ); - tmp2 = Mpy_32_32( s_fx, s_fx ); - q_tmp2 = sub( add( q_tmp1, q_tmp1 ), 31 ); + exp = sub( norm_l( s_fx ), 1 ); + tmp2 = Mpy_32_32( s_fx, s_fx ); + q_tmp2 = sub( add( q_tmp1, q_tmp1 ), 31 ); - tmp2 = BASOP_Util_Add_Mant32Exp( crossSquare_fx, sub( 31, q_crossSquare ), tmp2, sub( 31, q_tmp2 ), &q_tmp2 ); - q_tmp2 = sub( 31, q_tmp2 ); + tmp2 = BASOP_Util_Add_Mant32Exp( crossSquare_fx, sub( 31, q_crossSquare ), tmp2, sub( 31, q_tmp2 ), &q_tmp2 ); + q_tmp2 = sub( 31, q_tmp2 ); - tmp3 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), epsilon_mant, epsilon_exp, &exp_tmp3 ); + tmp3 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), epsilon_mant, epsilon_exp, &exp_tmp3 ); - tmp2 = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, tmp3, &exp ); - exp = sub( exp, sub( Q30, sub( 31, exp_tmp3 ) ) ); - normVal_fx = Sqrt32( tmp2, &exp ); - q_tmp2 = sub( 31, exp ); + tmp2 = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, tmp3, &exp ); + exp = sub( exp, sub( Q30, sub( 31, exp_tmp3 ) ) ); + normVal_fx = Sqrt32( tmp2, &exp ); + q_tmp2 = sub( 31, exp ); - IF( LT_16( q_tmp1, q_c ) ) - { - c_re = L_shr( c_re, sub( q_c, q_tmp1 ) ); - c_im = L_shr( c_im, sub( q_c, q_tmp1 ) ); - q_c = q_tmp1; - move16(); - } - ELSE - { - s_fx = L_shr( s_fx, sub( q_tmp1, q_c ) ); - q_tmp1 = q_c; - move16(); - } + IF( LT_16( q_tmp1, q_c ) ) + { + c_re = L_shr( c_re, sub( q_c, q_tmp1 ) ); + c_im = L_shr( c_im, sub( q_c, q_tmp1 ) ); + q_c = q_tmp1; + move16(); + } + ELSE + { + s_fx = L_shr( s_fx, sub( q_tmp1, q_c ) ); + q_tmp1 = q_c; + move16(); + } - Ure_fx[1][ch] = Mpy_32_32( s_fx, normVal_fx ); - move32(); - Ure_fx[0][ch] = Mpy_32_32( c_re, normVal_fx ); - move32(); - Uim_fx[0][ch] = Mpy_32_32( -c_im, normVal_fx ); - move32(); - q_U_2 = sub( add( q_tmp1, q_tmp2 ), 31 ); + Ure_fx[1][ch] = Mpy_32_32( s_fx, normVal_fx ); + move32(); + Ure_fx[0][ch] = Mpy_32_32( c_re, normVal_fx ); + move32(); + Uim_fx[0][ch] = Mpy_32_32( -c_im, normVal_fx ); + move32(); + q_U_2 = sub( add( q_tmp1, q_tmp2 ), 31 ); - IF( q_U_1 != 0 ) - { - IF( LT_16( q_U_1, q_U_2 ) ) - { - Ure_fx[1][ch] = L_shr( Ure_fx[1][ch], sub( q_U_2, q_U_1 ) ); - Ure_fx[0][ch] = L_shr( Ure_fx[0][ch], sub( q_U_2, q_U_1 ) ); - Uim_fx[0][ch] = L_shr( Uim_fx[0][ch], sub( q_U_2, q_U_1 ) ); - q_U_2 = q_U_1; - } - ELSE IF( GT_16( q_U_1, q_U_2 ) ) - { - Ure_fx[1][ch - 1] = L_shr( Ure_fx[1][ch - 1], sub( q_U_1, q_U_2 ) ); - Ure_fx[0][ch - 1] = L_shr( Ure_fx[0][ch - 1], sub( q_U_1, q_U_2 ) ); - Uim_fx[1][ch - 1] = L_shr( Uim_fx[1][ch - 1], sub( q_U_1, q_U_2 ) ); + IF( q_U_1 != 0 ) + { + IF( LT_16( q_U_1, q_U_2 ) ) + { + Ure_fx[1][ch] = L_shr( Ure_fx[1][ch], sub( q_U_2, q_U_1 ) ); + Ure_fx[0][ch] = L_shr( Ure_fx[0][ch], sub( q_U_2, q_U_1 ) ); + Uim_fx[0][ch] = L_shr( Uim_fx[0][ch], sub( q_U_2, q_U_1 ) ); + q_U_2 = q_U_1; + move32(); + move32(); + move32(); + move16(); + } + ELSE IF( GT_16( q_U_1, q_U_2 ) ) + { + Ure_fx[1][ch - 1] = L_shr( Ure_fx[1][ch - 1], sub( q_U_1, q_U_2 ) ); + Ure_fx[0][ch - 1] = L_shr( Ure_fx[0][ch - 1], sub( q_U_1, q_U_2 ) ); + Uim_fx[1][ch - 1] = L_shr( Uim_fx[1][ch - 1], sub( q_U_1, q_U_2 ) ); + q_U_1 = q_U_2; + move32(); + move32(); + move32(); + move16(); + } + } q_U_1 = q_U_2; + move16(); } } - q_U_1 = q_U_2; -} -} -*q_U = q_U_1 != 0 ? q_U_1 : q_U_2; + IF( q_U_1 != 0 ) + *q_U = q_U_1; + ELSE + *q_U = q_U_2; + move16(); -return; + return; } #endif // IVAS_FLOAT_FIXED @@ -5010,12 +5335,15 @@ static void matrixDiagMul_fx( { reOut_fx[chA][chB] = Mpy_32_32( reIn_fx[chA][chB], D_fx[chB] ); imOut_fx[chA][chB] = Mpy_32_32( imIn_fx[chA][chB], D_fx[chB] ); + move32(); + move32(); } } *q_Out = sub( add( q_In, q_D ), 31 ); + move16(); - IF( L_and( is_zero_arr( reOut_fx[0], size ), is_zero_arr( imOut_fx[0], size ) ) ) + if ( L_and( is_zero_arr( reOut_fx[0], size ), is_zero_arr( imOut_fx[0], size ) ) ) { *q_Out = Q31; move16(); @@ -5076,31 +5404,112 @@ static void matrixMul_fx( *q_A = add( *q_A, min_q_shift1 ); *q_B = add( *q_B, min_q_shift2 ); + move16(); + move16(); FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { FOR( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) { - tmp1 = ( Are_fx[chA][0] >= 0 && Bre_fx[0][chB] >= 0 ) || ( Are_fx[chA][0] < 0 && Bre_fx[0][chB] < 0 ) ? Mpy_32_32( Are_fx[chA][0], Bre_fx[0][chB] ) : L_negate( Mpy_32_32( abs( Are_fx[chA][0] ), abs( Bre_fx[0][chB] ) ) ); - tmp2 = ( Are_fx[chA][1] >= 0 && Bre_fx[1][chB] >= 0 ) || ( Are_fx[chA][1] < 0 && Bre_fx[1][chB] < 0 ) ? Mpy_32_32( Are_fx[chA][1], Bre_fx[1][chB] ) : L_negate( Mpy_32_32( abs( Are_fx[chA][1] ), abs( Bre_fx[1][chB] ) ) ); + test(); + test(); + test(); + IF( ( Are_fx[chA][0] >= 0 && Bre_fx[0][chB] >= 0 ) || ( Are_fx[chA][0] < 0 && Bre_fx[0][chB] < 0 ) ) + { + tmp1 = Mpy_32_32( Are_fx[chA][0], Bre_fx[0][chB] ); + } + ELSE + { + tmp1 = L_negate( Mpy_32_32( abs( Are_fx[chA][0] ), abs( Bre_fx[0][chB] ) ) ); + } + test(); + test(); + test(); + IF( ( Are_fx[chA][1] >= 0 && Bre_fx[1][chB] >= 0 ) || ( Are_fx[chA][1] < 0 && Bre_fx[1][chB] < 0 ) ) + { + tmp2 = Mpy_32_32( Are_fx[chA][1], Bre_fx[1][chB] ); + } + ELSE + { + tmp2 = L_negate( Mpy_32_32( abs( Are_fx[chA][1] ), abs( Bre_fx[1][chB] ) ) ); + } // outRe_fx[chA][chB] = Madd_32_32( Mpy_32_32( Are_fx[chA][0], Bre_fx[0][chB] ), Are_fx[chA][1], Bre_fx[1][chB] ); outRe_fx[chA][chB] = L_add( tmp1, tmp2 ); move32(); - tmp1 = ( Aim_fx[chA][0] >= 0 && Bim_fx[0][chB] >= 0 ) || ( Aim_fx[chA][0] < 0 && Bim_fx[0][chB] < 0 ) ? Mpy_32_32( Aim_fx[chA][0], Bim_fx[0][chB] ) : L_negate( Mpy_32_32( abs( Aim_fx[chA][0] ), abs( Bim_fx[0][chB] ) ) ); - tmp2 = ( Aim_fx[chA][1] >= 0 && Bim_fx[1][chB] >= 0 ) || ( Aim_fx[chA][1] < 0 && Bim_fx[1][chB] < 0 ) ? Mpy_32_32( Aim_fx[chA][1], Bim_fx[1][chB] ) : L_negate( Mpy_32_32( abs( Aim_fx[chA][1] ), abs( Bim_fx[1][chB] ) ) ); + test(); + test(); + test(); + IF( ( Aim_fx[chA][0] >= 0 && Bim_fx[0][chB] >= 0 ) || ( Aim_fx[chA][0] < 0 && Bim_fx[0][chB] < 0 ) ) + { + tmp1 = Mpy_32_32( Aim_fx[chA][0], Bim_fx[0][chB] ); + } + ELSE + { + tmp1 = L_negate( Mpy_32_32( abs( Aim_fx[chA][0] ), abs( Bim_fx[0][chB] ) ) ); + } + test(); + test(); + test(); + IF( ( Aim_fx[chA][1] >= 0 && Bim_fx[1][chB] >= 0 ) || ( Aim_fx[chA][1] < 0 && Bim_fx[1][chB] < 0 ) ) + { + tmp2 = Mpy_32_32( Aim_fx[chA][1], Bim_fx[1][chB] ); + } + ELSE + { + tmp2 = L_negate( Mpy_32_32( abs( Aim_fx[chA][1] ), abs( Bim_fx[1][chB] ) ) ); + } // outRe_fx[chA][chB] = L_sub( outRe_fx[chA][chB], Madd_32_32( Mpy_32_32( Aim_fx[chA][0], Bim_fx[0][chB] ), Aim_fx[chA][1], Bim_fx[1][chB] ) ); outRe_fx[chA][chB] = L_sub( outRe_fx[chA][chB], L_add( tmp1, tmp2 ) ); move32(); - - tmp1 = ( Aim_fx[chA][0] >= 0 && Bre_fx[0][chB] >= 0 ) || ( Aim_fx[chA][0] < 0 && Bre_fx[0][chB] < 0 ) ? Mpy_32_32( Aim_fx[chA][0], Bre_fx[0][chB] ) : L_negate( Mpy_32_32( abs( Aim_fx[chA][0] ), abs( Bre_fx[0][chB] ) ) ); - tmp2 = ( Aim_fx[chA][1] >= 0 && Bre_fx[1][chB] >= 0 ) || ( Aim_fx[chA][1] < 0 && Bre_fx[1][chB] < 0 ) ? Mpy_32_32( Aim_fx[chA][1], Bre_fx[1][chB] ) : L_negate( Mpy_32_32( abs( Aim_fx[chA][1] ), abs( Bre_fx[1][chB] ) ) ); + test(); + test(); + test(); + IF( ( Aim_fx[chA][0] >= 0 && Bre_fx[0][chB] >= 0 ) || ( Aim_fx[chA][0] < 0 && Bre_fx[0][chB] < 0 ) ) + { + tmp1 = Mpy_32_32( Aim_fx[chA][0], Bre_fx[0][chB] ); + } + ELSE + { + tmp1 = L_negate( Mpy_32_32( abs( Aim_fx[chA][0] ), abs( Bre_fx[0][chB] ) ) ); + } + test(); + test(); + test(); + IF( ( Aim_fx[chA][1] >= 0 && Bre_fx[1][chB] >= 0 ) || ( Aim_fx[chA][1] < 0 && Bre_fx[1][chB] < 0 ) ) + { + tmp2 = Mpy_32_32( Aim_fx[chA][1], Bre_fx[1][chB] ); + } + ELSE + { + tmp2 = L_negate( Mpy_32_32( abs( Aim_fx[chA][1] ), abs( Bre_fx[1][chB] ) ) ); + } // outIm_fx[chA][chB] = Madd_32_32( Mpy_32_32( Aim_fx[chA][0], Bre_fx[0][chB] ), Aim_fx[chA][1], Bre_fx[1][chB] ); outIm_fx[chA][chB] = L_add( tmp1, tmp2 ); move32(); - tmp1 = ( Are_fx[chA][0] >= 0 && Bim_fx[0][chB] >= 0 ) || ( Are_fx[chA][0] < 0 && Bim_fx[0][chB] < 0 ) ? Mpy_32_32( Are_fx[chA][0], Bim_fx[0][chB] ) : L_negate( Mpy_32_32( abs( Are_fx[chA][0] ), abs( Bim_fx[0][chB] ) ) ); - tmp2 = ( Are_fx[chA][1] >= 0 && Bim_fx[1][chB] >= 0 ) || ( Are_fx[chA][1] < 0 && Bim_fx[1][chB] < 0 ) ? Mpy_32_32( Are_fx[chA][1], Bim_fx[1][chB] ) : L_negate( Mpy_32_32( abs( Are_fx[chA][1] ), abs( Bim_fx[1][chB] ) ) ); + test(); + test(); + test(); + IF( ( Are_fx[chA][0] >= 0 && Bim_fx[0][chB] >= 0 ) || ( Are_fx[chA][0] < 0 && Bim_fx[0][chB] < 0 ) ) + { + tmp1 = Mpy_32_32( Are_fx[chA][0], Bim_fx[0][chB] ); + } + ELSE + { + tmp1 = L_negate( Mpy_32_32( abs( Are_fx[chA][0] ), abs( Bim_fx[0][chB] ) ) ); + } + test(); + test(); + test(); + IF( ( Are_fx[chA][1] >= 0 && Bim_fx[1][chB] >= 0 ) || ( Are_fx[chA][1] < 0 && Bim_fx[1][chB] < 0 ) ) + { + tmp2 = Mpy_32_32( Are_fx[chA][1], Bim_fx[1][chB] ); + } + ELSE + { + tmp2 = L_negate( Mpy_32_32( abs( Are_fx[chA][1] ), abs( Bim_fx[1][chB] ) ) ); + } // outIm_fx[chA][chB] = L_add( outIm_fx[chA][chB], Madd_32_32( Mpy_32_32( Are_fx[chA][0], Bim_fx[0][chB] ), Are_fx[chA][1], Bim_fx[1][chB] ) ); outIm_fx[chA][chB] = L_add( outIm_fx[chA][chB], L_add( tmp1, tmp2 ) ); move32(); @@ -5108,7 +5517,8 @@ static void matrixMul_fx( } *q_out = sub( add( *q_A, *q_B ), 31 ); - IF( L_and( is_zero_arr( outRe_fx[0], size ), is_zero_arr( outIm_fx[0], size ) ) ) + move16(); + if ( L_and( is_zero_arr( outRe_fx[0], size ), is_zero_arr( outIm_fx[0], size ) ) ) { *q_out = Q31; move16(); @@ -5162,24 +5572,73 @@ static void matrixTransp1Mul_fx( { FOR( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) { - tmp1 = ( ( ( Are_fx[0][chA] >= 0 ) && ( Bre_fx[0][chB] >= 0 ) ) || ( ( Are_fx[0][chA] < 0 ) && ( Bre_fx[0][chB] < 0 ) ) ) ? Mpy_32_32( Are_fx[0][chA], Bre_fx[0][chB] ) : L_negate( Mpy_32_32( abs( Are_fx[0][chA] ), abs( Bre_fx[0][chB] ) ) ); - tmp2 = ( ( ( Are_fx[1][chA] >= 0 ) && ( Bre_fx[1][chB] >= 0 ) ) || ( ( Are_fx[1][chA] < 0 ) && ( Bre_fx[1][chB] < 0 ) ) ) ? Mpy_32_32( Are_fx[1][chA], Bre_fx[1][chB] ) : L_negate( Mpy_32_32( abs( Are_fx[1][chA] ), abs( Bre_fx[1][chB] ) ) ); + test(); + test(); + test(); + IF( ( ( ( Are_fx[0][chA] >= 0 ) && ( Bre_fx[0][chB] >= 0 ) ) || ( ( Are_fx[0][chA] < 0 ) && ( Bre_fx[0][chB] < 0 ) ) ) ) + tmp1 = Mpy_32_32( Are_fx[0][chA], Bre_fx[0][chB] ); + ELSE + tmp1 = L_negate( Mpy_32_32( abs( Are_fx[0][chA] ), abs( Bre_fx[0][chB] ) ) ); + test(); + test(); + test(); + IF( ( ( ( Are_fx[1][chA] >= 0 ) && ( Bre_fx[1][chB] >= 0 ) ) || ( ( Are_fx[1][chA] < 0 ) && ( Bre_fx[1][chB] < 0 ) ) ) ) + tmp2 = Mpy_32_32( Are_fx[1][chA], Bre_fx[1][chB] ); + ELSE + tmp2 = L_negate( Mpy_32_32( abs( Are_fx[1][chA] ), abs( Bre_fx[1][chB] ) ) ); // outRe_fx[chA][chB] = Madd_32_32( Mpy_32_32( Are_fx[0][chA], Bre_fx[0][chB] ), Are_fx[1][chA], Bre_fx[1][chB] ); outRe_fx[chA][chB] = L_add( tmp1, tmp2 ); move32(); - tmp1 = ( ( ( L_negate( Aim_fx[0][chA] ) >= 0 ) && ( Bim_fx[0][chB] >= 0 ) ) || ( ( L_negate( Aim_fx[0][chA] ) < 0 ) && ( Bim_fx[0][chB] < 0 ) ) ) ? Mpy_32_32( -Aim_fx[0][chA], Bim_fx[0][chB] ) : L_negate( Mpy_32_32( abs( -Aim_fx[0][chA] ), abs( Bim_fx[0][chB] ) ) ); - tmp2 = ( ( ( Aim_fx[1][chA] >= 0 ) && ( Bim_fx[1][chB] >= 0 ) ) || ( ( Aim_fx[1][chA] < 0 ) && ( Bim_fx[1][chB] < 0 ) ) ) ? Mpy_32_32( Aim_fx[1][chA], Bim_fx[1][chB] ) : L_negate( Mpy_32_32( abs( Aim_fx[1][chA] ), abs( Bim_fx[1][chB] ) ) ); + test(); + test(); + test(); + IF( ( ( ( L_negate( Aim_fx[0][chA] ) >= 0 ) && ( Bim_fx[0][chB] >= 0 ) ) || ( ( L_negate( Aim_fx[0][chA] ) < 0 ) && ( Bim_fx[0][chB] < 0 ) ) ) ) + tmp1 = Mpy_32_32( -Aim_fx[0][chA], Bim_fx[0][chB] ); + ELSE + tmp1 = L_negate( Mpy_32_32( abs( -Aim_fx[0][chA] ), abs( Bim_fx[0][chB] ) ) ); + test(); + test(); + test(); + IF( ( ( ( Aim_fx[1][chA] >= 0 ) && ( Bim_fx[1][chB] >= 0 ) ) || ( ( Aim_fx[1][chA] < 0 ) && ( Bim_fx[1][chB] < 0 ) ) ) ) + tmp2 = Mpy_32_32( Aim_fx[1][chA], Bim_fx[1][chB] ); + ELSE + tmp2 = L_negate( Mpy_32_32( abs( Aim_fx[1][chA] ), abs( Bim_fx[1][chB] ) ) ); // outRe_fx[chA][chB] = L_sub( outRe_fx[chA][chB], Msub_32_32( Mpy_32_32( -Aim_fx[0][chA], Bim_fx[0][chB] ), Aim_fx[1][chA], Bim_fx[1][chB] ) ); outRe_fx[chA][chB] = L_sub( outRe_fx[chA][chB], L_sub( tmp1, tmp2 ) ); move32(); - tmp1 = ( ( ( L_negate( Aim_fx[0][chA] ) >= 0 ) && ( Bre_fx[0][chB] >= 0 ) ) || ( ( L_negate( Aim_fx[0][chA] ) < 0 ) && ( Bre_fx[0][chB] < 0 ) ) ) ? Mpy_32_32( -Aim_fx[0][chA], Bre_fx[0][chB] ) : L_negate( Mpy_32_32( abs( -Aim_fx[0][chA] ), abs( Bre_fx[0][chB] ) ) ); - tmp2 = ( ( ( Aim_fx[1][chA] >= 0 ) && ( Bre_fx[1][chB] >= 0 ) ) || ( ( Aim_fx[1][chA] < 0 ) && ( Bre_fx[1][chB] < 0 ) ) ) ? Mpy_32_32( Aim_fx[1][chA], Bre_fx[1][chB] ) : L_negate( Mpy_32_32( abs( Aim_fx[1][chA] ), abs( Bre_fx[1][chB] ) ) ); + test(); + test(); + test(); + IF( ( ( ( L_negate( Aim_fx[0][chA] ) >= 0 ) && ( Bre_fx[0][chB] >= 0 ) ) || ( ( L_negate( Aim_fx[0][chA] ) < 0 ) && ( Bre_fx[0][chB] < 0 ) ) ) ) + tmp1 = Mpy_32_32( -Aim_fx[0][chA], Bre_fx[0][chB] ); + ELSE + tmp1 = L_negate( Mpy_32_32( abs( -Aim_fx[0][chA] ), abs( Bre_fx[0][chB] ) ) ); + test(); + test(); + test(); + IF( ( ( ( Aim_fx[1][chA] >= 0 ) && ( Bre_fx[1][chB] >= 0 ) ) || ( ( Aim_fx[1][chA] < 0 ) && ( Bre_fx[1][chB] < 0 ) ) ) ) + tmp2 = Mpy_32_32( Aim_fx[1][chA], Bre_fx[1][chB] ); + ELSE + tmp2 = L_negate( Mpy_32_32( abs( Aim_fx[1][chA] ), abs( Bre_fx[1][chB] ) ) ); // outIm_fx[chA][chB] = Msub_32_32( Mpy_32_32( -Aim_fx[0][chA], Bre_fx[0][chB] ), Aim_fx[1][chA], Bre_fx[1][chB] ); outIm_fx[chA][chB] = L_sub( tmp1, tmp2 ); move32(); - tmp1 = ( ( ( Are_fx[0][chA] >= 0 ) && ( Bim_fx[0][chB] >= 0 ) ) || ( ( Are_fx[0][chA] < 0 ) && ( Bim_fx[0][chB] < 0 ) ) ) ? Mpy_32_32( Are_fx[0][chA], Bim_fx[0][chB] ) : L_negate( Mpy_32_32( abs( Are_fx[0][chA] ), abs( Bim_fx[0][chB] ) ) ); - tmp2 = ( ( ( Are_fx[1][chA] >= 0 ) && ( Bim_fx[1][chB] >= 0 ) ) || ( ( Are_fx[1][chA] < 0 ) && ( Bim_fx[1][chB] < 0 ) ) ) ? Mpy_32_32( Are_fx[1][chA], Bim_fx[1][chB] ) : L_negate( Mpy_32_32( abs( Are_fx[1][chA] ), abs( Bim_fx[1][chB] ) ) ); + + test(); + test(); + test(); + IF( ( ( ( Are_fx[0][chA] >= 0 ) && ( Bim_fx[0][chB] >= 0 ) ) || ( ( Are_fx[0][chA] < 0 ) && ( Bim_fx[0][chB] < 0 ) ) ) ) + tmp1 = Mpy_32_32( Are_fx[0][chA], Bim_fx[0][chB] ); + ELSE + tmp1 = L_negate( Mpy_32_32( abs( Are_fx[0][chA] ), abs( Bim_fx[0][chB] ) ) ); + test(); + test(); + test(); + IF( ( ( ( Are_fx[1][chA] >= 0 ) && ( Bim_fx[1][chB] >= 0 ) ) || ( ( Are_fx[1][chA] < 0 ) && ( Bim_fx[1][chB] < 0 ) ) ) ) + tmp2 = Mpy_32_32( Are_fx[1][chA], Bim_fx[1][chB] ); + ELSE + tmp2 = L_negate( Mpy_32_32( abs( Are_fx[1][chA] ), abs( Bim_fx[1][chB] ) ) ); // outIm_fx[chA][chB] = L_add( outIm_fx[chA][chB], Madd_32_32( Mpy_32_32( Are_fx[0][chA], Bim_fx[0][chB] ), Are_fx[1][chA], Bim_fx[1][chB] ) ); outIm_fx[chA][chB] = L_add( outIm_fx[chA][chB], L_add( tmp1, tmp2 ) ); move32(); @@ -5187,7 +5646,8 @@ static void matrixTransp1Mul_fx( } *q_out = sub( add( q_A, q_B ), 31 ); - IF( L_and( is_zero_arr( outRe_fx[0], size ), is_zero_arr( outIm_fx[0], size ) ) ) + move16(); + if ( L_and( is_zero_arr( outRe_fx[0], size ), is_zero_arr( outIm_fx[0], size ) ) ) { *q_out = Q31; move16(); @@ -5242,43 +5702,94 @@ static void matrixTransp2Mul_fx( scale_sig32( Are_fx[0], size, min_q_shift ); scale_sig32( Aim_fx[0], size, min_q_shift ); *q_A = add( *q_A, min_q_shift ); + move16(); min_q_shift = sub( s_min( L_norm_arr( Bre_fx[0], size ), L_norm_arr( Bim_fx[0], size ) ), 1 ); scale_sig32( Bre_fx[0], size, min_q_shift ); scale_sig32( Bim_fx[0], size, min_q_shift ); *q_B = add( *q_B, min_q_shift ); + move16(); FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { FOR( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) { - tmp1 = ( Are_fx[chA][0] >= 0 && Bre_fx[chB][0] >= 0 ) || ( Are_fx[chA][0] < 0 && Bre_fx[chB][0] < 0 ) ? Mpy_32_32( Are_fx[chA][0], Bre_fx[chB][0] ) : L_negate( Mpy_32_32( abs( Are_fx[chA][0] ), abs( Bre_fx[chB][0] ) ) ); - tmp2 = ( Are_fx[chA][1] >= 0 && Bre_fx[chB][1] >= 0 ) || ( Are_fx[chA][1] < 0 && Bre_fx[chB][1] < 0 ) ? Mpy_32_32( Are_fx[chA][1], Bre_fx[chB][1] ) : L_negate( Mpy_32_32( abs( Are_fx[chA][1] ), abs( Bre_fx[chB][1] ) ) ); + test(); + test(); + test(); + IF( ( Are_fx[chA][0] >= 0 && Bre_fx[chB][0] >= 0 ) || ( Are_fx[chA][0] < 0 && Bre_fx[chB][0] < 0 ) ) + tmp1 = Mpy_32_32( Are_fx[chA][0], Bre_fx[chB][0] ); + ELSE + tmp1 = L_negate( Mpy_32_32( abs( Are_fx[chA][0] ), abs( Bre_fx[chB][0] ) ) ); + test(); + test(); + test(); + IF( ( Are_fx[chA][1] >= 0 && Bre_fx[chB][1] >= 0 ) || ( Are_fx[chA][1] < 0 && Bre_fx[chB][1] < 0 ) ) + tmp2 = Mpy_32_32( Are_fx[chA][1], Bre_fx[chB][1] ); + ELSE + tmp2 = L_negate( Mpy_32_32( abs( Are_fx[chA][1] ), abs( Bre_fx[chB][1] ) ) ); // outRe_fx[chA][chB] = Madd_32_32( Mpy_32_32( Are_fx[chA][0], Bre_fx[chB][0] ), Are_fx[chA][1], Bre_fx[chB][1] ); outRe_fx[chA][chB] = L_add( tmp1, tmp2 ); move32(); - tmp1 = ( Aim_fx[chA][0] >= 0 && L_negate( Bim_fx[chB][0] ) >= 0 ) || ( Aim_fx[chA][0] < 0 && L_negate( Bim_fx[chB][0] ) < 0 ) ? Mpy_32_32( Aim_fx[chA][0], -Bim_fx[chB][0] ) : L_negate( Mpy_32_32( abs( Aim_fx[chA][0] ), abs( -Bim_fx[chB][0] ) ) ); - tmp2 = ( Aim_fx[chA][1] >= 0 && L_negate( Bim_fx[chB][1] ) >= 0 ) || ( Aim_fx[chA][1] < 0 && L_negate( Bim_fx[chB][1] ) < 0 ) ? Mpy_32_32( Aim_fx[chA][1], -Bim_fx[chB][1] ) : L_negate( Mpy_32_32( abs( Aim_fx[chA][1] ), abs( -Bim_fx[chB][1] ) ) ); + test(); + test(); + test(); + IF( ( Aim_fx[chA][0] >= 0 && L_negate( Bim_fx[chB][0] ) >= 0 ) || ( Aim_fx[chA][0] < 0 && L_negate( Bim_fx[chB][0] ) < 0 ) ) + tmp1 = Mpy_32_32( Aim_fx[chA][0], -Bim_fx[chB][0] ); + ELSE + tmp1 = L_negate( Mpy_32_32( abs( Aim_fx[chA][0] ), abs( -Bim_fx[chB][0] ) ) ); + test(); + test(); + test(); + IF( ( Aim_fx[chA][1] >= 0 && L_negate( Bim_fx[chB][1] ) >= 0 ) || ( Aim_fx[chA][1] < 0 && L_negate( Bim_fx[chB][1] ) < 0 ) ) + tmp2 = Mpy_32_32( Aim_fx[chA][1], -Bim_fx[chB][1] ); + ELSE + tmp2 = L_negate( Mpy_32_32( abs( Aim_fx[chA][1] ), abs( -Bim_fx[chB][1] ) ) ); // outRe_fx[chA][chB] = L_sub( outRe_fx[chA][chB], Madd_32_32( Mpy_32_32( Aim_fx[chA][0], -Bim_fx[chB][0] ), Aim_fx[chA][1], -Bim_fx[chB][1] ) ); outRe_fx[chA][chB] = L_sub( outRe_fx[chA][chB], L_add( tmp1, tmp2 ) ); move32(); - tmp1 = ( Aim_fx[chA][0] >= 0 && Bre_fx[chB][0] >= 0 ) || ( Aim_fx[chA][0] < 0 && Bre_fx[chB][0] < 0 ) ? Mpy_32_32( Aim_fx[chA][0], Bre_fx[chB][0] ) : L_negate( Mpy_32_32( abs( Aim_fx[chA][0] ), abs( Bre_fx[chB][0] ) ) ); - tmp2 = ( Aim_fx[chA][1] >= 0 && Bre_fx[chB][1] >= 0 ) || ( Aim_fx[chA][1] < 0 && Bre_fx[chB][1] < 0 ) ? Mpy_32_32( Aim_fx[chA][1], Bre_fx[chB][1] ) : L_negate( Mpy_32_32( abs( Aim_fx[chA][1] ), abs( Bre_fx[chB][1] ) ) ); + test(); + test(); + test(); + IF( ( Aim_fx[chA][0] >= 0 && Bre_fx[chB][0] >= 0 ) || ( Aim_fx[chA][0] < 0 && Bre_fx[chB][0] < 0 ) ) + tmp1 = Mpy_32_32( Aim_fx[chA][0], Bre_fx[chB][0] ); + ELSE + tmp1 = L_negate( Mpy_32_32( abs( Aim_fx[chA][0] ), abs( Bre_fx[chB][0] ) ) ); + test(); + test(); + test(); + IF( ( Aim_fx[chA][1] >= 0 && Bre_fx[chB][1] >= 0 ) || ( Aim_fx[chA][1] < 0 && Bre_fx[chB][1] < 0 ) ) + tmp2 = Mpy_32_32( Aim_fx[chA][1], Bre_fx[chB][1] ); + ELSE + tmp2 = L_negate( Mpy_32_32( abs( Aim_fx[chA][1] ), abs( Bre_fx[chB][1] ) ) ); // outIm_fx[chA][chB] = Madd_32_32( Mpy_32_32( Aim_fx[chA][0], Bre_fx[chB][0] ), Aim_fx[chA][1], Bre_fx[chB][1] ); outIm_fx[chA][chB] = L_add( tmp1, tmp2 ); move32(); - tmp1 = ( Are_fx[chA][0] >= 0 && L_negate( Bim_fx[chB][0] ) >= 0 ) || ( Are_fx[chA][0] < 0 && L_negate( Bim_fx[chB][0] ) < 0 ) ? Mpy_32_32( Are_fx[chA][0], -Bim_fx[chB][0] ) : L_negate( Mpy_32_32( abs( Are_fx[chA][0] ), abs( -Bim_fx[chB][0] ) ) ); - tmp2 = ( Are_fx[chA][1] >= 0 && L_negate( Bim_fx[chB][1] ) >= 0 ) || ( Are_fx[chA][1] < 0 && L_negate( Bim_fx[chB][1] ) < 0 ) ? Mpy_32_32( Are_fx[chA][1], -Bim_fx[chB][1] ) : L_negate( Mpy_32_32( abs( Are_fx[chA][1] ), abs( -Bim_fx[chB][1] ) ) ); + test(); + test(); + test(); + IF( ( Are_fx[chA][0] >= 0 && L_negate( Bim_fx[chB][0] ) >= 0 ) || ( Are_fx[chA][0] < 0 && L_negate( Bim_fx[chB][0] ) < 0 ) ) + tmp1 = Mpy_32_32( Are_fx[chA][0], -Bim_fx[chB][0] ); + ELSE + tmp1 = L_negate( Mpy_32_32( abs( Are_fx[chA][0] ), abs( -Bim_fx[chB][0] ) ) ); + test(); + test(); + test(); + IF( ( Are_fx[chA][1] >= 0 && L_negate( Bim_fx[chB][1] ) >= 0 ) || ( Are_fx[chA][1] < 0 && L_negate( Bim_fx[chB][1] ) < 0 ) ) + tmp2 = Mpy_32_32( Are_fx[chA][1], -Bim_fx[chB][1] ); + ELSE + tmp2 = L_negate( Mpy_32_32( abs( Are_fx[chA][1] ), abs( -Bim_fx[chB][1] ) ) ); // outIm_fx[chA][chB] = L_add( outIm_fx[chA][chB], Madd_32_32( Mpy_32_32( Are_fx[chA][0], -Bim_fx[chB][0] ), Are_fx[chA][1], -Bim_fx[chB][1] ) ); outIm_fx[chA][chB] = L_add( outIm_fx[chA][chB], L_add( tmp1, tmp2 ) ); move32(); } } *q_out = sub( add( *q_A, *q_B ), 31 ); + move16(); - IF( L_and( is_zero_arr( outRe_fx[0], size ), is_zero_arr( outIm_fx[0], size ) ) ) + if ( L_and( is_zero_arr( outRe_fx[0], size ), is_zero_arr( outIm_fx[0], size ) ) ) { *q_out = Q31; move16(); @@ -5336,7 +5847,7 @@ static void chol2x2_fx( q_re1 = sub( 31, exp ); // 4611686 = 1e-12 in Q62 - IF( EQ_32( outRe[0][0], 0 ) ) + IF( outRe[0][0] == 0 ) { outRe[1][0] = BASOP_Util_Divide3232_Scale_cadence( c_re, 4611686, &exp ); move32(); @@ -5356,12 +5867,12 @@ static void chol2x2_fx( move32(); q_im = add( sub( 31, exp ), sub( q_c, q_re1 ) ); } - IF( EQ_32( outRe[1][0], 0 ) ) + if ( outRe[1][0] == 0 ) { q_re2 = Q31; move16(); } - IF( EQ_32( outIm[1][0], 0 ) ) + if ( outIm[1][0] == 0 ) { q_im = Q31; move16(); @@ -5371,7 +5882,7 @@ static void chol2x2_fx( q_tmp = sub( add( q_c, q_c ), 31 ); // 4611686 = Q62 - IF( EQ_32( e1, 0 ) ) + IF( e1 == 0 ) { temp = BASOP_Util_Divide3232_Scale_cadence( temp, 4611686, &exp ); q_tmp = add( sub( 31, exp ), sub( q_tmp, 62 ) ); @@ -5381,7 +5892,7 @@ static void chol2x2_fx( temp = BASOP_Util_Divide3232_Scale_cadence( temp, e1, &exp ); q_tmp = add( sub( 31, exp ), sub( q_tmp, q_e ) ); } - IF( EQ_32( temp, 0 ) ) + if ( temp == 0 ) { q_tmp = Q31; move16(); @@ -5421,7 +5932,7 @@ static void chol2x2_fx( q_re1 = sub( 31, exp ); // 4611686 = Q62 - IF( EQ_32( outRe[1][1], 0 ) ) + IF( outRe[1][1] == 0 ) { outRe[0][1] = BASOP_Util_Divide3232_Scale_cadence( c_re, 4611686, &exp ); move32(); @@ -5441,12 +5952,12 @@ static void chol2x2_fx( move32(); q_im = add( sub( 31, exp ), sub( q_c, q_re1 ) ); } - IF( EQ_32( outRe[0][1], 0 ) ) + if ( outRe[0][1] == 0 ) { q_re2 = Q31; move16(); } - IF( EQ_32( outIm[0][1], 0 ) ) + if ( outIm[0][1] == 0 ) { q_im = Q31; move16(); @@ -5456,7 +5967,7 @@ static void chol2x2_fx( q_tmp = sub( add( q_c, q_c ), 31 ); // 4611686 = 1e-12 in Q62 - IF( EQ_32( e2, 0 ) ) + IF( e2 == 0 ) { temp = BASOP_Util_Divide3232_Scale_cadence( temp, 4611686, &exp ); q_tmp = add( sub( 31, exp ), sub( q_tmp, 62 ) ); @@ -5466,7 +5977,7 @@ static void chol2x2_fx( temp = BASOP_Util_Divide3232_Scale_cadence( temp, e2, &exp ); q_tmp = add( sub( 31, exp ), sub( q_tmp, q_e ) ); } - IF( EQ_32( temp, 0 ) ) + if ( temp == 0 ) { q_tmp = Q31; move16(); @@ -5489,6 +6000,7 @@ static void chol2x2_fx( q_re3 = sub( 31, exp ); *q_out = s_min( s_min( q_re1, q_re2 ), s_min( q_re3, q_im ) ); + move16(); outRe[1][1] = L_shr( outRe[1][1], sub( q_re1, *q_out ) ); move32(); outRe[0][1] = L_shr( outRe[0][1], sub( q_re2, *q_out ) ); @@ -5747,10 +6259,10 @@ static void formulate2x2MixingMatrix_fx( Word32 temp; Word16 q_Pre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], q_Pim[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; Word16 hdrm_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS], hdrm_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; - set_s( hdrm_re[0], 63, i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ) ); - set_s( hdrm_im[0], 63, i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ) ); - set_s( q_Pre[0], Q31, i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ) ); - set_s( q_Pim[0], Q31, i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ) ); + set16_fx( hdrm_re[0], 63, i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ) ); + set16_fx( hdrm_im[0], 63, i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ) ); + set16_fx( q_Pre[0], Q31, i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ) ); + set16_fx( q_Pim[0], Q31, i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ) ); q_ky = 0; move16(); @@ -5799,7 +6311,7 @@ static void formulate2x2MixingMatrix_fx( } // 4611686 = Q62 - IF( EQ_32( maxEne_fx, 0 ) ) + IF( maxEne_fx == 0 ) { maxEneDiv_fx = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, 4611686, &exp ); // 4611686 = 1e-12f in Q62 q_maxEneDiv = add( sub( 31, exp ), sub( Q30, 62 ) ); @@ -5853,12 +6365,14 @@ static void formulate2x2MixingMatrix_fx( /* Regularize the diagonal Sx for matrix inversion */ Sx_fx[0] = L_max( L_shr( Sx_fx[0], 1 ), Mpy_32_16_1( Sx_fx[1], regularizationFactor_fx ) ); Sx_fx[1] = L_max( L_shr( Sx_fx[1], 1 ), L_shl( Mpy_32_16_1( Sx_fx[0], regularizationFactor_fx ), 1 ) ); + move32(); + move32(); q_Sx = sub( add( q_Sx, Q14 ), 15 ); temp = Mpy_32_32( E_in2, 2147484 ); // 2147484 = 0.001f in Q31 temp = L_max( temp, E_in1 ); - IF( EQ_32( temp, 0 ) ) + IF( temp == 0 ) { BASOP_Util_Divide3232_Scale_cadence( E_out1, 4611686, &exp ); // 4611686 = Q62 exp = sub( exp, sub( q_eout, 62 ) ); @@ -5875,7 +6389,7 @@ static void formulate2x2MixingMatrix_fx( temp = Mpy_32_32( E_in1, 2147484 ); // 2147484 = 0.001f in Q31 temp = L_max( temp, E_in2 ); - IF( EQ_32( temp, 0 ) ) + IF( temp == 0 ) { BASOP_Util_Divide3232_Scale_cadence( E_out2, 4611686, &exp1 ); // 4611686 = Q62 exp1 = sub( exp1, sub( q_eout, 62 ) ); @@ -5902,6 +6416,8 @@ static void formulate2x2MixingMatrix_fx( { GhatQ_fx[chA][0] = Mpy_32_32( Q_fx[chA][0], Ghat_fx[chA] ); GhatQ_fx[chA][1] = Mpy_32_32( Q_fx[chA][1], Ghat_fx[chA] ); + move32(); + move32(); } q_GhatQ = sub( add( Q31, q_Ghat ), 31 ); @@ -5916,6 +6432,8 @@ static void formulate2x2MixingMatrix_fx( { tmpRe_fx[chA][chB] = Madd_32_32( Mpy_32_32( KyRe_fx[0][chA], GhatQ_fx[0][chB] ), KyRe_fx[1][chA], GhatQ_fx[1][chB] ); tmpIm_fx[chA][chB] = Msub_32_32( Mpy_32_32( -KyIm_fx[0][chA], GhatQ_fx[0][chB] ), KyIm_fx[1][chA], GhatQ_fx[1][chB] ); + move32(); + move32(); } } @@ -5930,7 +6448,7 @@ static void formulate2x2MixingMatrix_fx( eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D ); - IF( EQ_32( D_fx[0], 0 ) ) + IF( D_fx[0] == 0 ) { temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, 4611686, &exp ); // 4611686 = 1e-12 in Q62 exp = sub( exp, sub( Q30, 62 ) ); @@ -5943,7 +6461,7 @@ static void formulate2x2MixingMatrix_fx( div_fx[0] = Sqrt32( temp, &exp ); move32(); - IF( EQ_32( D_fx[1], 0 ) ) + IF( D_fx[1] == 0 ) { temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, 4611686, &exp1 ); // 4611686 = 1e-12 in Q62 exp1 = sub( exp1, sub( Q30, 62 ) ); @@ -5994,13 +6512,15 @@ static void formulate2x2MixingMatrix_fx( Word64 W_tmp; W_tmp = W_mult0_32_32( tmpRe_fx[chA][chB], div_fx[chB] ); - IF( NE_64( W_tmp, 0 ) ) + IF( W_tmp != 0 ) { hdrm_re[chA][chB] = sub( W_norm( W_tmp ), 0 ); + move16(); W_tmp = W_shl( W_tmp, hdrm_re[chA][chB] ); tmpRe_fx[chA][chB] = W_extract_h( W_tmp ); move32(); hdrm_re[chA][chB] = sub( add( add( q_temp, q_div ), hdrm_re[chA][chB] ), 32 ); + move16(); } ELSE { @@ -6009,13 +6529,15 @@ static void formulate2x2MixingMatrix_fx( } W_tmp = W_mult0_32_32( tmpIm_fx[chA][chB], div_fx[chB] ); - IF( NE_64( W_tmp, 0 ) ) + IF( W_tmp != 0 ) { hdrm_im[chA][chB] = sub( W_norm( W_tmp ), 0 ); + move16(); W_tmp = W_shl( W_tmp, hdrm_im[chA][chB] ); tmpIm_fx[chA][chB] = W_extract_h( W_tmp ); move32(); hdrm_im[chA][chB] = sub( add( add( q_temp, q_div ), hdrm_im[chA][chB] ), 32 ); + move16(); } ELSE { @@ -6027,6 +6549,7 @@ static void formulate2x2MixingMatrix_fx( minimum_s( hdrm_re[0], i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ), &exp ); q_temp = exp; + move16(); minimum_s( hdrm_im[0], i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ), &exp ); q_temp = s_min( q_temp, exp ); @@ -6036,6 +6559,8 @@ static void formulate2x2MixingMatrix_fx( { tmpRe_fx[chA][chB] = L_shr( tmpRe_fx[chA][chB], sub( hdrm_re[chA][chB], q_temp ) ); tmpIm_fx[chA][chB] = L_shr( tmpIm_fx[chA][chB], sub( hdrm_im[chA][chB], q_temp ) ); + move32(); + move32(); } } @@ -6046,7 +6571,7 @@ static void formulate2x2MixingMatrix_fx( { FOR( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) { - IF( EQ_32( Sx_fx[chB], 0 ) ) + IF( Sx_fx[chB] == 0 ) { Pre_fx[chA][chB] = BASOP_Util_Divide3232_Scale_cadence( Pre_fx[chA][chB], 4611686, &exp ); // 4611686 = 1e-12 in Q62 q_Pre[chA][chB] = add( sub( q_P, 62 ), sub( 31, exp ) ); @@ -6062,6 +6587,10 @@ static void formulate2x2MixingMatrix_fx( Pim_fx[chA][chB] = BASOP_Util_Divide3232_Scale_cadence( Pim_fx[chA][chB], temp, &exp ); q_Pim[chA][chB] = add( sub( q_P, sub( 31, exp_temp ) ), sub( 31, exp ) ); } + move32(); + move32(); + move16(); + move16(); } } minimum_s( q_Pre[0], i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ), &exp ); @@ -6075,6 +6604,8 @@ static void formulate2x2MixingMatrix_fx( { Pre_fx[chA][chB] = L_shr( Pre_fx[chA][chB], sub( q_Pre[chA][chB], q_P ) ); Pim_fx[chA][chB] = L_shr( Pim_fx[chA][chB], sub( q_Pim[chA][chB], q_P ) ); + move32(); + move32(); } } @@ -6105,6 +6636,7 @@ static void getDirectPartGains_fx( Word32 y, mappedX; Word16 aziRadMapped, A, A2, A3; const Word16 LsAngleRad = 17157; // Q15 + move16(); Word32 *ptr_sin, *ptr_cos; Word32 sin_val, cos_val; Word16 e_mappedX; @@ -6127,6 +6659,7 @@ static void getDirectPartGains_fx( { cos_val = ptr_cos[abs_s( eleDeg )]; // Q31 } + move32(); IF( GT_16( aziDeg, 180 ) ) { @@ -6142,9 +6675,11 @@ static void getDirectPartGains_fx( { sin_val = ptr_sin[aziDeg]; // Q31 } + move32(); y = Mpy_32_32( sin_val, cos_val ); // Q31 e_mappedX = 0; + move16(); mappedX = Sqrt32( L_max( 0, L_sub( ONE_IN_Q31, Mpy_32_32( y, y ) ) ), &e_mappedX ); aziRadMapped = BASOP_util_atan2( y, mappedX, negate( e_mappedX ) ); // Q13 @@ -6152,46 +6687,60 @@ static void getDirectPartGains_fx( /* Determine the real valued amplitude panning gains */ *lImagp = 0; *rImagp = 0; + move32(); + move32(); IF( GE_16( aziRadMapped, shr( LsAngleRad, 2 ) ) ) { /* Left side */ *lRealp = ONE_IN_Q31; *rRealp = 0; + move32(); + move32(); } ELSE IF( LE_16( aziRadMapped, negate( shr( LsAngleRad, 2 ) ) ) ) { /* Right side */ *lRealp = 0; *rRealp = ONE_IN_Q31; + move32(); + move32(); } ELSE /* Tangent panning law */ { Word16 e_div, div, e_a, e_a3, temp_16_1, temp_16_2, e_num, e_den; div = BASOP_Util_Divide3232_Scale( y, mappedX, &e_div ); - e_div = e_div - e_mappedX; + e_div = sub( e_div, e_mappedX ); A = mult( div, INV_TAN30_FX ); - e_a = e_div + 1; + e_a = add( e_div, 1 ); e_num = BASOP_Util_Add_MantExp( A, e_a, -32767, 0, &temp_16_1 ); e_den = BASOP_Util_Add_MantExp( A, e_a, 32767, 0, &temp_16_2 ); - IF( LE_16( temp_16_2, 0 ) ) + IF( temp_16_2 <= 0 ) { temp_16_2 = 32; e_den = 0; + move16(); + move16(); } A2 = BASOP_Util_Divide1616_Scale( temp_16_1, temp_16_2, &e_div ); - e_div = e_div + sub( e_num, e_den ); + e_div = add( e_div, sub( e_num, e_den ) ); e_den = BASOP_Util_Add_MantExp( mult( A2, A2 ), add( e_div, e_div ), 32767, 0, &temp_16_2 ); A3 = BASOP_Util_Divide1616_Scale( 32767, temp_16_2, &e_a3 ); - e_a3 = e_a3 - e_den; + e_a3 = sub( e_a3, e_den ); // A3 = 1.0f / ( A2 * A2 + 1.0f ); // Q15 Word32 temp_32 = L_shr( L_deposit_h( A3 ), sub( 0, e_a3 ) ); Word16 temp_e = 0; e_a3 = 0; + move16(); + move16(); *lRealp = Sqrt32( temp_32, &e_a3 ); *rRealp = Sqrt32( L_sub( ONE_IN_Q31, temp_32 ), &temp_e ); *lRealp = L_shr( *lRealp, sub( 0, e_a3 ) ); // Q31 *rRealp = L_shr( *rRealp, sub( 0, temp_e ) ); // Q31 + move32(); + move32(); + move32(); + move32(); } /* Scaling to have the same expected gain as for the HRTF rendering */ @@ -6200,9 +6749,14 @@ static void getDirectPartGains_fx( *lRealp = L_shr( *lRealp, 2 ); // Q28 *rRealp = L_shr( *rRealp, 2 ); // Q28 + move32(); + move32(); + move32(); + move32(); } ELSE /* In regular binaural rendering mode */ { + test(); IF( EQ_16( aziDeg, gainCache->azi ) && EQ_16( eleDeg, gainCache->ele ) ) { hrtfShGetHrtf_fx( bin, aziDeg, eleDeg, lRealp, lImagp, rRealp, rImagp, gainCache, TRUE ); @@ -6211,6 +6765,8 @@ static void getDirectPartGains_fx( { gainCache->azi = aziDeg; gainCache->ele = eleDeg; + move16(); + move16(); IF( isHeadtracked ) { // Word32 aziDeg_32, eleDeg_32; @@ -6318,6 +6874,10 @@ static void hrtfShGetHrtf_fx( *lImagp = 0; *rRealp = 0; *rImagp = 0; + move32(); + move32(); + move32(); + move32(); IF( useCachedValue ) { @@ -6331,6 +6891,10 @@ static void hrtfShGetHrtf_fx( *lImagp = L_add( *lImagp, Mpy_32_16_1( shVec[k], hrtfShCoeffsIm_fx[0][k][bin] ) ); // Q28 *rRealp = L_add( *rRealp, L_shr( Mpy_32_16_1( shVec[k], hrtfShCoeffsRe_fx[1][k][bin] ), 1 ) ); // Q28 *rImagp = L_add( *rImagp, Mpy_32_16_1( shVec[k], hrtfShCoeffsIm_fx[1][k][bin] ) ); // Q28 + move32(); + move32(); + move32(); + move32(); } } ELSE @@ -6353,6 +6917,11 @@ static void hrtfShGetHrtf_fx( *rImagp = L_add( *rImagp, Mpy_32_16_1( shVec[k], hrtfShCoeffsIm_fx[1][k][bin] ) ); // Q28 gainCache->shVec_fx[k] = shVec[k]; // Q29 + move32(); + move32(); + move32(); + move32(); + move32(); } } @@ -6583,7 +7152,9 @@ void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( hSpatParamRendCom = st_ivas->hSpatParamRendCom; hMasaIsmData = st_ivas->hMasaIsmData; - IF( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_FOA || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) + test(); + test(); + IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) || EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) { enableCentering = 0; move16(); @@ -6595,17 +7166,17 @@ void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( } /* Bypass processing until first object is moved */ - IF( EQ_16( hMasaIsmData->objectsMoved, 0 ) ) + IF( hMasaIsmData->objectsMoved == 0 ) { FOR( ismDirIndex = 0; ismDirIndex < hSpatParamRendCom->numIsmDirections; ismDirIndex++ ) { - IF( hMasaIsmData->ism_is_edited[ismDirIndex] ) + if ( hMasaIsmData->ism_is_edited[ismDirIndex] ) { hMasaIsmData->objectsMoved = 1; move16(); } } - IF( EQ_16( hMasaIsmData->objectsMoved, 0 ) ) + IF( hMasaIsmData->objectsMoved == 0 ) { /* No objects have moved so far */ return; @@ -6633,21 +7204,21 @@ void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( Word16 eneMove_q_fx[2], enePreserve_q_fx[2], temp1; Word32 temp; - set_s( ismPreprocMtxNew_fx[0], 0, 2 ); - set_s( ismPreprocMtxNew_fx[1], 0, 2 ); - set_s( ismPreprocMtxIncrement_fx[0], 0, 2 ); - set_s( ismPreprocMtxIncrement_fx[1], 0, 2 ); - set_s( eneMove_fx, 0, 2 ); - set_s( enePreserve_fx, 0, 2 ); + set16_fx( ismPreprocMtxNew_fx[0], 0, 2 ); + set16_fx( ismPreprocMtxNew_fx[1], 0, 2 ); + set16_fx( ismPreprocMtxIncrement_fx[0], 0, 2 ); + set16_fx( ismPreprocMtxIncrement_fx[1], 0, 2 ); + set16_fx( eneMove_fx, 0, 2 ); + set16_fx( enePreserve_fx, 0, 2 ); ismRatioAcc_fx = 0; move16(); subframeEne_fx = 0; move32(); - set_s( normEnes_fx, 0, 2 ); - set_l( Enes_fx, 0, 2 ); - set_s( normEnes_q_fx, Q31, 2 ); - set_s( eneMove_q_fx, Q31, 2 ); - set_s( enePreserve_q_fx, Q31, 2 ); + set16_fx( normEnes_fx, 0, 2 ); + set32_fx( Enes_fx, 0, 2 ); + set16_fx( normEnes_q_fx, Q31, 2 ); + set16_fx( eneMove_q_fx, Q31, 2 ); + set16_fx( enePreserve_q_fx, Q31, 2 ); /* Determine transport normalized energies and subframe energy */ FOR( slot = 0; slot < nSlots; slot++ ) @@ -6662,7 +7233,7 @@ void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( subframeEne_fx = L_add( Enes_fx[0], Enes_fx[1] ); - IF( NE_32( subframeEne_fx, 0 ) ) + IF( subframeEne_fx != 0 ) { normEnes_fx[0] = BASOP_Util_Divide3232_Scale( Enes_fx[0], subframeEne_fx, &temp_q ); move32(); @@ -6699,7 +7270,6 @@ void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( ratio = extract_l( hMasaIsmData->energy_ratio_ism_fx[ismDirIndex][dirac_read_idx][bin] ); // Q14 ismRatioAcc_fx = add( ismRatioAcc_fx, ratio ); - move16(); /* Get input and output panning gains */ ivas_get_stereo_panning_gains_fx( hMasaIsmData->azimuth_ism[ismDirIndex][dirac_read_idx], @@ -6763,7 +7333,7 @@ void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( } /* Any remaining (non-object) energy is set to be preserved at both channels */ - remainderNormEne_fx = s_max( 0, sub( sub( shr( sub( ONE_IN_Q14, ismRatioAcc_fx ), sub( Q14, Q12 ) ), normEnes_fx[0] ), normEnes_fx[1] ) ); // Q12 + remainderNormEne_fx = s_max( 0, sub( sub( shr( sub( ONE_IN_Q14, ismRatioAcc_fx ), Q14 - Q12 ), normEnes_fx[0] ), normEnes_fx[1] ) ); // Q12 FOR( ch = 0; ch < 2; ch++ ) { @@ -6788,7 +7358,7 @@ void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( move32(); normVal_fx = L_add( hMasaIsmData->eneMoveIIR_fx[ch][bin], hMasaIsmData->enePreserveIIR_fx[ch][bin] ); - IF( NE_32( normVal_fx, 0 ) ) + IF( normVal_fx != 0 ) { temp1 = BASOP_Util_Divide3232_Scale( hMasaIsmData->enePreserveIIR_fx[ch][bin], normVal_fx, &temp_q ); @@ -6827,6 +7397,8 @@ void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( { Word16 eqVal_fx = 0; Word16 eqVal_q_fx = 0; + move16(); + move16(); Word32 outSlotRe_fx[2]; Word32 outSlotIm_fx[2]; @@ -6860,7 +7432,8 @@ void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( } temp1 = BASOP_Util_Divide3232_Scale( hMasaIsmData->preprocEneTarget_fx[bin], L_max( EPSILON_FX, hMasaIsmData->preprocEneRealized_fx[bin] ), &eqVal_q_fx ); eqVal_fx = Sqrt16( temp1, &eqVal_q_fx ); - temp1 = shl( 4, Q12 ); + temp1 = 4 << Q12; + move16(); IF( LT_16( eqVal_q_fx, Q12 ) ) { IF( GT_16( eqVal_fx, shr( temp1, sub( Q12, eqVal_q_fx ) ) ) ) @@ -6873,7 +7446,7 @@ void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( } ELSE { - IF( GT_16( shr( eqVal_fx, sub( eqVal_q_fx, Q12 ) ), temp1 ) ) + if ( GT_16( shr( eqVal_fx, sub( eqVal_q_fx, Q12 ) ), temp1 ) ) { eqVal_fx = temp1; move16(); @@ -6888,6 +7461,7 @@ void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( move32(); } *cldfb_buf_q = sub( add( *cldfb_buf_q, eqVal_q_fx ), 15 ); + move16(); } } @@ -7281,7 +7855,9 @@ static void ivas_masa_ext_rend_parambin_internal( config_data.separateCenterChannelRendering = 0; move16(); config_data.ivas_format = MASA_FORMAT; + move32(); config_data.mc_mode = MC_MODE_NONE; + move32(); config_data.ivas_total_brate = IVAS_512k; /* Maximum bitrate set for external renderer */ move32(); config_data.nchan_transport = hMasaExtRend->nchan_input; @@ -7291,6 +7867,7 @@ static void ivas_masa_ext_rend_parambin_internal( config_data.processReverb = hMasaExtRend->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ? 1 : 0; move16(); config_data.ism_mode = ISM_MODE_NONE; + move32(); /* Set nchan_transport to number of transport channels in MASA input */ nchan_transport = hMasaExtRend->nchan_input; @@ -7328,7 +7905,8 @@ static void ivas_masa_ext_rend_parambin_internal( { FOR( ch = 0; ch < numInChannels; ch++ ) { - IF( EQ_16( ch, 0 ) || EQ_16( nchan_transport, 2 ) ) + test(); + IF( ch == 0 || EQ_16( nchan_transport, 2 ) ) { cldfbAnalysis_ts_fx_fixed_q( &( output_fx[ch][nBins * slot] ), @@ -7356,6 +7934,7 @@ static void ivas_masa_ext_rend_parambin_internal( FOR( j = 0; j < 3; j++ ) { Rmat_fx[i][j] = hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx][i][j]; // Q30// + move32(); } } @@ -7367,6 +7946,7 @@ static void ivas_masa_ext_rend_parambin_internal( } Word16 shift = 31; + move16(); Word32 Cldfb_RealBuffer_inTmp_fx[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Cldfb_ImagBuffer_inTmp_fx[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; FOR( i = 0; i < 2; i++ ) { @@ -7377,7 +7957,7 @@ static void ivas_masa_ext_rend_parambin_internal( } } - Word16 q = q_inp + shift; + Word16 q = add( q_inp, shift ); FOR( i = 0; i < 2; i++ ) { @@ -7387,6 +7967,8 @@ static void ivas_masa_ext_rend_parambin_internal( { Cldfb_RealBuffer_inTmp_fx[i][j][k] = L_shl( Cldfb_RealBuffer_in_fx[i][j][k], shift ); Cldfb_ImagBuffer_inTmp_fx[i][j][k] = L_shl( Cldfb_ImagBuffer_in_fx[i][j][k], shift ); + move32(); + move32(); } } } @@ -7404,6 +7986,7 @@ static void ivas_masa_ext_rend_parambin_internal( #if 1 Word16 q_out; q_inp = Q6; + move16(); FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { output_fx[ch] = output_fx_buff[ch]; @@ -7411,10 +7994,12 @@ static void ivas_masa_ext_rend_parambin_internal( FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { hMasaExtRend->cldfbSynRend[ch]->Q_cldfb_state = Q11; + move16(); } #endif // Float to fix ends q_mat = hDiracDecBin->q_processMtx; + move16(); q_mat = s_min( q_mat, hDiracDecBin->q_processMtxPrev ); q_mat = s_min( q_mat, hDiracDecBin->q_processMtxDec ); q_mat = s_min( q_mat, hDiracDecBin->q_processMtxDecPrev ); @@ -7443,6 +8028,10 @@ static void ivas_masa_ext_rend_parambin_internal( hDiracDecBin->q_processMtxPrev = q_mat; hDiracDecBin->q_processMtxDec = q_mat; hDiracDecBin->q_processMtxDecPrev = q_mat; + move16(); + move16(); + move16(); + move16(); ivas_dirac_dec_binaural_process_output_fx( hDiracDecBin, hSpatParamRendCom, hMasaExtRend->cldfbSynRend, output_fx, &q_out, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, q_inp, max_band_decorr, numInChannels, config_data.processReverb, subframe, q_mat ); @@ -7451,6 +8040,8 @@ static void ivas_masa_ext_rend_parambin_internal( hSpatParamRendCom->slots_rendered = add( hSpatParamRendCom->slots_rendered, hSpatParamRendCom->subframe_nbslots[subframe] ); hSpatParamRendCom->subframes_rendered = add( hSpatParamRendCom->subframes_rendered, 1 ); + move16(); + move16(); #if 1 // Fix to float FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) diff --git a/lib_rend/ivas_dirac_decorr_dec.c b/lib_rend/ivas_dirac_decorr_dec.c index 2e952223de0b973609043aabed083e58079d7045..de0253bb51f2cadfc24fe48c2b572380d34a5cd3 100644 --- a/lib_rend/ivas_dirac_decorr_dec.c +++ b/lib_rend/ivas_dirac_decorr_dec.c @@ -338,11 +338,12 @@ ivas_error ivas_dirac_dec_decorr_open_fx( const Word32 output_Fs /* i : output sampling rate */ ) { - int16_t k, l, m, n; - int16_t split_band_index_start; - int16_t k_in, k_out, num_bands, band_table_idx, buffer_size_decorr; - int16_t split_frequencies_bands[DIRAC_DECORR_NUM_SPLIT_BANDS + 1] = { 0, 0, 0, 23768 }; - int16_t *split_freq_ptr; + Word16 k, l, m, n; + Word16 split_band_index_start; + Word16 k_in, k_out, num_bands, band_table_idx, buffer_size_decorr; + Word16 split_frequencies_bands[DIRAC_DECORR_NUM_SPLIT_BANDS + 1] = { 0, 0, 0, 23768 }; + move16(); + Word16 *split_freq_ptr; Word16 cur_lattice_delta_phi_fx, lattice_coeffs_fx[2 * DIRAC_MAX_DECORR_FILTER_LEN]; ivas_error error; @@ -373,7 +374,7 @@ ivas_error ivas_dirac_dec_decorr_open_fx( assert( ( num_freq_bands > 0 ) && "Error: Number of frequency bands <= 0!" ); - IF( EQ_16( synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) + if ( EQ_16( synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { num_outputs_diff = sub( num_outputs_diff, nchan_transport ); } @@ -394,7 +395,7 @@ ivas_error ivas_dirac_dec_decorr_open_fx( } ELSE { - freq_domain_decorr_ap_params->max_frequency = ( min( num_freq_bands, DIRAC_MAX_DECORR_CLDFB_BANDS_AMBI ) * 24000 ) / CLDFB_NO_CHANNELS_MAX; + freq_domain_decorr_ap_params->max_frequency = imult1616( s_min( num_freq_bands, DIRAC_MAX_DECORR_CLDFB_BANDS_AMBI ), 400 ); /*24000 / 60=400*/ } } ELSE IF( EQ_16( synthesisConf, DIRAC_SYNTHESIS_COV_MC_LS ) ) @@ -409,8 +410,11 @@ ivas_error ivas_dirac_dec_decorr_open_fx( freq_domain_decorr_ap_params->add_back_onsets_on = 1; freq_domain_decorr_ap_params->max_frequency = ( DIRAC_MAX_DECORR_CLDFB_BANDS * 24000 ) / CLDFB_NO_CHANNELS_MAX; } + move16(); + move16(); freq_domain_decorr_ap_params->use_ducker = 1; + move16(); assert( ( freq_domain_decorr_ap_params->max_frequency >= 0 ) && ( freq_domain_decorr_ap_params->max_frequency <= output_Fs / 2 ) && "Error: max_frequency invalid!" ); @@ -419,8 +423,9 @@ ivas_error ivas_dirac_dec_decorr_open_fx( FOR( k = num_freq_bands - 1; k > 0; --k ) { freq_domain_decorr_ap_params->max_band_decorr = add( k, 1 ); /* outside "if" to avoid uninitialized variable */ + move16(); - IF( frequency_axis[k] < freq_domain_decorr_ap_params->max_frequency ) + IF( LT_16( frequency_axis[k], freq_domain_decorr_ap_params->max_frequency ) ) { BREAK; } @@ -431,7 +436,7 @@ ivas_error ivas_dirac_dec_decorr_open_fx( *-----------------------------------------------------------------*/ /* open onset detection module */ - IF( synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + IF( EQ_32( synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { /*Onset detector up to Nyquist and not only up to max_band_decorr*/ IF( ( error = ivas_dirac_dec_onset_detection_open_fx( num_protos_diff, num_freq_bands, num_freq_bands, &freq_domain_decorr_ap_params->h_onset_detection_power_params, &freq_domain_decorr_ap_state->h_onset_detection_power_state ) ) != IVAS_ERR_OK ) @@ -454,24 +459,32 @@ ivas_error ivas_dirac_dec_decorr_open_fx( /* calculate decorrelation split bands */ split_freq_ptr = &split_frequencies_bands[0]; split_freq_ptr[0] = 0; + move16(); Word16 temp = 0; + move16(); FOR( k = 1; k < DIRAC_DECORR_NUM_SPLIT_BANDS; k++ ) { temp = mult( CLDFB_NO_CHANNELS_MAX_FX, ap_split_frequencies_fx[k] ); // Q8 - temp = add( temp, (Word16) floatToFixed( 0.5, Q8 ) ); + temp = add( temp, ONE_IN_Q7 /*0.5 Q8*/ ); split_freq_ptr[k] = sub( temp, ONE_IN_Q8 ); + move16(); } split_band_index_start = 0; + move16(); split_frequencies_bands[k] = 0; + move16(); freq_domain_decorr_ap_params->num_split_frequency_bands = 0; + move16(); FOR( k = 1; k < DIRAC_DECORR_NUM_SPLIT_BANDS + 1; k++ ) { - freq_domain_decorr_ap_params->num_split_frequency_bands++; + freq_domain_decorr_ap_params->num_split_frequency_bands = add( freq_domain_decorr_ap_params->num_split_frequency_bands, 1 ); + move16(); IF( GE_16( split_frequencies_bands[k], shl( freq_domain_decorr_ap_params->max_band_decorr, Q8 ) ) ) { split_frequencies_bands[k] = shl( freq_domain_decorr_ap_params->max_band_decorr, Q8 ); + move16(); break; } } @@ -480,6 +493,7 @@ ivas_error ivas_dirac_dec_decorr_open_fx( FOR( k = 1; k < DIRAC_DECORR_NUM_SPLIT_BANDS; k++ ) { split_frequencies_bands[k] = shr( split_frequencies_bands[k], Q8 ); + move16(); } IF( ( freq_domain_decorr_ap_params->split_frequency_bands = (Word16 *) malloc( sizeof( Word16 ) * ( add( freq_domain_decorr_ap_params->num_split_frequency_bands, 1 ) ) ) ) == NULL ) @@ -503,41 +517,42 @@ ivas_error ivas_dirac_dec_decorr_open_fx( IF( num_outputs_diff > 0 ) { - buffer_size_decorr = ( ap_pre_delay[split_band_index_start] + ap_filter_length[split_band_index_start] ); - IF( ( freq_domain_decorr_ap_state->decorr_buffer_fx = (Word32 *) malloc( sizeof( Word32 ) * 2 * buffer_size_decorr * num_outputs_diff * freq_domain_decorr_ap_params->max_band_decorr ) ) == NULL ) + buffer_size_decorr = add( ap_pre_delay[split_band_index_start], ap_filter_length[split_band_index_start] ); + IF( ( freq_domain_decorr_ap_state->decorr_buffer_fx = (Word32 *) malloc( sizeof( Word32 ) * shl( imult1616( buffer_size_decorr, imult1616( num_outputs_diff, freq_domain_decorr_ap_params->max_band_decorr ) ), 1 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); } - freq_domain_decorr_ap_state->decorr_buffer_len = 2 * buffer_size_decorr * num_outputs_diff * freq_domain_decorr_ap_params->max_band_decorr; - set32_fx( freq_domain_decorr_ap_state->decorr_buffer_fx, 0, 2 * buffer_size_decorr * num_outputs_diff * freq_domain_decorr_ap_params->max_band_decorr ); + freq_domain_decorr_ap_state->decorr_buffer_len = imult1616( 2, imult1616( buffer_size_decorr, imult1616( num_outputs_diff, freq_domain_decorr_ap_params->max_band_decorr ) ) ); + set32_fx( freq_domain_decorr_ap_state->decorr_buffer_fx, 0, imult1616( 2, imult1616( buffer_size_decorr, imult1616( num_outputs_diff, freq_domain_decorr_ap_params->max_band_decorr ) ) ) ); freq_domain_decorr_ap_state->q_decorr_buffer = Q31; + move16(); - IF( ( freq_domain_decorr_ap_params->filter_coeff_num_real_fx = (Word16 *) malloc( sizeof( Word16 ) * ( ap_filter_length[split_band_index_start] + 1 ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) + IF( ( freq_domain_decorr_ap_params->filter_coeff_num_real_fx = (Word16 *) malloc( sizeof( Word16 ) * imult1616( add( ap_filter_length[split_band_index_start], 1 ), imult1616( freq_domain_decorr_ap_params->max_band_decorr, num_outputs_diff ) ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); } - IF( ( freq_domain_decorr_ap_params->filter_coeff_den_real_fx = (Word16 *) malloc( sizeof( Word16 ) * ( ap_filter_length[split_band_index_start] + 1 ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) + IF( ( freq_domain_decorr_ap_params->filter_coeff_den_real_fx = (Word16 *) malloc( sizeof( Word16 ) * imult1616( add( ap_filter_length[split_band_index_start], 1 ), imult1616( freq_domain_decorr_ap_params->max_band_decorr, num_outputs_diff ) ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); } - IF( ( freq_domain_decorr_ap_params->phase_coeff_real_fx = (Word16 *) malloc( sizeof( Word16 ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) + IF( ( freq_domain_decorr_ap_params->phase_coeff_real_fx = (Word16 *) malloc( sizeof( Word16 ) * imult1616( freq_domain_decorr_ap_params->max_band_decorr, num_outputs_diff ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); } - IF( ( freq_domain_decorr_ap_params->phase_coeff_imag_fx = (Word16 *) malloc( sizeof( Word16 ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) + IF( ( freq_domain_decorr_ap_params->phase_coeff_imag_fx = (Word16 *) malloc( sizeof( Word16 ) * imult1616( freq_domain_decorr_ap_params->max_band_decorr, num_outputs_diff ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); } - IF( ( freq_domain_decorr_ap_state->direct_energy_smooth_fx = (Word32 *) malloc( sizeof( Word32 ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) + IF( ( freq_domain_decorr_ap_state->direct_energy_smooth_fx = (Word32 *) malloc( sizeof( Word32 ) * imult1616( freq_domain_decorr_ap_params->max_band_decorr, num_outputs_diff ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); } - IF( ( freq_domain_decorr_ap_state->reverb_energy_smooth_fx = (Word32 *) malloc( sizeof( Word32 ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) + IF( ( freq_domain_decorr_ap_state->reverb_energy_smooth_fx = (Word32 *) malloc( sizeof( Word32 ) * imult1616( freq_domain_decorr_ap_params->max_band_decorr, num_outputs_diff ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); } @@ -551,9 +566,11 @@ ivas_error ivas_dirac_dec_decorr_open_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); } - set32_fx( freq_domain_decorr_ap_state->direct_energy_smooth_fx, 0, freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ); - set32_fx( freq_domain_decorr_ap_state->reverb_energy_smooth_fx, 0, freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ); + set32_fx( freq_domain_decorr_ap_state->direct_energy_smooth_fx, 0, imult1616( freq_domain_decorr_ap_params->max_band_decorr, num_outputs_diff ) ); + set32_fx( freq_domain_decorr_ap_state->reverb_energy_smooth_fx, 0, imult1616( freq_domain_decorr_ap_params->max_band_decorr, num_outputs_diff ) ); freq_domain_decorr_ap_state->q_direct_energy_smooth = freq_domain_decorr_ap_state->q_reverb_energy_smooth = Q31; + move16(); + move16(); /* compute filter coefficients */ FOR( k = 0; k < freq_domain_decorr_ap_params->num_split_frequency_bands; k++ ) @@ -564,20 +581,22 @@ ivas_error ivas_dirac_dec_decorr_open_fx( band_table_idx = add( k, split_band_index_start ); freq_domain_decorr_ap_params->filter_length[k] = add( ap_filter_length[band_table_idx], 1 ); freq_domain_decorr_ap_params->pre_delay[k] = ap_pre_delay[band_table_idx]; + move16(); + move16(); FOR( l = 0; l < num_outputs_diff; l++ ) { FOR( m = 0; m < num_bands; m++ ) { n = add( k_in, m ); - Word32 cur_lattice_delta_phi_32_fx = L_mult( ap_lattice_delta_phi_fx[l * DIRAC_MAX_DECORR_FILTER_LEN + ap_filter_length[k] - 1], (Word16) floatToFixed( n, 10 ) ); + Word32 cur_lattice_delta_phi_32_fx = L_mult( ap_lattice_delta_phi_fx[sub( add( imult1616( l, DIRAC_MAX_DECORR_FILTER_LEN ), ap_filter_length[k] ), 1 )], shl( n, 10 ) ); cur_lattice_delta_phi_fx = extract_h( cur_lattice_delta_phi_32_fx ); // Q10 - WHILE( GT_16( cur_lattice_delta_phi_fx, sub( ONE_IN_Q11, 1 ) ) ) + WHILE( GT_16( cur_lattice_delta_phi_fx, ONE_IN_Q11 - 1 ) ) { cur_lattice_delta_phi_fx = sub( cur_lattice_delta_phi_fx, 3217 ); } - WHILE( LT_16( cur_lattice_delta_phi_fx, negate( ONE_IN_Q11 ) ) ) + WHILE( LT_16( cur_lattice_delta_phi_fx, -ONE_IN_Q11 ) ) { cur_lattice_delta_phi_fx = add( cur_lattice_delta_phi_fx, 3217 ); } @@ -586,14 +605,16 @@ ivas_error ivas_dirac_dec_decorr_open_fx( Word16 temp_a = getCosWord16( cur_lattice_delta_phi_fx ); Word16 temp_b = negate( getCosWord16( sub( 12868 /*PI/2 in Q13*/, cur_lattice_delta_phi_fx ) ) ); - freq_domain_decorr_ap_params->phase_coeff_real_fx[l * freq_domain_decorr_ap_params->max_band_decorr + n] = temp_a; - freq_domain_decorr_ap_params->phase_coeff_imag_fx[l * freq_domain_decorr_ap_params->max_band_decorr + n] = temp_b; + freq_domain_decorr_ap_params->phase_coeff_real_fx[add( imult1616( l, freq_domain_decorr_ap_params->max_band_decorr ), n )] = temp_a; + freq_domain_decorr_ap_params->phase_coeff_imag_fx[add( imult1616( l, freq_domain_decorr_ap_params->max_band_decorr ), n )] = temp_b; + move16(); + move16(); /* calculate phase offset */ get_lattice_coeffs_fx( band_table_idx, l, lattice_coeffs_fx ); /* calcualte transfer function coefficients from the lattice coefficients */ - Word16 a = ( k_in + m ) * ( freq_domain_decorr_ap_params->filter_length[0] * num_outputs_diff ) + l * freq_domain_decorr_ap_params->filter_length[0]; + Word16 a = add( imult1616( add( k_in, m ), imult1616( freq_domain_decorr_ap_params->filter_length[0], num_outputs_diff ) ), imult1616( l, freq_domain_decorr_ap_params->filter_length[0] ) ); lattice2allpass_fx( freq_domain_decorr_ap_params->filter_length[k], lattice_coeffs_fx, &freq_domain_decorr_ap_params->filter_coeff_num_real_fx[a], &freq_domain_decorr_ap_params->filter_coeff_den_real_fx[a] ); } @@ -926,24 +947,26 @@ void ivas_dirac_dec_decorr_process_fx( Word16 max_band_decorr_temp = h_freq_domain_decorr_ap_params->h_onset_detection_power_params.max_band_decorr; Word16 q_shift, guarded_bits; Word32 max_abs_val = 0; - + move16(); + move32(); push_wmops( "dirac_decorr_process" ); /* check handles */ - IF( h_freq_domain_decorr_ap_params == NULL || h_freq_domain_decorr_ap_state == NULL ) + test(); + if ( h_freq_domain_decorr_ap_params == NULL || h_freq_domain_decorr_ap_state == NULL ) { return; } /* check input data */ - IF( input_frame_fx == NULL ) + if ( input_frame_fx == NULL ) { return; } /* check result arrays */ - IF( frame_dec_fx == NULL ) + if ( frame_dec_fx == NULL ) { return; } @@ -957,7 +980,7 @@ void ivas_dirac_dec_decorr_process_fx( * collect some often used parameters *-----------------------------------------------------------------*/ - IF( synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( EQ_32( synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { num_channels = sub( num_channels, nchan_transport ); } @@ -969,6 +992,7 @@ void ivas_dirac_dec_decorr_process_fx( /* compute power */ q_onset_dec = h_freq_domain_decorr_ap_state->h_onset_detection_power_state.q_onset_detector; + move16(); guarded_bits = find_guarded_bits_fx( 2 ); #if 0 FOR( ch_idx = 0; ch_idx < num_protos_dir; ch_idx++ ) @@ -985,61 +1009,68 @@ void ivas_dirac_dec_decorr_process_fx( } q_aux_buffer += q_shift; #else - (void) maximum_abs_32_fx( &input_frame_fx[0], 2 * num_protos_dir * num_freq_bands, &max_abs_val ); - q_shift = getScaleFactor32( &input_frame_fx[0], 2 * num_protos_dir * num_freq_bands ) - guarded_bits; - IF( LT_16( q_shift, sub( 0, guarded_bits ) ) && NE_32( max_abs_val, 0 ) ) + (void) maximum_abs_32_fx( &input_frame_fx[0], imult1616( 2, imult1616( num_protos_dir, num_freq_bands ) ), &max_abs_val ); + q_shift = sub( getScaleFactor32( &input_frame_fx[0], imult1616( 2, imult1616( num_protos_dir, num_freq_bands ) ) ), guarded_bits ); + test(); + IF( LT_16( q_shift, negate( guarded_bits ) ) && max_abs_val != 0 ) { q_shift = sub( 0, guarded_bits ); } - ELSE IF( EQ_32( max_abs_val, 0 ) ) + ELSE IF( max_abs_val == 0 ) { q_shift = 0; + move16(); } FOR( ch_idx = 0; ch_idx < num_protos_dir; ch_idx++ ) { - v_shr( &input_frame_fx[2 * ch_idx * num_freq_bands], negate( q_shift ), &aux_buffer_fx[2 * ch_idx * num_freq_bands], 2 * num_freq_bands ); + v_shr( &input_frame_fx[imult1616( 2, imult1616( ch_idx, num_freq_bands ) )], negate( q_shift ), &aux_buffer_fx[imult1616( 2, imult1616( ch_idx, num_freq_bands ) )], imult1616( 2, num_freq_bands ) ); } FOR( ch_idx = 0; ch_idx < num_protos_dir; ch_idx++ ) { - v_mult_fixed( &aux_buffer_fx[2 * ch_idx * num_freq_bands], &aux_buffer_fx[2 * ch_idx * num_freq_bands], &aux_buffer_fx[2 * ch_idx * max_band_decorr_temp], 2 * max_band_decorr_temp ); + v_mult_fixed( &aux_buffer_fx[imult1616( 2, imult1616( ch_idx, num_freq_bands ) )], &aux_buffer_fx[imult1616( 2, imult1616( ch_idx, num_freq_bands ) )], &aux_buffer_fx[imult1616( 2, imult1616( ch_idx, max_band_decorr_temp ) )], imult1616( 2, max_band_decorr_temp ) ); } - q_aux_buffer = q_input_frame + q_input_frame + q_shift + q_shift - 31; + q_aux_buffer = sub( add( add( add( q_input_frame, q_input_frame ), q_shift ), q_shift ), 31 ); #endif FOR( ch_idx = 0; ch_idx < num_protos_dir; ch_idx++ ) { - v_add_inc_fx( &aux_buffer_fx[2 * ch_idx * max_band_decorr_temp], 2, &aux_buffer_fx[2 * ch_idx * max_band_decorr_temp + 1], 2, &aux_buffer_fx[ch_idx * max_band_decorr_temp], 1, max_band_decorr_temp ); + v_add_inc_fx( &aux_buffer_fx[imult1616( 2, imult1616( ch_idx, max_band_decorr_temp ) )], 2, &aux_buffer_fx[add( imult1616( 2, imult1616( ch_idx, max_band_decorr_temp ) ), 1 )], 2, &aux_buffer_fx[imult1616( ch_idx, max_band_decorr_temp )], 1, max_band_decorr_temp ); } /* compute onset filter */ max_band_decorr = h_freq_domain_decorr_ap_params->max_band_decorr; - set32_fx( onset_filter_fx, ONE_IN_Q31, num_protos_diff * num_freq_bands ); + set32_fx( onset_filter_fx, ONE_IN_Q31, imult1616( num_protos_diff, num_freq_bands ) ); Word16 q_temp = s_min( q_onset_dec, q_aux_buffer ); IF( NE_16( q_temp, q_onset_dec ) ) { - FOR( Word16 i = 0; i < num_protos_diff * max_band_decorr_temp; i++ ) + FOR( Word16 i = 0; i < imult1616( num_protos_diff, max_band_decorr_temp ); i++ ) { - h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_2_fx[i] = L_shr( h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_2_fx[i], q_onset_dec - q_temp ); - h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_1_fx[i] = L_shr( h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_1_fx[i], q_onset_dec - q_temp ); + h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_2_fx[i] = L_shr( h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_2_fx[i], sub( q_onset_dec, q_temp ) ); + h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_1_fx[i] = L_shr( h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_1_fx[i], sub( q_onset_dec, q_temp ) ); + move32(); + move32(); } } IF( NE_16( q_temp, q_aux_buffer ) ) { - FOR( Word16 i = 0; i < 2 * num_protos_diff * max_band_decorr_temp; i++ ) + FOR( Word16 i = 0; i < shl( imult1616( num_protos_diff, max_band_decorr_temp ), 1 ); i++ ) { - aux_buffer_fx[i] = L_shr( aux_buffer_fx[i], q_aux_buffer - q_temp ); + aux_buffer_fx[i] = L_shr( aux_buffer_fx[i], sub( q_aux_buffer, q_temp ) ); + move32(); } } q_aux_buffer = q_temp; + move16(); h_freq_domain_decorr_ap_state->h_onset_detection_power_state.q_onset_detector = q_temp; + move16(); ivas_dirac_dec_onset_detection_process_fx( aux_buffer_fx, q_aux_buffer, onset_filter_fx, num_protos_diff, h_freq_domain_decorr_ap_params->h_onset_detection_power_params, h_freq_domain_decorr_ap_state->h_onset_detection_power_state ); /* Apply decorrelator if num_channels is greater than 0 */ - IF( GT_16( num_channels, 0 ) ) + IF( num_channels > 0 ) { /* remove onsets from prototype frame */ FOR( ch_idx = 0; ch_idx < num_protos_dir; ch_idx++ ) @@ -1050,6 +1081,7 @@ void ivas_dirac_dec_decorr_process_fx( v_mult_inc_fixed( &input_frame_fx[2 * ch_idx * num_freq_bands + 1], 2, &onset_filter_fx[ch_idx * num_freq_bands], 1, &aux_buffer_fx[2 * ch_idx * max_band_decorr + 1], 2, max_band_decorr ); } q_aux_buffer = q_input_frame; + move16(); /*-----------------------------------------------------------------* * all pass based decorrelation @@ -1059,6 +1091,7 @@ void ivas_dirac_dec_decorr_process_fx( /* output is the first frame of the state */ decorr_buffer_len = sub( add( h_freq_domain_decorr_ap_params->filter_length[0], h_freq_domain_decorr_ap_params->pre_delay[0] ), 1 ); Word16 q_decorr_buf = h_freq_domain_decorr_ap_state->q_decorr_buffer; + move16(); p_frame_dec_fx = frame_dec_fx; decorr_buffer_fx = h_freq_domain_decorr_ap_state->decorr_buffer_fx; phase_coeff_real_fx = h_freq_domain_decorr_ap_params->phase_coeff_real_fx; // Q14 @@ -1077,6 +1110,8 @@ void ivas_dirac_dec_decorr_process_fx( phase_coeff_imag_fx++; phase_coeff_real_fx++; decorr_buffer_fx += 2; + move32(); + move32(); } p_frame_dec_fx += incr_aux; } @@ -1085,41 +1120,42 @@ void ivas_dirac_dec_decorr_process_fx( FOR( time_idx = 0; time_idx < sub( decorr_buffer_len, 1 ); time_idx++ ) { - Copy32( &h_freq_domain_decorr_ap_state->decorr_buffer_fx[2 * ( time_idx + 1 ) * max_band_decorr * num_channels], &h_freq_domain_decorr_ap_state->decorr_buffer_fx[2 * (time_idx) *max_band_decorr * num_channels], 2 * max_band_decorr * num_channels ); + Copy32( &h_freq_domain_decorr_ap_state->decorr_buffer_fx[imult1616( 2, imult1616( imult1616( add( time_idx, 1 ), max_band_decorr ), num_channels ) )], &h_freq_domain_decorr_ap_state->decorr_buffer_fx[imult1616( imult1616( imult1616( 2, ( time_idx ) ), max_band_decorr ), num_channels )], imult1616( imult1616( 2, max_band_decorr ), num_channels ) ); } - set32_fx( &h_freq_domain_decorr_ap_state->decorr_buffer_fx[2 * ( decorr_buffer_len - 1 ) * max_band_decorr * num_channels], 0, 2 * max_band_decorr * num_channels ); + set32_fx( &h_freq_domain_decorr_ap_state->decorr_buffer_fx[imult1616( imult1616( imult1616( 2, sub( decorr_buffer_len, 1 ) ), max_band_decorr ), num_channels )], 0, imult1616( imult1616( 2, max_band_decorr ), num_channels ) ); Word16 decorr_buff_tot_len = imult1616( imult1616( shl( decorr_buffer_len, 1 ), max_band_decorr ), num_channels ); guarded_bits = s_max( find_guarded_bits_fx( 2 ), 3 ); - q_shift = getScaleFactor32( h_freq_domain_decorr_ap_state->decorr_buffer_fx, decorr_buff_tot_len ) - guarded_bits; + q_shift = sub( getScaleFactor32( h_freq_domain_decorr_ap_state->decorr_buffer_fx, decorr_buff_tot_len ), guarded_bits ); Scale_sig32( h_freq_domain_decorr_ap_state->decorr_buffer_fx, decorr_buff_tot_len, q_shift ); - q_decorr_buf = q_decorr_buf + q_shift; + q_decorr_buf = add( q_decorr_buf, q_shift ); - q_shift = getScaleFactor32( aux_buffer_fx, 2 * num_protos_dir * max_band_decorr_temp ); + q_shift = getScaleFactor32( aux_buffer_fx, imult1616( imult1616( 2, num_protos_dir ), max_band_decorr_temp ) ); - FOR( Word16 j = 0; j < 2 * num_protos_dir * max_band_decorr_temp; j++ ) + FOR( Word16 j = 0; j < shl( imult1616( num_protos_dir, max_band_decorr_temp ), 1 ); j++ ) { aux_buffer_fx[j] = L_shl( aux_buffer_fx[j], q_shift ); + move32(); } - q_aux_buffer += q_shift; + q_aux_buffer = add( q_aux_buffer, q_shift ); // q of aux buff must be greater than 3 than decorr buffer// IF( GE_16( q_decorr_buf, q_aux_buffer ) ) { - Scale_sig32( h_freq_domain_decorr_ap_state->decorr_buffer_fx, decorr_buff_tot_len, negate( q_decorr_buf - q_aux_buffer + 3 ) ); - q_decorr_buf = q_decorr_buf + negate( q_decorr_buf - q_aux_buffer + 3 ); + Scale_sig32( h_freq_domain_decorr_ap_state->decorr_buffer_fx, decorr_buff_tot_len, negate( add( sub( q_decorr_buf, q_aux_buffer ), 3 ) ) ); + q_decorr_buf = sub( q_decorr_buf, add( sub( q_decorr_buf, q_aux_buffer ), 3 ) ); } ELSE { IF( GT_16( sub( q_aux_buffer, q_decorr_buf ), 3 ) ) { - Scale_sig32( aux_buffer_fx, 2 * num_protos_dir * max_band_decorr_temp, negate( sub( sub( q_aux_buffer, q_decorr_buf ), 3 ) ) ); + Scale_sig32( aux_buffer_fx, shl( imult1616( num_protos_dir, max_band_decorr_temp ), 1 ), negate( sub( sub( q_aux_buffer, q_decorr_buf ), 3 ) ) ); } ELSE { - Scale_sig32( h_freq_domain_decorr_ap_state->decorr_buffer_fx, decorr_buff_tot_len, negate( 3 - ( q_aux_buffer - q_decorr_buf ) ) ); - q_decorr_buf = q_decorr_buf + negate( 3 - ( q_aux_buffer - q_decorr_buf ) ); + Scale_sig32( h_freq_domain_decorr_ap_state->decorr_buffer_fx, decorr_buff_tot_len, negate( sub( 3, sub( q_aux_buffer, q_decorr_buf ) ) ) ); + q_decorr_buf = sub( q_decorr_buf, sub( 3, sub( q_aux_buffer, q_decorr_buf ) ) ); } } @@ -1145,46 +1181,55 @@ void ivas_dirac_dec_decorr_process_fx( filter_coeff_num_real_fx = &h_freq_domain_decorr_ap_params->filter_coeff_num_real_fx[idx_filter]; // Q12 filter_coeff_den_real_fx = &h_freq_domain_decorr_ap_params->filter_coeff_den_real_fx[idx_filter]; // Q12 decorr_buffer_start_ptr_fx = &h_freq_domain_decorr_ap_state->decorr_buffer_fx[2 * ( ch_idx * max_band_decorr + band_idx )]; - input_real_fx = aux_buffer_fx[2 * ( proto_index_dir[ch_idx] * max_band_decorr + band_idx )]; // q_aux - input_imag_fx = aux_buffer_fx[2 * ( proto_index_dir[ch_idx] * max_band_decorr + band_idx ) + 1]; // q_aux + input_real_fx = aux_buffer_fx[shl( add( imult1616( proto_index_dir[ch_idx], max_band_decorr ), band_idx ), 1 )]; // q_aux + input_imag_fx = aux_buffer_fx[add( shl( add( imult1616( proto_index_dir[ch_idx], max_band_decorr ), band_idx ), 1 ), 1 )]; // q_aux /* MA part of filter impulse response */ FOR( l = 0; l < filter_length; l++ ) { frame_ma_fx[2 * l] = Mpy_32_16_1( input_real_fx, filter_coeff_num_real_fx[l] ); // Q_qux -3 = q_deorr // frame_ma_fx[2 * l] = L_shr(frame_ma_fx[2 * l],3); // scaling to q_decorr_buf - frame_ma_fx[2 * l + 1] = Mpy_32_16_1( input_imag_fx, filter_coeff_num_real_fx[l] ); // Q_qux - 3 = q_deorr - // frame_ma_fx[2 * l + 1] = L_shr(frame_ma_fx[2 * l + 1], 3); // scaling to q_decorr_buf + frame_ma_fx[add( shl( l, 1 ), 1 )] = Mpy_32_16_1( input_imag_fx, filter_coeff_num_real_fx[l] ); // Q_qux - 3 = q_deorr + // frame_ma_fx[2 * l + 1] = L_shr(frame_ma_fx[2 * l + 1], 3); // scaling to q_decorr_buf + move32(); + move32(); } - decorr_buffer_ptr_fx = decorr_buffer_start_ptr_fx + 2 * ( sub( pre_delay, 1 ) ) * decorr_buffer_step; + decorr_buffer_ptr_fx = decorr_buffer_start_ptr_fx + shl( imult1616( ( sub( pre_delay, 1 ) ), decorr_buffer_step ), 1 ); /*add MA part to state */ decorr_buffer_ptr_fx[0] = L_add( decorr_buffer_ptr_fx[0], frame_ma_fx[0] ); decorr_buffer_ptr_fx[1] = L_add( decorr_buffer_ptr_fx[1], frame_ma_fx[1] ); + move32(); + move32(); /*get values for AR part */ filter_frame_real_fx = decorr_buffer_ptr_fx[0]; // q_decorr filter_frame_imag_fx = decorr_buffer_ptr_fx[1]; // q_deocrr - decorr_buffer_ptr_fx += 2 * decorr_buffer_step; + decorr_buffer_ptr_fx += shl( decorr_buffer_step, 1 ); FOR( l = 1; l < filter_length; l++ ) { // q adjustment needed// - decorr_buffer_ptr_fx[0] = L_add( decorr_buffer_ptr_fx[0], frame_ma_fx[2 * l] ); // q_decorr - Word32 temp_1 = Mpy_32_16_1( filter_frame_real_fx, filter_coeff_den_real_fx[l] ); // q_decorr - 3 - temp_1 = L_shl( temp_1, 3 ); // q_decorr - decorr_buffer_ptr_fx[0] = L_sub( decorr_buffer_ptr_fx[0], temp_1 ); // q_deocor - decorr_buffer_ptr_fx[1] = L_add( decorr_buffer_ptr_fx[1], frame_ma_fx[2 * l + 1] ); // q_decorr - Word32 temp_2 = Mpy_32_16_1( filter_frame_imag_fx, filter_coeff_den_real_fx[l] ); // q_decorr - 3 - temp_2 = L_shl( temp_2, 3 ); // q_decorr - decorr_buffer_ptr_fx[1] = L_sub( decorr_buffer_ptr_fx[1], temp_2 ); // q_decorr + decorr_buffer_ptr_fx[0] = L_add( decorr_buffer_ptr_fx[0], frame_ma_fx[2 * l] ); // q_decorr + Word32 temp_1 = Mpy_32_16_1( filter_frame_real_fx, filter_coeff_den_real_fx[l] ); // q_decorr - 3 + temp_1 = L_shl( temp_1, 3 ); // q_decorr + decorr_buffer_ptr_fx[0] = L_sub( decorr_buffer_ptr_fx[0], temp_1 ); // q_deocor + decorr_buffer_ptr_fx[1] = L_add( decorr_buffer_ptr_fx[1], frame_ma_fx[add( shl( l, 1 ), 1 )] ); // q_decorr + Word32 temp_2 = Mpy_32_16_1( filter_frame_imag_fx, filter_coeff_den_real_fx[l] ); // q_decorr - 3 + temp_2 = L_shl( temp_2, 3 ); // q_decorr + decorr_buffer_ptr_fx[1] = L_sub( decorr_buffer_ptr_fx[1], temp_2 ); // q_decorr decorr_buffer_ptr_fx += imult1616( 2, decorr_buffer_step ); + move32(); + move32(); + move32(); + move32(); } } } } h_freq_domain_decorr_ap_state->q_decorr_buffer = q_decorr_buf; + move16(); /*-----------------------------------------------------------------* * onset/diffuse energy ratio conservation *-----------------------------------------------------------------*/ @@ -1194,6 +1239,7 @@ void ivas_dirac_dec_decorr_process_fx( Word16 e_reverb_energy_smooth, e_direct_energy_smooth; Word16 offset1, offset2; Word16 norm = 63; + move16(); e_reverb_energy_smooth = sub( 31, h_freq_domain_decorr_ap_state->q_reverb_energy_smooth ); e_direct_energy_smooth = sub( 31, h_freq_domain_decorr_ap_state->q_direct_energy_smooth ); @@ -1204,11 +1250,11 @@ void ivas_dirac_dec_decorr_process_fx( FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { q_shift = s_min( q_shift, - L_norm_arr( &frame_dec_fx[2 * ch_idx * num_freq_bands], shl( max_band_decorr, 1 ) ) ); + L_norm_arr( &frame_dec_fx[shl( imult1616( ch_idx, num_freq_bands ), 1 )], shl( max_band_decorr, 1 ) ) ); } FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { - Scale_sig32( &frame_dec_fx[2 * ch_idx * num_freq_bands], shl( max_band_decorr, 1 ), q_shift ); + Scale_sig32( &frame_dec_fx[shl( imult1616( ch_idx, num_freq_bands ), 1 )], shl( max_band_decorr, 1 ), q_shift ); } #else q_shift = L_norm_arr( frame_dec_fx, ( 2 * max_band_decorr + incr_aux ) * num_channels ); @@ -1220,41 +1266,44 @@ void ivas_dirac_dec_decorr_process_fx( IF( h_freq_domain_decorr_ap_params->use_ducker ) { /* compute direct power w/o onsets for the energy ratio, signal is still in the aux buffer */ - v_mult_fixed( aux_buffer_fx, aux_buffer_fx, aux_buffer_fx, 2 * max_band_decorr * num_protos_dir ); // 2 *q_aux -31 + v_mult_fixed( aux_buffer_fx, aux_buffer_fx, aux_buffer_fx, shl( imult1616( max_band_decorr, num_protos_dir ), 1 ) ); // 2 *q_aux -31 q_aux_buffer = sub( imult1616( 2, q_aux_buffer ), 31 ); // if this scaling is eliminated overflow is happening fot v_add_inc_fix - q_shift = L_norm_arr( aux_buffer_fx, 2 * num_protos_dir * max_band_decorr ) - find_guarded_bits_fx( 2 ); - Scale_sig32( aux_buffer_fx, 2 * num_protos_dir * max_band_decorr_temp, q_shift ); + q_shift = sub( L_norm_arr( aux_buffer_fx, shl( imult1616( num_protos_dir, max_band_decorr ), 1 ) ), find_guarded_bits_fx( 2 ) ); + Scale_sig32( aux_buffer_fx, shl( imult1616( num_protos_dir, max_band_decorr_temp ), 1 ), q_shift ); q_aux_buffer = add( q_aux_buffer, q_shift ); v_add_inc_fx( &aux_buffer_fx[0], 2, &aux_buffer_fx[1], 2, direct_energy_fx, 1, imult1616( num_protos_dir, max_band_decorr ) ); q_direct_energy = q_aux_buffer; + move16(); /* calculate the power of the decorrelated signal */ FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { - offset1 = 2 * ch_idx * num_freq_bands; - offset2 = 2 * ch_idx * max_band_decorr; + offset1 = shl( imult1616( ch_idx, num_freq_bands ), 1 ); + offset2 = shl( imult1616( ch_idx, max_band_decorr ), 1 ); FOR( Word16 i = 0; i < 2 * max_band_decorr; i++ ) { - aux_64[offset2 + i] = W_mult0_32_32( frame_dec_fx[offset1 + i], frame_dec_fx[offset1 + i] ); - norm = s_min( norm, W_norm( aux_64[offset2 + i] ) ); + aux_64[add( offset2, i )] = W_mult0_32_32( frame_dec_fx[add( offset1, i )], frame_dec_fx[add( offset1, i )] ); + move64(); + norm = s_min( norm, W_norm( aux_64[add( offset2, i )] ) ); } } - FOR( Word16 i = 0; i < 2 * num_channels * max_band_decorr; i++ ) + FOR( Word16 i = 0; i < shl( imult1616( num_channels, max_band_decorr ), 1 ); i++ ) { - aux_buffer_fx[i] = W_extract_h( W_shl( aux_64[i], norm - find_guarded_bits_fx( 2 ) ) ); + aux_buffer_fx[i] = W_extract_h( W_shl( aux_64[i], sub( norm, find_guarded_bits_fx( 2 ) ) ) ); + move32(); } q_aux_buffer = add( imult1616( 2, q_frame_f ), sub( sub( norm, 1 ), 32 ) ); FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { - v_add_inc_fx( &aux_buffer_fx[2 * ch_idx * max_band_decorr], 2, &aux_buffer_fx[2 * ch_idx * max_band_decorr + 1], 2, &aux_buffer_fx[ch_idx * max_band_decorr], 1, max_band_decorr ); + v_add_inc_fx( &aux_buffer_fx[shl( imult1616( ch_idx, max_band_decorr ), 1 )], 2, &aux_buffer_fx[add( shl( imult1616( ch_idx, max_band_decorr ), 1 ), 1 )], 2, &aux_buffer_fx[imult1616( ch_idx, max_band_decorr )], 1, max_band_decorr ); } /* smooth energies */ @@ -1262,25 +1311,28 @@ void ivas_dirac_dec_decorr_process_fx( v_multc_fixed( h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx, DIRAC_DUCK_ALPHA_FX, h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx, imult1616( num_channels, max_band_decorr ) ); // same-q - v_add_fixed_me( aux_buffer_fx, 31 - q_aux_buffer, h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx, e_reverb_energy_smooth, h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx, &e_reverb_energy_smooth, imult1616( num_channels, max_band_decorr ), 0 ); + v_add_fixed_me( aux_buffer_fx, sub( 31, q_aux_buffer ), h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx, e_reverb_energy_smooth, h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx, &e_reverb_energy_smooth, imult1616( num_channels, max_band_decorr ), 0 ); h_freq_domain_decorr_ap_state->q_reverb_energy_smooth = sub( 31, e_reverb_energy_smooth ); v_multc_fixed( direct_energy_fx, ONE_M_DIRAC_DUCK_ALPHA, direct_energy_fx, imult1616( num_protos_dir, max_band_decorr ) ); // same q v_multc_fixed( h_freq_domain_decorr_ap_state->direct_energy_smooth_fx, DIRAC_DUCK_ALPHA_FX, h_freq_domain_decorr_ap_state->direct_energy_smooth_fx, imult1616( num_protos_dir, max_band_decorr ) ); // same q - v_add_fixed_me( direct_energy_fx, 31 - q_direct_energy, h_freq_domain_decorr_ap_state->direct_energy_smooth_fx, e_direct_energy_smooth, h_freq_domain_decorr_ap_state->direct_energy_smooth_fx, &e_direct_energy_smooth, imult1616( num_protos_dir, max_band_decorr ), 0 ); + v_add_fixed_me( direct_energy_fx, sub( 31, q_direct_energy ), h_freq_domain_decorr_ap_state->direct_energy_smooth_fx, e_direct_energy_smooth, h_freq_domain_decorr_ap_state->direct_energy_smooth_fx, &e_direct_energy_smooth, imult1616( num_protos_dir, max_band_decorr ), 0 ); h_freq_domain_decorr_ap_state->q_direct_energy_smooth = sub( 31, e_direct_energy_smooth ); + move16(); // scaling energy buffers for better precision for higher values// q_shift = L_norm_arr( h_freq_domain_decorr_ap_state->direct_energy_smooth_fx, imult1616( num_protos_dir, max_band_decorr ) ); Scale_sig32( h_freq_domain_decorr_ap_state->direct_energy_smooth_fx, imult1616( num_protos_dir, max_band_decorr ), q_shift ); - h_freq_domain_decorr_ap_state->q_direct_energy_smooth = h_freq_domain_decorr_ap_state->q_direct_energy_smooth + q_shift; + h_freq_domain_decorr_ap_state->q_direct_energy_smooth = add( h_freq_domain_decorr_ap_state->q_direct_energy_smooth, q_shift ); + move16(); q_shift = L_norm_arr( h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx, imult1616( num_channels, max_band_decorr ) ); Scale_sig32( h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx, imult1616( num_channels, max_band_decorr ), q_shift ); - h_freq_domain_decorr_ap_state->q_reverb_energy_smooth = h_freq_domain_decorr_ap_state->q_reverb_energy_smooth + q_shift; + h_freq_domain_decorr_ap_state->q_reverb_energy_smooth = add( h_freq_domain_decorr_ap_state->q_reverb_energy_smooth, q_shift ); + move16(); e_reverb_energy_smooth = sub( 31, h_freq_domain_decorr_ap_state->q_reverb_energy_smooth ); e_direct_energy_smooth = sub( 31, h_freq_domain_decorr_ap_state->q_direct_energy_smooth ); @@ -1292,12 +1344,12 @@ void ivas_dirac_dec_decorr_process_fx( FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { q_shift = s_min( q_shift, - sub( L_norm_arr( &frame_dec_fx[2 * ch_idx * num_freq_bands], shl( max_band_decorr, 1 ) ), + sub( L_norm_arr( &frame_dec_fx[shl( imult1616( ch_idx, num_freq_bands ), 1 )], shl( max_band_decorr, 1 ) ), Q2 ) ); } FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { - Scale_sig32( &frame_dec_fx[2 * ch_idx * num_freq_bands], shl( max_band_decorr, 1 ), q_shift ); + Scale_sig32( &frame_dec_fx[shl( imult1616( ch_idx, num_freq_bands ), 1 )], shl( max_band_decorr, 1 ), q_shift ); } #else q_shift = sub( L_norm_arr( frame_dec_fx, ( 2 * max_band_decorr + incr_aux ) * num_channels ), 2 ); @@ -1307,7 +1359,7 @@ void ivas_dirac_dec_decorr_process_fx( FOR( ch_idx = 0; ch_idx < num_channels; ch_idx++ ) { - Word32 *frame_dec_fx_ptr = &frame_dec_fx[ch_idx * 2 * num_freq_bands]; + Word32 *frame_dec_fx_ptr = &frame_dec_fx[shl( imult1616( ch_idx, num_freq_bands ), 1 )]; Word16 cur_proto_index = imult1616( proto_index_dir[ch_idx], max_band_decorr ); Word16 cur_reverb_index = imult1616( ch_idx, max_band_decorr ); Word32 *reverb_energy_smooth_ptr = &h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx[cur_reverb_index]; // q_aux @@ -1316,43 +1368,52 @@ void ivas_dirac_dec_decorr_process_fx( FOR( band_idx = 0; band_idx < max_band_decorr; band_idx++ ) { Word16 duck_gain = 32767, e_duck_gain = 0; + move16(); + move16(); Word32 direct_energy_loc = direct_energy_smooth_ptr[band_idx]; Word32 reverb_energy_loc = reverb_energy_smooth_ptr[band_idx]; + move32(); + move32(); Word32 temp_1 = Mpy_32_32( direct_energy_loc, DIRAC_DUCK_GAMMA_FX ); // e+1 Word32 temp_2 = Mpy_32_32( reverb_energy_loc, DIRAC_DUCK_GAMMA_FX ); // e+1 - Word16 comp_flag_1 = BASOP_Util_Cmp_Mant32Exp( reverb_energy_loc, e_reverb_energy_smooth, temp_1, e_direct_energy_smooth + 1 ); - Word16 comp_flag_2 = BASOP_Util_Cmp_Mant32Exp( direct_energy_loc, e_direct_energy_smooth, temp_2, e_reverb_energy_smooth + 1 ); + Word16 comp_flag_1 = BASOP_Util_Cmp_Mant32Exp( reverb_energy_loc, e_reverb_energy_smooth, temp_1, add( e_direct_energy_smooth, 1 ) ); + Word16 comp_flag_2 = BASOP_Util_Cmp_Mant32Exp( direct_energy_loc, e_direct_energy_smooth, temp_2, add( e_reverb_energy_smooth, 1 ) ); IF( EQ_16( comp_flag_1, 1 ) ) { duck_gain = BASOP_Util_Divide3232_Scale( temp_1, L_add( reverb_energy_loc, EPSILON_FX ), &e_duck_gain ); - e_duck_gain = e_duck_gain + ( e_direct_energy_smooth + 1 - e_reverb_energy_smooth ); + e_duck_gain = add( e_duck_gain, sub( add( e_direct_energy_smooth, 1 ), e_reverb_energy_smooth ) ); duck_gain = Sqrt16( duck_gain, &e_duck_gain ); duck_gain = shl( duck_gain, sub( e_duck_gain, 1 ) ); // Q14 - frame_dec_fx_ptr[2 * band_idx] = L_shl( Mpy_32_16_1( frame_dec_fx_ptr[2 * band_idx], duck_gain ), 1 ); // q_frame_f - frame_dec_fx_ptr[2 * band_idx + 1] = L_shl( Mpy_32_16_1( frame_dec_fx_ptr[2 * band_idx + 1], duck_gain ), 1 ); // q_frame_f + frame_dec_fx_ptr[2 * band_idx] = L_shl( Mpy_32_16_1( frame_dec_fx_ptr[2 * band_idx], duck_gain ), 1 ); // q_frame_f + frame_dec_fx_ptr[add( shl( band_idx, 1 ), 1 )] = L_shl( Mpy_32_16_1( frame_dec_fx_ptr[add( shl( band_idx, 1 ), 1 )], duck_gain ), 1 ); // q_frame_f + move32(); + move32(); } ELSE IF( EQ_16( comp_flag_2, 1 ) ) { duck_gain = BASOP_Util_Divide3232_Scale( direct_energy_loc, L_add( temp_2, EPSILON_FX ), &e_duck_gain ); - e_duck_gain = e_duck_gain + ( e_direct_energy_smooth - e_reverb_energy_smooth - 1 ); + e_duck_gain = add( e_duck_gain, sub( e_direct_energy_smooth, add( e_reverb_energy_smooth, 1 ) ) ); duck_gain = Sqrt16( duck_gain, &e_duck_gain ); Word16 comp_flag = BASOP_Util_Cmp_Mant32Exp( duck_gain, e_duck_gain, 16384, 2 ); IF( EQ_16( comp_flag, 1 ) ) { duck_gain = 16384; // 2inQ13 + move16(); } ELSE { duck_gain = shl( duck_gain, sub( e_duck_gain, 2 ) ); // Q13 } - frame_dec_fx_ptr[2 * band_idx] = L_shl( Mpy_32_16_1( frame_dec_fx_ptr[2 * band_idx], duck_gain ), 2 ); // q_frame_dec - frame_dec_fx_ptr[2 * band_idx + 1] = L_shl( Mpy_32_16_1( frame_dec_fx_ptr[2 * band_idx + 1], duck_gain ), 2 ); // q_frame_dec + frame_dec_fx_ptr[2 * band_idx] = L_shl( Mpy_32_16_1( frame_dec_fx_ptr[2 * band_idx], duck_gain ), 2 ); // q_frame_dec + frame_dec_fx_ptr[add( shl( band_idx, 1 ), 1 )] = L_shl( Mpy_32_16_1( frame_dec_fx_ptr[add( shl( band_idx, 1 ), 1 )], duck_gain ), 2 ); // q_frame_dec + move32(); + move32(); } } } @@ -1362,18 +1423,18 @@ void ivas_dirac_dec_decorr_process_fx( * add back onsets *-----------------------------------------------------------------*/ - q_shift = q_input_frame - q_frame_f; + q_shift = sub( q_input_frame, q_frame_f ); #ifdef MSAN_FIX // scaling it to input q FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { - Scale_sig32( &frame_dec_fx[2 * ch_idx * num_freq_bands], shl( max_band_decorr, 1 ), q_shift ); + Scale_sig32( &frame_dec_fx[shl( imult1616( ch_idx, num_freq_bands ), 1 )], shl( max_band_decorr, 1 ), q_shift ); } #else Scale_sig32( frame_dec_fx, ( 2 * max_band_decorr + incr_aux ) * num_channels, q_shift ); // scaling it to input q #endif q_frame_f = q_input_frame; - + move16(); IF( EQ_16( h_freq_domain_decorr_ap_params->add_back_onsets_on, 1 ) ) { @@ -1383,11 +1444,13 @@ void ivas_dirac_dec_decorr_process_fx( FOR( k = 0; k < max_band_decorr; ++k ) { - aux_buffer_fx[2 * k] = Mpy_32_32( input_frame_fx[2 * offset + 2 * k], L_sub( ONE_IN_Q31, onset_filter_fx[offset + k] ) ); - aux_buffer_fx[2 * k + 1] = Mpy_32_32( input_frame_fx[2 * offset + 2 * k + 1], L_sub( ONE_IN_Q31, onset_filter_fx[offset + k] ) ); // q_input_f + aux_buffer_fx[2 * k] = Mpy_32_32( input_frame_fx[add( shl( offset, 1 ), shl( k, 1 ) )], L_sub( ONE_IN_Q31, onset_filter_fx[add( offset, k )] ) ); + aux_buffer_fx[add( shl( k, 1 ), 1 )] = Mpy_32_32( input_frame_fx[add( add( shl( offset, 1 ), shl( k, 1 ) ), 1 )], L_sub( ONE_IN_Q31, onset_filter_fx[add( offset, k )] ) ); // q_input_f + move32(); + move32(); } - v_add_fx( &frame_dec_fx[ch_idx * 2 * num_freq_bands], aux_buffer_fx, &frame_dec_fx[ch_idx * 2 * num_freq_bands], 2 * max_band_decorr ); + v_add_fx( &frame_dec_fx[imult1616( ch_idx, shl( num_freq_bands, 1 ) )], aux_buffer_fx, &frame_dec_fx[imult1616( ch_idx, shl( num_freq_bands, 1 ) )], shl( max_band_decorr, 1 ) ); } } @@ -1395,12 +1458,13 @@ void ivas_dirac_dec_decorr_process_fx( FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { /* calc output indices */ - idx_in_out = 2 * ( add( imult1616( ch_idx, num_freq_bands ), h_freq_domain_decorr_ap_params->max_band_decorr ) ); + idx_in_out = shl( ( add( imult1616( ch_idx, num_freq_bands ), h_freq_domain_decorr_ap_params->max_band_decorr ) ), 1 ); /* copy to output signal */ - set32_fx( &frame_dec_fx[idx_in_out], 0, 2 * sub( num_freq_bands, h_freq_domain_decorr_ap_params->max_band_decorr ) ); + set32_fx( &frame_dec_fx[idx_in_out], 0, shl( sub( num_freq_bands, h_freq_domain_decorr_ap_params->max_band_decorr ), 1 ) ); } *q_frame_dec = q_frame_f; + move16(); } /*end of decorrelator*/ pop_wmops(); @@ -1427,11 +1491,13 @@ void ivas_dirac_dec_decorr_close_fx( * check input handles *-----------------------------------------------------------------*/ + test(); if ( ph_freq_domain_decorr_ap_params == NULL || ph_freq_domain_decorr_ap_state == NULL ) { return; } + test(); if ( *ph_freq_domain_decorr_ap_params == NULL || *ph_freq_domain_decorr_ap_state == NULL ) { return; @@ -1443,7 +1509,6 @@ void ivas_dirac_dec_decorr_close_fx( dirac_onset_detection_state = &( *ph_freq_domain_decorr_ap_state )->h_onset_detection_power_state; -#ifdef IVAS_FLOAT_FIXED IF( dirac_onset_detection_state->onset_detector_1_fx != NULL ) { free( dirac_onset_detection_state->onset_detector_1_fx ); @@ -1455,13 +1520,11 @@ void ivas_dirac_dec_decorr_close_fx( free( dirac_onset_detection_state->onset_detector_2_fx ); dirac_onset_detection_state->onset_detector_2_fx = NULL; } -#endif /*-----------------------------------------------------------------* * memory deallocation *-----------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED IF( ( *ph_freq_domain_decorr_ap_state )->decorr_buffer_fx != NULL ) { free( ( *ph_freq_domain_decorr_ap_state )->decorr_buffer_fx ); @@ -1481,30 +1544,28 @@ void ivas_dirac_dec_decorr_close_fx( free( ( *ph_freq_domain_decorr_ap_state )->reverb_energy_smooth_fx ); ( *ph_freq_domain_decorr_ap_state )->reverb_energy_smooth_fx = NULL; } -#endif /* free pre-delay param buffer */ - if ( ( *ph_freq_domain_decorr_ap_params )->pre_delay != NULL ) + IF( ( *ph_freq_domain_decorr_ap_params )->pre_delay != NULL ) { free( ( *ph_freq_domain_decorr_ap_params )->pre_delay ); ( *ph_freq_domain_decorr_ap_params )->pre_delay = NULL; } /* free filter length param buffer */ - if ( ( *ph_freq_domain_decorr_ap_params )->filter_length != NULL ) + IF( ( *ph_freq_domain_decorr_ap_params )->filter_length != NULL ) { free( ( *ph_freq_domain_decorr_ap_params )->filter_length ); ( *ph_freq_domain_decorr_ap_params )->filter_length = NULL; } /* free pre-delay param buffer */ - if ( ( *ph_freq_domain_decorr_ap_params )->split_frequency_bands != NULL ) + IF( ( *ph_freq_domain_decorr_ap_params )->split_frequency_bands != NULL ) { free( ( *ph_freq_domain_decorr_ap_params )->split_frequency_bands ); ( *ph_freq_domain_decorr_ap_params )->split_frequency_bands = NULL; } -#ifdef IVAS_FLOAT_FIXED /* free filter coeff param buffers */ IF( ( *ph_freq_domain_decorr_ap_params )->filter_coeff_num_real_fx != NULL ) { @@ -1532,7 +1593,6 @@ void ivas_dirac_dec_decorr_close_fx( free( ( *ph_freq_domain_decorr_ap_params )->phase_coeff_real_fx ); ( *ph_freq_domain_decorr_ap_params )->phase_coeff_real_fx = NULL; } -#endif /* free pointers to state and parameter structs */ free( *ph_freq_domain_decorr_ap_params ); *ph_freq_domain_decorr_ap_params = NULL; @@ -1698,7 +1758,7 @@ static void get_lattice_coeffs_fx( FOR( k = 0; k < ap_filter_length[band_index]; k++ ) { - Word16 cur_lattice_coeff = ap_lattice_coeffs_fx[band_index][channel_index * ap_filter_length[band_index] + k]; + Word16 cur_lattice_coeff = ap_lattice_coeffs_fx[band_index][add( imult1616( channel_index, ap_filter_length[band_index] ), k )]; lattice_coeffs[k] = cur_lattice_coeff; move16(); move16(); @@ -1784,11 +1844,12 @@ static void lattice2allpass_fx( FOR( p = 1; p < filter_length; p++ ) { alpha_real_p_fx[p] = shr( lattice_coeffs_fx[( p - 1 )], 3 ); /* Q12 */ + move16(); FOR( i = 1; i < p; i++ ) { - lattice_alpha = mult( lattice_coeffs_fx[( p - 1 )], alpha_real_p_old_fx[p - i] ); /* Q12 */ - alpha_real_p_fx[i] = add( alpha_real_p_old_fx[i], lattice_alpha ); /* Q12 */ + lattice_alpha = mult( lattice_coeffs_fx[( p - 1 )], alpha_real_p_old_fx[sub( p, i )] ); /* Q12 */ + alpha_real_p_fx[i] = add( alpha_real_p_old_fx[i], lattice_alpha ); /* Q12 */ move16(); } /* switch pointers */ @@ -1801,7 +1862,7 @@ static void lattice2allpass_fx( { filter_coeffs_den_real_fx[i] = alpha_real_p_old_fx[i]; /* Q12 */ move16(); - filter_coeffs_num_real_fx[i] = alpha_real_p_old_fx[filter_length - i - 1]; /* Q12 */ + filter_coeffs_num_real_fx[i] = alpha_real_p_old_fx[sub( sub( filter_length, i ), 1 )]; /* Q12 */ move16(); } diff --git a/lib_rend/ivas_dirac_onsets_dec.c b/lib_rend/ivas_dirac_onsets_dec.c index 123c9aec4dc03866a717c06664a86b4b590b9e3d..7e2a595911bd537136a7d16f2294d31ddc9a2d3f 100644 --- a/lib_rend/ivas_dirac_onsets_dec.c +++ b/lib_rend/ivas_dirac_onsets_dec.c @@ -104,7 +104,7 @@ Word16 BASOP_Util_Cmp_Mant32Exp_sat /*!< o: flag: result of comparison */ } /* Check sign, exponent and mantissa to identify, whether a is greater b or not */ - result = sub( 0, 1 ); + result = -1; IF( a_m >= 0 ) { @@ -195,24 +195,27 @@ ivas_error ivas_dirac_dec_onset_detection_open_fx( /* check / set input parameters */ dirac_onset_detection_params->num_freq_bands = num_freq_bands; + move16(); assert( dirac_onset_detection_params->num_freq_bands > 0 && "Error: Number of frequency bands <= 0!" ); dirac_onset_detection_params->max_band_decorr = max_band_decorr; + move16(); /* memory allocation */ - IF( ( dirac_onset_detection_state->onset_detector_1_fx = (Word32 *) malloc( sizeof( Word32 ) * num_protos_diff * dirac_onset_detection_params->max_band_decorr ) ) == NULL ) + IF( ( dirac_onset_detection_state->onset_detector_1_fx = (Word32 *) malloc( sizeof( Word32 ) * imult1616( num_protos_diff, dirac_onset_detection_params->max_band_decorr ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for onset detection\n" ) ); } - IF( ( dirac_onset_detection_state->onset_detector_2_fx = (Word32 *) malloc( sizeof( Word32 ) * num_protos_diff * dirac_onset_detection_params->max_band_decorr ) ) == NULL ) + IF( ( dirac_onset_detection_state->onset_detector_2_fx = (Word32 *) malloc( sizeof( Word32 ) * imult1616( num_protos_diff, dirac_onset_detection_params->max_band_decorr ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for onset detection\n" ) ); } /* init to zero */ - set32_fx( dirac_onset_detection_state->onset_detector_1_fx, 0, num_protos_diff * dirac_onset_detection_params->max_band_decorr ); - set32_fx( dirac_onset_detection_state->onset_detector_2_fx, 0, num_protos_diff * dirac_onset_detection_params->max_band_decorr ); + set32_fx( dirac_onset_detection_state->onset_detector_1_fx, 0, imult1616( num_protos_diff, dirac_onset_detection_params->max_band_decorr ) ); + set32_fx( dirac_onset_detection_state->onset_detector_2_fx, 0, imult1616( num_protos_diff, dirac_onset_detection_params->max_band_decorr ) ); dirac_onset_detection_state->q_onset_detector = Q31; + move16(); return IVAS_ERR_OK; } @@ -293,6 +296,7 @@ void ivas_dirac_dec_onset_detection_process_fx( { /*detector 1: envelope max*/ *p_onset_detector_1_fx = Mpy_32_16_1( *p_onset_detector_1_fx, DIRAC_ONSET_ALPHA_FX ); /* Q(q_onset_detector) */ + move32(); UNUSED_PARAM( q_input_power ); IF( GT_32( *p_onset_detector_1_fx, *input_power_f ) ) { @@ -307,6 +311,7 @@ void ivas_dirac_dec_onset_detection_process_fx( /*detector 2: envelope min*/ *p_onset_detector_2_fx = L_add( Mpy_32_16_1( *p_onset_detector_2_fx, DIRAC_ONSET_BETA_FX ), Mpy_32_16_1( *p_onset_detector_1_fx, ONE_DIRAC_ONSET_BETA_FX ) ); /* Q(q_onset_detector) */ + move32(); IF( LT_32( *p_onset_detector_2_fx, *p_onset_detector_1_fx ) ) { *p_onset_detector_2_fx = *p_onset_detector_2_fx; @@ -318,25 +323,30 @@ void ivas_dirac_dec_onset_detection_process_fx( move32(); } - IF( EQ_32( *p_onset_detector_1_fx, 0 ) ) + IF( *p_onset_detector_1_fx == 0 ) { *p_onset_detector_1_fx = L_add( *p_onset_detector_1_fx, EPSILON_FX ); + move32(); } /*onset filter limited between 0 and 1*/ tmp_fx = BASOP_Util_Divide3232_Scale( *p_onset_detector_2_fx, *p_onset_detector_1_fx, &e_scale ); tmp32_fx = L_mult0( tmp_fx, DIRAC_ONSET_GAIN_FX ); - IF( LT_32( tmp32_fx, 0 ) ) + if ( tmp32_fx < 0 ) { tmp32_fx = 0; move32(); } - Word16 comp_flag = BASOP_Util_Cmp_Mant32Exp_sat( tmp32_fx, e_scale + 4, ONE_IN_Q30, 1 ); - IF( EQ_16( comp_flag, 1 ) || EQ_16( comp_flag, 0 ) ) - tmp32_fx = ONE_IN_Q31; + Word16 comp_flag = BASOP_Util_Cmp_Mant32Exp_sat( tmp32_fx, add( e_scale, 4 ), ONE_IN_Q30, 1 ); + test(); + IF( EQ_16( comp_flag, 1 ) || comp_flag == 0 ) + { + tmp32_fx = ONE_IN_Q31; + move32(); + } ELSE { - tmp32_fx = L_shl( tmp32_fx, e_scale + 4 ); + tmp32_fx = L_shl( tmp32_fx, add( e_scale, 4 ) ); } onset_filter[b] = tmp32_fx; move32(); diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index cc57f1a64a44424ad6bcd6dfa2f0f6a79d653a3d..c5d73c23148099b89b39f6e59e5bdaa4ee3cbe42 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -47,6 +47,9 @@ #include "prot_fx1.h" /* Function prototypes */ #include "prot_fx2.h" /* Function prototypes */ #endif +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif /*------------------------------------------------------------------------- * Local constants diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 0334bdc33e52ba22179c127a813a1a452114ef49..11cb17e704745b2cd43185f17aebd7fe723ee0fd 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -2216,8 +2216,8 @@ void ivas_shoebox_set_scene ( shoebox_output_t *ER_PARAMS, const Word32 list_pos[3], const Word32 src_pos_data[], - const uint16_t isCartesian, - const uint16_t isRelative + const UWord16 isCartesian, + const UWord16 isRelative ); #endif diff --git a/lib_rend/ivas_reflections.c b/lib_rend/ivas_reflections.c index b06de85c6568ce3136cd1e14a1cde690d0ec78df..ea4b114184d01da34f44d23d3d3611333b590693 100644 --- a/lib_rend/ivas_reflections.c +++ b/lib_rend/ivas_reflections.c @@ -49,6 +49,10 @@ #define float_to_fix( n, factor ) ( round( n * ( 1 << factor ) ) ) #define fix_to_float( n, factor ) ( (float) n / ( 1 << factor ) ) #endif +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif + /*-----------------------------------------------------------------------------------------* * Local constants/tabels *-----------------------------------------------------------------------------------------*/ diff --git a/lib_rend/ivas_shoebox.c b/lib_rend/ivas_shoebox.c index 18ff7da3018476225dc053ee345fc58a63fddecc..c2df17819a2cb4f87d53ebb4f01046f96895884a 100644 --- a/lib_rend/ivas_shoebox.c +++ b/lib_rend/ivas_shoebox.c @@ -39,6 +39,9 @@ #include "prot.h" #include "wmc_auto.h" #include "ivas_rom_com.h" +#ifdef IVAS_FLOAT_FIXED +#include "ivas_rom_com_fx.h" +#endif /*------------------------------------------------------------------------- @@ -181,7 +184,7 @@ void ivas_shoebox_init( shoebox_obj_t *obj, shoebox_config_t *cal ) { - uint16_t i; + UWord16 i; /* Add cal to obj struct */ obj->cal = *cal; @@ -305,65 +308,86 @@ static void shoebox_bound_fx( { Word32 out_tmp, out_tmp1; Word32 i; - // assert( 0 ); out_tmp = L_sub( L_shr( obj->cal.room_L_fx, 1 ), obj->min_wall_dist_fx ); // Q.22 out_tmp1 = L_add( L_shr( L_negate( obj->cal.room_L_fx ), 1 ), obj->min_wall_dist_fx ); // Q.22 test(); IF( GT_32( out_pos[0], out_tmp ) || LT_32( out_pos[0], out_tmp1 ) ) { - test(); - IF( LT_32( out_pos[0], 0 ) ) + IF( out_pos[0] < 0 ) { i = -1; move32(); } ELSE { - i = ( out_pos[0] > 0 ) ? ( (Word32) 1 ) : ( (Word32) 0 ); - test(); + IF( out_pos[0] > 0 ) + { + i = (Word32) 1; + } + ELSE + { + i = (Word32) 0; + } move32(); } - out_pos[0] = ( out_tmp * ( i ) ); + out_pos[0] = W_extract_l( W_mult0_32_32( out_tmp, i ) ); + move32(); } out_tmp = L_sub( L_shr( obj->cal.room_W_fx, 1 ), obj->min_wall_dist_fx ); // Q.22 out_tmp1 = L_add( L_shr( L_negate( obj->cal.room_W_fx ), 1 ), obj->min_wall_dist_fx ); // Q.22 + test(); IF( GT_32( out_pos[1], out_tmp ) || LT_32( out_pos[1], out_tmp1 ) ) { - IF( LT_32( out_pos[1], 0 ) ) + IF( out_pos[1] < 0 ) { i = -1; move32(); } ELSE { - i = ( out_pos[1] > 0 ) ? ( (Word32) 1 ) : ( (Word32) 0 ); - test(); + IF( out_pos[1] > 0 ) + { + i = (Word32) 1; + } + ELSE + { + i = (Word32) 0; + } move32(); } - out_pos[1] = out_tmp * ( i ); + out_pos[1] = W_extract_l( W_mult0_32_32( out_tmp, i ) ); + move32(); } out_tmp = L_sub( L_shr( obj->cal.room_H_fx, 1 ), obj->min_wall_dist_fx ); // Q.22 out_tmp1 = L_add( L_shr( L_negate( obj->cal.room_H_fx ), 1 ), obj->min_wall_dist_fx ); // Q.22 + test(); IF( GT_32( out_pos[2], out_tmp ) || LT_32( out_pos[2], out_tmp1 ) ) { - IF( LT_32( out_pos[2], 0 ) ) + IF( out_pos[2] < 0 ) { i = -1; move32(); } ELSE { - i = ( out_pos[2] > 0 ) ? ( (Word32) 1 ) : ( (Word32) 0 ); - test(); + IF( out_pos[2] > 0 ) + { + i = (Word32) 1; + } + ELSE + { + i = (Word32) 0; + } move32(); } - out_pos[2] = out_tmp * ( i ); + out_pos[2] = (Word32) W_mult0_32_32( out_tmp, (Word32) i ); + move32(); } return; @@ -470,10 +494,10 @@ static void shoebox_get_coord_fx( Word32 rcoselev; Word32 tmp_size_idx_1; Word32 n; - // assert( 0 ); + tmp_size_idx_1 = 3; move32(); - IF( EQ_16( obj->isCartesian, 0 ) ) + IF( obj->isCartesian == 0 ) { /* Convert Spherical to Cartesian */ #if 0 @@ -503,28 +527,29 @@ static void shoebox_get_coord_fx( { /* CARTESIAN CASE */ tmp_size_idx_1 = loop_ub; + move32(); FOR( n = 0; n < loop_ub; n++ ) { tmp_data[n] = src_pos_data[k + n]; move32(); } - IF( NE_16( obj->isZHeight, 0 ) ) + IF( obj->isZHeight != 0 ) { /* FIX Z COORDINATE */ - tmp_data[2] = L_sub( src_pos_data[k + 2], L_shr( obj->cal.room_H_fx, 1 ) ); + tmp_data[2] = L_sub( src_pos_data[L_add( k, 2 )], L_shr( obj->cal.room_H_fx, 1 ) ); + move32(); } } FOR( k = 0; k < tmp_size_idx_1; k++ ) { - obj->src_pos_fx[( coord + k ) - 1] = tmp_data[k]; //.22 + obj->src_pos_fx[L_add( coord, k ) - 1] = tmp_data[k]; //.22 move32(); } /* CENTER TO LISTENER */ - k = ( out_tmp + 1 ); - + k = L_add( out_tmp, 1 ); tmp_pos[0] = obj->src_pos_fx[k - 1]; //.22 tmp_pos[1] = obj->src_pos_fx[k]; @@ -533,11 +558,15 @@ static void shoebox_get_coord_fx( move32(); move32(); - IF( NE_16( isRelative, 0 ) ) + IF( isRelative != 0 ) { tmp_pos[0] = L_add( tmp_pos[0], obj->list_pos_fx[0] ); //.22 tmp_pos[1] = L_add( tmp_pos[1], obj->list_pos_fx[1] ); tmp_pos[2] = L_add( tmp_pos[2], obj->list_pos_fx[2] ); + + move32(); + move32(); + move32(); } return; @@ -612,8 +641,6 @@ static Word32 shoebox_get_euclidian_distance_internal_fx( Word32 absxk, out_tmp, t; Word16 q; - // assert( 0 ); - absxk = L_abs( L_sub( obj->list_pos_fx[0], tmp_pos[0] ) ); // Q.22-Q22 IF( GT_32( absxk, ER_EUCLIDEAN_SCALE_FX ) ) @@ -625,9 +652,9 @@ static Word32 shoebox_get_euclidian_distance_internal_fx( } ELSE { - t = absxk * ER_RECIPROCAL_EUCLIDEAN_SCALE_FX; // Q22 - out_tmp = Mpy_32_32( t, t ); // Q13 - out_tmp = L_shl( out_tmp, 9 ); // Q22 + t = (Word32) W_mult0_32_32( absxk, ER_RECIPROCAL_EUCLIDEAN_SCALE_FX ); // Q22 + out_tmp = Mpy_32_32( t, t ); // Q13 + out_tmp = L_shl( out_tmp, 9 ); // Q22 } absxk = L_abs( L_sub( obj->list_pos_fx[1], tmp_pos[1] ) ); @@ -852,15 +879,15 @@ void ivas_shoebox_set_scene( shoebox_output_t *ER_PARAMS, const Word32 list_pos_fx[3], const Word32 src_pos_data[], - const uint16_t isCartesian, - const uint16_t isRelative ) + const UWord16 isCartesian, + const UWord16 isRelative ) { Word32 tmp_pos_fx[3]; Word32 out_tmp; - Word32 i, j, k, n; + Word32 k, n; Word32 loop_ub, out_tmp_fx; - Word16 q_format1, q_format; + Word16 q_format1, q_format, i, j; /* ------------- SET FLAGS ------------- */ obj->isCartesian = isCartesian; @@ -868,11 +895,11 @@ void ivas_shoebox_set_scene( move16(); move16(); /* ------------- CHECK DIMENSIONS ------------- */ - if ( GE_16( ER_PARAMS->n_sources, obj->MAX_SOURCES ) ) + IF( GE_16( ER_PARAMS->n_sources, obj->MAX_SOURCES ) ) { obj->nSrc = obj->MAX_SOURCES; } - else + ELSE { obj->nSrc = ER_PARAMS->n_sources; } @@ -887,9 +914,10 @@ void ivas_shoebox_set_scene( move32(); move32(); /* ---------- ADJUST LISTENER ------------- */ - IF( NE_16( obj->isZHeight, 0 ) ) + if ( obj->isZHeight != 0 ) { obj->list_pos_fx[2] = L_sub( list_pos_fx[2], L_shr( obj->cal.room_H_fx, 1 ) ); // Q.22 + move32(); } tmp_pos_fx[1] = obj->list_pos_fx[1]; tmp_pos_fx[2] = obj->list_pos_fx[2]; @@ -900,7 +928,7 @@ void ivas_shoebox_set_scene( /* ---------- SOURCE LOOP ------------- */ - i = (Word32) obj->nSrc; + i = obj->nSrc; move32(); FOR( j = 0; j < i; j++ ) { @@ -909,7 +937,7 @@ void ivas_shoebox_set_scene( Word32 coord; /* idx = single(i); */ - out_tmp = 3 * j; + out_tmp = L_mult0( 3, j ); /* GET COORDINATE IN CARTESIAN ABSOLUTE FORMAT */ k = out_tmp; move32(); @@ -920,7 +948,7 @@ void ivas_shoebox_set_scene( FOR( n = 0; n < loop_ub; n++ ) { - fcnOutput_data_fx[n] = src_pos_data[k + n]; + fcnOutput_data_fx[n] = src_pos_data[L_add( k, n )]; move32(); } @@ -930,7 +958,8 @@ void ivas_shoebox_set_scene( scale_fx = ER_EUCLIDEAN_SCALE_FX; move32(); out_tmp_fx = shoebox_get_euclidian_distance_internal_fx( obj, tmp_pos_fx, &scale_fx ); - q_format = sub( Q31, Q22 ); + q_format = Q31 - Q22; + move16(); out_tmp_fx = Sqrt32( out_tmp_fx, &q_format ); out_tmp_fx = Mpy_32_32( scale_fx, out_tmp_fx ); obj->src_dist_fx[j] = L_shl( out_tmp_fx, q_format ); // Q22 @@ -963,7 +992,7 @@ void ivas_shoebox_set_scene( /* Retrieve coordinate and surface sign */ coord = L_shr( loop_ub, 1 ); // tbl - rcoselev = L_add( L_add( loop_ub, 1 ), ( ER_PARAMS->n_ref * j ) ); + rcoselev = L_add( L_add( loop_ub, 1 ), L_mult( (Word16) ER_PARAMS->n_ref, j ) ); /* Initialize image position coordinates */ im_pos_fx[0] = tmp_pos_fx[0]; // Q:22 @@ -992,15 +1021,17 @@ void ivas_shoebox_set_scene( im_pos_fx[coord] = - tmp_pos_fx[coord] + - ( ( ( ( ( -( 1 - ( ( ( loop_ub + 1 ) & 1 ) << 1 ) ) ) * scale_fx ) >> 1 ) - tmp_pos_fx[coord] ) << 1 ); // Q:22 + L_add( tmp_pos_fx[coord], + L_shl( L_sub( L_shr( (Word32) W_mult0_32_32( ( L_negate( L_sub( 1, L_shl( L_and( L_add( loop_ub, 1 ), 1 ), 1 ) ) ) ), scale_fx ), 1 ), tmp_pos_fx[coord] ), 1 ) ); // Q:22 + move32(); /* 0. Get euclidean distance from IMAGE SOURCE [N,W] to LIST */ scale_fx = ER_EUCLIDEAN_SCALE_FX; // Q:22 move32(); path_dist_fx = shoebox_get_euclidian_distance_internal_fx( obj, im_pos_fx, &scale_fx ); // Uutput :Q:22 - q_format = sub( Q31, Q22 ); + q_format = Q31 - Q22; + move16(); path_dist_fx = Sqrt32( path_dist_fx, &q_format ); // Input: Q:22, Output : Q.30 path_dist_fx = Mpy_32_32( scale_fx, path_dist_fx ); // Q22 * Q = Q @@ -1009,11 +1040,13 @@ void ivas_shoebox_set_scene( /* 1. Compute time-of arrival (TOA) */ ER_PARAMS->times.data_fx[rcoselev - 1] = Mpy_32_32( path_dist_fx, obj->soundspeed_fx ); // Q.22 + move32(); /* 2./3. DOA */ sub_im_nd_list_pos_1 = L_sub( im_pos_fx[1], obj->list_pos_fx[1] ); // Q.22 sub_im_nd_list_pos_0 = L_sub( im_pos_fx[0], obj->list_pos_fx[0] ); // Q.22 - q_format = sub( Q22, Q22 ); + q_format = Q22 - Q22; + move16(); atan_pos = BASOP_util_atan2( sub_im_nd_list_pos_1, sub_im_nd_list_pos_0, q_format ); // Q.13 az_angle_d = rad2deg_fx( atan_pos ); // Q.23 ER_PARAMS->az_angle.data_fx[rcoselev - 1] = az_angle_d; @@ -1022,19 +1055,20 @@ void ivas_shoebox_set_scene( q_format = Q22; move16(); - sub_im_nd_list_div_path = BASOP_Util_Divide3232_Scale( ( im_pos_fx[2] - obj->list_pos_fx[2] ), path_dist_fx, &q_format ); + sub_im_nd_list_div_path = BASOP_Util_Divide3232_Scale( ( L_sub( im_pos_fx[2], obj->list_pos_fx[2] ) ), path_dist_fx, &q_format ); sub_im_nd_list_div_path = L_shl( sub_im_nd_list_div_path, q_format ); sub_im_nd_list_div_path = L_deposit_h( (Word16) sub_im_nd_list_div_path ); sub_im_nd_list_div_path_sq = Mpy_32_32( sub_im_nd_list_div_path, sub_im_nd_list_div_path ); sub_im_nd_list_div_path_sq = L_shr( sub_im_nd_list_div_path_sq, 1 ); one_minus_sub_im_nd_list_div_path_sq = L_sub( L_shl( 1, Q30 ), sub_im_nd_list_div_path_sq ); - q_format1 = sub( Q31, Q30 ); + q_format1 = Q31 - Q30; + move16(); one_minus_sub_im_nd_list_div_path_sq_rt = Sqrt32( one_minus_sub_im_nd_list_div_path_sq, &q_format1 ); one_minus_sub_im_nd_list_div_path_sq_rt = L_shl( one_minus_sub_im_nd_list_div_path_sq_rt, q_format1 ); - q_format_n = sub( Q31, Q31 ); + q_format_n = Q31 - Q31; asin_val = BASOP_util_atan2( sub_im_nd_list_div_path, one_minus_sub_im_nd_list_div_path_sq_rt, q_format_n ); // Q13 asin_val_deg = rad2deg_fx( asin_val ); // Q.23 @@ -1061,6 +1095,7 @@ void ivas_shoebox_set_scene( pro_pd_air_coeff = Mpy_32_32( path_dist_fx, obj->air_coeff_fx ); // Q.22 *Q.31 =Q.22 result_gain = L_sub( product, pro_pd_air_coeff ); ER_PARAMS->gains.data_fx[rcoselev - 1] = result_gain; + move32(); } } return; diff --git a/lib_rend/ivas_td_decorr.c b/lib_rend/ivas_td_decorr.c index a2aa03d69c86e518751cdd7aa71fc5a78b04978d..2e14388f82ec9d1c0af40b9054be643dbf4ed0b6 100644 --- a/lib_rend/ivas_td_decorr.c +++ b/lib_rend/ivas_td_decorr.c @@ -136,7 +136,12 @@ static Word16 ivas_get_APD_filt_orders_fx( const Word16 num_out_chans, const Wor #else static Word16 ivas_get_APD_filt_orders( const Word16 num_out_chans, const Word32 output_Fs, Word16 *APD_filt_orders ); #endif + +#ifdef IVAS_FLOAT_FIXED static void ivas_td_decorr_init( ivas_td_decorr_state_t *hTdDecorr, const Word16 num_out_chans, const Word16 ducking_flag ); +#else +static void ivas_td_decorr_init( ivas_td_decorr_state_t *hTdDecorr, const int16_t num_out_chans, const int16_t ducking_flag ); +#endif /*------------------------------------------------------------------------- * ivas_td_decorr_reconfig_dec() @@ -158,39 +163,51 @@ ivas_error ivas_td_decorr_reconfig_dec( ivas_error error; useTdDecorr_new = 0; - IF( ivas_format == SBA_FORMAT || ivas_format == SBA_ISM_FORMAT ) + move16(); + + test(); + IF( EQ_32( ivas_format, SBA_FORMAT ) || EQ_32( ivas_format, SBA_ISM_FORMAT ) ) { - IF( nchan_transport == 1 ) + if ( EQ_16( nchan_transport, 1 ) ) { useTdDecorr_new = 1; + move16(); } } - ELSE IF( ivas_format == MASA_FORMAT ) + ELSE IF( EQ_32( ivas_format, MASA_FORMAT ) ) { - IF( ( LT_32( ivas_total_brate, IVAS_48k ) && nchan_transport == 1 ) || LT_32( ivas_total_brate, MASA_STEREO_MIN_BITRATE ) ) + test(); + test(); + if ( ( LT_32( ivas_total_brate, IVAS_48k ) && EQ_16( nchan_transport, 1 ) ) || LT_32( ivas_total_brate, MASA_STEREO_MIN_BITRATE ) ) { useTdDecorr_new = 1; + move16(); } } - ELSE IF( ivas_format == MC_FORMAT ) + ELSE IF( EQ_32( ivas_format, MC_FORMAT ) ) { - IF( LT_32( ivas_total_brate, IVAS_48k ) && EQ_16( nchan_transport, 1 ) ) + test(); + if ( LT_32( ivas_total_brate, IVAS_48k ) && EQ_16( nchan_transport, 1 ) ) { useTdDecorr_new = 1; + move16(); } } - IF( *useTdDecorr != useTdDecorr_new ) + IF( NE_32( *useTdDecorr, useTdDecorr_new ) ) { *useTdDecorr = useTdDecorr_new; + move16(); IF( *useTdDecorr ) { - IF( GE_32( ivas_total_brate, IVAS_13k2 ) && ( ivas_format == SBA_FORMAT || ivas_format == SBA_ISM_FORMAT ) ) + test(); + test(); + IF( GE_32( ivas_total_brate, IVAS_13k2 ) && ( EQ_32( ivas_format, SBA_FORMAT ) || EQ_32( ivas_format, SBA_ISM_FORMAT ) ) ) { IF( *hTdDecorr == NULL ) { - IF( ( error = ivas_td_decorr_dec_open_fx( hTdDecorr, output_Fs, 3, 1 ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_td_decorr_dec_open_fx( hTdDecorr, output_Fs, 3, 1 ) ), IVAS_ERR_OK ) ) { return error; } @@ -199,17 +216,19 @@ ivas_error ivas_td_decorr_reconfig_dec( IF( LT_32( ivas_total_brate, IVAS_24k4 ) ) { ( *hTdDecorr )->pTrans_det->duck_mult_fac = IVAS_TDET_DUCK_MULT_FAC_PARA_BIN_LOW_BR; + move32(); } ELSE { ( *hTdDecorr )->pTrans_det->duck_mult_fac = IVAS_TDET_DUCK_MULT_FAC_PARA_BIN; + move32(); } } ELSE { IF( *hTdDecorr == NULL ) { - IF( ( error = ivas_td_decorr_dec_open_fx( hTdDecorr, output_Fs, 3, 0 ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_td_decorr_dec_open_fx( hTdDecorr, output_Fs, 3, 0 ) ), IVAS_ERR_OK ) ) { return error; } @@ -231,80 +250,80 @@ ivas_error ivas_td_decorr_reconfig_dec( #else ivas_error ivas_td_decorr_reconfig_dec( const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const Word32 ivas_total_brate, /* i : total IVAS bitrate */ - const Word16 nchan_transport, /* i : number of transport channels */ - const Word32 output_Fs, /* i : output sampling rate */ + const int32_t ivas_total_brate, /* i : total IVAS bitrate */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int32_t output_Fs, /* i : output sampling rate */ ivas_td_decorr_state_t **hTdDecorr, /* i/o: TD decorrelator handle */ - UWord16 *useTdDecorr /* i/o: TD decorrelator flag */ + uint16_t *useTdDecorr /* i/o: TD decorrelator flag */ ) { - UWord16 useTdDecorr_new; + uint16_t useTdDecorr_new; ivas_error error; useTdDecorr_new = 0; - IF( ivas_format == SBA_FORMAT || ivas_format == SBA_ISM_FORMAT ) + if ( ivas_format == SBA_FORMAT || ivas_format == SBA_ISM_FORMAT ) { - IF( nchan_transport == 1 ) + if ( nchan_transport == 1 ) { useTdDecorr_new = 1; } } - ELSE IF( ivas_format == MASA_FORMAT ) + else if ( ivas_format == MASA_FORMAT ) { - IF( ( LT_32( ivas_total_brate, IVAS_48k ) && nchan_transport == 1 ) || LT_32( ivas_total_brate, MASA_STEREO_MIN_BITRATE ) ) + if ( ( ivas_total_brate < IVAS_48k && nchan_transport == 1 ) || ivas_total_brate < MASA_STEREO_MIN_BITRATE ) { useTdDecorr_new = 1; } } - ELSE IF( ivas_format == MC_FORMAT ) + else if ( ivas_format == MC_FORMAT ) { - IF( LT_32( ivas_total_brate, IVAS_48k ) && EQ_16( nchan_transport, 1 ) ) + if ( ivas_total_brate < IVAS_48k && nchan_transport == 1 ) { useTdDecorr_new = 1; } } - IF( *useTdDecorr != useTdDecorr_new ) + if ( *useTdDecorr != useTdDecorr_new ) { *useTdDecorr = useTdDecorr_new; - IF( *useTdDecorr ) + if ( *useTdDecorr ) { - IF( GE_32( ivas_total_brate, IVAS_13k2 ) && ( ivas_format == SBA_FORMAT || ivas_format == SBA_ISM_FORMAT ) ) + if ( ivas_total_brate >= IVAS_13k2 && ( ivas_format == SBA_FORMAT || ivas_format == SBA_ISM_FORMAT ) ) { - IF( *hTdDecorr == NULL ) + if ( *hTdDecorr == NULL ) { - IF( ( error = ivas_td_decorr_dec_open( hTdDecorr, output_Fs, 3, 1 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_decorr_dec_open( hTdDecorr, output_Fs, 3, 1 ) ) != IVAS_ERR_OK ) { return error; } } - IF( LT_32( ivas_total_brate, IVAS_24k4 ) ) + if ( ivas_total_brate < IVAS_24k4 ) { ( *hTdDecorr )->pTrans_det->duck_mult_fac = IVAS_TDET_DUCK_MULT_FAC_PARA_BIN_LOW_BR; } - ELSE + else { ( *hTdDecorr )->pTrans_det->duck_mult_fac = IVAS_TDET_DUCK_MULT_FAC_PARA_BIN; } } - ELSE + else { - IF( *hTdDecorr == NULL ) + if ( *hTdDecorr == NULL ) { - IF( ( error = ivas_td_decorr_dec_open( hTdDecorr, output_Fs, 3, 0 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_decorr_dec_open( hTdDecorr, output_Fs, 3, 0 ) ) != IVAS_ERR_OK ) { return error; } } - ELSE + else { ivas_td_decorr_init( *hTdDecorr, 3, 0 ); } } } - ELSE + else { ivas_td_decorr_dec_close( hTdDecorr ); } @@ -329,32 +348,39 @@ ivas_error ivas_td_decorr_dec_open_fx( ) { Word16 i, j, len; - Word16 num_out_chans; + Word16 num_out_chans, buf_len; ivas_td_decorr_state_t *hTdDecorr_loc; ivas_error error; - num_out_chans = nchan_internal - 1; + buf_len = extract_l( Mpy_32_32( output_Fs, 4294968 ) ); + // IVAS_DECORR_PARM_LOOKAHEAD_TAU * 2 ^ 31 -> 4294968 + + num_out_chans = sub( nchan_internal, 1 ); error = IVAS_ERR_OK; + move32(); IF( ( hTdDecorr_loc = (ivas_td_decorr_state_t *) malloc( sizeof( ivas_td_decorr_state_t ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory FOR SPAR COV decoder" ); } - IF( ( hTdDecorr_loc->look_ahead_buf = (Word32 *) malloc( sizeof( Word32 ) * (Word16) ( output_Fs * IVAS_DECORR_PARM_LOOKAHEAD_TAU ) ) ) == NULL ) + IF( ( hTdDecorr_loc->look_ahead_buf = (Word32 *) malloc( sizeof( Word32 ) * buf_len ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory FOR SPAR COV decoder" ); } - set32_fx( hTdDecorr_loc->look_ahead_buf, 0, (Word16) ( output_Fs * IVAS_DECORR_PARM_LOOKAHEAD_TAU ) ); - hTdDecorr_loc->offset = (Word16) ( output_Fs * IVAS_DECORR_PARM_LOOKAHEAD_TAU ); + set32_fx( hTdDecorr_loc->look_ahead_buf, 0, buf_len ); + hTdDecorr_loc->offset = buf_len; hTdDecorr_loc->num_apd_sections = ivas_get_APD_filt_orders_fx( num_out_chans, output_Fs, hTdDecorr_loc->APD_filt_state[0].order ); + move16(); + move16(); FOR( j = 0; j < num_out_chans; j++ ) { FOR( i = 0; i < hTdDecorr_loc->num_apd_sections; i++ ) { len = hTdDecorr_loc->APD_filt_state[0].order[i]; + move16(); IF( ( hTdDecorr_loc->APD_filt_state[j].state[i] = (Word32 *) malloc( sizeof( Word32 ) * len ) ) == NULL ) { @@ -369,7 +395,7 @@ ivas_error ivas_td_decorr_dec_open_fx( IF( ducking_flag ) { - IF( ( error = ivas_transient_det_open( &hTdDecorr_loc->pTrans_det, output_Fs ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_transient_det_open( &hTdDecorr_loc->pTrans_det, output_Fs ) ), IVAS_ERR_OK ) ) { return error; } @@ -466,6 +492,7 @@ void ivas_td_decorr_dec_close( { Word16 i, j; + test(); IF( hTdDecorr == NULL || *hTdDecorr == NULL ) { return; @@ -508,6 +535,7 @@ static Word16 ivas_get_APD_filt_orders_fx( { Word16 i; Word16 num_apd_sections = 0; + move16(); Word32 sum_R, R[IVAS_MAX_DECORR_APD_SECTIONS]; SWITCH( num_out_chans ) @@ -515,16 +543,19 @@ static Word16 ivas_get_APD_filt_orders_fx( case IVAS_TD_DECORR_OUT_1CH: case IVAS_TD_DECORR_OUT_2CH: num_apd_sections = IVAS_APD_2_SECT; + move16(); BREAK; case IVAS_TD_DECORR_OUT_3CH: case IVAS_TD_DECORR_OUT_4CH: num_apd_sections = IVAS_APD_4_SECT; + move16(); BREAK; case IVAS_TD_DECORR_OUT_5CH: case IVAS_TD_DECORR_OUT_6CH: case IVAS_TD_DECORR_OUT_7CH: case IVAS_TD_DECORR_OUT_8CH: num_apd_sections = IVAS_APD_8_SECT; + move16(); BREAK; default: assert( !"Invalid num out chans" ); @@ -532,15 +563,18 @@ static Word16 ivas_get_APD_filt_orders_fx( } sum_R = 0; + move32(); FOR( i = 0; i < num_apd_sections; i++ ) { R[i] = ivas_three_pow_frac[i]; + move32(); sum_R = L_add( sum_R, R[i] ); } FOR( i = 0; i < num_apd_sections; i++ ) { - APD_filt_orders[i] = (Word16) L_shr( Mpy_32_32( L_shl( output_Fs, Q15 ), Mpy_32_32( IVAS_DECORR_PARM_APD_TAU, L_shl( (Word32) divide3232( R[i], sum_R ), Q15 ) ) ), Q14 ) + 1; + APD_filt_orders[i] = (Word16) L_add( L_shr( Mpy_32_32( L_shl( output_Fs, Q15 ), Mpy_32_32( IVAS_DECORR_PARM_APD_TAU, L_shl( (Word32) divide3232( R[i], sum_R ), Q15 ) ) ), Q14 ), 1 ); + move16(); } return num_apd_sections; @@ -604,6 +638,7 @@ static int16_t ivas_get_APD_filt_orders( * TD decorr Initialisation function *-----------------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void ivas_td_decorr_init( ivas_td_decorr_state_t *hTdDecorr, /* i/o: TD decorrelator handle */ const int16_t num_out_chans, /* i : number of channels */ @@ -627,6 +662,37 @@ static void ivas_td_decorr_init( return; } +#else +static void ivas_td_decorr_init( + ivas_td_decorr_state_t *hTdDecorr, /* i/o: TD decorrelator handle */ + const Word16 num_out_chans, /* i : number of channels */ + const Word16 ducking_flag /* i : TD ducking flag */ +) +{ + Word16 i, j; + + hTdDecorr->ducking_flag = ducking_flag; + hTdDecorr->num_apd_outputs = num_out_chans; + move16(); + move16(); + + FOR( i = 0; i < hTdDecorr->num_apd_outputs; i++ ) + { + FOR( j = 0; j < hTdDecorr->num_apd_sections; j++ ) + { + hTdDecorr->APD_filt_state[i].order[j] = hTdDecorr->APD_filt_state[0].order[j]; + hTdDecorr->APD_filt_state[i].coeffs[j] = ivas_hadamard_decorr_APD_coeff[i][j]; + hTdDecorr->APD_filt_state[i].idx[j] = 0; + + move16(); + move16(); + move16(); + } + } + + return; +} +#endif #ifndef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------------------------* @@ -777,23 +843,31 @@ void ivas_td_decorr_APD_iir_filter_fx( Word32 *pFilt_state = filter_state->state[k]; Word16 filt_coeff = filter_state->coeffs[k]; Word16 order = filter_state->order[k]; + move16(); + move16(); idx = filter_state->idx[k]; + move16(); FOR( i = 0; i < length; i++ ) { tmp_pIn_buf_i = pIn[i]; + move32(); pOut[i] = Madd_32_16( pFilt_state[idx], pIn[i], filt_coeff ); + move32(); pFilt_state[idx++] = Msub_32_16( tmp_pIn_buf_i, pOut[i], filt_coeff ); + move32(); - IF( order == idx ) + if ( EQ_16( order, idx ) ) { idx = 0; + move16(); } } filter_state->idx[k] = idx; + move16(); } return; @@ -832,11 +906,12 @@ void ivas_td_decorr_process_fx( const Word16 output_frame, /* i : output frame length */ Word16 *q_format ) { + UNUSED_PARAM( *q_format ); Word16 i, j; Word32 in_duck_gain[L_FRAME48k], out_duck_gain[L_FRAME48k]; /* Look-ahead delay */ - mvl2l( pcm_in[0], ppOut_pcm[0], output_frame ); + Copy32( pcm_in[0], ppOut_pcm[0], output_frame ); delay_signal_fx( ppOut_pcm[0], output_frame, hTdDecorr->look_ahead_buf, hTdDecorr->offset ); /* In ducking gains */ @@ -847,13 +922,13 @@ void ivas_td_decorr_process_fx( FOR( j = 0; j < output_frame; j++ ) { ppOut_pcm[0][j] = L_shl( Mpy_32_32( ppOut_pcm[0][j], in_duck_gain[j] ), 1 ); + move32(); } - *q_format -= 0; } FOR( i = 1; i < hTdDecorr->num_apd_outputs; i++ ) { - mvl2l( ppOut_pcm[0], ppOut_pcm[i], output_frame ); + Copy32( ppOut_pcm[0], ppOut_pcm[i], output_frame ); } /* All pass delay section */ @@ -867,9 +942,9 @@ void ivas_td_decorr_process_fx( FOR( j = 0; j < output_frame; j++ ) { ppOut_pcm[i][j] = L_shl( Mpy_32_32( ppOut_pcm[i][j], out_duck_gain[j] ), 1 ); + move32(); } } - *q_format -= 0; } return; diff --git a/lib_rend/ivas_vbap.c b/lib_rend/ivas_vbap.c index a69c706090fa5289e9f0f7c371045092ccc9e51c..bc8090c7a71161984abb0d3f17774527db58d9e4 100644 --- a/lib_rend/ivas_vbap.c +++ b/lib_rend/ivas_vbap.c @@ -141,7 +141,7 @@ static UWord8 vector_matrix_multiply_3x3_32_fx( const Word32 *src_vector, Word32 static void init_speaker_node_direction_data_fx( VBAP_SPEAKER_NODE *speaker_node_data, const Word32 *speaker_node_azi_deg_fx, const Word32 *speaker_node_ele_deg_fx, const int16_t num_speaker_nodes ); -static int16_t determine_virtual_surface_triplets_fx( const int16_t num_speaker_nodes, const VBAP_SPEAKER_NODE *speaker_node_data, int16_t connections[][2], const int16_t max_num_connections, VBAP_VS_TRIPLET *triplets, int16_t initial_search_indices[VBAP_NUM_SEARCH_SECTORS], enum SpeakerNodeGroup allowed_group ); +static Word16 determine_virtual_surface_triplets_fx( const Word16 num_speaker_nodes, const VBAP_SPEAKER_NODE *speaker_node_data, Word16 connections[][2], const Word16 max_num_connections, VBAP_VS_TRIPLET *triplets, Word16 initial_search_indices[VBAP_NUM_SEARCH_SECTORS], enum SpeakerNodeGroup allowed_group ); static void determine_initial_search_indices_fx( const int16_t num_triplets, const Word32 triplet_azidegs_fx[VBAP_MAX_NUM_TRIPLETS], int16_t initial_search_indices[VBAP_NUM_SEARCH_SECTORS] ); @@ -231,6 +231,7 @@ ivas_error vbap_init_data_fx( /* If the requested layout is invalid, hVBAPdata is set to NULL and the signal will * be distributed with an equal gain into all output channels. * The surrounding code needs to handle the NULL pointer properly. */ + test(); IF( GT_16( num_speaker_nodes, VBAP_MAX_NUM_SPEAKER_NODES ) || LT_16( num_speaker_nodes, 3 ) ) { hVBAPdata = NULL; @@ -238,6 +239,7 @@ ivas_error vbap_init_data_fx( return IVAS_ERR_OK; } + test(); IF( !speaker_node_azi_deg_fx || !speaker_node_ele_deg_fx ) { hVBAPdata = NULL; @@ -251,6 +253,7 @@ ivas_error vbap_init_data_fx( } is_success = 1; + move16(); vbap->bottom_virtual_speaker_node_index = -1; move16(); vbap->top_virtual_speaker_node_index = -1; @@ -299,6 +302,8 @@ ivas_error vbap_init_data_fx( } speaker_node_azi_deg_internal_fx[vbap->bottom_virtual_speaker_node_index] = 0; speaker_node_ele_deg_internal_fx[vbap->bottom_virtual_speaker_node_index] = -377487360; /*-90.0f in Q22*/ + move32(); + move32(); } test(); IF( is_success && NE_16( virtual_top_type, NO_VIRTUAL_SPEAKER_NODE ) ) @@ -321,6 +326,8 @@ ivas_error vbap_init_data_fx( } speaker_node_azi_deg_internal_fx[vbap->top_virtual_speaker_node_index] = 0; speaker_node_ele_deg_internal_fx[vbap->top_virtual_speaker_node_index] = 377487360; /*90.0f in Q22*/ + move32(); + move16(); } test(); IF( is_success && NE_16( virtual_back_type, NO_VIRTUAL_SPEAKER_NODE ) ) @@ -343,6 +350,9 @@ ivas_error vbap_init_data_fx( } speaker_node_azi_deg_internal_fx[vbap->back_virtual_speaker_node_index] = 754974720; speaker_node_ele_deg_internal_fx[vbap->back_virtual_speaker_node_index] = 0; + + move32(); + move16(); } init_speaker_node_direction_data_fx( speaker_node_data, speaker_node_azi_deg_internal_fx, speaker_node_ele_deg_internal_fx, vbap->num_speaker_nodes_internal ); #ifdef TRUE0 @@ -359,7 +369,7 @@ ivas_error vbap_init_data_fx( /* Allocate and determine node-node connections */ max_num_connections = mult0( ( sub( vbap->num_speaker_nodes_internal, 2 ) ), 3 ); /* Theoretical maximum */ - IF( ( error = determine_connections_fx( vbap->num_speaker_nodes_internal, speaker_node_data, connections, max_num_connections, &connection_group1_count, &connection_group2_start, &connection_group2_count ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = determine_connections_fx( vbap->num_speaker_nodes_internal, speaker_node_data, connections, max_num_connections, &connection_group1_count, &connection_group2_start, &connection_group2_count ) ), IVAS_ERR_OK ) ) { return error; } @@ -373,7 +383,7 @@ ivas_error vbap_init_data_fx( move16(); Word16 speaker_nodes_horiz_internal = 0; move16(); - uint8_t loop_done = 0; + UWord8 loop_done = 0; /* Count nodes in different groups to reserve correct memory */ FOR( ch = 0; ch < vbap->num_speaker_nodes_internal && !loop_done; ch++ ) @@ -409,7 +419,7 @@ ivas_error vbap_init_data_fx( } is_success &= vbap->search_struct[0].triplets != NULL; - IF( GT_16( speaker_nodes_group2_internal, 0 ) ) + IF( speaker_nodes_group2_internal > 0 ) { vbap->num_search_structs = 2; move16(); @@ -446,10 +456,12 @@ ivas_error vbap_init_data_fx( IF( is_success ) { Word16 max_exp = 31; + move16(); + determine_virtual_speaker_node_division_gains_fx( vbap->top_virtual_speaker_node_index, vbap->top_virtual_speaker_node_division_gains_fx, &max_exp, connections, virtual_top_type, max_num_connections, num_speaker_nodes, 0 ); determine_virtual_speaker_node_division_gains_fx( vbap->bottom_virtual_speaker_node_index, vbap->bottom_virtual_speaker_node_division_gains_fx, &max_exp, connections, virtual_bottom_type, max_num_connections, num_speaker_nodes, 0 ); determine_virtual_speaker_node_division_gains_fx( vbap->back_virtual_speaker_node_index, vbap->back_virtual_speaker_node_division_gains_fx, &max_exp, connections, virtual_back_type, max_num_connections, num_speaker_nodes, 0 ); - IF( ivas_format == MASA_ISM_FORMAT ) + IF( EQ_32( ivas_format, MASA_ISM_FORMAT ) ) { determine_virtual_speaker_node_division_gains_fx( vbap->top_virtual_speaker_node_index, vbap->object_mode_top_virtual_speaker_node_division_gains_fx, &max_exp, connections, virtual_top_type == NO_VIRTUAL_SPEAKER_NODE ? NO_VIRTUAL_SPEAKER_NODE : VIRTUAL_SPEAKER_NODE_DISTRIBUTE_ENERGY, max_num_connections, num_speaker_nodes, 1 ); determine_virtual_speaker_node_division_gains_fx( vbap->bottom_virtual_speaker_node_index, vbap->object_mode_bottom_virtual_speaker_node_division_gains_fx, &max_exp, connections, virtual_bottom_type == NO_VIRTUAL_SPEAKER_NODE ? NO_VIRTUAL_SPEAKER_NODE : VIRTUAL_SPEAKER_NODE_DISTRIBUTE_ENERGY, max_num_connections, num_speaker_nodes, 1 ); @@ -731,6 +743,7 @@ void vbap_free_data_fx( VBAP_HANDLE *hVBAPdata /* i/o: VBAP handle to be freed */ ) { + test(); IF( hVBAPdata == NULL || *hVBAPdata == NULL ) { return; @@ -760,11 +773,13 @@ void vbap_free_data_fx( { free( ( *hVBAPdata )->object_mode_back_virtual_speaker_node_division_gains_fx ); } - if ( ( *hVBAPdata )->search_struct[0].triplets != NULL ) + IF( ( *hVBAPdata )->search_struct[0].triplets != NULL ) { free( ( *hVBAPdata )->search_struct[0].triplets ); } - if ( ( *hVBAPdata )->num_search_structs == 2 && ( *hVBAPdata )->search_struct[1].triplets != NULL ) + + test(); + IF( EQ_16( ( *hVBAPdata )->num_search_structs, 2 ) && ( *hVBAPdata )->search_struct[1].triplets != NULL ) { free( ( *hVBAPdata )->search_struct[1].triplets ); } @@ -889,9 +904,13 @@ void vbap_determine_gains_fx( panning_unit_vec_fx[0] = mult( getCosWord16R2( (Word16) azi_norm ), getCosWord16R2( (Word16) ele_norm ) ); panning_unit_vec_fx[1] = mult( getSineWord16R2( (Word16) azi_norm ), getCosWord16R2( (Word16) ele_norm ) ); panning_unit_vec_fx[2] = getSineWord16R2( (Word16) ele_norm ); + move16(); + move16(); + /* Find the best VS triplet and speaker node gains for the panning direction using the prepared search structures. */ - IF( EQ_16( hVBAPdata->num_search_structs, 2 ) && GT_16( ele_deg, 0 ) ) + test(); + IF( EQ_16( hVBAPdata->num_search_structs, 2 ) && ele_deg > 0 ) { triplet_index = determine_best_triplet_and_gains_fx( &( hVBAPdata->search_struct[1] ), panning_unit_vec_fx, azi_deg, gain_triplet_fx ); move16(); @@ -917,11 +936,13 @@ void vbap_determine_gains_fx( FOR( ch = 0; ch < 3; ch++ ) { gain_triplet_fx[ch] = Mpy_32_32( gain_triplet_fx[ch], norm_value_fx ); // Q16 + move32(); /* Sanity check for rounding issues */ - IF( LT_32( gain_triplet_fx[ch], 0 ) ) + if ( gain_triplet_fx[ch] < 0 ) { gain_triplet_fx[ch] = 0; + move32(); } } @@ -938,6 +959,7 @@ void vbap_determine_gains_fx( FOR( ch2 = 0; ch2 < num_speaker_nodes; ch2++ ) { gains_fx[ch2] = L_add( gains_fx[ch2], L_shl( Mpy_32_16_1( gain_triplet_fx[ch], bottom_virtual_speaker_node_division_gains_fx[ch2] ), 13 ) ); // Q29 + move32(); } } ELSE IF( EQ_16( triplet_ch, top_virtual_speaker_node_index ) ) @@ -945,6 +967,7 @@ void vbap_determine_gains_fx( FOR( ch2 = 0; ch2 < num_speaker_nodes; ch2++ ) { gains_fx[ch2] = L_add( gains_fx[ch2], L_shl( Mpy_32_16_1( gain_triplet_fx[ch], top_virtual_speaker_node_division_gains_fx[ch2] ), 13 ) ); // Q29 + move32(); } } ELSE IF( EQ_16( triplet_ch, back_virtual_speaker_node_index ) ) @@ -952,11 +975,13 @@ void vbap_determine_gains_fx( FOR( ch2 = 0; ch2 < num_speaker_nodes; ch2++ ) { gains_fx[ch2] = L_add( gains_fx[ch2], L_shl( Mpy_32_16_1( gain_triplet_fx[ch], back_virtual_speaker_node_division_gains_fx[ch2] ), 13 ) ); // Q29 + move32(); } } ELSE { gains_fx[triplet_ch] = L_add( gains_fx[triplet_ch], L_shl( gain_triplet_fx[ch], 13 ) ); // Q29 + move32(); } } @@ -1144,7 +1169,7 @@ static void vbap_crossp( #ifdef IVAS_FLOAT_FIXED /*! r: Status result if triplet is usable for panning. Allows early exit. */ -static uint8_t vector_matrix_multiply_3x3_fx( +static UWord8 vector_matrix_multiply_3x3_fx( const Word16 *src_vector, /* i : input vector */ Word32 matrix[3][3], /* i : input matrix */ Word32 *result, /* o : output vector */ @@ -1153,8 +1178,11 @@ static uint8_t vector_matrix_multiply_3x3_fx( result[0] = Mpy_32_16_1( matrix[0][0], src_vector[0] ); // q = q_matrix result[0] = L_add( result[0], Mpy_32_16_1( matrix[1][0], src_vector[1] ) ); result[0] = L_add( result[0], Mpy_32_16_1( matrix[2][0], src_vector[2] ) ); + move32(); + move32(); + move32(); - IF( result[0] < Mpy_32_16_1( 1 << q_matrix, -327 ) ) // 327 = 0.01 in Q = 15 + IF( LT_32( result[0], Mpy_32_16_1( L_lshl( 1, q_matrix ), -327 ) ) ) // 327 = 0.01 in Q = 15 { return 0; } @@ -1162,8 +1190,11 @@ static uint8_t vector_matrix_multiply_3x3_fx( result[1] = Mpy_32_16_1( matrix[0][1], src_vector[0] ); result[1] = L_add( result[1], Mpy_32_16_1( matrix[1][1], src_vector[1] ) ); result[1] = L_add( result[1], Mpy_32_16_1( matrix[2][1], src_vector[2] ) ); + move32(); + move32(); + move32(); - IF( result[1] < Mpy_32_16_1( 1 << q_matrix, -327 ) ) + IF( LT_32( result[1], Mpy_32_16_1( L_shl( 1, q_matrix ), -327 ) ) ) { return 0; } @@ -1171,8 +1202,11 @@ static uint8_t vector_matrix_multiply_3x3_fx( result[2] = Mpy_32_16_1( matrix[0][2], src_vector[0] ); result[2] = L_add( result[2], Mpy_32_16_1( matrix[1][2], src_vector[1] ) ); result[2] = L_add( result[2], Mpy_32_16_1( matrix[2][2], src_vector[2] ) ); + move32(); + move32(); + move32(); - IF( result[2] < Mpy_32_16_1( 1 << q_matrix, -327 ) ) + IF( LT_32( result[2], Mpy_32_16_1( L_shl( 1, q_matrix ), -327 ) ) ) { return 0; } @@ -1180,7 +1214,7 @@ static uint8_t vector_matrix_multiply_3x3_fx( return 1; } -static uint8_t vector_matrix_multiply_3x3_32_fx( +static UWord8 vector_matrix_multiply_3x3_32_fx( const Word32 *src_vector, /* i : input vector */ Word32 matrix[3][3], /* i : input matrix */ Word32 *result, /* o : output vector */ @@ -1189,8 +1223,10 @@ static uint8_t vector_matrix_multiply_3x3_32_fx( result[0] = Mpy_32_32( matrix[0][0], src_vector[0] ); // q = ( q_matrix + 30 ) - 31 result[0] = L_add( result[0], Mpy_32_32( matrix[1][0], src_vector[1] ) ); result[0] = L_add( result[0], Mpy_32_32( matrix[2][0], src_vector[2] ) ); - - IF( result[0] < Mpy_32_32( L_shl( 1, ( q_matrix - 1 ) ), -21474836 ) ) // 21474836 = 0.01 in Q = 31 + move32(); + move32(); + move32(); + IF( LT_32( result[0], Mpy_32_32( L_shl( 1, ( sub( q_matrix, 1 ) ) ), -21474836 ) ) ) // 21474836 = 0.01 in Q = 31 { return 0; } @@ -1198,7 +1234,11 @@ static uint8_t vector_matrix_multiply_3x3_32_fx( result[1] = Mpy_32_32( matrix[0][1], src_vector[0] ); result[1] = L_add( result[1], Mpy_32_32( matrix[1][1], src_vector[1] ) ); result[1] = L_add( result[1], Mpy_32_32( matrix[2][1], src_vector[2] ) ); - IF( result[1] < Mpy_32_32( L_shl( 1, ( q_matrix - 1 ) ), -21474836 ) ) // 21474836 = 0.01 in Q = 31 + + move32(); + move32(); + move32(); + IF( LT_32( result[1], Mpy_32_32( L_shl( 1, ( sub( q_matrix, 1 ) ) ), -21474836 ) ) ) // 21474836 = 0.01 in Q = 31 { return 0; } @@ -1207,7 +1247,10 @@ static uint8_t vector_matrix_multiply_3x3_32_fx( result[2] = L_add( result[2], Mpy_32_32( matrix[1][2], src_vector[1] ) ); result[2] = L_add( result[2], Mpy_32_32( matrix[2][2], src_vector[2] ) ); - IF( result[2] < Mpy_32_32( L_shl( 1, ( q_matrix - 1 ) ), -21474836 ) ) // 21474836 = 0.01 in Q = 31 + move32(); + move32(); + move32(); + IF( LT_32( result[2], Mpy_32_32( L_shl( 1, ( sub( q_matrix, 1 ) ) ), -21474836 ) ) ) // 21474836 = 0.01 in Q = 31 { return 0; } @@ -1327,14 +1370,14 @@ static Word16 determine_best_triplet_and_gains_fx( gains_fx[k] = unnormalized_gains_fx[k]; move32(); } - IF( !( best_min_gain_fx < 0 ) ) + IF( best_min_gain_fx >= 0 ) { return best_triplet; } } } tr = add( first_triplet, jump ); - IF( LT_16( tr, 0 ) ) + IF( tr < 0 ) { tr = add( tr, num_triplets ); } @@ -1344,7 +1387,7 @@ static Word16 determine_best_triplet_and_gains_fx( } jump = negate( jump ); - IF( GT_16( jump, 0 ) ) + IF( jump > 0 ) { jump = add( jump, 1 ); } @@ -1480,7 +1523,7 @@ static void determine_virtual_speaker_node_division_gains_fx( /* The second condition allows division gains only to actual loudspeakers */ test(); - IF( GE_16( connection_node, 0 ) && ( LT_16( connection_node, num_speaker_nodes ) ) ) + IF( connection_node > 0 && ( LT_16( connection_node, num_speaker_nodes ) ) ) { virtual_node_division_gains_fx[connection_node] = ONE_IN_Q14; move16(); @@ -1499,11 +1542,12 @@ static void determine_virtual_speaker_node_division_gains_fx( } Word16 final_exp = 0, res_exp; Word32 tmp_1, tmp_2, tmp_3; + move16(); FOR( ch = 0; ch < num_speaker_nodes; ch++ ) { - IF( NE_16( virtual_node_division_gains_fx[ch], 0 ) ) + IF( virtual_node_division_gains_fx[ch] != 0 ) { - BASOP_Util_Divide_MantExp( virtual_node_division_gains_fx[ch], 1, sum_val_fx, 1 + guard_bits, &virtual_node_division_gains_fx[ch], &final_exp ); // Q15 + BASOP_Util_Divide_MantExp( virtual_node_division_gains_fx[ch], 1, sum_val_fx, add( guard_bits, 1 ), &virtual_node_division_gains_fx[ch], &final_exp ); // Q15 } ELSE { @@ -1514,7 +1558,7 @@ static void determine_virtual_speaker_node_division_gains_fx( move16(); IF( use_object_mode ) { - IF( EQ_16( virtual_node_division_gains_fx[ch], 0 ) ) + IF( virtual_node_division_gains_fx[ch] == 0 ) { tmp_1 = 0; move16(); @@ -1530,6 +1574,7 @@ static void determine_virtual_speaker_node_division_gains_fx( exp_virtual_node_division_gains[ch] = res_exp; move16(); virtual_node_division_gains_fx[ch] = extract_h( tmp_3 ); + move16(); } } } @@ -1539,10 +1584,12 @@ static void determine_virtual_speaker_node_division_gains_fx( FOR( i = 0; i < num_speaker_nodes; i++ ) { *max_exp = s_max( *max_exp, exp_virtual_node_division_gains[i] ); + move16(); } FOR( i = 0; i < num_speaker_nodes; i++ ) { virtual_node_division_gains_fx[i] = shr( virtual_node_division_gains_fx[i], sub( *max_exp, exp_virtual_node_division_gains[i] ) ); + move16(); } } @@ -1631,6 +1678,7 @@ static enum VirtualSpeakerNodeType check_need_of_virtual_speaker_node_fx( Word16 ch; Word32 max_elevation_fx = 0; Word16 Flag1, Flag2, Flag3; + move32(); /* The following considers if SPEAKER_NODE_BACK virtual speaker is needed */ IF( EQ_16( group, SPEAKER_NODE_BACK ) ) @@ -1641,20 +1689,19 @@ static enum VirtualSpeakerNodeType check_need_of_virtual_speaker_node_fx( move16(); FOR( ch = 0; ch < hVBAPdata->num_speaker_nodes; ch++ ) { - Flag1 = BASOP_Util_Cmp_Mant32Exp( speaker_node_ele_deg_fx[ch], 31 - Q22, 23040 /*45.0f Q9*/, 31 - Q9 ); + Flag1 = BASOP_Util_Cmp_Mant32Exp( speaker_node_ele_deg_fx[ch], Q31 - Q22, 23040 /*45.0f Q9*/, Q31 - Q9 ); IF( EQ_16( Flag1, (Word16) -1 ) ) { Word16 azi_temp; azi_temp = extract_l( L_shr( Mpy_32_32( speaker_node_azi_deg_fx[ch], ONE_BY_180_Q31 ), Q8 ) ); /* Q15 */ - - Word16 cos_res = getCosWord16R2( azi_temp ); // Q15 + Word16 cos_res = getCosWord16R2( azi_temp ); // Q15 IF( LT_16( cos_res, virtual_back_epsilon_fx ) ) { virtual_back_needed = 0; move16(); - break; + BREAK; } } } @@ -1664,6 +1711,7 @@ static enum VirtualSpeakerNodeType check_need_of_virtual_speaker_node_fx( hVBAPdata->back_virtual_speaker_node_index = hVBAPdata->num_speaker_nodes_internal; move16(); hVBAPdata->num_speaker_nodes_internal = add( hVBAPdata->num_speaker_nodes_internal, 1 ); + move16(); return VIRTUAL_SPEAKER_NODE_DISTRIBUTE_ENERGY; } @@ -1675,7 +1723,7 @@ static enum VirtualSpeakerNodeType check_need_of_virtual_speaker_node_fx( { IF( EQ_16( group, SPEAKER_NODE_TOP_HALF ) ) { - IF( GT_32( speaker_node_ele_deg_fx[ch], max_elevation_fx ) ) + if ( GT_32( speaker_node_ele_deg_fx[ch], max_elevation_fx ) ) { max_elevation_fx = speaker_node_ele_deg_fx[ch]; move32(); @@ -1689,7 +1737,7 @@ static enum VirtualSpeakerNodeType check_need_of_virtual_speaker_node_fx( } } } - Flag2 = BASOP_Util_Cmp_Mant32Exp( max_elevation_fx, 31 - Q22, 23039 /*44.9990005 Q9*/, 31 - Q9 ); + Flag2 = BASOP_Util_Cmp_Mant32Exp( max_elevation_fx, Q31 - Q22, 23039 /*44.9990005 Q9*/, Q31 - Q9 ); IF( EQ_16( Flag2, 1 ) ) { return NO_VIRTUAL_SPEAKER_NODE; @@ -1708,7 +1756,8 @@ static enum VirtualSpeakerNodeType check_need_of_virtual_speaker_node_fx( } hVBAPdata->num_speaker_nodes_internal = add( hVBAPdata->num_speaker_nodes_internal, 1 ); - Flag3 = BASOP_Util_Cmp_Mant32Exp( max_elevation_fx, 31 - Q22, 20478 /*19.9990005 Q10*/, 31 - Q10 ); + move16(); + Flag3 = BASOP_Util_Cmp_Mant32Exp( max_elevation_fx, Q31 - Q22, 20478 /*19.9990005 Q10*/, Q31 - Q10 ); IF( EQ_16( Flag3, 1 ) ) { @@ -1821,7 +1870,10 @@ static void init_speaker_node_direction_data_fx( Word16 num_horiz = 0; UWord8 in_all_mode = TRUE; - + move32(); + move32(); + move32(); + move16(); FOR( ch = 0; ch < num_speaker_nodes; ch++ ) { speaker_node_data[ch].azi_deg_fx = speaker_node_azi_deg_fx[ch]; @@ -1845,7 +1897,7 @@ static void init_speaker_node_direction_data_fx( move32(); ele_rad_fx = extract_l( L_shr( Mpy_32_32( speaker_node_ele_deg_fx[ch], ONE_BY_180_Q31 ), Q8 ) ); - IF( LT_16( ele_rad_fx, 0 ) ) + IF( ele_rad_fx < 0 ) { speaker_node_data[ch].group = SPEAKER_NODE_BOTTOM_HALF; move16(); @@ -1874,6 +1926,7 @@ static void init_speaker_node_direction_data_fx( UWord16 temp; i = 0; + move16(); FOR( ch = 0; ch < num_speaker_nodes && i < num_horiz; ch++ ) { IF( EQ_16( speaker_node_data[ch].group, SPEAKER_NODE_HORIZONTAL ) ) @@ -1881,9 +1934,9 @@ static void init_speaker_node_direction_data_fx( Word16 exp1; Word32 Mant2 = BASOP_Util_Add_Mant32Exp( speaker_node_azi_deg_fx[ch], 31 - 22, 23040, 31 - 6, &exp1 ); - IF( LT_32( L_shr( speaker_node_azi_deg_fx[ch], 22 ), 0 ) ) + IF( L_shr( speaker_node_azi_deg_fx[ch], 22 ) < 0 ) { - horiz_azi[i] = (UWord16) L_shr( Mant2, 31 - exp1 ); + horiz_azi[i] = (UWord16) L_shr( Mant2, sub( 31, exp1 ) ); } ELSE { @@ -1902,7 +1955,7 @@ static void init_speaker_node_direction_data_fx( FOR( ch = 0; ch < sub( num_horiz, 1 ); ch++ ) { temp = sub( horiz_azi[ch + 1], horiz_azi[ch] ); - IF( GT_16( temp, largest_gap ) ) + if ( GT_16( temp, largest_gap ) ) { largest_gap = temp; move16(); @@ -1911,9 +1964,10 @@ static void init_speaker_node_direction_data_fx( /* If largest gap is small enough, we have definitive zero elevation plane. * Otherwise, we should assign all speaker nodes to one group. */ - IF( LE_16( largest_gap, VBAP_MAX_HORIZONTAL_GAP ) ) + if ( LE_16( largest_gap, VBAP_MAX_HORIZONTAL_GAP ) ) { in_all_mode = FALSE; + move16(); } } @@ -2047,12 +2101,16 @@ static void matrix_inverse_3x3_32_fx( vbap_crossp_fx( input_matrix_fx[1], input_matrix_fx[2], cross_vec_fx ); determinant_fx = dotp_fixed( input_matrix_fx[0], cross_vec_fx, 3 ); // Q30 + Q29 - Q31 = Q28 Word16 inv_mat_exp = 0; + move16(); FOR( k = 0; k < 3; k++ ) { inverse_matrix_fx[k][0] = L_deposit_h( BASOP_Util_Divide3232_Scale( cross_vec_fx[k], determinant_fx, &inv_mat_exp ) ); - inv_mat_exp = inv_mat_exp + ( ( 31 - 29 ) - ( 31 - 28 ) ); + inv_mat_exp = add( inv_mat_exp, ( ( 31 - 29 ) - ( 31 - 28 ) ) ); exp_inverse_matrix_fx[k][0] = inv_mat_exp; + + move32(); + move16(); } vbap_crossp_fx( input_matrix_fx[2], input_matrix_fx[0], cross_vec_fx ); @@ -2060,8 +2118,11 @@ static void matrix_inverse_3x3_32_fx( FOR( k = 0; k < 3; k++ ) { inverse_matrix_fx[k][1] = L_deposit_h( BASOP_Util_Divide3232_Scale( cross_vec_fx[k], determinant_fx, &inv_mat_exp ) ); - inv_mat_exp = inv_mat_exp + ( ( 31 - 29 ) - ( 31 - 28 ) ); + inv_mat_exp = add( inv_mat_exp, ( ( 31 - 29 ) - ( 31 - 28 ) ) ); exp_inverse_matrix_fx[k][1] = inv_mat_exp; + + move32(); + move16(); } vbap_crossp_fx( input_matrix_fx[0], input_matrix_fx[1], cross_vec_fx ); @@ -2069,8 +2130,10 @@ static void matrix_inverse_3x3_32_fx( FOR( k = 0; k < 3; k++ ) { inverse_matrix_fx[k][2] = L_deposit_h( BASOP_Util_Divide3232_Scale( cross_vec_fx[k], determinant_fx, &inv_mat_exp ) ); - inv_mat_exp = inv_mat_exp + ( ( 31 - 29 ) - ( 31 - 28 ) ); + move32(); + inv_mat_exp = add( inv_mat_exp, ( ( 31 - 29 ) - ( 31 - 28 ) ) ); exp_inverse_matrix_fx[k][2] = inv_mat_exp; + move16(); } /*make common exponant*/ @@ -2083,20 +2146,25 @@ static void matrix_inverse_3x3_32_fx( } } - *exp_inv_mat = max_exp + 1; + *exp_inv_mat = add( max_exp, 1 ); + move16(); FOR( i = 0; i < 3; i++ ) { FOR( j = 0; j < 3; j++ ) { - IF( exp_inverse_matrix_fx[i][j] < -15 && inverse_matrix_fx[i][j] != 0 ) + test(); + IF( LT_16( exp_inverse_matrix_fx[i][j], -15 ) && inverse_matrix_fx[i][j] != 0 ) { inverse_matrix_fx[i][j] = 1; exp_inverse_matrix_fx[i][j] = 0; + move32(); + move16(); } ELSE { inverse_matrix_fx[i][j] = L_shr( inverse_matrix_fx[i][j], *exp_inv_mat - exp_inverse_matrix_fx[i][j] ); + move32(); } } } @@ -2173,22 +2241,30 @@ static Word16 check_and_store_triplet_fx( speaker_node_triplet_unit_vec_matrix_fx[1] = speaker_node_data[chB].unit_vec_fx; speaker_node_triplet_unit_vec_matrix_fx[2] = speaker_node_data[chC].unit_vec_fx; Word16 exp_inv_mat = 31; + move16(); matrix_inverse_3x3_32_fx( speaker_node_triplet_unit_vec_matrix_fx, inverse_matrix_fx, &exp_inv_mat ); - triplets[*triplet_index].q_inverse_matrix = 31 - exp_inv_mat; + triplets[*triplet_index].q_inverse_matrix = sub( 31, exp_inv_mat ); /* Check through all speaker nodes that none of them are within the triplet. * Node within the triplet is identified by that all three panning gains are positive. * Epsilon-condition is for some small rounding issues.*/ speaker_node_found_inside_triplet = 0; + move16(); FOR( ch_check = 0; ch_check < num_speaker_nodes; ch_check++ ) { - IF( ( ch_check != chA ) && ( ch_check != chB ) && ( ch_check != chC ) ) + test(); + test(); + IF( ( NE_16( ch_check, chA ) ) && NE_16( ch_check, chB ) && NE_16( ch_check, chC ) ) { - triplet_ok = vector_matrix_multiply_3x3_32_fx( speaker_node_data[ch_check].unit_vec_fx, inverse_matrix_fx, unnormalized_gains_fx, 31 - exp_inv_mat ); - IF( triplet_ok && ( GT_32( unnormalized_gains_fx[0], ( VBAP_EPSILON_Q31 << ( 30 - exp_inv_mat ) ) ) ) && ( GT_32( unnormalized_gains_fx[1], ( VBAP_EPSILON_Q31 << ( 30 - exp_inv_mat ) ) ) ) && ( GT_32( unnormalized_gains_fx[2], ( VBAP_EPSILON_Q31 << ( 30 - exp_inv_mat ) ) ) ) ) + triplet_ok = vector_matrix_multiply_3x3_32_fx( speaker_node_data[ch_check].unit_vec_fx, inverse_matrix_fx, unnormalized_gains_fx, sub( 31, exp_inv_mat ) ); + test(); + test(); + test(); + IF( triplet_ok && ( GT_32( unnormalized_gains_fx[0], L_shl( VBAP_EPSILON_Q31, sub( Q30, exp_inv_mat ) ) ) ) && ( GT_32( unnormalized_gains_fx[1], L_shl( VBAP_EPSILON_Q31, sub( Q30, exp_inv_mat ) ) ) ) && ( GT_32( unnormalized_gains_fx[2], L_shl( VBAP_EPSILON_Q31, sub( Q30, exp_inv_mat ) ) ) ) ) { speaker_node_found_inside_triplet = 1; - break; + move16(); + BREAK; } } } @@ -2199,6 +2275,9 @@ static Word16 check_and_store_triplet_fx( triplets[*triplet_index].speaker_node[0] = (UWord8) chA; triplets[*triplet_index].speaker_node[1] = (UWord8) chB; triplets[*triplet_index].speaker_node[2] = (UWord8) chC; + move16(); + move16(); + move16(); FOR( k = 0; k < 3; k++ ) { Copy32( inverse_matrix_fx[k], triplets[*triplet_index].inverse_matrix_fx[k], 3 ); @@ -2206,18 +2285,21 @@ static Word16 check_and_store_triplet_fx( /* Get center azimuth for fast search use */ Word32 tmp_a = L_add( L_shr( L_add( speaker_node_data[chA].unit_vec_fx[1], speaker_node_data[chB].unit_vec_fx[1] ), 2 ), L_shr( speaker_node_data[chC].unit_vec_fx[1], 2 ) ); // Q28 /*Condition to make tmp_a 0 to adress precision loss seen*/ - IF( tmp_a == -8193 ) + if ( EQ_32( tmp_a, -8193 ) ) { tmp_a = 0; + move32(); } Word32 tmp_b = L_add( L_shr( L_add( speaker_node_data[chA].unit_vec_fx[0], speaker_node_data[chB].unit_vec_fx[0] ), 2 ), L_shr( speaker_node_data[chC].unit_vec_fx[0], 2 ) ); // Q28 Word16 tmp_tan = shr( BASOP_util_atan2( tmp_a, tmp_b, 0 ), Q13 - Q9 ); triplet_azidegs_fx[*triplet_index] = L_mult( tmp_tan, 29335 /*_180_OVER_PI in Q9*/ ); // Q3 - + move32(); /* Store increasing order indices for the later sorting step. */ triplet_order[*triplet_index] = *triplet_index; + move16(); *triplet_index = add( *triplet_index, 1 ); + move16(); return 1; } @@ -2321,6 +2403,7 @@ static Word16 determine_virtual_surface_triplets_fx( { Word16 chA, chB, chC, k, l, m; Word16 num_triplets = 0; + move16(); Word16 num_connected_to_chA; Word16 connected_to_chA[VBAP_MAX_NUM_SPEAKER_NODES]; Word16 connection_uses_left[VBAP_MAX_NUM_SPEAKER_NODES]; @@ -2335,7 +2418,7 @@ static Word16 determine_virtual_surface_triplets_fx( /* Early skip if not in correct group. */ IF( NE_16( speaker_node_data[chA].group, allowed_group ) ) { - continue; + CONTINUE; } /* Get all connections connected to current chA that have not been used by @@ -2346,7 +2429,7 @@ static Word16 determine_virtual_surface_triplets_fx( { test(); test(); - IF( ( EQ_16( connections[k][0], chA ) || EQ_16( connections[k][1], chA ) ) && ( GT_16( connection_uses_left[k], 0 ) ) ) + IF( ( EQ_16( connections[k][0], chA ) || EQ_16( connections[k][1], chA ) ) && ( connection_uses_left[k] > 0 ) ) { connected_to_chA[num_connected_to_chA] = k; move16(); @@ -2358,7 +2441,7 @@ static Word16 determine_virtual_surface_triplets_fx( * This can fail in later stages when all connections are already used. */ IF( LT_16( num_connected_to_chA, 2 ) ) { - continue; + CONTINUE; } /* Try to form triplets from each valid connection. */ @@ -2390,7 +2473,7 @@ static Word16 determine_virtual_surface_triplets_fx( move16(); connection_uses_left[m] = sub( connection_uses_left[m], 1 ); move16(); - break; + BREAK; } } } @@ -2400,7 +2483,7 @@ static Word16 determine_virtual_surface_triplets_fx( * connection. */ IF( LT_16( connection_uses_left[connect_index_k], 1 ) ) { - break; + BREAK; } } } @@ -2527,7 +2610,7 @@ static void determine_initial_search_indices_fx( Word32 sector_reference_azideg_fx; Word32 sector_border_start_azideg_fx; Word32 sector_border_end_azideg_fx; - int16_t best_index; + Word16 best_index; Word32 min_azideg_diff_fx; Word32 azideg_diff_fx; @@ -2642,6 +2725,7 @@ static ivas_error determine_connections_fx( Word16 num_non_crossing_planes; Word16 c; Word16 connection_write_index = 0; + move16(); Word32 non_crossing_plane_elevation_deg_fx[VBAP_MAX_PLANES]; ivas_error error; @@ -2661,7 +2745,7 @@ static ivas_error determine_connections_fx( /* Process in different mode based on the grouping. It is enough to check for first node. */ IF( EQ_16( speaker_node_data[0].group, SPEAKER_NODE_ALL ) ) { - IF( ( error = formulate_half_sphere_connections_fx( speaker_node_data, num_speaker_nodes, SPEAKER_NODE_ALL, connections, &connection_write_index, max_num_connections, num_non_crossing_planes, non_crossing_plane_elevation_deg_fx ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = formulate_half_sphere_connections_fx( speaker_node_data, num_speaker_nodes, SPEAKER_NODE_ALL, connections, &connection_write_index, max_num_connections, num_non_crossing_planes, non_crossing_plane_elevation_deg_fx ) ), IVAS_ERR_OK ) ) { return error; } @@ -2669,7 +2753,7 @@ static ivas_error determine_connections_fx( ELSE { /* The node-node connections are determined in three stages: bottom, horizontal, and top. */ - IF( ( error = formulate_half_sphere_connections_fx( speaker_node_data, num_speaker_nodes, SPEAKER_NODE_BOTTOM_HALF, connections, &connection_write_index, max_num_connections, num_non_crossing_planes, non_crossing_plane_elevation_deg_fx ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = formulate_half_sphere_connections_fx( speaker_node_data, num_speaker_nodes, SPEAKER_NODE_BOTTOM_HALF, connections, &connection_write_index, max_num_connections, num_non_crossing_planes, non_crossing_plane_elevation_deg_fx ) ), IVAS_ERR_OK ) ) { return error; } @@ -2680,12 +2764,13 @@ static ivas_error determine_connections_fx( *group1_count = connection_write_index; move16(); - IF( ( error = formulate_half_sphere_connections_fx( speaker_node_data, num_speaker_nodes, SPEAKER_NODE_TOP_HALF, connections, &connection_write_index, max_num_connections, num_non_crossing_planes, non_crossing_plane_elevation_deg_fx ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = formulate_half_sphere_connections_fx( speaker_node_data, num_speaker_nodes, SPEAKER_NODE_TOP_HALF, connections, &connection_write_index, max_num_connections, num_non_crossing_planes, non_crossing_plane_elevation_deg_fx ) ), IVAS_ERR_OK ) ) { return error; } *group2_count = sub( connection_write_index, *group2_start ); + move16(); } return IVAS_ERR_OK; @@ -2781,6 +2866,7 @@ static enum ConnectionClass determine_connection_class_fx( * When this happens, unit vectors point in opposite directions. */ uvecdot_fx = L_add( L_shl( dotp_fixed( node_data[chA].unit_vec_fx, node_data[chB].unit_vec_fx, 3 ), 1 ), ONE_IN_Q30 ); // Q30 - adding one guard bit + test(); IF( LT_32( uvecdot_fx, VBAP_EPSILON_Q3O ) && GT_32( uvecdot_fx, L_negate( VBAP_EPSILON_Q3O ) ) ) { return CONNECTION_WITH_SPEAKER_NODE_BEHIND; @@ -2839,7 +2925,8 @@ static enum ConnectionClass determine_connection_class_fx( Word32 tmp5 = Mpy_32_32( L_negate( v1v2_fx ), v2p1_fx ); // q25 Word32 tmp6 = L_add( tmp4, tmp5 ); // q25 Word16 tmp7, exp = 0; - IF( EQ_32( determinant_fx, 0 ) ) + move16(); + if ( determinant_fx == 0 ) { determinant_fx = 1; move32(); @@ -2852,7 +2939,7 @@ static enum ConnectionClass determine_connection_class_fx( Word32 var1, var2; Word16 vTarget_fx_e[3], vec_diff_e[3]; test(); - IF( GT_32( norm_distance_on_v1_fx, 0 ) && LT_32( norm_distance_on_v1_fx, L_shr( ONE_IN_Q31, sub( 31, sub( Q25, exp ) ) ) ) ) + IF( norm_distance_on_v1_fx > 0 && LT_32( norm_distance_on_v1_fx, L_shr( ONE_IN_Q31, sub( 31, sub( Q25, exp ) ) ) ) ) { /* Formulate vTarget, that is an unit vector that goes through the determined point on chA-chB connection */ energy_sum_fx = 0; @@ -2860,7 +2947,7 @@ static enum ConnectionClass determine_connection_class_fx( FOR( k = 0; k < 3; k++ ) { var1 = Mpy_32_32( norm_distance_on_v1_fx, v1_fx[k] ); // Q(25 - exp) + Q28 - 31 - vTarget_fx[k] = BASOP_Util_Add_Mant32Exp( p1_fx[k], 1, var1, 31 - ( Q25 - exp + Q28 - 31 ), &exp_vTarget ); + vTarget_fx[k] = BASOP_Util_Add_Mant32Exp( p1_fx[k], 1, var1, Q31 - ( Q25 - exp + Q28 - Q31 ), &exp_vTarget ); move16(); vTarget_fx_e[k] = exp_vTarget; move16(); @@ -2873,6 +2960,7 @@ static enum ConnectionClass determine_connection_class_fx( move16(); } Word16 exp_eq = exp_energy_sum; + move16(); eq_value_fx = ISqrt32( energy_sum_fx, &exp_eq ); FOR( k = 0; k < 3; k++ ) { @@ -2883,6 +2971,8 @@ static enum ConnectionClass determine_connection_class_fx( } /*make a common exponent*/ Word16 max_vTarget_e = 0, max_vec_diff_e = 0; + move16(); + move16(); FOR( k = 0; k < 3; k++ ) { max_vTarget_e = s_max( vTarget_fx_e[k], max_vTarget_e ); @@ -2898,7 +2988,7 @@ static enum ConnectionClass determine_connection_class_fx( /* A check if the angle between vTarget and node_data[ch].unit_vec is less than 1 degree. Essentially reveals if there is a speaker node too close "behind" the connection. Such connections should be rejected.*/ - FOR( int i = 0; i < 3; i++ ) + FOR( Word16 i = 0; i < 3; i++ ) { vTarget_fx[i] = L_shr( vTarget_fx[i], 2 ); // add guard bits move32(); @@ -2919,7 +3009,7 @@ static enum ConnectionClass determine_connection_class_fx( Word32 vec_diff_dotp = dotp_fixed( vec_diff_fx, vec_diff_fx, 3 ); // exp : 2 * max_vec_diff_e + 4 move32(); Word32 var = Mpy_32_32( vec_diff_dotp, 51200 /*25.0f in Q11*/ ); // exp : 2 * max_vec_diff_e + 4 + 20 - Word16 Flag1 = BASOP_Util_Cmp_Mant32Exp( v1v1_fx, 31 - Q25, var, 2 * max_vec_diff_e + 4 + 20 ); + Word16 Flag1 = BASOP_Util_Cmp_Mant32Exp( v1v1_fx, Q31 - Q25, var, 2 * max_vec_diff_e + 4 + 20 ); IF( EQ_16( Flag1, 1 ) ) { IF( LT_32( L_abs( L_sub( node_data[chB].unit_vec_fx[2], node_data[chA].unit_vec_fx[2] ) ), 2147483 ) ) @@ -3072,15 +3162,16 @@ static void formulate_horizontal_connections_fx( FOR( chCheck = 0; chCheck < num_speaker_nodes; chCheck++ ) { + test(); IF( ( NE_16( ch, chCheck ) ) && ( EQ_16( speaker_node_data[chCheck].group, SPEAKER_NODE_HORIZONTAL ) ) ) { arc_diff_fx = L_sub( speaker_node_data[chCheck].azi_deg_fx, speaker_node_data[ch].azi_deg_fx ); // Q22 - WHILE( LT_32( arc_diff_fx, 0 ) ) + WHILE( arc_diff_fx < 0 ) { arc_diff_fx = L_add( arc_diff_fx, 1509949440 /*360.0f in Q22*/ ); } - IF( LT_32( L_shr( arc_diff_fx, 22 - Q_min_arc_diff ), min_arc_diff_fx ) ) + IF( LT_32( L_shr( arc_diff_fx, sub( 22, Q_min_arc_diff ) ), min_arc_diff_fx ) ) { min_arc_diff_fx = arc_diff_fx; move32(); @@ -3096,6 +3187,7 @@ static void formulate_horizontal_connections_fx( connections[*connection_write_index][1] = next_index; move16(); *connection_write_index = add( *connection_write_index, 1 ); + move16(); } } @@ -3167,10 +3259,12 @@ static Word16 check_plane_crossing_fx( FOR( plane = 0; plane < num_non_crossing_planes; plane++ ) { + test(); IF( ( GT_32( L_shr( ele1_deg_fx, 8 ), L_add( non_crossing_plane_elevation_deg_fx[plane], ONE_IN_Q14 ) ) ) && ( LT_32( L_shr( ele2_deg_fx, 8 ), L_sub( non_crossing_plane_elevation_deg_fx[plane], ONE_IN_Q14 ) ) ) ) { return 1; } + test(); IF( ( GT_32( L_shr( ele2_deg_fx, 8 ), L_add( non_crossing_plane_elevation_deg_fx[plane], ONE_IN_Q14 ) ) ) && ( LT_32( L_shr( ele1_deg_fx, 8 ), L_sub( non_crossing_plane_elevation_deg_fx[plane], ONE_IN_Q14 ) ) ) ) { return 1; @@ -3228,6 +3322,9 @@ static ivas_error get_half_sphere_connection_options_fx( Word16 node, chA, chB, c, c_cmp; ConnectionOption *c_options, *c_options_reorder; + move16(); + move16(); + /* Count max num connection options at the half sphere */ FOR( node = 0; node < num_speaker_nodes; node++ ) { @@ -3288,11 +3385,13 @@ static ivas_error get_half_sphere_connection_options_fx( unit_vec_dotp = dotp_fixed( speaker_node_data[chA].unit_vec_fx, speaker_node_data[chB].unit_vec_fx, 3 ); // Q29 unit_vec_dotp_sq = Mpy_32_32( unit_vec_dotp, unit_vec_dotp ); // Q27 one_minus_unit_vec_dotp_sq = L_sub( ONE_IN_Q27, unit_vec_dotp_sq ); - Word16 exp_uv = sub( 31, Q27 ); + Word16 exp_uv = Q31 - Q27; + move16(); one_minus_unit_vec_dotp_sq_root = Sqrt32( one_minus_unit_vec_dotp_sq, &exp_uv ); acos_val = BASOP_util_atan2( one_minus_unit_vec_dotp_sq_root, unit_vec_dotp, exp_uv - 2 ); // Q13 c_options[index].arc_fx = L_deposit_h( acos_val ); // Q29 - c_options[index].arc_weighted_fx = c_options[index].arc_fx; // Q29 + move32(); + c_options[index].arc_weighted_fx = c_options[index].arc_fx; // Q29 move32(); /* A special case, mainly accounting for ELEVATED L,R,C speaker nodes. @@ -3301,6 +3400,7 @@ static ivas_error get_half_sphere_connection_options_fx( IF( EQ_16( ConnectionClass, ELEVATED_PLANE_THIN_TRIANGLE_CONNECTION ) ) { c_options[index].arc_weighted_fx = L_shl( c_options[index].arc_weighted_fx, 1 ); + move32(); } /* If the connection passes a pre-determined plane of speaker nodes, then add further penalty */ @@ -3308,6 +3408,7 @@ static ivas_error get_half_sphere_connection_options_fx( IF( check_plane_crossing_fx( speaker_node_data[chA].ele_deg_fx /*q22*/, speaker_node_data[chB].ele_deg_fx, num_non_crossing_planes, non_crossing_plane_elevation_deg_fx ) ) { c_options[index].arc_weighted_fx = L_shl( c_options[index].arc_weighted_fx, 1 ); + move32(); } index = add( index, 1 ); } @@ -3339,11 +3440,13 @@ static ivas_error get_half_sphere_connection_options_fx( FOR( c_cmp = 0; c_cmp < *num_connection_options; c_cmp++ ) { res = BASOP_Util_Cmp_Mant32Exp( c_options[c_cmp].arc_weighted_fx, 31 - Q29, min_arc_weighted_fx_new, exp_min_arc_weighted_fx ); - IF( EQ_16( res, -1 ) || EQ_16( res, 0 ) ) + test(); + IF( EQ_16( res, -1 ) || res == 0 ) { min_arc_weighted_fx_new = c_options[c_cmp].arc_weighted_fx; move32(); - exp_min_arc_weighted_fx = sub( 31, Q29 ); + exp_min_arc_weighted_fx = Q31 - Q29; + move16(); min_arc_index = c_cmp; move16(); } @@ -3529,14 +3632,15 @@ static ivas_error formulate_half_sphere_connections_fx( /* Obtain all connection options (i.e., channel pairs) at the half sphere. The function orders them * in terms of which connection to keep if two connections would cross each other. */ - IF( ( error = get_half_sphere_connection_options_fx( - speaker_node_data, - group, - num_speaker_nodes, - num_non_crossing_planes, - non_crossing_plane_elevation_deg_fx, - &connection_options, - &num_connection_options ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = get_half_sphere_connection_options_fx( + speaker_node_data, + group, + num_speaker_nodes, + num_non_crossing_planes, + non_crossing_plane_elevation_deg_fx, + &connection_options, + &num_connection_options ) ), + IVAS_ERR_OK ) ) { return error; } @@ -3599,7 +3703,7 @@ static ivas_error formulate_half_sphere_connections_fx( } Word16 tmp_exp = sub( 31, Q23 ); - IF( tmpFloat_fx == 0 ) + if ( tmpFloat_fx == 0 ) { tmpFloat_fx = 1; move16(); @@ -3612,7 +3716,7 @@ static ivas_error formulate_half_sphere_connections_fx( move32(); } /*update Q for planeCrossingVec */ - Q_planeCrossingVec = sub( sub( add( Q27, Q31 ), tmp_exp ), Q31 ); + Q_planeCrossingVec = sub( sub( Q27 + Q31, tmp_exp ), Q31 ); /* If the plane intersection is between both connections, then the two connections cross. */ /* Study first if the crossing is between arc chA-chB */ @@ -3639,13 +3743,13 @@ static ivas_error formulate_half_sphere_connections_fx( } one_minus_var1_sq = BASOP_Util_Add_Mant32Exp( ONE_IN_Q30, 1, L_negate( var1_sq ), exp_var1_sq, &final_exp_A ); var1_sqrt = Sqrt32( one_minus_var1_sq, &final_exp_A ); - var1_cos = BASOP_util_atan2( var1_sqrt, var1, final_exp_A - ( Q31 - ( Q_planeCrossingVec + Q30 - Q31 ) ) ); // Q13 + var1_cos = BASOP_util_atan2( var1_sqrt, var1, sub( final_exp_A, ( Q31 - ( Q_planeCrossingVec + Q30 - Q31 ) ) ) ); // Q13 angleCmp_fx = var1_cos; move16(); one_minus_var2_sq = BASOP_Util_Add_Mant32Exp( ONE_IN_Q30, 1, L_negate( var2_sq ), exp_var2_sq, &final_exp_B ); var2_sqrt = Sqrt32( one_minus_var2_sq, &final_exp_B ); - var2_cos = BASOP_util_atan2( var2_sqrt, var2, final_exp_B - ( Q31 - ( Q_planeCrossingVec + Q30 - Q31 ) ) ); // Q13 + var2_cos = BASOP_util_atan2( var2_sqrt, var2, sub( final_exp_B, ( Q31 - ( Q_planeCrossingVec + Q30 - Q31 ) ) ) ); // Q13 final_exp = BASOP_Util_Add_MantExp( angleCmp_fx, Q15 - Q13, var2_cos, Q15 - Q13, &angleCmp_fx ); @@ -3679,7 +3783,7 @@ static ivas_error formulate_half_sphere_connections_fx( } /* Study if the crossing is also between arc cmp_chA-cmp_chB */ - IF( GT_16( within_first_arc, 0 ) ) + IF( within_first_arc > 0 ) { var1 = dotp_fixed( planeCrossingVec_fx, speaker_node_data[cmp_chA].unit_vec_fx, 3 ); move32(); @@ -3724,7 +3828,7 @@ static ivas_error formulate_half_sphere_connections_fx( var_a = BASOP_Util_Add_Mant32Exp( cmp_arc_fx, Q31 - Q29, L_negate( L_deposit_h( angleCmp_fx ) ), final_exp, &sub_exp ); comp1 = BASOP_Util_Cmp_Mant32Exp( L_abs( var_a ), sub_exp, 21474836, 0 ); - IF( EQ_16( comp1, -1 ) ) + if ( EQ_16( comp1, -1 ) ) { /* A crossing is detected. The new connection is not valid, because * the connections were ordered in order of preference (arc_weighted) */ @@ -3737,7 +3841,7 @@ static ivas_error formulate_half_sphere_connections_fx( } /* Store the new connection which has been confirmed valid */ - IF( GT_16( new_connection_is_valid, 0 ) ) + IF( new_connection_is_valid > 0 ) { connections[*connection_write_index][0] = chA; move16(); @@ -3948,6 +4052,8 @@ static Word16 determine_non_crossing_planes_fx( { tmp1 = L_add( ele_check_fx, 16 /*VBAP_EPSILON in Q14*/ ); tmp2 = L_sub( next_ele_check_fx, 16 /*VBAP_EPSILON in Q14*/ ); + test(); + test(); IF( ( node_data[ch].group != SPEAKER_NODE_HORIZONTAL ) && GT_32( L_shr( node_data[ch].ele_deg_fx, 8 ), tmp1 ) && LT_32( L_shr( node_data[ch].ele_deg_fx, 8 ), tmp2 ) ) { next_ele_check_fx = L_shr( node_data[ch].ele_deg_fx, 8 ); // shift due to comparision with 90.0f @@ -3959,7 +4065,7 @@ static Word16 determine_non_crossing_planes_fx( IF( GT_32( ele_check_fx, 1474560 ) /*90.0f in Q14*/ ) { /* When no next node elevation found, break loop */ - break; + BREAK; } max_gap_fx = -163838368; // Q14 @@ -3977,7 +4083,7 @@ static Word16 determine_non_crossing_planes_fx( IF( NE_16( ch_cmp, ch ) && LT_32( L_abs( L_sub( L_shr( node_data[ch_cmp].ele_deg_fx, 8 ), ele_check_fx ) ), 16 /*0.001f in Q14*/ ) ) { Word32 gap_fx = L_sub( node_data[ch_cmp].azi_deg_fx, node_data[ch].azi_deg_fx ); - WHILE( LT_32( gap_fx, 0 ) ) + WHILE( gap_fx < 0 ) { gap_fx = L_add( gap_fx, 1509949440 /*360.0f in Q22*/ ); } @@ -3997,15 +4103,17 @@ static Word16 determine_non_crossing_planes_fx( } /* If maximum gap is small enough, then a non-crossing plane is detected */ - IF( LT_32( max_gap_fx, 2293776 /*Q14*/ ) && GT_32( max_gap_fx, 0 ) ) + test(); + IF( LT_32( max_gap_fx, 2293776 /*Q14*/ ) && max_gap_fx > 0 ) { non_crossing_plane_elevation_deg_fx[num_planes] = ele_check_fx; // q14 + move32(); num_planes = add( num_planes, 1 ); IF( EQ_16( num_planes, VBAP_MAX_PLANES ) ) { /* Memory init limit. Does not happen with any real speaker node configuration. Triangulation succeeds even if number of non_crossing_planes are limited. */ - break; + BREAK; } } } diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 88706683c4ee981797dcedd0051fc6453c5e2214..f9eadb8002403ff253492e9be168bf19ca768e72 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -52,6 +52,7 @@ #include "debug.h" #define float_to_fix( n, factor ) ( round( n * ( 1 << factor ) ) ) #define fix_to_float( n, factor ) ( (float) n / ( 1 << factor ) ) +#define IVAS_FLOAT_FIXED_TO_BE_REMOVED #endif /*-------------------------------------------------------------------* * Local constants @@ -447,7 +448,7 @@ static ivas_error allocateMcLfeDelayBuffer_fx( const Word16 data_size ) { *lfeDelayBuffer = (Word32 *) malloc( data_size * sizeof( Word32 ) ); - if ( *lfeDelayBuffer == NULL ) + IF( *lfeDelayBuffer == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for LFE delay buffer" ); } @@ -515,7 +516,7 @@ static IVAS_QUATERNION quaternionInit_fx( move16(); move16(); -#ifndef IVAS_FLOAT_FIXED_TO_BE_REMOVED +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED q.w = 1.0f; q.x = q.y = q.z = 0.0f; #endif @@ -566,6 +567,7 @@ static void copyBufferTo2dArray_fx( FOR( smplIdx = 0; smplIdx < (UWord32) buffer.config.numSamplesPerChannel; ++smplIdx ) { array[chnlIdx][smplIdx] = *readPtr++; + move32(); } } @@ -605,7 +607,9 @@ static void accumulate2dArrayToBuffer_fx( { FOR( smplIdx = 0; smplIdx < buffer->config.numSamplesPerChannel; ++smplIdx ) { - *writePtr++ += array[chnlIdx][smplIdx]; + *writePtr = L_add( *writePtr, array[chnlIdx][smplIdx] ); + move32(); + writePtr++; } } @@ -651,6 +655,8 @@ static Word32 limitRendererOutput_fx( Word32 numClipping = 0; /* return early if given bad parameters */ + test(); + test(); IF( hLimiter == NULL || output == NULL || output_frame <= 0 ) { return 0; @@ -658,10 +664,11 @@ static Word32 limitRendererOutput_fx( channels = hLimiter->channel_ptrs_fx; num_channels = hLimiter->num_channels; + move16(); FOR( i = 0; i < num_channels; ++i ) { - channels[i] = output + i * output_frame; + channels[i] = output + imult1616( i, output_frame ); } limiter_process_fx( hLimiter, output_frame, threshold, 0, NULL, q_factor ); @@ -670,7 +677,8 @@ static Word32 limitRendererOutput_fx( FOR( i = 0; i < output_frame * num_channels; ++i ) { - output[i] = min( max( L_shl( INT16_MIN, q_factor ), output[i] ), L_shl( INT16_MAX, q_factor ) ); + output[i] = L_min( L_max( L_shl( INT16_MIN, q_factor ), output[i] ), L_shl( INT16_MAX, q_factor ) ); + move32(); } return numClipping; @@ -908,7 +916,7 @@ static ivas_error validateOutputSampleRate( const Word32 sampleRate, const AUDIO_CONFIG outConfig ) { - IF( getAudioConfigType( outConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) + IF( NE_32( getAudioConfigType( outConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) ) { /* If no binaural rendering, any sampling rate is supported */ return IVAS_ERR_OK; @@ -1087,7 +1095,9 @@ static ivas_error initLimiter( ivas_error error; /* If re-initializing with unchanged values, return early */ - IF( *phLimiter != NULL && ( *phLimiter )->num_channels == numChannels && ( *phLimiter )->sampling_rate == sampleRate ) + test(); + test(); + IF( *phLimiter != NULL && EQ_16( ( *phLimiter )->num_channels, numChannels ) && EQ_32( ( *phLimiter )->sampling_rate, sampleRate ) ) { return IVAS_ERR_OK; } @@ -1098,19 +1108,10 @@ static ivas_error initLimiter( ivas_limiter_close( phLimiter ); } - IF( ( error = ivas_limiter_open( phLimiter, numChannels, sampleRate ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_limiter_open( phLimiter, numChannels, sampleRate ) ), IVAS_ERR_OK ) ) { return error; } - // The below code has to be deleted once whole conversion is completed - //( *phLimiter )->gain = 1.0f; - //( *phLimiter )->release_heuristic = 0.f; - //( *phLimiter )->attack_constant = powf( 0.01f, 1.0f / ( IVAS_LIMITER_ATTACK_SECONDS * sampleRate ) ); - for ( Word32 i = 0; i < numChannels; ++i ) - { - //( *phLimiter )->channel_ptrs[i] = NULL; - } - // Till this line. return IVAS_ERR_OK; } @@ -1156,13 +1157,25 @@ static LSSETUP_CUSTOM_STRUCT defaultCustomLs( since output config is never in an undefined state. */ ls.is_planar_setup = 1; ls.num_spk = 1; + move16(); + move16(); + +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED set_zero( ls.ls_azimuth, MAX_OUTPUT_CHANNELS ); +#endif + set_val_Word32( ls.ls_azimuth_fx, 0, MAX_OUTPUT_CHANNELS ); + +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED set_zero( ls.ls_elevation, MAX_OUTPUT_CHANNELS ); +#endif + set_val_Word32( ls.ls_elevation_fx, 0, MAX_OUTPUT_CHANNELS ); ls.num_lfe = 0; + move16(); set_s( ls.lfe_idx, 0, MAX_OUTPUT_CHANNELS ); ls.separate_ch_found = 0; + move16(); set_val_Word16( ls.separate_ch_gains_fx, 0, MAX_OUTPUT_CHANNELS ); return ls; @@ -1505,31 +1518,35 @@ static ivas_error getMcConfigValues_fx( *lfe_idx = -1; *is_planar = 1; + move16(); + move16(); SWITCH( inConfig ) { case IVAS_AUDIO_CONFIG_LS_CUSTOM: *azimuth = (const Word32 *) &pInCustomLs->ls_azimuth_fx; *elevation = (const Word32 *) &pInCustomLs->ls_azimuth_fx; - IF( GT_16( pInCustomLs->num_lfe, 0 ) ) + IF( pInCustomLs->num_lfe > 0 ) { *lfe_idx = pInCustomLs->lfe_idx[0]; + move16(); } FOR( i = 0; i < pInCustomLs->num_spk; i++ ) { - IF( NE_32( pInCustomLs->ls_elevation_fx[i], 0 ) ) + IF( pInCustomLs->ls_elevation_fx[i] != 0 ) { *is_planar = 0; + move16(); BREAK; } } BREAK; case IVAS_AUDIO_CONFIG_MONO: case IVAS_AUDIO_CONFIG_STEREO: - if ( ( error = getSpeakerAzimuths_fx( inConfig, azimuth ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getSpeakerAzimuths_fx( inConfig, azimuth ) ), IVAS_ERR_OK ) ) { return error; } - if ( ( error = getSpeakerElevations_fx( inConfig, elevation ) ) != IVAS_ERR_OK ) + IF( NE_32( error = getSpeakerElevations_fx( inConfig, elevation ), IVAS_ERR_OK ) ) { return error; } @@ -1539,16 +1556,28 @@ static ivas_error getMcConfigValues_fx( case IVAS_AUDIO_CONFIG_5_1_2: case IVAS_AUDIO_CONFIG_5_1_4: case IVAS_AUDIO_CONFIG_7_1_4: - IF( ( error = getSpeakerAzimuths_fx( inConfig, azimuth ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getSpeakerAzimuths_fx( inConfig, azimuth ) ), IVAS_ERR_OK ) ) { return error; } - IF( ( error = getSpeakerElevations_fx( inConfig, elevation ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getSpeakerElevations_fx( inConfig, elevation ) ), IVAS_ERR_OK ) ) { return error; } *lfe_idx = LFE_CHANNEL; - *is_planar = ( inConfig == IVAS_AUDIO_CONFIG_5_1 || inConfig == IVAS_AUDIO_CONFIG_7_1 ) ? 1 : 0; + move16(); + + test(); + IF( EQ_32( inConfig, IVAS_AUDIO_CONFIG_5_1 ) || EQ_32( inConfig, IVAS_AUDIO_CONFIG_7_1 ) ) + { + *is_planar = 1; + move16(); + } + ELSE + { + *is_planar = 0; + move16(); + } BREAK; default: assert( !"Invalid speaker config" ); @@ -1635,13 +1664,16 @@ static ivas_error initEfap( const Word32 *elevations; Word16 numNonLfeChannels; - IF( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + test(); + IF( EQ_32( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_32( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { pEfapWrapper->speakerConfig = IVAS_AUDIO_CONFIG_7_1_4; + move32(); } ELSE { pEfapWrapper->speakerConfig = outConfig; + move32(); } pEfapWrapper->pCustomLsSetup = pCustomLsOut; @@ -1652,36 +1684,36 @@ static ivas_error initEfap( } /* Only initialize EFAP handle if output config is channel-based */ - IF( getAudioConfigType( pEfapWrapper->speakerConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + IF( NE_32( getAudioConfigType( pEfapWrapper->speakerConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) { pEfapWrapper->hEfap = NULL; return IVAS_ERR_OK; } - IF( outConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + IF( EQ_32( outConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { - IF( ( error = efap_init_data_fx( &pEfapWrapper->hEfap, pCustomLsOut->ls_azimuth_fx, pCustomLsOut->ls_elevation_fx, pCustomLsOut->num_spk, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = efap_init_data_fx( &pEfapWrapper->hEfap, pCustomLsOut->ls_azimuth_fx, pCustomLsOut->ls_elevation_fx, pCustomLsOut->num_spk, EFAP_MODE_EFAP ) ), IVAS_ERR_OK ) ) { return error; } } ELSE { - IF( ( error = getSpeakerAzimuths_fx( pEfapWrapper->speakerConfig, &azimuths ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getSpeakerAzimuths_fx( pEfapWrapper->speakerConfig, &azimuths ) ), IVAS_ERR_OK ) ) { return error; } - IF( ( error = getSpeakerElevations_fx( pEfapWrapper->speakerConfig, &elevations ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getSpeakerElevations_fx( pEfapWrapper->speakerConfig, &elevations ) ), IVAS_ERR_OK ) ) { return error; } - IF( ( error = getNumNonLfeChannelsInSpeakerLayout( pEfapWrapper->speakerConfig, &numNonLfeChannels ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getNumNonLfeChannelsInSpeakerLayout( pEfapWrapper->speakerConfig, &numNonLfeChannels ) ), IVAS_ERR_OK ) ) { return error; } - IF( ( error = efap_init_data_fx( &pEfapWrapper->hEfap, azimuths, elevations, numNonLfeChannels, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = efap_init_data_fx( &pEfapWrapper->hEfap, azimuths, elevations, numNonLfeChannels, EFAP_MODE_EFAP ) ), IVAS_ERR_OK ) ) { return error; } @@ -1792,7 +1824,14 @@ static ivas_error getEfapGains_fx( } ELSE { - panGains[i] = EQ_32( *readPtr, ONE_IN_Q30 ) ? ONE_IN_Q31 : L_shl( *readPtr, 1 ); // Q31 + IF( EQ_32( *readPtr, ONE_IN_Q30 ) ) + { + panGains[i] = ONE_IN_Q31; + } + ELSE + { + panGains[i] = L_shl( *readPtr, 1 ); + } move32(); ++readPtr; } @@ -1800,7 +1839,7 @@ static ivas_error getEfapGains_fx( } ELSE { - IF( ( error = getAudioConfigNumChannels( efapWrapper.speakerConfig, &numChannels ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getAudioConfigNumChannels( efapWrapper.speakerConfig, &numChannels ) ), IVAS_ERR_OK ) ) { return error; } @@ -1816,7 +1855,15 @@ static ivas_error getEfapGains_fx( } ELSE { - panGains[i] = GE_32( *readPtr, ONE_IN_Q30 ) ? ONE_IN_Q31 : L_shl( *readPtr, 1 ); // Q31 + IF( GE_32( *readPtr, ONE_IN_Q30 ) ) + { + panGains[i] = ONE_IN_Q31; + } + ELSE + { + panGains[i] = L_shl( *readPtr, 1 ); + } + move32(); ++readPtr; } @@ -1899,6 +1946,7 @@ static ivas_error initHeadRotation_fx( /* Head rotation is enabled by default */ hIvasRend->headRotData.headRotEnabled = 1; + move16(); /* Initialize 5ms crossfade */ crossfade_len = L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES; @@ -1924,7 +1972,7 @@ static ivas_error initHeadRotation_fx( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Orientation tracking" ); } - IF( ( error = ivas_orient_trk_Init_fx( hIvasRend->headRotData.hOrientationTracker ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_orient_trk_Init_fx( hIvasRend->headRotData.hOrientationTracker ) ), IVAS_ERR_OK ) ) { return error; } @@ -2042,6 +2090,7 @@ static void initRotGains_fx( { set_val_Word16( rot_gains[i], 0, MAX_INPUT_CHANNELS ); rot_gains[i][i] = ONE_IN_Q14; + move16(); } return; @@ -2057,6 +2106,7 @@ static void initRotGainsWord32_fx( { set_val_Word32( rot_gains[i], 0, MAX_INPUT_CHANNELS ); rot_gains[i][i] = ONE_IN_Q30; + move16(); } return; @@ -2086,13 +2136,19 @@ static void initRendInputBase_fx( const Word16 dataBufSize ) { inputBase->inConfig = inConfig; + move32(); inputBase->id = id; + move16(); inputBase->gain_fx = ONE_IN_Q30; + move32(); inputBase->ctx = rendCtx; inputBase->numNewSamplesPerChannel = 0; + move32(); inputBase->inputBuffer.config.numSamplesPerChannel = 0; inputBase->inputBuffer.config.numChannels = 0; + move16(); + move16(); inputBase->inputBuffer.data_fx = dataBuf; IF( inputBase->inputBuffer.data_fx != NULL ) { @@ -2135,12 +2191,19 @@ static IVAS_ISM_METADATA defaultObjectPosition( IVAS_ISM_METADATA pos; pos.azimuth_fx = 0; + move32(); pos.elevation_fx = 0; + move32(); pos.radius_fx = ONE_IN_Q9; + move16(); pos.spread_fx = 0; + move32(); pos.gainFactor_fx = ONE_IN_Q31; + move32(); pos.yaw_fx = 0; + move32(); pos.pitch_fx = 0; + move32(); #if 0 /*TODO: To be removed*/ pos.azimuth = 0.0f; pos.elevation = 0.0f; @@ -2187,6 +2250,7 @@ static Word8 checkObjectPositionChanged_fx( IVAS_ISM_METADATA *currentPos, IVAS_ISM_METADATA *previousPos ) { + test(); return !( LT_32( abs( L_sub( currentPos->azimuth_fx, previousPos->azimuth_fx ) ), EPSILLON_FX ) && LT_32( abs( L_sub( currentPos->elevation_fx, previousPos->elevation_fx ) ), EPSILLON_FX ) ); } @@ -2288,7 +2352,7 @@ static ivas_error initIsmMasaRendering( ivas_reverb_close( &inputIsm->hReverb ); - IF( ( error = ivas_omasa_ana_open( &inputIsm->hOMasa, inSampleRate, inputIsm->total_num_objects ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_omasa_ana_open( &inputIsm->hOMasa, inSampleRate, inputIsm->total_num_objects ) ), IVAS_ERR_OK ) ) { return error; } @@ -2347,7 +2411,7 @@ static ivas_error setRendInputActiveIsm( return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } - IF( ( error = allocateInputBaseBufferData_fx( &inputIsm->bufferData_fx, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = allocateInputBaseBufferData_fx( &inputIsm->bufferData_fx, MAX_BUFFER_LENGTH ) ), IVAS_ERR_OK ) ) { return error; } @@ -2368,17 +2432,19 @@ static ivas_error setRendInputActiveIsm( inputIsm->hOMasa = NULL; error = IVAS_ERR_OK; + move32(); + test(); IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) { - IF( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) { return error; } } ELSE IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_MASA1 ) || EQ_16( outConfig, IVAS_AUDIO_CONFIG_MASA2 ) ) { - IF( ( error = initIsmMasaRendering( inputIsm, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = initIsmMasaRendering( inputIsm, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) { return error; } @@ -2387,16 +2453,29 @@ static ivas_error setRendInputActiveIsm( { Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; Word16 num_src; - Word16 ivas_format = ( EQ_16( getAudioConfigType( inConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) ? MC_FORMAT : ISM_FORMAT; - IF( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, SrcInd, &num_src ) ) != IVAS_ERR_OK ) + Word16 ivas_format; + IF( EQ_32( getAudioConfigType( inConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) + { + ivas_format = MC_FORMAT; + } + ELSE + { + ivas_format = ISM_FORMAT; + } + + move16(); + IF( NE_32( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, SrcInd, &num_src ) ), IVAS_ERR_OK ) ) { return error; } Word16 nchan_rend = num_src; - IF( EQ_16( ivas_format, MC_FORMAT ) && NE_16( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) + move16(); + + test(); + IF( EQ_16( ivas_format, MC_FORMAT ) && NE_32( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { - nchan_rend--; /* Skip LFE channel -- added to the others */ + nchan_rend = sub( nchan_rend, 1 ); /* Skip LFE channel -- added to the others */ } FOR( Word16 nS = 0; nS < nchan_rend; nS++ ) { @@ -2406,15 +2485,17 @@ static ivas_error setRendInputActiveIsm( IF( Src_p->SrcSpatial_p != NULL ) { Src_p->SrcSpatial_p->q_Pos_p = Q31; + move16(); } TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[nS]->SrcSpatial_p; SrcSpatial_p->q_Pos_p = Q31; + move16(); } } IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { - IF( ( error = ivas_reverb_open_fx( &( inputIsm->hReverb ), outConfig, NULL, inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_reverb_open_fx( &( inputIsm->hReverb ), outConfig, NULL, inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) { return error; } @@ -2444,20 +2525,12 @@ static ivas_error setRendInputActiveIsm( return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } -#ifdef IVAS_FLOAT_FIXED - if ( ( error = allocateInputBaseBufferData_fx( &inputIsm->bufferData_fx, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) - { - return error; - } - initRendInputBase_fx( &inputIsm->base, inConfig, id, rendCtx, inputIsm->bufferData_fx, MAX_BUFFER_LENGTH ); -#else if ( ( error = allocateInputBaseBufferData( &inputIsm->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) { return error; } initRendInputBase( &inputIsm->base, inConfig, id, rendCtx, inputIsm->bufferData, MAX_BUFFER_LENGTH ); -#endif inputIsm->firstFrameRendered = FALSE; @@ -2466,15 +2539,8 @@ static ivas_error setRendInputActiveIsm( inputIsm->crendWrapper = NULL; inputIsm->hReverb = NULL; inputIsm->tdRendWrapper = defaultTdRendWrapper(); -#ifndef IVAS_FLOAT_FIXED initRotMatrix( inputIsm->rot_mat_prev ); -#else - initRotMatrix_fx( inputIsm->rot_mat_prev ); -#endif set_zero( inputIsm->prev_pan_gains, MAX_OUTPUT_CHANNELS ); -#ifdef IVAS_FLOAT_FIXED - set_zero_fx( inputIsm->prev_pan_gains_fx, MAX_OUTPUT_CHANNELS ); -#endif inputIsm->hOMasa = NULL; @@ -2496,61 +2562,16 @@ static ivas_error setRendInputActiveIsm( } else { -#ifdef IVAS_FLOAT_FIXED - Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; - Word16 num_src; - Word16 ivas_format = ( EQ_16( getAudioConfigType( inConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) ? MC_FORMAT : ISM_FORMAT; - IF( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, SrcInd, &num_src ) ) != IVAS_ERR_OK ) - { - return error; - } - - Word16 nchan_rend = num_src; - IF( EQ_16( ivas_format, MC_FORMAT ) && NE_16( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) - { - nchan_rend--; /* Skip LFE channel -- added to the others */ - } - FOR( Word16 nS = 0; nS < nchan_rend; nS++ ) - { - TDREND_SRC_t *Src_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[SrcInd[nS]]; - IF( Src_p != NULL ) - { - IF( Src_p->SrcSpatial_p != NULL ) - { - FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) - { - fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3 ); - fixedToFloat_arrL( Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3 ); - } - Src_p->SrcSpatial_p->q_Pos_p = Q31; - } - TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[nS]->SrcSpatial_p; - fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3 ); - fixedToFloat_arrL( SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3 ); - SrcSpatial_p->q_Pos_p = Q31; - } - } -#else if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } -#endif - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { -#ifdef IVAS_FLOAT_FIXED - - if ( ( error = ivas_reverb_open_fx( &( inputIsm->hReverb ), outConfig, NULL, inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } -#else if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), outConfig, NULL, inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } -#endif // IVAS_FLOAT_FIXED } } @@ -2576,7 +2597,7 @@ static void clearInputIsm( ivas_reverb_close( &inputIsm->hReverb ); - if ( inputIsm->tdRendWrapper.hBinRendererTd != NULL ) + IF( inputIsm->tdRendWrapper.hBinRendererTd != NULL ) { ivas_td_binaural_close_fx( &inputIsm->tdRendWrapper.hBinRendererTd ); inputIsm->tdRendWrapper.hHrtfTD = NULL; @@ -2597,10 +2618,6 @@ static void clearInputIsm( freeInputBaseBufferData( &inputIsm->base.inputBuffer.data ); initRendInputBase( &inputIsm->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); -#ifdef IVAS_FLOAT_FIXED - freeInputBaseBufferData_fx( &inputIsm->base.inputBuffer.data_fx ); - initRendInputBase_fx( &inputIsm->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); -#endif /* Free input's internal handles */ ivas_rend_closeCrend( &inputIsm->crendWrapper ); @@ -2609,11 +2626,7 @@ static void clearInputIsm( if ( inputIsm->tdRendWrapper.hBinRendererTd != NULL ) { -#ifdef IVAS_FLOAT_FIXED - ivas_td_binaural_close_fx( &inputIsm->tdRendWrapper.hBinRendererTd ); -#else ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd ); -#endif inputIsm->tdRendWrapper.hHrtfTD = NULL; } @@ -2651,7 +2664,15 @@ static void copyLsConversionMatrixToPanMatrix_fx( // inCh = lsConvMatrix[i].index / numColumns; outCh = lsConvMatrix[i].index % numColumns; move16(); - panMatrix[inCh][outCh] = EQ_32( lsConvMatrix[i].value, ONE_IN_Q30 ) ? ONE_IN_Q31 : L_shl( lsConvMatrix[i].value, 1 ); // Q31 + + IF( EQ_32( lsConvMatrix[i].value, ONE_IN_Q30 ) ) + { + panMatrix[inCh][outCh] = ONE_IN_Q31; + } + ELSE + { + panMatrix[inCh][outCh] = L_shl( lsConvMatrix[i].value, 1 ); + } move32(); } @@ -2843,17 +2864,17 @@ static ivas_error initMcPanGainsWithEfap_fx( IF( NE_32( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { - IF( ( error = getNumNonLfeChannelsInSpeakerLayout( inputMc->base.inConfig, &numNonLfeInChannels ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getNumNonLfeChannelsInSpeakerLayout( inputMc->base.inConfig, &numNonLfeInChannels ) ), IVAS_ERR_OK ) ) { return error; } - IF( ( error = getSpeakerAzimuths_fx( inputMc->base.inConfig, &spkAzi ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getSpeakerAzimuths_fx( inputMc->base.inConfig, &spkAzi ) ), IVAS_ERR_OK ) ) { return error; } - IF( ( error = getSpeakerElevations_fx( inputMc->base.inConfig, &spkEle ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getSpeakerElevations_fx( inputMc->base.inConfig, &spkEle ) ), IVAS_ERR_OK ) ) { return error; } @@ -2871,13 +2892,14 @@ static ivas_error initMcPanGainsWithEfap_fx( move32(); inLfeChIdx = -1; move16(); - IF( GT_16( inputMc->customLsInput.num_lfe, 0 ) ) + if ( inputMc->customLsInput.num_lfe > 0 ) { inLfeChIdx = inputMc->customLsInput.lfe_idx[0]; move16(); } } outChIdx = 0; + move16(); FOR( i = 0; i < numNonLfeInChannels; ++i ) { IF( EQ_16( i, inLfeChIdx ) ) @@ -2885,7 +2907,7 @@ static ivas_error initMcPanGainsWithEfap_fx( ++outChIdx; } - IF( ( error = getEfapGains_fx( *inputMc->base.ctx.pEfapOutWrapper, spkAzi[i], spkEle[i], inputMc->panGains_fx[outChIdx] ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getEfapGains_fx( *inputMc->base.ctx.pEfapOutWrapper, spkAzi[i], spkEle[i], inputMc->panGains_fx[outChIdx] ) ), IVAS_ERR_OK ) ) { return error; } @@ -2894,12 +2916,12 @@ static ivas_error initMcPanGainsWithEfap_fx( test(); test(); - IF( NE_32( outConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && GE_16( inLfeChIdx, 0 ) ) + IF( NE_32( outConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && inLfeChIdx >= 0 ) { inputMc->panGains_fx[inLfeChIdx][LFE_CHANNEL] = ONE_IN_Q31; move32(); } - ELSE IF( GT_16( inputMc->base.ctx.pCustomLsOut->num_lfe, 0 ) && GE_16( inLfeChIdx, 0 ) ) + ELSE IF( inputMc->base.ctx.pCustomLsOut->num_lfe > 0 && inLfeChIdx >= 0 ) { inputMc->panGains_fx[inLfeChIdx][inputMc->base.ctx.pCustomLsOut->lfe_idx[0]] = ONE_IN_Q31; move32(); @@ -2991,10 +3013,11 @@ static ivas_error getRendInputNumChannels( { pInputMc = (const input_mc *) rendInput; *numInChannels = add( pInputMc->customLsInput.num_spk, pInputMc->customLsInput.num_lfe ); + move16(); } ELSE { - IF( ( error = getAudioConfigNumChannels( pInputBase->inConfig, numInChannels ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getAudioConfigNumChannels( pInputBase->inConfig, numInChannels ) ), IVAS_ERR_OK ) ) { return error; } @@ -3043,7 +3066,7 @@ static ivas_error initMcPanGainsWithMonoOut_fx( bool skipSideSpeakers; ivas_error error; - IF( ( error = getRendInputNumChannels( inputMc, &numInChannels ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getRendInputNumChannels( inputMc, &numInChannels ) ), IVAS_ERR_OK ) ) { return error; } @@ -3072,9 +3095,10 @@ static ivas_error initMcPanGainsWithMonoOut_fx( * These should be skipped with 5.1+X inputs. */ skipSideSpeakers = false; test(); - IF( EQ_32( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_5_1_2 ) || EQ_32( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_5_1_4 ) ) + if ( EQ_32( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_5_1_2 ) || EQ_32( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_5_1_4 ) ) { skipSideSpeakers = true; + move16(); } readIdx = 0; move16(); @@ -3085,10 +3109,26 @@ static ivas_error initMcPanGainsWithMonoOut_fx( { /* Skip gains for side speakers in lookup table */ readIdx = add( readIdx, 2 ); - move16(); } - inputMc->panGains_fx[writeIdx][0] = ( EQ_32( ls_conversion_cicpX_mono_fx[readIdx][0], ONE_IN_Q30 ) ) ? ONE_IN_Q31 : L_shl( ls_conversion_cicpX_mono_fx[readIdx][0], 1 ); // Q31 + IF( EQ_32( ls_conversion_cicpX_mono_fx[readIdx][0], ONE_IN_Q30 ) ) + { + inputMc->panGains_fx[writeIdx][0] = ONE_IN_Q31; + } + ELSE + { + inputMc->panGains_fx[writeIdx][0] = L_shl( ls_conversion_cicpX_mono_fx[readIdx][0], 1 ); + } + move32(); + + IF( EQ_32( ls_conversion_cicpX_mono_fx[readIdx][0], ONE_IN_Q30 ) ) + { + inputMc->panGains_fx[writeIdx][0] = ONE_IN_Q31; + } + ELSE + { + inputMc->panGains_fx[writeIdx][0] = L_shl( ls_conversion_cicpX_mono_fx[readIdx][0], 1 ); // Q31 + } move32(); ++readIdx; } @@ -3177,13 +3217,15 @@ static ivas_error initMcPanGainsWithStereoLookup_fx( /* ls_conversion_cicpX_stereo contains gains for side speakers. * These should be skipped with 5.1+X inputs. */ skipSideSpeakers = false; + move16(); test(); - IF( EQ_32( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_5_1_2 ) || EQ_32( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_5_1_4 ) ) + if ( EQ_32( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_5_1_2 ) || EQ_32( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_5_1_4 ) ) { skipSideSpeakers = true; + move16(); } - IF( ( error = getRendInputNumChannels( inputMc, &numInChannels ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getRendInputNumChannels( inputMc, &numInChannels ) ), IVAS_ERR_OK ) ) { return error; } @@ -3191,16 +3233,31 @@ static ivas_error initMcPanGainsWithStereoLookup_fx( move16(); FOR( writeIdx = 0; writeIdx < numInChannels; ++writeIdx ) { + test(); IF( skipSideSpeakers && EQ_16( readIdx, 4 ) ) { /* Skip gains for side speakers in lookup table */ readIdx = add( readIdx, 2 ); - move16(); } - inputMc->panGains_fx[writeIdx][0] = EQ_32( ls_conversion_cicpX_stereo_fx[readIdx][0], ONE_IN_Q30 ) ? ONE_IN_Q31 : L_shl( ls_conversion_cicpX_stereo_fx[readIdx][0], 1 ); // Q31 + IF( EQ_32( ls_conversion_cicpX_stereo_fx[readIdx][0], ONE_IN_Q30 ) ) + { + inputMc->panGains_fx[writeIdx][0] = ONE_IN_Q31; + } + ELSE + { + inputMc->panGains_fx[writeIdx][0] = L_shl( ls_conversion_cicpX_stereo_fx[readIdx][0], 1 ); + } move32(); - inputMc->panGains_fx[writeIdx][1] = EQ_32( ls_conversion_cicpX_stereo_fx[readIdx][1], ONE_IN_Q30 ) ? ONE_IN_Q31 : L_shl( ls_conversion_cicpX_stereo_fx[readIdx][1], 1 ); // Q31 + + IF( EQ_32( ls_conversion_cicpX_stereo_fx[readIdx][1], ONE_IN_Q30 ) ) + { + inputMc->panGains_fx[writeIdx][1] = ONE_IN_Q31; + } + ELSE + { + inputMc->panGains_fx[writeIdx][1] = L_shl( ls_conversion_cicpX_stereo_fx[readIdx][1], 1 ); + } move32(); ++readIdx; } @@ -3270,7 +3327,7 @@ static bool configsAreEqual( /* Both input and output are custom LS - compare structs */ test(); - IF( EQ_16( configA, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && EQ_16( configB, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) + IF( EQ_32( configA, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && EQ_32( configB, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { IF( NE_16( customLsA.num_spk, customLsB.num_spk ) ) { @@ -3370,6 +3427,7 @@ static ivas_error updateLfePanGainsForMcOut( Word16 i, numLfeIn, numOutChannels; ivas_error error; error = IVAS_ERR_OK; + move32(); /* If panning is not required, simply return */ IF( !inputMc->lfeRouting.pan_lfe ) @@ -3385,7 +3443,7 @@ static ivas_error updateLfePanGainsForMcOut( } ELSE { - IF( ( error = getAudioConfigNumChannels( outConfig, &numOutChannels ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getAudioConfigNumChannels( outConfig, &numOutChannels ) ), IVAS_ERR_OK ) ) { return error; } @@ -3394,7 +3452,7 @@ static ivas_error updateLfePanGainsForMcOut( FOR( i = 0; i < numLfeIn; i++ ) { /* panning gains */ - IF( ( error = getEfapGains_fx( *inputMc->base.ctx.pEfapOutWrapper, inputMc->lfeRouting.lfeOutputAzimuth_fx, inputMc->lfeRouting.lfeOutputElevation_fx, inputMc->lfeRouting.lfePanMtx_fx[i] ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getEfapGains_fx( *inputMc->base.ctx.pEfapOutWrapper, inputMc->lfeRouting.lfeOutputAzimuth_fx, inputMc->lfeRouting.lfeOutputElevation_fx, inputMc->lfeRouting.lfePanMtx_fx[i] ) ), IVAS_ERR_OK ) ) { return error; } @@ -3458,6 +3516,7 @@ static ivas_error updateLfePanGainsForAmbiOut( Word16 numLfeIn, outAmbiOrder; ivas_error error; error = IVAS_ERR_OK; + move32(); /* If panning is not required, simply return */ IF( !inputMc->lfeRouting.pan_lfe ) @@ -3465,7 +3524,7 @@ static ivas_error updateLfePanGainsForAmbiOut( return error; } - IF( ( error = getAmbisonicsOrder_fx( outConfig, &outAmbiOrder ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getAmbisonicsOrder_fx( outConfig, &outAmbiOrder ) ), IVAS_ERR_OK ) ) { return error; } @@ -3543,18 +3602,26 @@ static ivas_error updateMcPanGainsForMcOut( { error = initMcPanGainsWithIdentMatrix( inputMc ); } - ELSE IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) || - EQ_16( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_MONO ) || - EQ_16( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) + ELSE IF( EQ_32( outConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) || + EQ_32( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_MONO ) || + EQ_32( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { test(); - IF( EQ_16( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_MONO ) && ( inputMc->nonDiegeticPan ) ) + IF( EQ_32( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_MONO ) && ( inputMc->nonDiegeticPan ) ) { - inputMc->panGains_fx[0][0] = EQ_32( inputMc->nonDiegeticPanGain_fx, ONE_IN_Q31 ) ? ONE_IN_Q31 : L_add( L_shr( inputMc->nonDiegeticPanGain_fx, 1 ), ONE_IN_Q30 ); + IF( EQ_32( inputMc->nonDiegeticPanGain_fx, ONE_IN_Q31 ) ) + { + inputMc->panGains_fx[0][0] = ONE_IN_Q31; + } + ELSE + { + inputMc->panGains_fx[0][0] = L_add( L_shr( inputMc->nonDiegeticPanGain_fx, 1 ), ONE_IN_Q30 ); + } move32(); inputMc->panGains_fx[0][1] = L_sub( ONE_IN_Q31, inputMc->panGains_fx[0][0] ); move32(); error = IVAS_ERR_OK; + move32(); } ELSE { @@ -3575,7 +3642,7 @@ static ivas_error updateMcPanGainsForMcOut( } /* check for errors from above block */ - IF( error != IVAS_ERR_OK ) + IF( NE_32( error, IVAS_ERR_OK ) ) { return error; } @@ -3658,24 +3725,24 @@ static ivas_error updateMcPanGainsForAmbiOut( const Word32 *spkAzi_fx, *spkEle_fx; ivas_error error; - IF( ( error = getAmbisonicsOrder_fx( outConfig, &outAmbiOrder ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getAmbisonicsOrder_fx( outConfig, &outAmbiOrder ) ), IVAS_ERR_OK ) ) { return error; } IF( NE_32( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { - IF( ( error = getNumNonLfeChannelsInSpeakerLayout( inputMc->base.inConfig, &numNonLfeInChannels ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getNumNonLfeChannelsInSpeakerLayout( inputMc->base.inConfig, &numNonLfeInChannels ) ), IVAS_ERR_OK ) ) { return error; } - IF( ( error = getSpeakerAzimuths_fx( inputMc->base.inConfig, &spkAzi_fx ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getSpeakerAzimuths_fx( inputMc->base.inConfig, &spkAzi_fx ) ), IVAS_ERR_OK ) ) { return error; } - IF( ( error = getSpeakerElevations_fx( inputMc->base.inConfig, &spkEle_fx ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getSpeakerElevations_fx( inputMc->base.inConfig, &spkEle_fx ) ), IVAS_ERR_OK ) ) { return error; } @@ -3685,16 +3752,34 @@ static ivas_error updateMcPanGainsForAmbiOut( { IF( EQ_16( ch_in, LFE_CHANNEL ) ) { - ++ch_out; + ch_out = add( ch_out, 1 ); } + move16(); + move16(); // move for typecasting Word32 to Word16 ivas_dirac_dec_get_response_fx( (Word16) L_shr( spkAzi_fx[ch_in], 22 ), (Word16) L_shr( spkEle_fx[ch_in], 22 ), inputMc->panGains_fx[ch_out], outAmbiOrder, Q29 ); FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { Word32 temp = inputMc->panGains_fx[ch_out][i]; move32(); - inputMc->panGains_fx[ch_out][i] = GE_32( abs( temp ), ONE_IN_Q29 ) ? ( GT_32( temp, 0 ) ? ONE_IN_Q31 : L_negate( ONE_IN_Q31 ) ) - : L_shl( temp, 2 ); // Q31 - move32(); + + IF( GE_32( abs( temp ), ONE_IN_Q29 ) ) + { + IF( temp > 0 ) + { + inputMc->panGains_fx[ch_out][i] = ONE_IN_Q31; + move32(); + } + ELSE + { + inputMc->panGains_fx[ch_out][i] = L_negate( ONE_IN_Q31 ); + move32(); + } + } + ELSE + { + inputMc->panGains_fx[ch_out][i] = L_shl( temp, 2 ); + move32(); + } } ++ch_in; } @@ -3715,7 +3800,7 @@ static ivas_error updateMcPanGainsForAmbiOut( { IF( EQ_16( inputMc->customLsInput.lfe_idx[lfeIdx], ch_in ) ) { - ++ch_out; + ch_out = add( ch_out, 1 ); BREAK; } } @@ -3725,16 +3810,31 @@ static ivas_error updateMcPanGainsForAmbiOut( { Word32 temp = inputMc->panGains_fx[ch_out][i]; move32(); - inputMc->panGains_fx[ch_out][i] = GE_32( abs( temp ), ONE_IN_Q29 ) ? ( GT_32( temp, 0 ) ? ONE_IN_Q31 : L_negate( ONE_IN_Q31 ) ) - : L_shl( temp, 2 ); // Q31 - move32(); + IF( GE_32( abs( temp ), ONE_IN_Q29 ) ) + { + IF( temp > 0 ) + { + inputMc->panGains_fx[ch_out][i] = ONE_IN_Q31; + move32(); + } + ELSE + { + inputMc->panGains_fx[ch_out][i] = L_negate( ONE_IN_Q31 ); + move32(); + } + } + ELSE + { + inputMc->panGains_fx[ch_out][i] = L_shl( temp, 2 ); + move32(); + } } ++ch_in; } } /* update LFE panning */ - IF( ( error = updateLfePanGainsForAmbiOut( inputMc, outConfig ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = updateLfePanGainsForAmbiOut( inputMc, outConfig ) ), IVAS_ERR_OK ) ) { return error; } @@ -3824,6 +3924,7 @@ static ivas_error updateMcPanGains( setZeroPanMatrix_fx( inputMc->panGains_fx ); error = IVAS_ERR_OK; + move32(); SWITCH( getAudioConfigType( outConfig ) ) { case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: @@ -3852,7 +3953,7 @@ static ivas_error updateMcPanGains( return IVAS_ERR_INVALID_OUTPUT_FORMAT; } /* Check error here to keep switch statement more compact */ - IF( error != IVAS_ERR_OK ) + IF( NE_32( error, IVAS_ERR_OK ) ) { return error; } @@ -3952,8 +4053,10 @@ static ivas_error initMcBinauralRendering( /* Allocate TD binaural renderer for custom loudspeaker layouts (regardless of headrotation) or planar MC layouts with headrotation, CREND for the rest */ useTDRend = FALSE; + move16(); IF( NE_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) { + test(); test(); test(); IF( EQ_16( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && NE_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) @@ -4000,6 +4103,7 @@ static ivas_error initMcBinauralRendering( } outSampleRate = *inputMc->base.ctx.pOutSampleRate; + move32(); test(); test(); @@ -4007,14 +4111,17 @@ static ivas_error initMcBinauralRendering( { Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; Word16 num_src; - IF( ( error = ivas_td_binaural_open_ext_fx( &inputMc->tdRendWrapper, inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate, SrcInd, &num_src ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_td_binaural_open_ext_fx( &inputMc->tdRendWrapper, inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate, SrcInd, &num_src ) ), IVAS_ERR_OK ) ) { return error; } Word16 nchan_rend = num_src; + move16(); + + test(); IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) && inputMc->hReverb == NULL ) { - nchan_rend--; /* Skip LFE channel -- added to the others */ + nchan_rend = sub( nchan_rend, 1 ); /* Skip LFE channel -- added to the others */ } FOR( Word16 nS = 0; nS < nchan_rend; nS++ ) { @@ -4024,17 +4131,20 @@ static ivas_error initMcBinauralRendering( IF( Src_p->SrcSpatial_p != NULL ) { Src_p->SrcSpatial_p->q_Pos_p = 31; + move16(); } IF( inputMc->tdRendWrapper.hBinRendererTd->Sources[nS] != NULL ) { TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputMc->tdRendWrapper.hBinRendererTd->Sources[nS]->SrcSpatial_p; SrcSpatial_p->q_Pos_p = 31; + move16(); } } } - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb == NULL ) + test(); + IF( EQ_32( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) && inputMc->hReverb == NULL ) { - IF( ( error = ivas_reverb_open_fx( &( inputMc->hReverb ), outConfig, NULL, inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_reverb_open_fx( &( inputMc->hReverb ), outConfig, NULL, inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, outSampleRate ) ), IVAS_ERR_OK ) ) { return error; } @@ -4043,30 +4153,45 @@ static ivas_error initMcBinauralRendering( ELSE IF( !useTDRend && inputMc->crendWrapper == NULL ) { /* open CREND */ - IF( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( EQ_16( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, NULL, outSampleRate ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( EQ_16( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, NULL, outSampleRate ) ), IVAS_ERR_OK ) ) { return error; } } /* Initialise the EFAP handle for rotation on input layout */ - IF( NE_16( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && inputMc->base.ctx.pHeadRotData->headRotEnabled && inputMc->efapInWrapper.hEfap == NULL ) + test(); + test(); + IF( NE_32( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && inputMc->base.ctx.pHeadRotData->headRotEnabled && inputMc->efapInWrapper.hEfap == NULL ) { - IF( ( error = initEfap( &inputMc->efapInWrapper, inConfig, NULL ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = initEfap( &inputMc->efapInWrapper, inConfig, NULL ) ), IVAS_ERR_OK ) ) { return error; } } /* determine binaural delay ( used for aligning LFE to output signal ) */ - binauralDelayNs = max( ( inputMc->crendWrapper != NULL ) ? inputMc->crendWrapper->binaural_latency_ns : 0, inputMc->tdRendWrapper.binaural_latency_ns ); + + IF( ( inputMc->crendWrapper != NULL ) ) + { + binauralDelayNs = inputMc->crendWrapper->binaural_latency_ns; + } + ELSE + { + binauralDelayNs = 0; + } + move32(); + + binauralDelayNs = L_max( binauralDelayNs, inputMc->tdRendWrapper.binaural_latency_ns ); Word16 exp = 0; + move16(); Word16 var1 = BASOP_Util_Divide3232_Scale( *inputMc->base.ctx.pOutSampleRate, 1000000000, &exp ); - Word32 var2 = L_shr_r( Mpy_32_32( binauralDelayNs, L_deposit_h( var1 ) ), -exp ); // 31 + exp + Word32 var2 = L_shr_r( Mpy_32_32( binauralDelayNs, L_deposit_h( var1 ) ), negate( exp ) ); // 31 + exp inputMc->binauralDelaySmp = (Word16) var2; + move16(); // inputMc->binauralDelaySmp = (int16_t) roundf( (float) binauralDelayNs * *inputMc->base.ctx.pOutSampleRate / 1000000000.f ); - IF( inputMc->binauralDelaySmp > MAX_BIN_DELAY_SAMPLES ) + IF( GT_16( inputMc->binauralDelaySmp, MAX_BIN_DELAY_SAMPLES ) ) { return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "Invalid delay for LFE binaural rendering!)" ); } @@ -4105,12 +4230,7 @@ static ivas_error initMcBinauralRendering( /* if TD renderer was open and we need to use CREND, close it */ if ( !reconfigureFlag || ( !useTDRend && inputMc->tdRendWrapper.hBinRendererTd != NULL ) ) { -#ifdef IVAS_FLOAT_FIXED - ivas_td_binaural_close_fx( &inputMc->tdRendWrapper.hBinRendererTd ); -#else ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); -#endif - inputMc->tdRendWrapper.hHrtfTD = NULL; } @@ -4137,70 +4257,17 @@ static ivas_error initMcBinauralRendering( if ( useTDRend && inputMc->tdRendWrapper.hBinRendererTd == NULL ) { -#ifdef IVAS_FLOAT_FIXED - Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; - Word16 num_src; - Word16 ivas_format = ( EQ_16( getAudioConfigType( inConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) ? MC_FORMAT : ISM_FORMAT; - IF( ( error = ivas_td_binaural_open_ext_fx( &inputMc->tdRendWrapper, inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate, SrcInd, &num_src ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_binaural_open_ext( &inputMc->tdRendWrapper, inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate ) ) != IVAS_ERR_OK ) { return error; } -#if 1 - Word16 nchan_rend = num_src; - IF( EQ_16( ivas_format, MC_FORMAT ) && NE_16( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) - { - nchan_rend--; /* Skip LFE channel -- added to the others */ - } - FOR( Word16 nS = 0; nS < nchan_rend; nS++ ) - { - TDREND_SRC_t *Src_p = inputMc->tdRendWrapper.hBinRendererTd->Sources[SrcInd[nS]]; - IF( Src_p != NULL ) - { - IF( Src_p->SrcSpatial_p != NULL ) - { - FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) - { - fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3 ); - } - Src_p->SrcSpatial_p->q_Pos_p = Q31; - } - TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputMc->tdRendWrapper.hBinRendererTd->Sources[nS]->SrcSpatial_p; - fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3 ); - SrcSpatial_p->q_Pos_p = Q31; - } - } -#endif -#else - if ( ( error = ivas_td_binaural_open_ext( &inputMc->tdRendWrapper, inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb == NULL ) { -#ifdef IVAS_FLOAT_FIXED - - if ( ( error = ivas_reverb_open_fx( &( inputMc->hReverb ), outConfig, NULL, inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } - -#if 0 /*Fixed to float conversions */ - FOR( Word16 k = 0; k < add( extract_l( L_shr( inputMc->hReverb->fft_size, 1 ) ), 1 ); k++ ) - { - ( inputMc->hReverb )->fft_filter_correl_0.fft_spectrum[k] = (float) ( inputMc->hReverb )->fft_filter_correl_0.fft_spectrum_fx[k] / ONE_IN_Q31; - ( inputMc->hReverb )->fft_filter_color_0.fft_spectrum[k] = (float) ( inputMc->hReverb )->fft_filter_color_0.fft_spectrum_fx[k] / ONE_IN_Q31; - ( inputMc->hReverb )->fft_filter_correl_1.fft_spectrum[k] = (float) ( inputMc->hReverb )->fft_filter_correl_1.fft_spectrum_fx[k] / ONE_IN_Q31; - ( inputMc->hReverb )->fft_filter_color_1.fft_spectrum[k] = (float) ( inputMc->hReverb )->fft_filter_color_1.fft_spectrum_fx[k] / ONE_IN_Q31; - } -#endif -#else if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), outConfig, NULL, inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) { return error; } -#endif } } else if ( !useTDRend && inputMc->crendWrapper == NULL ) @@ -4257,7 +4324,7 @@ static ivas_error initMcMasaRendering( efap_free_data( &inputMc->efapInWrapper.hEfap ); } - IF( ( error = ivas_mcmasa_ana_open( &inputMc->hMcMasa, inConfig, inSampleRate ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_mcmasa_ana_open( &inputMc->hMcMasa, inConfig, inSampleRate ) ), IVAS_ERR_OK ) ) { return error; } @@ -4274,11 +4341,7 @@ static ivas_error initMcMasaRendering( if ( inputMc->tdRendWrapper.hBinRendererTd != NULL ) { -#ifdef IVAS_FLOAT_FIXED - ivas_td_binaural_close_fx( &inputMc->tdRendWrapper.hBinRendererTd ); -#else ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); -#endif inputMc->tdRendWrapper.hHrtfTD = NULL; } @@ -4295,20 +4358,6 @@ static ivas_error initMcMasaRendering( { return error; } -#ifdef IVAS_FLOAT_FIXED -#if 0 /*Fixed to float conversion for ivas_mcmasa_ana_open (to be removed later)*/ - MCMASA_ANA_HANDLE hMcMasa = inputMc->hMcMasa; - Word16 i, j; - //fixedToFloat_arrL( hMcMasa->ls_azimuth_fx, hMcMasa->ls_azimuth, Q22, MCMASA_MAX_ANA_CHANS ); - /*FOR( i = 0; i < MCMASA_MAX_ANA_CHANS; i++ ) - { - FOR( j = 0; j < FOA_CHANNELS; j++ ) - { - hMcMasa->chnlToFoaMtx[j][i] = fixedToFloat( hMcMasa->chnlToFoaMtx_fx[j][i], Q31 ); - } - }*/ -#endif -#endif // IVAS_FLOAT_FIXED return IVAS_ERR_OK; } @@ -4330,6 +4379,7 @@ static lfe_routing defaultLfeRouting( set_val_Word32( routing.lfePanMtx_fx[i], 0, IVAS_MAX_OUTPUT_CHANNELS ); } routing.pan_lfe = false; + move16(); routing.lfeInputGain_fx = ONE_IN_Q31; move32(); @@ -4455,12 +4505,12 @@ static ivas_error setRendInputActiveMc( { return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } - IF( ( error = allocateMcLfeDelayBuffer_fx( &inputMc->lfeDelayBuffer_fx, MAX_BIN_DELAY_SAMPLES ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = allocateMcLfeDelayBuffer_fx( &inputMc->lfeDelayBuffer_fx, MAX_BIN_DELAY_SAMPLES ) ), IVAS_ERR_OK ) ) { return error; } - IF( ( error = allocateInputBaseBufferData_fx( &inputMc->bufferData_fx, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = allocateInputBaseBufferData_fx( &inputMc->bufferData_fx, MAX_BUFFER_LENGTH ) ), IVAS_ERR_OK ) ) { return error; } @@ -4480,24 +4530,28 @@ static ivas_error setRendInputActiveMc( inputMc->lfeRouting = defaultLfeRouting( inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ); set_val_Word32( inputMc->lfeDelayBuffer_fx, 0, MAX_BIN_DELAY_SAMPLES ); inputMc->binauralDelaySmp = 0; + move16(); + test(); + test(); IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { - IF( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg, FALSE ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg, FALSE ) ), IVAS_ERR_OK ) ) { return error; } } + test(); IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_MASA1 ) || EQ_16( outConfig, IVAS_AUDIO_CONFIG_MASA2 ) ) { - IF( ( error = initMcMasaRendering( inputMc, inConfig, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = initMcMasaRendering( inputMc, inConfig, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) { return error; } } - IF( ( error = updateMcPanGains( inputMc, outConfig ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = updateMcPanGains( inputMc, outConfig ) ), IVAS_ERR_OK ) ) { return error; } @@ -4581,9 +4635,6 @@ static void clearInputMc( rendCtx = inputMc->base.ctx; freeMcLfeDelayBuffer_fx( &inputMc->lfeDelayBuffer_fx ); freeInputBaseBufferData_fx( &inputMc->bufferData_fx ); -#if 0 - initRendInputBase( &inputMc->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); -#endif initRendInputBase_fx( &inputMc->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); /* Free input's internal handles */ @@ -4653,12 +4704,12 @@ static ivas_error initSbaPanGainsForMcOut( IVAS_OUTPUT_SETUP hOutSetup; ivas_error error; - IF( ( error = getAmbisonicsOrder_fx( inputSba->base.inConfig, &ambiOrderIn ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getAmbisonicsOrder_fx( inputSba->base.inConfig, &ambiOrderIn ) ), IVAS_ERR_OK ) ) { return error; } - IF( getAudioConfigType( outConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + IF( NE_32( getAudioConfigType( outConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) { assert( !"Invalid configuration" ); return IVAS_ERR_WRONG_PARAMS; @@ -4690,7 +4741,7 @@ static ivas_error initSbaPanGainsForMcOut( /* obtain and copy over HOA decoding matrix */ tmpDecMtx = NULL; - IF( ( error = ivas_sba_get_hoa_dec_matrix_fx( hOutSetup, &tmpDecMtx, ambiOrderIn ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_sba_get_hoa_dec_matrix_fx( hOutSetup, &tmpDecMtx, ambiOrderIn ) ), IVAS_ERR_OK ) ) { return error; } @@ -4700,11 +4751,13 @@ static ivas_error initSbaPanGainsForMcOut( { FOR( chInIdx = 0; chInIdx < SBA_NHARM_HOA3; ++chInIdx ) { - IF( hOutSetup.num_lfe > 0 && chOutIdx == hOutSetup.index_lfe[0] ) + test(); + IF( hOutSetup.num_lfe > 0 && EQ_16( chOutIdx, hOutSetup.index_lfe[0] ) ) { - continue; /* nothing to be rendered to LFE */ + CONTINUE; /* nothing to be rendered to LFE */ } inputSba->hoaDecMtx_fx[chInIdx][chOutIdx] = L_shl_sat( *readPtr++, 2 ); + move32(); } } free( tmpDecMtx ); @@ -4750,11 +4803,7 @@ static ivas_error initSbaPanGainsForMcOut( ivas_output_init( &hOutSetup, outConfig ); break; case IVAS_AUDIO_CONFIG_LS_CUSTOM: -#ifdef IVAS_FLOAT_FIXED - ivas_ls_custom_setup( &hOutSetup, (LSSETUP_CUSTOM_STRUCT *) outSetupCustom ); -#else ivas_ls_custom_setup( &hOutSetup, outSetupCustom ); -#endif break; default: assert( !"Invalid speaker config" ); @@ -4794,6 +4843,7 @@ static ivas_error initSbaPanGainsForSbaOut( { ivas_error error; error = IVAS_ERR_OK; + move32(); IF( NE_32( getAudioConfigType( outConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) { @@ -4854,7 +4904,7 @@ static ivas_error updateSbaPanGains( { case IVAS_AUDIO_CONFIG_BINAURAL: { - IF( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) { return error; @@ -4863,12 +4913,12 @@ static ivas_error updateSbaPanGains( BREAK; case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: - IF( ( error = initSbaPanGainsForMcOut( inputSba, IVAS_AUDIO_CONFIG_7_1_4, NULL ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = initSbaPanGainsForMcOut( inputSba, IVAS_AUDIO_CONFIG_7_1_4, NULL ) ), IVAS_ERR_OK ) ) { return error; } - IF( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) { return error; } @@ -4879,13 +4929,14 @@ static ivas_error updateSbaPanGains( BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: error = IVAS_ERR_OK; + move32(); BREAK; /* Do nothing */ default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; } /* Check error here to keep switch statement more compact */ - IF( error != IVAS_ERR_OK ) + IF( NE_32( error, IVAS_ERR_OK ) ) { return error; } @@ -4970,7 +5021,7 @@ static ivas_error initSbaMasaRendering( ivas_rend_closeCrend( &inputSba->crendWrapper ); - IF( ( error = ivas_dirac_ana_open_fx( &inputSba->hDirAC, inSampleRate ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_dirac_ana_open_fx( &inputSba->hDirAC, inSampleRate ) ), IVAS_ERR_OK ) ) { return error; } @@ -5017,13 +5068,14 @@ static ivas_error setRendInputActiveSba( inputSba = (input_sba *) input; rendCtx = inputSba->base.ctx; outConfig = *rendCtx.pOutConfig; + move32(); IF( !isIoConfigPairSupported( inConfig, outConfig ) ) { return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } - IF( ( error = allocateInputBaseBufferData_fx( &inputSba->bufferData_fx, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = allocateInputBaseBufferData_fx( &inputSba->bufferData_fx, MAX_BUFFER_LENGTH ) ), IVAS_ERR_OK ) ) { return error; } @@ -5035,15 +5087,16 @@ static ivas_error setRendInputActiveSba( inputSba->hDirAC = NULL; initRotGains_fx( inputSba->rot_gains_prev_fx ); - IF( outConfig == IVAS_AUDIO_CONFIG_MASA1 || outConfig == IVAS_AUDIO_CONFIG_MASA2 ) + test(); + IF( EQ_32( outConfig, IVAS_AUDIO_CONFIG_MASA1 ) || EQ_32( outConfig, IVAS_AUDIO_CONFIG_MASA2 ) ) { - IF( ( error = initSbaMasaRendering( inputSba, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = initSbaMasaRendering( inputSba, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) { return error; } } - IF( ( error = updateSbaPanGains( inputSba, outConfig, hRendCfg ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = updateSbaPanGains( inputSba, outConfig, hRendCfg ) ), IVAS_ERR_OK ) ) { return error; } @@ -5211,6 +5264,7 @@ static ivas_error setRendInputActiveMasa( inputMasa = (input_masa *) input; rendCtx = inputMasa->base.ctx; outConfig = *rendCtx.pOutConfig; + move32(); (void) hRendCfg; /* Suppress warning */ IF( !isIoConfigPairSupported( inConfig, outConfig ) ) @@ -5218,34 +5272,45 @@ static ivas_error setRendInputActiveMasa( return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } - IF( ( error = allocateInputBaseBufferData_fx( &inputMasa->bufferData_fx, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = allocateInputBaseBufferData_fx( &inputMasa->bufferData_fx, MAX_BUFFER_LENGTH ) ), IVAS_ERR_OK ) ) { return error; } #if 1 /*To be removed later:(contains malloc for inputMasa->bufferData)*/ - IF( ( error = allocateInputBaseBufferData( &inputMasa->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = allocateInputBaseBufferData( &inputMasa->bufferData, MAX_BUFFER_LENGTH ) ), IVAS_ERR_OK ) ) { return error; } #endif initRendInputBase_fx( &inputMasa->base, inConfig, id, rendCtx, inputMasa->bufferData_fx, MAX_BUFFER_LENGTH ); - IF( ( error = getAudioConfigNumChannels( inConfig, &numInChannels ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getAudioConfigNumChannels( inConfig, &numInChannels ) ), IVAS_ERR_OK ) ) { return error; } - IF( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) + IF( EQ_32( getAudioConfigType( outConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) ) { inputMasa->metadataHasBeenFed = false; - IF( ( error = masaPrerendOpen_fx( &inputMasa->hMasaPrerend, EQ_16( inputMasa->base.inConfig, IVAS_AUDIO_CONFIG_MASA1 ) ? 1 : 2, *( inputMasa->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + move16(); + Word16 temp; + IF( EQ_16( inputMasa->base.inConfig, IVAS_AUDIO_CONFIG_MASA1 ) ) + { + temp = 1; + } + ELSE + { + temp = 2; + } + move16(); + IF( NE_32( ( error = masaPrerendOpen_fx( &inputMasa->hMasaPrerend, temp, *( inputMasa->base.ctx.pOutSampleRate ) ) ), IVAS_ERR_OK ) ) { return error; } } ELSE { - IF( ( error = initMasaExtRenderer( inputMasa, outConfig ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = initMasaExtRenderer( inputMasa, outConfig ) ), IVAS_ERR_OK ) ) { return error; } @@ -5260,6 +5325,7 @@ static ivas_error setRendInputActiveMasa( } #endif // IVAS_FLOAT_FIXED +#ifdef IVAS_FLOAT_FIXED static void clearInputMasa( input_masa *inputMasa ) { @@ -5269,17 +5335,33 @@ static void clearInputMasa( freeInputBaseBufferData( &inputMasa->bufferData ); -#ifdef IVAS_FLOAT_FIXED masaPrerendClose_fx( &inputMasa->hMasaPrerend ); + + freeMasaExtRenderer( &inputMasa->hMasaExtRend ); + + initRendInputBase( &inputMasa->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); + + return; +} #else +static void clearInputMasa( + input_masa *inputMasa ) +{ + rendering_context rendCtx; + + rendCtx = inputMasa->base.ctx; + + freeInputBaseBufferData( &inputMasa->bufferData ); + masaPrerendClose( &inputMasa->hMasaPrerend ); -#endif + freeMasaExtRenderer( &inputMasa->hMasaExtRend ); initRendInputBase( &inputMasa->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); return; } +#endif #ifdef IVAS_FLOAT_FIXED @@ -5308,12 +5390,12 @@ ivas_error IVAS_REND_Open( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - IF( ( error = validateOutputAudioConfig( outConfig ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = validateOutputAudioConfig( outConfig ) ), IVAS_ERR_OK ) ) { return error; } - IF( ( error = validateOutputSampleRate( outputSampleRate, outConfig ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = validateOutputSampleRate( outputSampleRate, outConfig ) ), IVAS_ERR_OK ) ) { return error; } @@ -5334,34 +5416,34 @@ ivas_error IVAS_REND_Open( hIvasRend->num_subframes = num_subframes; /* Initialize limiter */ - IF( ( error = IVAS_REND_NumOutChannels( hIvasRend, &numOutChannels ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = IVAS_REND_NumOutChannels( hIvasRend, &numOutChannels ) ), IVAS_ERR_OK ) ) { return error; } - IF( ( error = initLimiter( &hIvasRend->hLimiter, numOutChannels, outputSampleRate ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = initLimiter( &hIvasRend->hLimiter, numOutChannels, outputSampleRate ) ), IVAS_ERR_OK ) ) { return error; } /* Initialize headrotation data */ - IF( ( error = initHeadRotation_fx( hIvasRend ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = initHeadRotation_fx( hIvasRend ) ), IVAS_ERR_OK ) ) { return error; } /* Initialize external orientation data */ - IF( ( error = ivas_external_orientation_open( &( hIvasRend->hExternalOrientationData ), num_subframes ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_external_orientation_open( &( hIvasRend->hExternalOrientationData ), num_subframes ) ), IVAS_ERR_OK ) ) { return error; } /* Initilize combined orientation data */ - IF( ( error = ivas_combined_orientation_open( &( hIvasRend->hCombinedOrientationData ), outputSampleRate, num_subframes ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_combined_orientation_open( &( hIvasRend->hCombinedOrientationData ), outputSampleRate, num_subframes ) ), IVAS_ERR_OK ) ) { return error; } /* Initialize EFAP */ - IF( ( error = initEfap( &hIvasRend->efapOutWrapper, outConfig, &hIvasRend->customLsOut ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = initEfap( &hIvasRend->efapOutWrapper, outConfig, &hIvasRend->customLsOut ) ), IVAS_ERR_OK ) ) { return error; } @@ -5378,7 +5460,9 @@ ivas_error IVAS_REND_Open( hIvasRend->inputsIsm[i].bufferData = NULL; #endif hIvasRend->inputsIsm[i].nonDiegeticPan = nonDiegeticPan; + move16(); hIvasRend->inputsIsm[i].nonDiegeticPanGain_fx = nonDiegeticPanGain; + move32(); hIvasRend->inputsIsm[i].hOMasa = NULL; hIvasRend->inputsIsm[i].bufferData_fx = NULL; } @@ -5397,7 +5481,9 @@ ivas_error IVAS_REND_Open( hIvasRend->inputsMc[i].bufferData_fx = NULL; hIvasRend->inputsMc[i].lfeDelayBuffer_fx = NULL; hIvasRend->inputsMc[i].nonDiegeticPan = nonDiegeticPan; + move16(); hIvasRend->inputsMc[i].nonDiegeticPanGain_fx = nonDiegeticPanGain; + move32(); hIvasRend->inputsMc[i].hMcMasa = NULL; } @@ -5421,6 +5507,7 @@ ivas_error IVAS_REND_Open( hIvasRend->inputsMasa[i].bufferData = NULL; hIvasRend->inputsMasa[i].hMasaPrerend = NULL; hIvasRend->inputsMasa[i].hMasaExtRend = NULL; + move16(); } @@ -5569,12 +5656,13 @@ ivas_error IVAS_REND_Open( static LSSETUP_CUSTOM_STRUCT makeCustomLsSetup( const IVAS_CUSTOM_LS_DATA rendCustomLsLayout ) { - int16_t i; + Word16 i; LSSETUP_CUSTOM_STRUCT customLs; /* Copy layout description */ customLs.num_spk = rendCustomLsLayout.num_spk; - for ( i = 0; i < rendCustomLsLayout.num_spk; i++ ) + move16(); + FOR( i = 0; i < rendCustomLsLayout.num_spk; i++ ) { customLs.ls_azimuth_fx[i] = (Word32) ( rendCustomLsLayout.azimuth[i] * ONE_IN_Q22 ); customLs.ls_elevation_fx[i] = (Word32) ( rendCustomLsLayout.elevation[i] * ONE_IN_Q22 ); @@ -5583,16 +5671,19 @@ static LSSETUP_CUSTOM_STRUCT makeCustomLsSetup( mvr2r( rendCustomLsLayout.elevation, customLs.ls_elevation, rendCustomLsLayout.num_spk ); customLs.is_planar_setup = 1; - for ( i = 0; i < rendCustomLsLayout.num_spk; ++i ) + move16(); + FOR( i = 0; i < rendCustomLsLayout.num_spk; ++i ) { - if ( fabsf( rendCustomLsLayout.elevation[i] ) > EPSILON ) + IF( fabsf( rendCustomLsLayout.elevation[i] ) > EPSILON ) { customLs.is_planar_setup = 0; - break; + move16(); + BREAK; } } customLs.num_lfe = rendCustomLsLayout.num_lfe; + move16(); mvs2s( rendCustomLsLayout.lfe_idx, customLs.lfe_idx, rendCustomLsLayout.num_lfe ); return customLs; @@ -5635,13 +5726,13 @@ static ivas_error validateCustomLsLayout_fx( /* Negative number of speakers or LFEs makes no sense */ test(); - IF( LT_16( layout.num_spk, 0 ) || LT_16( layout.num_lfe, 0 ) ) + IF( layout.num_spk < 0 || layout.num_lfe < 0 ) { return IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT; } /* There must be at least one speaker or LFE in the layout */ - IF( LE_16( add( layout.num_spk, layout.num_lfe ), 0 ) ) + IF( add( layout.num_spk, layout.num_lfe ) <= 0 ) { return IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT; } @@ -5649,7 +5740,7 @@ static ivas_error validateCustomLsLayout_fx( /* LFE indices must be positive */ FOR( i = 0; i < layout.num_lfe; ++i ) { - IF( LT_16( layout.lfe_idx[i], 0 ) ) + IF( layout.lfe_idx[i] < 0 ) { return IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT; } @@ -5695,6 +5786,7 @@ static ivas_error validateCustomLsLayout( * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED ivas_error IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( IVAS_REND_HANDLE hIvasRend, const IVAS_CUSTOM_LS_DATA layout ) @@ -5716,17 +5808,10 @@ ivas_error IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( return IVAS_ERR_INVALID_OUTPUT_FORMAT; } -#ifdef IVAS_FLOAT_FIXED - IF( ( error = validateCustomLsLayout_fx( layout ) ) != IVAS_ERR_OK ) - { - return error; - } -#else if ( ( error = validateCustomLsLayout( layout ) ) != IVAS_ERR_OK ) { return error; } -#endif hIvasRend->customLsOut = makeCustomLsSetup( layout ); @@ -5777,6 +5862,7 @@ ivas_error IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( /* Input inactive, skip. */ continue; } + if ( ( error = updateSbaPanGains( inputSba, hIvasRend->outputConfig, hIvasRend->hRendererConfig ) ) != IVAS_ERR_OK ) { return error; @@ -5786,6 +5872,92 @@ ivas_error IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( return IVAS_ERR_OK; } +#else +ivas_error IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( + IVAS_REND_HANDLE hIvasRend, + const IVAS_CUSTOM_LS_DATA layout ) +{ + Word16 i, numOutChannels; + ivas_error error; + input_mc *inputMc; + input_sba *inputSba; + + /* Validate function arguments */ + IF( hIvasRend == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + IF( NE_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) + { + /* Specifying details of custom speaker layout only makes sense if output config is set to custom speaker layout */ + return IVAS_ERR_INVALID_OUTPUT_FORMAT; + } + + IF( NE_32( ( error = validateCustomLsLayout_fx( layout ) ), IVAS_ERR_OK ) ) + { + return error; + } + + hIvasRend->customLsOut = makeCustomLsSetup( layout ); + + /* Re-initialize limiter - number of output channels may have changed */ + IF( NE_32( ( error = IVAS_REND_NumOutChannels( hIvasRend, &numOutChannels ) ), IVAS_ERR_OK ) ) + { + return error; + } + + IF( NE_32( ( error = initLimiter( &hIvasRend->hLimiter, numOutChannels, hIvasRend->sampleRateOut ) ), IVAS_ERR_OK ) ) + { + return error; + } + + /* Re-initialize EFAP - output layout has changed or has been fully defined for the first time */ + IF( NE_32( ( error = initEfap( &hIvasRend->efapOutWrapper, hIvasRend->outputConfig, &hIvasRend->customLsOut ) ), IVAS_ERR_OK ) ) + { + return error; + } + + /* Re-initialize panning gains for each active MC input, This includes re-initializing + * LFE handling for the new output layout, which means custom LFE handling is overwritten, + * if previously set for any MC input. */ + FOR( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) + { + inputMc = &hIvasRend->inputsMc[i]; + IF( EQ_32( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + { + /* Input inactive, skip. */ + CONTINUE; + } + + inputMc->lfeRouting = defaultLfeRouting( inputMc->base.inConfig, inputMc->customLsInput, hIvasRend->outputConfig, *inputMc->base.ctx.pCustomLsOut ); + + IF( NE_32( ( error = updateMcPanGains( inputMc, hIvasRend->outputConfig ) ), IVAS_ERR_OK ) ) + { + return error; + } + } + + /* Re-initialize panning gains for each active SBA input */ + FOR( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i ) + { + inputSba = &hIvasRend->inputsSba[i]; + + IF( EQ_32( inputSba->base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + { + /* Input inactive, skip. */ + CONTINUE; + } + IF( NE_32( ( error = updateSbaPanGains( inputSba, hIvasRend->outputConfig, hIvasRend->hRendererConfig ) ), IVAS_ERR_OK ) ) + { + return error; + } + } + + return IVAS_ERR_OK; +} +#endif + #ifdef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * IVAS_REND_NumOutChannels() @@ -5811,9 +5983,10 @@ ivas_error IVAS_REND_NumOutChannels( { case IVAS_AUDIO_CONFIG_LS_CUSTOM: *numOutChannels = add( hIvasRend->customLsOut.num_spk, hIvasRend->customLsOut.num_lfe ); + move16(); BREAK; default: - IF( ( error = getAudioConfigNumChannels( hIvasRend->outputConfig, numOutChannels ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getAudioConfigNumChannels( hIvasRend->outputConfig, numOutChannels ) ), IVAS_ERR_OK ) ) { return error; } @@ -5898,7 +6071,7 @@ static ivas_error getInputById( configType = L_shr( L_and( inputId, 0xFF00 ), 8 ); /* Validate values derived from input ID */ - IF( LT_32( inputIndex, 0 ) ) + IF( inputIndex < 0 ) { return IVAS_ERR_INVALID_INPUT_ID; } @@ -6030,7 +6203,7 @@ static ivas_error getConstInputById( configType = L_shr( L_and( inputId, 0xFF00 ), 8 ); /* Validate values derived from input ID */ - IF( LT_32( inputIndex, 0 ) ) + IF( inputIndex < 0 ) { return IVAS_ERR_INVALID_INPUT_ID; } @@ -6207,6 +6380,7 @@ static ivas_error findFreeInputSlot_fx( const input_base *pInputBase; canAddInput = false; + move16(); /* Find first unused input in array */ FOR( ( i = 0, pByte = inputs ); i < maxInputs; ( ++i, pByte += inputStructSize ) ) @@ -6216,7 +6390,9 @@ static ivas_error findFreeInputSlot_fx( IF( EQ_32( pInputBase->inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { *inputIndex = i; + move32(); canAddInput = true; + move16(); BREAK; } } @@ -6317,6 +6493,7 @@ ivas_error IVAS_REND_AddInput_fx( Word32 inputIndex; /* Validate function arguments */ + test(); IF( hIvasRend == NULL || inputId == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -6330,38 +6507,47 @@ ivas_error IVAS_REND_AddInput_fx( inputsArray = hIvasRend->inputsIsm; inputStructSize = sizeof( *hIvasRend->inputsIsm ); activateInput = setRendInputActiveIsm; + move32(); + move32(); BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: maxNumInputsOfType = RENDERER_MAX_MC_INPUTS; inputsArray = hIvasRend->inputsMc; inputStructSize = sizeof( *hIvasRend->inputsMc ); activateInput = setRendInputActiveMc; + move32(); + move32(); BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: maxNumInputsOfType = RENDERER_MAX_SBA_INPUTS; inputsArray = hIvasRend->inputsSba; inputStructSize = sizeof( *hIvasRend->inputsSba ); activateInput = setRendInputActiveSba; + move32(); + move32(); BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: maxNumInputsOfType = RENDERER_MAX_MASA_INPUTS; inputsArray = hIvasRend->inputsMasa; inputStructSize = sizeof( *hIvasRend->inputsMasa ); activateInput = setRendInputActiveMasa; + move32(); + move32(); BREAK; default: return IVAS_ERR_INVALID_INPUT_FORMAT; } /* Find first free input in array corresponding to input type */ - IF( ( error = findFreeInputSlot_fx( inputsArray, inputStructSize, maxNumInputsOfType, &inputIndex ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = findFreeInputSlot_fx( inputsArray, inputStructSize, maxNumInputsOfType, &inputIndex ) ), IVAS_ERR_OK ) ) { return error; } *inputId = makeInputId( inConfig, inputIndex ); + move16(); - IF( ( error = activateInput( (uint8_t *) inputsArray + inputStructSize * inputIndex, inConfig, *inputId, hIvasRend->hRendererConfig ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = activateInput( (UWord8 *) inputsArray + inputStructSize * inputIndex, inConfig, *inputId, hIvasRend->hRendererConfig ) ), IVAS_ERR_OK ) ) { return error; } @@ -6393,17 +6579,17 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - IF( ( error = validateCustomLsLayout_fx( layout ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = validateCustomLsLayout_fx( layout ) ), IVAS_ERR_OK ) ) { return error; } - IF( ( error = getInputById( hIvasRend, inputId, (void **) &inputMc ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getInputById( hIvasRend, inputId, (void **) &inputMc ) ), IVAS_ERR_OK ) ) { return error; } - IF( inputMc->base.inConfig != IVAS_AUDIO_CONFIG_LS_CUSTOM ) + IF( NE_32( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { /* Specifying details of custom speaker layout only makes sense if input config is set to custom speaker layout */ return IVAS_ERR_INVALID_INPUT_FORMAT; @@ -6416,20 +6602,22 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( inputMc->lfeRouting = defaultLfeRouting( inputMc->base.inConfig, inputMc->customLsInput, hIvasRend->outputConfig, *inputMc->base.ctx.pCustomLsOut ); - IF( ( error = initEfap( &inputMc->efapInWrapper, inputMc->base.inConfig, &inputMc->customLsInput ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = initEfap( &inputMc->efapInWrapper, inputMc->base.inConfig, &inputMc->customLsInput ) ), IVAS_ERR_OK ) ) { return error; } + test(); + test(); IF( EQ_16( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_16( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_16( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { - IF( ( error = initMcBinauralRendering( inputMc, inputMc->base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig, FALSE ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = initMcBinauralRendering( inputMc, inputMc->base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig, FALSE ) ), IVAS_ERR_OK ) ) { return error; } } - IF( ( error = updateMcPanGains( inputMc, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = updateMcPanGains( inputMc, hIvasRend->outputConfig ) ), IVAS_ERR_OK ) ) { return error; } @@ -6550,12 +6738,13 @@ ivas_error IVAS_REND_SetInputGain_fx( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - IF( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ), IVAS_ERR_OK ) ) { return error; } inputBase->gain_fx = gain; + move32(); return IVAS_ERR_OK; } @@ -6627,12 +6816,12 @@ ivas_error IVAS_REND_SetInputLfeMtx_fx( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - IF( ( error = getInputById( hIvasRend, inputId, (void **) &pInputBase ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getInputById( hIvasRend, inputId, (void **) &pInputBase ) ), IVAS_ERR_OK ) ) { return error; } - IF( getAudioConfigType( pInputBase->inConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + IF( NE_32( getAudioConfigType( pInputBase->inConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) { /* Custom LFE panning matrix only makes sense with channel-based input */ return IVAS_ERR_INVALID_INPUT_FORMAT; @@ -6645,7 +6834,7 @@ ivas_error IVAS_REND_SetInputLfeMtx_fx( Copy32( ( *lfePanMtx )[i], pInputMc->lfeRouting.lfePanMtx_fx[i], IVAS_MAX_OUTPUT_CHANNELS ); } - IF( ( error = updateMcPanGains( pInputMc, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = updateMcPanGains( pInputMc, hIvasRend->outputConfig ) ), IVAS_ERR_OK ) ) { return error; } @@ -6679,12 +6868,12 @@ ivas_error IVAS_REND_SetInputLfePos_fx( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - IF( ( error = getInputById( hIvasRend, inputId, (void **) &pInputBase ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getInputById( hIvasRend, inputId, (void **) &pInputBase ) ), IVAS_ERR_OK ) ) { return error; } - IF( getAudioConfigType( pInputBase->inConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + IF( NE_32( getAudioConfigType( pInputBase->inConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) { /* Custom LFE routing only makes sense with channel-based input */ return IVAS_ERR_INVALID_INPUT_FORMAT; @@ -6692,11 +6881,15 @@ ivas_error IVAS_REND_SetInputLfePos_fx( pInputMc = (input_mc *) pInputBase; pInputMc->lfeRouting.pan_lfe = true; - pInputMc->lfeRouting.lfeInputGain_fx = inputGain; // Q31 - pInputMc->lfeRouting.lfeOutputAzimuth_fx = (Word16) ( outputAzimuth ); // Q0 + move16(); + pInputMc->lfeRouting.lfeInputGain_fx = inputGain; // Q31 + move32(); + pInputMc->lfeRouting.lfeOutputAzimuth_fx = (Word16) ( outputAzimuth ); // Q0 + move16(); pInputMc->lfeRouting.lfeOutputElevation_fx = (Word16) ( outputElevation ); // Q0 + move16(); - IF( ( error = updateMcPanGains( pInputMc, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = updateMcPanGains( pInputMc, hIvasRend->outputConfig ) ), IVAS_ERR_OK ) ) { return error; } @@ -6763,30 +6956,30 @@ ivas_error IVAS_REND_RemoveInput( input_base *inputBase; /* Validate function arguments */ - if ( hIvasRend == NULL ) + IF( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - if ( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ), IVAS_ERR_OK ) ) { return error; } - switch ( getAudioConfigType( inputBase->inConfig ) ) + SWITCH( getAudioConfigType( inputBase->inConfig ) ) { case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED: clearInputIsm( (input_ism *) inputBase ); - break; + BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: clearInputMc( (input_mc *) inputBase ); - break; + BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: clearInputSba( (input_sba *) inputBase ); - break; + BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: clearInputMasa( (input_masa *) inputBase ); - break; + BREAK; default: return IVAS_ERR_INVALID_INPUT_FORMAT; } @@ -6839,17 +7032,18 @@ ivas_error IVAS_REND_GetInputNumChannels( const input_base *pInput; /* Validate function arguments */ + test(); IF( hIvasRend == NULL || numChannels == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - IF( ( error = getConstInputById( hIvasRend, inputId, (const void **) &pInput ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getConstInputById( hIvasRend, inputId, (const void **) &pInput ) ), IVAS_ERR_OK ) ) { return error; } - IF( ( error = getRendInputNumChannels( pInput, numChannels ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getRendInputNumChannels( pInput, numChannels ) ), IVAS_ERR_OK ) ) { return error; } @@ -6887,14 +7081,17 @@ ivas_error IVAS_REND_GetNumAllObjects( Word16 *numChannels /* o : number of all objects */ ) { + test(); IF( hIvasRend == NULL || numChannels == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + test(); IF( EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_MASA1 ) || EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_MASA2 ) ) { *numChannels = (Word16) hIvasRend->inputsIsm[0].total_num_objects; + move16(); } return IVAS_ERR_OK; @@ -6993,23 +7190,37 @@ ivas_error IVAS_REND_GetDelay_fx( Word32 timescale_by_ns[7] = { 0, 17180, 34360, 0, 68719, 0, 103079 }; /* Validate function arguments */ + test(); + test(); IF( hIvasRend == NULL || nSamples == NULL || timeScale == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } *timeScale = hIvasRend->sampleRateOut; + move32(); assert( *timeScale == 8000 || *timeScale == 16000 || *timeScale == 32000 || *timeScale == 48000 ); *nSamples = 0; + move16(); max_latency_ns = 0; + move32(); /* Compute the maximum delay across all inputs */ FOR( i = 0; i < RENDERER_MAX_ISM_INPUTS; i++ ) { IF( NE_32( hIvasRend->inputsIsm[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { - latency_ns = L_max( ( hIvasRend->inputsIsm[i].crendWrapper != NULL ) ? hIvasRend->inputsIsm[i].crendWrapper->binaural_latency_ns : 0, - hIvasRend->inputsIsm[i].tdRendWrapper.binaural_latency_ns ); + IF( hIvasRend->inputsIsm[i].crendWrapper != NULL ) + { + latency_ns = hIvasRend->inputsIsm[i].crendWrapper->binaural_latency_ns; + } + ELSE + { + latency_ns = 0; + } + move32(); + + latency_ns = L_max( latency_ns, hIvasRend->inputsIsm[i].tdRendWrapper.binaural_latency_ns ); max_latency_ns = L_max( max_latency_ns, latency_ns ); } } @@ -7018,8 +7229,18 @@ ivas_error IVAS_REND_GetDelay_fx( { IF( NE_32( hIvasRend->inputsMc[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { - latency_ns = L_max( ( hIvasRend->inputsMc[i].crendWrapper != NULL ) ? hIvasRend->inputsMc[i].crendWrapper->binaural_latency_ns : 0, - hIvasRend->inputsMc[i].tdRendWrapper.binaural_latency_ns ); + IF( ( hIvasRend->inputsMc[i].crendWrapper != NULL ) ) + { + latency_ns = hIvasRend->inputsMc[i].crendWrapper->binaural_latency_ns; + } + ELSE + { + latency_ns = 0; + } + + move32(); + + latency_ns = L_max( latency_ns, hIvasRend->inputsMc[i].tdRendWrapper.binaural_latency_ns ); max_latency_ns = L_max( max_latency_ns, latency_ns ); } } @@ -7029,24 +7250,37 @@ ivas_error IVAS_REND_GetDelay_fx( IF( NE_32( hIvasRend->inputsSba[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { { - latency_ns = ( hIvasRend->inputsSba[i].crendWrapper != NULL ) ? hIvasRend->inputsSba[i].crendWrapper->binaural_latency_ns : 0; - max_latency_ns = L_max( max_latency_ns, latency_ns ); - } - } + IF( hIvasRend->inputsSba[i].crendWrapper != NULL ) + { + latency_ns = hIvasRend->inputsSba[i].crendWrapper->binaural_latency_ns; + } + ELSE + { + latency_ns = 0; + } + move32(); + max_latency_ns = L_max( max_latency_ns, latency_ns ); + } + } } - FOR( i = 0; i < RENDERER_MAX_MASA_INPUTS; i++ ){ - IF( NE_32( hIvasRend->inputsMasa[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ){ + FOR( i = 0; i < RENDERER_MAX_MASA_INPUTS; i++ ) + { + IF( NE_32( hIvasRend->inputsMasa[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + { latency_ns = (Word32) ( IVAS_FB_DEC_DELAY_NS ); - max_latency_ns = L_max( max_latency_ns, latency_ns ); -} -} + max_latency_ns = L_max( max_latency_ns, latency_ns ); + } + } -//*nSamples = (Word16) roundf( (float) max_latency_ns * *timeScale / 1000000000.f ); -*nSamples = extract_l( Mpy_32_32_r( max_latency_ns, timescale_by_ns[*timeScale / 8000] ) ); -return IVAS_ERR_OK; + //*nSamples = (Word16) roundf( (float) max_latency_ns * *timeScale / 1000000000.f ); + Word32 temp = Mpy_32_32( *timeScale, 268436 ); // Q0 + Q31 - Q31 -> Q0, ( 1 / 8000 ) * 2 ^ 31 + *nSamples = extract_l( Mpy_32_32_r( max_latency_ns, timescale_by_ns[temp] ) ); + move16(); + + return IVAS_ERR_OK; } #endif @@ -7068,40 +7302,47 @@ ivas_error IVAS_REND_FeedInputAudio_fx( Word16 numInputChannels; /* Validate function arguments */ + test(); IF( hIvasRend == NULL || inputAudio.data == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - IF( LE_16( inputAudio.config.numSamplesPerChannel, 0 ) || LT_16( MAX_BUFFER_LENGTH_PER_CHANNEL, inputAudio.config.numSamplesPerChannel ) ) + test(); + IF( inputAudio.config.numSamplesPerChannel <= 0 || LT_16( MAX_BUFFER_LENGTH_PER_CHANNEL, inputAudio.config.numSamplesPerChannel ) ) { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Buffer size outside of supported range" ); } - IF( LE_16( inputAudio.config.numChannels, 0 ) || LT_16( MAX_INPUT_CHANNELS, inputAudio.config.numChannels ) ) + test(); + IF( inputAudio.config.numChannels <= 0 || LT_16( MAX_INPUT_CHANNELS, inputAudio.config.numChannels ) ) { return IVAS_ERR_WRONG_NUM_CHANNELS; } - IF( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && - inputAudio.config.numSamplesPerChannel * 1000 != ( BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->num_subframes ) * hIvasRend->sampleRateOut ) + test(); + move32(); // move added for typecasting + IF( EQ_32( getAudioConfigType( hIvasRend->outputConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) && + NE_32( L_mult0( inputAudio.config.numSamplesPerChannel, 1000 ), (Word32) W_mult0_32_32( L_mult0( BINAURAL_RENDERING_FRAME_SIZE_MS, hIvasRend->num_subframes ), hIvasRend->sampleRateOut ) ) ) { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Binaural rendering requires specific frame size" ); } - IF( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ), IVAS_ERR_OK ) ) { return error; } - IF( ( error = getRendInputNumChannels( inputBase, &numInputChannels ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getRendInputNumChannels( inputBase, &numInputChannels ) ), IVAS_ERR_OK ) ) { return error; } - - IF( ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_MASA1 || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_MASA2 ) && inputBase->inConfig == IVAS_AUDIO_CONFIG_OBA ) + test(); + test(); + IF( ( EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_MASA1 ) || EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_MASA2 ) ) && EQ_32( inputBase->inConfig, IVAS_AUDIO_CONFIG_OBA ) ) { numInputChannels = (Word16) hIvasRend->inputsIsm[0].total_num_objects; + move16(); } IF( NE_16( numInputChannels, inputAudio.config.numChannels ) ) @@ -7114,6 +7355,7 @@ ivas_error IVAS_REND_FeedInputAudio_fx( mvr2r_Word32( inputAudio.data_fx, inputBase->inputBuffer.data_fx, inputAudio.config.numSamplesPerChannel * inputAudio.config.numChannels ); inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel; + move32(); return IVAS_ERR_OK; } @@ -7136,43 +7378,50 @@ ivas_error IVAS_REND_FeedInputAudio( int16_t numInputChannels; /* Validate function arguments */ - if ( hIvasRend == NULL || inputAudio.data == NULL ) + test(); + IF( hIvasRend == NULL || inputAudio.data == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - if ( inputAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel ) + test(); + IF( inputAudio.config.numSamplesPerChannel <= 0 || LT_16( MAX_BUFFER_LENGTH_PER_CHANNEL, inputAudio.config.numSamplesPerChannel ) ) { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Buffer size outside of supported range" ); } - if ( inputAudio.config.numChannels <= 0 || MAX_INPUT_CHANNELS < inputAudio.config.numChannels ) + test(); + IF( inputAudio.config.numChannels <= 0 || MAX_INPUT_CHANNELS < inputAudio.config.numChannels ) { return IVAS_ERR_WRONG_NUM_CHANNELS; } - if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && - inputAudio.config.numSamplesPerChannel * 1000 != ( BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->num_subframes ) * hIvasRend->sampleRateOut ) + test(); + move32(); // move added for typecasting + IF( EQ_32( getAudioConfigType( hIvasRend->outputConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) && + NE_32( L_mult0( inputAudio.config.numSamplesPerChannel, 1000 ), (Word32) W_mult0_32_32( L_mult0( BINAURAL_RENDERING_FRAME_SIZE_MS, hIvasRend->num_subframes ), hIvasRend->sampleRateOut ) ) ) { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Binaural rendering requires specific frame size" ); } - if ( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ), IVAS_ERR_OK ) ) { return error; } - if ( ( error = getRendInputNumChannels( inputBase, &numInputChannels ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getRendInputNumChannels( inputBase, &numInputChannels ) ), IVAS_ERR_OK ) ) { return error; } - if ( ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_MASA1 || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_MASA2 ) && inputBase->inConfig == IVAS_AUDIO_CONFIG_OBA ) + test(); + test(); + IF( ( EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_MASA1 ) || EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_MASA2 ) ) && EQ_32( inputBase->inConfig, IVAS_AUDIO_CONFIG_OBA ) ) { - numInputChannels = (int16_t) hIvasRend->inputsIsm[0].total_num_objects; + numInputChannels = (Word16) hIvasRend->inputsIsm[0].total_num_objects; } - if ( numInputChannels != inputAudio.config.numChannels ) + IF( NE_16( numInputChannels, inputAudio.config.numChannels ) ) { return IVAS_ERR_WRONG_NUM_CHANNELS; } @@ -7185,6 +7434,7 @@ ivas_error IVAS_REND_FeedInputAudio( mvr2r( inputAudio.data, inputBase->inputBuffer.data, inputAudio.config.numSamplesPerChannel * inputAudio.config.numChannels ); inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel; + move32(); return IVAS_ERR_OK; } @@ -7213,7 +7463,7 @@ ivas_error IVAS_REND_FeedInputObjectMetadata( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - IF( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ), IVAS_ERR_OK ) ) { return error; } @@ -7340,7 +7590,7 @@ ivas_error IVAS_REND_FeedInputMasaMetadata( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - IF( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ), IVAS_ERR_OK ) ) { return error; } @@ -7354,6 +7604,7 @@ ivas_error IVAS_REND_FeedInputMasaMetadata( inputMasa = (input_masa *) inputBase; inputMasa->masaMetadata = *masaMetadata; inputMasa->metadataHasBeenFed = true; + move16(); return IVAS_ERR_OK; } @@ -7408,39 +7659,36 @@ ivas_error IVAS_REND_InitConfig( ivas_error error; bool rendererConfigEnabled; - rendererConfigEnabled = ( getAudioConfigType( outAudioConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ); + rendererConfigEnabled = EQ_32( getAudioConfigType( outAudioConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ); IF( rendererConfigEnabled ) { hIvasRend->rendererConfigEnabled = 1; + move16(); } ELSE { hIvasRend->rendererConfigEnabled = 0; + move16(); } - IF( rendererConfigEnabled ){ - IF( ( error = ivas_render_config_open( &( hIvasRend->hRendererConfig ) ) ) != IVAS_ERR_OK ){ + IF( rendererConfigEnabled ) + { + IF( NE_32( ( error = ivas_render_config_open( &( hIvasRend->hRendererConfig ) ) ), IVAS_ERR_OK ) ) + { return error; -} -#ifdef IVAS_FLOAT_FIXED -IF( ( error = ivas_render_config_init_from_rom_fx( &hIvasRend->hRendererConfig ) ) != IVAS_ERR_OK ) -{ - return error; -} -#else -IF( ( error = ivas_render_config_init_from_rom( &hIvasRend->hRendererConfig ) ) != IVAS_ERR_OK ) -{ - return error; -} -#endif -} -ELSE -{ - hIvasRend->hRendererConfig = NULL; -} + } + IF( NE_32( ( error = ivas_render_config_init_from_rom_fx( &hIvasRend->hRendererConfig ) ), IVAS_ERR_OK ) ) + { + return error; + } + } + ELSE + { + hIvasRend->hRendererConfig = NULL; + } -return IVAS_ERR_OK; + return IVAS_ERR_OK; } #else ivas_error IVAS_REND_InitConfig( @@ -7569,13 +7817,15 @@ int16_t IVAS_REND_FeedRenderConfig( * *-------------------------------------------------------------------*/ -int16_t IVAS_REND_GetRenderConfig( +Word16 IVAS_REND_GetRenderConfig( IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ const IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render configuration handle */ ) { RENDER_CONFIG_HANDLE hRCin; + test(); + test(); IF( hIvasRend == NULL || hIvasRend->hRendererConfig == NULL || hRCout == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -7587,6 +7837,10 @@ int16_t IVAS_REND_GetRenderConfig( hRCout->roomAcoustics.acousticPreDelay_fx = hRCin->roomAcoustics.acousticPreDelay_fx; hRCout->roomAcoustics.inputPreDelay_fx = hRCin->roomAcoustics.inputPreDelay_fx; Copy( hRCin->directivity_fx, hRCout->directivity_fx, 3 * MAX_NUM_OBJECTS ); + move16(); + move16(); + move32(); + move32(); Copy32( hRCin->roomAcoustics.pFc_input_fx, hRCout->roomAcoustics.pFc_input_fx, CLDFB_NO_CHANNELS_MAX ); Copy32( hRCin->roomAcoustics.pAcoustic_rt60_fx, hRCout->roomAcoustics.pAcoustic_rt60_fx, CLDFB_NO_CHANNELS_MAX ); @@ -7595,6 +7849,8 @@ int16_t IVAS_REND_GetRenderConfig( hRCout->roomAcoustics.use_er = hRCin->roomAcoustics.use_er; hRCout->roomAcoustics.lowComplexity = hRCin->roomAcoustics.lowComplexity; + move16(); + move32(); return IVAS_ERR_OK; } @@ -7606,33 +7862,41 @@ int16_t IVAS_REND_GetRenderConfig( * *-------------------------------------------------------------------*/ -int16_t IVAS_REND_FeedRenderConfig( +Word16 IVAS_REND_FeedRenderConfig( IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ const IVAS_RENDER_CONFIG_DATA renderConfig /* i : Render configuration struct */ ) { RENDER_CONFIG_HANDLE hRenderConfig; - if ( hIvasRend == NULL || hIvasRend->hRendererConfig == NULL ) + test(); + IF( hIvasRend == NULL || hIvasRend->hRendererConfig == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } hRenderConfig = hIvasRend->hRendererConfig; hRenderConfig->roomAcoustics.override = renderConfig.roomAcoustics.override; + move16(); hRenderConfig->roomAcoustics.nBands = renderConfig.roomAcoustics.nBands; + move16(); hRenderConfig->roomAcoustics.acousticPreDelay_fx = renderConfig.roomAcoustics.acousticPreDelay_fx; + move32(); hRenderConfig->roomAcoustics.inputPreDelay_fx = renderConfig.roomAcoustics.inputPreDelay_fx; + move32(); Copy32( renderConfig.roomAcoustics.pFc_input_fx, hRenderConfig->roomAcoustics.pFc_input_fx, CLDFB_NO_CHANNELS_MAX ); Copy32( renderConfig.roomAcoustics.pAcoustic_rt60_fx, hRenderConfig->roomAcoustics.pAcoustic_rt60_fx, CLDFB_NO_CHANNELS_MAX ); Copy32( renderConfig.roomAcoustics.pAcoustic_dsr_fx, hRenderConfig->roomAcoustics.pAcoustic_dsr_fx, CLDFB_NO_CHANNELS_MAX ); Copy( renderConfig.directivity_fx, hRenderConfig->directivity_fx, 3 * MAX_NUM_OBJECTS ); hRenderConfig->roomAcoustics.use_er = 0; - if ( renderConfig.roomAcoustics.use_er == 1 ) + move16(); + IF( EQ_16( renderConfig.roomAcoustics.use_er, 1 ) ) { hRenderConfig->roomAcoustics.use_er = renderConfig.roomAcoustics.use_er; + move16(); hRenderConfig->roomAcoustics.lowComplexity = renderConfig.roomAcoustics.lowComplexity; + move32(); hRenderConfig->roomAcoustics.dimensions = renderConfig.roomAcoustics.dimensions; hRenderConfig->roomAcoustics.ListenerOrigin = renderConfig.roomAcoustics.ListenerOrigin; @@ -7667,20 +7931,21 @@ ivas_error IVAS_REND_SetHeadRotation( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - IF( getAudioConfigType( hIvasRend->outputConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) + IF( NE_32( getAudioConfigType( hIvasRend->outputConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) ) { /* Head rotation can be set only with binaural output */ return IVAS_ERR_INVALID_OUTPUT_FORMAT; } hIvasRend->headRotData.headRotEnabled = 1; + move16(); /* reconfigure binaural rendering to allocate the necessary renderers and free unused ones */ FOR( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) { - IF( hIvasRend->inputsMc[i].base.inConfig != IVAS_AUDIO_CONFIG_INVALID ) + IF( NE_32( hIvasRend->inputsMc[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { - IF( ( error = initMcBinauralRendering( &hIvasRend->inputsMc[i], hIvasRend->inputsMc[i].base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig, TRUE ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = initMcBinauralRendering( &hIvasRend->inputsMc[i], hIvasRend->inputsMc[i].base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig, TRUE ) ), IVAS_ERR_OK ) ) { return error; } @@ -7698,11 +7963,17 @@ ivas_error IVAS_REND_SetHeadRotation( } Word32 updateRate_fx = 1677721600; // value is 200 in Q23 - rotQuat.w_fx = L_shl( rotQuat.w_fx, Q29 - rotQuat.q_fact ); - rotQuat.x_fx = L_shl( rotQuat.x_fx, Q29 - rotQuat.q_fact ); - rotQuat.y_fx = L_shl( rotQuat.y_fx, Q29 - rotQuat.q_fact ); - rotQuat.z_fx = L_shl( rotQuat.z_fx, Q29 - rotQuat.q_fact ); - hIvasRend->headRotData.hOrientationTracker->refRot.w_fx = L_shl( hIvasRend->headRotData.hOrientationTracker->refRot.w_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->refRot.q_fact ); + rotQuat.w_fx = L_shl( rotQuat.w_fx, sub( Q29, rotQuat.q_fact ) ); + rotQuat.x_fx = L_shl( rotQuat.x_fx, sub( Q29, rotQuat.q_fact ) ); + rotQuat.y_fx = L_shl( rotQuat.y_fx, sub( Q29, rotQuat.q_fact ) ); + rotQuat.z_fx = L_shl( rotQuat.z_fx, sub( Q29, rotQuat.q_fact ) ); + + move32(); + move32(); + move32(); + move32(); + + hIvasRend->headRotData.hOrientationTracker->refRot.w_fx = L_shl( hIvasRend->headRotData.hOrientationTracker->refRot.w_fx, sub( Q29, hIvasRend->headRotData.hOrientationTracker->refRot.q_fact ) ); hIvasRend->headRotData.hOrientationTracker->refRot.x_fx = L_shl( hIvasRend->headRotData.hOrientationTracker->refRot.x_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->refRot.q_fact ); hIvasRend->headRotData.hOrientationTracker->refRot.y_fx = L_shl( hIvasRend->headRotData.hOrientationTracker->refRot.y_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->refRot.q_fact ); hIvasRend->headRotData.hOrientationTracker->refRot.z_fx = L_shl( hIvasRend->headRotData.hOrientationTracker->refRot.z_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->refRot.q_fact ); @@ -7711,11 +7982,23 @@ ivas_error IVAS_REND_SetHeadRotation( hIvasRend->headRotData.hOrientationTracker->absAvgRot.y_fx = L_shl( hIvasRend->headRotData.hOrientationTracker->absAvgRot.y_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->absAvgRot.q_fact ); hIvasRend->headRotData.hOrientationTracker->absAvgRot.z_fx = L_shl( hIvasRend->headRotData.hOrientationTracker->absAvgRot.z_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->absAvgRot.q_fact ); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + move32(); + hIvasRend->headRotData.hOrientationTracker->refRot.q_fact = Q29; hIvasRend->headRotData.hOrientationTracker->absAvgRot.q_fact = Q29; + move16(); + move16(); rotQuat.q_fact = Q29; - IF( ( error = ivas_orient_trk_Process_fx( hIvasRend->headRotData.hOrientationTracker, rotQuat, updateRate_fx, &hIvasRend->headRotData.headPositions[sf_idx] ) ) != IVAS_ERR_OK ) + move16(); + IF( NE_32( ( error = ivas_orient_trk_Process_fx( hIvasRend->headRotData.hOrientationTracker, rotQuat, updateRate_fx, &hIvasRend->headRotData.headPositions[sf_idx] ) ), IVAS_ERR_OK ) ) { return error; } @@ -7762,39 +8045,6 @@ ivas_error IVAS_REND_SetHeadRotation( } } -#ifdef IVAS_FLOAT_FIXED - /* check for Euler angle signaling */ - IF( EQ_32( headRot.w_fx, -1610612736 /* -3.0f in Q29 */ ) ) - { - Euler2Quat_fx( deg2rad_fx( headRot.x_fx ), deg2rad_fx( headRot.y_fx ), deg2rad_fx( headRot.z_fx ), &rotQuat ); - } - ELSE - { - rotQuat = headRot; - } - Word32 updateRate_fx = 1677721600; // value is 200 in Q23 - rotQuat.w_fx = L_shl( rotQuat.w_fx, Q29 - rotQuat.q_fact ); - rotQuat.x_fx = L_shl( rotQuat.x_fx, Q29 - rotQuat.q_fact ); - rotQuat.y_fx = L_shl( rotQuat.y_fx, Q29 - rotQuat.q_fact ); - rotQuat.z_fx = L_shl( rotQuat.z_fx, Q29 - rotQuat.q_fact ); - hIvasRend->headRotData.hOrientationTracker->refRot.w_fx = L_shl( hIvasRend->headRotData.hOrientationTracker->refRot.w_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->refRot.q_fact ); - hIvasRend->headRotData.hOrientationTracker->refRot.x_fx = L_shl( hIvasRend->headRotData.hOrientationTracker->refRot.x_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->refRot.q_fact ); - hIvasRend->headRotData.hOrientationTracker->refRot.y_fx = L_shl( hIvasRend->headRotData.hOrientationTracker->refRot.y_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->refRot.q_fact ); - hIvasRend->headRotData.hOrientationTracker->refRot.z_fx = L_shl( hIvasRend->headRotData.hOrientationTracker->refRot.z_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->refRot.q_fact ); - hIvasRend->headRotData.hOrientationTracker->absAvgRot.w_fx = L_shl( hIvasRend->headRotData.hOrientationTracker->absAvgRot.w_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->absAvgRot.q_fact ); - hIvasRend->headRotData.hOrientationTracker->absAvgRot.x_fx = L_shl( hIvasRend->headRotData.hOrientationTracker->absAvgRot.x_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->absAvgRot.q_fact ); - hIvasRend->headRotData.hOrientationTracker->absAvgRot.y_fx = L_shl( hIvasRend->headRotData.hOrientationTracker->absAvgRot.y_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->absAvgRot.q_fact ); - hIvasRend->headRotData.hOrientationTracker->absAvgRot.z_fx = L_shl( hIvasRend->headRotData.hOrientationTracker->absAvgRot.z_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->absAvgRot.q_fact ); - - hIvasRend->headRotData.hOrientationTracker->refRot.q_fact = Q29; - hIvasRend->headRotData.hOrientationTracker->absAvgRot.q_fact = Q29; - rotQuat.q_fact = Q29; - - IF( ( error = ivas_orient_trk_Process_fx( hIvasRend->headRotData.hOrientationTracker, rotQuat, updateRate_fx, &hIvasRend->headRotData.headPositions[sf_idx] ) ) != IVAS_ERR_OK ) - { - return error; - } -#else /* check for Euler angle signaling */ if ( headRot.w == -3.0f ) { @@ -7809,7 +8059,6 @@ ivas_error IVAS_REND_SetHeadRotation( { return error; } -#endif hIvasRend->headRotData.Pos[sf_idx] = Pos; @@ -7838,15 +8087,16 @@ ivas_error IVAS_REND_DisableHeadRotation( } hIvasRend->headRotData.headRotEnabled = 0; + move32(); /* reconfigure binaural rendering to allocate the necessary renderers and free unused ones */ - IF( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) + IF( EQ_32( getAudioConfigType( hIvasRend->outputConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) ) { FOR( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) { - IF( hIvasRend->inputsMc[i].base.inConfig != IVAS_AUDIO_CONFIG_INVALID ) + IF( NE_32( hIvasRend->inputsMc[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { - IF( ( error = initMcBinauralRendering( &hIvasRend->inputsMc[i], hIvasRend->inputsMc[i].base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig, TRUE ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = initMcBinauralRendering( &hIvasRend->inputsMc[i], hIvasRend->inputsMc[i].base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig, TRUE ) ), IVAS_ERR_OK ) ) { return error; @@ -7924,6 +8174,7 @@ ivas_error IVAS_REND_SetOrientationTrackingMode( * *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED ivas_error IVAS_REND_SetReferenceRotation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_QUATERNION refRot /* i : Reference rotation */ @@ -7937,25 +8188,39 @@ ivas_error IVAS_REND_SetReferenceRotation( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef IVAS_FLOAT_FIXED - error = ivas_orient_trk_SetReferenceRotation_fx( hIvasRend->headRotData.hOrientationTracker, refRot ); - IF( error != IVAS_ERR_OK ) + IF( NE_32( error, IVAS_ERR_OK ) ) { return error; } + return IVAS_ERR_OK; +} #else +ivas_error IVAS_REND_SetReferenceRotation( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_QUATERNION refRot /* i : Reference rotation */ +) +{ + ivas_error error; + + /* Validate function arguments */ + if ( hIvasRend == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + if ( ( error = ivas_orient_trk_SetReferenceRotation( hIvasRend->headRotData.hOrientationTracker, refRot ) ) != IVAS_ERR_OK ) { return error; } -#endif return IVAS_ERR_OK; } +#endif + /*-------------------------------------------------------------------* * IVAS_REND_GetMainOrientation() @@ -8028,6 +8293,7 @@ ivas_error IVAS_REND_SetReferenceVector( const IVAS_VECTOR3 refPos /* i : Reference position */ ) { + test(); IF( hIvasRend == NULL || hIvasRend->headRotData.hOrientationTracker == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -8069,6 +8335,7 @@ ivas_error IVAS_REND_SetExternalOrientation( ) { /* Validate function arguments */ + test(); IF( hIvasRend == NULL || hIvasRend->hExternalOrientationData == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -8077,6 +8344,7 @@ ivas_error IVAS_REND_SetExternalOrientation( IF( orientation == NULL ) { hIvasRend->hExternalOrientationData->enableExternalOrientation[sf_idx] = 0; + move16(); } ELSE { @@ -8086,6 +8354,10 @@ ivas_error IVAS_REND_SetExternalOrientation( hIvasRend->hExternalOrientationData->enableExternalOrientation[sf_idx] = enableExternalOrientation; hIvasRend->hExternalOrientationData->enableRotationInterpolation[sf_idx] = enableRotationInterpolation; hIvasRend->hExternalOrientationData->numFramesToTargetOrientation[sf_idx] = numFramesToTargetOrientation; + move16(); + move16(); + move16(); + move16(); } return IVAS_ERR_OK; @@ -8282,8 +8554,12 @@ static void renderBufferChannelLerp_fx( { currentGain = gainsCurrent[outChnlIdx]; previousGain = gainsPrev == NULL ? 0 : gainsPrev[outChnlIdx]; + move32(); + move32(); /* Process current output channel only if applying non-zero gains */ + test(); + test(); IF( GT_32( abs( currentGain ), EPSILON_FX ) || ( gainsPrev != NULL && GT_32( abs( previousGain ), EPSILON_FX ) ) ) { /* Reset input pointer to the beginning of input channel */ @@ -8292,12 +8568,14 @@ static void renderBufferChannelLerp_fx( /* Set output pointer to first output channel sample */ outSmpl = getSmplPtr_fx( outAudio, outChnlIdx, 0 ); + test(); IF( gainsPrev == NULL || LE_32( abs( L_sub( L_shr( previousGain, 1 ), L_shr( currentGain, 1 ) ) ), EPSILON_FX ) ) { /* If no interpolation from previous frame, apply current gain */ DO { *outSmpl = L_add( Mpy_32_32( currentGain, ( *inSmpl ) ), *outSmpl ); + move32(); ++outSmpl; ++inSmpl; } @@ -8307,31 +8585,41 @@ static void renderBufferChannelLerp_fx( { i = 0; Word32 tmp = Q31_BY_SUB_FRAME_240; + move32(); + move32(); SWITCH( outAudio.config.numSamplesPerChannel ) { case NUM_SAMPLES_960: tmp = Q31_BY_NUM_SAMPLES_960; + move32(); BREAK; case NUM_SAMPLES_720: tmp = Q31_BY_NUM_SAMPLES_720; + move32(); BREAK; case NUM_SAMPLES_320: tmp = Q31_BY_NUM_SAMPLES_320; + move32(); BREAK; case NUM_SAMPLES_160: tmp = Q31_BY_NUM_SAMPLES_160; + move32(); BREAK; case L_SUBFRAME_48k: tmp = Q31_BY_SUB_FRAME_240; + move32(); BREAK; case L_SUBFRAME_32k: tmp = Q31_BY_SUB_FRAME_180; + move32(); BREAK; case L_SUBFRAME_16k: tmp = Q31_BY_SUB_FRAME_80; + move32(); BREAK; case L_SUBFRAME_8k: tmp = Q31_BY_SUB_FRAME_40; + move32(); BREAK; default: BREAK; @@ -8340,9 +8628,10 @@ static void renderBufferChannelLerp_fx( DO { fadeIn = UL_Mpy_32_32( i, tmp ); - fadeOut = ONE_IN_Q31 - fadeIn; + fadeOut = L_sub( ONE_IN_Q31, fadeIn ); *outSmpl = L_add( Mpy_32_32( L_add( Mpy_32_32( fadeIn, currentGain ), Mpy_32_32( fadeOut, previousGain ) ), ( *inSmpl ) ), *outSmpl ); + move32(); ++outSmpl; ++inSmpl; ++i; @@ -8399,7 +8688,6 @@ static ivas_error chooseCrossfade_fx( const Word32 **pCrossfade ) { *pCrossfade = headRotData->crossfade_fx; - move32(); return IVAS_ERR_OK; } @@ -8435,16 +8723,23 @@ static ivas_error rotateFrameMc_fx( Word32 tmp_gains[MAX_INPUT_CHANNELS]; ivas_error error; push_wmops( "rotateFrameMc_fx" ); - IF( ( error = chooseCrossfade_fx( headRotData, &crossfade ) ) != IVAS_ERR_OK ) // Q31 + IF( NE_32( ( error = chooseCrossfade_fx( headRotData, &crossfade ) ), IVAS_ERR_OK ) ) // Q31 { return error; } - num_subframes = ( hCombinedOrientationData != NULL ) ? ( *hCombinedOrientationData )->num_subframes : MAX_PARAM_SPATIAL_SUBFRAMES; + IF( ( hCombinedOrientationData != NULL ) ) + { + num_subframes = ( *hCombinedOrientationData )->num_subframes; + } + ELSE + { + num_subframes = MAX_PARAM_SPATIAL_SUBFRAMES; + } move16(); IF( NE_32( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { - IF( ( error = getAudioConfigNumChannels( inConfig, &nchan ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getAudioConfigNumChannels( inConfig, &nchan ) ), IVAS_ERR_OK ) ) { return error; } @@ -8454,7 +8749,7 @@ static ivas_error rotateFrameMc_fx( nchan = add( pInCustomLs->num_spk, pInCustomLs->num_lfe ); } - IF( ( error = getMcConfigValues_fx( inConfig, pInCustomLs, &ls_azimuth, &ls_elevation, &lfe_idx, &is_planar_setup ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getMcConfigValues_fx( inConfig, pInCustomLs, &ls_azimuth, &ls_elevation, &lfe_idx, &is_planar_setup ) ), IVAS_ERR_OK ) ) { return error; } @@ -8472,6 +8767,7 @@ static ivas_error rotateFrameMc_fx( Word16 tmp = BASOP_Util_Divide3216_Scale( inAudio.config.numSamplesPerChannel, num_subframes, &tmp_e ); tmp = shr( tmp, negate( add( 1, tmp_e ) ) ); subframe_len = tmp; + move16(); FOR( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ ) { @@ -8504,11 +8800,24 @@ static ivas_error rotateFrameMc_fx( /* input channel index without LFE */ ch_in_woLFE = ( ( GT_16( lfe_idx, 0 ) ) && ( GE_16( ch_in, lfe_idx ) ) ) ? sub( ch_in, 1 ) : ch_in; - move16(); + + test(); + IF( ( GT_16( lfe_idx, 0 ) ) && ( GE_16( ch_in, lfe_idx ) ) ) + { + ch_in_woLFE = sub( ch_in, 1 ); + } + ELSE + { + ch_in_woLFE = ch_in; + move16(); + } + /* gains for current subframe rotation */ rotateAziEle_fixed( (Word16) L_shr( ls_azimuth[ch_in_woLFE], 22 ), (Word16) L_shr( ls_elevation[ch_in_woLFE], 22 ), &azimuth_fx, &elevation_fx, Rmat_fx, is_planar_setup ); + test(); + test(); IF( hEFAPdata != NULL && ( NE_32( ls_azimuth[ch_in_woLFE], azimuth_fx ) || NE_32( ls_elevation[ch_in_woLFE], elevation_fx ) ) ) { efap_determine_gains_fx( hEFAPdata, tmp_gains, azimuth_fx, elevation_fx, EFAP_MODE_EFAP ); @@ -8522,8 +8831,17 @@ static ivas_error rotateFrameMc_fx( } /* output channel index without LFE */ - ch_out_woLFE = ( ( lfe_idx > 0 ) && ( ch_out >= lfe_idx ) ) ? ch_out - 1 : ch_out; - move16(); + test(); + IF( ( lfe_idx > 0 ) && ( GE_16( ch_out, lfe_idx ) ) ) + { + ch_out_woLFE = sub( ch_out, 1 ); + } + ELSE + { + ch_out_woLFE = ch_out; + move16(); + } + gains[ch_in][ch_out] = tmp_gains[ch_out_woLFE]; // Q30 move32(); } @@ -8535,17 +8853,15 @@ static ivas_error rotateFrameMc_fx( { FOR( ch_in = 0; ch_in < nchan; ch_in++ ) { - writePtr = getSmplPtr_fx( outAudio, ch_out, subframe_idx * subframe_len ); - move32(); - readPtr = getSmplPtr_fx( inAudio, ch_in, subframe_idx * subframe_len ); - move32(); + writePtr = getSmplPtr_fx( outAudio, ch_out, imult1616( subframe_idx, subframe_len ) ); + readPtr = getSmplPtr_fx( inAudio, ch_in, imult1616( subframe_idx, subframe_len ) ); /* crossfade with previous rotation gains */ FOR( i = 0; i < subframe_len; i++ ) { *writePtr = L_add( *writePtr, L_add( Mpy_32_32( ( *readPtr ), Mpy_32_32( ( ONE_IN_Q31 - crossfade[i] ), gains_prev[ch_in][ch_out] ) ), Mpy_32_32( ( *readPtr ), Mpy_32_32( crossfade[i], gains[ch_in][ch_out] ) ) ) ); // Qinp -1 - + move32(); readPtr++; writePtr++; } @@ -8730,46 +9046,51 @@ static ivas_error rotateFrameSba_fx( Word32 temp; Word32 Rmat[3][3]; ivas_error error; - Word16 idx; + Word16 idx, exp; Word32 cf, oneminuscf; Word32 val; push_wmops( "rotateFrameSba" ); - if ( ( error = chooseCrossfade_fx( headRotData, &crossfade ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = chooseCrossfade_fx( headRotData, &crossfade ) ), IVAS_ERR_OK ) ) { return error; } num_subframes = ( hCombinedOrientationData != NULL ) ? ( *hCombinedOrientationData )->num_subframes : MAX_PARAM_SPATIAL_SUBFRAMES; + move16(); - if ( ( error = getAmbisonicsOrder_fx( inConfig, &shd_rot_max_order ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getAmbisonicsOrder_fx( inConfig, &shd_rot_max_order ) ), IVAS_ERR_OK ) ) { return error; } - subframe_len = inAudio.config.numSamplesPerChannel / num_subframes; - for ( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ ) + // subframe_len = inAudio.config.numSamplesPerChannel / num_subframes; + subframe_len = BASOP_Util_Divide1616_Scale( inAudio.config.numSamplesPerChannel, num_subframes, &exp ); + subframe_len = shr( subframe_len, sub( 15, exp ) ); + FOR( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ ) { /* initialize rotation matrices with zeros */ - for ( i = 0; i < HEADROT_SHMAT_DIM; i++ ) + FOR( i = 0; i < HEADROT_SHMAT_DIM; i++ ) { set_val_Word16( gains[i], 0, HEADROT_SHMAT_DIM ); } - for ( i = 0; i < 3; i++ ) + FOR( i = 0; i < 3; i++ ) { - if ( hCombinedOrientationData != NULL ) + IF( hCombinedOrientationData != NULL ) { - for ( l = 0; l < 3; l++ ) + FOR( l = 0; l < 3; l++ ) { Rmat[i][l] = ( *hCombinedOrientationData )->Rmat_fx[subframe_idx][i][l]; // Q30 + move32(); } } - else + ELSE { /* Set to identity */ set_val_Word32( Rmat[i], 0, 3 ); Rmat[i][i] = ONE_IN_Q30; + move32(); } } /* calculate ambisonics rotation matrices for the previous and current frames */ @@ -8779,45 +9100,53 @@ static ivas_error rotateFrameSba_fx( dbgwrite_txt( gains, HEADROT_SHMAT_DIM * HEADROT_SHMAT_DIM, "Fixed_code_gains.txt", NULL ); dbgwrite_txt( Rmat, 3 * 3, "Fixed_code_Rmat.txt", NULL ); #endif - for ( i = 0; i < subframe_len; i++ ) + FOR( i = 0; i < subframe_len; i++ ) { - idx = subframe_idx * subframe_len + i; + idx = add( imult1616( subframe_idx, subframe_len ), i ); // cf = crossfade[i]; cf = crossfade[i]; - oneminuscf = ONE_IN_Q31 - cf; + move32(); + oneminuscf = L_sub( ONE_IN_Q31, cf ); /* As the rotation matrix becomes block diagonal in a SH basis, we can*/ /* apply each angular-momentum block individually to save complexity. */ /* loop over l blocks */ m1 = 1; m2 = 4; - for ( l = 1; l <= shd_rot_max_order; l++ ) + move16(); + move16(); + FOR( l = 1; l <= shd_rot_max_order; l++ ) { /* compute mtx-vector product for this l */ - for ( n = m1; n < m2; n++ ) + FOR( n = m1; n < m2; n++ ) { - tmpRot[n - m1] = 0; - for ( m = m1; m < m2; m++ ) + tmpRot[sub( n, m1 )] = 0; + move32(); + FOR( m = m1; m < m2; m++ ) { - val = inAudio.data_fx[m * inAudio.config.numSamplesPerChannel + idx]; + val = inAudio.data_fx[add( imult1616( m, inAudio.config.numSamplesPerChannel ), idx )]; /* crossfade with previous rotation gains */ temp = Mpy_32_32( L_add( Mpy_32_16_r( cf, gains[n][m] ), ( Mpy_32_16_r( oneminuscf, gains_prev[n][m] ) ) ), val ); - tmpRot[n - m1] = L_add( L_shl( temp, 1 ), tmpRot[n - m1] ); // Qexp + tmpRot[sub( n, m1 )] = L_add( L_shl( temp, 1 ), tmpRot[sub( n, m1 )] ); // Qexp + move32(); + move32(); } } /* write back the result */ - for ( n = m1; n < m2; n++ ) + FOR( n = m1; n < m2; n++ ) { writePtr = getSmplPtr_fx( outAudio, n, idx ); - ( *writePtr ) = tmpRot[n - m1]; + ( *writePtr ) = tmpRot[sub( n, m1 )]; + move32(); } m1 = m2; - m2 += 2 * ( l + 1 ) + 1; + move16(); + m2 = add( m2, 2 * ( l + 1 ) + 1 ); } } /* move SHrotmat to SHrotmat_prev */ - for ( i = 0; i < HEADROT_SHMAT_DIM; i++ ) + FOR( i = 0; i < HEADROT_SHMAT_DIM; i++ ) { Copy( gains[i], gains_prev[i], HEADROT_SHMAT_DIM ); // Q14 } @@ -8953,6 +9282,7 @@ static ivas_error renderIsmToBinaural( Word16 ism_md_subframe_update_ext; Word16 i; Word16 exp = *outAudio.pq_fact; + move16(); push_wmops( "renderIsmToBinaural" ); /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */ ism_md_subframe_update_ext = extract_l( Mpy_32_32( ismInput->ism_metadata_delay_ms_fx, 429496730 /* 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES in Q31 */ ) ); @@ -8963,15 +9293,16 @@ static ivas_error renderIsmToBinaural( Scale_sig32( tmpTDRendBuffer[i], L_FRAME48k, sub( 11, exp ) ); } - IF( ( error = ivas_td_binaural_renderer_ext_fx( &ismInput->tdRendWrapper, ismInput->base.inConfig, NULL, ismInput->base.ctx.pCombinedOrientationData, &ismInput->currentPos, ismInput->hReverb, ism_md_subframe_update_ext, - *ismInput->base.ctx.pOutSampleRate, outAudio.config.numSamplesPerChannel, tmpTDRendBuffer, &exp ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_td_binaural_renderer_ext_fx( &ismInput->tdRendWrapper, ismInput->base.inConfig, NULL, ismInput->base.ctx.pCombinedOrientationData, &ismInput->currentPos, ismInput->hReverb, ism_md_subframe_update_ext, + *ismInput->base.ctx.pOutSampleRate, outAudio.config.numSamplesPerChannel, tmpTDRendBuffer, &exp ) ), + IVAS_ERR_OK ) ) { return error; } FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i ) { - Scale_sig32( tmpTDRendBuffer[i], L_FRAME48k, -sub( 11, exp ) ); + Scale_sig32( tmpTDRendBuffer[i], L_FRAME48k, negate( sub( 11, exp ) ) ); } IF( ismInput->hReverb != NULL ) @@ -8979,7 +9310,10 @@ static ivas_error renderIsmToBinaural( FOR( i = 0; i < outAudio.config.numChannels; i++ ) { FOR( Word16 j = 0; j < outAudio.config.numSamplesPerChannel; j++ ) - tmpTDRendBuffer[i][j] = L_shl( tmpTDRendBuffer[i][j], 2 ); + { + tmpTDRendBuffer[i][j] = L_shl( tmpTDRendBuffer[i][j], 2 ); + move32(); + } } } accumulate2dArrayToBuffer_fx( tmpTDRendBuffer, &outAudio ); @@ -9028,7 +9362,10 @@ static Word16 getNumSubframesInBuffer( const IVAS_REND_AudioBuffer *buffer, const Word32 sampleRate ) { - return extract_l( buffer->config.numSamplesPerChannel / ( sampleRate / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); + Word16 scale, temp = extract_l( Mpy_32_32( sampleRate, 10737418 ) ); // Q0 + Q31 - Q31 -> Q0 + temp = BASOP_Util_Divide1616_Scale( buffer->config.numSamplesPerChannel, temp, &scale ); + temp = shr( temp, sub( 15, scale ) ); + return temp; } #else static int16_t getNumSubframesInBuffer( @@ -9076,6 +9413,7 @@ static ivas_error renderIsmToBinauralRoom( hCombinedOrientationData = ismInput->base.ctx.pCombinedOrientationData; combinedOrientationEnabled = 0; + move16(); IF( hCombinedOrientationData != NULL ) { FOR( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) @@ -9084,6 +9422,7 @@ static ivas_error renderIsmToBinauralRoom( IF( ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] != 0 ) { combinedOrientationEnabled = 1; + move16(); BREAK; } } @@ -9095,6 +9434,7 @@ static ivas_error renderIsmToBinauralRoom( { FOR( i = 0; i < 3; i++ ) { + test(); IF( hCombinedOrientationData != NULL && ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] ) { FOR( j = 0; j < 3; j++ ) @@ -9151,7 +9491,7 @@ static ivas_error renderIsmToBinauralRoom( position_changed = !ismInput->firstFrameRendered || checkObjectPositionChanged_fx( &rotatedPos, &rotatedPosPrev ); /* set previous gains if this is the first frame */ - IF( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, rotatedPosPrev.azimuth_fx, rotatedPosPrev.elevation_fx, ismInput->prev_pan_gains_fx ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, rotatedPosPrev.azimuth_fx, rotatedPosPrev.elevation_fx, ismInput->prev_pan_gains_fx ) ), IVAS_ERR_OK ) ) { return error; } @@ -9159,10 +9499,11 @@ static ivas_error renderIsmToBinauralRoom( /* compute gains only if position changed */ IF( position_changed ) { - IF( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, - rotatedPos.azimuth_fx, - rotatedPos.elevation_fx, - currentPanGains ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, + rotatedPos.azimuth_fx, + rotatedPos.elevation_fx, + currentPanGains ) ), + IVAS_ERR_OK ) ) { return error; } @@ -9171,15 +9512,16 @@ static ivas_error renderIsmToBinauralRoom( /* intermediate rendering to 7_1_4 */ tmpMcBuffer = ismInput->base.inputBuffer; - IF( ( error = getAudioConfigNumChannels( IVAS_AUDIO_CONFIG_7_1_4, &tmp ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getAudioConfigNumChannels( IVAS_AUDIO_CONFIG_7_1_4, &tmp ) ), IVAS_ERR_OK ) ) { return error; } tmpMcBuffer.config.numChannels = tmp; move16(); - tmpMcBuffer.data_fx = malloc( tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels * sizeof( Word32 ) ); - set_zero_fx( tmpMcBuffer.data_fx, tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels ); + tmpMcBuffer.data_fx = malloc( imult1616( tmpMcBuffer.config.numSamplesPerChannel, tmpMcBuffer.config.numChannels ) * sizeof( Word32 ) ); + set_zero_fx( tmpMcBuffer.data_fx, imult1616( tmpMcBuffer.config.numSamplesPerChannel, tmpMcBuffer.config.numChannels ) ); + renderBufferChannelLerp_fx( ismInput->base.inputBuffer, 0, position_changed ? currentPanGains : ismInput->prev_pan_gains_fx, @@ -9206,11 +9548,13 @@ static ivas_error renderIsmToBinauralRoom( move16(); IF( hCrend->reflections != NULL ) { - IF( hCrend->reflections->use_er == 1 && hCrend->reflections->is_ready == 1 ) + test(); + IF( EQ_32( hCrend->reflections->use_er, 1 ) && EQ_32( hCrend->reflections->is_ready, 1 ) ) { FOR( i = 0; i < 150; i++ ) { hCrend->reflections->shoebox_data.gains.data_fx[i] = L_shl( hCrend->reflections->shoebox_data.gains.data_fx[i], 9 ); + move32(); } } } @@ -9218,9 +9562,10 @@ static ivas_error renderIsmToBinauralRoom( move16(); /* render 7_1_4 with BRIRs */ - IF( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, - NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &outAudio, *ismInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, + NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate, + getNumSubframesInBuffer( &outAudio, *ismInput->base.ctx.pOutSampleRate ) ) ), + IVAS_ERR_OK ) ) { return error; @@ -9228,6 +9573,7 @@ static ivas_error renderIsmToBinauralRoom( IF( hCrend->hReverb != NULL ) { *exp = sub( *exp, 2 ); + move16(); } accumulate2dArrayToBuffer_fx( tmpRendBuffer, &outAudio ); @@ -9408,6 +9754,7 @@ static ivas_error renderIsmToBinauralReverb( ivas_error error; Word16 ism_md_subframe_update_ext, i; Word16 exp = *outAudio.pq_fact; + move16(); push_wmops( "renderIsmToBinauralRoom" ); @@ -9420,14 +9767,14 @@ static ivas_error renderIsmToBinauralReverb( Scale_sig32( tmpRendBuffer_fx[i], L_FRAME48k, sub( 11, exp ) ); } - IF( ( error = ivas_td_binaural_renderer_ext_fx( &ismInput->tdRendWrapper, ismInput->base.inConfig, NULL, ismInput->base.ctx.pCombinedOrientationData, &ismInput->currentPos, ismInput->hReverb, ism_md_subframe_update_ext, *ismInput->base.ctx.pOutSampleRate, outAudio.config.numSamplesPerChannel, tmpRendBuffer_fx, &exp ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_td_binaural_renderer_ext_fx( &ismInput->tdRendWrapper, ismInput->base.inConfig, NULL, ismInput->base.ctx.pCombinedOrientationData, &ismInput->currentPos, ismInput->hReverb, ism_md_subframe_update_ext, *ismInput->base.ctx.pOutSampleRate, outAudio.config.numSamplesPerChannel, tmpRendBuffer_fx, &exp ) ), IVAS_ERR_OK ) ) { return error; } FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i ) { - Scale_sig32( tmpRendBuffer_fx[i], L_FRAME48k, -sub( 11, exp ) ); + Scale_sig32( tmpRendBuffer_fx[i], L_FRAME48k, negate( sub( 11, exp ) ) ); } IF( ismInput->hReverb != NULL ) @@ -9435,7 +9782,10 @@ static ivas_error renderIsmToBinauralReverb( FOR( i = 0; i < outAudio.config.numChannels; i++ ) { FOR( Word16 j = 0; j < outAudio.config.numSamplesPerChannel; j++ ) - tmpRendBuffer_fx[i][j] = L_shl( tmpRendBuffer_fx[i][j], 2 ); + { + tmpRendBuffer_fx[i][j] = L_shl( tmpRendBuffer_fx[i][j], 2 ); + move16(); + } } } accumulate2dArrayToBuffer_fx( tmpRendBuffer_fx, &outAudio ); @@ -9477,7 +9827,7 @@ static ivas_error renderIsmToMc( input_ism *ismInput, const IVAS_REND_AudioBuffer outAudio ) { - int8_t position_changed; + Word8 position_changed; pan_vector_fx currentPanGains_fx; ivas_error error; @@ -9489,7 +9839,8 @@ static ivas_error renderIsmToMc( ismInput->previousPos.elevation_fx = L_shl( L_shr( L_add( ismInput->previousPos.elevation_fx, ONE_IN_Q21 ), Q22 ), Q22 ); position_changed = !ismInput->firstFrameRendered || checkObjectPositionChanged( &ismInput->currentPos, &ismInput->previousPos ); - IF( *ismInput->base.ctx.pOutConfig == IVAS_AUDIO_CONFIG_STEREO ) + test(); + IF( EQ_32( *ismInput->base.ctx.pOutConfig, IVAS_AUDIO_CONFIG_STEREO ) ) { IF( ismInput->nonDiegeticPan ) { @@ -9497,6 +9848,10 @@ static ivas_error renderIsmToMc( currentPanGains_fx[1] = L_sub( ONE_IN_Q31, currentPanGains_fx[0] ); ismInput->prev_pan_gains_fx[0] = currentPanGains_fx[0]; // Q31 ismInput->prev_pan_gains_fx[1] = currentPanGains_fx[1]; // Q31 + move32(); + move32(); + move32(); + move32(); } ELSE { @@ -9511,6 +9866,8 @@ static ivas_error renderIsmToMc( ivas_ism_get_stereo_gains_fx( azimuth_tmp, elevation_tmp, &gains_fx[0], &gains_fx[1] ); currentPanGains_fx[0] = L_deposit_h( gains_fx[0] ); // Q31 currentPanGains_fx[1] = L_deposit_h( gains_fx[1] ); // Q31 + move32(); + move32(); azimuth_tmp = extract_l( L_shr( ismInput->previousPos.azimuth_fx, Q22 ) ); elevation_tmp = extract_l( L_shr( ismInput->previousPos.elevation_fx, Q22 ) ); @@ -9519,6 +9876,8 @@ static ivas_error renderIsmToMc( ivas_ism_get_stereo_gains_fx( azimuth_tmp, elevation_tmp, &gains_fx[0], &gains_fx[1] ); ismInput->prev_pan_gains_fx[0] = L_deposit_h( gains_fx[0] ); // Q31 ismInput->prev_pan_gains_fx[1] = L_deposit_h( gains_fx[1] ); // Q31 + move32(); + move32(); } } ELSE @@ -9527,10 +9886,11 @@ static ivas_error renderIsmToMc( IF( position_changed ) { // TODO tmu review when #215 is resolved - IF( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, - ismInput->currentPos.azimuth_fx, - ismInput->currentPos.elevation_fx, - currentPanGains_fx ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, + ismInput->currentPos.azimuth_fx, + ismInput->currentPos.elevation_fx, + currentPanGains_fx ) ), + IVAS_ERR_OK ) ) { return error; } @@ -9540,10 +9900,11 @@ static ivas_error renderIsmToMc( IF( !ismInput->firstFrameRendered ) { // TODO tmu review when #215 is resolved - IF( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, - ismInput->previousPos.azimuth_fx, - ismInput->previousPos.elevation_fx, - ismInput->prev_pan_gains_fx ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, + ismInput->previousPos.azimuth_fx, + ismInput->previousPos.elevation_fx, + ismInput->prev_pan_gains_fx ) ), + IVAS_ERR_OK ) ) { return error; } @@ -9662,20 +10023,25 @@ static ivas_error renderIsmToSba( ismInput->currentPos.elevation_fx = L_shl( L_shr( L_add( ismInput->currentPos.elevation_fx, ONE_IN_Q21 ), Q22 ), Q22 ); ismInput->previousPos.azimuth_fx = L_shl( L_shr( L_add( ismInput->previousPos.azimuth_fx, ONE_IN_Q21 ), Q22 ), Q22 ); ismInput->previousPos.elevation_fx = L_shl( L_shr( L_add( ismInput->previousPos.elevation_fx, ONE_IN_Q21 ), Q22 ), Q22 ); + move32(); + move32(); + move32(); + move32(); push_wmops( "renderIsmToSba" ); - IF( ( error = getAudioConfigNumChannels( outConfig, &numOutChannels ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getAudioConfigNumChannels( outConfig, &numOutChannels ) ), IVAS_ERR_OK ) ) { return error; } - IF( ( error = getAmbisonicsOrder( outConfig, &ambiOrderOut ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getAmbisonicsOrder( outConfig, &ambiOrderOut ) ), IVAS_ERR_OK ) ) { return error; } position_changed = !ismInput->firstFrameRendered || checkObjectPositionChanged( &ismInput->currentPos, &ismInput->previousPos ); + test(); /* set previous gains if this is the first frame */ Word16 azimuth_tmp, elevation_tmp; @@ -9692,6 +10058,7 @@ static ivas_error renderIsmToSba( FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { ismInput->prev_pan_gains_fx[i] = L_shl_sat( ismInput->prev_pan_gains_fx[i], Q2 ); + move32(); } } @@ -9709,6 +10076,7 @@ static ivas_error renderIsmToSba( FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { currentPanGains_fx[i] = L_shl_sat( currentPanGains_fx[i], Q2 ); + move32(); } } @@ -9815,6 +10183,7 @@ static void renderIsmToMasa( Word16 guard_bits = find_guarded_bits_fx( L_FRAME48k ); max_e = input_e[0]; + move16(); FOR( i = 1; i < MAX_NUM_OBJECTS; i++ ) { @@ -9838,6 +10207,7 @@ static void renderIsmToMasa( ivas_omasa_ana_fx( ismInput->hOMasa, tmpRendBuffer_fx, &q_fact, ismInput->base.inputBuffer.config.numSamplesPerChannel, outAudio.config.numChannels, ismInput->base.inputBuffer.config.numChannels ); *exp = q_fact; + move16(); accumulate2dArrayToBuffer_fx( tmpRendBuffer_fx, &outAudio ); @@ -9885,12 +10255,15 @@ static ivas_error renderInputIsm( return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Mismatch between the number of input samples vs number of requested output samples - currently not allowed" ); } ismInput->base.numNewSamplesPerChannel = 0; - + move32(); /* Apply input gain to new audio */ v_multc_fixed( inAudio.data_fx, ismInput->base.gain_fx, inAudio.data_fx, imult1616( inAudio.config.numSamplesPerChannel, inAudio.config.numChannels ) ); - *outAudio.pq_fact -= 1; + *outAudio.pq_fact = sub( *outAudio.pq_fact, 1 ); exp = *outAudio.pq_fact; + + move16(); + move16(); /* set combined orientation subframe info to start info */ ivas_combined_orientation_set_to_start_index( *ismInput->base.ctx.pCombinedOrientationData ); @@ -9904,7 +10277,7 @@ static ivas_error renderInputIsm( error = renderIsmToSba( ismInput, outConfig, outAudio ); BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: - switch ( outConfig ) + SWITCH( outConfig ) { case IVAS_AUDIO_CONFIG_BINAURAL: error = renderIsmToBinaural( ismInput, outAudio ); @@ -9923,7 +10296,8 @@ static ivas_error renderInputIsm( renderIsmToMasa( ismInput, outAudio, &exp ); FOR( Word16 block_m_idx = 0; block_m_idx < MAX_PARAM_SPATIAL_SUBFRAMES; block_m_idx++ ) { - ismInput->hOMasa->energy_e[block_m_idx] = 31 - ismInput->hOMasa->energy_q; + ismInput->hOMasa->energy_e[block_m_idx] = sub( 31, ismInput->hOMasa->energy_q ); + move16(); } BREAK; default: @@ -9931,7 +10305,7 @@ static ivas_error renderInputIsm( } /* Check error here to keep switch statement more compact */ - IF( error != IVAS_ERR_OK ) + IF( NE_32( error, IVAS_ERR_OK ) ) { return error; } @@ -9939,6 +10313,9 @@ static ivas_error renderInputIsm( ismInput->firstFrameRendered = TRUE; *outAudio.pq_fact = exp; + + move16(); + move16(); return error; } #else @@ -9949,11 +10326,6 @@ static ivas_error renderInputIsm( { ivas_error error; IVAS_REND_AudioBuffer inAudio; -#ifdef IVAS_FLOAT_FIXED - Word16 exp = 8; - move16(); -#endif - error = IVAS_ERR_OK; inAudio = ismInput->base.inputBuffer; @@ -9963,64 +10335,19 @@ static ivas_error renderInputIsm( } ismInput->base.numNewSamplesPerChannel = 0; -#ifdef IVAS_FLOAT_FIXED - ismInput->base.gain = fix_to_float( ismInput->base.gain_fx, 30 ); -#endif // IVAS_FLOAT_FIXED - /* Apply input gain to new audio */ v_multc( inAudio.data, ismInput->base.gain, inAudio.data, inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); /* set combined orientation subframe info to start info */ ivas_combined_orientation_set_to_start_index( *ismInput->base.ctx.pCombinedOrientationData ); -#ifdef IVAS_FLOAT_FIXED - ismInput->previousPos.azimuth_fx = (Word32) ( ismInput->previousPos.azimuth * ONE_IN_Q22 ); - move32(); - ismInput->previousPos.elevation_fx = (Word32) ( ismInput->previousPos.elevation * ONE_IN_Q22 ); - move32(); - ismInput->currentPos.azimuth_fx = (Word32) ( ismInput->currentPos.azimuth * ONE_IN_Q22 ); - move32(); - ismInput->currentPos.elevation_fx = (Word32) ( ismInput->currentPos.elevation * ONE_IN_Q22 ); - move32(); - - fixedToFloat_arrL( ismInput->base.inputBuffer.data_fx, ismInput->base.inputBuffer.data, Q8, ismInput->base.inputBuffer.config.numSamplesPerChannel * ismInput->base.inputBuffer.config.numChannels ); - - floatToFixed_arrL( ismInput->prev_pan_gains, ismInput->prev_pan_gains_fx, Q31, MAX_OUTPUT_CHANNELS ); - ismInput->nonDiegeticPanGain_fx = floatToFixed_32( ismInput->nonDiegeticPanGain, Q31 ); - -#endif - switch ( getAudioConfigType( outConfig ) ) { case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: -#ifdef IVAS_FLOAT_FIXED - error = renderIsmToMc( ismInput, outAudio ); - FOR( Word32 i = 0; i < 16; i++ ) - { - ismInput->prev_pan_gains[i] = (float) ismInput->prev_pan_gains_fx[i] / ( ONE_IN_Q31 ); - } - FOR( Word32 i = 0; i < outAudio.config.numSamplesPerChannel * outAudio.config.numChannels; ++i ) - { - outAudio.data[i] = ( (float) outAudio.data_fx[i] / ONE_IN_Q8 ); - } -#else error = renderIsmToMc( ismInput, outAudio ); -#endif break; case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: -#ifdef IVAS_FLOAT_FIXED - error = renderIsmToSba( ismInput, outConfig, outAudio ); - FOR( Word32 i = 0; i < 16; i++ ) - { - ismInput->prev_pan_gains[i] = (float) ismInput->prev_pan_gains_fx[i] / ( ONE_IN_Q31 ); - } - FOR( Word32 i = 0; i < outAudio.config.numSamplesPerChannel * outAudio.config.numChannels; ++i ) - { - outAudio.data[i] = ( (float) outAudio.data_fx[i] / ONE_IN_Q8 ); - } -#else error = renderIsmToSba( ismInput, outConfig, outAudio ); -#endif break; case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: switch ( outConfig ) @@ -10029,19 +10356,7 @@ static ivas_error renderInputIsm( error = renderIsmToBinaural( ismInput, outAudio ); break; case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: -#ifdef IVAS_FLOAT_FIXED - error = renderIsmToBinauralRoom( ismInput, outAudio, &exp ); - FOR( Word32 i = 0; i < 16; i++ ) - { - ismInput->prev_pan_gains[i] = (float) ismInput->prev_pan_gains_fx[i] / ( ONE_IN_Q31 ); - } - FOR( Word32 i = 0; i < outAudio.config.numSamplesPerChannel * outAudio.config.numChannels; ++i ) - { - outAudio.data[i] = ( (float) outAudio.data_fx[i] / ( 1 << exp ) ); - } -#else error = renderIsmToBinauralRoom( ismInput, outAudio ); -#endif break; case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: error = renderIsmToBinauralReverb( ismInput, outAudio ); @@ -10051,22 +10366,7 @@ static ivas_error renderInputIsm( } break; case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: -#ifdef IVAS_FLOAT_FIXED - renderIsmToMasa( ismInput, outAudio, &exp ); - FOR( Word16 block_m_idx = 0; block_m_idx < MAX_PARAM_SPATIAL_SUBFRAMES; block_m_idx++ ) - { - FOR( Word16 band_m_idx = 0; band_m_idx < ismInput->hOMasa->nbands; band_m_idx++ ) - { - ismInput->hOMasa->energy[block_m_idx][band_m_idx] = fixedToFloat( ismInput->hOMasa->energy_fx[block_m_idx][band_m_idx], ismInput->hOMasa->energy_q ); - } - } - FOR( Word32 i = 0; i < outAudio.config.numSamplesPerChannel * outAudio.config.numChannels; ++i ) - { - outAudio.data[i] = ( (float) outAudio.data_fx[i] / ( 1 << exp ) ); - } -#else renderIsmToMasa( ismInput, outAudio ); -#endif break; default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; @@ -10093,24 +10393,28 @@ static ivas_error renderActiveInputsIsm( input_ism *pCurrentInput; ivas_error error; Word16 input_q = Q8; - for ( i = 0, pCurrentInput = hIvasRend->inputsIsm; i < RENDERER_MAX_ISM_INPUTS; ++i, ++pCurrentInput ) + move16(); + FOR( ( i = 0, pCurrentInput = hIvasRend->inputsIsm ); i < RENDERER_MAX_ISM_INPUTS; ( ++i, ++pCurrentInput ) ) { - IF( pCurrentInput->base.inConfig == IVAS_AUDIO_CONFIG_INVALID ) + IF( EQ_32( pCurrentInput->base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { /* Skip inactive inputs */ - continue; + CONTINUE; } *outAudio.pq_fact = Q8; - if ( ( error = renderInputIsm( pCurrentInput, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) + move16(); + IF( NE_32( ( error = renderInputIsm( pCurrentInput, hIvasRend->outputConfig, outAudio ) ), IVAS_ERR_OK ) ) { return error; } FOR( Word16 j = 0; j < outAudio.config.numSamplesPerChannel * outAudio.config.numChannels; ++j ) { outAudio.data_fx[j] = L_shl( outAudio.data_fx[j], sub( sub( input_q, 1 ), ( *outAudio.pq_fact ) ) ); + move32(); } *outAudio.pq_fact = sub( input_q, 1 ); + move16(); } #if 0 /*To be removed later when dependency on data is removed*/ FOR( Word16 j = 0; j < outAudio.config.numSamplesPerChannel * outAudio.config.numChannels; ++j ) @@ -10172,7 +10476,7 @@ static ivas_error renderLfeToBinaural_fx( lfe_idx = LFE_CHANNEL; move16(); } - ELSE IF( GT_16( mcInput->customLsInput.num_lfe, 0 ) ) + ELSE IF( mcInput->customLsInput.num_lfe > 0 ) { lfe_idx = mcInput->customLsInput.lfe_idx[0]; move16(); @@ -10190,8 +10494,7 @@ static ivas_error renderLfeToBinaural_fx( move16(); num_cpy_smpl_prev_frame = mcInput->binauralDelaySmp; move16(); - num_cpy_smpl_cur_frame = frame_size - num_cpy_smpl_prev_frame; - move16(); + num_cpy_smpl_cur_frame = sub( frame_size, num_cpy_smpl_prev_frame ); /* Assuming LFE should be delayed by less that the duration of one frame */ assert( mcInput->binauralDelaySmp < frame_size ); @@ -10205,8 +10508,8 @@ static ivas_error renderLfeToBinaural_fx( /* Save remaining LFE samples of current frame for next frame */ mvr2r_Word32( lfeInput + num_cpy_smpl_cur_frame, mcInput->lfeDelayBuffer_fx, num_cpy_smpl_prev_frame ); r_shift = sub( sub( in_q, 1 ), out_q ); - move16(); - IF( NE_16( r_shift, 0 ) ) + + IF( r_shift != 0 ) { FOR( i = 0; i < add( num_cpy_smpl_prev_frame, num_cpy_smpl_cur_frame ); i++ ) { @@ -10306,29 +10609,33 @@ static ivas_error renderMcToBinaural( Word32 *p_tmpRendBuffer_fx[MAX_OUTPUT_CHANNELS]; Word16 i; Word16 exp = *outAudio.pq_fact; - + move16(); FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { p_tmpRendBuffer_fx[i] = tmpRendBuffer_fx[i]; - move32(); } push_wmops( "renderMcToBinaural" ); inConfig = mcInput->base.inConfig; move32(); hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData; combinedOrientationEnabled = 0; + move16(); IF( hCombinedOrientationData != NULL ) { FOR( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) { - IF( NE_16( ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx], 0 ) ) + IF( ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] != 0 ) { combinedOrientationEnabled = 1; + move16(); BREAK; } } } + test(); + test(); + test(); IF( ( EQ_32( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) || ( combinedOrientationEnabled && ( EQ_32( inConfig, IVAS_AUDIO_CONFIG_5_1 ) || EQ_32( inConfig, IVAS_AUDIO_CONFIG_7_1 ) ) ) ) { copyBufferTo2dArray_fx( mcInput->base.inputBuffer, tmpRendBuffer_fx ); @@ -10337,8 +10644,9 @@ static ivas_error renderMcToBinaural( { Scale_sig32( tmpRendBuffer_fx[i], L_FRAME48k, sub( 11, exp ) ); } - IF( ( error = ivas_td_binaural_renderer_ext_fx( &mcInput->tdRendWrapper, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pCombinedOrientationData, NULL, mcInput->hReverb, - 0, *mcInput->base.ctx.pOutSampleRate, mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer_fx, &exp ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_td_binaural_renderer_ext_fx( &mcInput->tdRendWrapper, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pCombinedOrientationData, NULL, mcInput->hReverb, + 0, *mcInput->base.ctx.pOutSampleRate, mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer_fx, &exp ) ), + IVAS_ERR_OK ) ) { return error; } @@ -10355,15 +10663,14 @@ static ivas_error renderMcToBinaural( { tmpRotBuffer = mcInput->base.inputBuffer; tmpRotBuffer.data_fx = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( Word32 ) ); - set_val_Word32( tmpRotBuffer.data_fx, 0, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels ); + set_val_Word32( tmpRotBuffer.data_fx, 0, imult1616( tmpRotBuffer.config.numSamplesPerChannel, tmpRotBuffer.config.numChannels ) ); - IF( ( error = rotateFrameMc_fx( mcInput->base.inputBuffer, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, mcInput->base.ctx.pCombinedOrientationData, mcInput->rot_gains_prev_fx, mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = rotateFrameMc_fx( mcInput->base.inputBuffer, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, mcInput->base.ctx.pCombinedOrientationData, mcInput->rot_gains_prev_fx, mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ), IVAS_ERR_OK ) ) { return error; } exp = sub( *outAudio.pq_fact, 1 ); - move16(); copyBufferTo2dArray_fx( tmpRotBuffer, tmpRendBuffer_fx ); @@ -10378,21 +10685,21 @@ static ivas_error renderMcToBinaural( hCrend = mcInput->crendWrapper->hCrend; /* call CREND */ - IF( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer_fx, *mcInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer_fx, *mcInput->base.ctx.pOutSampleRate, + getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ), + IVAS_ERR_OK ) ) { return error; } IF( hCrend->hReverb != NULL ) { exp = sub( exp, 2 ); - move16(); } } accumulate2dArrayToBuffer_fx( tmpRendBuffer_fx, &outAudio ); - IF( ( error = renderLfeToBinaural_fx( mcInput, outAudio, *outAudio.pq_fact, exp ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = renderLfeToBinaural_fx( mcInput, outAudio, *outAudio.pq_fact, exp ) ), IVAS_ERR_OK ) ) { return error; @@ -10512,7 +10819,6 @@ static ivas_error renderMcToBinauralRoom( FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { p_tmpRendBuffer[i] = tmpRendBuffer[i]; - move32(); } push_wmops( "renderMcToBinauralRoom" ); @@ -10526,15 +10832,21 @@ static ivas_error renderMcToBinauralRoom( { FOR( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) { - IF( NE_16( ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx], 0 ) ) + IF( ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] != 0 ) { combinedOrientationEnabled = 1; + move16(); BREAK; } } } - if ( ( mcInput->hReverb != NULL && EQ_32( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) && ( EQ_32( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) || ( combinedOrientationEnabled && ( EQ_32( inConfig, IVAS_AUDIO_CONFIG_5_1 ) || EQ_32( inConfig, IVAS_AUDIO_CONFIG_7_1 ) ) ) ) ) + test(); + test(); + test(); + test(); + test(); + IF( ( mcInput->hReverb != NULL && EQ_32( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) && ( EQ_32( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) || ( combinedOrientationEnabled && ( EQ_32( inConfig, IVAS_AUDIO_CONFIG_5_1 ) || EQ_32( inConfig, IVAS_AUDIO_CONFIG_7_1 ) ) ) ) ) { copyBufferTo2dArray_fx( mcInput->base.inputBuffer, tmpRendBuffer ); @@ -10543,8 +10855,9 @@ static ivas_error renderMcToBinauralRoom( Scale_sig32( tmpRendBuffer[i], L_FRAME48k, sub( 11, exp ) ); } - IF( ( error = ivas_td_binaural_renderer_ext_fx( &mcInput->tdRendWrapper, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pCombinedOrientationData, NULL, mcInput->hReverb, - 0, *mcInput->base.ctx.pOutSampleRate, mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer, &exp ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_td_binaural_renderer_ext_fx( &mcInput->tdRendWrapper, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pCombinedOrientationData, NULL, mcInput->hReverb, + 0, *mcInput->base.ctx.pOutSampleRate, mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer, &exp ) ), + IVAS_ERR_OK ) ) { return error; } @@ -10564,15 +10877,15 @@ static ivas_error renderMcToBinauralRoom( tmpRotBuffer.data_fx = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( Word32 ) ); set_val_Word32( tmpRotBuffer.data_fx, 0, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels ); - IF( ( error = rotateFrameMc_fx( mcInput->base.inputBuffer, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, mcInput->base.ctx.pCombinedOrientationData, - mcInput->rot_gains_prev_fx, - mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = rotateFrameMc_fx( mcInput->base.inputBuffer, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, mcInput->base.ctx.pCombinedOrientationData, + mcInput->rot_gains_prev_fx, + mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ), + IVAS_ERR_OK ) ) { return error; } exp = sub( *outAudio.pq_fact, 1 ); - move16(); copyBufferTo2dArray_fx( tmpRotBuffer, tmpRendBuffer ); free( tmpRotBuffer.data_fx ); @@ -10586,21 +10899,21 @@ static ivas_error renderMcToBinauralRoom( hCrend = mcInput->crendWrapper->hCrend; /* call CREND */ - IF( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, + getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ), + IVAS_ERR_OK ) ) { return error; } IF( hCrend->hReverb != NULL ) { exp = sub( exp, 2 ); - move16(); } } accumulate2dArrayToBuffer_fx( tmpRendBuffer, &outAudio ); - IF( ( error = renderLfeToBinaural_fx( mcInput, outAudio, *outAudio.pq_fact, exp ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = renderLfeToBinaural_fx( mcInput, outAudio, *outAudio.pq_fact, exp ) ), IVAS_ERR_OK ) ) { return error; } @@ -10725,7 +11038,6 @@ static ivas_error renderMcCustomLsToBinauralRoom( FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { p_tmpCrendBuffer[i] = tmpCrendBuffer[i]; - move32(); } hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData; @@ -10735,7 +11047,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( { FOR( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) { - IF( NE_16( ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx], 0 ) ) + IF( ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] != 0 ) { combinedOrientationEnabled = 1; move16(); @@ -10751,30 +11063,37 @@ static ivas_error renderMcCustomLsToBinauralRoom( tmpRotBuffer.data_fx = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( Word32 ) ); set_val_Word32( tmpRotBuffer.data_fx, 0, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels ); - IF( ( error = rotateFrameMc_fx( mcInput->base.inputBuffer, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, mcInput->base.ctx.pCombinedOrientationData, - mcInput->rot_gains_prev_fx, - mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = rotateFrameMc_fx( mcInput->base.inputBuffer, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, mcInput->base.ctx.pCombinedOrientationData, + mcInput->rot_gains_prev_fx, + mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ), + IVAS_ERR_OK ) ) { return error; } exp = sub( *outAudio.pq_fact, 1 ); - move16(); } /* intermediate conversion to 7_1_4 */ tmpMcBuffer = mcInput->base.inputBuffer; - IF( ( error = getAudioConfigNumChannels( IVAS_AUDIO_CONFIG_7_1_4, &tmp ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getAudioConfigNumChannels( IVAS_AUDIO_CONFIG_7_1_4, &tmp ) ), IVAS_ERR_OK ) ) { return error; } tmpMcBuffer.config.numChannels = tmp; move16(); - tmpMcBuffer.data_fx = malloc( tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels * sizeof( Word32 ) ); - set_val_Word32( tmpMcBuffer.data_fx, 0, tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels ); + tmpMcBuffer.data_fx = malloc( imult1616( tmpMcBuffer.config.numSamplesPerChannel, tmpMcBuffer.config.numChannels ) * sizeof( Word32 ) ); + set_val_Word32( tmpMcBuffer.data_fx, 0, imult1616( tmpMcBuffer.config.numSamplesPerChannel, tmpMcBuffer.config.numChannels ) ); - tmpBufPtr = ( combinedOrientationEnabled ) ? &tmpRotBuffer : &mcInput->base.inputBuffer; + IF( combinedOrientationEnabled ) + { + tmpBufPtr = &tmpRotBuffer; + } + ELSE + { + tmpBufPtr = &mcInput->base.inputBuffer; + } FOR( i = 0; i < mcInput->base.inputBuffer.config.numChannels; i++ ) { renderBufferChannel_fx( *tmpBufPtr, i, mcInput->panGains_fx[i], tmpMcBuffer ); @@ -10784,20 +11103,20 @@ static ivas_error renderMcCustomLsToBinauralRoom( CREND_HANDLE hCrend; hCrend = mcInput->crendWrapper->hCrend; /* call CREND */ - IF( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, - p_tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, + p_tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ), + IVAS_ERR_OK ) ) { return error; } IF( hCrend->hReverb != NULL ) { exp = sub( exp, 2 ); - move16(); } accumulate2dArrayToBuffer_fx( tmpCrendBuffer, &outAudio ); - IF( ( error = renderLfeToBinaural_fx( mcInput, outAudio, *outAudio.pq_fact, exp ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = renderLfeToBinaural_fx( mcInput, outAudio, *outAudio.pq_fact, exp ) ), IVAS_ERR_OK ) ) { return error; } @@ -11020,6 +11339,7 @@ static ivas_error renderInputMc( ivas_error error; IVAS_REND_AudioBuffer inAudio; error = IVAS_ERR_OK; + move32(); inAudio = mcInput->base.inputBuffer; @@ -11140,16 +11460,17 @@ static ivas_error renderActiveInputsMc( Word16 i; input_mc *pCurrentInput; ivas_error error; - for ( i = 0, pCurrentInput = hIvasRend->inputsMc; i < RENDERER_MAX_MC_INPUTS; ++i, ++pCurrentInput ) + FOR( ( i = 0, pCurrentInput = hIvasRend->inputsMc ); i < RENDERER_MAX_MC_INPUTS; ( ++i, ++pCurrentInput ) ) { - IF( pCurrentInput->base.inConfig == IVAS_AUDIO_CONFIG_INVALID ) + IF( EQ_32( pCurrentInput->base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { /* Skip inactive inputs */ CONTINUE; } *outAudio.pq_fact = Q8; - IF( ( error = renderInputMc( pCurrentInput, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) + move16(); + IF( NE_32( ( error = renderInputMc( pCurrentInput, hIvasRend->outputConfig, outAudio ) ), IVAS_ERR_OK ) ) { return error; } @@ -11287,6 +11608,7 @@ static ivas_error renderSbaToBinaural( hCombinedOrientationData = sbaInput->base.ctx.pCombinedOrientationData; combinedOrientationEnabled = 0; + move16(); IF( hCombinedOrientationData != NULL ) { FOR( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) @@ -11294,6 +11616,7 @@ static ivas_error renderSbaToBinaural( IF( ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] != 0 ) { combinedOrientationEnabled = 1; + move16(); BREAK; } } @@ -11308,8 +11631,9 @@ static ivas_error renderSbaToBinaural( mvr2r_Word32( sbaInput->base.inputBuffer.data_fx, tmpRotBuffer.data_fx, tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel ); - IF( ( error = rotateFrameSba_fx( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, - sbaInput->base.ctx.pCombinedOrientationData, sbaInput->rot_gains_prev_fx, tmpRotBuffer ) ) != IVAS_ERR_OK ) + IF( NE_16( ( error = rotateFrameSba_fx( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, + sbaInput->base.ctx.pCombinedOrientationData, sbaInput->rot_gains_prev_fx, tmpRotBuffer ) ), + IVAS_ERR_OK ) ) { return error; } @@ -11326,14 +11650,16 @@ static ivas_error renderSbaToBinaural( hCrend = sbaInput->crendWrapper->hCrend; /* call CREND */ - IF( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, output_fx, *sbaInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, output_fx, *sbaInput->base.ctx.pOutSampleRate, + getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) ) ), + IVAS_ERR_OK ) ) { return error; } IF( hCrend->hReverb != NULL ) { - *outAudio.pq_fact -= 2; + *outAudio.pq_fact = sub( *outAudio.pq_fact, 2 ); + move16(); } accumulate2dArrayToBuffer_fx( output_buffer_fx, &outAudio ); } @@ -11440,43 +11766,46 @@ static ivas_error renderSbaToBinauralRoom( hCrend = sbaInput->crendWrapper->hCrend; - IF( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ), IVAS_ERR_OK ) ) { return error; } - for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { p_tmpCrendBuffer[i] = tmpCrendBuffer[i]; } hCombinedOrientationData = sbaInput->base.ctx.pCombinedOrientationData; combinedOrientationEnabled = 0; - if ( hCombinedOrientationData != NULL ) + move16(); + IF( hCombinedOrientationData != NULL ) { - for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) + FOR( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) { - if ( ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] != 0 ) + IF( ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] != 0 ) { combinedOrientationEnabled = 1; + move16(); break; } } } /* apply rotation */ - if ( combinedOrientationEnabled ) + IF( combinedOrientationEnabled ) { tmpRotBuffer = sbaInput->base.inputBuffer; - tmpRotBuffer.data_fx = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( Word32 ) ); + tmpRotBuffer.data_fx = malloc( imult1616( tmpRotBuffer.config.numSamplesPerChannel, tmpRotBuffer.config.numChannels ) * sizeof( Word32 ) ); /* copy input for in-place rotation */ mvr2r_Word32( sbaInput->base.inputBuffer.data_fx, tmpRotBuffer.data_fx, tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel ); - IF( ( error = rotateFrameSba_fx( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, - sbaInput->base.ctx.pCombinedOrientationData, - sbaInput->rot_gains_prev_fx, - tmpRotBuffer ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = rotateFrameSba_fx( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, + sbaInput->base.ctx.pCombinedOrientationData, + sbaInput->rot_gains_prev_fx, + tmpRotBuffer ) ), + IVAS_ERR_OK ) ) { return error; } @@ -11485,16 +11814,24 @@ static ivas_error renderSbaToBinauralRoom( /* intermediate rendering to 7_1_4 */ tmpMcBuffer = sbaInput->base.inputBuffer; - IF( ( error = getAudioConfigNumChannels( IVAS_AUDIO_CONFIG_7_1_4, &tmp ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getAudioConfigNumChannels( IVAS_AUDIO_CONFIG_7_1_4, &tmp ) ), IVAS_ERR_OK ) ) { return error; } tmpMcBuffer.config.numChannels = tmp; + move16(); tmpMcBuffer.data_fx = malloc( tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels * sizeof( Word32 ) ); set_val_Word32( tmpMcBuffer.data_fx, 0, tmpMcBuffer.config.numChannels * tmpMcBuffer.config.numSamplesPerChannel ); - tmpBufPtr = ( combinedOrientationEnabled ) ? &tmpRotBuffer : &sbaInput->base.inputBuffer; + IF( combinedOrientationEnabled ) + { + tmpBufPtr = &tmpRotBuffer; + } + ELSE + { + tmpBufPtr = &sbaInput->base.inputBuffer; + } FOR( i = 0; i < sbaInput->base.inputBuffer.config.numChannels; i++ ) { renderBufferChannel_fx( *tmpBufPtr, i, sbaInput->hoaDecMtx_fx[i], tmpMcBuffer ); @@ -11503,20 +11840,22 @@ static ivas_error renderSbaToBinauralRoom( // Porting Crend_process function /* call CREND */ - IF( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, - NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, + NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate, + getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) ) ), + IVAS_ERR_OK ) ) { return error; } IF( hCrend->hReverb != NULL ) { - *outAudio.pq_fact -= 2; + *outAudio.pq_fact = sub( *outAudio.pq_fact, 2 ); + move16(); } accumulate2dArrayToBuffer_fx( tmpCrendBuffer, &outAudio ); - if ( combinedOrientationEnabled ) + IF( combinedOrientationEnabled ) { free( tmpRotBuffer.data_fx ); } @@ -11663,6 +12002,7 @@ static ivas_error renderInputSba( ivas_error error; IVAS_REND_AudioBuffer inAudio; error = IVAS_ERR_OK; + move32(); inAudio = sbaInput->base.inputBuffer; IF( NE_32( sbaInput->base.numNewSamplesPerChannel, outAudio.config.numSamplesPerChannel ) ) @@ -11670,10 +12010,13 @@ static ivas_error renderInputSba( return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Mismatch between the number of input samples vs number of requested output samples - currently not allowed" ); } sbaInput->base.numNewSamplesPerChannel = 0; + move32(); *outAudio.pq_fact = outAudio.q_factor; + move16(); /* Apply input gain to new audio */ v_multc_fixed( inAudio.data_fx, sbaInput->base.gain_fx, inAudio.data_fx, inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); - *outAudio.pq_fact -= 1; // to compensate for the qfactor reduction in gain multiplication. + *outAudio.pq_fact = sub( *outAudio.pq_fact, 1 ); // to compensate for the qfactor reduction in gain multiplication. + move16(); /* set combined orientation subframe info to start info */ ivas_combined_orientation_set_to_start_index( *( sbaInput->base.ctx.pCombinedOrientationData ) ); @@ -11687,7 +12030,7 @@ static ivas_error renderInputSba( renderSbaToSba( sbaInput, outAudio ); BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: - switch ( outConfig ) + SWITCH( outConfig ) { case IVAS_AUDIO_CONFIG_BINAURAL: error = renderSbaToBinaural( sbaInput, outConfig, outAudio ); @@ -11774,15 +12117,16 @@ static ivas_error renderActiveInputsSba( input_sba *pCurrentInput; ivas_error error; - for ( i = 0, pCurrentInput = hIvasRend->inputsSba; i < RENDERER_MAX_SBA_INPUTS; ++i, ++pCurrentInput ) + FOR( ( i = 0, pCurrentInput = hIvasRend->inputsSba ); i < RENDERER_MAX_SBA_INPUTS; ( ++i, ++pCurrentInput ) ) { - IF( pCurrentInput->base.inConfig == IVAS_AUDIO_CONFIG_INVALID ) + IF( EQ_32( pCurrentInput->base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { /* Skip inactive inputs */ CONTINUE; } *outAudio.pq_fact = Q8; - IF( ( error = renderInputSba( pCurrentInput, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) + move16(); + IF( NE_32( ( error = renderInputSba( pCurrentInput, hIvasRend->outputConfig, outAudio ) ), IVAS_ERR_OK ) ) { return error; } @@ -11828,6 +12172,8 @@ static void copyMasaMetadataToDiracRenderer_fx( hSpatParamRendCom->numParametricDirections = add( meta->descriptive_meta.numberOfDirections, 1 ); hSpatParamRendCom->numSimultaneousDirections = add( meta->descriptive_meta.numberOfDirections, 1 ); + move16(); + move16(); FOR( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { @@ -11868,6 +12214,7 @@ static void copyMasaMetadataToDiracRenderer_fx( } hSpatParamRendCom->dirac_bs_md_write_idx = ( hSpatParamRendCom->dirac_bs_md_write_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % hSpatParamRendCom->dirac_md_buffer_length; + move16(); return; } @@ -11940,14 +12287,19 @@ static void renderMasaToMasa( Word16 q_cldfb_out = *outAudio.pq_fact; Word16 scale_factor = 31; move16(); + move16(); + move16(); /* Calculate energy */ l_ts = masaInput->base.inputBuffer.config.numSamplesPerChannel / CLDFB_NO_COL_MAX; numAnalysisChannels = masaInput->hMasaPrerend->num_Cldfb_instances; + move16(); /* do processing over all CLDFB time slots */ FOR( block_m_idx = 0; block_m_idx < MAX_PARAM_SPATIAL_SUBFRAMES; block_m_idx++ ) { mrange[0] = DirAC_block_grouping[block_m_idx]; mrange[1] = DirAC_block_grouping[block_m_idx + 1]; + move16(); + move16(); set_zero_fx( masaInput->hMasaPrerend->energy_fx[block_m_idx], MASA_FREQUENCY_BANDS ); @@ -11960,6 +12312,7 @@ static void renderMasaToMasa( masaInput->hMasaPrerend->cldfbAnaEnc[i]->Q_cldfb_state = q_cldfb; q_cldfb_out = q_cldfb; move16(); + move16(); cldfbAnalysis_ts_fx_fixed_q( &( tmpBuffer_fx[i][l_ts * ts] ), Chan_RealBuffer_fx[i], Chan_ImagBuffer_fx[i], l_ts, masaInput->hMasaPrerend->cldfbAnaEnc[i], &q_cldfb_out ); scale_factor = s_min( scale_factor, s_min( getScaleFactor32( Chan_RealBuffer_fx[i], CLDFB_NO_CHANNELS_MAX ), getScaleFactor32( Chan_ImagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX ) ) ); scale_factor = sub( scale_factor, 1 ); @@ -11981,6 +12334,7 @@ static void renderMasaToMasa( { Word32 temp = L_add( Mult_32_32( Chan_RealBuffer_fx[0][j], Chan_RealBuffer_fx[0][j] ), Mult_32_32( Chan_ImagBuffer_fx[0][j], Chan_ImagBuffer_fx[0][j] ) ); masaInput->hMasaPrerend->energy_fx[block_m_idx][band_m_idx] = BASOP_Util_Add_Mant32Exp( masaInput->hMasaPrerend->energy_fx[block_m_idx][band_m_idx], tmp_energy_e[block_m_idx][band_m_idx], temp, ( 2 * q_add ), &tmp_energy_e[block_m_idx][band_m_idx] ); + move32(); } } } @@ -12001,14 +12355,17 @@ static void renderMasaToMasa( { masaInput->hMasaPrerend->energy_fx[i][j] = L_shr( masaInput->hMasaPrerend->energy_fx[i][j], sub( max_e, tmp_energy_e[i][j] ) ); + move32(); } } /* Copy audio channels if mismatch in number of transports */ - IF( masaInput->base.inputBuffer.config.numChannels == 1 && outAudio.config.numChannels == 2 ) + test(); + test(); + IF( EQ_16( masaInput->base.inputBuffer.config.numChannels, 1 ) && EQ_16( outAudio.config.numChannels, 2 ) ) { mvr2r_Word32( tmpBuffer_fx[0], tmpBuffer_fx[1], masaInput->base.inputBuffer.config.numSamplesPerChannel ); } - ELSE IF( masaInput->base.inputBuffer.config.numChannels == 2 && outAudio.config.numChannels == 1 ) + ELSE IF( EQ_16( masaInput->base.inputBuffer.config.numChannels, 2 ) && EQ_16( outAudio.config.numChannels, 1 ) ) { // v_add( tmpBuffer[0], tmpBuffer[1], tmpBuffer[0], masaInput->base.inputBuffer.config.numSamplesPerChannel ); v_add_fixed( tmpBuffer_fx[0], tmpBuffer_fx[1], tmpBuffer_fx[0], masaInput->base.inputBuffer.config.numSamplesPerChannel, 0 ); @@ -12017,7 +12374,7 @@ static void renderMasaToMasa( /* Copy metadata */ outMeta = masaInput->hMasaPrerend->hMasaOut; inMeta = &masaInput->masaMetadata; - numDirs = inMeta->descriptive_meta.numberOfDirections + 1; + numDirs = add( inMeta->descriptive_meta.numberOfDirections, 1 ); FOR( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { @@ -12036,13 +12393,15 @@ static void renderMasaToMasa( } ratioSum_fx = L_add( ratioSum_fx, inMeta->common_meta.diffuse_to_total_ratio_fx[sf][band] ); - IF( EQ_32( ratioSum_fx, 0 ) ) + IF( ratioSum_fx == 0 ) { FOR( dir = 0; dir < numDirs; dir++ ) { inMeta->directional_meta[dir].energy_ratio_fx[sf][band] = 0; + move32(); } inMeta->common_meta.diffuse_to_total_ratio_fx[sf][band] = ONE_IN_Q30; + move32(); } ELSE IF( NE_32( ratioSum_fx, ONE_IN_Q30 ) ) { @@ -12053,14 +12412,14 @@ static void renderMasaToMasa( FOR( dir = 0; dir < numDirs; dir++ ) { tmp = BASOP_Util_Divide3232_Scale_cadence( inMeta->directional_meta[dir].energy_ratio_fx[sf][band], ratioSum_fx, &tmp_e ); - inMeta->directional_meta[dir].energy_ratio_fx[sf][band] = L_shl( tmp, tmp_e - 1 ); // Q30 + inMeta->directional_meta[dir].energy_ratio_fx[sf][band] = L_shl( tmp, sub( tmp_e, 1 ) ); // Q30 } tmp_e = 0; move16(); tmp = 0; move32(); tmp = BASOP_Util_Divide3232_Scale_cadence( inMeta->common_meta.diffuse_to_total_ratio_fx[sf][band], ratioSum_fx, &tmp_e ); - inMeta->common_meta.diffuse_to_total_ratio_fx[sf][band] = L_shl( tmp, tmp_e - 1 ); // Q30 + inMeta->common_meta.diffuse_to_total_ratio_fx[sf][band] = L_shl( tmp, sub( tmp_e, 1 ) ); // Q30 } } } @@ -12070,14 +12429,21 @@ static void renderMasaToMasa( FOR( band = 0; band < MASA_FREQUENCY_BANDS; band++ ) { outMeta->diffuseToTotalRatio[sf][band] = UINT8_MAX; + move16(); FOR( dir = 0; dir < numDirs; dir++ ) { outMeta->directionIndex[dir][sf][band] = index_theta_phi_16_fx( &inMeta->directional_meta[dir].elevation_fx[sf][band], &inMeta->directional_meta[dir].azimuth_fx[sf][band], masaInput->hMasaPrerend->sph_grid16 ); - outMeta->directToTotalRatio[dir][sf][band] = (UWord8) L_shr( inMeta->directional_meta[dir].energy_ratio_fx[sf][band], 22 ); + outMeta->directToTotalRatio[dir][sf][band] = (UWord8) L_shr( inMeta->directional_meta[dir].energy_ratio_fx[sf][band], Q22 ); outMeta->diffuseToTotalRatio[sf][band] -= outMeta->directToTotalRatio[dir][sf][band]; outMeta->spreadCoherence[dir][sf][band] = (UWord8) shr( inMeta->directional_meta[dir].spread_coherence_fx[sf][band], Q7 ); + + move16(); + move16(); + move16(); + move16(); } outMeta->surroundCoherence[sf][band] = (UWord8) shr( inMeta->common_meta.surround_coherence_fx[sf][band], Q7 ); + move16(); } } @@ -12215,6 +12581,7 @@ static void renderMasaToMasa( } #endif +#ifdef IVAS_FLOAT_FIXED static ivas_error renderInputMasa( input_masa *masaInput, const AUDIO_CONFIG outConfig, @@ -12229,35 +12596,37 @@ static ivas_error renderInputMasa( Word32 *tmpBuffer_fx[MAX_OUTPUT_CHANNELS]; Word32 tmpBuffer_buff_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; #endif - if ( !masaInput->metadataHasBeenFed ) + IF( !masaInput->metadataHasBeenFed ) { return IVAS_ERR_MISSING_METADATA; } inAudio = masaInput->base.inputBuffer; - if ( masaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) + IF( NE_32( masaInput->base.numNewSamplesPerChannel, outAudio.config.numSamplesPerChannel ) ) { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Mismatch between the number of input samples vs number of requested output samples - currently not allowed" ); } masaInput->base.numNewSamplesPerChannel = 0; + move32(); #ifdef IVAS_FLOAT_FIXED masaInput->base.gain = fix_to_float( masaInput->base.gain_fx, Q30 ); *outAudio.pq_fact = outAudio.q_factor; + move16(); /* Apply input gain to new audio */ v_multc_fixed( inAudio.data_fx, masaInput->base.gain_fx, inAudio.data_fx, inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); - *outAudio.pq_fact -= 1; // to compensate for the qfactor reduction in gain multiplication. -#endif // IVAS_FLOAT_FIXED + *outAudio.pq_fact = sub( *outAudio.pq_fact, 1 ); // to compensate for the qfactor reduction in gain multiplication. +#endif // IVAS_FLOAT_FIXED /* Apply input gain to new audio */ v_multc( inAudio.data, masaInput->base.gain, inAudio.data, inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); - maxBin = (int16_t) ( *masaInput->base.ctx.pOutSampleRate * INV_CLDFB_BANDWIDTH ); + maxBin = (Word16) ( *masaInput->base.ctx.pOutSampleRate * INV_CLDFB_BANDWIDTH ); /* set combined orientation subframe info to start info */ ivas_combined_orientation_set_to_start_index( *( masaInput->base.ctx.pCombinedOrientationData ) ); - if ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) + if ( EQ_32( getAudioConfigType( outConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) ) { /* MASA prerendering path for MASA -> MASA */ renderMasaToMasa( masaInput, outAudio ); @@ -12338,45 +12707,119 @@ static ivas_error renderInputMasa( return IVAS_ERR_OK; } - -static ivas_error renderActiveInputsMasa( - IVAS_REND_HANDLE hIvasRend, +#else +static ivas_error renderInputMasa( + input_masa *masaInput, + const AUDIO_CONFIG outConfig, IVAS_REND_AudioBuffer outAudio ) { - int16_t i; - input_masa *pCurrentInput; - ivas_error error; -#ifdef IVAS_FLOAT_FIXED - if ( hIvasRend->inputsSba[0].base.inConfig != IVAS_AUDIO_CONFIG_INVALID ) + IVAS_REND_AudioBuffer inAudio; + int16_t ch; + int16_t maxBin; + float *tmpBuffer[MAX_OUTPUT_CHANNELS]; + float tmpBuffer_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + + if ( !masaInput->metadataHasBeenFed ) { - for ( i = 0; i < outAudio.config.numChannels * outAudio.config.numSamplesPerChannel; i++ ) - { - outAudio.data[i] = (float) outAudio.data_fx[i] / ( 1 << *outAudio.pq_fact ); - } + return IVAS_ERR_MISSING_METADATA; } -#endif - for ( i = 0, pCurrentInput = hIvasRend->inputsMasa; i < RENDERER_MAX_MASA_INPUTS; ++i, ++pCurrentInput ) + + inAudio = masaInput->base.inputBuffer; + if ( masaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) { - if ( pCurrentInput->base.inConfig == IVAS_AUDIO_CONFIG_INVALID ) - { - /* Skip inactive inputs */ - continue; - } + return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Mismatch between the number of input samples vs number of requested output samples - currently not allowed" ); + } + masaInput->base.numNewSamplesPerChannel = 0; -#ifdef IVAS_FLOAT_FIXED - *outAudio.pq_fact = Q8; -#endif // IVAS_FLOAT_FIXED - if ( ( error = renderInputMasa( pCurrentInput, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) - { - return error; - } -#ifdef IVAS_FLOAT_FIXED - if ( ( hIvasRend->inputsSba[0].base.inConfig != IVAS_AUDIO_CONFIG_INVALID ) && ( getAudioConfigType( hIvasRend->outputConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) ) - { - for ( Word16 k = 0; k < outAudio.config.numChannels * outAudio.config.numSamplesPerChannel; k++ ) - { - outAudio.data_fx[k] = (Word32) outAudio.data[k] * ( 1 << *outAudio.pq_fact ); - } + /* Apply input gain to new audio */ + v_multc( inAudio.data, masaInput->base.gain, inAudio.data, inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); + + maxBin = (int16_t) ( *masaInput->base.ctx.pOutSampleRate * INV_CLDFB_BANDWIDTH ); + + /* set combined orientation subframe info to start info */ + ivas_combined_orientation_set_to_start_index( *( masaInput->base.ctx.pCombinedOrientationData ) ); + + if ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) + { + /* MASA prerendering path for MASA -> MASA */ + renderMasaToMasa( masaInput, outAudio ); + } + else + { + /* MASA external renderer -> other formats */ + int16_t num_subframes; + for ( ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++ ) + { + tmpBuffer[ch] = tmpBuffer_buff[ch]; + } + + copyBufferTo2dArray( masaInput->base.inputBuffer, tmpBuffer_buff ); + + num_subframes = (int16_t) ( masaInput->base.inputBuffer.config.numSamplesPerChannel / ( *masaInput->base.ctx.pOutSampleRate / ( IVAS_NUM_FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ) ); + + switch ( masaInput->hMasaExtRend->renderer_type ) + { + case RENDERER_DIRAC: + copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->hMasaExtRend->hSpatParamRendCom, maxBin ); + ivas_masa_ext_dirac_render( masaInput->hMasaExtRend, tmpBuffer, num_subframes ); + break; + case RENDERER_STEREO_PARAMETRIC: + case RENDERER_BINAURAL_PARAMETRIC: + case RENDERER_BINAURAL_PARAMETRIC_ROOM: + copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->hMasaExtRend->hSpatParamRendCom, maxBin ); + ivas_masa_ext_rend_parambin_render( masaInput->hMasaExtRend, *masaInput->base.ctx.pCombinedOrientationData, tmpBuffer, num_subframes ); + break; + case RENDERER_DISABLE: + break; /* This happens for 1TC MASA to MONO where we just copy input transport to output */ + default: + return ( IVAS_ERROR( IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED, "Wrong output config for MASA input in external renderer\n" ) ); + } + + accumulate2dArrayToBuffer( tmpBuffer_buff, &outAudio ); + } + + return IVAS_ERR_OK; +} +#endif + +static ivas_error renderActiveInputsMasa( + IVAS_REND_HANDLE hIvasRend, + IVAS_REND_AudioBuffer outAudio ) +{ + int16_t i; + input_masa *pCurrentInput; + ivas_error error; +#ifdef IVAS_FLOAT_FIXED + if ( hIvasRend->inputsSba[0].base.inConfig != IVAS_AUDIO_CONFIG_INVALID ) + { + for ( i = 0; i < outAudio.config.numChannels * outAudio.config.numSamplesPerChannel; i++ ) + { + outAudio.data[i] = (float) outAudio.data_fx[i] / ( 1 << *outAudio.pq_fact ); + } + } +#endif + for ( i = 0, pCurrentInput = hIvasRend->inputsMasa; i < RENDERER_MAX_MASA_INPUTS; ++i, ++pCurrentInput ) + { + if ( pCurrentInput->base.inConfig == IVAS_AUDIO_CONFIG_INVALID ) + { + /* Skip inactive inputs */ + continue; + } + +#ifdef IVAS_FLOAT_FIXED + *outAudio.pq_fact = Q8; +#endif // IVAS_FLOAT_FIXED + if ( ( error = renderInputMasa( pCurrentInput, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) + { + return error; + } +#ifdef IVAS_FLOAT_FIXED + if ( ( hIvasRend->inputsSba[0].base.inConfig != IVAS_AUDIO_CONFIG_INVALID ) && ( getAudioConfigType( hIvasRend->outputConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) ) + { + for ( Word16 k = 0; k < outAudio.config.numChannels * outAudio.config.numSamplesPerChannel; k++ ) + { + outAudio.data_fx[k] = (Word32) outAudio.data[k] * ( 1 << *outAudio.pq_fact ); + } } #endif } @@ -12478,67 +12921,67 @@ ivas_error IVAS_REND_MergeMasaMetadata( Word16 *inEne1_e; Word16 *inEne2_e; - if ( hIvasRend == NULL ) + IF( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } /* Input1 metadata and energy */ - if ( inputType1 == IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED ) + IF( EQ_32( inputType1, IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED ) ) { *hMasaExtOutMeta = hIvasRend->inputsIsm->hOMasa->hMasaOut; inEne1_fx = &( hIvasRend->inputsIsm->hOMasa->energy_fx ); inEne1_e = ( hIvasRend->inputsIsm->hOMasa->energy_e ); } - else if ( inputType1 == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + ELSE IF( EQ_32( inputType1, IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) { *hMasaExtOutMeta = hIvasRend->inputsMc->hMcMasa->hMasaOut; inEne1_fx = &( hIvasRend->inputsMc->hMcMasa->energy_fx ); inEne1_e = ( hIvasRend->inputsMc->hMcMasa->energy_exp ); } - else if ( inputType1 == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) + ELSE IF( EQ_32( inputType1, IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) { *hMasaExtOutMeta = hIvasRend->inputsSba->hDirAC->hMasaOut; inEne1_fx = &( hIvasRend->inputsSba->hDirAC->energy_fx ); inEne1_e = ( hIvasRend->inputsSba->hDirAC->energy_exp ); } - else if ( inputType1 == IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) + ELSE IF( EQ_32( inputType1, IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) ) { *hMasaExtOutMeta = hIvasRend->inputsMasa->hMasaPrerend->hMasaOut; inEne1_fx = &( hIvasRend->inputsMasa->hMasaPrerend->energy_fx ); inEne1_e = ( hIvasRend->inputsMasa->hMasaPrerend->energy_e ); } - else + ELSE { return IVAS_ERR_NOT_SUPPORTED_OPTION; } /* Input2 metadata and energy */ - if ( inputType2 == IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED ) + IF( EQ_32( inputType2, IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED ) ) { inMeta2 = hIvasRend->inputsIsm->hOMasa->hMasaOut; inEne2_fx = &( hIvasRend->inputsIsm->hOMasa->energy_fx ); inEne2_e = ( hIvasRend->inputsIsm->hOMasa->energy_e ); } - else if ( inputType2 == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + ELSE IF( EQ_32( inputType2, IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) { inMeta2 = hIvasRend->inputsMc->hMcMasa->hMasaOut; inEne2_fx = &( hIvasRend->inputsMc->hMcMasa->energy_fx ); inEne2_e = ( hIvasRend->inputsMc->hMcMasa->energy_exp ); } - else if ( inputType2 == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) + ELSE IF( EQ_32( inputType2, IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) { inMeta2 = hIvasRend->inputsSba->hDirAC->hMasaOut; inEne2_fx = &( hIvasRend->inputsSba->hDirAC->energy_fx ); inEne2_e = ( hIvasRend->inputsSba->hDirAC->energy_exp ); } - else if ( inputType2 == IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) + ELSE IF( EQ_32( inputType2, IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) ) { inMeta2 = hIvasRend->inputsMasa->hMasaPrerend->hMasaOut; inEne2_fx = &( hIvasRend->inputsMasa->hMasaPrerend->energy_fx ); inEne2_e = ( hIvasRend->inputsMasa->hMasaPrerend->energy_e ); } - else + ELSE { return IVAS_ERR_NOT_SUPPORTED_OPTION; } @@ -12547,7 +12990,16 @@ ivas_error IVAS_REND_MergeMasaMetadata( ivas_prerend_merge_masa_metadata_fx( *hMasaExtOutMeta, *hMasaExtOutMeta, inputType1, *inEne1_fx, inEne1_e, inMeta2, inputType2, *inEne2_fx, inEne2_e ); - ( *hMasaExtOutMeta )->descriptiveMeta.numberOfChannels = hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_MASA1 ? 0u : 1u; + IF( EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_MASA1 ) ) + { + ( *hMasaExtOutMeta )->descriptiveMeta.numberOfChannels = 0u; + move16(); + } + ELSE + { + ( *hMasaExtOutMeta )->descriptiveMeta.numberOfChannels = 1u; + move16(); + } return IVAS_ERR_OK; } @@ -12562,9 +13014,7 @@ ivas_error IVAS_REND_MergeMasaMetadata( { MASA_DECODER_EXT_OUT_META_HANDLE inMeta2; float( *inEne1 )[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; -#ifndef IVAS_FLOAT_FIXED float( *inEne2 )[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; -#endif if ( hIvasRend == NULL ) { @@ -12576,57 +13026,21 @@ ivas_error IVAS_REND_MergeMasaMetadata( { *hMasaExtOutMeta = hIvasRend->inputsIsm->hOMasa->hMasaOut; inEne1 = &( hIvasRend->inputsIsm->hOMasa->energy ); -#ifdef IVAS_FLOAT_FIXED - inEne1_fx = &( hIvasRend->inputsIsm->hOMasa->energy_fx ); - inEne1_e = ( hIvasRend->inputsIsm->hOMasa->energy_e ); - - - for ( Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - f2me_buf( hIvasRend->inputsIsm->hOMasa->energy[i], hIvasRend->inputsIsm->hOMasa->energy_fx[i], &hIvasRend->inputsIsm->hOMasa->energy_e[i], MASA_FREQUENCY_BANDS ); - } -#endif } else if ( inputType1 == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { *hMasaExtOutMeta = hIvasRend->inputsMc->hMcMasa->hMasaOut; inEne1 = &( hIvasRend->inputsMc->hMcMasa->energy ); -#ifdef IVAS_FLOAT_FIXED - inEne1_fx = &( hIvasRend->inputsMc->hMcMasa->energy_fx ); - inEne1_e = ( hIvasRend->inputsMc->hMcMasa->energy_exp ); - - for ( Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - f2me_buf( hIvasRend->inputsMc->hMcMasa->energy[i], hIvasRend->inputsMc->hMcMasa->energy_fx[i], &hIvasRend->inputsMc->hMcMasa->energy_exp[i], MASA_FREQUENCY_BANDS ); - } -#endif } else if ( inputType1 == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) { *hMasaExtOutMeta = hIvasRend->inputsSba->hDirAC->hMasaOut; inEne1 = &( hIvasRend->inputsSba->hDirAC->energy ); -#ifdef IVAS_FLOAT_FIXED - inEne1_fx = &( hIvasRend->inputsSba->hDirAC->energy_fx ); - inEne1_e = ( hIvasRend->inputsSba->hDirAC->energy_exp ); - for ( Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - f2me_buf( hIvasRend->inputsSba->hDirAC->energy[i], hIvasRend->inputsSba->hDirAC->energy_fx[i], &hIvasRend->inputsSba->hDirAC->energy_exp[i], MASA_FREQUENCY_BANDS ); - } - -#endif } else if ( inputType1 == IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) { *hMasaExtOutMeta = hIvasRend->inputsMasa->hMasaPrerend->hMasaOut; inEne1 = &( hIvasRend->inputsMasa->hMasaPrerend->energy ); -#ifdef IVAS_FLOAT_FIXED - inEne1_fx = &( hIvasRend->inputsMasa->hMasaPrerend->energy_fx ); - inEne1_e = ( hIvasRend->inputsMasa->hMasaPrerend->energy_e ); - for ( Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - f2me_buf( hIvasRend->inputsMasa->hMasaPrerend->energy[i], hIvasRend->inputsMasa->hMasaPrerend->energy_fx[i], &hIvasRend->inputsMasa->hMasaPrerend->energy_e[i], MASA_FREQUENCY_BANDS ); - } -#endif } else { @@ -12637,65 +13051,22 @@ ivas_error IVAS_REND_MergeMasaMetadata( if ( inputType2 == IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED ) { inMeta2 = hIvasRend->inputsIsm->hOMasa->hMasaOut; -#ifndef IVAS_FLOAT_FIXED inEne2 = &( hIvasRend->inputsIsm->hOMasa->energy ); -#endif -#ifdef IVAS_FLOAT_FIXED - inEne2_fx = &( hIvasRend->inputsIsm->hOMasa->energy_fx ); - inEne2_e = ( hIvasRend->inputsIsm->hOMasa->energy_e ); - - for ( Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - f2me_buf( hIvasRend->inputsIsm->hOMasa->energy[i], hIvasRend->inputsIsm->hOMasa->energy_fx[i], &hIvasRend->inputsIsm->hOMasa->energy_e[i], MASA_FREQUENCY_BANDS ); - } - -#endif } else if ( inputType2 == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { inMeta2 = hIvasRend->inputsMc->hMcMasa->hMasaOut; -#ifndef IVAS_FLOAT_FIXED inEne2 = &( hIvasRend->inputsMc->hMcMasa->energy ); -#endif -#ifdef IVAS_FLOAT_FIXED - inEne2_fx = &( hIvasRend->inputsMc->hMcMasa->energy_fx ); - inEne2_e = ( hIvasRend->inputsMc->hMcMasa->energy_exp ); - for ( Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - f2me_buf( hIvasRend->inputsMc->hMcMasa->energy[i], hIvasRend->inputsMc->hMcMasa->energy_fx[i], &hIvasRend->inputsMc->hMcMasa->energy_exp[i], MASA_FREQUENCY_BANDS ); - } -#endif } else if ( inputType2 == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) { inMeta2 = hIvasRend->inputsSba->hDirAC->hMasaOut; -#ifndef IVAS_FLOAT_FIXED inEne2 = &( hIvasRend->inputsSba->hDirAC->energy ); -#endif -#ifdef IVAS_FLOAT_FIXED - inEne2_fx = &( hIvasRend->inputsSba->hDirAC->energy_fx ); - inEne2_e = ( hIvasRend->inputsSba->hDirAC->energy_exp ); - for ( Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - f2me_buf( hIvasRend->inputsSba->hDirAC->energy[i], hIvasRend->inputsSba->hDirAC->energy_fx[i], &hIvasRend->inputsSba->hDirAC->energy_exp[i], MASA_FREQUENCY_BANDS ); - } -#endif } else if ( inputType2 == IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) { inMeta2 = hIvasRend->inputsMasa->hMasaPrerend->hMasaOut; -#ifndef IVAS_FLOAT_FIXED inEne2 = &( hIvasRend->inputsMasa->hMasaPrerend->energy ); -#endif -#ifdef IVAS_FLOAT_FIXED - inEne2_fx = &( hIvasRend->inputsMasa->hMasaPrerend->energy_fx ); - inEne2_e = ( hIvasRend->inputsMasa->hMasaPrerend->energy_e ); - for ( Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - f2me_buf( hIvasRend->inputsMasa->hMasaPrerend->energy[i], hIvasRend->inputsMasa->hMasaPrerend->energy_fx[i], &hIvasRend->inputsMasa->hMasaPrerend->energy_e[i], MASA_FREQUENCY_BANDS ); - } - -#endif } else { @@ -12703,22 +13074,12 @@ ivas_error IVAS_REND_MergeMasaMetadata( } /* Merge metadata */ -#ifdef IVAS_FLOAT_FIXED - ivas_prerend_merge_masa_metadata_fx( *hMasaExtOutMeta, *hMasaExtOutMeta, inputType1, *inEne1_fx, inEne1_e, inMeta2, inputType2, *inEne2_fx, inEne2_e ); - - FOR( Word32 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - me2f_buf( ( *inEne1_fx )[i], inEne1_e[i], ( *inEne1 )[i], MASA_FREQUENCY_BANDS ); - } -#else ivas_prerend_merge_masa_metadata( *hMasaExtOutMeta, *hMasaExtOutMeta, inputType1, *inEne1, inMeta2, inputType2, *inEne2 ); ( *hMasaExtOutMeta )->descriptiveMeta.numberOfChannels = hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_MASA1 ? 0u : 1u; -#endif - - ( *hMasaExtOutMeta )->descriptiveMeta.numberOfChannels = hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_MASA1 ? 0u : 1u; return IVAS_ERR_OK; } + #endif // IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* @@ -12781,6 +13142,7 @@ ivas_error IVAS_REND_SetIsmMetadataDelay( FOR( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) { hIvasRend->inputsIsm[i].ism_metadata_delay_ms_fx = sync_md_delay; + move32(); } return IVAS_ERR_OK; @@ -12828,17 +13190,18 @@ static ivas_error getSamplesInternal( } test(); - IF( LE_16( outAudio.config.numSamplesPerChannel, 0 ) || LT_16( MAX_BUFFER_LENGTH_PER_CHANNEL, outAudio.config.numSamplesPerChannel ) ) + IF( outAudio.config.numSamplesPerChannel <= 0 || LT_16( MAX_BUFFER_LENGTH_PER_CHANNEL, outAudio.config.numSamplesPerChannel ) ) { return IVAS_ERR_INVALID_BUFFER_SIZE; } test(); - IF( LE_16( outAudio.config.numChannels, 0 ) || LT_16( MAX_OUTPUT_CHANNELS, outAudio.config.numChannels ) ) + IF( outAudio.config.numChannels <= 0 || LT_16( MAX_OUTPUT_CHANNELS, outAudio.config.numChannels ) ) { return IVAS_ERR_WRONG_NUM_CHANNELS; } + test(); IF( EQ_32( getAudioConfigType( hIvasRend->outputConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) && NE_32( outAudio.config.numSamplesPerChannel * 1000, ( hIvasRend->num_subframes * BINAURAL_RENDERING_FRAME_SIZE_MS ) * hIvasRend->sampleRateOut ) ) { @@ -12857,26 +13220,58 @@ static ivas_error getSamplesInternal( FOR( i = 0; i < RENDERER_MAX_MASA_INPUTS; i++ ) { // numMasaInputs += hIvasRend->inputsMasa[i].base.inConfig == IVAS_AUDIO_CONFIG_INVALID ? 0 : 1; - numMasaInputs = EQ_32( L_add( numMasaInputs, hIvasRend->inputsMasa[i].base.inConfig ), IVAS_AUDIO_CONFIG_INVALID ) ? 0 : 1; + + IF( EQ_32( hIvasRend->inputsMasa[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + { + numMasaInputs = add( numMasaInputs, 0 ); + } + ELSE + { + numMasaInputs = add( numMasaInputs, 1 ); + } } FOR( i = 0; i < RENDERER_MAX_MC_INPUTS; i++ ) { // numOtherInputs += hIvasRend->inputsMc[i].base.inConfig == IVAS_AUDIO_CONFIG_INVALID ? 0 : 1; - numOtherInputs = EQ_32( L_add( numOtherInputs, hIvasRend->inputsMc[i].base.inConfig ), IVAS_AUDIO_CONFIG_INVALID ) ? 0 : 1; + + IF( EQ_32( hIvasRend->inputsMc[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + { + numOtherInputs = add( numOtherInputs, 0 ); + } + ELSE + { + numOtherInputs = add( numOtherInputs, 1 ); + } } FOR( i = 0; i < RENDERER_MAX_SBA_INPUTS; i++ ) { // numOtherInputs += hIvasRend->inputsSba[i].base.inConfig == IVAS_AUDIO_CONFIG_INVALID ? 0 : 1; - numOtherInputs = EQ_32( L_add( numOtherInputs, hIvasRend->inputsSba[i].base.inConfig ), IVAS_AUDIO_CONFIG_INVALID ) ? 0 : 1; + + IF( EQ_32( hIvasRend->inputsSba[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + { + numOtherInputs = add( numOtherInputs, 0 ); + } + ELSE + { + numOtherInputs = add( numOtherInputs, 1 ); + } } /* For ISM, we check only first as all ISMs are handled together via OMASA when merging to MASA. */ // numOtherInputs += hIvasRend->inputsIsm[0].base.inConfig == IVAS_AUDIO_CONFIG_INVALID ? 0 : 1; - numOtherInputs = EQ_32( L_add( numOtherInputs, hIvasRend->inputsIsm[0].base.inConfig ), IVAS_AUDIO_CONFIG_INVALID ) ? 0 : 1; + IF( EQ_32( hIvasRend->inputsIsm[0].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + { + numOtherInputs = add( numOtherInputs, 0 ); + } + ELSE + { + numOtherInputs = add( numOtherInputs, 1 ); + } + test(); - IF( EQ_16( numMasaInputs, 0 ) || EQ_16( numOtherInputs, 0 ) ) + IF( numMasaInputs == 0 || numOtherInputs == 0 ) { return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } @@ -12893,8 +13288,8 @@ static ivas_error getSamplesInternal( } /* Clear original output buffer */ - set_zero( outAudio.data, outAudio.config.numChannels * outAudio.config.numSamplesPerChannel ); - set_val_Word32( outAudio.data_fx, 0, outAudio.config.numChannels * outAudio.config.numSamplesPerChannel ); + set_zero( outAudio.data, imult1616( outAudio.config.numChannels, outAudio.config.numSamplesPerChannel ) ); + set_val_Word32( outAudio.data_fx, 0, imult1616( outAudio.config.numChannels, outAudio.config.numSamplesPerChannel ) ); IF( NE_32( ( error = renderActiveInputsIsm( hIvasRend, outAudio ) ), IVAS_ERR_OK ) ) { @@ -12913,20 +13308,8 @@ static ivas_error getSamplesInternal( return error; } - /*IF( NE_32( hIvasRend->inputsSba[0].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) || NE_32( hIvasRend->inputsMc[0].base.inConfig, IVAS_AUDIO_CONFIG_INVALID )|| NE_32( hIvasRend->inputsIsm[0].base.inConfig, IVAS_AUDIO_CONFIG_INVALID )) - { -#ifndef DISABLE_LIMITER - Word32 limiter_thresold = L_lshl( IVAS_LIMITER_THRESHOLD, *outAudio.pq_fact ); - limitRendererOutput_fx( hIvasRend->hLimiter, outAudio.data_fx, outAudio.config.numSamplesPerChannel, limiter_thresold, *outAudio.pq_fact ); -#endif - } - ELSE - { -#ifndef DISABLE_LIMITER - limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); - *outAudio.pq_fact = 0; -#endif - }*/ + test(); + test(); IF( NE_32( hIvasRend->inputsSba[0].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) || NE_32( hIvasRend->inputsMc[0].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) || NE_32( hIvasRend->inputsIsm[0].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { Word32 limiter_thresold = L_lshl( IVAS_LIMITER_THRESHOLD, *outAudio.pq_fact ); @@ -13078,40 +13461,43 @@ ivas_error IVAS_REND_GetSamples( * * *-------------------------------------------------------------------*/ + + #ifdef IVAS_FLOAT_FIXED void IVAS_REND_Close( IVAS_REND_HANDLE *phIvasRend /* i/o: Pointer to renderer handle */ ) { - uint16_t i; + UWord16 i; IVAS_REND_HANDLE hIvasRend; /* Validate function arguments */ - if ( phIvasRend == NULL || *phIvasRend == NULL ) + test(); + IF( phIvasRend == NULL || *phIvasRend == NULL ) { return; } hIvasRend = *phIvasRend; - if ( hIvasRend->efapOutWrapper.hEfap != NULL ) + IF( hIvasRend->efapOutWrapper.hEfap != NULL ) { efap_free_data( &hIvasRend->efapOutWrapper.hEfap ); } /* clear inputs */ - for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) + FOR( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) { clearInputIsm( &hIvasRend->inputsIsm[i] ); } - for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) + FOR( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) { clearInputMc( &hIvasRend->inputsMc[i] ); } - for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i ) + FOR( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i ) { clearInputSba( &hIvasRend->inputsSba[i] ); } - for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i ) + FOR( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i ) { clearInputMasa( &hIvasRend->inputsMasa[i] ); } @@ -13178,8 +13564,8 @@ void IVAS_REND_Close( closeHeadRotation( hIvasRend ); - ivas_external_orientation_close( &hIvasRend->hExternalOrientationData ); - ivas_combined_orientation_close( &hIvasRend->hCombinedOrientationData ); + ivas_external_orientation_close_fx( &hIvasRend->hExternalOrientationData ); + ivas_combined_orientation_close_fx( &hIvasRend->hCombinedOrientationData ); free( hIvasRend ); *phIvasRend = NULL; @@ -13203,6 +13589,7 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; error = IVAS_ERR_OK; + move32(); hDirACRend = NULL; output_Fs = *( inputMasa->base.ctx.pOutSampleRate ); @@ -13219,7 +13606,16 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC renderer\n" ) ); } - nchan_transport = EQ_16( inputMasa->base.inConfig, IVAS_AUDIO_CONFIG_MASA2 ) ? 2 : 1; + IF( EQ_16( inputMasa->base.inConfig, IVAS_AUDIO_CONFIG_MASA2 ) ) + { + nchan_transport = 2; + move16(); + } + ELSE + { + nchan_transport = 1; + move16(); + } /*-----------------------------------------------------------------* * output setup: for parametric binaural renderer, use output setup, otherwise internal setup @@ -13249,6 +13645,7 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( nchan_out_woLFE = hDirACRend->hOutSetup.nchan_out_woLFE; move16(); + test(); IF( hDirACRend->hOutSetup.ls_azimuth_fx != NULL && hDirACRend->hOutSetup.ls_elevation_fx != NULL ) { Copy32( hDirACRend->hOutSetup.ls_azimuth_fx, ls_azimuth_fx, nchan_out_woLFE ); @@ -13275,27 +13672,36 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( * set input parameters *-----------------------------------------------------------------*/ + test(); IF( EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_MONO ) ) { hDirACRend->synthesisConf = DIRAC_SYNTHESIS_MONO; hDirACRend->panningConf = DIRAC_PANNING_HOA3; nchan_out_woLFE = 1; + move32(); + move32(); move16(); } ELSE IF( hDirACRend->hOutSetup.is_loudspeaker_setup ) { hDirACRend->synthesisConf = DIRAC_SYNTHESIS_PSD_LS; hDirACRend->panningConf = DIRAC_PANNING_VBAP; + move32(); + move32(); } ELSE IF( !hDirACRend->hOutSetup.is_loudspeaker_setup && GT_16( nchan_transport, 1 ) ) { hDirACRend->synthesisConf = DIRAC_SYNTHESIS_PSD_SHD; hDirACRend->panningConf = DIRAC_PANNING_HOA3; + move32(); + move32(); } ELSE { hDirACRend->synthesisConf = DIRAC_SYNTHESIS_GAIN_SHD; hDirACRend->panningConf = DIRAC_PANNING_HOA3; + move32(); + move32(); } IF( ( hDirACRend->frequency_axis_fx = (Word16 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word16 ) ) ) == NULL ) @@ -13306,6 +13712,7 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( ivas_dirac_dec_get_frequency_axis_fx( hDirACRend->frequency_axis_fx, output_Fs, hSpatParamRendCom->num_freq_bands ); + test(); IF( EQ_16( hDirACRend->panningConf, DIRAC_PANNING_HOA3 ) && EQ_16( nchan_transport, 2 ) ) { IF( ( hDirACRend->masa_stereo_type_detect = (MASA_STEREO_TYPE_DETECT *) malloc( sizeof( MASA_STEREO_TYPE_DETECT ) ) ) == NULL ) @@ -13333,23 +13740,31 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( /* Directional and diffuses components in output LS format */ hDirACRend->num_outputs_diff = nchan_out_woLFE; hDirACRend->num_outputs_dir = nchan_out_woLFE; + move16(); + move16(); } ELSE IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { /* Directional and diffuses components in SHD */ /* Diffuseness components up to 1st order */ - hDirACRend->num_outputs_diff = ( min( hDirACRend->hOutSetup.ambisonics_order, 1 ) + 1 ) * ( min( hDirACRend->hOutSetup.ambisonics_order, 1 ) + 1 ); + hDirACRend->num_outputs_diff = imult1616( ( s_min( hDirACRend->hOutSetup.ambisonics_order, 1 ) + 1 ), ( add( s_min( hDirACRend->hOutSetup.ambisonics_order, 1 ), 1 ) ) ); hDirACRend->num_outputs_dir = ivas_sba_get_nchan_fx( hDirACRend->hOutSetup.ambisonics_order, 0 ); + move16(); + move16(); } ELSE IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD ) ) { hDirACRend->num_outputs_diff = DIRAC_HOA_RENDERING_NUM_VIRT_DECORR_LS; hDirACRend->num_outputs_dir = nchan_out_woLFE; + move16(); + move16(); } ELSE IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) { hDirACRend->num_outputs_diff = 1; /* There is one output channel in mono */ hDirACRend->num_outputs_dir = 2; /* Two channels are pre-rendered for stereo type detection */ + move16(); + move16(); } ELSE { @@ -13418,11 +13833,11 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( FOR( k = 0; k < hDirACRend->num_outputs_diff; k++ ) { - IF( GT_32( ls_azimuth_fx[k], 0 ) ) + IF( ls_azimuth_fx[k] > 0 ) { hDirACRend->proto_index_diff[k] = 1; } - ELSE IF( LT_32( ls_azimuth_fx[k], 0 ) ) + ELSE IF( ls_azimuth_fx[k] < 0 ) { hDirACRend->proto_index_diff[k] = 2; } @@ -13456,6 +13871,8 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } + test(); + test(); IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_LS ) || EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD ) || EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) { initDiffuseResponses_fx( hDirACRend->diffuse_response_function_fx, nchan_out_woLFE, hDirACRend->hOutSetup.output_config, @@ -13484,7 +13901,7 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( IF( EQ_16( hDirACRend->panningConf, DIRAC_PANNING_VBAP ) ) { - IF( ( error = vbap_init_data_fx( &( inputMasa->hMasaExtRend->hVBAPdata ), ls_azimuth_fx, ls_elevation_fx, nchan_out_woLFE, MASA_FORMAT ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = vbap_init_data_fx( &( inputMasa->hMasaExtRend->hVBAPdata ), ls_azimuth_fx, ls_elevation_fx, nchan_out_woLFE, MASA_FORMAT ) ), IVAS_ERR_OK ) ) { return error; } @@ -13496,7 +13913,7 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( { IF( hDirACRend->hOutSetup.is_loudspeaker_setup ) { - IF( ( error = ivas_sba_get_hoa_dec_matrix_fx( hDirACRend->hOutSetup, &inputMasa->hMasaExtRend->hoa_dec_mtx, hDirACRend->hOutSetup.ambisonics_order ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_sba_get_hoa_dec_matrix_fx( hDirACRend->hOutSetup, &inputMasa->hMasaExtRend->hoa_dec_mtx, hDirACRend->hOutSetup.ambisonics_order ) ), IVAS_ERR_OK ) ) { return error; } @@ -13507,35 +13924,39 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( /* decorrelation */ hDirACRend->proto_signal_decorr_on = 1; + move16(); IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) { hDirACRend->proto_signal_decorr_on = 0; + move16(); } IF( hDirACRend->proto_signal_decorr_on ) { - IF( ( error = ivas_dirac_dec_decorr_open_fx( &( hDirACRend->h_freq_domain_decorr_ap_params ), - &( hDirACRend->h_freq_domain_decorr_ap_state ), - hSpatParamRendCom->num_freq_bands, - hDirACRend->num_outputs_diff, - hDirACRend->num_protos_diff, - hDirACRend->synthesisConf, - hDirACRend->frequency_axis_fx, - nchan_transport, - output_Fs ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_dirac_dec_decorr_open_fx( &( hDirACRend->h_freq_domain_decorr_ap_params ), + &( hDirACRend->h_freq_domain_decorr_ap_state ), + hSpatParamRendCom->num_freq_bands, + hDirACRend->num_outputs_diff, + hDirACRend->num_protos_diff, + hDirACRend->synthesisConf, + hDirACRend->frequency_axis_fx, + nchan_transport, + output_Fs ) ), + IVAS_ERR_OK ) ) { return error; } } /* output synthesis */ - IF( ( ivas_dirac_dec_output_synthesis_open_fx( hSpatParamRendCom, hDirACRend, RENDERER_DIRAC, nchan_transport, output_Fs, 0 ) ) != IVAS_ERR_OK ) + IF( NE_32( ( ivas_dirac_dec_output_synthesis_open_fx( hSpatParamRendCom, hDirACRend, RENDERER_DIRAC, nchan_transport, output_Fs, 0 ) ), IVAS_ERR_OK ) ) { return error; } hDirACRend->h_output_synthesis_psd_params.use_onset_filters = hDirACRend->proto_signal_decorr_on; move16(); + test(); IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD ) || EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { hDirACRend->h_output_synthesis_psd_params.use_onset_filters = 0; @@ -13552,11 +13973,12 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( } ELSE { - IF( ( hDirACRend->proto_frame_f_fx = (Word32 *) malloc( sizeof( Word32 ) * 2 * hDirACRend->num_protos_diff * hSpatParamRendCom->num_freq_bands ) ) == NULL ) + IF( ( hDirACRend->proto_frame_f_fx = (Word32 *) malloc( sizeof( Word32 ) * shl( imult1616( hDirACRend->num_protos_diff, hSpatParamRendCom->num_freq_bands ), 1 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - hDirACRend->proto_frame_f_len = 2 * hDirACRend->num_protos_diff * hSpatParamRendCom->num_freq_bands; + hDirACRend->proto_frame_f_len = shl( imult1616( hDirACRend->num_protos_diff, hSpatParamRendCom->num_freq_bands ), 1 ); + move16(); } @@ -13573,7 +13995,7 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( ivas_dirac_dec_output_synthesis_init_fx( hSpatParamRendCom, hDirACRend, nchan_out_woLFE, 0 ); /* Allocate stack memory */ - IF( ( error = ivas_dirac_alloc_mem( hDirACRend, RENDERER_DIRAC, hSpatParamRendCom->num_freq_bands, &( hDirACRend->stack_mem ), 0 ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_dirac_alloc_mem( hDirACRend, RENDERER_DIRAC, hSpatParamRendCom->num_freq_bands, &( hDirACRend->stack_mem ), 0 ) ), IVAS_ERR_OK ) ) { return error; } @@ -13696,11 +14118,7 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } -#ifdef IVAS_FLOAT_FIXED - ivas_masa_init_stereotype_detection_fx( hDirACRend->masa_stereo_type_detect ); -#else ivas_masa_init_stereotype_detection( hDirACRend->masa_stereo_type_detect ); -#endif } else { @@ -13912,20 +14330,10 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { -#ifdef IVAS_FLOAT_FIXED - hDirACRend->proto_frame_f_fx = NULL; -#endif hDirACRend->proto_frame_f = NULL; } else { -#ifdef IVAS_FLOAT_FIXED - IF( ( hDirACRend->proto_frame_f_fx = (Word32 *) malloc( sizeof( Word32 ) * 2 * hDirACRend->num_protos_diff * hSpatParamRendCom->num_freq_bands ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - hDirACRend->proto_frame_f_len = 2 * hDirACRend->num_protos_diff * hSpatParamRendCom->num_freq_bands; -#endif if ( ( hDirACRend->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirACRend->num_protos_diff * hSpatParamRendCom->num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); @@ -14063,29 +14471,7 @@ static ivas_error ivas_masa_ext_rend_parambin_init( } /* Always open frequency domain decorrelator */ -#ifdef IVAS_FLOAT_FIXED - Word16 frequency_axis_fx[CLDFB_NO_CHANNELS_MAX]; - ivas_dirac_dec_get_frequency_axis_fx( frequency_axis_fx, output_Fs, nBins ); - - for ( int i = 0; i < nBins; i++ ) - { - frequency_axis[i] = (float) frequency_axis_fx[i]; - } - if ( ( error = ivas_dirac_dec_decorr_open_fx( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), - &( hDiracDecBin->h_freq_domain_decorr_ap_state ), - nBins, - BINAURAL_CHANNELS, - BINAURAL_CHANNELS, - DIRAC_SYNTHESIS_PSD_LS, - frequency_axis_fx, - BINAURAL_CHANNELS, - output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } -#else ivas_dirac_dec_get_frequency_axis( frequency_axis, output_Fs, nBins ); - if ( ( error = ivas_dirac_dec_decorr_open( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), &( hDiracDecBin->h_freq_domain_decorr_ap_state ), nBins, @@ -14098,14 +14484,8 @@ static ivas_error ivas_masa_ext_rend_parambin_init( { return error; } -#endif /* External renderer uses constant regularization factor */ -#ifdef IVAS_FLOAT_FIXED - hDiracDecBin->reqularizationFactor_fx = 6554; - move16(); -#else hDiracDecBin->reqularizationFactor = 0.4f; -#endif inputMasa->hMasaExtRend->hDiracDecBin = hDiracDecBin; @@ -14131,6 +14511,7 @@ static ivas_error ivas_masa_ext_rend_parambin_init( Word16 tmp2; error = IVAS_ERR_OK; + move32(); hHrtfParambin = inputMasa->hMasaExtRend->hHrtfParambin; @@ -14140,6 +14521,7 @@ static ivas_error ivas_masa_ext_rend_parambin_init( move32(); move16(); renderer_type = inputMasa->hMasaExtRend->renderer_type; + move32(); hDiracDecBin = inputMasa->hMasaExtRend->hDiracDecBin; @@ -14176,6 +14558,12 @@ static ivas_error ivas_masa_ext_rend_parambin_init( hDiracDecBin->q_processMtxPrevSCCR = Q15; hDiracDecBin->q_processMtxDec = Q15; hDiracDecBin->q_processMtxDecPrev = Q15; + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); set_zero_fx( hDiracDecBin->ChEnePrev_fx[j], nBins ); set_zero_fx( hDiracDecBin->ChEneOutPrev_fx[j], nBins ); set16_fx( hDiracDecBin->ChEnePrev_e[j], 0, nBins ); @@ -14190,21 +14578,25 @@ static ivas_error ivas_masa_ext_rend_parambin_init( set16_fx( hDiracDecBin->ChCrossReOutPrev_e, 0, nBins ); set16_fx( hDiracDecBin->ChCrossImOutPrev_e, 0, nBins ); hDiracDecBin->renderStereoOutputInsteadOfBinaural = 0; + move16(); FOR( bin = 0; bin < nBins; bin++ ) { binCenterFreq_fx = L_mult0( extract_l( L_shr( output_Fs, 1 ) ), div_s( add( shl( bin, 1 ), 1 ), shl( nBins, 1 ) ) ) /*( (float) bin + 0.5f ) / (float) nBins * ( (float) output_Fs / 2.0f )*/; /*Q15*/ /* These formulas and values are from Christian Borss's publication for binaural diffuse field coherence */ - tmp = BASOP_Util_Divide3232_Scale( binCenterFreq_fx, 2700 << Q15, &tmp_e ); + tmp = BASOP_Util_Divide3232_Scale( binCenterFreq_fx, L_shl( 2700, Q15 ), &tmp_e ); IF( tmp_e < 0 ) { tmp = shl( tmp, tmp_e ); /*q15*/ tmp_e = 0; + move16(); } - tmpFloat_fx = s_max( 0, sub( shl_sat( 1, 15 - tmp_e ), tmp ) ) /*max( 0.0f, 1.0f - binCenterFreq / 2700.0f )*/; /*Q30*/ + tmpFloat_fx = s_max( 0, sub( shl_sat( 1, sub( 15, tmp_e ) ), tmp ) ) /*max( 0.0f, 1.0f - binCenterFreq / 2700.0f )*/; /*Q30*/ tmp2 = extract_l( Mult_32_32( binCenterFreq_fx, 1952258 /*=2^31*180/(550)/360*/ ) % 32767 ); //*binCenterFreq_fx * EVS_PI / 550.0f*/ hDiracDecBin->diffuseFieldCoherence_fx[bin] = L_shl( L_mult0( divide3232( tmpFloat_fx, Mult_32_16( binCenterFreq_fx, 187 /*2^15*pi/550*/ ) ), getSineWord16R2( tmp2 ) ), tmp_e ); /*tmpFloat * sinf( binCenterFreq * EVS_PI / 550.0f ) / ( binCenterFreq * EVS_PI / 550.0f );*/ hDiracDecBin->diffuseFieldCoherence_fx[bin] = L_shl( hDiracDecBin->diffuseFieldCoherence_fx[bin], 1 ); // Q31 + move32(); + move32(); } /* No SPAR in external renderer so set directive diffuse field coherence tables to zero */ @@ -14216,17 +14608,19 @@ static ivas_error ivas_masa_ext_rend_parambin_init( { set32_fx( hDiracDecBin->earlyPartEneCorrection_fx, ONE_IN_Q28 /*1.0f Q28*/, CLDFB_NO_CHANNELS_MAX ); hDiracDecBin->q_earlyPartEneCorrection = Q28; + move16(); hDiracDecBin->hReverb = NULL; } ELSE IF( EQ_16( renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) /* Indication of binaural rendering with room effect */ { Copy32( hHrtfParambin->parametricEarlyPartEneCorrection_fx, hDiracDecBin->earlyPartEneCorrection_fx, nBins ); hDiracDecBin->q_earlyPartEneCorrection = Q28; + move16(); IF( hDiracDecBin->hReverb == NULL ) { /* Todo Philips: Room acoustics should be passed here once the underlying part works. In this case, it probably should come from render context or somewhere else suitable. */ - IF( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, hHrtfParambin ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, hHrtfParambin ) ), IVAS_ERR_OK ) ) { return error; } @@ -14236,8 +14630,10 @@ static ivas_error ivas_masa_ext_rend_parambin_init( { set32_fx( hDiracDecBin->earlyPartEneCorrection_fx, ONE_IN_Q28 /*1.0f Q28*/, CLDFB_NO_CHANNELS_MAX ); hDiracDecBin->q_earlyPartEneCorrection = Q28; + move16(); hDiracDecBin->hReverb = NULL; hDiracDecBin->renderStereoOutputInsteadOfBinaural = 1; + move16(); } ELSE /* Not valid renderer type for this renderer */ { @@ -14247,15 +14643,16 @@ static ivas_error ivas_masa_ext_rend_parambin_init( /* Always open frequency domain decorrelator */ ivas_dirac_dec_get_frequency_axis_fx( frequency_axis_fx, output_Fs, nBins ); - IF( ( error = ivas_dirac_dec_decorr_open_fx( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), - &( hDiracDecBin->h_freq_domain_decorr_ap_state ), - nBins, - BINAURAL_CHANNELS, - BINAURAL_CHANNELS, - DIRAC_SYNTHESIS_PSD_LS, - frequency_axis_fx, - BINAURAL_CHANNELS, - output_Fs ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_dirac_dec_decorr_open_fx( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), + &( hDiracDecBin->h_freq_domain_decorr_ap_state ), + nBins, + BINAURAL_CHANNELS, + BINAURAL_CHANNELS, + DIRAC_SYNTHESIS_PSD_LS, + frequency_axis_fx, + BINAURAL_CHANNELS, + output_Fs ) ), + IVAS_ERR_OK ) ) { return error; } @@ -14353,17 +14750,12 @@ static ivas_error initMasaExtRenderer( if ( hMasaExtRend->renderer_type != RENDERER_DISABLE ) { int16_t subframe; -#ifdef IVAS_FLOAT_FIXED - IF( ( error = ivas_spat_hSpatParamRendCom_config_fx( &hMasaExtRend->hSpatParamRendCom, DIRAC_OPEN, 0, MASA_FORMAT, MC_MODE_NONE, *( inputMasa->base.ctx.pOutSampleRate ), 0, 1 ) ) != IVAS_ERR_OK ) - { - return error; - } -#else + if ( ( error = ivas_spat_hSpatParamRendCom_config( &hMasaExtRend->hSpatParamRendCom, DIRAC_OPEN, 0, MASA_FORMAT, MC_MODE_NONE, *( inputMasa->base.ctx.pOutSampleRate ), 0, 1 ) ) != IVAS_ERR_OK ) { return error; } -#endif + /* Simple population of the metadata index map as no adaptation is present */ set_s( hMasaExtRend->hSpatParamRendCom->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); for ( subframe = 0; subframe < MAX_PARAM_SPATIAL_SUBFRAMES; subframe++ ) @@ -14412,7 +14804,7 @@ static ivas_error initMasaExtRenderer( { for ( i = 0; i < hMasaExtRend->nchan_input; i++ ) { - if ( ( error = openCldfb_ivas( &( hMasaExtRend->cldfbAnaRend[i] ), CLDFB_ANALYSIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + if ( ( error = openCldfb( &( hMasaExtRend->cldfbAnaRend[i] ), CLDFB_ANALYSIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) { return error; } @@ -14420,7 +14812,7 @@ static ivas_error initMasaExtRenderer( for ( i = 0; i < hMasaExtRend->nchan_output; i++ ) { - if ( ( error = openCldfb_ivas( &( hMasaExtRend->cldfbSynRend[i] ), CLDFB_SYNTHESIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + if ( ( error = openCldfb( &( hMasaExtRend->cldfbSynRend[i] ), CLDFB_SYNTHESIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) { return error; } @@ -14431,7 +14823,6 @@ static ivas_error initMasaExtRenderer( return IVAS_ERR_OK; } - #else static ivas_error initMasaExtRenderer( input_masa *inputMasa, @@ -14442,6 +14833,7 @@ static ivas_error initMasaExtRenderer( MASA_EXT_REND_HANDLE hMasaExtRend; error = IVAS_ERR_OK; + move32(); IF( ( hMasaExtRend = (MASA_EXT_REND_HANDLE) malloc( sizeof( MASA_EXT_REND_DATA ) ) ) == NULL ) { @@ -14452,6 +14844,7 @@ static ivas_error initMasaExtRenderer( /* Default init */ hMasaExtRend->renderer_type = RENDERER_DISABLE; + move32(); hMasaExtRend->hDirACRend = NULL; hMasaExtRend->hSpatParamRendCom = NULL; hMasaExtRend->hDiracDecBin = NULL; @@ -14460,12 +14853,12 @@ static ivas_error initMasaExtRenderer( hMasaExtRend->hVBAPdata = NULL; hMasaExtRend->hoa_dec_mtx = NULL; - IF( ( error = getAudioConfigNumChannels( inputMasa->base.inConfig, &hMasaExtRend->nchan_input ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getAudioConfigNumChannels( inputMasa->base.inConfig, &hMasaExtRend->nchan_input ) ), IVAS_ERR_OK ) ) { return error; } - IF( ( error = getAudioConfigNumChannels( outConfig, &hMasaExtRend->nchan_output ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getAudioConfigNumChannels( outConfig, &hMasaExtRend->nchan_output ) ), IVAS_ERR_OK ) ) { return error; } @@ -14476,16 +14869,19 @@ static ivas_error initMasaExtRenderer( IF( EQ_16( inputMasa->base.inConfig, IVAS_AUDIO_CONFIG_MASA2 ) ) { hMasaExtRend->renderer_type = RENDERER_DIRAC; + move32(); } ELSE { /* 1TC MASA to mono does not need rendering. */ hMasaExtRend->renderer_type = RENDERER_DISABLE; + move32(); } BREAK; case IVAS_AUDIO_CONFIG_STEREO: hMasaExtRend->renderer_type = RENDERER_STEREO_PARAMETRIC; + move32(); BREAK; case IVAS_AUDIO_CONFIG_5_1: @@ -14498,15 +14894,18 @@ static ivas_error initMasaExtRenderer( case IVAS_AUDIO_CONFIG_HOA2: case IVAS_AUDIO_CONFIG_HOA3: hMasaExtRend->renderer_type = RENDERER_DIRAC; + move32(); BREAK; case IVAS_AUDIO_CONFIG_BINAURAL: hMasaExtRend->renderer_type = RENDERER_BINAURAL_PARAMETRIC; + move32(); BREAK; case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: hMasaExtRend->renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM; + move32(); BREAK; default: @@ -14516,7 +14915,7 @@ static ivas_error initMasaExtRenderer( IF( NE_16( hMasaExtRend->renderer_type, RENDERER_DISABLE ) ) { Word16 subframe; - IF( ( error = ivas_spat_hSpatParamRendCom_config_fx( &hMasaExtRend->hSpatParamRendCom, DIRAC_OPEN, 0, MASA_FORMAT, MC_MODE_NONE, *( inputMasa->base.ctx.pOutSampleRate ), 0, 1 ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_spat_hSpatParamRendCom_config_fx( &hMasaExtRend->hSpatParamRendCom, DIRAC_OPEN, 0, MASA_FORMAT, MC_MODE_NONE, *( inputMasa->base.ctx.pOutSampleRate ), 0, 1 ) ), IVAS_ERR_OK ) ) { return error; } @@ -14533,29 +14932,31 @@ static ivas_error initMasaExtRenderer( IF( EQ_16( hMasaExtRend->renderer_type, RENDERER_DIRAC ) ) { - IF( ( error = ivas_masa_ext_rend_dirac_rend_init( inputMasa ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_masa_ext_rend_dirac_rend_init( inputMasa ) ), IVAS_ERR_OK ) ) { return error; } } + test(); + test(); IF( EQ_16( hMasaExtRend->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( hMasaExtRend->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) || EQ_16( hMasaExtRend->renderer_type, RENDERER_STEREO_PARAMETRIC ) ) { IF( NE_16( hMasaExtRend->renderer_type, RENDERER_STEREO_PARAMETRIC ) ) { - IF( ( error = ivas_dirac_dec_binaural_copy_hrtfs_fx( &inputMasa->hMasaExtRend->hHrtfParambin ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_dirac_dec_binaural_copy_hrtfs_fx( &inputMasa->hMasaExtRend->hHrtfParambin ) ), IVAS_ERR_OK ) ) { return error; } #if 1 /*TODO: To be removed later after dependency on floating buffers in hHrtfParambin is removed*/ - if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &inputMasa->hMasaExtRend->hHrtfParambin ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &inputMasa->hMasaExtRend->hHrtfParambin ) ), IVAS_ERR_OK ) ) { return error; } #endif // IVAS_FLOAT_FIXED } - IF( ( error = ivas_masa_ext_rend_parambin_init( inputMasa ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_masa_ext_rend_parambin_init( inputMasa ) ), IVAS_ERR_OK ) ) { return error; } @@ -14572,11 +14973,11 @@ static ivas_error initMasaExtRenderer( hMasaExtRend->cldfbSynRend[i] = NULL; } - IF( hMasaExtRend->renderer_type != RENDERER_DISABLE ) + IF( NE_32( hMasaExtRend->renderer_type, RENDERER_DISABLE ) ) { FOR( i = 0; i < hMasaExtRend->nchan_input; i++ ) { - IF( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbAnaRend[i] ), CLDFB_ANALYSIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbAnaRend[i] ), CLDFB_ANALYSIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ), IVAS_ERR_OK ) ) { return error; } @@ -14584,7 +14985,7 @@ static ivas_error initMasaExtRenderer( FOR( i = 0; i < hMasaExtRend->nchan_output; i++ ) { - IF( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbSynRend[i] ), CLDFB_SYNTHESIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbSynRend[i] ), CLDFB_SYNTHESIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ), IVAS_ERR_OK ) ) { return error; } @@ -14604,6 +15005,7 @@ static void freeMasaExtRenderer( MASA_EXT_REND_HANDLE hMasaExtRend; Word16 i; + test(); IF( hMasaExtRendOut == NULL || *hMasaExtRendOut == NULL ) { return; @@ -14683,20 +15085,12 @@ static void freeMasaExtRenderer( if ( hMasaExtRend->hDirACRend != NULL ) { -#ifdef IVAS_FLOAT_FIXED - ivas_dirac_rend_close_fx( &hMasaExtRend->hDirACRend ); -#else ivas_dirac_rend_close( &hMasaExtRend->hDirACRend ); -#endif // IVAS_FLOAT_FIXED } if ( hMasaExtRend->hSpatParamRendCom != NULL ) { -#ifdef IVAS_FLOAT_FIXED - ivas_spat_hSpatParamRendCom_close_fx( &hMasaExtRend->hSpatParamRendCom ); -#else ivas_spat_hSpatParamRendCom_close( &hMasaExtRend->hSpatParamRendCom ); -#endif // IVAS_FLOAT_FIXED } if ( hMasaExtRend->hDiracDecBin != NULL ) @@ -14706,32 +15100,17 @@ static void freeMasaExtRenderer( if ( hMasaExtRend->hReverb != NULL ) { -#ifdef IVAS_FLOAT_FIXED - ivas_binaural_reverb_close_fx( &hMasaExtRend->hReverb ); -#else ivas_binaural_reverb_close( &hMasaExtRend->hReverb ); -#endif } -#ifdef IVAS_FLOAT_FIXED - IF( hMasaExtRend->hHrtfParambin != NULL ) - { - ivas_HRTF_parambin_binary_close_fx( &hMasaExtRend->hHrtfParambin ); - } -#else if ( hMasaExtRend->hHrtfParambin != NULL ) { ivas_HRTF_parambin_binary_close( &hMasaExtRend->hHrtfParambin ); } -#endif if ( hMasaExtRend->hVBAPdata != NULL ) { -#ifdef IVAS_FLOAT_FIXED - vbap_free_data_fx( &hMasaExtRend->hVBAPdata ); -#else vbap_free_data( &hMasaExtRend->hVBAPdata ); -#endif } if ( hMasaExtRend->hoa_dec_mtx != NULL ) diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index f10e35e0951e7db9f7978711270c9468fe437ca0..af6e6d766273deaa349dedbf10c974c55bda530a 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -162,10 +162,17 @@ ivas_error IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( /* Functions to be called before/during rendering */ +#ifndef IVAS_FLOAT_FIXED ivas_error IVAS_REND_NumOutChannels( IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ int16_t *numOutChannels /* o : number of output channels */ ); +#else +ivas_error IVAS_REND_NumOutChannels( + IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ + Word16 *numOutChannels /* o : number of output channels */ +); +#endif ivas_error IVAS_REND_AddInput( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ @@ -231,17 +238,34 @@ ivas_error IVAS_REND_RemoveInput( const IVAS_REND_InputId inputId /* i : ID of the input */ ); +#ifdef IVAS_FLOAT_FIXED +ivas_error IVAS_REND_GetInputNumChannels( + IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + Word16 *numChannels /* o : number of channels of the input */ +); +#else ivas_error IVAS_REND_GetInputNumChannels( IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ int16_t *numChannels /* o : number of channels of the input */ ); +#endif +#ifndef IVAS_FLOAT_FIXED ivas_error IVAS_REND_GetDelay( IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ int16_t *nSamples, /* o : Renderer delay in samples */ int32_t *timeScale /* o : Time scale of the delay, equal to renderer output sampling rate */ ); +#else +ivas_error IVAS_REND_GetDelay( + IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ + Word16 *nSamples, /* o : Renderer delay in samples */ + Word32 *timeScale /* o : Time scale of the delay, equal to renderer output sampling rate */ +); +#endif + #ifdef IVAS_FLOAT_FIXED ivas_error IVAS_REND_GetDelay_fx( IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer state */ @@ -289,23 +313,46 @@ ivas_error IVAS_REND_InitConfig( const IVAS_AUDIO_CONFIG outAudioConfig /* i : output audioConfig */ ); +#ifndef IVAS_FLOAT_FIXED int16_t IVAS_REND_GetRenderConfig( IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ const IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render configuration handle */ ); +#else +Word16 IVAS_REND_GetRenderConfig( + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + const IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render configuration handle */ +); +#endif +#ifndef IVAS_FLOAT_FIXED int16_t IVAS_REND_FeedRenderConfig( IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ const IVAS_RENDER_CONFIG_DATA renderConfig /* i : Render configuration struct */ ); +#else +Word16 IVAS_REND_FeedRenderConfig( + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + const IVAS_RENDER_CONFIG_DATA renderConfig /* i : Render configuration struct */ +); +#endif +#ifndef IVAS_FLOAT_FIXED ivas_error IVAS_REND_SetHeadRotation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_QUATERNION headRot, /* i : head orientations for next rendering call */ const IVAS_VECTOR3 Pos, /* i : listener positions for next rendering call */ const int16_t sf_idx /* i : subframe index */ ); +#else +ivas_error IVAS_REND_SetHeadRotation( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_QUATERNION headRot, /* i : head orientations for next rendering call */ + const IVAS_VECTOR3 Pos, /* i : listener positions for next rendering call */ + const Word16 sf_idx /* i : subframe index */ +); +#endif /* Head rotation becomes enabled by calling IVAS_REND_SetHeadRotation. Use this to disable. */ ivas_error IVAS_REND_DisableHeadRotation( @@ -339,6 +386,17 @@ ivas_error IVAS_REND_SetReferenceVector( ); +#ifdef IVAS_FLOAT_FIXED +ivas_error IVAS_REND_SetExternalOrientation( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_QUATERNION *orientation, /* i : external orientation data */ + Word8 enableHeadRotation, /* i : flag to enable head rotation for this frame */ + Word8 enableExternalOrientation, /* i : flag to enable external orientation for this frame */ + Word8 enableRotationInterpolation, /* i : flag to interpolate rotations from current and previous frames */ + Word16 numFramesToTargetOrientation, /* i : number of frames until target orientation is reached */ + const Word16 sf_idx /* i : subframe index */ +); +#else ivas_error IVAS_REND_SetExternalOrientation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ IVAS_QUATERNION *orientation, /* i : external orientation data */ @@ -348,6 +406,7 @@ ivas_error IVAS_REND_SetExternalOrientation( int16_t numFramesToTargetOrientation, /* i : number of frames until target orientation is reached */ const int16_t sf_idx /* i : subframe index */ ); +#endif ivas_error IVAS_REND_CombineHeadAndExternalOrientation( IVAS_REND_HANDLE hIvasRend /* i/o: Renderer handle */ @@ -395,10 +454,17 @@ ivas_error IVAS_REND_SetIsmMetadataDelay( ); #endif +#ifdef IVAS_FLOAT_FIXED +ivas_error IVAS_REND_GetNumAllObjects( + IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ + Word16 *numChannels /* o : number of all objects */ +); +#else ivas_error IVAS_REND_GetNumAllObjects( IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ int16_t *numChannels /* o : number of all objects */ ); +#endif ivas_error IVAS_REND_GetSamples( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */