Commit 437601cb authored by Nicolas Roussin's avatar Nicolas Roussin
Browse files

Merge branch '2181-optimize-matrixtransp1mul_fx' into 'main'

Optimize matrixTransp1Mul_fx.

Closes #2181

See merge request !2499
parents 76117723 417d9326
Loading
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -104,4 +104,10 @@

/* clang-format on */

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

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

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

#endif
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@

*******************************************************************************************************/

#include "move.h"
#include <stdint.h>
#include "options.h"
#include "ivas_cnst.h"
@@ -40,6 +39,7 @@
#include "ivas_stat_enc.h"
#include <math.h>
#include "wmc_auto.h"
#include "move.h"
#include "ivas_prot_fx.h"


+40 −0
Original line number Diff line number Diff line
@@ -3965,6 +3965,45 @@ 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, q;
    q = add( add( q_A, q_B ), 1 );
    common_lsh = sub( 63, q );
    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] = W_mac_32_32( tmp64, Aim_fx[1][chA], Bim_fx[1][chB] );
            move64();
            common_lsh = s_min( common_lsh, W_norm( tmp_outRe_fx[chA][chB] ) );

            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_neg( tmp64 ), Are_fx[0][chA], Bim_fx[0][chB] );
            tmp_outIm_fx[chA][chB] = W_mac_32_32( tmp64, Are_fx[1][chA], Bim_fx[1][chB] );
            move64();
            common_lsh = s_min( common_lsh, W_norm( tmp_outIm_fx[chA][chB] ) );
        }
    }
    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 = sub( add( q, common_lsh ), 32 );
    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;
@@ -4011,6 +4050,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;