Commit 297ef631 authored by Nicolas Roussin's avatar Nicolas Roussin
Browse files

Optimize matrixTransp1Mul_fx.

parent 267ec305
Loading
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -138,4 +138,10 @@

/* #################### End BASOP porting switches ############################ */

/* #################### Start BASOP optimization switches ############################ */

#define OPT_2181_MATRIX_TRANSP_1_MUL                    /* Dolby: Issue 2181, optimize matrixTransp1Mul_fx. */

/* #################### End BASOP optimization switches ############################ */

#endif
+39 −0
Original line number Diff line number Diff line
@@ -3997,6 +3997,44 @@ static void matrixTransp1Mul_fx(

    Word64 tmp_outRe_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
    Word64 tmp_outIm_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
#ifdef OPT_2181_MATRIX_TRANSP_1_MUL
    Word64 tmp64;
    Word16 common_lsh;
    common_lsh = 63;
    move16();

    FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ )
    {
        FOR( chB = 0; chB < BINAURAL_CHANNELS; chB++ )
        {
            tmp64 = W_mult_32_32( Are_fx[0][chA], Bre_fx[0][chB] );
            tmp64 = W_mac_32_32( tmp64, Are_fx[1][chA], Bre_fx[1][chB] );
            tmp64 = W_mac_32_32( tmp64, Aim_fx[0][chA], Bim_fx[0][chB] );
            tmp_outRe_fx[chA][chB] = tmp64 = W_mac_32_32( tmp64, Aim_fx[1][chA], Bim_fx[1][chB] );
            move64();
            common_lsh = s_min( common_lsh, W_norm( tmp64 ) );

            tmp64 = W_mult_32_32( Aim_fx[0][chA], Bre_fx[0][chB] );
            tmp64 = W_mac_32_32( tmp64, Aim_fx[1][chA], Bre_fx[1][chB] );
            tmp64 = W_mac_32_32( W_negate( tmp64 ), Are_fx[0][chA], Bim_fx[0][chB] );
            tmp_outIm_fx[chA][chB] = tmp64 = W_mac_32_32( tmp64, Are_fx[1][chA], Bim_fx[1][chB] );
            move64();
            common_lsh = s_min( common_lsh, W_norm( tmp64 ) );
        }
    }
    FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ )
    {
        FOR( chB = 0; chB < BINAURAL_CHANNELS; chB++ )
        {
            outRe_fx[chA][chB] = W_extract_h( W_shl( tmp_outRe_fx[chA][chB], common_lsh ) );
            move32();
            outIm_fx[chA][chB] = W_extract_h( W_shl( tmp_outIm_fx[chA][chB], common_lsh ) );
            move32();
        }
    }
    *q_out = add( add( add( q_A, q_B ), 1 ), common_lsh );
    move16();
#else
    Word16 q_tmp_outRe_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
    Word16 q_tmp_outIm_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
    Word64 tmp64_1, tmp64_2;
@@ -4043,6 +4081,7 @@ static void matrixTransp1Mul_fx(
    }
    *q_out = sub( q_common, 32 );
    move16();
#endif
    if ( L_and( is_zero_arr( outRe_fx[0], size ), is_zero_arr( outIm_fx[0], size ) ) )
    {
        *q_out = Q31;