Commit 2007c02f authored by vaillancour's avatar vaillancour
Browse files

Fix saturation, add debugging and missing rescaling

parent c521a983
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -145,6 +145,7 @@
#define NONBE_FIX_1069_SVD_TUNING                       /* FhG: issue 1069: tune SVD constants */
#define FIX_778_STEREO_BRATE_SWITCHING
#define FIX_774_ENERGY_BURST                    /* Fix 0 bit BWE */
#define FIX_729_MISSING_RESCALING
/* ################## End DEVELOPMENT switches ######################### */

/* clang-format on */
+15 −0
Original line number Diff line number Diff line
@@ -727,6 +727,9 @@ static void filt_mu_fx(
    Word16 mu, ga, temp;
    const Word16 *ptrs;
    Word16 tmp, exp;
#ifdef FIX_729_MISSING_RESCALING
    Flag Overflow = 0;
#endif


    IF( EQ_16( SubFrameLength, L_SUBFR ) )
@@ -767,7 +770,19 @@ static void filt_mu_fx(
    {
        temp = mult_r( mu, ( *ptrs++ ) );
        temp = add( temp, *ptrs ); /*Q12 */
#ifdef FIX_729_MISSING_RESCALING
        sig_out[n] = shl_o( mult_r( ga, temp ), 1, &Overflow );
#ifdef DEBUGGING
        if ( Overflow )
        {
            fprintf( stderr, "Saturation in filt_mu_fx for ga = %d, temp = %d, result = %.2f at frame %d\n\n", ga, temp, (float) ga * temp * 4.0 / 65536.0, frame );
            Overflow = 0;
        }
#endif

#else
        sig_out[n] = shl( mult_r( ga, temp ), 1 );
#endif
        move16(); /*Q12 */
    }

+9 −0
Original line number Diff line number Diff line
@@ -1733,6 +1733,15 @@ void ivas_swb_tbe_dec_fx(
        st->prev_Q_bwe_exc_fb = 51;
        move16();
    }

#ifdef FIX_729_MISSING_RESCALING
    /* rescale the TBE post proc memory */
    FOR( i = 0; i < LPC_SHB_ORDER; i++ )
    {
        hBWE_TD->mem_stp_swb_fx[i] = shl( hBWE_TD->mem_stp_swb_fx[i], Q_bwe_exc - st->prev_Q_bwe_syn );
        move16();
    }
#endif
    /* fill-in missing SHB excitation */
    IF( ( st->element_mode == IVAS_CPE_TD || st->element_mode == IVAS_CPE_DFT ) && st->last_core_brate <= SID_2k40 )
    {