diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index 3396815be3462df1fc71644307c05a214342a2db..10943789435243fffaae92321e6c5f9094515456 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -385,7 +385,17 @@ void ivas_get_dirac_sba_max_md_bits( *metadata_max_bits = MAX16B; /* no limit */ } +#ifdef FIX_FLOAT_1544_SBA_META_IMPRECISION_UNSAFE_MATH + /* + original formula was: + *metadata_max_bits = (int16_t) min( (float) MAX16B, ceilf( (float) *metadata_max_bits * nbands / 5 ) ); + The division by 5 is replaced by a multiplication by 0.2f, since the division is causing problems for + certain optimizations using -funsafe-math-optimizations + */ + *metadata_max_bits = (int16_t) min( (float) MAX16B, ceilf( *metadata_max_bits * nbands * 0.2f ) ); +#else *metadata_max_bits = (int16_t) min( (float) MAX16B, ceilf( (float) *metadata_max_bits * nbands / 5 ) ); +#endif *qmetadata_max_bit_req = QMETADATA_MAXBIT_REQ_SBA >> 1; return; diff --git a/lib_com/options.h b/lib_com/options.h index fb59113de2ca47af68634904f029d35b0a4e2921..ace054c19f259c6f6e38f9dbd79aa926c0002c2e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -163,6 +163,7 @@ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ #define FIX_BASOP_2469_OBJ_EDIT_TD_REND_GAIN /* Eri: Basop issue 2469: TD renderer gain has wrong Q. In float this is just a synch of the cleanup done in BASOP */ #define FIX_ISSUE_1546_DEAD_CODE /* FhG: remove dead code reported in the issue*/ +#define FIX_FLOAT_1544_SBA_META_IMPRECISION_UNSAFE_MATH /* FhG: float issue 1544: imprecision in ivas_get_dirac_sba_max_md_bits() with -funsafe-math-optimizations */ /* #################### End BE switches ################################## */