Commit 0a06a75a 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 1796-replace-shl_o-by-overflow-free-alternatives
parents 5fa99975 9d464c09
Loading
Loading
Loading
Loading
Loading
+29 −9
Original line number Diff line number Diff line
@@ -1028,6 +1028,7 @@ void ivas_ls_setup_conversion_process_mdct_param_mc_fx(

    Word16 start, stop, start_tcx5, stop_tcx5;
    Word16 mct_chan_mode[MAX_CICP_CHANNELS];
    Word16 all_ch_ignored; // Flag for checking if all channels are ignored

    /* Declare all handles */
    LSSETUP_CONVERSION_HANDLE hLsSetUpConversion;
@@ -1130,13 +1131,22 @@ void ivas_ls_setup_conversion_process_mdct_param_mc_fx(
    set_zero_fx( target_ch_ener_fx, MAX_OUTPUT_CHANNELS );
    Word16 max_e = 0;
    move16();
    all_ch_ignored = 1;
    move16();
    FOR( idx = 0; idx < nchan_transport; idx++ )
    {
        IF( NE_16( mct_chan_mode[idx], MCT_CHAN_MODE_IGNORE ) )
        {
            max_e = s_max( max_e, x_e[idx][0] );
            all_ch_ignored = 0;
            move16();
        }
    }
    if ( all_ch_ignored )
    {
        max_e = 31;
        move16();
    }
    FOR( bandIdx = 0; bandIdx < hLsSetUpConversion->sfbCnt; bandIdx++ )
    {
        set_zero_fx( real_in_buffer_fx, PARAM_MC_MAX_BANDS_IN_PARAMETER_BAND * PARAM_MC_BAND_TO_MDCT_BAND_RATIO * MAX_TRANSPORT_CHANNELS );
@@ -1164,6 +1174,10 @@ void ivas_ls_setup_conversion_process_mdct_param_mc_fx(
                }
            }
        }
        input_exp = max_e;
        move16();
        IF( all_ch_ignored == 0 )
        {
            Word16 shift = 1;
            move16();
            FOR( i = 0; i < num_bands * nchan_transport; ++i )
@@ -1173,13 +1187,19 @@ void ivas_ls_setup_conversion_process_mdct_param_mc_fx(
                imag_in_buffer_fx[i] = L_shr( imag_in_buffer_fx[i], shift );
                move32();
            }
        input_exp = max_e;
        move16();
            input_exp = add( input_exp, shift );
        }

        cmplx_matrix_square_fx( real_in_buffer_fx, imag_in_buffer_fx, num_bands, nchan_transport, real_buffer_fx, imag_buffer_fx, input_exp, &output_exp );
        v_add_32( cx_fx[bandIdx], real_buffer_fx, cx_fx[bandIdx], i_mult( nchan_transport, nchan_transport ) );           /*Q=Q_real_buffer=Q_imag_buffer=output_exp*/
        v_add_32( cx_imag_fx[bandIdx], imag_buffer_fx, cx_imag_fx[bandIdx], i_mult( nchan_transport, nchan_transport ) ); /*Q=Q_real_buffer=Q_imag_buffer=output_exp*/
    }
    if ( all_ch_ignored )
    {
        output_exp = 29;
        move16();
    }

    Word16 exp_in = 10, exp_out = 0;
    move16();
    move16();