diff --git a/lib_com/options.h b/lib_com/options.h index 0cf958d03f0ea1e00be423e92f82dd91da395295..733223354f9e3aa382a794ed5930c1ff54877d97 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -110,6 +110,8 @@ #define FIX_1740_MISING_POP_WMOPS /* VA: fix issue 1740: missing pop_wmops() */ +#define FIX_ISSUE_1744_IVAS_SPAR_TO_DIRAC /* FhG: NON-BE!!! Simplify azimuth & elevation calculations, remove parameter mismatch for divide3232, fix copy/paste error for elevation */ +#define FIX_ISSUE_1744_IVAS_DIRAC_GET_MONO_FLAG /* FhG: NON-BE!!! Simplify threshold - comparison, change (wrong) Equal-comparion to (correct) Greater-Than-comparison */ #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 */ diff --git a/lib_dec/ivas_spar_md_dec_fx.c b/lib_dec/ivas_spar_md_dec_fx.c index ad1fb4c3aa5ed92ae57d1ec187a6abc359266d48..fdb29e842026e4ea644c553cd636c0d094130545 100644 --- a/lib_dec/ivas_spar_md_dec_fx.c +++ b/lib_dec/ivas_spar_md_dec_fx.c @@ -44,6 +44,9 @@ /*------------------------------------------------------------------------------------------* * Local constants *------------------------------------------------------------------------------------------*/ +#ifdef FIX_ISSUE_1744_IVAS_SPAR_TO_DIRAC +#define DEG180_BY_PI_Q24 ( (Word32) 0x394BB835 ) /* 180.0/PI in Q24) */ +#endif #define IVAS_DEFAULT_DTX_CNG_RAMP ( 8 ) @@ -2959,8 +2962,13 @@ void ivas_spar_to_dirac_fx( radius_fx = Sqrt32( temp, &q_temp ); Word16 check_azi_fx = BASOP_util_atan2( dvy_fx[band], dvx_fx[band], 0 ); /*Q13*/ - Word32 check_azi_fx_32 = L_shl( check_azi_fx, 16 ); /*Q29*/ + +#ifdef FIX_ISSUE_1744_IVAS_SPAR_TO_DIRAC + Word32 azi_intermediate = Mpy_32_16_1( DEG180_BY_PI_Q24, check_azi_fx ); +#else Word16 check_azi_fx_res; + Word32 check_azi_fx_32 = L_shl( check_azi_fx, 16 ); /*Q29*/ + IF( check_azi_fx_32 < 0 ) { check_azi_fx_res = negate( divide3232( L_negate( check_azi_fx_32 ), 1686629760 /*3.145f in Q29*/ ) ); /*Q15*/ @@ -2970,7 +2978,9 @@ void ivas_spar_to_dirac_fx( check_azi_fx_res = divide3232( check_azi_fx_32, 1686629760 /*3.145f in Q29*/ ); /*Q15*/ } Word32 azi_intermediate = Mpy_32_16_1( DEGREE_180_Q_22, check_azi_fx_res ); /*Q22*/ - azi_intermediate = L_add( azi_intermediate, ONE_IN_Q21 ); /*Q22*/ +#endif + + azi_intermediate = L_add( azi_intermediate, ONE_IN_Q21 ); /*Q22*/ Word16 azi_res; IF( azi_intermediate < 0 ) @@ -2983,9 +2993,14 @@ void ivas_spar_to_dirac_fx( } Word16 check_ele_fx = BASOP_util_atan2( dvz_fx[band], radius_fx, sub( add( 9, q_dvnorm ), q_temp ) ); /*Q13*/ - Word32 check_ele_fx_32 = L_shl( check_ele_fx, 16 ); /*Q29*/ +#ifdef FIX_ISSUE_1744_IVAS_SPAR_TO_DIRAC + Word32 ele_intermediate = Mpy_32_16_1( DEG180_BY_PI_Q24, check_ele_fx ); +#else + Word16 check_ele_fx_res; - IF( check_azi_fx_32 < 0 ) + Word32 check_ele_fx_32 = L_shl( check_ele_fx, 16 ); /*Q29*/ + + IF( check_ele_fx_32 < 0 ) { check_ele_fx_res = negate( divide3232( L_negate( check_ele_fx_32 ), 1686629760 /*3.145f in Q29*/ ) ); /*Q15*/ } @@ -2994,7 +3009,8 @@ void ivas_spar_to_dirac_fx( check_ele_fx_res = divide3232( check_ele_fx_32, 1686629760 /*3.145f in Q29*/ ); /*Q15*/ } Word32 ele_intermediate = Mpy_32_16_1( DEGREE_180_Q_22, check_ele_fx_res ); /*Q22*/ - ele_intermediate = L_add( ele_intermediate, ONE_IN_Q21 ); /*Q22*/ +#endif + ele_intermediate = L_add( ele_intermediate, ONE_IN_Q21 ); /*Q22*/ Word16 ele_res; IF( ele_intermediate < 0 ) diff --git a/lib_enc/ivas_dirac_enc_fx.c b/lib_enc/ivas_dirac_enc_fx.c index 3aa010d42871b86bffae89220b944cb47965196e..ab48d0f3b849feba671f4ef99a89d61a1af4dad1 100644 --- a/lib_enc/ivas_dirac_enc_fx.c +++ b/lib_enc/ivas_dirac_enc_fx.c @@ -660,7 +660,18 @@ static Word16 ivas_dirac_get_mono_flag_fx( move32(); move16(); } - +#ifdef FIX_ISSUE_1744_IVAS_DIRAC_GET_MONO_FLAG + IF( BASOP_Util_Cmp_Mant32Exp( W_band_power, W_band_power_e, Mpy_32_32( other_ch_band_power, threshold ), other_ch_band_power_e + threshold_e ) == 1 ) + { + any_mono_band = 1; + move16(); + } + ELSE + { + any_mc_band = 1; + move16(); + } +#else IF( BASOP_Util_Cmp_Mant32Exp( divide3232( W_band_power, other_ch_band_power ), 31, threshold, threshold_e ) == 0 ) { any_mono_band = 1; @@ -671,6 +682,7 @@ static Word16 ivas_dirac_get_mono_flag_fx( any_mc_band = 1; move16(); } +#endif } } }