Commit 43a6c591 authored by Nishant S Kulgod's avatar Nishant S Kulgod
Browse files

commit 1

parent 55f431d5
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1235,8 +1235,8 @@ void init_tcx_window_cfg_fx(
    }
    /*Mid-OLA*/
    /*compute minimum length for "half" window: lookahead - 5ms. It must be also multiple of 2*/
    hTcxCfg->tcx_mdct_window_half_length = extract_l( L_shr( L_mult0( L_LOOK_12k8 - NS2SA_FX2( 12800, 5000000L ), sr2fscale( sr_core ) ), LD_FSCALE_DENOM ) );    /*Q0*/
    hTcxCfg->tcx_mdct_window_half_lengthFB = extract_l( L_shr( L_mult0( L_LOOK_12k8 - NS2SA_FX2( 12800, 5000000L ), sr2fscale( input_Fs ) ), LD_FSCALE_DENOM ) ); /*Q0*/
    hTcxCfg->tcx_mdct_window_half_length = extract_l( L_shr( L_mult0( L_LOOK_12k8 - NS2SA( 12800, 5000000L ), sr2fscale( sr_core ) ), LD_FSCALE_DENOM ) );    /*Q0*/
    hTcxCfg->tcx_mdct_window_half_lengthFB = extract_l( L_shr( L_mult0( L_LOOK_12k8 - NS2SA( 12800, 5000000L ), sr2fscale( input_Fs ) ), LD_FSCALE_DENOM ) ); /*Q0*/
    move16();
    move16();
    assert( GT_16( hTcxCfg->tcx_mdct_window_half_length, 16 ) && "Half window can not be large enough!" );
+3 −3
Original line number Diff line number Diff line
@@ -1289,7 +1289,7 @@ static ivas_error ivas_filterbank_setup_fx(

        ivas_get_active_bins_fx( &pAll_bins_per_band, &pAll_bins_per_band_abs, &pAll_bins_start_offset, &pAll_bins_start_offset_abs, sampling_rate );

        IF( EQ_16( pCfg->fb_latency, NS2SA( sampling_rate, DELAY_FB_1_NS ) ) )
        IF( EQ_16( pCfg->fb_latency, NS2SA_FX2( sampling_rate, DELAY_FB_1_NS ) ) )
        {
            pAll_fb_fr_fx[0] = ivas_fb_fr_12band_1ms_re_fx; // Q30
            move32();
@@ -1478,7 +1478,7 @@ static ivas_error ivas_fb_mixer_get_window_fx(
    error = IVAS_ERR_OK;
    move32();

    IF( EQ_16( fade_len, NS2SA( sampling_rate, DELAY_FB_4_NS ) ) )
    IF( EQ_16( fade_len, NS2SA_FX2( sampling_rate, DELAY_FB_4_NS ) ) )
    {
        SWITCH( sampling_rate )
        {
@@ -1495,7 +1495,7 @@ static ivas_error ivas_fb_mixer_get_window_fx(
                return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Unsupported Sampling frequency!" );
        }
    }
    ELSE IF( EQ_16( fade_len, NS2SA( sampling_rate, DELAY_FB_1_NS ) ) )
    ELSE IF( EQ_16( fade_len, NS2SA_FX2( sampling_rate, DELAY_FB_1_NS ) ) )
    {
        SWITCH( sampling_rate )
        {
+1 −1
Original line number Diff line number Diff line
@@ -1282,7 +1282,7 @@ void tcx_ltp_post(

    filtIdx = 0; /* just to avoid comilation warnings */
    move16();
    tcx_buf_len = NS2SA( st->output_Fs, TCXLTP_DELAY_NS ); /* Q0 */
    tcx_buf_len = NS2SA_FX2( st->output_Fs, TCXLTP_DELAY_NS ); /* Q0 */
    SideInfoOnly = 0;
    move16();
    if ( GE_32( total_brate, HQ_96k ) )
+3 −3
Original line number Diff line number Diff line
@@ -833,13 +833,13 @@ void core_switching_OLA_fx(

        IF( ( output_frame - L_FRAME16k ) == 0 ) /* no resampling */
        {
            Copy( mem_over_hp + 2, tmp_buf_switch + i_mult2( SWITCH_GAP_LENGTH_8k, delta ), NS2SA( output_Fs, DELAY_CLDFB_NS ) );
            Copy( mem_over_hp + 2, tmp_buf_switch + i_mult2( SWITCH_GAP_LENGTH_8k, delta ), NS2SA_FX2( output_Fs, DELAY_CLDFB_NS ) );
        }
        ELSE
        {
            IF( ( output_frame - L_FRAME8k ) == 0 ) /* not done yet */
            {
                Copy( synth_subfr_out + SWITCH_GAP_LENGTH_8k, tmp_buf_switch + SWITCH_GAP_LENGTH_8k, NS2SA( output_Fs, DELAY_CLDFB_NS ) ); /* copy subframe to tmp buffer */
                Copy( synth_subfr_out + SWITCH_GAP_LENGTH_8k, tmp_buf_switch + SWITCH_GAP_LENGTH_8k, NS2SA_FX2( output_Fs, DELAY_CLDFB_NS ) ); /* copy subframe to tmp buffer */
            }
            ELSE
            {
@@ -950,7 +950,7 @@ void core_switching_OLA_fx(

    pt = synth;
    pt2 = tmp_buf_switch;
    tmp = NS2SA( output_Fs, DELAY_CLDFB_NS );
    tmp = NS2SA_FX2( output_Fs, DELAY_CLDFB_NS );
    move16();
    pt3 = synth_subfr_bwe;

+15 −15
Original line number Diff line number Diff line
@@ -2156,7 +2156,7 @@ static void ivas_subst_spec_fx(
    ELSE
    {
        // tmp = NS2SA(output_frame*50,PH_ECU_ALDO_OLP2_NS-PH_ECU_LOOKAHEAD_NS);
        tmp = NS2SA_FX2( output_frame * 50, PH_ECU_ALDO_OLP2_NS );
        tmp = NS2SA_FX2( L_mult0( output_frame, 50 ), PH_ECU_ALDO_OLP2_NS );
        move16();
        tmp = sub( tmp, ph_ecu_lookahead );
        tmp = add( tmp, sub( Lecu, shr( sub( Lecu, Lprot ), 1 ) ) );
@@ -2559,7 +2559,7 @@ static void subst_spec_fx(
    }
    ELSE
    {
        tmp = NS2SA( output_frame * 50, PH_ECU_ALDO_OLP2_NS - PH_ECU_LOOKAHEAD_NS );
        tmp = NS2SA_FX2( L_mult0( output_frame, 50 ), PH_ECU_ALDO_OLP2_NS - PH_ECU_LOOKAHEAD_NS );
        move16();
        tmp = add( tmp, sub( Lecu, shr( sub( Lecu, Lprot ), 1 ) ) );
        tmp = sub( tmp, shr( output_frame, 1 ) );
@@ -2920,9 +2920,9 @@ static void ivas_rec_wtda_fx(
    Word16 copy_len;
    Word16 ola_len;

    copy_len = NS2SA( output_frame * FRAMES_PER_SEC, ( 2 * FRAME_SIZE_NS - L_PROT_NS ) / 2 ); /* prototype fill on each side of xsubst to fill MDCT Frame */
    copy_len = NS2SA_FX2( L_mult0( output_frame, FRAMES_PER_SEC ), ( 2 * FRAME_SIZE_NS - L_PROT_NS ) / 2 ); /* prototype fill on each side of xsubst to fill MDCT Frame */
    move16();
    ola_len = NS2SA( output_frame * FRAMES_PER_SEC, N_ZERO_MDCT_NS - ( 2 * FRAME_SIZE_NS - L_PROT_NS ) / 2 ); /* remaining lengt of LA_ZEROS to overlap add decoded with xsubst */
    ola_len = NS2SA_FX2( L_mult0( output_frame, FRAMES_PER_SEC ), N_ZERO_MDCT_NS - ( 2 * FRAME_SIZE_NS - L_PROT_NS ) / 2 ); /* remaining lengt of LA_ZEROS to overlap add decoded with xsubst */
    move16();

    xf_len = 26;
@@ -2980,7 +2980,7 @@ static void ivas_rec_wtda_fx(
    }

    /* extract reconstructed frame with aldo window */
    timesh = sub( NS2SA( output_frame * FRAMES_PER_SEC, N_ZERO_MDCT_NS ), shr( sub( shl( output_frame, 1 ), Lprot ), 1 ) );
    timesh = sub( NS2SA_FX2( L_mult0( output_frame, FRAMES_PER_SEC ), N_ZERO_MDCT_NS ), shr( sub( shl( output_frame, 1 ), Lprot ), 1 ) );

    set16_fx( xsubst_, 0, add( sub( shl( output_frame, 1 ), Lprot ), timesh ) );
    Copy( X, xsubst_ + add( sub( shl( output_frame, 1 ), Lprot ), timesh ), sub( Lprot, timesh ) );
@@ -2988,9 +2988,9 @@ static void ivas_rec_wtda_fx(
    /* Copy and OLA look ahead zero part of MDCT window from decoded signal  */
    IF( element_mode != EVS_MONO )
    {
        Copy( old_dec, xsubst_ + NS2SA( output_frame * FRAMES_PER_SEC, N_ZERO_MDCT_NS ), copy_len ); /* also need to scale to Q0 ?? */
        Copy( old_dec, xsubst_ + NS2SA_FX2( L_mult0( output_frame, FRAMES_PER_SEC ), N_ZERO_MDCT_NS ), copy_len ); /* also need to scale to Q0 ?? */
        pOld = old_dec + copy_len;
        pNew = xsubst_ + add( copy_len, NS2SA( output_frame * FRAMES_PER_SEC, N_ZERO_MDCT_NS ) );
        pNew = xsubst_ + add( copy_len, NS2SA_FX2( L_mult0( output_frame, FRAMES_PER_SEC ), N_ZERO_MDCT_NS ) );
        tmp = div_s( 1, shl( ola_len, 1 ) );                    // Q15
        tmp = round_fx( L_shl( L_mult( tmp, EVS_PI_FX ), 2 ) ); // Q15
        sinq_fx( tmp, 0, ola_len, xfwin );
@@ -4583,7 +4583,7 @@ static void ivas_fec_noise_filling_fx(
    }
    ELSE
    {
        kk = NS2SA( L * FRAMES_PER_SEC, N_ZERO_MDCT_NS );
        kk = NS2SA_FX2( L_mult0( L, FRAMES_PER_SEC ), N_ZERO_MDCT_NS );
        p_mdct_ola = old_out + kk;
    }

@@ -4939,7 +4939,7 @@ static void ivas_hq_phase_ecu_fx(

    IF( element_mode == EVS_MONO )
    {
        ph_ecu_lookahead = NS2SA( output_frame * FRAMES_PER_SEC, PH_ECU_LOOKAHEAD_NS );
        ph_ecu_lookahead = NS2SA_FX2( L_mult0( output_frame, FRAMES_PER_SEC ), PH_ECU_LOOKAHEAD_NS );
        move16();
    }
    ELSE
@@ -5018,7 +5018,7 @@ static void ivas_hq_phase_ecu_fx(
                        alpha, beta, *beta_mute, Xavg, element_mode, ph_ecu_lookahead, noise_fac );

    /* reconstructed frame in tda domain */
    old_dec = prevsynth + sub( shl( output_frame, 1 ), NS2SA( output_frame * FRAMES_PER_SEC, N_ZERO_MDCT_NS ) );
    old_dec = prevsynth + sub( shl( output_frame, 1 ), NS2SA_FX2( L_mult0( output_frame, FRAMES_PER_SEC ), N_ZERO_MDCT_NS ) );
    ivas_rec_frame_fx( X, ecu_rec, output_frame, *Q_spec, old_dec, element_mode, num_p, plocs );

    *last_fec = 0;
@@ -5223,11 +5223,11 @@ void ivas_hq_ecu_fx(
    move16();
    IF( EQ_16( st_fx->element_mode, EVS_MONO ) )
    {
        fec_alg_input = prevsynth + NS2SA( output_frame * FRAMES_PER_SEC, ACELP_LOOK_NS / 2 - PH_ECU_LOOKAHEAD_NS );
        fec_alg_input = prevsynth + NS2SA_FX2( L_mult0( output_frame, FRAMES_PER_SEC ), ACELP_LOOK_NS / 2 - PH_ECU_LOOKAHEAD_NS );
    }
    ELSE
    {
        fec_alg_input = prevsynth - NS2SA( output_frame * FRAMES_PER_SEC, PH_ECU_LOOKAHEAD_NS );
        fec_alg_input = prevsynth - NS2SA_FX2( L_mult0( output_frame, FRAMES_PER_SEC ), PH_ECU_LOOKAHEAD_NS );
    }
    /* init (values ar changed after) */

@@ -5286,7 +5286,7 @@ void ivas_hq_ecu_fx(
    }
    ELSE
    {
        ivas_hq_phase_ecu_fx( prevsynth - NS2SA( output_frame * FRAMES_PER_SEC, PH_ECU_LOOKAHEAD_NS ), ecu_rec, time_offs, X_sav, Q_spec, num_p, plocs, plocsi,
        ivas_hq_phase_ecu_fx( prevsynth - NS2SA_FX2( L_mult0( output_frame, FRAMES_PER_SEC ), PH_ECU_LOOKAHEAD_NS ), ecu_rec, time_offs, X_sav, Q_spec, num_p, plocs, plocsi,
                              env_stab, last_fec, ph_ecu_active, prev_bfi, old_is_transient,
                              mag_chg_1st, Xavg, beta_mute, st_fx->bwidth, output_frame, corr, st_fx->element_mode );

@@ -5354,7 +5354,7 @@ void hq_ecu_fx(
#ifdef IVAS_FEC_ECU_TO_COMPLETE
        fec_ecu_pitch_fx( fec_alg_input, prevsynth_LP, output_frame, &N, &corr, &decimatefactor, ph_ecu_HqVoicing );
#else
        fec_ecu_pitch_fx( prevsynth + NS2SA( output_frame * 50, ACELP_LOOK_NS / 2 - PH_ECU_LOOKAHEAD_NS ), prevsynth_LP, output_frame, &N, &corr, &decimatefactor, ph_ecu_HqVoicing );
        fec_ecu_pitch_fx( prevsynth + NS2SA_FX2( L_mult0( output_frame, 50 ), ACELP_LOOK_NS / 2 - PH_ECU_LOOKAHEAD_NS ), prevsynth_LP, output_frame, &N, &corr, &decimatefactor, ph_ecu_HqVoicing );
#endif
    }
    ELSE
@@ -5409,7 +5409,7 @@ void hq_ecu_fx(
        ( LT_32( st_fx->total_brate, 48000 ) && ( ( ph_ecu_HqVoicing || GT_16( corr, 27853 ) ) && !prev_bfi && ( !old_is_transient[0] || old_is_transient[1] ) ) ) )
    {

        fec_alg_fx( prevsynth + NS2SA( output_frame * 50, ACELP_LOOK_NS / 2 - PH_ECU_LOOKAHEAD_NS ), prevsynth_LP, &st_fx->hHQ_core->ni_seed_forfec, ecu_rec, output_frame, N, decimatefactor, ph_ecu_HqVoicing, gapsynth );
        fec_alg_fx( prevsynth + NS2SA_FX2( L_mult0( output_frame, 50 ), ACELP_LOOK_NS / 2 - PH_ECU_LOOKAHEAD_NS ), prevsynth_LP, &st_fx->hHQ_core->ni_seed_forfec, ecu_rec, output_frame, N, decimatefactor, ph_ecu_HqVoicing, gapsynth );
        *last_fec = 1;
        move16();
        *ph_ecu_active = 0;
Loading