Commit 54848246 authored by Nicolas Roussin's avatar Nicolas Roussin
Browse files

Merge branch '2182-move-scaling-operations-outside-matrix-mul-operations' into...

Merge branch '2182-move-scaling-operations-outside-matrix-mul-operations' into 2185-optimize-matrix-mul-output-format-fix
parents 8af6898e 6fadb2b4
Loading
Loading
Loading
Loading
Loading
+16 −11
Original line number Diff line number Diff line
@@ -2300,7 +2300,8 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx(
#ifdef OPT_2182_MATRIX_SCALE_OPS
        matrixScale_fx( tmpMtxRe_fx, tmpMtxIm_fx, &q_tmp );
        matrixTransp2Mul_fx(
            tmpMtxRe_fx, tmpMtxIm_fx, &q_tmp, Mre_fx, Mim_fx, &q_M,
            tmpMtxRe_fx, tmpMtxIm_fx, &q_tmp,
            Mre_fx, Mim_fx, &q_M,
            resultMtxRe_fx, resultMtxIm_fx, &q_res );
#else
        matrixTransp2Mul_fx(
@@ -3980,7 +3981,7 @@ static void matrixScale_fx(
    Word16 *q_A )
{
    Word16 shift;
    Word16 size = i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS );
    Word16 size = BINAURAL_CHANNELS * BINAURAL_CHANNELS;
    shift = sub( s_min( L_norm_arr( Are_fx[0], size ), L_norm_arr( Aim_fx[0], size ) ), 1 );
    scale_sig32( Are_fx[0], size, shift );
    scale_sig32( Aim_fx[0], size, shift );
@@ -4066,7 +4067,7 @@ static void matrixMul_fx(
    }
#else
#ifdef OPT_2182_MATRIX_SCALE_OPS
    Word16 size = i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS );
    Word16 size = BINAURAL_CHANNELS * BINAURAL_CHANNELS;
#endif
    if ( L_and( is_zero_arr( outRe_fx[0], size ), is_zero_arr( outIm_fx[0], size ) ) )
    {
@@ -4115,16 +4116,16 @@ static void matrixTransp1Mul_fx(
            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] );
            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( tmp64 ) );
            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] = tmp64 = W_mac_32_32( tmp64, Are_fx[1][chA], Bim_fx[1][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( tmp64 ) );
            common_lsh = s_min( common_lsh, W_norm( tmp_outIm_fx[chA][chB] ) );
#else
            tmp64_1 = W_mac_32_32( W_mult_32_32( Are_fx[0][chA], Bre_fx[0][chB] ), Are_fx[1][chA], Bre_fx[1][chB] ); // Q: add( add( q_A, q_B ), 1 )
            tmp64_2 = W_mac_32_32( W_mult_32_32( Aim_fx[0][chA], Bim_fx[0][chB] ), Aim_fx[1][chA], Bim_fx[1][chB] ); // Q: add( add( q_A, q_B ), 1 )
@@ -4936,7 +4937,9 @@ static void formulate2x2MixingMatrix_fx(
    }

#ifdef OPT_2182_MATRIX_SCALE_OPS
    matrixTransp2Mul_fx( tmpRe_fx, tmpIm_fx, &q_temp, Ure_fx, Uim_fx, &q_U,
    matrixTransp2Mul_fx( 
        tmpRe_fx, tmpIm_fx, &q_temp, 
        Ure_fx, Uim_fx, &q_U,
        Pre_fx, Pim_fx, &q_P ); /* Nearest orthonormal matrix P to matrix A formulated */
#else
    matrixTransp2Mul_fx( tmpRe_fx, tmpIm_fx, &q_temp, Ure_fx, Uim_fx, &q_U,
@@ -5081,7 +5084,9 @@ static void formulate2x2MixingMatrix_fx(
    matrixMul_fx( KyRe_fx, KyIm_fx, &q_ky, Pre_fx, Pim_fx, &q_P, tmpRe_fx, tmpIm_fx, &q_temp );
#ifdef OPT_2182_MATRIX_SCALE_OPS
    matrixScale_fx( tmpRe_fx, tmpIm_fx, &q_temp );
    matrixTransp2Mul_fx( tmpRe_fx, tmpIm_fx, &q_temp, Uxre_fx, Uxim_fx, &q_Ux,
    matrixTransp2Mul_fx( 
        tmpRe_fx, tmpIm_fx, &q_temp, 
        Uxre_fx, Uxim_fx, &q_Ux,
        Mre_fx, Mim_fx, q_M );
#else
    matrixTransp2Mul_fx( tmpRe_fx, tmpIm_fx, &q_temp, Uxre_fx, Uxim_fx, &q_Ux,