Commit b163bc69 authored by norvell's avatar norvell
Browse files

Merge branch '2067_basop_PortMR1921_USAN_FIX' into 'main'

Add FIX_1179_USAN_PHASEECU for porting MR1921 into basop

See merge request !2361
parents 6ced6ebd df61d8a7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -151,6 +151,7 @@
#define FIX_1387_INIT_PRM_SQQ                           /* FhG: initialize pointer prm_sqQ, which might be uninitialized in case of bfi == 1 */
#define NONBE_1296_TDREND_ITD_OUT_OF_BOUNDS_ACCESS      /* Eri: issue 1296: ITD resampling can occasionally read out of bounds, especially when the requested subframes are short (1.25 ms). Seen for headtracking+JBM. */
#define FIX_1349_TNS_CRASH                              /* FhG: Fix crash in TNS entropy coding, in case order of joint TNS coding is reduced to 0 */
#define FIX_1179_USAN_PHASEECU                          /* Eri: issue 1179:  better handling of 16 bit wrap around for very long(>200ms) FER-bursts   */

/* #################### End BASOP porting switches ############################ */

+30 −0
Original line number Diff line number Diff line
@@ -2304,7 +2304,11 @@ static void subst_spec_fx(
        move16();
        tmp = add( tmp, sub( Lecu, shr( sub( Lecu, Lprot ), 1 ) ) );
        tmp = sub( tmp, shr( output_frame, 1 ) );
#ifdef FIX_1179_USAN_PHASEECU
        tmp = add_sat( tmp, time_offs );
#else
        tmp = add( tmp, time_offs );
#endif
        tmp = round_fx( L_shl( L_mult0( tmp, Lprot_inv ), 4 ) ); /* 0+22+4-16=10 */

        pPlocsi = plocsi;
@@ -4499,12 +4503,20 @@ static void ivas_hq_phase_ecu_fx(
    {
        test();
        test();
#ifdef FIX_1179_USAN_PHASEECU
        if ( !( prev_bfi != 0 && *last_fec != 0 && element_mode == EVS_MONO ) )
        {
            *time_offs = 0; /* IVAS reset of offset time counter, timeoffset variable later also used to calculate burst length */
            move16();
        }
#else
        // PMT("verify condition compared to float")
        if ( !( prev_bfi != 0 && *last_fec != 0 && element_mode == EVS_MONO ) )
        {
            *time_offs = 0;
            move16();
        }
#endif

        offset = add( sub( sub( shl( output_frame, 1 ), lprot ), *time_offs ), ph_ecu_lookahead );
        trans_ana_fx( prevsynth + offset, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab,
@@ -4515,7 +4527,11 @@ static void ivas_hq_phase_ecu_fx(
        test();
        IF( prev_bfi != 0 && *last_fec != 0 )
        {
#ifdef FIX_1179_USAN_PHASEECU
            *time_offs = add_sat( *time_offs, output_frame ); /* when saturation is reached, this keeps the long term muting on */
#else
            *time_offs = add( *time_offs, output_frame );
#endif
            move16();
        }
    }
@@ -4604,7 +4620,9 @@ static void hq_phase_ecu_fx(
    IF( prev_bfi == 0 || ( prev_bfi != 0 && *last_fec != 0 && ( EQ_16( *time_offs, output_frame ) ) ) )
    {
        test();
#ifndef FIX_1179_USAN_PHASEECU
        // PMT("verify condition compared to float")
#endif
        if ( !( prev_bfi != 0 && *last_fec != 0 ) )
        {
            *time_offs = 0;
@@ -4620,13 +4638,21 @@ static void hq_phase_ecu_fx(
        test();
        IF( prev_bfi != 0 && *last_fec != 0 )
        {
#ifdef FIX_1179_USAN_PHASEECU
            *time_offs = add_sat( *time_offs, output_frame );
#else
            *time_offs = add( *time_offs, output_frame );
#endif
            move16();
        }
    }
    ELSE
    {
#ifdef FIX_1179_USAN_PHASEECU
        *time_offs = add_sat( *time_offs, output_frame );
#else
        *time_offs = add( *time_offs, output_frame );
#endif
        move16();

        offset = sub( shl( output_frame, 1 ), lprot );
@@ -4641,7 +4667,11 @@ static void hq_phase_ecu_fx(
    move16();
    IF( *num_p > 0 )
    {
#ifdef FIX_1179_USAN_PHASEECU
        seed = add_sat( seed, plocs[*num_p - 1] );
#else
        seed = add( seed, plocs[*num_p - 1] );
#endif
    }

    subst_spec_fx( plocs, plocsi, num_p, *time_offs, X, mag_chg, ph_dith, old_is_transient, output_frame, &seed,