Commit 0224a2a8 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

MCT optimization for encoder

parent d8645b0c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@
#define FIX_1379_MASA_ANGLE_ROUND

/* Note: each compile switch (FIX_1101_...) is independent from the other ones */
#define OPT_MCT_ENC_V1_NBE
#define OPT_SBA_REND_V1_BE
#define OPT_HEAD_ROT_REND_V1_BE
#define OPT_SBA_DEC_V2_BE
+1 −1
Original line number Diff line number Diff line
@@ -2617,7 +2617,7 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
        move16();
        move16();

        FOR( ch_idx = 0; ch_idx < ( MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS ); ch_idx++ )
        FOR( ch_idx = 0; ch_idx < MAX_CICP_CHANNELS; ch_idx++ )
        {
            p_output_fx[ch_idx] = output_fx[ch_idx];
        }
+5 −5
Original line number Diff line number Diff line
@@ -2608,7 +2608,7 @@ void stereo_dft_dec_fx(
                    q_cna_level = hFdCngDec->smoothed_psd_exp;
                    move16();
                    l_tmp = Sqrt32( cna_level, &q_cna_level );
                    scale_fact = Mpy_32_32( l_tmp, scale_fact0 ); /* q_cna_level */
                    scale_fact = Mpy_32_32( l_tmp, scale_fact0 ); /* Q = (31-q_cna_level) + Q15 - 31 */
                    /*
                       scale_fact0 will be in Q15 by the time the above operation is performed
                       so the q of scale_fact represented now by q_cna_level has to be updated
@@ -2628,12 +2628,12 @@ void stereo_dft_dec_fx(
                    l_tmp = L_add( Madd_32_16( N1, N1, g ), Mpy_32_16_1( N2, gamma ) ); /* q_cna_level */
                    l_tmp = L_shr( l_tmp, sub( q_cna_level, hStereoDft->q_dft ) );      /* q_dft */
#endif                                                                        /* OPT_STEREO_32KBPS_V1 */
                    DFT_L[2 * i] = L_add( DFT_L[2 * i], l_tmp );              /* q_dft */
                    DFT_L[2 * i] = L_add_sat( DFT_L[2 * i], l_tmp );          /* q_dft */
                    move32();
#ifdef OPT_STEREO_32KBPS_V1
                    l_tmp = Msub_32_16( Msub_32_16( N1, N1, g ), N2, gamma ); /* q_cna_level */
                    l_tmp = L_shr( l_tmp, shift );                            /* q_dft */
                    DFT_R[2 * i] = L_add( DFT_R[2 * i], l_tmp );              /* q_dft */
                    DFT_R[2 * i] = L_add_sat( DFT_R[2 * i], l_tmp );          /* q_dft */
#else                                                                         /* OPT_STEREO_32KBPS_V1 */
                    l_tmp = L_sub( Msub_32_16( N1, N1, g ), Mpy_32_16_1( N2, gamma ) ); /* q_cna_level */
                    l_tmp = L_shr( l_tmp, sub( q_cna_level, hStereoDft->q_dft ) );      /* q_dft */
@@ -2646,11 +2646,11 @@ void stereo_dft_dec_fx(
#ifdef OPT_STEREO_32KBPS_V1
                    l_tmp = Madd_32_16( Madd_32_16( N1, N1, g ), N2, gamma ); /* q_cna_level */
                    l_tmp = L_shr( l_tmp, shift );                            /* q_dft */
                    DFT_L[2 * i + 1] = L_add( DFT_L[2 * i + 1], l_tmp );      /* q_dft */
                    DFT_L[2 * i + 1] = L_add_sat( DFT_L[2 * i + 1], l_tmp );  /* q_dft */
                    move32();
                    l_tmp = Msub_32_16( Msub_32_16( N1, N1, g ), N2, gamma ); /* q_cna_level */
                    l_tmp = L_shr( l_tmp, shift );                            /* q_dft */
                    DFT_R[2 * i + 1] = L_add( DFT_R[2 * i + 1], l_tmp );      /* q_dft */
                    DFT_R[2 * i + 1] = L_add_sat( DFT_R[2 * i + 1], l_tmp );  /* q_dft */
                    move32();
#else  /* OPT_STEREO_32KBPS_V1 */
                    l_tmp = L_add( Madd_32_16( N1, N1, g ), Mpy_32_16_1( N2, gamma ) ); /* q_cna_level */
+2 −2
Original line number Diff line number Diff line
@@ -814,7 +814,7 @@ void enc_pit_exc_ivas_fx(
            /*-----------------------------------------------------------------*
             * Gain encoding
             *-----------------------------------------------------------------*/
            gain_enc_mless_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, st_fx->L_frame, i_subfr, -1, xn, y1, sub( shift_wsp, 1 ), y2, code, Es_pred,
            gain_enc_mless_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_FRAME, i_subfr, -1, xn, y1, sub( shift_wsp, 1 ), y2, code, Es_pred,
                                    &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain );
        }
        gp_clip_test_gain_pit_fx( st_fx->element_mode, st_fx->core_brate, gain_pit, st_fx->clip_var_fx );
@@ -823,7 +823,7 @@ void enc_pit_exc_ivas_fx(
        gcode16 = round_fx_sat( Lgcode );
        IF( use_fcb != 0 )
        {
            hLPDmem->tilt_code = est_tilt_ivas_fx( &exc[i_subfr], gain_pit, code, gain_code, &voice_fac, Q_new, L_subfr, 0 ); // Q15
            hLPDmem->tilt_code = est_tilt_ivas_fx( &exc[i_subfr], gain_pit, code, gain_code, &voice_fac, Q_new, L_SUBFR, 0 ); // Q15
            move16();
        }
        ELSE
+36 −2
Original line number Diff line number Diff line
@@ -2085,10 +2085,44 @@ static void compute_cov_mtx_fx(
)
{
    Word16 i, j;
#ifdef OPT_MCT_ENC_V1_NBE
    Word64 temp64_1, temp64_2;
    Word16 tmp_16, max_exp;
    Word16 temp_exp = shl( inp_exp, 1 );
    FOR( i = 0; i < N; i++ )
    {
        FOR( j = i; j < N; j++ )
        {
            temp64_1 = W_mac_32_32( W_mult_32_32( sr[i][freq], sr[j][freq] ), si[i][freq], si[j][freq] ); // exp:2*inp_exp
            temp64_2 = W_deposit32_h( COVls->xr_fx[i][j] );                                               // exp:COVls->xr_e[i][j]
            max_exp = s_max( COVls->xr_e[i][j], temp_exp );
            temp64_2 = W_shl( temp64_2, sub( COVls->xr_e[i][j], max_exp ) ); // exp:max_exp
            temp64_1 = W_shl( temp64_1, sub( temp_exp, max_exp ) );          // exp:max_exp
            temp64_1 = W_add( temp64_1, temp64_2 );                          // exp:max_exp
            tmp_16 = W_norm( temp64_1 );

            COVls->xr_fx[i][j] = W_extract_h( W_shl( temp64_1, tmp_16 ) ); // exp:max_exp-tmp_16
            COVls->xr_e[i][j] = sub( max_exp, tmp_16 );
            move32();
            move16();

            temp64_1 = W_sub( W_mult_32_32( si[i][freq], sr[j][freq] ), W_mult_32_32( sr[i][freq], si[j][freq] ) ); // exp :2*inp_exp
            temp64_2 = W_deposit32_h( COVls->xi_fx[i][j] );                                                         // exp:COVls->xi_e[i][j]
            max_exp = s_max( COVls->xi_e[i][j], temp_exp );
            temp64_2 = W_shl( temp64_2, sub( COVls->xi_e[i][j], max_exp ) ); // exp:max_exp
            temp64_1 = W_shl( temp64_1, sub( temp_exp, max_exp ) );          // exp:max_exp
            temp64_1 = W_add( temp64_1, temp64_2 );                          // exp:max_exp
            tmp_16 = W_norm( temp64_1 );

            COVls->xi_fx[i][j] = W_extract_h( W_shl( temp64_1, tmp_16 ) ); // exp:max_exp-tmp_16
            COVls->xi_e[i][j] = sub( max_exp, tmp_16 );
            move32();
        }
    }
#else
    Word32 a, b, c, d;
    Word32 temp;
    Word16 norm_a, norm_b, norm_c, norm_d;
    Word16 shift;
    FOR( i = 0; i < N; i++ )
    {
        a = sr[i][freq];
@@ -2117,7 +2151,7 @@ static void compute_cov_mtx_fx(
            move32();
        }
    }

#endif
    return;
}

Loading