Commit 78be9d07 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

LTV test for optimizations

parent 856c5694
Loading
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -70,9 +70,14 @@ Word32 Interpol_lc_fx( /* o : interpolated value
            c2 += up_samp; /* move16() not needed, since the coefficient can be rearrange in bit exact way */
            c1 += up_samp;
        }
#ifdef OPT_SBA_ENC_V2_BE
        L_sum = W_shl_sat_l( L_sum64, 1 ); /*Q15*/
    }
#else
        L_sum = W_sat_l( L_sum64 ); /*Q14*/
    }
    L_sum = L_shl_sat( L_sum, 1 ); /*Q15*/
#endif
    return L_sum;
}

+19 −20
Original line number Diff line number Diff line
@@ -783,7 +783,6 @@ void computeDirectionVectors_fx(
 *
 *
 *------------------------------------------------------------------------*/

void computeDiffuseness_fixed(
    Word32 *buffer_intensity[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF], // i: Q(q_factor_intensity)
    const Word32 *buffer_energy,                                     // i: Q(q_factor_energy)
@@ -796,10 +795,10 @@ void computeDiffuseness_fixed(
{
    Word32 intensity_slow[DIRAC_NUM_DIMS * CLDFB_NO_CHANNELS_MAX];
    Word32 intensity_slow_abs[CLDFB_NO_CHANNELS_MAX];
    Word64 tmp_intensity_slow_abs[CLDFB_NO_CHANNELS_MAX];
    Word16 intensity_slow_abs_exp[CLDFB_NO_CHANNELS_MAX];
    Word64 intensity_slow_abs_64[CLDFB_NO_CHANNELS_MAX];
    Word16 intensity_slow_abs_q[CLDFB_NO_CHANNELS_MAX];
    Word32 energy_slow[CLDFB_NO_CHANNELS_MAX];
    Word16 i, j, k, tmp16;
    Word16 i, j, k;
    Word32 tmp = 0;
    move32();
    Word32 *p_tmp;
@@ -809,10 +808,8 @@ void computeDiffuseness_fixed(

    /* Compute Intensity slow and energy slow buffer_intensity and buffer_energy */

    set_zero_fx( intensity_slow, DIRAC_NUM_DIMS * CLDFB_NO_CHANNELS_MAX );
    set_zero_fx( intensity_slow, i_mult( DIRAC_NUM_DIMS, CLDFB_NO_CHANNELS_MAX ) );
    set_zero_fx( intensity_slow_abs, CLDFB_NO_CHANNELS_MAX );
    set16_fx( intensity_slow_abs_exp, 0, CLDFB_NO_CHANNELS_MAX );
    set64_fx( tmp_intensity_slow_abs, 0, CLDFB_NO_CHANNELS_MAX );
    set_zero_fx( energy_slow, CLDFB_NO_CHANNELS_MAX );

    /* Calculate max possible shift for the buffer buffer_energy and buffer_intensity */
@@ -896,27 +893,31 @@ void computeDiffuseness_fixed(
        q_intensity = s_min( q_intensity, q_tmp );
    }

    scale_sig32( intensity_slow, i_mult( DIRAC_NUM_DIMS, num_freq_bands ), -2 );
    q_intensity = sub( q_intensity, 2 );
    min_q_shift1 = getScaleFactor32( intensity_slow, i_mult( DIRAC_NUM_DIMS, num_freq_bands ) );
    min_q_shift1 = sub( min_q_shift1, idiv1616( add( find_guarded_bits_fx( DIRAC_NUM_DIMS ), 1 ), 2 ) );
    scale_sig32( intensity_slow, i_mult( DIRAC_NUM_DIMS, num_freq_bands ), min_q_shift1 );
    q_intensity = add( q_intensity, min_q_shift1 );
    FOR( k = 0; k < num_freq_bands; k++ )
    {
        intensity_slow_abs_64[k] = 0;
        move64();
    }
     
    /* intensity_slow.^2 + intensity_slow_abs*/
    FOR( j = 0; j < DIRAC_NUM_DIMS; ++j )
    {
        p_tmp = intensity_slow + j * num_freq_bands;

        FOR( k = 0; k < num_freq_bands; k++ )
        {
            tmp_intensity_slow_abs[k] = W_mac_32_32( tmp_intensity_slow_abs[k], p_tmp[k], p_tmp[k] );
            move64();
            intensity_slow_abs_64[k] = W_add( intensity_slow_abs_64[k], W_mult_32_32( p_tmp[k], p_tmp[k] ) ); // 2*q_intensity+1
        }
    }

    FOR( k = 0; k < num_freq_bands; k++ )
    {
        tmp16 = W_norm( tmp_intensity_slow_abs[k] );
        intensity_slow_abs[k] = W_extract_h( W_shl( tmp_intensity_slow_abs[k], tmp16 ) );
        Word16 shift = W_norm( intensity_slow_abs_64[k] );
        intensity_slow_abs[k] = W_extract_h( W_shl( intensity_slow_abs_64[k], shift ) );
        move32();
        intensity_slow_abs_exp[k] = sub( 31, sub( add( add( shl( q_intensity, 1 ), 1 ), tmp16 ), 32 ) );
        intensity_slow_abs_q[k] = sub( add( add( q_intensity, q_intensity ), shift ), 31 );
        move16();
    }

@@ -926,8 +927,7 @@ void computeDiffuseness_fixed(
    move16();
    FOR( i = 0; i < num_freq_bands; ++i )
    {
        exp1 = intensity_slow_abs_exp[i];
        move16();
        exp1 = sub( 31, intensity_slow_abs_q[i] );
        tmp = Sqrt32( p_tmp[i], &exp1 );

        tmp = BASOP_Util_Divide3232_Scale_newton( tmp, L_add( energy_slow[i], EPSILLON_FX ), &exp2 );
@@ -966,7 +966,6 @@ void computeDiffuseness_fixed(
    return;
}


Word32 deindex_azimuth_fx(                             /* o  : output Q22                              */
                           Word16 id_phi,              /* i  : index                                   */
                           const Word16 no_bits,       /* i  : number of bits for the spherical grid   */
+3 −0
Original line number Diff line number Diff line
@@ -75,6 +75,9 @@
#define FIX_1379_MASA_ANGLE_ROUND

/* Note: each compile switch (FIX_1101_...) is independent from the other ones */
#define OPT_SBA_DEC_V2_BE
#define OPT_HEAD_ROT_REND_V1_BE
#define OPT_SBA_ENC_V2_BE
#define OPT_SBA_ENC_V1_BE
#define OPT_BIN_RENDERER_V1
#define OPT_BIN_RENDERER_V2
+22 −1
Original line number Diff line number Diff line
@@ -2634,9 +2634,16 @@ void IMDCT_ivas_fx(
        Word32 fac;
        // fac = shl_sat( mult_r( extract_h( L_shr_sat( hTcxDec->conceal_eof_gain32, sub( 1, hTcxDec->conceal_eof_gain_e ) ) ), st->last_concealed_gain_syn_deemph ), 1 );
        fac = Mpy_32_16_1( hTcxDec->conceal_eof_gain32, st->last_concealed_gain_syn_deemph ); // q = 31 - hTcxDec->conceal_eof_gain_e - last_concealed_gain_syn_deemph_e
#ifdef OPT_SBA_DEC_V2_BE
        Word16 eff_e = add( hTcxDec->conceal_eof_gain_e, st->last_concealed_gain_syn_deemph_e );
#endif /* OPT_SBA_DEC_V2_BE */
        FOR( Word16 ind = 0; ind < overlap; ind++ )
        {
#ifdef OPT_SBA_DEC_V2_BE
            old_syn_overl_fx[ind] = extract_h( L_shl_sat( Mpy_32_16_1( fac, old_syn_overl_fx[ind] ), eff_e ) ); // Q(-2)
#else                                                                                                           /* OPT_SBA_DEC_V2_BE */
            old_syn_overl_fx[ind] = extract_h( L_shl_sat( Mpy_32_16_1( fac, old_syn_overl_fx[ind] ), add( hTcxDec->conceal_eof_gain_e, st->last_concealed_gain_syn_deemph_e ) ) ); // Q(-2)
#endif                                                                                                          /* OPT_SBA_DEC_V2_BE */
            move16();
        }
    }
@@ -2879,7 +2886,7 @@ void IMDCT_ivas_fx(
            {
                Word16 q_old_out = q_win;
                move16();
                edct_fx( x_fx, xn_buf_fx_32 + add( shr( overlap, 1 ), nz ), L_frame, &q_xn_buf_fx_32 );
                edct_ivas_fx( x_fx, xn_buf_fx_32 + add( shr( overlap, 1 ), nz ), L_frame, &q_xn_buf_fx_32 );
                Word16 res_m, res_e;
                res_e = 0;
                move16();
@@ -4713,9 +4720,16 @@ void decoder_tcx_noiseshaping_igf_fx(
        {
            /* If the exponent on the spec side (i>L_frame) is lesser, then shift all the values in the
            spec side by the difference to make both sides have the same exponent. */
#ifdef OPT_SBA_DEC_V2_BE
            Word16 diff_e = sub( frame_side_x_e, spec_side_x_e );
#endif /* OPT_SBA_DEC_V2_BE */
            FOR( i = L_frame; i < L_spec; i++ )
            {
#ifdef OPT_SBA_DEC_V2_BE
                x_fx[i] = L_shr( x_fx[i], diff_e );
#else  /* OPT_SBA_DEC_V2_BE */
                x_fx[i] = L_shr( x_fx[i], sub( frame_side_x_e, spec_side_x_e ) );
#endif /* OPT_SBA_DEC_V2_BE */
                move32();
            }
        }
@@ -4723,9 +4737,16 @@ void decoder_tcx_noiseshaping_igf_fx(
        {
            /* If the exponent on the spec side (i>L_frame) is greater, then shift all the values in the
            frame side (i<L_frame) by the difference to make both sides have the same exponent. */
#ifdef OPT_SBA_DEC_V2_BE
            Word16 diff_e = sub( spec_side_x_e, frame_side_x_e );
#endif /* OPT_SBA_DEC_V2_BE */
            FOR( i = 0; i < L_frame; i++ )
            {
#ifdef OPT_SBA_DEC_V2_BE
                x_fx[i] = L_shr( x_fx[i], diff_e );
#else  /* OPT_SBA_DEC_V2_BE */
                x_fx[i] = L_shr( x_fx[i], sub( spec_side_x_e, frame_side_x_e ) );
#endif /* OPT_SBA_DEC_V2_BE */
                move32();
            }
        }
+15 −0
Original line number Diff line number Diff line
@@ -1622,6 +1622,7 @@ void ivas_binRenderer_fx(

    /* Compute Convolution */
    /* memory reset for the binaural output */
#ifndef OPT_SBA_DEC_V2_BE
    FOR( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ )
    {
        FOR( k = 0; k < numTimeSlots; k++ )
@@ -1634,6 +1635,7 @@ void ivas_binRenderer_fx(
#endif /* OPT_BIN_RENDERER_V2 */
        }
    }
#endif /* OPT_SBA_DEC_V2_BE */

    /* Head rotation in HOA3 or CICPx */
    test();
@@ -1736,6 +1738,19 @@ void ivas_binRenderer_fx(
            }
        }
    }

#ifdef OPT_SBA_DEC_V2_BE
    Word16 len = sub( CLDFB_NO_CHANNELS_MAX, hBinRenderer->conv_band );

    FOR( k = 0; k < numTimeSlots; k++ )
    {
        set32_fx( &Cldfb_RealBuffer_Binaural_fx[0][k][hBinRenderer->conv_band], 0, len );
        set32_fx( &Cldfb_RealBuffer_Binaural_fx[1][k][hBinRenderer->conv_band], 0, len );
        set32_fx( &Cldfb_ImagBuffer_Binaural_fx[0][k][hBinRenderer->conv_band], 0, len );
        set32_fx( &Cldfb_ImagBuffer_Binaural_fx[1][k][hBinRenderer->conv_band], 0, len );
    }
#endif /* OPT_SBA_DEC_V2_BE */

    pop_wmops();
    return;
}
Loading