diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index 1dc21c5f1129c6dd2ced14614acff4d7e3e2e543..43dcf5417555cfa261ffe549e1bcb42f993228fb 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -2512,6 +2512,7 @@ Word16 BASOP_Util_Cmp_Mant32Exp /*!< o: flag: result of comparison */ headroom is introduced into acc */ +#ifndef ISSUE_2247_Accelerate_AddMant32Exp 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 */ @@ -2575,6 +2576,7 @@ Word32 BASOP_Util_Add_Mant32Exp /* o : normalized result mantissa */ return ( a_m ); } +#endif static const Word16 shift_lc[] = { 9, 10 }; diff --git a/lib_com/basop_util.h b/lib_com/basop_util.h index cbd7838655e95b97380107cd4144c756ad1f2b3e..035dc927ea75af59981db3050240c2555926780e 100644 --- a/lib_com/basop_util.h +++ b/lib_com/basop_util.h @@ -59,6 +59,56 @@ #define CHEAP_NORM_SIZE 161 #endif +#ifdef ISSUE_2247_Accelerate_AddMant32Exp +static __inline Word32 BASOP_Util_Add_Mant32Exp( + Word32 Mant1, + Word16 exp1, + Word32 Mant2, + Word16 exp2, + Word16 *exp_res ) +{ + + Word32 tmp1, tmp2, tmp_res; + Word16 scale_tmp, scale_tmp2, scale_tmp3; + + + if ( Mant1 == 0 ) + { + exp1 = exp2; + move16(); + } + + if ( Mant2 == 0 ) + { + exp2 = exp1; + move16(); + } + + scale_tmp = add( s_max( exp2, exp1 ), 1 ); + tmp1 = L_shl( Mant1, sub( exp1, scale_tmp ) ); + + tmp2 = L_shl( Mant2, sub( exp2, scale_tmp ) ); + tmp_res = L_add( tmp1, tmp2 ); + + scale_tmp2 = norm_l( tmp_res ); + tmp_res = L_shl( tmp_res, scale_tmp2 ); + + scale_tmp3 = 0; + move16(); + + if ( tmp_res != 0 ) + { + scale_tmp3 = sub( scale_tmp, scale_tmp2 ); + } + + *exp_res = scale_tmp3; + move16(); + + return tmp_res; +} + +#endif + static __inline Word16 limitScale16( Word16 s ) { /* It is assumed, that s is calculated just before, therefore we can switch upon sign */ diff --git a/lib_com/options.h b/lib_com/options.h index 1a7b596d5309b846680d83f511711c50f1bc7674..6a611a703b844cf9da41efe7913680979781acee 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -85,6 +85,7 @@ #define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */ #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_1435_MOVE_STEREO_PANNING /* VA: issue 1435: do the EVS stereo panning in the renderer */ +#define ISSUE_2247_Accelerate_AddMant32Exp /* FhG: inline and acelerate Heavily used BASOP_Util_AddMant32Exp */ /* #################### End BE switches ################################## */