Commit f6b93d76 authored by norvell's avatar norvell
Browse files

Merge branch 'main' into ci/add-long-term-logs

parents 5bd99fde 7538f7ea
Loading
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -114,6 +114,8 @@

#define FIX_1740_MISING_POP_WMOPS               /* VA: fix issue 1740: missing pop_wmops() */

#define FIX_ISSUE_1744_IVAS_SPAR_TO_DIRAC       /* FhG: NON-BE!!! Simplify azimuth & elevation calculations, remove parameter mismatch for divide3232, fix copy/paste error for elevation */
#define FIX_ISSUE_1744_IVAS_DIRAC_GET_MONO_FLAG /* FhG: NON-BE!!! Simplify threshold - comparison, change (wrong) Equal-comparion to (correct) Greater-Than-comparison */
#define NONBE_FIX_864_JBM_RENDER_FRAMESIZE                    /* FhG: issue #864: fix different behaviour of JBM TSM with different render frame sizes */

#define FIX_1762_COMPILER_ISSUE                 /* FhG: fix compiler issues with W_mac_32_32() + ONE_IN_Q30 */
@@ -124,8 +126,19 @@
#define FIX_1735_W_SHL_SAT_L                    /* FhG: Usage of W_shl_sat_l() */
#define FIX_ISSUE_1792                          /* FhG: fix noise bursts in binaural rendering */

/* Info for issue 1816:
 * Some compilers do not automatically use 32 bit for 16x16bit products. The code "Word32 c = (Word16) a * (Word16) b;" creates then a 16-bit result, sign-extending the
 * lower 16-bit of the product, any upper bits are omitted. Example: Product 0x0100 * 0x0100 results in 0x0001.0000, gets truncated to its lower bits and return 0x0000.
 * The issue is fixed by simply casting one of the product operands to Word32 in lib_com/basop32.c
 */
#define FIX_ISSUE_1816_USE_W32_FOR_MPY_W16xW16          /* FhG: (QA-FIX) Use doubled data width for 16x16 product, some compilers keep 16-bit format also for products */
#define FIX_ISSUE_1816_IMPROVE_MPY_ZERO_DOT_1_PRECISION /* FhG: (NON-BE) improve precision of multiplications with factor 0.1f, avoids overflow with up-rounded value */

#define FIX_ISSUE_1795_Q3_OVERFLOW              /* FhG: Q3 overflow in function WB_BWE_gain_pred_fx (EVS legacy code) BE, MR1855 */
#define NONBE_FIX_1748_SPAR_DIV_OPT                      /*Dlb: issue 1748: SPAR common div optimizations*/

#define FIX_ISSUE_1801_NOISE_FLOOR_REDUCTION    /* FhG: Fixed getScalefactor usage */

#define FIX_1818_WRONG_PIT_INIT                 /* VA: Fix wrong pitch initialization */

#endif
+21 −5
Original line number Diff line number Diff line
@@ -44,6 +44,9 @@
/*------------------------------------------------------------------------------------------*
 * Local constants
 *------------------------------------------------------------------------------------------*/
#ifdef FIX_ISSUE_1744_IVAS_SPAR_TO_DIRAC
#define DEG180_BY_PI_Q24 ( (Word32) 0x394BB835 ) /* 180.0/PI in Q24) */
#endif

#define IVAS_DEFAULT_DTX_CNG_RAMP ( 8 )

@@ -2959,8 +2962,13 @@ void ivas_spar_to_dirac_fx(
                radius_fx = Sqrt32( temp, &q_temp );

                Word16 check_azi_fx = BASOP_util_atan2( dvy_fx[band], dvx_fx[band], 0 ); /*Q13*/
                Word32 check_azi_fx_32 = L_shl( check_azi_fx, 16 );                      /*Q29*/

#ifdef FIX_ISSUE_1744_IVAS_SPAR_TO_DIRAC
                Word32 azi_intermediate = Mpy_32_16_1( DEG180_BY_PI_Q24, check_azi_fx );
#else
                Word16 check_azi_fx_res;
                Word32 check_azi_fx_32 = L_shl( check_azi_fx, 16 ); /*Q29*/

                IF( check_azi_fx_32 < 0 )
                {
                    check_azi_fx_res = negate( divide3232( L_negate( check_azi_fx_32 ), 1686629760 /*3.145f in Q29*/ ) ); /*Q15*/
@@ -2970,6 +2978,8 @@ void ivas_spar_to_dirac_fx(
                    check_azi_fx_res = divide3232( check_azi_fx_32, 1686629760 /*3.145f in Q29*/ ); /*Q15*/
                }
                Word32 azi_intermediate = Mpy_32_16_1( DEGREE_180_Q_22, check_azi_fx_res ); /*Q22*/
#endif

                azi_intermediate = L_add( azi_intermediate, ONE_IN_Q21 ); /*Q22*/

                Word16 azi_res;
@@ -2983,9 +2993,14 @@ void ivas_spar_to_dirac_fx(
                }

                Word16 check_ele_fx = BASOP_util_atan2( dvz_fx[band], radius_fx, sub( add( 9, q_dvnorm ), q_temp ) ); /*Q13*/
                Word32 check_ele_fx_32 = L_shl( check_ele_fx, 16 );                                                   /*Q29*/
#ifdef FIX_ISSUE_1744_IVAS_SPAR_TO_DIRAC
                Word32 ele_intermediate = Mpy_32_16_1( DEG180_BY_PI_Q24, check_ele_fx );
#else

                Word16 check_ele_fx_res;
                IF( check_azi_fx_32 < 0 )
                Word32 check_ele_fx_32 = L_shl( check_ele_fx, 16 ); /*Q29*/

                IF( check_ele_fx_32 < 0 )
                {
                    check_ele_fx_res = negate( divide3232( L_negate( check_ele_fx_32 ), 1686629760 /*3.145f in Q29*/ ) ); /*Q15*/
                }
@@ -2994,6 +3009,7 @@ void ivas_spar_to_dirac_fx(
                    check_ele_fx_res = divide3232( check_ele_fx_32, 1686629760 /*3.145f in Q29*/ ); /*Q15*/
                }
                Word32 ele_intermediate = Mpy_32_16_1( DEGREE_180_Q_22, check_ele_fx_res ); /*Q22*/
#endif
                ele_intermediate = L_add( ele_intermediate, ONE_IN_Q21 ); /*Q22*/

                Word16 ele_res;
+66 −0
Original line number Diff line number Diff line
@@ -2723,6 +2723,38 @@ void swb_tbe_dec_fx(
        exp = 0;
        move16();
    }
#ifdef FIX_ISSUE_1816_IMPROVE_MPY_ZERO_DOT_1_PRECISION
    /*
       code for EVS and IVAS are basically identical with the exception of i_mult_sat() which has precision issues
       thus is was replaced for IVAS and kept for EVS, in order to keep EVS BE to test sequences and legacy implementations
    */
    IF( EQ_16( st_fx->element_mode, EVS_MONO ) )
    {
        FOR( ; i < L_SHB_LAHEAD + 10; i++ )
        {
            temp = i_mult_sat( sub( i, 19 ), 3277 /*0.1f Q15*/ );        /* Q15 */
            L_tmp1 = Mult_32_16( L_shl_sat( 1, sub( 31, exp ) ), temp ); /* Q31-exp */
            temp = sub( 32767 /*1.0f Q15*/, temp );
            Lscale = L_add( Mult_32_16( Lscale, temp ), L_tmp1 );
            L_tmp = Mult_32_16( Lscale, shaped_shb_excitation[i] );     /* Q_bwe_exc + (31-exp) - 15 */
            shaped_shb_excitation[i] = round_fx( L_shl( L_tmp, exp ) ); /* Q_bwe_exc */
            move16();
        }
    }
    ELSE
    {
        FOR( ; i < L_SHB_LAHEAD + 10; i++ )
        {
            temp = round_fx_sat( L_shl( L_mult( 0x6666 /* 0.1 in Q12 */, shl( sub( i, 19 ), 11 ) ), 1 ) );
            L_tmp1 = Mult_32_16( L_shl_sat( 1, sub( 31, exp ) ), temp ); /* Q31-exp */
            temp = sub( 32767 /*1.0f Q15*/, temp );
            Lscale = L_add( Mult_32_16( Lscale, temp ), L_tmp1 );
            L_tmp = Mult_32_16( Lscale, shaped_shb_excitation[i] );     /* Q_bwe_exc + (31-exp) - 15 */
            shaped_shb_excitation[i] = round_fx( L_shl( L_tmp, exp ) ); /* Q_bwe_exc */
            move16();
        }
    }
#else
    FOR( ; i < L_SHB_LAHEAD + 10; i++ )
    {
        temp = i_mult_sat( sub( i, 19 ), 3277 /*0.1f Q15*/ );        /* Q15 */
@@ -2733,6 +2765,7 @@ void swb_tbe_dec_fx(
        shaped_shb_excitation[i] = round_fx( L_shl( L_tmp, exp ) ); /* Q_bwe_exc */
        move16();
    }
#endif

    /* Update SHB excitation */
    Copy( shaped_shb_excitation + L_FRAME16k, hBWE_TD->state_syn_shbexc_fx, L_SHB_LAHEAD ); /* Q_bwe_exc */
@@ -6285,6 +6318,13 @@ void ivas_swb_tbe_dec_fx(
            exp = 0;
            move16();
        }
#ifdef FIX_ISSUE_1816_IMPROVE_MPY_ZERO_DOT_1_PRECISION
        /*
           code for EVS and IVAS are basically identical with the exception of i_mult_sat() which has precision issues
           thus is was replaced for IVAS and kept for EVS, in order to keep EVS BE to test sequences and legacy implementations
        */
        IF( EQ_16( st->element_mode, EVS_MONO ) )
        {
            FOR( ; i < L_SHB_LAHEAD + 10; i++ )
            {
                temp_fx = i_mult_sat( sub( i, 19 ), 3277 /*0.1f Q15*/ );        /* Q15 */
@@ -6297,6 +6337,32 @@ void ivas_swb_tbe_dec_fx(
            }
        }
        ELSE
        {
            FOR( ; i < L_SHB_LAHEAD + 10; i++ )
            {
                temp_fx = round_fx_sat( L_shl( L_mult( 0x6666 /* 0.1 in Q12 */, shl( sub( i, 19 ), 11 ) ), 1 ) );
                L_tmp1 = Mult_32_16( L_shl_sat( 1, sub( 31, exp ) ), temp_fx ); /* Q31-exp */
                temp_fx = sub( 32767 /*1.0f Q15*/, temp_fx );
                Lscale = L_add( Mult_32_16( Lscale, temp_fx ), L_tmp1 );
                L_tmp = Mult_32_16( Lscale, shaped_shb_excitation_fx[i] );             /* Q_bwe_exc + (31-exp) - 15 */
                shaped_shb_excitation_fx[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */
                move16();
            }
        }
#else
        FOR( ; i < L_SHB_LAHEAD + 10; i++ )
        {
            temp_fx = i_mult_sat( sub( i, 19 ), 3277 /*0.1f Q15*/ );        /* Q15 */
            L_tmp1 = Mult_32_16( L_shl_sat( 1, sub( 31, exp ) ), temp_fx ); /* Q31-exp */
            temp_fx = sub( 32767 /*1.0f Q15*/, temp_fx );
            Lscale = L_add( Mult_32_16( Lscale, temp_fx ), L_tmp1 );
            L_tmp = Mult_32_16( Lscale, shaped_shb_excitation_fx[i] );             /* Q_bwe_exc + (31-exp) - 15 */
            shaped_shb_excitation_fx[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */
            move16();
        }
#endif
    }
    ELSE
    {
        /* reset the PF memories if the PF is not running */
        set16_fx( hBWE_TD->mem_stp_swb_fx, 0, LPC_SHB_ORDER );
+12 −3
Original line number Diff line number Diff line
@@ -282,8 +282,11 @@ void core_switching_pre_enc_fx(

        tmp16 = shr( st_fx->L_frame, 6 );
        Copy( st_fx->old_pitch_buf_fx + tmp16, st_fx->old_pitch_buf_fx, tmp16 ); /*Q6*/
#ifdef FIX_1818_WRONG_PIT_INIT
        set16_fx( st_fx->old_pitch_buf_fx + tmp16, L_SUBFR << 6, tmp16 );
#else
        set16_fx( st_fx->old_pitch_buf_fx + tmp16, L_SUBFR, tmp16 );

#endif
        /* Reset old TD BWE buffers */
        IF( hBWE_TD != NULL )
        {
@@ -851,8 +854,11 @@ void core_switching_pre_enc_ivas_fx(
        }

        Copy( st_fx->old_pitch_buf_fx + tmp16, st_fx->old_pitch_buf_fx, tmp16 );
#ifdef FIX_1818_WRONG_PIT_INIT
        set16_fx( st_fx->old_pitch_buf_fx + tmp16, L_SUBFR << 6, tmp16 );
#else
        set16_fx( st_fx->old_pitch_buf_fx + tmp16, L_SUBFR, tmp16 );

#endif
        /* Reset old ACELP buffers */
        test();
        IF( ( st_fx->element_mode == EVS_MONO ) && hLPDmem != NULL )
@@ -902,8 +908,11 @@ void core_switching_pre_enc_ivas_fx(

        tmp16 = shr( st_fx->L_frame, 6 );
        Copy( st_fx->old_pitch_buf_fx + tmp16, st_fx->old_pitch_buf_fx, tmp16 );
#ifdef FIX_1818_WRONG_PIT_INIT
        set16_fx( st_fx->old_pitch_buf_fx + tmp16, L_SUBFR << 6, tmp16 );
#else
        set16_fx( st_fx->old_pitch_buf_fx + tmp16, L_SUBFR, tmp16 );

#endif
        /* Reset old TD BWE buffers */
        IF( hBWE_TD != NULL )
        {
+13 −1
Original line number Diff line number Diff line
@@ -660,7 +660,18 @@ static Word16 ivas_dirac_get_mono_flag_fx(
                    move32();
                    move16();
                }

#ifdef FIX_ISSUE_1744_IVAS_DIRAC_GET_MONO_FLAG
                IF( BASOP_Util_Cmp_Mant32Exp( W_band_power, W_band_power_e, Mpy_32_32( other_ch_band_power, threshold ), other_ch_band_power_e + threshold_e ) == 1 )
                {
                    any_mono_band = 1;
                    move16();
                }
                ELSE
                {
                    any_mc_band = 1;
                    move16();
                }
#else
                IF( BASOP_Util_Cmp_Mant32Exp( divide3232( W_band_power, other_ch_band_power ), 31, threshold, threshold_e ) == 0 )
                {
                    any_mono_band = 1;
@@ -671,6 +682,7 @@ static Word16 ivas_dirac_get_mono_flag_fx(
                    any_mc_band = 1;
                    move16();
                }
#endif
            }
        }
    }
Loading