Commit d9b2947a authored by mave2802's avatar mave2802
Browse files

complexity reductions

parent ffeb27b7
Loading
Loading
Loading
Loading
Loading
+31 −34
Original line number Diff line number Diff line
@@ -176,8 +176,6 @@ static void ivas_param_ism_collect_slot_fx(
    Word32 *Cldfb_ImagBuffer_in_fx, /*Q(31-exp_imag)*/
    Word16 exp_imag,
    const Word16 ch,
    Word32 ref_power_fx[], /*Q(31-exp_ref_power)*/
    Word16 exp_ref_power[],
    Word32 cx_diag_fx[][PARAM_ISM_MAX_DMX], /*Q(31-exp_cx_diag)*/
    Word16 exp_cx_diag[][PARAM_ISM_MAX_DMX] )
{
@@ -205,17 +203,13 @@ static void ivas_param_ism_collect_slot_fx(
            tmp_fx = BASOP_Util_Add_Mant32Exp( tmp_fx, exp_tmp, var1, add( exp_real, exp_real ), &exp_tmp );
            tmp_fx = BASOP_Util_Add_Mant32Exp( tmp_fx, exp_tmp, var2, add( exp_imag, exp_imag ), &exp_tmp );

            Word16 exp_cx_diag_new = 0, exp_ref_power_new = 0;
            Word16 exp_cx_diag_new;
            move16();
            move16();
            cx_diag_fx[bin_idx][ch] = BASOP_Util_Add_Mant32Exp( cx_diag_fx[bin_idx][ch], exp_cx_diag[bin_idx][ch], tmp_fx, exp_tmp, &exp_cx_diag_new );
            move32();
            ref_power_fx[bin_idx] = BASOP_Util_Add_Mant32Exp( ref_power_fx[bin_idx], exp_ref_power[bin_idx], tmp_fx, exp_tmp, &exp_ref_power_new );
            move32();
            exp_cx_diag[bin_idx][ch] = exp_cx_diag_new;
            move16();
            exp_ref_power[bin_idx] = exp_ref_power_new;
            move16();
        }
    }
    return;
@@ -230,8 +224,6 @@ static void ivas_param_ism_compute_mixing_matrix_fx(
    const Word16 nchan_out_woLFE,
    Word32 cx_diag_fx[][PARAM_ISM_MAX_DMX], /*Q(31-cx_diag_e)*/
    Word16 cx_diag_e[][PARAM_ISM_MAX_DMX],
    Word32 ref_power_fx[], /*Q(31-ref_power_e)*/
    Word16 ref_power_e[],
    Word32 mixing_matrix_fx[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_CHAN * PARAM_ISM_MAX_DMX], /*Q(31-mixing_matrix_e)*/
    Word16 mixing_matrix_e[CLDFB_NO_CHANNELS_MAX] )
{
@@ -304,6 +296,27 @@ static void ivas_param_ism_compute_mixing_matrix_fx(

            set32_fx( cy_diag_fx, 0, nchan_out_woLFE );
            set16_fx( cy_diag_e_arr, 0, nchan_out_woLFE );

            /* equal cx diag exponents, compute ref power from cx_diag*/
            Word16 max_exp_cx_diag;
            Word32 cx_diag_eq_exp_fx[PARAM_ISM_MAX_DMX];
            Word32 ref_power_fx;
            Word16 ref_power_e, ref_power_e_new;
            ref_power_fx = cx_diag_fx[bin_idx][0];
            ref_power_e = cx_diag_e[bin_idx][0];

            FOR( i = 1; i < PARAM_ISM_MAX_DMX; i++ )
            {
                ref_power_fx = BASOP_Util_Add_Mant32Exp( ref_power_fx, ref_power_e, cx_diag_fx[bin_idx][i], cx_diag_e[bin_idx][i], &ref_power_e_new );
                ref_power_e = ref_power_e_new;
            }
            max_exp_cx_diag = ref_power_e;
            FOR( i = 0; i < PARAM_ISM_MAX_DMX; i++ )
            {
                cx_diag_eq_exp_fx[i] = L_shr_r( cx_diag_fx[bin_idx][i], sub( max_exp_cx_diag, cx_diag_e[bin_idx][i] ) ); // Q(31-max_exp_cx_diag)
            }


            FOR( w = 0; w < num_wave; w++ )
            {
                test();
@@ -313,25 +326,26 @@ static void ivas_param_ism_compute_mixing_matrix_fx(
                    SWITCH( nchan_ism )
                    {
                        case 2:
                            direct_power_fx[w] = L_shr_r( ref_power_fx[bin_idx], 1 );
                            direct_power_fx[w] = L_shr_r( ref_power_fx, 1 );
                            move32();
                            BREAK;
                        case 3:
                            direct_power_fx[w] = Mpy_32_16_1( ref_power_fx[bin_idx], 10923 ); // 10923 = 1/3f in Q15
                            direct_power_fx[w] = Mpy_32_16_1( ref_power_fx, 10923 ); // 10923 = 1/3f in Q15
                            move32();
                            BREAK;
                        case 4:
                            direct_power_fx[w] = L_shr_r( ref_power_fx[bin_idx], 2 );
                            direct_power_fx[w] = L_shr_r( ref_power_fx, 2 );
                            move32();
                            BREAK;
                    }
                }
                ELSE
                {
                    direct_power_fx[w] = Mpy_32_16_1( ref_power_fx[bin_idx], hParamIsmDec->power_ratios_fx[band_idx][0][w] ); // Q(31-ref_power_e[bin_idx])
                    direct_power_fx[w] = Mpy_32_16_1( ref_power_fx, hParamIsmDec->power_ratios_fx[band_idx][0][w] ); // Q(31-ref_power_e[bin_idx])
                    move32();
                }
                direct_power_e = ref_power_e[bin_idx];
                //direct_power_e = ref_power_e[bin_idx];
                direct_power_e = ref_power_e;
                move16();
                IF( direct_power_fx[w] != 0 )
                {
@@ -370,18 +384,6 @@ static void ivas_param_ism_compute_mixing_matrix_fx(
                move32();
            }

            /* equal cx diag exponents */
            Word16 max_exp_cx_diag = cx_diag_e[bin_idx][0];
            Word32 cx_diag_eq_exp_fx[PARAM_ISM_MAX_DMX];
            FOR( i = 1; i < PARAM_ISM_MAX_DMX; i++ )
            {
                max_exp_cx_diag = s_max( max_exp_cx_diag, cx_diag_e[bin_idx][i] );
            }
            FOR( i = 0; i < PARAM_ISM_MAX_DMX; i++ )
            {
                cx_diag_eq_exp_fx[i] = L_shr_r( cx_diag_fx[bin_idx][i], sub( max_exp_cx_diag, cx_diag_e[bin_idx][i] ) ); // Q(31-max_exp_cx_diag)
            }

            /* Compute mixing matrix */
            computeMixingMatricesISM_fx( nchan_transport, num_wave, nchan_out_woLFE, response_matrix_fx, response_matrix_e, direct_power_fx, direct_power_e, cx_diag_eq_exp_fx, max_exp_cx_diag, cy_diag_fx, cy_diag_e, proto_matrix_fx, 1,
                                         PARAM_MC_REG_SX_FX, PARAM_MC_REG_GHAT_FX, mixing_matrix_fx[bin_idx], &mixing_matrix_e[bin_idx] );
@@ -1048,9 +1050,7 @@ void ivas_param_ism_dec_digest_tc_fx(
    move16();
    move16();
    move16();
    Word32 ref_power_fx[CLDFB_NO_CHANNELS_MAX];
    Word32  cx_diag_fx[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_DMX];
    Word16  exp_ref_power[CLDFB_NO_CHANNELS_MAX];
    Word16  exp_cx_diag[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_DMX];

    Word16 q_tc = q_tc_in;
@@ -1110,9 +1110,6 @@ void ivas_param_ism_dec_digest_tc_fx(
    set_zero_fx(&cx_diag_fx[0][0], CLDFB_NO_CHANNELS_MAX * PARAM_ISM_MAX_DMX);
    set16_zero_fx(&exp_cx_diag[0][0], CLDFB_NO_CHANNELS_MAX * PARAM_ISM_MAX_DMX);

    set_zero_fx( ref_power_fx, CLDFB_NO_CHANNELS_MAX );
    set16_zero_fx(&exp_ref_power[0], CLDFB_NO_CHANNELS_MAX);

    /* Frame-level Processing */
    /* De-quantization */
    test();
@@ -1240,7 +1237,7 @@ void ivas_param_ism_dec_digest_tc_fx(
                                            &hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc_fx[current_idx],
                                            exp_imag_tmp,
                                            ch,
                                            ref_power_fx, exp_ref_power, cx_diag_fx, exp_cx_diag );
                                            cx_diag_fx, exp_cx_diag );

            exp_real_tmp = add( exp_real_tmp, scale_factor_real );
            exp_imag_tmp = add( exp_imag_tmp, scale_factor_imag );
@@ -1255,7 +1252,7 @@ void ivas_param_ism_dec_digest_tc_fx(
    }

    /* Compute mixing matrix */
    ivas_param_ism_compute_mixing_matrix_fx( st_ivas->nchan_ism, hParamIsmDec, st_ivas->hISMDTX, direct_response_fx, nchan_transport, nchan_out_woLFE, cx_diag_fx, exp_cx_diag, ref_power_fx, exp_ref_power,
    ivas_param_ism_compute_mixing_matrix_fx( st_ivas->nchan_ism, hParamIsmDec, st_ivas->hISMDTX, direct_response_fx, nchan_transport, nchan_out_woLFE, cx_diag_fx, exp_cx_diag,
                                             hParamIsmDec->hParamIsmRendering->mixing_matrix_lin_fx, hParamIsmDec->hParamIsmRendering->exp_mixing_matrix_lin_fx );

    pop_wmops();