Commit 0be82abb authored by Fabian Bauer's avatar Fabian Bauer
Browse files

Merge branch 'main' of ssh://forge.3gpp.org:29419/sa4/audio/ivas-basop into...

Merge branch 'main' of ssh://forge.3gpp.org:29419/sa4/audio/ivas-basop into 1751-replace-shl_ro-by-overflow-free-alternatives
parents 99b3f1d1 097e2392
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -71,6 +71,8 @@
#define FIX_732_MS_PERIODOG_FLOOR                /* Eri: Issue-732: Dynamic range of msPeriodog leads to minimum value 1e-5 being truncated to zero. This uses the smallest non-zero value instead. */

#define FIX_867_CLDFB_NRG_SCALE
#define FIX_1737_FIX_867_CLDFB_NRG_SCALE
#define FIX_1737_proto_fac_overflow

#define FIX_1378_ACELP_OUT_OF_BOUNDS

@@ -123,4 +125,6 @@

#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 */

#endif
+14 −2
Original line number Diff line number Diff line
@@ -2356,13 +2356,21 @@ static void param_mc_protoSignalComputation_fx(
            FOR( band = 0; band < num_freq_bands; band++ )
            {

#ifdef FIX_1737_proto_fac_overflow
                Word32 tmp_x = L_shl( Mpy_32_32( fac_fx, ( *( p_real_buffer_fx++ ) ) ), 4 ); // Q(26 + 4 + 6 - 31)  :: Q5
#else
                Word32 tmp_x = Mpy_32_32( fac_fx, ( *( p_real_buffer_fx++ ) ) );                                                                       // Q(30 + 6 - 31)  :: Q5
#endif

                *( p_proto_frame_fx ) = L_add( *( p_proto_frame_fx ), tmp_x );
                move32();
                p_proto_frame_fx++;

#ifdef FIX_1737_proto_fac_overflow
                tmp_x = L_shl( Mpy_32_32( fac_fx, ( *( p_imag_buffer_fx++ ) ) ), 4 ); // Q(26 + 4 + 6 - 31)  :: Q5
#else
                tmp_x = Mpy_32_32( fac_fx, ( *( p_imag_buffer_fx++ ) ) );                                                                              // Q(30 + 6 - 31)  :: Q5
#endif

                *( p_proto_frame_fx ) = L_add( *( p_proto_frame_fx ), tmp_x );
                move32();
@@ -3596,7 +3604,11 @@ static ivas_error param_mc_get_diff_proto_info_fx(
            {
                p_diff_proto_info->source_chan_idx[cur_diff_proto][p_diff_proto_info->num_source_chan_diff[cur_diff_proto]] = cur_transport_ch;
                move16();
#ifdef FIX_1737_proto_fac_overflow
                p_diff_proto_info->proto_fac_fx[cur_diff_proto][p_diff_proto_info->num_source_chan_diff[cur_diff_proto]] = *proto_fac_ptr; // (proto_fac_fx)Q26 = Q26
#else
                p_diff_proto_info->proto_fac_fx[cur_diff_proto][p_diff_proto_info->num_source_chan_diff[cur_diff_proto]] = L_shl( *proto_fac_ptr, 4 ); // (proto_fac_fx)Q26 + 4 = Q30
#endif
                move16();
                p_diff_proto_info->num_source_chan_diff[cur_diff_proto] = add( p_diff_proto_info->num_source_chan_diff[cur_diff_proto], 1 );
                move16();
+4 −0
Original line number Diff line number Diff line
@@ -642,7 +642,11 @@ void ivas_analy_sp_fx(
        move32();

        /* PS[i] = ( Bin_E[i] + 1e-5f + Bin_E[i + L_FFT / 2] + 1e-5f ) / 2.0f; */
#ifndef FIX_1762_COMPILER_ISSUE
        PS[i] = W_extract_h( W_add( W_mac_32_32( W_mult_32_32( Bin_E[i], ONE_IN_Q30 ), Bin_E[i + L_FFT / 2], ONE_IN_Q30 ), W_shr( W_shl( add_const, 32 ), sub( 31, *q_Bin_E ) ) ) ); // *q_Bin_E
#else
        PS[i] = W_extract_h( W_add( W_shl( W_add( W_deposit32_l( Bin_E[i] ), W_deposit32_l( Bin_E[i + L_FFT / 2] ) ), 31 ), W_shr( W_shl( add_const, 32 ), sub( 31, *q_Bin_E ) ) ) ); // *q_Bin_E
#endif
        move32();

        /* Bin_E[i] = (float) ( 10.0f * log( PS[i] ) ); */
+7 −3
Original line number Diff line number Diff line
@@ -324,7 +324,11 @@ void find_tilt_ivas_fx(
    }
    lp_bckr = W_shl_sat_l( sum, -16 );                        // q_bckr
    /*hp_bckr = 0.5f * (bckr[max_band-1] + bckr[max_band]);*/ /* estimated noise E in last 2 critical bands */
#ifndef FIX_1762_COMPILER_ISSUE
    hp_bckr = W_extract_h( W_mac_32_32( W_mult_32_32( bckr[max_band - 1], ONE_IN_Q30 ), bckr[max_band], ONE_IN_Q30 ) ); // q_bckr
#else
    hp_bckr = W_extract_h( W_shl( W_add( W_deposit32_l( bckr[max_band - 1] ), W_deposit32_l( bckr[max_band] ) ), 31 ) ); // q_bckr
#endif
    if ( hp_bckr == 0 ) /* Avoid division by zero. */
    {
        hp_bckr = L_deposit_l( 1 );
+10 −7
Original line number Diff line number Diff line
@@ -2525,7 +2525,7 @@ void gain_enc_lbr_ivas_fx(

    /*Ecode = ( dotp( code, code, L_SUBFR ) + 0.01f ) / L_SUBFR;
     *gain_inov = 1.0f / (float)sqrt(Ecode);*/
    L_tmp = Dot_product12( code, code, L_subfr, &exp_code );
    L_tmp = Dot_product12( code, code, L_subfr, &exp_code ); /* Q9 + Q9 + 1 + (30-exp_code)*/
    L_inov = L_tmp;                                          /* sets to 'L_tmp' in 1 clock */
    move32();
    /* exp_code: -18 (code in Q9), -6 (/L_SUBFR), -31 (L_tmp Q31->Q0) */
@@ -2599,12 +2599,15 @@ void gain_enc_lbr_ivas_fx(
        /*     gcode0 = (float)pow(10, dotp(b, aux, n_pred) - 0.5f * (float)log10(Ecode));
        gcode0 = (float)pow(10, dotp(b, aux, n_pred) - 0.05f * 10 * (float)log10(Ecode));
        gcode0 = (float)pow(10, 0.05(20 * dotp(b, aux, n_pred) - 10 * (float)log10(Ecode))); */

        exp_code = sub( exp_code, 18 + 6 + 1 );
        // Ecode = (Ecode / L_subfr)
        L_tmp = L_shr( L_tmp, L_subfr_sf );                     // Q19 + (Q30-exp_code)
                                                                /* Calculation for log10(Ecode) exponent for applying log10 = Q31 - q = Q31 - Q19 - Q30 + exp_code = exp_code - Q18*/
        L_tmp = BASOP_Util_Log10( L_tmp, sub( exp_code, 18 ) ); // new q = Q25
        exp = norm_l( L_tmp );
        frac = Log2_norm_lc( L_shl( L_tmp, exp ) );
        exp = sub( exp_code, exp );
        L_tmp1 = Mpy_32_16( exp, frac, 24660 ); /* Q14 */ /* 10*log10(2) in Q13*/
        L_tmp = L_shl( L_tmp, exp ); // Q25 + exp
        // 10 in Q27 , ( 10 * log10( Ecode ) )
        L_tmp1 = Mpy_32_32( L_tmp, 1342177280 ); // Q25 + exp + 1 + Q27 - 32 = Q21 + exp
        L_tmp1 = L_shr( L_tmp1, add( 7, exp ) ); // Q21 + exp - 7 - exp = Q14

        L_tmp = Dot_product( b, aux, n_pred ); /*Q25*/
        L_tmp = Mult_32_16( L_tmp, 320 );      /*Q14, 20 in Q4*/
Loading