Commit 1be6ea77 authored by Nishant S Kulgod's avatar Nishant S Kulgod
Browse files

commit 1

parent 474bc689
Loading
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -106,7 +106,6 @@ void bands_and_bit_alloc_ivas_fx(
    Word32 sum_bit /*Q0*/, bit_fracf /*Q18*/;
    Word16 etmp;
    Word16 tmp;
    Word16 Ener_per_bd_iQ_tmp[MBANDS_GN_BITALLOC16k]; // Q13
    Word16 pos, band;
    Word32 SWB_bit_budget;                        // Q0 -> Q18
    Word32 bits_per_bands[MBANDS_GN_BITALLOC16k]; // Q18
@@ -126,7 +125,6 @@ void bands_and_bit_alloc_ivas_fx(
        nb_tot_bands = MBANDS_GN_BITALLOC16k;
        move16();
    }
    Copy( Ener_per_bd_iQ, Ener_per_bd_iQ_tmp, nb_tot_bands );

    set32_fx( bits_per_bands, 0, MBANDS_GN_BITALLOC16k );
    set16_fx( out_bits_per_bands, 0, MBANDS_GN_BITALLOC16k );
@@ -138,7 +136,7 @@ void bands_and_bit_alloc_ivas_fx(
    ener_vec[0] = add( Ener_per_bd_iQ[0], Ener_per_bd_iQ[1] ); /*Q12 */
#endif
    move16();
    Copy( Ener_per_bd_iQ_tmp + 1, ener_vec, MBANDS_GN - 1 ); /*Q12 */
    Copy( Ener_per_bd_iQ + 1, ener_vec, MBANDS_GN - 1 ); /*Q12 */
    ener_vec[MBANDS_GN - 1] = ener_vec[MBANDS_GN - 2];
    move16();
    IF( EQ_16( L_frame, L_FRAME16k ) )
+27 −0
Original line number Diff line number Diff line
@@ -279,6 +279,33 @@ void ivas_filter_process_fx(
}
#endif

void ivas_filter_process_exp_fx(
    ivas_filters_process_state_t *filter_state, /* i/o: filter state handle             */
    Word32 *pIn_Out_fx,                         /* i/o: signal subject to filtering (exp[i] : pIn_out_e[i])   */
    const Word16 length,                        /* i  : filter order                    */
    Word16 *pIn_Out_e )
{
    SWITCH( filter_state->order )
    {
        case IVAS_FILTER_ORDER_1:
        case IVAS_FILTER_ORDER_2:
            ivas_iir_2_filter_fx( filter_state, pIn_Out_fx, length, IVAS_FILTER_STAGE_0, pIn_Out_e );
            /* Scale pIn_Out_fx back to input Q */
            BREAK;
        case IVAS_FILTER_ORDER_4:
            /* biquad-1 */
            ivas_iir_2_filter_fx( filter_state, pIn_Out_fx, length, IVAS_FILTER_STAGE_0, pIn_Out_e );
            /* biquad-2 */
            ivas_iir_2_filter_fx( filter_state, pIn_Out_fx, length, IVAS_FILTER_STAGE_1, pIn_Out_e );
            /* Scale pIn_Out_fx back to input Q */
            BREAK;
        default:
            BREAK;
    }

    return;
}


/*-----------------------------------------------------------------------------------------*
 * Function ivas_iir_2_filter()
+6 −0
Original line number Diff line number Diff line
@@ -3761,6 +3761,12 @@ void ivas_filter_process_fx(
    const Word16 length,                        /* i  : filter order                            */
    Word16 q_factor );

void ivas_filter_process_exp_fx(
    ivas_filters_process_state_t *filter_state, /* i/o: filter state handle             */
    Word32 *pIn_Out_fx,                         /* i/o: signal subject to filtering (exp[i] : pIn_out_e[i])   */
    const Word16 length,                        /* i  : filter order                    */
    Word16 *pIn_Out_e );

ivas_error ivas_osba_enc_open_fx(
    Encoder_Struct *st_ivas /* i/o: IVAS encoder handle                     */
);
+30 −20
Original line number Diff line number Diff line
@@ -554,15 +554,18 @@ static float ivas_calc_duck_gain(
static Word32 ivas_calc_duck_gain_fx(
    const Word32 duck_gain,  /*Q30*/
    const Word32 duck_coeff, /*Q30*/
    const Word32 env_1,      /*Q14*/
    const Word32 env_2,      /*Q14*/
    const Word32 env_1,      /*exp : env1_e*/
    const Word16 env1_e,
    const Word32 env_2, /*exp : env2_e*/
    const Word16 env2_e,
    const Word32 duck_mult_fac /*Q29*/ )
{
    Word32 duck_gain_out;
    Word32 duck_gain_out, L_tmp;
    Word16 tmp_e;

    duck_gain_out = L_add( L_shl( Mpy_32_32( L_sub( duck_gain, ONE_IN_Q30 ), duck_coeff ), Q1 ), ONE_IN_Q30 ); /*Q30*/

    IF( LT_32( Mpy_32_32( duck_mult_fac, env_1 ), Mpy_32_32( L_shr( duck_gain_out, 1 ), env_2 ) ) )
    IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( Mpy_32_32( duck_mult_fac, env_1 ), add( 2, env1_e ), Mpy_32_32( duck_gain_out, env_2 ), add( 1, env2_e ) ), -1 ) )
    {
        test();
        IF( ( env_1 == 0 ) || ( env_2 == 0 ) )
@@ -572,7 +575,10 @@ static Word32 ivas_calc_duck_gain_fx(
        }
        ELSE
        {
            duck_gain_out = Mpy_32_32( duck_mult_fac, L_shl( (Word32) ( divide3232( env_1, env_2 ) ), Q16 ) ); /*Q29*/
            L_tmp = BASOP_Util_Divide3232_Scale_cadence( env_1, env_2, &tmp_e );
            L_tmp = L_shl( L_tmp, add( sub( env1_e, env2_e ), tmp_e ) );

            duck_gain_out = Mpy_32_32( duck_mult_fac, L_tmp ); /*Q29*/
            duck_gain_out = L_shl( duck_gain_out, Q1 );        /*Q30*/
        }
    }
@@ -660,9 +666,9 @@ void ivas_td_decorr_get_ducking_gains_fx(
    const Word16 frame_len,           /*Q0*/
    const Word16 tdet_flag /*Q0*/ )
{
    Word16 i, q = Q14;
    move16();
    Word16 i;
    Word32 e_fast_fx[L_FRAME48k], e_slow_fx[L_FRAME48k];
    Word16 e_fast_e[L_FRAME48k], e_slow_e[L_FRAME48k];
    Word32 in_duck_gain = hTranDet->in_duck_gain; /*Q30*/
    move32();
    Word32 out_duck_gain = hTranDet->out_duck_gain; /*Q30*/
@@ -676,30 +682,34 @@ void ivas_td_decorr_get_ducking_gains_fx(

    Copy32( pIn_pcm, e_fast_fx, frame_len ); /*Q11*/

    set16_fx( e_fast_e, 31 - Q11, L_FRAME48k );

    /* env hpf */
    ivas_filter_process_fx( &hTranDet->env_hpf, e_fast_fx, frame_len, q );
    ivas_filter_process_exp_fx( &hTranDet->env_hpf, e_fast_fx, frame_len, e_fast_e );

    Word16 q_factor_diff = sub( 31, q );

    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*/
        // e_fast_fx[i] = L_add( L_abs( e_fast_fx[i] ), L_shr( IVAS_TDET_PARM_ENV_EPS_fx, q_factor_diff ) ); /*Q14*/
        e_fast_fx[i] = BASOP_Util_Add_Mant32Exp( L_abs( e_fast_fx[i] ), e_fast_e[i], IVAS_TDET_PARM_ENV_EPS_fx, 0, &e_fast_e[i] );
        move32();
        e_slow_fx[i] = e_fast_fx[i]; /*Q14*/
        e_slow_fx[i] = e_fast_fx[i];
        move32();
        e_slow_e[i] = e_fast_e[i];
        move16();
    }

    /* env fast*/
    ivas_filter_process_fx( &hTranDet->env_fast, e_fast_fx, frame_len, q );
    ivas_filter_process_exp_fx( &hTranDet->env_fast, e_fast_fx, frame_len, e_fast_e );

    /* env slow */
    ivas_filter_process_fx( &hTranDet->env_slow, e_slow_fx, frame_len, q );
    ivas_filter_process_exp_fx( &hTranDet->env_slow, e_slow_fx, frame_len, e_slow_e );

    IF( tdet_flag )
    {
        FOR( i = 0; i < frame_len; i++ )
        {
            in_duck_gain = ivas_calc_duck_gain_fx( in_duck_gain, in_duck_coeff, e_slow_fx[i], e_fast_fx[i], duck_mult_fac ); /*Q30*/
            in_duck_gain = ivas_calc_duck_gain_fx( in_duck_gain, in_duck_coeff, e_slow_fx[i], e_slow_e[i], e_fast_fx[i], e_fast_e[i], duck_mult_fac ); /*Q30*/
            pIn_duck_gains[i] = in_duck_gain;                                                                                                          /*Q30*/
            move32();
        }
@@ -710,10 +720,10 @@ void ivas_td_decorr_get_ducking_gains_fx(
    {
        FOR( i = 0; i < frame_len; i++ )
        {
            in_duck_gain = ivas_calc_duck_gain_fx( in_duck_gain, in_duck_coeff, e_slow_fx[i], e_fast_fx[i], duck_mult_fac ); /*Q30*/
            in_duck_gain = ivas_calc_duck_gain_fx( in_duck_gain, in_duck_coeff, e_slow_fx[i], e_slow_e[i], e_fast_fx[i], e_fast_e[i], duck_mult_fac ); /*Q30*/
            pIn_duck_gains[i] = in_duck_gain;                                                                                                          /*Q30*/
            move32();
            out_duck_gain = ivas_calc_duck_gain_fx( out_duck_gain, out_duck_coeff, e_fast_fx[i], e_slow_fx[i], duck_mult_fac ); /*Q30*/
            out_duck_gain = ivas_calc_duck_gain_fx( out_duck_gain, out_duck_coeff, e_fast_fx[i], e_fast_e[i], e_slow_fx[i], e_slow_e[i], duck_mult_fac ); /*Q30*/
            pOut_duck_gains[i] = out_duck_gain;                                                                                                           /*Q30*/
            move32();
        }
+1 −1
Original line number Diff line number Diff line
@@ -531,7 +531,7 @@ void preecho_sb_fx(
                        tmp_fx1 = norm_l( es_mdct_fx[i] );
                        tmp_fxL1 = L_shl( es_mdct_fx[i], tmp_fx1 );
                        tmp_fxL2 = L_shl( mean_prev_fx_loc, tmp_fx1 );
                        tmp_fx1 = round_fx( tmp_fxL1 );
                        tmp_fx1 = round_fx_sat( tmp_fxL1 );
                        tmp_fx2 = round_fx( tmp_fxL2 );
                        tmp_fx3 = div_s( tmp_fx2, tmp_fx1 );
                        min_g_fx[i] = Frac_sqrt( tmp_fx3 );
Loading