Commit 6f31d186 authored by Mohammadreza Naghibzadeh's avatar Mohammadreza Naghibzadeh
Browse files

Merge remote-tracking branch 'origin/main' into 1942_fix_assertion_reverb

parents fbd18ffc 480834a3
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -146,6 +146,8 @@
#define FIX_587_DEFAULT_REVERB                          /* Philips: issue 587: inconsistent default reverb parameters across renderers */
#define NONBE_FIX_1097_SBA_DTX_BRATE_SWITCHING_ENC      /* FhG: fix out-of-bound errors when switching from SID frame to active frame*/
#define NONBE_FIX_1052_SBA_EXT_FIX                      /* VA: SBA external output support fix - do not overwrite "output_config" parameter */

#define FIX_1129_EXT_REND_OUTPUT_HIGH                   /* Philips: issue 1129: External renderer BINAURAL_ROOM_REVERB format output level too high compared to internal rendering output */
#define NONBE_1289_STEREO_SW_TO_MONO                    /* VA: issue 1289: Fix glitch when stereo signal is decoded to mono n TD->DFT switching */
#define NONBE_FIX_1196_TD_HEADTRACKING_INTERPOLATION    /* Ericsson: Issue 1196, Always apply filter interpolation for each subframe */
#define NONBE_FIX_1110_STEREO_DTX_BRATE_SWITCHING       /* VA: issue 1110: fix encoder crash in the stereo DTX bitrate switching condition */
@@ -169,8 +171,10 @@
#define NONBE_1293_SR_HRTF                              /* VA: issue 1293: add support of external HRTFs in split rendering */
#define FIX_1249_REMOVE_OBSOLETE_ALLRAD_MATRIX          /* VA: issue 1249: remove obsolete code around ALLRAD decoder matrix */
#define NONBE_1220_OMASA_JBM_BRATE_SW_FLUSH             /* VA: issue 1220: fix bug in renderer flush in OMASA 1ISM JBM bitrate switching */
#define NONBE_1118_EVS_LR_HQ_BITERROR                   /* VA: issue 1118: fix EVS decoder crash in LR-HQ in case of bit errors */
#define FIX_1139_REV_COLORATION_SHORT_T60               /* Nokia,FhG: Fix issue 1139, prevent sound coloration artefacts at very low reverberation times */

#define FIX_1959_assert_in_gain_enc_mless_fx            /* VA: Fix saturation introduced by the usage of the non-EVS basop operators =, the saturation was expected */
/* #################### End BASOP porting switches ############################ */

#endif
+23 −0
Original line number Diff line number Diff line
@@ -629,10 +629,33 @@ void hq_lr_dec_fx(

            IF( GE_16( i, highband ) )
            {

#ifdef NONBE_1118_EVS_LR_HQ_BITERROR
                /* safety check in case of bit errors */
                IF( GT_32( Ep_fx[i], 536788991 /* max(Q30) */ ) )
                {
                    st_fx->BER_detect = 1;
                    move16();
                    set32_fx( L_yout, 0, inner_frame );
                    return;
                }

#endif
                enerH_fx = L_add_sat( enerH_fx, L_shl_sat( Ep_fx[i], 2 ) ); /*Q0 */
            }
            ELSE IF( GE_16( i, lowband ) )
            {
#ifdef NONBE_1118_EVS_LR_HQ_BITERROR
                /* safety check in case of bit errors */
                IF( GT_32( Ep_fx[i], 536788991 /* max(Q30) */ ) )
                {
                    st_fx->BER_detect = 1;
                    move16();
                    set32_fx( L_yout, 0, inner_frame );
                    return;
                }

#endif
                enerL_fx = L_add_sat( enerL_fx, L_shl_sat( Ep_fx[i], 2 ) ); /*Q0 */
            }
        }
+49 −22
Original line number Diff line number Diff line
@@ -275,6 +275,21 @@ void gain_enc_mless_fx(
    /* gain_inov = 1.0f / sqrt((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */
    L_tmp = Dot_product12( code, code, L_SUBFR, &exp_code );
    exp_inov = sub( exp_code, 18 + 6 );
#ifdef FIX_1959_assert_in_gain_enc_mless_fx
    // To avoid crash in case code value is 0,
    test();
    IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( L_tmp, exp_inov, 21474836, 0 ), -1 ) && element_mode > EVS_MONO )
    {
        // setting values to avoid extra computation
        *gain_inov = 32767; /*8(max value gain_inov can hold) in Q12*/
        Ei = -9743;         /* -38 in Q8*/
        move16();
        move16();
    }
    ELSE
#endif
    {

        exp_code = sub( exp_code, 30 );

        /*Ei = 10 * log10((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */
@@ -287,10 +302,10 @@ void gain_enc_mless_fx(
        tmp = add( 30 - 18 - 6 - 1, sub( exp_code, tmp ) ); /* exp: -18 (code in Q9), -6 (/L_SUBFR) */
        L_tmp1 = Mpy_32_16( tmp, frac, 12330 );             /* Q13 */
        Ei = round_fx( L_shl( L_tmp1, 11 ) );               /* Q8 */

#ifndef FIX_1959_assert_in_gain_enc_mless_fx
        /* predicted codebook gain */
        gcode0 = sub( Es_pred, Ei ); /* Q8 */

#endif
        /*---------------------------------------------------------------*
         * Decode codebook gain and the adaptive excitation low-pass
         * filtering factor (Finalize computation )
@@ -299,7 +314,11 @@ void gain_enc_mless_fx(
        L_tmp = Isqrt_lc( L_tmp, &exp_inov );
        *gain_inov = extract_h( L_shl( L_tmp, sub( exp_inov, 3 ) ) ); /* gain_inov in Q12 */
        move16();

    }
#ifdef FIX_1959_assert_in_gain_enc_mless_fx
    /* predicted codebook gain */
    gcode0 = sub( Es_pred, Ei ); /* Q8 */
#endif
    /* gcode0 = pow(10, 0.05 * (Es_pred - Ei)) */
    /*----------------------------------------------------------------*
     * gcode0 = pow(10.0, gcode0/20)
@@ -339,10 +358,18 @@ void gain_enc_mless_fx(
                          = ((-0.5*g_corr[3]*g_corr[0]) - (-0.25*g_corr[1]*g_corr[4]))/tmp1;
                          = ((0.25*g_corr[1]*g_corr[4]) - (0.5*g_corr[0]*g_corr[3]))/tmp1; */

#ifdef FIX_1959_assert_in_gain_enc_mless_fx
        L_tmp1 = L_mult_sat( coeff[0], coeff[2] ); /*Q31*/
#else
        L_tmp1 = L_mult( coeff[0], coeff[2] );                     /*Q31*/
#endif
        exp1 = add( exp_coeff[0], exp_coeff[2] );

#ifdef FIX_1959_assert_in_gain_enc_mless_fx
        L_tmp2 = L_shr( L_mult_sat( coeff[4], coeff[4] ), 2 ); /*Q31*/
#else
        L_tmp2 = L_shr( L_mult( coeff[4], coeff[4] ), 2 );         /*Q31*/
#endif
        exp2 = add( exp_coeff[4], exp_coeff[4] );

        IF( GT_16( exp1, exp2 ) )
+13 −0
Original line number Diff line number Diff line
@@ -3038,6 +3038,9 @@ static ivas_error updateSbaPanGains(
                    break;
                }
                case IVAS_AUDIO_CONFIG_BINAURAL:
#ifdef FIX_1129_EXT_REND_OUTPUT_HIGH
                case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB:
#endif
                {
                    if ( hRendCfg->split_rend_config.rendererSelection == ISAR_SPLIT_REND_RENDERER_SELECTION_FASTCONV )
                    {
@@ -3056,7 +3059,9 @@ static ivas_error updateSbaPanGains(
                }
                    BREAK;
                case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR:
#ifndef FIX_1129_EXT_REND_OUTPUT_HIGH
                case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB:
#endif
                    IF( NE_32( ( error = initSbaPanGainsForMcOut( inputSba, IVAS_AUDIO_CONFIG_7_1_4, NULL ) ), IVAS_ERR_OK ) )
                    {
                        return error;
@@ -8071,11 +8076,19 @@ static ivas_error renderInputSba(
                case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM:
                    error = renderSbaToSplitBinaural( sbaInput, outConfig, outAudio );
                    break;
#ifdef FIX_1129_EXT_REND_OUTPUT_HIGH
                case IVAS_AUDIO_CONFIG_BINAURAL:
                case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB:
                    error = renderSbaToBinaural( sbaInput, outConfig, outAudio );
                    break;
                case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR:
#else
                case IVAS_AUDIO_CONFIG_BINAURAL:
                    error = renderSbaToBinaural( sbaInput, outConfig, outAudio );
                    BREAK;
                case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR:
                case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB:
#endif
                    error = renderSbaToBinauralRoom( sbaInput, outConfig, outAudio );
                    BREAK;
                default: