Loading lib_com/options.h +8 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,12 @@ #define FIX_BASOP_2333_MCMASA_ANA_MEMORY_LEAK /* Nokia: basop issue 2333: Add missing free for direction_vector_e to ivas_mcmasa_ana_fx.c */ #define HARM_COREDECODER_FUNCTIONS /* VA: basop issue 2347: Remove various duplicated code in core-decoder */ #define FIX_BASOP_2358_SCALING_OOB /* Eri: Basip issue 2358: Clang-18 reports OOB access where scaling is applied to L_FRAME48k instead of output_frame */ #define FIX_BASOP_2351_EXTREND_SCALE /* FhG: basop issue 2351: Only scale initialized samples in renderer, related to 2326 */ #define FIX_2331_CLANG18_MSAN_UNINIT_VARIABLE /* FhG: Fix issue 2331: Uninitialized variable */ #define FIX_2362_TOTAL_BRATE_CALCULATION /* FhG: basop issue 2362: fix calculation of st->total_brate in ivas_cpe_enc_fx() */ #define FIX_2330_CLANG_18_WARNINGS_REND /* FhG: Fix renderer warnings */ #define FIX_BASOP_2350_HARM_0B_BWE /* VA: basop issue 2350: harmonization of the 0b BWE */ #define FIX_2349_HARM_FIND_UV /* VA: basop issue 2349: harmonization of find_uv() function */ /* #################### End BE switches ################################## */ Loading @@ -111,6 +117,8 @@ #define FIX_2250_LARGE_DIFFERENCES_BETWEEN_BASOP_AND_FLOAT /* Dolby: Issue 2250: random vector generation in GenShapedSHBExcitation() */ #define FIX_2320_OOB_SCE_SWITCHING /* VA: basop issue 2320: Correct the length of the buffer to be scaled in SCE/CPE switching */ #define FIX_2302_LSF_CDBK_THRESHOLD /* VA: basop issue 2302: fix threshold for LSF Q codebook-type decision */ #define FIX_1500_ISM_MD_DTX /* VA: float issue 1500: fix ISM elevation metadata smoothing in DTX */ #define FIX_2348_REPLACE_FEC_ENC /* VA: basop issue 2348: replace FEC_encode_ivas_fx with FEC_encode_fx */ /* ##################### End NON-BE switches ########################### */ Loading lib_com/prot_fx.h +19 −2 Original line number Diff line number Diff line Loading @@ -6395,6 +6395,7 @@ void hf_synth_reset_fx( ZERO_BWE_DEC_HANDLE hBWE_zero /* o : zero BWE decoder handle */ ); #ifndef FIX_BASOP_2350_HARM_0B_BWE void hf_synth_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, /* i/o: handle to 0 bit BWE parameters */ const Word32 core_brate, /* i : core bitrate Q0*/ Loading @@ -6406,7 +6407,6 @@ void hf_synth_fx( const Word16 Q_exc, /* i : excitation scaling */ const Word16 Q_syn2 /* i : synthesis scaling */ ); void hf_synth_ivas_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, /* i/o: handle to 0 bit BWE parameters */ const Word32 core_brate, /* i : core bitrate Q0*/ Loading @@ -6418,7 +6418,23 @@ void hf_synth_ivas_fx( const Word16 Q_exc, /* i : excitation scaling */ const Word16 Q_syn2 /* i : synthesis scaling */ ); #else void hf_synth_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, /* i/o: handle to 0 bit BWE parameters */ #ifdef FIX_BASOP_2350_HARM_0B_BWE const Word16 element_mode, /* i : element mode Q0*/ #endif const Word32 core_brate, /* i : core bitrate Q0*/ const Word16 output_frame, /* i : output frame length Q0*/ const Word16 *Aq, /* i : quantized Az Q12*/ const Word16 *exc, /* i : excitation at 12.8 kHz Q_exc*/ Word16 *synth, /* i : 12.8kHz synthesis signal Q_syn2*/ Word16 *synth16k, /* o : 16kHz synthesis signal Q_syn2*/ const Word16 Q_exc, /* i : excitation scaling */ const Word16 Q_syn2 /* i : synthesis scaling */ ); #endif void hf_synth_amr_wb_init_fx( AMRWB_IO_DEC_HANDLE hAmrwb_IO /* i/o: AMR-WB IO data handle */ ); Loading Loading @@ -10655,6 +10671,7 @@ Word16 msvq_stage1_dct_recalc_candidates_fdcng_wb_fx( Word16 *dist_ptr_e /* i/o: exp for updated MSE vector for stage1 */ ); #ifndef FIX_2348_REPLACE_FEC_ENC void FEC_encode_ivas_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const ACELP_config acelp_cfg, /* i/o: configuration of the ACELP */ Loading @@ -10668,7 +10685,7 @@ void FEC_encode_ivas_fx( const Word32 total_brate, /* i : total codec bitrate Q0*/ const Word16 Q_synth /* i : input scaling */ ); #endif ivas_error IGF_Reconfig_fx( IGF_ENC_INSTANCE_HANDLE *hIGFEnc, /* i/o: instance handle of IGF Encoder */ const Word16 igf, /* i : IGF on/off */ Loading lib_com/swb_tbe_com_fx.c +12 −10 Original line number Diff line number Diff line Loading @@ -6073,6 +6073,7 @@ void create_random_vector_fx( Word16 i, j, k; Word16 scale1, scale2; Word32 L_tmp; /* Note: the constant 2144047674 is 0.0078f in Q38 from the float reference. It should read 0.0078125f, which is 1/128.Since 0.0078f is nor exactly Loading @@ -6083,34 +6084,34 @@ void create_random_vector_fx( #ifdef FIX_2250_LARGE_DIFFERENCES_BETWEEN_BASOP_AND_FLOAT if ( element_mode != EVS_MONO ) { L_tmp = L_abs( Mpy_32_16_r( 2144047674, Random( &seed[0] ) ) ); /*Q23 */ j = shr( abs_s( Random( &seed[0] ) ), 7 ); /* Random( &seed[0] * 0.0078125f ) */ } else { L_tmp = L_abs( Mult_32_16( 2144047674, Random( &seed[0] ) ) ); /*Q23 */ j = extract_l( L_shr( L_tmp, 23 ) ); } #else L_tmp = L_abs( Mult_32_16( 2144047674, Random( &seed[0] ) ) ); /*Q23 */ #endif j = extract_l( L_shr( L_tmp, 23 ) ); #endif j = s_and( j, 0xff ); #ifdef FIX_2250_LARGE_DIFFERENCES_BETWEEN_BASOP_AND_FLOAT if ( element_mode != EVS_MONO ) { L_tmp = L_abs( Mpy_32_16_r( 2144047674, Random( &seed[1] ) ) ); /*Q23 */ k = shr( abs_s( Random( &seed[1] ) ), 7 ); /* Random( &seed[0] * 0.0078125f ) */ } else { L_tmp = L_abs( Mult_32_16( 2144047674, Random( &seed[1] ) ) ); /*Q23 */ k = extract_l( L_shr( L_tmp, 23 ) ); } #else L_tmp = L_abs( Mult_32_16( 2144047674, Random( &seed[1] ) ) ); /*Q23 */ k = extract_l( L_shr( L_tmp, 23 ) ); #endif k = extract_l( L_shr( L_tmp, 23 ) ); k = s_and( k, 0xff ); WHILE( EQ_16( k, j ) ) Loading @@ -6118,17 +6119,18 @@ void create_random_vector_fx( #ifdef FIX_2250_LARGE_DIFFERENCES_BETWEEN_BASOP_AND_FLOAT if ( element_mode != EVS_MONO ) { L_tmp = L_abs( Mpy_32_16_r( 2144047674, Random( &seed[1] ) ) ); /*Q23 */ k = shr( abs_s( Random( &seed[1] ) ), 7 ); } else { L_tmp = L_abs( Mult_32_16( 2144047674, Random( &seed[1] ) ) ); /*Q23 */ k = extract_l( L_shr( L_tmp, 23 ) ); } #else L_tmp = L_abs( Mult_32_16( 2144047674, Random( &seed[1] ) ) ); /*Q23 */ k = extract_l( L_shr( L_tmp, 23 ) ); #endif k = extract_l( L_shr( L_tmp, 23 ) ); k = s_and( k, 0xff ); } Loading lib_dec/acelp_core_dec_fx.c +8 −0 Original line number Diff line number Diff line Loading @@ -2219,12 +2219,20 @@ ivas_error acelp_core_dec_fx( { IF( EQ_16( st->element_mode, EVS_MONO ) ) { #ifndef FIX_BASOP_2350_HARM_0B_BWE hf_synth_fx( st->hBWE_zero, st->core_brate, output_frame, Aq_fx, exc2_fx, psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2 ); #else hf_synth_fx( st->hBWE_zero, EVS_MONO, st->core_brate, output_frame, Aq_fx, exc2_fx, psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2 ); #endif } ELSE { Copy_Scale_sig_32_16( synth_fx, synth_fx16, output_frame, 0 ); // Q0 #ifndef FIX_BASOP_2350_HARM_0B_BWE hf_synth_ivas_fx( st->hBWE_zero, st->core_brate, output_frame, Aq_fx, exc2_fx, psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2 ); #else hf_synth_fx( st->hBWE_zero, st->element_mode, st->core_brate, output_frame, Aq_fx, exc2_fx, psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2 ); #endif Copy_Scale_sig_16_32_DEPREC( synth_fx16, synth_fx, output_frame, 0 ); } } Loading lib_dec/hf_synth_fx.c +187 −81 Original line number Diff line number Diff line Loading @@ -20,8 +20,12 @@ *---------------------------------------------------------------------*/ static void filt_6k_7k_scale_fx( Word16 signal[], Word16 lg, Word16 mem[], Word16 fact, Word16 exp ); #ifdef FIX_BASOP_2350_HARM_0B_BWE static void hf_synthesis_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, const Word16 element_mode, const Word32 core_brate, const Word16 output_subfr, const Word16 Aq[], const Word16 exc[], const Word16 Q_exc, Word16 synth[], Word16 synth16k[], const Word16 Q_syn ); #else static void hf_synthesis_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, const Word32 core_brate, const Word16 output_subfr, const Word16 Aq[], const Word16 exc[], const Word16 Q_exc, Word16 synth[], Word16 synth16k[], const Word16 Q_syn ); static void hf_synthesis_ivas_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, const Word32 core_brate, const Word16 output_subfr, const Word16 Aq[], const Word16 exc[], const Word16 Q_exc, Word16 synth[], Word16 synth16k[], const Word16 Q_syn ); #endif static void hf_synthesis_amr_wb_fx( const Word32 core_brate, const Word16 output_subfr, const Word16 Ap[], Word16 exc16k[], Word16 synth_out[], Word16 *mem_syn_hf, Word16 *delay_syn_hf, Word16 *mem_hp_interp, Word16 p_r, Word16 HF_corr_gain, Word16 til, Word16 voice_factors, const Word16 exc[], const Word16 Q_exc, const Word16 Q_out, Word16 qhf ); static void envelope_fx( AMRWB_IO_DEC_HANDLE hAmrwb_IO, const Word32 core_brate, const Word16 Aq[], Word16 Ap[], Word16 *r, Word16 tilt0, Word16 tilt, Word16 voice_factor ); static void AdaptiveStartBand_fx( Word16 *start_band, const Word32 rate, const Word16 *lsf, const Word16 voicing_fac, const Word16 clas, Word16 *voicing_flag, Word16 *start_band_old, Word32 *OptCrit_old ); Loading Loading @@ -80,6 +84,9 @@ void hf_synth_reset_fx( void hf_synth_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, /* i/o: handle to 0 bit BWE parameters */ #ifdef FIX_BASOP_2350_HARM_0B_BWE const Word16 element_mode, /* i : element mode Q0*/ #endif const Word32 core_brate, /* i : core bitrate Q0*/ const Word16 output_frame, /* i : output frame length Q0*/ const Word16 *Aq, /* i : quantized Az Q12*/ Loading @@ -99,8 +106,11 @@ void hf_synth_fx( p_Aq = Aq; /* Q12 */ FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { hf_synthesis_fx( hBWE_zero, core_brate, output_subfr, p_Aq, &exc[i_subfr], Q_exc, &synth[i_subfr], &synth16k[imult3216( (Word32) i_subfr, output_subfr ) / L_SUBFR], Q_syn2 ); #ifdef FIX_BASOP_2350_HARM_0B_BWE hf_synthesis_fx( hBWE_zero, element_mode, core_brate, output_subfr, p_Aq, &exc[i_subfr], Q_exc, &synth[i_subfr], &synth16k[i_subfr * output_subfr / L_SUBFR], Q_syn2 ); #else hf_synthesis_fx( hBWE_zero, core_brate, output_subfr, p_Aq, &exc[i_subfr], Q_exc, &synth[i_subfr], &synth16k[i_subfr * output_subfr / L_SUBFR], Q_syn2 ); #endif p_Aq += ( M + 1 ); /* Q12 */ } Loading @@ -120,6 +130,9 @@ void hf_synth_fx( static void hf_synthesis_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, #ifdef FIX_BASOP_2350_HARM_0B_BWE const Word16 element_mode, /* i : element mode Q0*/ #endif const Word32 core_brate, /* i : core bitrate Q0*/ const Word16 output_subfr, /* i : output sub-frame length Q0*/ const Word16 Aq[], /* i : quantized Az Q12*/ Loading @@ -135,6 +148,11 @@ static void hf_synthesis_fx( Word16 HF_exc[L_SUBFR16k]; Word16 tmp, ener, exp1, exp2, scale; Word32 L_tmp; #ifdef FIX_BASOP_2350_HARM_0B_BWE Word16 Q_tmp, Q_ener, sft; Word32 ONE, P_ONE; Word64 prod; #endif Word16 Ap[M16k + 1]; /*-----------------------------------------------------------------* Loading @@ -157,6 +175,11 @@ static void hf_synthesis_fx( /*tmp = round_fx(Dot_product12(HF_exc, HF_exc, output_subfr, &exp1)); */ L_tmp = Dot_product12( HF_exc, HF_exc, L_SUBFR16k, &exp1 ); tmp = round_fx( L_tmp ); /* Q15 */ #ifdef FIX_BASOP_2350_HARM_0B_BWE IF( element_mode == EVS_MONO ) { #endif /* tmp = (float)(sqrt(ener/tmp)) */ /* scale is -1 if tmp > ener */ scale = shr( sub( ener, tmp ), 15 ); /* Q0 */ Loading @@ -171,18 +194,12 @@ static void hf_synthesis_fx( L_tmp = Isqrt_lc( L_tmp, &exp1 ); scale = round_fx( L_tmp ); /* Q18 when Q_exc=-1, HF_exc in Q-3 */ exp2 = sub( hBWE_zero->memExp1, exp1 ); hBWE_zero->memExp1 = exp1; move16(); /*-----------------------------------------------------------------* * calculate energy scaling factor to respect tilt of synth12k8 * (tilt: 1=voiced, -1=unvoiced) *-----------------------------------------------------------------*/ hp400_12k8_fx( synth, L_SUBFR, hBWE_zero->mem_hp400_fx ); /* i: mem_hp400 in Q_syn */ /* i: synth in Q_syn */ /* o: synth in Q_syn-3 */ L_tmp = L_mac( 1L, synth[0], synth[0] ); /* 2*(Q_syn-3)+1 */ FOR( i = 1; i < L_SUBFR; i++ ) Loading @@ -203,7 +220,6 @@ static void hf_synthesis_fx( /*we use the same normalization factor for both ener and tmp, */ /*if the headroom in "tmp" is less than "ener", tmp can saturate */ /*but this is ok since below we apply some thresholds to tmp */ tmp = s_max( 0, tmp ); if ( tmp > 0 ) { Loading @@ -213,6 +229,7 @@ static void hf_synthesis_fx( /*-----------------------------------------------------------------* * modify energy of white noise according to synthesis tilt *-----------------------------------------------------------------*/ /* tmp = 1.0 - fac */ tmp = add_sat( 1, sub( 32767 /* 1 in Q15 */, tmp ) ); test(); Loading @@ -226,11 +243,93 @@ static void hf_synthesis_fx( /*scale *= fac;*/ tmp = mult_r( scale, tmp ); #ifdef FIX_BASOP_2350_HARM_0B_BWE } ELSE { exp1 = add( exp1, 6 ); /* tmp exponent */ ener = shr( ener, 1 ); /* to avoid the assertion in div_s() further*/ exp2 = add( exp2, 1 ); tmp = div_s( ener, tmp ); exp1 = sub( exp2, exp1 ); scale = Sqrt16( tmp, &exp1 ); /* scale exponent = exp1 */ /*-----------------------------------------------------------------* * calculate energy scaling factor to respect tilt of synth12k8 * (tilt: 1=voiced, -1=unvoiced) *-----------------------------------------------------------------*/ hp400_12k8_ivas_fx( synth, L_SUBFR, hBWE_zero->mem_hp400_fx ); /* i: mem_hp400 in Q_syn */ /* i: synth in Q_syn */ /* o: synth in Q_syn-3 */ prod = W_mac0_16_16( 1L, synth[0], synth[0] ); /* 2*(Q_syn-3) */ FOR( i = 1; i < L_SUBFR; i++ ) { prod = W_mac0_16_16( prod, synth[i], synth[i] ); /* 2*(Q_syn-3) */ } sft = W_norm( prod ); ener = extract_h( W_extract_h( W_shl( prod, sft ) ) ); Q_ener = sub( add( shl( sub( Q_syn, 3 ), 1 ), sft ), 48 ); prod = W_mac0_16_16( 1L, synth[1], synth[0] ); /* 2*(Q_syn-3) */ FOR( i = 2; i < L_SUBFR; i++ ) { prod = W_mac0_16_16( prod, synth[i], synth[i - 1] ); /* 2*(Q_syn-3) */ } sft = sub( W_norm( prod ), 1 ); tmp = extract_h( W_extract_h( W_shl( prod, sft ) ) ); Q_tmp = sub( add( shl( sub( Q_syn, 3 ), 1 ), sft ), 48 ); tmp = s_max( 0, tmp ); IF( tmp > 0 ) { tmp = div_s( tmp, ener ); Q_tmp = add( 15, sub( Q_tmp, Q_ener ) ); } /*-----------------------------------------------------------------* * modify energy of white noise according to synthesis tilt *-----------------------------------------------------------------*/ /* tmp = 1.0 - fac */ ONE = L_shl( 1, Q_tmp ); P_ONE = L_shl( 3277 /* 0.1 in Q15 */, sub( Q_tmp, 15 ) ); L_tmp = L_msu0( ONE, tmp, 1 ); test(); if ( core_brate == FRAME_NO_DATA || EQ_32( core_brate, SID_2k40 ) ) { /* emphasize HF noise in CNG */ /*fac *= 2.0f;*/ L_tmp = L_add( L_tmp, L_tmp ); } L_tmp = L_max( L_tmp, P_ONE ); L_tmp = L_min( L_tmp, ONE ); sft = norm_l( L_tmp ); L_tmp = L_shl( L_tmp, sft ); tmp = round_fx( L_tmp ); Q_tmp = sub( add( Q_tmp, sft ), 16 ); /*scale *= fac;*/ tmp = mult_r( scale, tmp ); /* Q = (15 - exp1) + Q_tmp - 15 */ Q_tmp = sub( Q_tmp, exp1 ); } #endif /*-----------------------------------------------------------------* * modify HF excitation according to both calculated scaling factors * high pass filtering (0.94ms of delay) *-----------------------------------------------------------------*/ exp2 = sub( hBWE_zero->memExp1, exp1 ); hBWE_zero->memExp1 = exp1; move16(); filt_6k_7k_scale_fx( HF_exc, L_SUBFR16k, hBWE_zero->mem_hf_fx, tmp, exp2 ); /* i: input HF_exc is scaled in float, here scaling is done inside this filter */ /* i: mem_hf in Q-2 */ Loading @@ -240,15 +339,9 @@ static void hf_synthesis_fx( * synthesis of noise: 4.8kHz..5.6kHz --> 6kHz..7kHz *-----------------------------------------------------------------*/ /*weight_a( Aq, Ap, 0.6f, M );*/ weight_a_lc_fx( Aq, Ap, Gamma_19661_Tbl_fx, M ); /* o: Ap in Q14 */ Syn_filt_s( 0, Ap, M, HF_exc, HF_syn, L_SUBFR16k, hBWE_zero->mem_syn_hf_fx, 1 ); /* i: Ap in Q14 */ /* i: HF_exc in Q0 */ /* o: HF_syn in Q0 */ /* i/o: mem_syn_hf in Q0 */ Scale_sig( HF_syn, L_SUBFR16k, ( add( Q_syn, exp1 ) ) ); /* bring HF_syn to (Q_syn+exp1) */ Loading Loading @@ -287,11 +380,13 @@ static void hf_synthesis_fx( { Copy( HF_syn, upsampled_HF_syn, L_SUBFR16k ); /* Q_syn */ } Vr_add( synth16k, upsampled_HF_syn, synth16k, output_subfr ); return; } #ifndef FIX_BASOP_2350_HARM_0B_BWE void hf_synth_ivas_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, /* i/o: handle to 0 bit BWE parameters */ const Word32 core_brate, /* i : core bitrate Q0*/ Loading Loading @@ -319,7 +414,6 @@ void hf_synth_ivas_fx( return; } static void hf_synthesis_ivas_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, const Word32 core_brate, /* i : core bitrate Q0*/ Loading Loading @@ -498,6 +592,7 @@ static void hf_synthesis_ivas_fx( return; } #endif /*-------------------------------------------------------------------* * filt_6k_7k: Loading @@ -508,6 +603,7 @@ static void hf_synthesis_ivas_fx( * dB loss: -60dB -45dB -13dB -3dB 0dB -3dB -13dB -45dB * (gain=4.0) *-------------------------------------------------------------------*/ static void filt_6k_7k_scale_fx( Word16 signal[], /* i/o: signal Qx*/ Word16 lg, /* i : length of input Q0*/ Loading Loading @@ -539,9 +635,13 @@ static void filt_6k_7k_scale_fx( signal[i] = round_fx_sat( L_tmp ); /* Q0 */ move16(); } Copy( x + lg, mem, L_FIR - 1 ); /* Qx - 2 */ return; } /*-------------------------------------------------------------------* * hf_synth_amr_wb_init() * Loading Loading @@ -578,7 +678,7 @@ void hf_synth_amr_wb_init_fx( move16(); hAmrwb_IO->OptCrit_old_fx = 32768; move32(); /*1.0f in Q15*/ ; return; } Loading @@ -589,6 +689,7 @@ void hf_synth_amr_wb_init_fx( * reset of HF synthesis filters * - needed in switching scenarios *-------------------------------------------------------------------*/ void hf_synth_amr_wb_reset_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, /* o : zero BWE decoder handle */ AMRWB_IO_DEC_HANDLE hAmrwb_IO /* i/o: AMR-WB IO data handle */ Loading Loading @@ -634,6 +735,7 @@ void hf_synth_amr_wb_reset_fx( return; } /*-------------------------------------------------------------------* * hf_synth_amr_wb() * Loading Loading @@ -883,7 +985,6 @@ void hf_synth_amr_wb_fx( tmp = sub( 18022 /* 1.1f in Q14 */, tmp ); /*Q14 */ fmerit_w = round_fx( L_shl( L_mult( fmerit_w, tmp ), 1 ) ); /*Q: 14+14+1+1-16 = 14 */ L_tmp = L_deposit_l( fmerit_w ); /*Q14 */ L_tmp = Isqrt( L_tmp ); /*Q(31-7) */ tmp = round_fx( L_tmp ); /*Q8 */ Loading Loading @@ -1201,6 +1302,8 @@ void hf_synth_amr_wb_fx( return; } static void hf_synthesis_amr_wb_fx( const Word32 core_brate, /* i : core bitrate : Q0*/ const Word16 output_subfr, /* i : output sub-frame length : Q0*/ Loading @@ -1226,6 +1329,7 @@ static void hf_synthesis_amr_wb_fx( Word32 L_tmp; Word16 q1, q2, q3, shift; Word16 *pt1, *pt2, flag; IF( EQ_32( core_brate, ACELP_23k85 ) ) { ener = dot_prod_satcontr( exc, exc, Q_exc, Q_exc, &q1, L_SUBFR ); Loading Loading @@ -1361,6 +1465,7 @@ static void hf_synthesis_amr_wb_fx( return; } static Word16 EnhanceClass_fx( const Word16 qq_fx, /* Qx */ const Word16 pp_fx, /* Qx */ Loading Loading @@ -1423,10 +1528,12 @@ static Word16 EnhanceClass_fx( *unvoicing_flag = 0; move16(); } test(); return ( *unvoicing_flag && GT_16( qq_fx, pp_fx ) ); } static void envelope_fx( AMRWB_IO_DEC_HANDLE hAmrwb_IO, const Word32 core_brate, /* i : core bitrate Q0*/ Loading @@ -1450,7 +1557,6 @@ static void envelope_fx( const Word16 *pt2, *pt3; Word16 Aq[M + 1]; /* Aq has dynamic scaling go back to Q12 to make sure there's no overflow while calculating qx,qy*/ shift = sub( norm_s( Aq_dyn_scal[0] ), 2 ); Loading Loading @@ -1644,7 +1750,6 @@ static void envelope_fx( } qy = round_fx( L_shr( L_tmp, 1 ) ); /*Q(10+q1)*/ L_tmp = L_mult( qx, qx ); /* Q21 + 2q1 */ L_tmp = L_mac( L_tmp, qy, qy ); /* Q21 + 2q1 */ qq = round_fx( Isqrt( L_shr( L_tmp, add( 11, shl( q1, 1 ) ) ) ) ); /*Q10*/ Loading Loading @@ -1711,16 +1816,17 @@ static void envelope_fx( rr = s_min( est_level1, est_level2 ); } q1 = norm_s( pp ); tmp = div_s( shl( 1, sub( 14, q1 ) ), pp ); /*Q(29-q1-10) */ L_tmp = L_mult( rr, tmp ); /*Q(30-q1-10+10) */ *sub_gain = s_min( 20480 /* 5.0f in Q12 */, round_fx_sat( L_shl_sat( L_tmp, sub( q1, 2 ) ) ) ); /*Q12 */ move16(); return; } /*---------------------------------------------------------------------* * AdaptiveStartBand_fx() * Loading Loading
lib_com/options.h +8 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,12 @@ #define FIX_BASOP_2333_MCMASA_ANA_MEMORY_LEAK /* Nokia: basop issue 2333: Add missing free for direction_vector_e to ivas_mcmasa_ana_fx.c */ #define HARM_COREDECODER_FUNCTIONS /* VA: basop issue 2347: Remove various duplicated code in core-decoder */ #define FIX_BASOP_2358_SCALING_OOB /* Eri: Basip issue 2358: Clang-18 reports OOB access where scaling is applied to L_FRAME48k instead of output_frame */ #define FIX_BASOP_2351_EXTREND_SCALE /* FhG: basop issue 2351: Only scale initialized samples in renderer, related to 2326 */ #define FIX_2331_CLANG18_MSAN_UNINIT_VARIABLE /* FhG: Fix issue 2331: Uninitialized variable */ #define FIX_2362_TOTAL_BRATE_CALCULATION /* FhG: basop issue 2362: fix calculation of st->total_brate in ivas_cpe_enc_fx() */ #define FIX_2330_CLANG_18_WARNINGS_REND /* FhG: Fix renderer warnings */ #define FIX_BASOP_2350_HARM_0B_BWE /* VA: basop issue 2350: harmonization of the 0b BWE */ #define FIX_2349_HARM_FIND_UV /* VA: basop issue 2349: harmonization of find_uv() function */ /* #################### End BE switches ################################## */ Loading @@ -111,6 +117,8 @@ #define FIX_2250_LARGE_DIFFERENCES_BETWEEN_BASOP_AND_FLOAT /* Dolby: Issue 2250: random vector generation in GenShapedSHBExcitation() */ #define FIX_2320_OOB_SCE_SWITCHING /* VA: basop issue 2320: Correct the length of the buffer to be scaled in SCE/CPE switching */ #define FIX_2302_LSF_CDBK_THRESHOLD /* VA: basop issue 2302: fix threshold for LSF Q codebook-type decision */ #define FIX_1500_ISM_MD_DTX /* VA: float issue 1500: fix ISM elevation metadata smoothing in DTX */ #define FIX_2348_REPLACE_FEC_ENC /* VA: basop issue 2348: replace FEC_encode_ivas_fx with FEC_encode_fx */ /* ##################### End NON-BE switches ########################### */ Loading
lib_com/prot_fx.h +19 −2 Original line number Diff line number Diff line Loading @@ -6395,6 +6395,7 @@ void hf_synth_reset_fx( ZERO_BWE_DEC_HANDLE hBWE_zero /* o : zero BWE decoder handle */ ); #ifndef FIX_BASOP_2350_HARM_0B_BWE void hf_synth_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, /* i/o: handle to 0 bit BWE parameters */ const Word32 core_brate, /* i : core bitrate Q0*/ Loading @@ -6406,7 +6407,6 @@ void hf_synth_fx( const Word16 Q_exc, /* i : excitation scaling */ const Word16 Q_syn2 /* i : synthesis scaling */ ); void hf_synth_ivas_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, /* i/o: handle to 0 bit BWE parameters */ const Word32 core_brate, /* i : core bitrate Q0*/ Loading @@ -6418,7 +6418,23 @@ void hf_synth_ivas_fx( const Word16 Q_exc, /* i : excitation scaling */ const Word16 Q_syn2 /* i : synthesis scaling */ ); #else void hf_synth_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, /* i/o: handle to 0 bit BWE parameters */ #ifdef FIX_BASOP_2350_HARM_0B_BWE const Word16 element_mode, /* i : element mode Q0*/ #endif const Word32 core_brate, /* i : core bitrate Q0*/ const Word16 output_frame, /* i : output frame length Q0*/ const Word16 *Aq, /* i : quantized Az Q12*/ const Word16 *exc, /* i : excitation at 12.8 kHz Q_exc*/ Word16 *synth, /* i : 12.8kHz synthesis signal Q_syn2*/ Word16 *synth16k, /* o : 16kHz synthesis signal Q_syn2*/ const Word16 Q_exc, /* i : excitation scaling */ const Word16 Q_syn2 /* i : synthesis scaling */ ); #endif void hf_synth_amr_wb_init_fx( AMRWB_IO_DEC_HANDLE hAmrwb_IO /* i/o: AMR-WB IO data handle */ ); Loading Loading @@ -10655,6 +10671,7 @@ Word16 msvq_stage1_dct_recalc_candidates_fdcng_wb_fx( Word16 *dist_ptr_e /* i/o: exp for updated MSE vector for stage1 */ ); #ifndef FIX_2348_REPLACE_FEC_ENC void FEC_encode_ivas_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const ACELP_config acelp_cfg, /* i/o: configuration of the ACELP */ Loading @@ -10668,7 +10685,7 @@ void FEC_encode_ivas_fx( const Word32 total_brate, /* i : total codec bitrate Q0*/ const Word16 Q_synth /* i : input scaling */ ); #endif ivas_error IGF_Reconfig_fx( IGF_ENC_INSTANCE_HANDLE *hIGFEnc, /* i/o: instance handle of IGF Encoder */ const Word16 igf, /* i : IGF on/off */ Loading
lib_com/swb_tbe_com_fx.c +12 −10 Original line number Diff line number Diff line Loading @@ -6073,6 +6073,7 @@ void create_random_vector_fx( Word16 i, j, k; Word16 scale1, scale2; Word32 L_tmp; /* Note: the constant 2144047674 is 0.0078f in Q38 from the float reference. It should read 0.0078125f, which is 1/128.Since 0.0078f is nor exactly Loading @@ -6083,34 +6084,34 @@ void create_random_vector_fx( #ifdef FIX_2250_LARGE_DIFFERENCES_BETWEEN_BASOP_AND_FLOAT if ( element_mode != EVS_MONO ) { L_tmp = L_abs( Mpy_32_16_r( 2144047674, Random( &seed[0] ) ) ); /*Q23 */ j = shr( abs_s( Random( &seed[0] ) ), 7 ); /* Random( &seed[0] * 0.0078125f ) */ } else { L_tmp = L_abs( Mult_32_16( 2144047674, Random( &seed[0] ) ) ); /*Q23 */ j = extract_l( L_shr( L_tmp, 23 ) ); } #else L_tmp = L_abs( Mult_32_16( 2144047674, Random( &seed[0] ) ) ); /*Q23 */ #endif j = extract_l( L_shr( L_tmp, 23 ) ); #endif j = s_and( j, 0xff ); #ifdef FIX_2250_LARGE_DIFFERENCES_BETWEEN_BASOP_AND_FLOAT if ( element_mode != EVS_MONO ) { L_tmp = L_abs( Mpy_32_16_r( 2144047674, Random( &seed[1] ) ) ); /*Q23 */ k = shr( abs_s( Random( &seed[1] ) ), 7 ); /* Random( &seed[0] * 0.0078125f ) */ } else { L_tmp = L_abs( Mult_32_16( 2144047674, Random( &seed[1] ) ) ); /*Q23 */ k = extract_l( L_shr( L_tmp, 23 ) ); } #else L_tmp = L_abs( Mult_32_16( 2144047674, Random( &seed[1] ) ) ); /*Q23 */ k = extract_l( L_shr( L_tmp, 23 ) ); #endif k = extract_l( L_shr( L_tmp, 23 ) ); k = s_and( k, 0xff ); WHILE( EQ_16( k, j ) ) Loading @@ -6118,17 +6119,18 @@ void create_random_vector_fx( #ifdef FIX_2250_LARGE_DIFFERENCES_BETWEEN_BASOP_AND_FLOAT if ( element_mode != EVS_MONO ) { L_tmp = L_abs( Mpy_32_16_r( 2144047674, Random( &seed[1] ) ) ); /*Q23 */ k = shr( abs_s( Random( &seed[1] ) ), 7 ); } else { L_tmp = L_abs( Mult_32_16( 2144047674, Random( &seed[1] ) ) ); /*Q23 */ k = extract_l( L_shr( L_tmp, 23 ) ); } #else L_tmp = L_abs( Mult_32_16( 2144047674, Random( &seed[1] ) ) ); /*Q23 */ k = extract_l( L_shr( L_tmp, 23 ) ); #endif k = extract_l( L_shr( L_tmp, 23 ) ); k = s_and( k, 0xff ); } Loading
lib_dec/acelp_core_dec_fx.c +8 −0 Original line number Diff line number Diff line Loading @@ -2219,12 +2219,20 @@ ivas_error acelp_core_dec_fx( { IF( EQ_16( st->element_mode, EVS_MONO ) ) { #ifndef FIX_BASOP_2350_HARM_0B_BWE hf_synth_fx( st->hBWE_zero, st->core_brate, output_frame, Aq_fx, exc2_fx, psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2 ); #else hf_synth_fx( st->hBWE_zero, EVS_MONO, st->core_brate, output_frame, Aq_fx, exc2_fx, psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2 ); #endif } ELSE { Copy_Scale_sig_32_16( synth_fx, synth_fx16, output_frame, 0 ); // Q0 #ifndef FIX_BASOP_2350_HARM_0B_BWE hf_synth_ivas_fx( st->hBWE_zero, st->core_brate, output_frame, Aq_fx, exc2_fx, psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2 ); #else hf_synth_fx( st->hBWE_zero, st->element_mode, st->core_brate, output_frame, Aq_fx, exc2_fx, psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2 ); #endif Copy_Scale_sig_16_32_DEPREC( synth_fx16, synth_fx, output_frame, 0 ); } } Loading
lib_dec/hf_synth_fx.c +187 −81 Original line number Diff line number Diff line Loading @@ -20,8 +20,12 @@ *---------------------------------------------------------------------*/ static void filt_6k_7k_scale_fx( Word16 signal[], Word16 lg, Word16 mem[], Word16 fact, Word16 exp ); #ifdef FIX_BASOP_2350_HARM_0B_BWE static void hf_synthesis_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, const Word16 element_mode, const Word32 core_brate, const Word16 output_subfr, const Word16 Aq[], const Word16 exc[], const Word16 Q_exc, Word16 synth[], Word16 synth16k[], const Word16 Q_syn ); #else static void hf_synthesis_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, const Word32 core_brate, const Word16 output_subfr, const Word16 Aq[], const Word16 exc[], const Word16 Q_exc, Word16 synth[], Word16 synth16k[], const Word16 Q_syn ); static void hf_synthesis_ivas_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, const Word32 core_brate, const Word16 output_subfr, const Word16 Aq[], const Word16 exc[], const Word16 Q_exc, Word16 synth[], Word16 synth16k[], const Word16 Q_syn ); #endif static void hf_synthesis_amr_wb_fx( const Word32 core_brate, const Word16 output_subfr, const Word16 Ap[], Word16 exc16k[], Word16 synth_out[], Word16 *mem_syn_hf, Word16 *delay_syn_hf, Word16 *mem_hp_interp, Word16 p_r, Word16 HF_corr_gain, Word16 til, Word16 voice_factors, const Word16 exc[], const Word16 Q_exc, const Word16 Q_out, Word16 qhf ); static void envelope_fx( AMRWB_IO_DEC_HANDLE hAmrwb_IO, const Word32 core_brate, const Word16 Aq[], Word16 Ap[], Word16 *r, Word16 tilt0, Word16 tilt, Word16 voice_factor ); static void AdaptiveStartBand_fx( Word16 *start_band, const Word32 rate, const Word16 *lsf, const Word16 voicing_fac, const Word16 clas, Word16 *voicing_flag, Word16 *start_band_old, Word32 *OptCrit_old ); Loading Loading @@ -80,6 +84,9 @@ void hf_synth_reset_fx( void hf_synth_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, /* i/o: handle to 0 bit BWE parameters */ #ifdef FIX_BASOP_2350_HARM_0B_BWE const Word16 element_mode, /* i : element mode Q0*/ #endif const Word32 core_brate, /* i : core bitrate Q0*/ const Word16 output_frame, /* i : output frame length Q0*/ const Word16 *Aq, /* i : quantized Az Q12*/ Loading @@ -99,8 +106,11 @@ void hf_synth_fx( p_Aq = Aq; /* Q12 */ FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { hf_synthesis_fx( hBWE_zero, core_brate, output_subfr, p_Aq, &exc[i_subfr], Q_exc, &synth[i_subfr], &synth16k[imult3216( (Word32) i_subfr, output_subfr ) / L_SUBFR], Q_syn2 ); #ifdef FIX_BASOP_2350_HARM_0B_BWE hf_synthesis_fx( hBWE_zero, element_mode, core_brate, output_subfr, p_Aq, &exc[i_subfr], Q_exc, &synth[i_subfr], &synth16k[i_subfr * output_subfr / L_SUBFR], Q_syn2 ); #else hf_synthesis_fx( hBWE_zero, core_brate, output_subfr, p_Aq, &exc[i_subfr], Q_exc, &synth[i_subfr], &synth16k[i_subfr * output_subfr / L_SUBFR], Q_syn2 ); #endif p_Aq += ( M + 1 ); /* Q12 */ } Loading @@ -120,6 +130,9 @@ void hf_synth_fx( static void hf_synthesis_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, #ifdef FIX_BASOP_2350_HARM_0B_BWE const Word16 element_mode, /* i : element mode Q0*/ #endif const Word32 core_brate, /* i : core bitrate Q0*/ const Word16 output_subfr, /* i : output sub-frame length Q0*/ const Word16 Aq[], /* i : quantized Az Q12*/ Loading @@ -135,6 +148,11 @@ static void hf_synthesis_fx( Word16 HF_exc[L_SUBFR16k]; Word16 tmp, ener, exp1, exp2, scale; Word32 L_tmp; #ifdef FIX_BASOP_2350_HARM_0B_BWE Word16 Q_tmp, Q_ener, sft; Word32 ONE, P_ONE; Word64 prod; #endif Word16 Ap[M16k + 1]; /*-----------------------------------------------------------------* Loading @@ -157,6 +175,11 @@ static void hf_synthesis_fx( /*tmp = round_fx(Dot_product12(HF_exc, HF_exc, output_subfr, &exp1)); */ L_tmp = Dot_product12( HF_exc, HF_exc, L_SUBFR16k, &exp1 ); tmp = round_fx( L_tmp ); /* Q15 */ #ifdef FIX_BASOP_2350_HARM_0B_BWE IF( element_mode == EVS_MONO ) { #endif /* tmp = (float)(sqrt(ener/tmp)) */ /* scale is -1 if tmp > ener */ scale = shr( sub( ener, tmp ), 15 ); /* Q0 */ Loading @@ -171,18 +194,12 @@ static void hf_synthesis_fx( L_tmp = Isqrt_lc( L_tmp, &exp1 ); scale = round_fx( L_tmp ); /* Q18 when Q_exc=-1, HF_exc in Q-3 */ exp2 = sub( hBWE_zero->memExp1, exp1 ); hBWE_zero->memExp1 = exp1; move16(); /*-----------------------------------------------------------------* * calculate energy scaling factor to respect tilt of synth12k8 * (tilt: 1=voiced, -1=unvoiced) *-----------------------------------------------------------------*/ hp400_12k8_fx( synth, L_SUBFR, hBWE_zero->mem_hp400_fx ); /* i: mem_hp400 in Q_syn */ /* i: synth in Q_syn */ /* o: synth in Q_syn-3 */ L_tmp = L_mac( 1L, synth[0], synth[0] ); /* 2*(Q_syn-3)+1 */ FOR( i = 1; i < L_SUBFR; i++ ) Loading @@ -203,7 +220,6 @@ static void hf_synthesis_fx( /*we use the same normalization factor for both ener and tmp, */ /*if the headroom in "tmp" is less than "ener", tmp can saturate */ /*but this is ok since below we apply some thresholds to tmp */ tmp = s_max( 0, tmp ); if ( tmp > 0 ) { Loading @@ -213,6 +229,7 @@ static void hf_synthesis_fx( /*-----------------------------------------------------------------* * modify energy of white noise according to synthesis tilt *-----------------------------------------------------------------*/ /* tmp = 1.0 - fac */ tmp = add_sat( 1, sub( 32767 /* 1 in Q15 */, tmp ) ); test(); Loading @@ -226,11 +243,93 @@ static void hf_synthesis_fx( /*scale *= fac;*/ tmp = mult_r( scale, tmp ); #ifdef FIX_BASOP_2350_HARM_0B_BWE } ELSE { exp1 = add( exp1, 6 ); /* tmp exponent */ ener = shr( ener, 1 ); /* to avoid the assertion in div_s() further*/ exp2 = add( exp2, 1 ); tmp = div_s( ener, tmp ); exp1 = sub( exp2, exp1 ); scale = Sqrt16( tmp, &exp1 ); /* scale exponent = exp1 */ /*-----------------------------------------------------------------* * calculate energy scaling factor to respect tilt of synth12k8 * (tilt: 1=voiced, -1=unvoiced) *-----------------------------------------------------------------*/ hp400_12k8_ivas_fx( synth, L_SUBFR, hBWE_zero->mem_hp400_fx ); /* i: mem_hp400 in Q_syn */ /* i: synth in Q_syn */ /* o: synth in Q_syn-3 */ prod = W_mac0_16_16( 1L, synth[0], synth[0] ); /* 2*(Q_syn-3) */ FOR( i = 1; i < L_SUBFR; i++ ) { prod = W_mac0_16_16( prod, synth[i], synth[i] ); /* 2*(Q_syn-3) */ } sft = W_norm( prod ); ener = extract_h( W_extract_h( W_shl( prod, sft ) ) ); Q_ener = sub( add( shl( sub( Q_syn, 3 ), 1 ), sft ), 48 ); prod = W_mac0_16_16( 1L, synth[1], synth[0] ); /* 2*(Q_syn-3) */ FOR( i = 2; i < L_SUBFR; i++ ) { prod = W_mac0_16_16( prod, synth[i], synth[i - 1] ); /* 2*(Q_syn-3) */ } sft = sub( W_norm( prod ), 1 ); tmp = extract_h( W_extract_h( W_shl( prod, sft ) ) ); Q_tmp = sub( add( shl( sub( Q_syn, 3 ), 1 ), sft ), 48 ); tmp = s_max( 0, tmp ); IF( tmp > 0 ) { tmp = div_s( tmp, ener ); Q_tmp = add( 15, sub( Q_tmp, Q_ener ) ); } /*-----------------------------------------------------------------* * modify energy of white noise according to synthesis tilt *-----------------------------------------------------------------*/ /* tmp = 1.0 - fac */ ONE = L_shl( 1, Q_tmp ); P_ONE = L_shl( 3277 /* 0.1 in Q15 */, sub( Q_tmp, 15 ) ); L_tmp = L_msu0( ONE, tmp, 1 ); test(); if ( core_brate == FRAME_NO_DATA || EQ_32( core_brate, SID_2k40 ) ) { /* emphasize HF noise in CNG */ /*fac *= 2.0f;*/ L_tmp = L_add( L_tmp, L_tmp ); } L_tmp = L_max( L_tmp, P_ONE ); L_tmp = L_min( L_tmp, ONE ); sft = norm_l( L_tmp ); L_tmp = L_shl( L_tmp, sft ); tmp = round_fx( L_tmp ); Q_tmp = sub( add( Q_tmp, sft ), 16 ); /*scale *= fac;*/ tmp = mult_r( scale, tmp ); /* Q = (15 - exp1) + Q_tmp - 15 */ Q_tmp = sub( Q_tmp, exp1 ); } #endif /*-----------------------------------------------------------------* * modify HF excitation according to both calculated scaling factors * high pass filtering (0.94ms of delay) *-----------------------------------------------------------------*/ exp2 = sub( hBWE_zero->memExp1, exp1 ); hBWE_zero->memExp1 = exp1; move16(); filt_6k_7k_scale_fx( HF_exc, L_SUBFR16k, hBWE_zero->mem_hf_fx, tmp, exp2 ); /* i: input HF_exc is scaled in float, here scaling is done inside this filter */ /* i: mem_hf in Q-2 */ Loading @@ -240,15 +339,9 @@ static void hf_synthesis_fx( * synthesis of noise: 4.8kHz..5.6kHz --> 6kHz..7kHz *-----------------------------------------------------------------*/ /*weight_a( Aq, Ap, 0.6f, M );*/ weight_a_lc_fx( Aq, Ap, Gamma_19661_Tbl_fx, M ); /* o: Ap in Q14 */ Syn_filt_s( 0, Ap, M, HF_exc, HF_syn, L_SUBFR16k, hBWE_zero->mem_syn_hf_fx, 1 ); /* i: Ap in Q14 */ /* i: HF_exc in Q0 */ /* o: HF_syn in Q0 */ /* i/o: mem_syn_hf in Q0 */ Scale_sig( HF_syn, L_SUBFR16k, ( add( Q_syn, exp1 ) ) ); /* bring HF_syn to (Q_syn+exp1) */ Loading Loading @@ -287,11 +380,13 @@ static void hf_synthesis_fx( { Copy( HF_syn, upsampled_HF_syn, L_SUBFR16k ); /* Q_syn */ } Vr_add( synth16k, upsampled_HF_syn, synth16k, output_subfr ); return; } #ifndef FIX_BASOP_2350_HARM_0B_BWE void hf_synth_ivas_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, /* i/o: handle to 0 bit BWE parameters */ const Word32 core_brate, /* i : core bitrate Q0*/ Loading Loading @@ -319,7 +414,6 @@ void hf_synth_ivas_fx( return; } static void hf_synthesis_ivas_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, const Word32 core_brate, /* i : core bitrate Q0*/ Loading Loading @@ -498,6 +592,7 @@ static void hf_synthesis_ivas_fx( return; } #endif /*-------------------------------------------------------------------* * filt_6k_7k: Loading @@ -508,6 +603,7 @@ static void hf_synthesis_ivas_fx( * dB loss: -60dB -45dB -13dB -3dB 0dB -3dB -13dB -45dB * (gain=4.0) *-------------------------------------------------------------------*/ static void filt_6k_7k_scale_fx( Word16 signal[], /* i/o: signal Qx*/ Word16 lg, /* i : length of input Q0*/ Loading Loading @@ -539,9 +635,13 @@ static void filt_6k_7k_scale_fx( signal[i] = round_fx_sat( L_tmp ); /* Q0 */ move16(); } Copy( x + lg, mem, L_FIR - 1 ); /* Qx - 2 */ return; } /*-------------------------------------------------------------------* * hf_synth_amr_wb_init() * Loading Loading @@ -578,7 +678,7 @@ void hf_synth_amr_wb_init_fx( move16(); hAmrwb_IO->OptCrit_old_fx = 32768; move32(); /*1.0f in Q15*/ ; return; } Loading @@ -589,6 +689,7 @@ void hf_synth_amr_wb_init_fx( * reset of HF synthesis filters * - needed in switching scenarios *-------------------------------------------------------------------*/ void hf_synth_amr_wb_reset_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, /* o : zero BWE decoder handle */ AMRWB_IO_DEC_HANDLE hAmrwb_IO /* i/o: AMR-WB IO data handle */ Loading Loading @@ -634,6 +735,7 @@ void hf_synth_amr_wb_reset_fx( return; } /*-------------------------------------------------------------------* * hf_synth_amr_wb() * Loading Loading @@ -883,7 +985,6 @@ void hf_synth_amr_wb_fx( tmp = sub( 18022 /* 1.1f in Q14 */, tmp ); /*Q14 */ fmerit_w = round_fx( L_shl( L_mult( fmerit_w, tmp ), 1 ) ); /*Q: 14+14+1+1-16 = 14 */ L_tmp = L_deposit_l( fmerit_w ); /*Q14 */ L_tmp = Isqrt( L_tmp ); /*Q(31-7) */ tmp = round_fx( L_tmp ); /*Q8 */ Loading Loading @@ -1201,6 +1302,8 @@ void hf_synth_amr_wb_fx( return; } static void hf_synthesis_amr_wb_fx( const Word32 core_brate, /* i : core bitrate : Q0*/ const Word16 output_subfr, /* i : output sub-frame length : Q0*/ Loading @@ -1226,6 +1329,7 @@ static void hf_synthesis_amr_wb_fx( Word32 L_tmp; Word16 q1, q2, q3, shift; Word16 *pt1, *pt2, flag; IF( EQ_32( core_brate, ACELP_23k85 ) ) { ener = dot_prod_satcontr( exc, exc, Q_exc, Q_exc, &q1, L_SUBFR ); Loading Loading @@ -1361,6 +1465,7 @@ static void hf_synthesis_amr_wb_fx( return; } static Word16 EnhanceClass_fx( const Word16 qq_fx, /* Qx */ const Word16 pp_fx, /* Qx */ Loading Loading @@ -1423,10 +1528,12 @@ static Word16 EnhanceClass_fx( *unvoicing_flag = 0; move16(); } test(); return ( *unvoicing_flag && GT_16( qq_fx, pp_fx ) ); } static void envelope_fx( AMRWB_IO_DEC_HANDLE hAmrwb_IO, const Word32 core_brate, /* i : core bitrate Q0*/ Loading @@ -1450,7 +1557,6 @@ static void envelope_fx( const Word16 *pt2, *pt3; Word16 Aq[M + 1]; /* Aq has dynamic scaling go back to Q12 to make sure there's no overflow while calculating qx,qy*/ shift = sub( norm_s( Aq_dyn_scal[0] ), 2 ); Loading Loading @@ -1644,7 +1750,6 @@ static void envelope_fx( } qy = round_fx( L_shr( L_tmp, 1 ) ); /*Q(10+q1)*/ L_tmp = L_mult( qx, qx ); /* Q21 + 2q1 */ L_tmp = L_mac( L_tmp, qy, qy ); /* Q21 + 2q1 */ qq = round_fx( Isqrt( L_shr( L_tmp, add( 11, shl( q1, 1 ) ) ) ) ); /*Q10*/ Loading Loading @@ -1711,16 +1816,17 @@ static void envelope_fx( rr = s_min( est_level1, est_level2 ); } q1 = norm_s( pp ); tmp = div_s( shl( 1, sub( 14, q1 ) ), pp ); /*Q(29-q1-10) */ L_tmp = L_mult( rr, tmp ); /*Q(30-q1-10+10) */ *sub_gain = s_min( 20480 /* 5.0f in Q12 */, round_fx_sat( L_shl_sat( L_tmp, sub( q1, 2 ) ) ) ); /*Q12 */ move16(); return; } /*---------------------------------------------------------------------* * AdaptiveStartBand_fx() * Loading