Loading lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -99,5 +99,6 @@ #define NONBE_FIX_864_JBM_RENDER_FRAMESIZE /* FhG: issue #864: fix different behaviour of JBM TSM with different render frame sizes */ #define FIX_1762_COMPILER_ISSUE /* FhG: fix compiler issues with W_mac_32_32() + ONE_IN_Q30 */ #define ISSUE_1751_replace_shl_ro /*FhG: replace shl_ro by overflow-free alternatives*/ #endif lib_dec/dec_gen_voic_fx.c +9 −4 Original line number Diff line number Diff line Loading @@ -106,10 +106,6 @@ ivas_error decod_gen_voic_fx( gain_inov_fx = 0; error_fx = 0; gain_preQ_fx = 0; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif move16(); move32(); move32(); Loading Loading @@ -467,11 +463,20 @@ ivas_error decod_gen_voic_fx( test(); test(); test(); #ifdef ISSUE_1751_replace_shl_ro IF( GT_16( shr_r_sat( enratio, sub( Qenratio, 15 ) ), 8192 ) && /*compare with 0.25 in Q15*/ LT_16( shr_r_sat( enratio, sub( Qenratio, 10 ) ), 15360 ) && /*compare with 15.0 in Q10*/ GT_16( shr_r_sat( sp_enratio, sub( Qsp_enratio, 15 ) ), 4915 ) && /*compare with 0.15 in Q15*/ LT_16( st_fx->bfi_pitch_fx, 9600 ) && /*Q6*/ LT_16( pitch_buf_fx[( NB_SUBFR16k - 1 )], 9600 ) ) /*Q6*/ #else Flag Overflow; IF( GT_16( shl_ro( enratio, sub( 15, Qenratio ), &Overflow ), 8192 ) && /*compare with 0.25 in Q15*/ LT_16( shl_ro( enratio, sub( 10, Qenratio ), &Overflow ), 15360 ) && /*compare with 15.0 in Q10*/ GT_16( shl_ro( sp_enratio, sub( 15, Qsp_enratio ), &Overflow ), 4915 ) && /*compare with 0.15 in Q15*/ LT_16( st_fx->bfi_pitch_fx, 9600 ) && /*Q6*/ LT_16( pitch_buf_fx[( NB_SUBFR16k - 1 )], 9600 ) ) /*Q6*/ #endif { IF( NE_32( ( error = DTFS_new_fx( &PREVP ) ), IVAS_ERR_OK ) ) { Loading lib_dec/jbm_pcmdsp_similarityestimation_fx.c +5 −1 Original line number Diff line number Diff line Loading @@ -128,7 +128,6 @@ Word16 normalized_cross_correlation_self_fx( const Word16 *signal, IF( sqrtXY != 0 ) { Flag Overflow = 0; move32(); normCC = 0; move16(); Loading @@ -136,7 +135,12 @@ Word16 normalized_cross_correlation_self_fx( const Word16 *signal, normCC = add( normCC, 16 ); /* scale to Q15 with saturation */ BASOP_SATURATE_WARNING_OFF #ifdef ISSUE_1751_replace_shl_ro cc = shr_r_sat( cc, negate( add( normXY, normCC ) ) ); #else Flag Overflow; cc = shl_ro( cc, add( normXY, normCC ), &Overflow ); #endif BASOP_SATURATE_WARNING_ON *energy = L_shr_r( L_deposit_l( sqrtXY ), normXY ); } Loading lib_rend/ivas_dirac_output_synthesis_dec_fx.c +14 −6 Original line number Diff line number Diff line Loading @@ -4258,11 +4258,15 @@ void ivas_lfe_synth_with_filters_fx( } ELSE { Flag overFlow; lfeGain_fx = extract_h( BASOP_Util_Divide3232_Scale_newton( hMasaLfeSynth->targetEneLfeSmooth_fx, L_add( EPSILON_FX, hMasaLfeSynth->transportEneSmooth_fx ), &lfeGain_fx_exp ) ); /*Q(31-(lfeGain_fx_exp+hMasaLfeSynth->transportEneSmooth_q-hMasaLfeSynth->targetEneLfeSmooth_q))-16*/ lfeGain_fx_exp = add( sub( hMasaLfeSynth->transportEneSmooth_q, hMasaLfeSynth->targetEneLfeSmooth_q ), lfeGain_fx_exp ); lfeGain_fx = Sqrt16( lfeGain_fx, &lfeGain_fx_exp ); // Q15-lfeGain_fx_exp lfeGain_fx = shl_ro( lfeGain_fx, lfeGain_fx_exp, &overFlow ); // Q15 #ifdef ISSUE_1751_replace_shl_ro lfeGain_fx = shr_r_sat( lfeGain_fx, negate( lfeGain_fx_exp ) ); // Q15 #else Flag Overflow; lfeGain_fx = shl_ro( lfeGain_fx, lfeGain_fx_exp, &Overflow ); // Q15 #endif } IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( hMasaLfeSynth->targetEneTransSmooth_fx, sub( Q31, hMasaLfeSynth->targetEneTransSmooth_q ), /*EPSILON + */ hMasaLfeSynth->transportEneSmooth_fx, sub( Q31, hMasaLfeSynth->transportEneSmooth_q ) ), 1 ) ) { Loading @@ -4271,11 +4275,15 @@ void ivas_lfe_synth_with_filters_fx( } ELSE { Flag overFlow; transportGain_fx = BASOP_Util_Divide3232_Scale( hMasaLfeSynth->targetEneTransSmooth_fx, /*EPSILON + */ hMasaLfeSynth->transportEneSmooth_fx, &transportGain_fx_exp ); /*Q=15-(transportGain_fx_exp+hMasaLfeSynth->transportEneSmooth_q-hMasaLfeSynth->targetEneTransSmooth_q)*/ transportGain_fx_exp = add( sub( hMasaLfeSynth->transportEneSmooth_q, hMasaLfeSynth->targetEneTransSmooth_q ), transportGain_fx_exp ); transportGain_fx = Sqrt16( transportGain_fx, &transportGain_fx_exp ); // q15-transportGain_fx_exp transportGain_fx = shl_ro( transportGain_fx, transportGain_fx_exp, &overFlow ); // Q15 #ifdef ISSUE_1751_replace_shl_ro transportGain_fx = shr_r_sat( transportGain_fx, negate( transportGain_fx_exp ) ); // Q15 #else Flag Overflow; transportGain_fx = shl_ro( transportGain_fx, transportGain_fx_exp, &Overflow ); // Q15 #endif } j = 0; move16(); Loading Loading
lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -99,5 +99,6 @@ #define NONBE_FIX_864_JBM_RENDER_FRAMESIZE /* FhG: issue #864: fix different behaviour of JBM TSM with different render frame sizes */ #define FIX_1762_COMPILER_ISSUE /* FhG: fix compiler issues with W_mac_32_32() + ONE_IN_Q30 */ #define ISSUE_1751_replace_shl_ro /*FhG: replace shl_ro by overflow-free alternatives*/ #endif
lib_dec/dec_gen_voic_fx.c +9 −4 Original line number Diff line number Diff line Loading @@ -106,10 +106,6 @@ ivas_error decod_gen_voic_fx( gain_inov_fx = 0; error_fx = 0; gain_preQ_fx = 0; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif move16(); move32(); move32(); Loading Loading @@ -467,11 +463,20 @@ ivas_error decod_gen_voic_fx( test(); test(); test(); #ifdef ISSUE_1751_replace_shl_ro IF( GT_16( shr_r_sat( enratio, sub( Qenratio, 15 ) ), 8192 ) && /*compare with 0.25 in Q15*/ LT_16( shr_r_sat( enratio, sub( Qenratio, 10 ) ), 15360 ) && /*compare with 15.0 in Q10*/ GT_16( shr_r_sat( sp_enratio, sub( Qsp_enratio, 15 ) ), 4915 ) && /*compare with 0.15 in Q15*/ LT_16( st_fx->bfi_pitch_fx, 9600 ) && /*Q6*/ LT_16( pitch_buf_fx[( NB_SUBFR16k - 1 )], 9600 ) ) /*Q6*/ #else Flag Overflow; IF( GT_16( shl_ro( enratio, sub( 15, Qenratio ), &Overflow ), 8192 ) && /*compare with 0.25 in Q15*/ LT_16( shl_ro( enratio, sub( 10, Qenratio ), &Overflow ), 15360 ) && /*compare with 15.0 in Q10*/ GT_16( shl_ro( sp_enratio, sub( 15, Qsp_enratio ), &Overflow ), 4915 ) && /*compare with 0.15 in Q15*/ LT_16( st_fx->bfi_pitch_fx, 9600 ) && /*Q6*/ LT_16( pitch_buf_fx[( NB_SUBFR16k - 1 )], 9600 ) ) /*Q6*/ #endif { IF( NE_32( ( error = DTFS_new_fx( &PREVP ) ), IVAS_ERR_OK ) ) { Loading
lib_dec/jbm_pcmdsp_similarityestimation_fx.c +5 −1 Original line number Diff line number Diff line Loading @@ -128,7 +128,6 @@ Word16 normalized_cross_correlation_self_fx( const Word16 *signal, IF( sqrtXY != 0 ) { Flag Overflow = 0; move32(); normCC = 0; move16(); Loading @@ -136,7 +135,12 @@ Word16 normalized_cross_correlation_self_fx( const Word16 *signal, normCC = add( normCC, 16 ); /* scale to Q15 with saturation */ BASOP_SATURATE_WARNING_OFF #ifdef ISSUE_1751_replace_shl_ro cc = shr_r_sat( cc, negate( add( normXY, normCC ) ) ); #else Flag Overflow; cc = shl_ro( cc, add( normXY, normCC ), &Overflow ); #endif BASOP_SATURATE_WARNING_ON *energy = L_shr_r( L_deposit_l( sqrtXY ), normXY ); } Loading
lib_rend/ivas_dirac_output_synthesis_dec_fx.c +14 −6 Original line number Diff line number Diff line Loading @@ -4258,11 +4258,15 @@ void ivas_lfe_synth_with_filters_fx( } ELSE { Flag overFlow; lfeGain_fx = extract_h( BASOP_Util_Divide3232_Scale_newton( hMasaLfeSynth->targetEneLfeSmooth_fx, L_add( EPSILON_FX, hMasaLfeSynth->transportEneSmooth_fx ), &lfeGain_fx_exp ) ); /*Q(31-(lfeGain_fx_exp+hMasaLfeSynth->transportEneSmooth_q-hMasaLfeSynth->targetEneLfeSmooth_q))-16*/ lfeGain_fx_exp = add( sub( hMasaLfeSynth->transportEneSmooth_q, hMasaLfeSynth->targetEneLfeSmooth_q ), lfeGain_fx_exp ); lfeGain_fx = Sqrt16( lfeGain_fx, &lfeGain_fx_exp ); // Q15-lfeGain_fx_exp lfeGain_fx = shl_ro( lfeGain_fx, lfeGain_fx_exp, &overFlow ); // Q15 #ifdef ISSUE_1751_replace_shl_ro lfeGain_fx = shr_r_sat( lfeGain_fx, negate( lfeGain_fx_exp ) ); // Q15 #else Flag Overflow; lfeGain_fx = shl_ro( lfeGain_fx, lfeGain_fx_exp, &Overflow ); // Q15 #endif } IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( hMasaLfeSynth->targetEneTransSmooth_fx, sub( Q31, hMasaLfeSynth->targetEneTransSmooth_q ), /*EPSILON + */ hMasaLfeSynth->transportEneSmooth_fx, sub( Q31, hMasaLfeSynth->transportEneSmooth_q ) ), 1 ) ) { Loading @@ -4271,11 +4275,15 @@ void ivas_lfe_synth_with_filters_fx( } ELSE { Flag overFlow; transportGain_fx = BASOP_Util_Divide3232_Scale( hMasaLfeSynth->targetEneTransSmooth_fx, /*EPSILON + */ hMasaLfeSynth->transportEneSmooth_fx, &transportGain_fx_exp ); /*Q=15-(transportGain_fx_exp+hMasaLfeSynth->transportEneSmooth_q-hMasaLfeSynth->targetEneTransSmooth_q)*/ transportGain_fx_exp = add( sub( hMasaLfeSynth->transportEneSmooth_q, hMasaLfeSynth->targetEneTransSmooth_q ), transportGain_fx_exp ); transportGain_fx = Sqrt16( transportGain_fx, &transportGain_fx_exp ); // q15-transportGain_fx_exp transportGain_fx = shl_ro( transportGain_fx, transportGain_fx_exp, &overFlow ); // Q15 #ifdef ISSUE_1751_replace_shl_ro transportGain_fx = shr_r_sat( transportGain_fx, negate( transportGain_fx_exp ) ); // Q15 #else Flag Overflow; transportGain_fx = shl_ro( transportGain_fx, transportGain_fx_exp, &Overflow ); // Q15 #endif } j = 0; move16(); Loading