Commit 8414e4de authored by Nicolas Roussin's avatar Nicolas Roussin Committed by Manuel Jander
Browse files

Optimize ivas_filter_process_fx part 2.

parent 69f1873b
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -668,6 +668,7 @@ typedef struct ivas_filters_process_state_t

#ifdef OPT_2239_IVAS_FILTER_PROCESS
    Word16 q_diff; // q_diff = q_out - q_in -> q_out = q_diff + q_in
    Word32 state64_fx[IVAS_FILTER_MAX_STAGES][IVAS_BIQUAD_FILT_LEN];
#endif

} ivas_filters_process_state_t;
@@ -682,6 +683,9 @@ typedef struct ivas_trans_det_state_t
    ivas_filters_process_state_t env_hpf;
    ivas_filters_process_state_t env_fast;
    ivas_filters_process_state_t env_slow;
    ivas_filters_process_state_t test_env_hpf;
    ivas_filters_process_state_t test_env_fast;
    ivas_filters_process_state_t test_env_slow;
    Word32 in_duck_coeff;
    Word32 out_duck_coeff;
    Word32 in_duck_gain;
+39 −0
Original line number Diff line number Diff line
@@ -229,6 +229,9 @@ static void ivas_transient_det_init(
    ivas_filters_init_fx( &hTranDet->env_hpf, (const Word32 *) filt_coeff_arr_fx[0], filt_coeff_arr_e, IVAS_FILTER_ORDER_1 );
    ivas_filters_init_fx( &hTranDet->env_fast, (const Word32 *) filt_coeff_arr_fx[1], filt_coeff_arr_e, IVAS_FILTER_ORDER_1 );
    ivas_filters_init_fx( &hTranDet->env_slow, (const Word32 *) filt_coeff_arr_fx[2], filt_coeff_arr_e, IVAS_FILTER_ORDER_1 );
    ivas_filters_init_fx( &hTranDet->test_env_hpf, (const Word32 *) filt_coeff_arr_fx[0], filt_coeff_arr_e, IVAS_FILTER_ORDER_1 );
    ivas_filters_init_fx( &hTranDet->test_env_fast, (const Word32 *) filt_coeff_arr_fx[1], filt_coeff_arr_e, IVAS_FILTER_ORDER_1 );
    ivas_filters_init_fx( &hTranDet->test_env_slow, (const Word32 *) filt_coeff_arr_fx[2], filt_coeff_arr_e, IVAS_FILTER_ORDER_1 );

    hTranDet->duck_mult_fac = IVAS_TDET_DUCK_MULT_FAC; /*Q29*/
    move32();
@@ -376,6 +379,31 @@ static Word32 ivas_calc_duck_gain_fx(
 * Calculate in/out ducking gains
 *-----------------------------------------------------------------------------------------*/

#ifndef OPT_2239_IVAS_FILTER_PROCESS
static void check( Word32 computed_fx, Word16 computed_q, Word32 expected_fx, Word16 expected_q );

static void check( Word32 computed_fx, Word16 computed_q, Word32 expected_fx, Word16 expected_q )
{
    Word32 cfx, efx;
    Word16 q_diff = computed_q - expected_q;
    if ( q_diff >= 0 )
    {
        cfx = L_shr( computed_fx, +q_diff );
        efx = expected_fx;
    }
    else
    {
        cfx = computed_fx;
        efx = L_shr( expected_fx, -q_diff );
    }
    Word32 error = abs( cfx - efx );
    if ( error >= ( 1 << 22 ) )
    {
        assert( false );
    }
}
#endif

void ivas_td_decorr_get_ducking_gains_fx(
    ivas_trans_det_state_t *hTranDet, /* i/o: Transient detector handle */
    Word32 *pIn_pcm,                  /*Q11*/
@@ -477,6 +505,17 @@ void ivas_td_decorr_get_ducking_gains_fx(
    ivas_filter_process_exp_fx( &hTranDet->env_hpf, e_fast_fx, frame_len, e_fast_e );


    // Word32 test_e_fast_fx[L_FRAME48k];
    // Word16 q_fast = Q11;
    // Copy32( pIn_pcm, test_e_fast_fx, frame_len ); /*Q11*/
    // ivas_filter_process_fixed_fx( &hTranDet->test_env_hpf, test_e_fast_fx, frame_len, &q_fast );

    // for ( i = 0; i < frame_len; i++ )
    // {
    //     check(test_e_fast_fx[i],q_fast,e_fast_fx[i],31-e_fast_e[i]);
    // }


    FOR( i = 0; i < frame_len; i++ )
    {
        // e_fast_fx[i] = L_add( L_abs( e_fast_fx[i] ), L_shr( IVAS_TDET_PARM_ENV_EPS_fx, q_factor_diff ) ); /*Q14*/