diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index 37619f4c1ff2a467c26414eea3a13394a1f4c11b..a65918ada9576f665e0e8058d574d999be6f8800 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -2563,7 +2563,71 @@ Word16 BASOP_Util_Cmp_Mant32Exp /*!< o: flag: result of comparison */ headroom is introduced into acc */ +#ifdef OPT_2146_BASOP_UTIL_ADD_MANT32EXP +Word32 BASOP_Util_Add_Mant32Exp /* o : normalized result mantissa */ + ( Word32 a_m, /* i : Mantissa of 1st operand a */ + Word16 a_e, /* i : Exponent of 1st operand a */ + Word32 b_m, /* i : Mantissa of 2nd operand b */ + Word16 b_e, /* i : Exponent of 2nd operand b */ + Word16 *ptr_e ) /* o : exponent of result */ +{ + Word16 shift; + /* Compare exponents: the difference is limited to +/- 31 + The Word32 mantissa of the operand with lower exponent is shifted right by the exponent difference. + Then, the unshifted mantissa of the operand with the higher exponent is added. The addition result + is normalized and the result represents the mantissa to return. The returned exponent takes into + account all shift operations. + */ + + if ( !a_m ) + { + a_e = b_e; + move16(); + } + + if ( !b_m ) + { + b_e = a_e; + move16(); + } + shift = sub( a_e, b_e ); + + if ( shift > 0 ) + shift = s_min( shift, 31 ); + if ( shift < 0 ) + shift = s_max( shift, -31 ); + + /* shift > 0 exponent of a is greater than exponent of b */ + if ( shift > 0 ) + b_m = L_shr( b_m, shift ); + /* shift < 0 exponent of b is greater than exponent of a */ + if ( shift < 0 ) + a_m = L_shl( a_m, shift ); + + a_m = L_add( L_shr( a_m, 1 ), L_shr( b_m, 1 ) ); + + if ( shift >= 0 ) + a_e = add( a_e, 1 ); + if ( shift < 0 ) + a_e = add( b_e, 1 ); + + shift = norm_l( a_m ); + if ( shift ) + a_m = L_shl( a_m, shift ); + if ( !a_m ) + { + a_e = 0; + move16(); + } + if ( a_m ) + a_e = sub( a_e, shift ); + + *ptr_e = a_e; + + return ( a_m ); +} +#else Word32 BASOP_Util_Add_Mant32Exp /* o : normalized result mantissa */ ( Word32 a_m, /* i : Mantissa of 1st operand a */ Word16 a_e, /* i : Exponent of 1st operand a */ @@ -2580,7 +2644,6 @@ Word32 BASOP_Util_Add_Mant32Exp /* o : normalized result mantissa */ is normalized and the result represents the mantissa to return. The returned exponent takes into account all shift operations. */ - if ( !a_m ) { a_e = b_e; @@ -2622,7 +2685,7 @@ Word32 BASOP_Util_Add_Mant32Exp /* o : normalized result mantissa */ return ( L_tmp ); } - +#endif static const Word16 shift_lc[] = { 9, 10 }; diff --git a/lib_com/options.h b/lib_com/options.h index 7a6d1adad0509d9dcb606402a32e2ce7cc2939a1..f133a531fbe522b7aa4d9aa2235be33a5c87e02b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -72,7 +72,6 @@ #endif /* ################### Start FIXES switches ########################### */ - #define FIX_1990_SANITIZER_IN_REVERB_LOAD /* Nokia: Fix issue part of issue 1990 by introducing missing free of structure - keep until #2059 is addressed */ #define FIX_1999_TEMPORARY_DISABLE_DIST_ATT_CHECK /* Eri: Issue 1999: Range check on float values of distance attenuation, while the float values are not propagated to this function. The test is not correct, but configurable distance attenuation is not used in Characterization.*/ #define TEMP_FIX_2088_MSAN_INIT_ERROR /* Eri: Temporary fix for Issue 2088 - MSAN error. Will come with later port of JBM+Split rendering update */ @@ -82,6 +81,7 @@ #define FIX_APA_EXECS_SCALING /* VA: fix scaling of JBM APA buffer */ #define FIX_2164_ASSERT_IN_OMASA_PREPROC_FOR_EDIT /* Nokia: Issue 2164: Prevent overflow when calculating equalization coefficient for editing before clamping to safe range */ #define FIX_BASOP_ASSERT_IN_TONAL_MDCT_PLC /* FhG: fix for issue 2165 - using saturating addition in tonal MDCT PLC function */ +#define OPT_2146_BASOP_UTIL_ADD_MANT32EXP /* Dlb: optimized version of BASOP_Util_Add_Mant32Exp() */ /* ################### End FIXES switches ########################### */ @@ -121,6 +121,7 @@ #define NONBE_FIX_1197_OMASA_META_BUFFER /* Nokia: OMASA ISM_MASA_MODE_PARAM_ONE_OBJ history zero in rateswitching - port 251 */ #define FIX_1413_IGF_INIT_PRINTOUT /* FhG: use correct variable for IGF initiliazation */ + // object-editing feature porting #define TMP_FIX_SPLIT_REND // temporary fix to split-rendering (it follows the later state of the framework but it is needed now because of current test-conditions) #define TMP_FIX_OMASA_SR_BE // temporary fix to keep OMASA split-rendering BE