Commit ffd18c62 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 1529-warnings-in-basop-main-branch
parents 5785fc2b 182c2a50
Loading
Loading
Loading
Loading
Loading
+25 −8
Original line number Diff line number Diff line
@@ -2134,9 +2134,6 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx(
            move16();
        }

        subtract_power_y = masa_stereo_type_detect->subtract_power_y_fx; // q_subtract_power_y
        move32();

        a = 858993; /* ( 0.0004f in Q31 ); Temporal smoothing coefficient */
        move32();
        b = L_sub( ONE_IN_Q31, a ); /* Temporal smoothing coefficient */
@@ -2152,24 +2149,42 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx(
        move32();
        masa_stereo_type_detect->q_target_power_y_smooth = q_com;
        move16();
        masa_stereo_type_detect->subtract_power_y_smooth_fx =
            L_add( Mpy_32_32( a, subtract_power_y ),
                   Mpy_32_32( b, masa_stereo_type_detect->subtract_power_y_smooth_fx ) ); //(Q31, q_subtract_power_y) -> q_subtract_power_y

        IF( NE_16( masa_stereo_type_detect->q_subtract_power_y, masa_stereo_type_detect->q_subtract_power_y_smooth ) )
        {
            exp = s_min( add( masa_stereo_type_detect->q_subtract_power_y, norm_l( masa_stereo_type_detect->subtract_power_y_fx ) ), add( masa_stereo_type_detect->q_subtract_power_y_smooth, norm_l( masa_stereo_type_detect->subtract_power_y_smooth_fx ) ) );
            masa_stereo_type_detect->subtract_power_y_fx = L_shl( masa_stereo_type_detect->subtract_power_y_fx, sub( exp, masa_stereo_type_detect->q_subtract_power_y ) );
            move32();
            masa_stereo_type_detect->subtract_power_y_smooth_fx = L_shl( masa_stereo_type_detect->subtract_power_y_smooth_fx, sub( exp, masa_stereo_type_detect->q_subtract_power_y_smooth ) );
            move32();
            masa_stereo_type_detect->q_subtract_power_y = exp;
            move16();
            masa_stereo_type_detect->q_subtract_power_y_smooth = exp;
            move16();
        }
        subtract_power_y = masa_stereo_type_detect->subtract_power_y_fx; // q_subtract_power_y
        move32();

        W_temp = W_add( W_mult0_32_32( a, subtract_power_y ), W_mult0_32_32( b, masa_stereo_type_detect->subtract_power_y_smooth_fx ) ); // Q31 + masa_stereo_type_detect->q_subtract_power_y_smooth
        exp = W_norm( W_temp );
        masa_stereo_type_detect->subtract_power_y_smooth_fx = W_extract_h( W_shl( W_temp, exp ) ); // Q31 + masa_stereo_type_detect->q_subtract_power_y_smooth + exp - 32
        move32();
        masa_stereo_type_detect->q_subtract_power_y_smooth = sub( add( masa_stereo_type_detect->q_subtract_power_y_smooth, exp ), 1 );
        move16();

        exp = 0;
        move16();
        IF( masa_stereo_type_detect->target_power_y_smooth_fx != 0 )
        {
            subtract_target_ratio = L_sub( BASOP_Util_Log2( masa_stereo_type_detect->subtract_power_y_smooth_fx ),
                                           BASOP_Util_Log2( masa_stereo_type_detect->target_power_y_smooth_fx ) ); // Q25
            exp = sub( masa_stereo_type_detect->q_subtract_power_y, q_com );
            exp = sub( masa_stereo_type_detect->q_subtract_power_y_smooth, q_com );
            L_tmp = Mpy_32_32( L_sub( subtract_target_ratio, L_shl( exp, 25 ) ), LOG10_2_Q31 ); // Q25
        }
        ELSE
        {
            subtract_target_ratio = BASOP_Util_Log2( masa_stereo_type_detect->subtract_power_y_smooth_fx ); // Q25
            exp = sub( 31, masa_stereo_type_detect->q_subtract_power_y );
            exp = sub( 31, masa_stereo_type_detect->q_subtract_power_y_smooth );
            L_tmp = L_sub( Mpy_32_32( L_add( subtract_target_ratio, L_shl( exp, 25 ) ), LOG10_2_Q31 ), -503316480 /* L_shl( -15, 25 ) */ /*log(EPSILON)*/ ); // Q25
        }
        subtract_target_ratio_db = Mpy_32_32( 1342177280 /* 10.0f * in Q27*/, L_tmp ); // (Q27, (Q25, Q31)) -> (Q27, Q25) -> Q21
@@ -2178,6 +2193,8 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx(
        move32();
        masa_stereo_type_detect->subtract_power_y_fx = 0;
        move32();
        masa_stereo_type_detect->q_subtract_power_y = Q31;
        move16();
    }

    /*-----------------------------------------------------------------*