Commit 24895746 authored by Manuel Jander's avatar Manuel Jander
Browse files

Add macro NONBE_FIX_ISSUE_2206_TD_CHANNEL_EXTRAPOLATION to fix saturation of...

Add macro NONBE_FIX_ISSUE_2206_TD_CHANNEL_EXTRAPOLATION to fix saturation of LPC coef A in stereo_td_channel_extrapolate_fx() causing instability in extrapolated signal.
parent 834fcce8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@
#define NONBE_FIX_ISSUE_2206_TV1                        /* VA/FhG: Calculate st->q_inp also considering st->mem_q decimation memory to avoid saturation */
#define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT             /* FhG: Dynamic scale of shb_speech buffers */
// #define NONBE_FIX_ISSUE_2206_DO_NOT_FLUSH_TO_ZERO       /* FhG: Do not right shift flush to zero in Copy_Scale_sig_nosat */
#define NONBE_FIX_ISSUE_2206_TD_CHANNEL_EXTRAPOLATION   /* FhG: Use different scale to avoid saturation LPC coefficient in TD Stereo signal extrapolation. */
#define HARM_HQ_CORE_KEEP_BE                            /* hack to keep all BE after HQ core functions harmonization; pending resolving issues #2450, #2451, #2452 */
#define FIX_2452_HQ_CORE_PEAQ_AVR_RATIO_HARM            /* Eri: Basop issue 2453: Fix alignment of peak_avrg_ratio_fx */
#define FIX_2480_HARM_TONALMDCT                         /* FhG: basop issue 2480: Harmonize TonalMDCTConceal_Detect_fx() and TonalMDCTConceal_Detect_ivas_fx() */
+9 −0
Original line number Diff line number Diff line
@@ -304,7 +304,12 @@ static void stereo_td_channel_extrapolate_fx(
    r_l[0] = s_max( r_l[0], 1 );
    move16();
    flag = E_LPC_lev_dur_fx( r_h, r_l, A, NULL, STEREO_DFT_CHANNEL_EXTR_LPC_ORDER, NULL );
#ifdef NONBE_FIX_ISSUE_2206_TD_CHANNEL_EXTRAPOLATION
    tmp = add( 2, sub( norm_s( A[0] ), norm_arr( A, STEREO_DFT_CHANNEL_EXTR_LPC_ORDER + 1 ) ) );
    scale_sig( A, STEREO_DFT_CHANNEL_EXTR_LPC_ORDER + 1, sub( norm_s( A[0] ), tmp ) );
#else
    Copy_Scale_sig( A, A, STEREO_DFT_CHANNEL_EXTR_LPC_ORDER + 1, sub( norm_s( A[0] ), 2 ) );
#endif
    IF( EQ_16( flag, 1 ) )
    {
        g_lpc = 0;
@@ -348,7 +353,11 @@ static void stereo_td_channel_extrapolate_fx(
        shift_input[i] = extract_h( L_mac0( L_mult0( g_lpc, shift_input[i] ), g, sts[leading_channel]->input_fx[i] ) ); // Q = 14 + q_shift - 16
        move16();
    }
#ifdef NONBE_FIX_ISSUE_2206_TD_CHANNEL_EXTRAPOLATION
    Word16 q_temp = sub( q_shift, tmp );
#else
    Word16 q_temp = sub( q_shift, 2 );
#endif

    /* smooth transition (currently done by blending over linearly, could be replaced by something more elaborate.) */
    Word16 e_shift = 0;