Commit 7f4c7817 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'fix_for_few_high_MLD_cases' into 'main'

Fix for few high MLD cases

See merge request !551
parents f09d4d0d d8de2d6b
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1720,7 +1720,7 @@ static void ivas_spec_ana_fx(
        {
            nJacob = n;
            move16();
            if ( sub( endPlocs, plocs[sub( *num_plocs, 1 )] <= 0 ) )
            if ( sub( endPlocs, plocs[sub( *num_plocs, 1 )] ) <= 0 )
            {
                nJacob = sub( nJacob, 1 );
            }
+5 −1
Original line number Diff line number Diff line
@@ -561,7 +561,7 @@ static void cpy_tcx_ltp_data(
static void cpy_tcx_ltp_data_fx(
    TCX_LTP_DEC_HANDLE hTcxLtpDecOld, /* i  : TCX-LTP structure to copy from */
    TCX_LTP_DEC_HANDLE hTcxLtpDecNew, /* o  : TCX-LTP structure to copy to   */
    const int32_t output_Fs           /* i  : output sampling rate           */
    const Word32 output_Fs            /* i  : output sampling rate           */
)
{
    Word16 sz;
@@ -577,10 +577,14 @@ static void cpy_tcx_ltp_data_fx(
    sz = extract_l( Mpy_32_32_r( TCXLTP_MAX_DELAY * output_Fs, 44739 /* 1 / 48000 in Q31 */ ) );
    Copy( hTcxLtpDecOld->tcxltp_mem_in, hTcxLtpDecNew->tcxltp_mem_in, sz ); // TODO: One of these will be removed later
    Copy32( hTcxLtpDecOld->tcxltp_mem_in_32, hTcxLtpDecNew->tcxltp_mem_in_32, sz );
    hTcxLtpDecNew->exp_tcxltp_mem_in = hTcxLtpDecOld->exp_tcxltp_mem_in;
    move16();
    /* (int16_t) ( ( L_FRAME48k * output_Fs ) / 48000 ) */
    sz = extract_l( Mpy_32_32_r( L_FRAME48k * output_Fs, 44739 /* 1 / 48000 in Q31 */ ) );
    Copy( hTcxLtpDecOld->tcxltp_mem_out, hTcxLtpDecNew->tcxltp_mem_out, sz ); // TODO: One of these will be removed later
    Copy32( hTcxLtpDecOld->tcxltp_mem_out_32, hTcxLtpDecNew->tcxltp_mem_out_32, sz );
    hTcxLtpDecNew->exp_tcxltp_mem_out = hTcxLtpDecOld->exp_tcxltp_mem_out;
    move16();

    return;
}
+2 −9
Original line number Diff line number Diff line
@@ -3229,7 +3229,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx(
            IF( EQ_32( *( p_power_smooth_prev ), EPSILON_FX ) )
            {
                p_power_smooth_prev++;
                L_tmp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q31, 4612, &exp ); // 1e-15 in Q62 is 4612
                L_tmp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q31, EPSILON_FX, &exp );
                exp_arr[add( i_mult( k, num_freq_bands ), l )] = exp;
                move16();

@@ -3276,16 +3276,9 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx(
            *p_power_smooth = L_shr( *p_power_smooth, sub( min_exp, exp_arr[add( i_mult( k, num_freq_bands ), l )] ) );
            move32();
            p_power_smooth++;
            IF( EQ_32( *( p_power_smooth_prev ), EPSILON_FX ) )
            {
                q_tmp = add( sub( Q31, min_exp ), Q31 - 62 );
            }
            ELSE
            {
            q_tmp = add( sub( Q31, min_exp ), sub( Q31, h_dirac_output_synthesis_state->proto_power_smooth_q ) );
        }
    }
    }

    // Update the Q-factor
    h_dirac_output_synthesis_state->proto_power_smooth_prev_q = h_dirac_output_synthesis_state->proto_power_smooth_q;
+14 −5
Original line number Diff line number Diff line
@@ -3103,12 +3103,21 @@ void protoSignalComputation2_fx(
                    move32();
                }

                test();
                IF( ( stereo_type_detect->sum_power_fx[l] == 0 ) && ( stereo_type_detect->total_power_fx[l] == 0 ) )
                {
                    sum_total_ratio_fx[l] = MAX_16;
                    move32();
                }
                ELSE
                {
                    sum_total_ratio_fx[l] = BASOP_Util_Divide3232_Scale( stereo_type_detect->sum_power_fx[l], L_add( stereo_type_detect->total_power_fx[l], EPSILON_FX ), &exp );
                    move32();
                    q_sum_total_ratio = add( sub( 15, exp ), sub( s_min( stereo_type_detect->q_sum_power, q_temp2 ), s_min( stereo_type_detect->q_total_power, q_temp ) ) );
                    sum_total_ratio_fx[l] = L_shl( sum_total_ratio_fx[l], sub( Q15, q_sum_total_ratio ) );
                    move32();
                }
            }

            IF( l == 0 )
            {
+18 −49
Original line number Diff line number Diff line
@@ -509,8 +509,6 @@ static Word32 QuaternionAngle_fx(
    QuaternionConjugate_fx( q1, &q12 );
    QuaternionProduct_fx( q12, q2, &q12 ); // q12:Q25, q2:Q29, q1: Q27//

    IF( q12.w_fx < 0 )
    {
    Word32 temp = 0;
    move32();
    Word16 q_dot, result_e = 0;
@@ -527,38 +525,9 @@ static Word32 QuaternionAngle_fx(
    q12.w_fx = temp;
    move32();

        // Converting numerator to same Q as denominator//
        IF( 0 > result_e )
        {
            result = L_shr( L_shr( result, negate( result_e ) ), sub( 31, q12.q_fact ) ); // Q25
        }
        ELSE
        {
            IF( GT_32( result_e, sub( Q31, q12.q_fact ) ) )
            {
                result = L_shl( result, sub( result_e, sub( Q31, q12.q_fact ) ) );
            }
            ELSE
            {
                result = L_shr( result, sub( sub( Q31, q12.q_fact ), result_e ) );
            }
        }
        IF( GT_32( q12.w_fx, result ) )
        {
            Word16 tan_result = BASOP_util_atan2( result, q12.w_fx, 0 );
    Word16 tan_result = BASOP_util_atan2( result, q12.w_fx, sub( result_e, sub( 31, q12.q_fact ) ) );
    result = L_deposit_h( tan_result ); // Q29
    return result;
        }
        ELSE
        {
            return PI_OVER_Q29;
        }
    }
    ELSE
    {
        angle = PI_OVER_Q29;
        move32();
    }

    return angle;
}