Commit 198ffcfe authored by mave2802's avatar mave2802
Browse files

initial version of optimized BASOP_Util_Add_Mant32Exp()

parent 417b23a6
Loading
Loading
Loading
Loading
+64 −1
Original line number Diff line number Diff line
@@ -2563,7 +2563,70 @@ 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;
    Word32 c_m;
    Word16 c_e = 0;

    /* Compare exponents: the difference is limited to +/- 30
   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 )
    {
        /* exponent of a is greater or equal than exponent of b */
        c_e = add( a_e, 1 );
        shift = add( shift, 1 );
        a_m = L_shr( a_m, 1 );
        b_m = L_shr( b_m, s_min( shift,31 ));
    }
    if ( shift < 0 )
    {
        /* exponent of b is greater or equal than exponent of a */
        c_e = add( b_e, 1 );
        shift = sub( shift, 1 );
        a_m = L_shl( a_m, s_max( shift, -31));
        b_m = L_shr( b_m, 1 );
    }
    c_m = L_add( a_m, b_m );

    if ( c_m == 0 )
    {
        c_e = 0;
        move16();
    }
    if ( c_m != 0 )
    {
        shift = norm_l( c_m );
        c_m = L_shl( c_m, shift );
        c_e = sub( c_e, shift );
    }

    *ptr_e = c_e;
    return( c_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  */
@@ -2622,7 +2685,7 @@ Word32 BASOP_Util_Add_Mant32Exp /* o : normalized result mantissa */

    return ( L_tmp );
}

#endif

static const Word16 shift_lc[] = { 9, 10 };

+2 −0
Original line number Diff line number Diff line
@@ -82,6 +82,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 +122,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