Commit 1eaaf3dc authored by emerit's avatar emerit
Browse files

Merge branch 'main' into 1785-10ms_Rendering_Assert_in_ivas_jbm_dec_render_fx()_scale_sig32

parents fe74f367 d11823c9
Loading
Loading
Loading
Loading
+63 −68
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@
#include "wmc_auto.h"

#define HP20_COEFF_SCALE    ( 2 )
#define HP20_FX_COEFF_SCALE ( 1 )
/*
 * hp20
 *
@@ -340,7 +341,7 @@ void hp20( Word16 signal[], /* i/o: signal to filter any *


#ifdef HP20_FIX32_RECODING
void hp20_fx_32(
void hp20_fx_32_opt(
    Word32 signal_fx[],
    const Word16 lg,
    Word32 mem_fx[],
@@ -348,54 +349,49 @@ void hp20_fx_32(
{
    Word32 i;
    Word32 a1_fx, a2_fx, b1_fx, b2_fx;
    Word32 diff_pos, diff_neg;
#ifndef ISSUE_1836_replace_overflow_libcom
    Flag Overflow = 0;
#endif
    Word16 prescale, prescaleOld, prescale_current_frame, diff;
    Word32 tmp_mem[4];

    prescale = getScaleFactor32( signal_fx, lg );
    prescale_current_frame = s_min( 3, sub( 1 + HP20_COEFF_SCALE, prescale ) );

    prescale = L_norm_arr( signal_fx, lg );
    prescale_current_frame = sub( 1 + HP20_FX_COEFF_SCALE, prescale );

    prescaleOld = extract_l( mem_fx[4] );

#ifdef ISSUE_1836_replace_overflow_libcom
    diff_pos = norm_l( L_shl_sat( L_max( mem_fx[2], mem_fx[3] ), prescaleOld ) );
    diff_neg = norm_l( L_shl_sat( L_min( mem_fx[2], mem_fx[3] ), prescaleOld ) );
#else
    diff_pos = norm_l( L_shl_o( L_max( mem_fx[2], mem_fx[3] ), prescaleOld, &Overflow ) );
    diff_neg = norm_l( L_shl_o( L_min( mem_fx[2], mem_fx[3] ), prescaleOld, &Overflow ) );
#endif
    tmp_mem[0] = L_shl_sat( mem_fx[0], prescaleOld );
    tmp_mem[1] = L_shl_sat( mem_fx[1], prescaleOld );
    tmp_mem[2] = L_shl_sat( mem_fx[2], prescaleOld );
    tmp_mem[3] = L_shl_sat( mem_fx[3], prescaleOld );
    move32();
    move32();
    move32();
    move32();

    diff = L_norm_arr( tmp_mem, 4 );

    prescale = s_min( prescale, diff );

    diff = L_max( diff_pos, diff_neg );
    prescale = sub( 1 + HP20_FX_COEFF_SCALE, prescale );

    IF( NE_16( diff, 0 ) )
    if ( EQ_16( prescale_current_frame, 1 + HP20_FX_COEFF_SCALE - 31 ) ) // signal_fx buffer contains only zeros, so use the mem_fx scale_factor instead
    {
        prescale = s_min( prescale, diff );
        prescale_current_frame = prescale;
    }

    prescale = s_min( 3, sub( 1 + HP20_COEFF_SCALE, prescale ) );

    diff = sub( prescale, prescaleOld );
#ifdef ISSUE_1836_replace_overflow_libcom
    mem_fx[0] = L_shr_sat( mem_fx[0], diff );
    move32();
    mem_fx[1] = L_shr_sat( mem_fx[1], diff );
    move32();
    mem_fx[2] = L_shr_sat( mem_fx[2], diff );
    move32();
    mem_fx[3] = L_shr_sat( mem_fx[3], diff );
#else
    mem_fx[0] = L_shr_o( mem_fx[0], diff, &Overflow );
    move32();
    mem_fx[1] = L_shr_o( mem_fx[1], diff, &Overflow );
    move32();
    mem_fx[2] = L_shr_o( mem_fx[2], diff, &Overflow );
    move32();
    mem_fx[3] = L_shr_o( mem_fx[3], diff, &Overflow );
#endif
    move32();
    move32();
    move32();
    move32();
    mem_fx[4] = L_deposit_l( prescale_current_frame );
    move32();
@@ -406,10 +402,10 @@ void hp20_fx_32(
           [b,a] = butter(2, 20.0/4000.0, 'high');
           b = [0.988954248067140  -1.977908496134280   0.988954248067140]
           a =[1.000000000000000  -1.977786483776764   0.978030508491796]*/
        a1_fx = 1061816033l /* 1.977786483776764 Q29*/;
        a2_fx = -525076131l /*-0.978030508491796 Q29*/;
        b1_fx = -1061881538l /*-1.977908496134280 Q29*/;
        b2_fx = 530940769l /* 0.988954248067140 Q29*/;
        a1_fx = 2123632067 /* 1.977786483776764 Q30*/;
        a2_fx = -1050152262 /*-0.978030508491796 Q30*/;
        b1_fx = -2123763076 /*-1.977908496134280 Q30*/;
        b2_fx = 1061881538 /* 0.988954248067140 Q30*/;
    }
    ELSE IF( EQ_32( Fs, 16000 ) )
    {
@@ -417,10 +413,10 @@ void hp20_fx_32(
           [b,a] = butter(2, 20.0/8000.0, 'high');
           b =[ 0.994461788958195  -1.988923577916390   0.994461788958195]
           a =[1.000000000000000  -1.988892905899653   0.988954249933127] */
        a1_fx = 1067778748l /* 1.988892905899653 Q29*/;
        a2_fx = -530940770l /*-0.988954249933127 Q29*/;
        b1_fx = -1067795215l /*-1.988923577916390 Q29*/;
        b2_fx = 533897608l /* 0.994461788958195 Q29*/;
        a1_fx = 2135557497 /* 1.988892905899653 Q30*/;
        a2_fx = -1061881540 /*-0.988954249933127 Q30*/;
        b1_fx = -2135590430 /*-1.988923577916390 Q30*/;
        b2_fx = 1067795215 /* 0.994461788958195 Q30*/;
    }
    ELSE IF( EQ_32( Fs, 32000 ) )
    {
@@ -428,10 +424,10 @@ void hp20_fx_32(
           [b,a] = butter(2, 20.0/16000.0, 'high');
           b =[0.997227049904470  -1.994454099808940   0.997227049904470]
           a =[1.000000000000000  -1.994446410541927   0.994461789075954]*/
        a1_fx = 1070760263l /* 1.994446410541927 Q29*/;
        a2_fx = -533897608l /*-0.994461789075954 Q29*/;
        b1_fx = -1070764392l /*-1.994454099808940 Q29*/;
        b2_fx = 535382196l /* 0.997227049904470 Q29*/;
        a1_fx = 2141520527 /* 1.994446410541927 Q30*/;
        a2_fx = -1067795215 /*-0.994461789075954 Q30*/;
        b1_fx = -2141528783 /*-1.994454099808940 Q30*/;
        b2_fx = 1070764392 /* 0.997227049904470 Q30*/;
    }
    ELSE
    {
@@ -439,10 +435,10 @@ void hp20_fx_32(
           [b,a] = butter(2, 20.0/24000.0, 'high');
           b =[ 0.998150511190452  -1.996301022380904   0.998150511190452]
           a =[1.000000000000000  -1.996297601769122   0.996304442992686]*/
        a1_fx = 1071754114l /* 1.996297601769122 Q29*/;
        a2_fx = -534886875l /*-0.996304442992686 Q29*/;
        b1_fx = -1071755951l /*-1.996301022380904 Q29*/;
        b2_fx = 535877975l /* 0.998150511190452 Q29*/;
        a1_fx = 2143508228 /* 1.996297601769122 Q30*/;
        a2_fx = -1069773750 /*-0.996304442992686 Q30*/;
        b1_fx = -2143511901 /*-1.996301022380904 Q30*/;
        b2_fx = 1071755951 /* 0.998150511190452 Q30*/;
    }
    move32();
    move32();
@@ -451,24 +447,24 @@ void hp20_fx_32(
    Word64 W_sum, W_y0, W_y1, W_y2;
    Word32 x0, x1, x2;

    W_sum = W_mult_32_32( b2_fx, mem_fx[2] );       /* b2*x2 */
    W_sum = W_mac_32_32( W_sum, b1_fx, mem_fx[3] ); /* b1*x1 */
    W_sum = W_mult0_32_32( b2_fx, mem_fx[2] );                 /* b2*x2 */
    W_sum = W_add( W_sum, W_mult0_32_32( b1_fx, mem_fx[3] ) ); /* b1*x1 */
    x2 = L_shr( signal_fx[0], prescale );
    W_sum = W_mac_32_32( W_sum, b2_fx, x2 );        /* b2*x0 */
    W_sum = W_mac_32_32( W_sum, mem_fx[0], a2_fx ); /* y2*a2 */
    W_sum = W_mac_32_32( W_sum, mem_fx[1], a1_fx ); /* y1*a1 */
    W_y2 = W_shl( W_sum, HP20_COEFF_SCALE );
    signal_fx[0] = W_extract_h( W_shl( W_y2, prescale ) );
    W_sum = W_add( W_sum, W_mult0_32_32( b2_fx, x2 ) );        /* b2*x0 */
    W_sum = W_add( W_sum, W_mult0_32_32( mem_fx[0], a2_fx ) ); /* y2*a2 */
    W_sum = W_add( W_sum, W_mult0_32_32( mem_fx[1], a1_fx ) ); /* y1*a1 */
    W_y2 = W_shl( W_sum, 1 + HP20_FX_COEFF_SCALE );
    signal_fx[0] = W_round64_L( W_shl( W_y2, prescale ) );
    move32();

    W_sum = W_mult_32_32( b2_fx, mem_fx[3] ); /* b2*x2 */
    W_sum = W_mac_32_32( W_sum, b1_fx, x2 );  /* b1*x1 */
    W_sum = W_mult0_32_32( b2_fx, mem_fx[3] );          /* b2*x2 */
    W_sum = W_add( W_sum, W_mult0_32_32( b1_fx, x2 ) ); /* b1*x1 */
    x1 = L_shr( signal_fx[1], prescale );
    W_sum = W_mac_32_32( W_sum, b2_fx, x1 );                  /* b2*x0 */
    W_sum = W_mac_32_32( W_sum, mem_fx[1], a2_fx );           /* y2*a2 */
    W_sum = W_mac_32_32( W_sum, W_extract_h( W_y2 ), a1_fx ); /* y1*a1 */
    W_y1 = W_shl( W_sum, HP20_COEFF_SCALE );
    signal_fx[1] = W_extract_h( W_shl( W_y1, prescale ) );
    W_sum = W_add( W_sum, W_mult0_32_32( b2_fx, x1 ) );                  /* b2*x0 */
    W_sum = W_add( W_sum, W_mult0_32_32( mem_fx[1], a2_fx ) );           /* y2*a2 */
    W_sum = W_add( W_sum, W_mult0_32_32( W_round64_L( W_y2 ), a1_fx ) ); /* y1*a1 */
    W_y1 = W_shl( W_sum, 1 + HP20_FX_COEFF_SCALE );
    signal_fx[1] = W_round64_L( W_shl( W_y1, prescale ) );
    move32();

    diff = sub( prescale_current_frame, prescale );
@@ -479,15 +475,15 @@ void hp20_fx_32(

    FOR( i = 2; i < lg; i++ )
    {
        W_sum = W_mult_32_32( b2_fx, x2 );       /* b2*x2 */
        W_sum = W_mac_32_32( W_sum, b1_fx, x1 ); /* b1*x1 */
        W_sum = W_mult0_32_32( b2_fx, x2 );                 /* b2*x2 */
        W_sum = W_add( W_sum, W_mult0_32_32( b1_fx, x1 ) ); /* b1*x1 */
        x0 = L_shr( signal_fx[i], prescale_current_frame );
        W_sum = W_mac_32_32( W_sum, b2_fx, x0 );                  /* b2*x0 */
        W_sum = W_mac_32_32( W_sum, W_extract_h( W_y2 ), a2_fx ); /* y2*a2 */
        W_sum = W_mac_32_32( W_sum, W_extract_h( W_y1 ), a1_fx ); /* y1*a1 */
        W_y0 = W_shl( W_sum, HP20_COEFF_SCALE );
        W_sum = W_add( W_sum, W_mult0_32_32( b2_fx, x0 ) );                  /* b2*x0 */
        W_sum = W_add( W_sum, W_mult0_32_32( W_round64_L( W_y2 ), a2_fx ) ); /* y2*a2 */
        W_sum = W_add( W_sum, W_mult0_32_32( W_round64_L( W_y1 ), a1_fx ) ); /* y1*a1 */
        W_y0 = W_shl( W_sum, 1 + HP20_FX_COEFF_SCALE );

        signal_fx[i] = W_extract_h( W_shl( W_y0, prescale_current_frame ) );
        signal_fx[i] = W_round64_L( W_shl( W_y0, prescale_current_frame ) );
        move32();

        x2 = x1;
@@ -501,8 +497,8 @@ void hp20_fx_32(
        move64();
    }

    mem_fx[0] = W_extract_h( W_y2 );
    mem_fx[1] = W_extract_h( W_y1 );
    mem_fx[0] = W_round64_L( W_y2 );
    mem_fx[1] = W_round64_L( W_y1 );
    mem_fx[2] = x2;
    mem_fx[3] = x1;

@@ -513,7 +509,7 @@ void hp20_fx_32(

    return;
}
#else
#endif
void hp20_fx_32(
    Word32 signal_fx[],
    const Word16 lg,
@@ -698,4 +694,3 @@ void hp20_fx_32(

    return;
}
#endif
+2 −0
Original line number Diff line number Diff line
@@ -106,7 +106,9 @@

#define FIX_1962_FORMAT_CONV_SPECTRAL_DIFF                   /* FhG: Improved precision of targetEnergy in ivas_ls_setup_conversion_process_mdct_fx() */
#define FIX_2003_CON_TCX_OVERFLOW                            /* FhG: Use a dynamic scaling factor for the synth buffer at the output of con_tcx_ivas_fx() */
#define HP20_FIX32_RECODING                                  /* FhG: optimized hp20_fx_32 calculation and applied it as hp20_fx_32_opt in decoder */
#define OPT_TCXLTP_FILTER_LOOP                               /* FhG: optimize loop in tcx_ltp_synth_filter */
#define FIX_2049_DIFF_IN_DECORR_TAIL                         /* FhG: correct scale values in ivas_dirac_dec_binaural_process_output_fx() */
#define FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE                  /* Dolby/FhG: fix for issue 2026: Saturation in SWB TBE re-scaling function preventing StereoDownmix complexity job to complete */
#define FIX_1785_NONBE_ASSERT_IN_IVAS_JBM_DEC_RENDER_FX      /* Orange: 10ms Rendering: Assert in ivas_jbm_dec_render_fx() -> scale_sig32 */

+8 −0
Original line number Diff line number Diff line
@@ -10490,6 +10490,14 @@ void hp20_fx_32(
    Word32 mem_fx[],
    const Word32 Fs );
#ifdef HP20_FIX32_RECODING
void hp20_fx_32_opt(
    Word32 signal_fx[],
    const Word16 lg,
    Word32 mem_fx[],
    const Word32 Fs );
#endif
void getTCXMode_ivas_fx(
    Decoder_State *st,    /* i/o: decoder memory state                */
    Decoder_State *st0,   /* i  : bitstream                           */
+36 −0
Original line number Diff line number Diff line
@@ -159,7 +159,11 @@ ivas_error ivas_jbm_dec_tc_fx(
        /* HP filtering */
        FOR( n = 0; n < s_min( nchan_out, st_ivas->nchan_transport ); n++ )
        {
#ifdef HP20_FIX32_RECODING
            hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
#else
            hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
#endif
        }
    }
    ELSE IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) )
@@ -226,7 +230,11 @@ ivas_error ivas_jbm_dec_tc_fx(
            }

            /* HP filtering */
#ifdef HP20_FIX32_RECODING
            hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
#else
            hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
#endif
        }

        test();
@@ -577,7 +585,11 @@ ivas_error ivas_jbm_dec_tc_fx(
        /* HP filtering */
        FOR( n = 0; n < nchan_remapped; n++ )
        {
#ifdef HP20_FIX32_RECODING
            hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
#else
            hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
#endif
        }

        IF( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) )
@@ -770,7 +782,11 @@ ivas_error ivas_jbm_dec_tc_fx(

        FOR( n = 0; n < getNumChanSynthesis( st_ivas ); n++ )
        {
#ifdef HP20_FIX32_RECODING
            hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
#else
            hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
#endif
        }

        Word16 output_q = 11;
@@ -1009,7 +1025,11 @@ ivas_error ivas_jbm_dec_tc_fx(
        /* HP filtering */
        FOR( n = 0; n < getNumChanSynthesis( st_ivas ); n++ )
        {
#ifdef HP20_FIX32_RECODING
            hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
#else
            hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
#endif
        }

        nchan_remapped = ivas_sba_remapTCs_fx( &p_output_fx[sba_ch_idx], st_ivas, output_frame );
@@ -1122,7 +1142,11 @@ ivas_error ivas_jbm_dec_tc_fx(
            {
                IF( NE_16( n, LFE_CHANNEL ) )
                {
#ifdef HP20_FIX32_RECODING
                    hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
#else
                    hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
#endif
                }
            }

@@ -1180,7 +1204,11 @@ ivas_error ivas_jbm_dec_tc_fx(
            {
                IF( NE_16( n, LFE_CHANNEL ) )
                {
#ifdef HP20_FIX32_RECODING
                    hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
#else
                    hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
#endif
                }
            }

@@ -1246,7 +1274,11 @@ ivas_error ivas_jbm_dec_tc_fx(
            /* HP filtering */
            FOR( n = 0; n < st_ivas->nchan_transport; n++ )
            {
#ifdef HP20_FIX32_RECODING
                hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
#else
                hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
#endif
            }

            /* Rendering */
@@ -1460,7 +1492,11 @@ ivas_error ivas_jbm_dec_tc_fx(
            /* HP filtering */
            FOR( n = 0; n < getNumChanSynthesis( st_ivas ); n++ )
            {
#ifdef HP20_FIX32_RECODING
                hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
#else
                hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
#endif
            }

            IF( EQ_32( st_ivas->renderer_type, RENDERER_MCMASA_MONO_STEREO ) )
+89 −14
Original line number Diff line number Diff line
@@ -109,8 +109,11 @@ typedef struct parambin_rend_config_data
 *------------------------------------------------------------------------*/

static void ivas_dirac_dec_binaural_internal_fx( Decoder_Struct *st_ivas, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, Word32 *output_f[] /*Q11*/, const Word16 nchan_transport, const Word16 subframe );

#ifdef FIX_2049_DIFF_IN_DECORR_TAIL
static void ivas_dirac_dec_decorrelate_slot_fx( DIRAC_DEC_BIN_HANDLE hDiracDecBin, const Word16 num_freq_bands, const Word16 slot, Word32 inRe[][CLDFB_SLOTS_PER_SUBFRAME] /*q_inp*/[CLDFB_NO_CHANNELS_MAX], Word32 inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX] /*q_inp*/, Word16 q_inp, Word32 decRe[][CLDFB_NO_CHANNELS_MAX], Word32 decIm[][CLDFB_NO_CHANNELS_MAX], Word16 *q_out );
#else
static void ivas_dirac_dec_decorrelate_slot_fx( DIRAC_DEC_BIN_HANDLE hDiracDecBin, const Word16 num_freq_bands, const Word16 slot, Word32 inRe[][CLDFB_SLOTS_PER_SUBFRAME] /*q_inp*/[CLDFB_NO_CHANNELS_MAX], Word32 inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX] /*q_inp*/, Word16 q_inp, Word32 decRe[][CLDFB_NO_CHANNELS_MAX] /*q_inp*/, Word32 decIm[] /*q_inp*/[CLDFB_NO_CHANNELS_MAX] );
#endif

static void ivas_dirac_dec_binaural_formulate_input_covariance_matrices_fx( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, Word32 inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word32 inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const Word16 subframe, Word32 *subFrameTotalEne, Word16 *subFrameTotalEne_e, Word32 *IIReneLimiter, Word16 q );

@@ -1261,8 +1264,15 @@ static void ivas_dirac_dec_decorrelate_slot_fx(
    Word32 inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /*q_inp*/
    Word32 inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /*q_inp*/
    Word16 q_inp,
#ifdef FIX_2049_DIFF_IN_DECORR_TAIL
    Word32 decRe[][CLDFB_NO_CHANNELS_MAX],
    Word32 decIm[][CLDFB_NO_CHANNELS_MAX],
    Word16 *q_out
#else
    Word32 decRe[][CLDFB_NO_CHANNELS_MAX], /*q_inp*/
    Word32 decIm[][CLDFB_NO_CHANNELS_MAX] /*q_inp*/ )
    Word32 decIm[][CLDFB_NO_CHANNELS_MAX]  /*q_inp*/
#endif
)
{
    Word16 offset, ch, bin;
    Word32 onset_filter_fx[BINAURAL_CHANNELS * CLDFB_NO_CHANNELS_MAX];                     /* 2 ch, 60 bins */
@@ -1314,7 +1324,11 @@ static void ivas_dirac_dec_decorrelate_slot_fx(
            move32();
        }
    }
#ifdef FIX_2049_DIFF_IN_DECORR_TAIL
    *q_out = q_decorrelatedFrameInterleaved;
#else
    // q_decorrelatedFrameInterleaved will be same as q_inp/q_protoFrame //
#endif
    return;
}

@@ -2734,8 +2748,11 @@ static void ivas_dirac_dec_binaural_process_output_fx(
    move16();
    move16();
    move16();

#ifdef FIX_2049_DIFF_IN_DECORR_TAIL
    Word32 decSlotRe_fx[CLDFB_SLOTS_PER_SUBFRAME][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX], decSlotIm_fx[CLDFB_SLOTS_PER_SUBFRAME][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX];
#else
    Word32 decSlotRe_fx[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX], decSlotIm_fx[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX];
#endif
    Word32 outSlotRe_fx[CLDFB_NO_CHANNELS_MAX], outSlotIm_fx[CLDFB_NO_CHANNELS_MAX];
    Word16 q_inp[6][CLDFB_SLOTS_PER_SUBFRAME];
    Word16 interpVal_fx;
@@ -2745,7 +2762,11 @@ static void ivas_dirac_dec_binaural_process_output_fx(
    move16();
    Word16 ch_len = s_max( 4, numInChannels );
    Word16 eff_q;

#ifdef FIX_2049_DIFF_IN_DECORR_TAIL
    Word16 q_decSlot[CLDFB_SLOTS_PER_SUBFRAME];
    Word16 q_decSlotMin = 31;
    move16();
#endif

    IF( processReverb )
    {
@@ -2792,15 +2813,55 @@ static void ivas_dirac_dec_binaural_process_output_fx(
            move16();
        }

#ifdef FIX_2049_DIFF_IN_DECORR_TAIL
        IF( !hDiracDecBin->useTdDecorr && ( max_band_decorr > 0 ) )
        {
            FOR( slot = 0; slot < nSlots; slot++ )
            {
                ivas_dirac_dec_decorrelate_slot_fx( hDiracDecBin, nBins, slot, inRe_fx, inIm_fx, q_input, decSlotRe_fx[slot], decSlotIm_fx[slot], &q_decSlot[slot] );

                Word16 scf = s_min( getScaleFactor32( decSlotRe_fx[slot][0], nBins ), getScaleFactor32( decSlotRe_fx[slot][1], nBins ) );
                scf = s_min( scf, getScaleFactor32( decSlotIm_fx[slot][0], nBins ) );
                scf = s_min( scf, getScaleFactor32( decSlotIm_fx[slot][1], nBins ) );

                scale_sig32( decSlotRe_fx[slot][0], nBins, scf );
                scale_sig32( decSlotRe_fx[slot][1], nBins, scf );
                scale_sig32( decSlotIm_fx[slot][0], nBins, scf );
                scale_sig32( decSlotIm_fx[slot][1], nBins, scf );
                q_decSlot[slot] += scf;

                q_decSlotMin = s_min( q_decSlotMin, q_decSlot[slot] );
            }

            Word16 q_tmp = add( q_input, sub( add( q_inp_mix, q_mat ), hDiracDecBin->q_processMtxPrev ) );
            Word16 q_shift = sub( q_decSlotMin, q_tmp );

            IF( GT_32( q_decSlotMin, q_tmp ) )
            {
                q_decSlotMin = sub( q_decSlotMin, q_shift );
            }
            ELSE
            {
                q_inp_mix = add( q_inp_mix, q_shift );
                cldfb_state_shift = add( cldfb_state_shift, q_shift );
            }

            FOR( Word16 ch = 0; ch < BINAURAL_CHANNELS; ch++ )
            {
                FOR( slot = 0; slot < nSlots; slot++ )
                {
                    scale_sig32( decSlotRe_fx[slot][ch], nBins, sub( q_decSlotMin, q_decSlot[slot] ) );
                    scale_sig32( decSlotIm_fx[slot][ch], nBins, sub( q_decSlotMin, q_decSlot[slot] ) );
                }
            }
        }
#endif
        eff_q = sub( add( q_inp_mix, q_mat ), 15 );

        FOR( Word16 i = 0; i < ch_len; i++ )

        {
            FOR( Word16 j = 0; j < nSlots; j++ )
            {

                scale_sig32( inRe_fx[i][j], nBins, q_inp_mix ); /*q_input + q_inp_mix*/
                scale_sig32( inIm_fx[i][j], nBins, q_inp_mix ); /*q_input + q_inp_mix*/
                test();
@@ -2853,19 +2914,31 @@ static void ivas_dirac_dec_binaural_process_output_fx(
        {
            if ( recompute == 1 )
            {
#ifndef FIX_2049_DIFF_IN_DECORR_TAIL
                ivas_dirac_dec_decorrelate_slot_fx( hDiracDecBin, nBins, slot, inRe_fx, inIm_fx, q_inp_mix, decSlotRe_fx, decSlotIm_fx );
#endif
                FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ )
                {
#ifdef FIX_2049_DIFF_IN_DECORR_TAIL
                    Copy32( decSlotRe_fx[slot][chA], decorrRe_fx[chA][slot], CLDFB_NO_CHANNELS_MAX );
                    Copy32( decSlotIm_fx[slot][chA], decorrIm_fx[chA][slot], CLDFB_NO_CHANNELS_MAX );
#else
                    Copy32( decSlotRe_fx[chA], decorrRe_fx[chA][slot], CLDFB_NO_CHANNELS_MAX );
                    Copy32( decSlotIm_fx[chA], decorrIm_fx[chA][slot], CLDFB_NO_CHANNELS_MAX );
#endif
                }
            }
            else
            {
                FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ )
                {
#ifdef FIX_2049_DIFF_IN_DECORR_TAIL
                    Copy32( decorrRe_fx[chA][slot], decSlotRe_fx[slot][chA], CLDFB_NO_CHANNELS_MAX );
                    Copy32( decorrIm_fx[chA][slot], decSlotIm_fx[slot][chA], CLDFB_NO_CHANNELS_MAX );
#else
                    Copy32( decorrRe_fx[chA][slot], decSlotRe_fx[chA], CLDFB_NO_CHANNELS_MAX );
                    Copy32( decorrIm_fx[chA][slot], decSlotIm_fx[chA], CLDFB_NO_CHANNELS_MAX );
#endif
                }
            }
        }
@@ -2893,8 +2966,13 @@ static void ivas_dirac_dec_binaural_process_output_fx(
                    }
                    ELSE
                    {
#ifdef FIX_2049_DIFF_IN_DECORR_TAIL
                        decSlotRePointer_fx = decSlotRe_fx[slot][chB];
                        decSlotImPointer_fx = decSlotIm_fx[slot][chB];
#else
                        decSlotRePointer_fx = decSlotRe_fx[chB];
                        decSlotImPointer_fx = decSlotIm_fx[chB];
#endif
                    }
                }
                ELSE
@@ -2903,7 +2981,6 @@ static void ivas_dirac_dec_binaural_process_output_fx(
                    decSlotImPointer_fx = NULL;
                }


                FOR( bin = 0; bin < nBins; bin++ )
                {
                    Word16 gain;
@@ -2916,11 +2993,9 @@ static void ivas_dirac_dec_binaural_process_output_fx(
                    move32();

                    gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxImPrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxIm_fx[chA][chB][bin] ) ); // Q11

                    // interpVal * hDiracDecBin->processMtxIm[chA][chB][bin];
                    outSlotRe_fx[bin] = Msub_32_16( outSlotRe_fx[bin], inIm_fx[chB][slot][bin], gain ); // q_inp_mix-4//q_result
                    outSlotIm_fx[bin] = Madd_32_16( outSlotIm_fx[bin], inRe_fx[chB][slot][bin], gain ); // q_inp_mix-4//q_result

                    move32();
                    move32();

@@ -2930,13 +3005,14 @@ static void ivas_dirac_dec_binaural_process_output_fx(
                    {
                        gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxDecRePrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxDecRe_fx[chA][chB][bin] ) ); // Q11
                        // interpVal * hDiracDecBin->processMtxDecRe[chA][chB][bin];

                        outSlotRe_fx[bin] = Madd_32_16( outSlotRe_fx[bin], decSlotRePointer_fx[bin], gain ); // q_inp_mix-4//q_result
                        outSlotIm_fx[bin] = Madd_32_16( outSlotIm_fx[bin], decSlotImPointer_fx[bin], gain ); // q_inp_mix-4//q_result
                        move32();
                        move32();


                        gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxDecImPrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxDecIm_fx[chA][chB][bin] ) ); // Q11

                        outSlotRe_fx[bin] = Msub_32_16( outSlotRe_fx[bin], decSlotImPointer_fx[bin], gain ); // q_inp_mix-4//q_result
                        outSlotIm_fx[bin] = Madd_32_16( outSlotIm_fx[bin], decSlotRePointer_fx[bin], gain ); // q_inp_mix-4//q_result
                        move32();
@@ -2945,7 +3021,6 @@ static void ivas_dirac_dec_binaural_process_output_fx(
                }
            }


            IF( processReverb )
            {
                /* Combine second (reverb) part with the first (HRTF) part to obtain binaural output signal with room effect */
@@ -2953,7 +3028,6 @@ static void ivas_dirac_dec_binaural_process_output_fx(
                v_add_fx( outSlotIm_fx, reverbIm_fx[chA][slot], outSlotIm_fx, CLDFB_NO_CHANNELS_MAX );
            }


            outSlotRePr_fx = &( outSlotRe_fx[0] );
            outSlotImPr_fx = &( outSlotIm_fx[0] );

@@ -2974,6 +3048,7 @@ static void ivas_dirac_dec_binaural_process_output_fx(
            }
        }
    }

    if ( recompute == 1 )
    {
        *q_out = sub( q_result, 1 );