Commit 4111bcf1 authored by vaillancour's avatar vaillancour
Browse files

possible fix to 856, wrong usage of extract_l

parent 8f6f9042
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -169,6 +169,7 @@


#define FIX_854_HILBERT_SCALING                 /* VA: reduce lost of precision due to unnecessary scaling, reduce a lot the 2 kHz tone */
#define FIX_856_EXTRACT_L                       /* VA: Fix undesirable wrap-around */
/* ################## End DEVELOPMENT switches ######################### */

/* clang-format on */
+4 −1
Original line number Diff line number Diff line
@@ -838,8 +838,11 @@ Word16 ivas_calc_tilt_bwe_fx( /* o : Tilt in Q24 */
        L_temp = L_shl( L_temp, sub( exp2, 4 ) ); // Output is expected in Q11
    }
    BASOP_SATURATE_WARNING_ON_EVS

#ifdef FIX_856_EXTRACT_L
    return extract_h( L_shl_sat( L_temp, 16 ) );
#else
    return extract_l( L_temp );
#endif
}
#endif

+4 −0
Original line number Diff line number Diff line
@@ -1584,7 +1584,11 @@ void save_synthesis_hq_fec_fx(
        Copy( st->hTcxDec->synth_history_fx + output_frame, st->hTcxDec->synth_history_fx, add( sub( output_frame, post_hq_delay ), NS2SA_FX2( st->output_Fs, PH_ECU_MEM_NS ) ) );
        FOR( Word16 i = 0; i < output_frame; i++ )
        {
#ifdef FIX_856_EXTRACT_L
            st->hTcxDec->old_synthFB_fx[sub( add( i, output_frame ), post_hq_delay )] = extract_h( L_shl_sat( output_fx[i], 16 ) );
#else
            st->hTcxDec->old_synthFB_fx[sub( add( i, output_frame ), post_hq_delay )] = extract_l( output_fx[i] );
#endif
            move16();
        }

+4 −1
Original line number Diff line number Diff line
@@ -1626,8 +1626,11 @@ ivas_error ivas_core_dec_fx(
            exp_max = s_min( exp_max, exp_delay_buf_out );

            Copy32( output_32_fx[n], output_fx_loc, output_frame );

#ifdef FIX_856_EXTRACT_L
            Scale_sig32( output_fx_loc, output_frame, -Q11 ); /* output_fx_loc should be in Q0 when entering save_synthesis_hq_fec_fx */
#else
            Scale_sig32( output_fx_loc, output_frame, sub( exp_max, Q11 ) );
#endif
            Scale_sig( st->delay_buf_out_fx, NS2SA_FX2( st->output_Fs, DELAY_CLDFB_NS ), exp_max );
            Scale_sig( st->hHQ_core->old_out_fx + NS2SA_FX2( st->output_Fs, N_ZERO_MDCT_NS ), sub( NS2SA_FX2( st->output_Fs, PH_ECU_LOOKAHEAD_NS ), NS2SA_FX2( st->output_Fs, N_ZERO_MDCT_NS ) ), exp_max );
            Scale_sig( st->prev_synth_buffer_fx, NS2SA_FX2( 48000, L_sub( DELAY_BWE_TOTAL_NS, DELAY_CLDFB_NS ) ), sub( exp_max, st->q_prev_synth_buffer_fx ) );
+4 −1
Original line number Diff line number Diff line
@@ -1121,8 +1121,11 @@ void ivas_swb_tbe_dec_fx(

    /* find tilt */
    calc_tilt_bwe_fx_loc( old_syn_12k8_16k_fx, &tilt_swb_fec_32_fx, &tilt_swb_fec_fx_q, L_FRAME );
#ifdef FIX_856_EXTRACT_L
    tilt_swb_fec_fx = round_fx_sat( L_shl_sat( tilt_swb_fec_32_fx, sub( 11 + 16, tilt_swb_fec_fx_q ) ) );
#else
    tilt_swb_fec_fx = extract_l( L_shr( tilt_swb_fec_32_fx, sub( tilt_swb_fec_fx_q, 11 ) ) );

#endif
    test();
    if ( st->bfi && st->clas_dec != UNVOICED_CLAS )
    {