Commit 20951319 authored by emerit's avatar emerit
Browse files

Merge branch 'main' into 1963_basop_portFltMR-1568-1471-1690

parents 2e04d8bc dc4d31a2
Loading
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -199,14 +199,13 @@ ivas_error ivas_FB_mixer_open_fx(
{
    IVAS_FB_MIXER_HANDLE hFbMixer;
    Word16 i, j, frame_len, num_bands;
    Word16 num_chs_alloc, exp;
    Word16 num_chs_alloc;
    ivas_error error;

    error = IVAS_ERR_OK;
    move32();

    frame_len = BASOP_Util_Divide3232_Scale( sampling_rate, FRAMES_PER_SEC, &exp );
    frame_len = shr( frame_len, sub( 15, exp ) );
    frame_len = extract_l( Mpy_32_32_r( sampling_rate, ONE_BY_FRAMES_PER_SEC_Q31 ) );

    hFbMixer = *hFbMixer_out;

@@ -936,8 +935,9 @@ static Word16 ivas_calculate_abs_fr_fx(
        move64();
        Word16 short_stride = pFb->fb_bin_to_band.short_stride;
        move16();

        Word32 res_dec1, res_frac, res_dec2;
        iDiv_and_mod_32( sampling_rate, FRAMES_PER_SEC, &res_dec1, &res_frac, 0 );
        res_dec1 = Mpy_32_32_r( sampling_rate, ONE_BY_FRAMES_PER_SEC_Q31 );
        iDiv_and_mod_32( res_dec1, short_stride, &res_dec2, &res_frac, 0 );
        const Word16 num_bins_per_short_stride_bin = extract_l( res_dec2 );
        iDiv_and_mod_32( res_dec1, pFb->fb_bin_to_band.num_cldfb_bands, &res_dec2, &res_frac, 0 );
@@ -1259,7 +1259,7 @@ static ivas_error ivas_filterbank_setup_fx(
    const Word32 sampling_rate,
    Word16 *index )
{
    Word16 i, j, exp, tmp;
    Word16 i, j, tmp;
    const Word32 *pAll_fb_fr_fx[2];
    const Word16 *pAll_bins_start_offset = NULL;
    const Word16 *pAll_bins_per_band = NULL;
@@ -1342,9 +1342,8 @@ static ivas_error ivas_filterbank_setup_fx(

        /*pFb->fb_bin_to_band.cldfb_stride = ( int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX );*/ /* equals num_cldfb_bands*/
        // pFb->fb_bin_to_band.short_stride = extract_l( ( sampling_rate / FRAMES_PER_SEC ) / 4 );
        tmp = BASOP_Util_Divide3232_Scale( sampling_rate, FRAMES_PER_SEC, &exp );
        pFb->fb_bin_to_band.short_stride = shr( tmp, add( sub( 15, exp ), 2 ) );

        tmp = extract_l( Mpy_32_32_r( sampling_rate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
        pFb->fb_bin_to_band.short_stride = shr( tmp, 2 );
        move16();

        set32_fx( pFb->fb_bin_to_band.p_short_stride_bin_to_band_fx, 0, 2 * MDFT_FB_BANDS_240 );
+7 −8
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@
#include "prot_fx.h"
#include "ivas_stat_com.h"
#include "ivas_rom_com.h"
#include "ivas_rom_com_fx.h"
#include "wmc_auto.h"
#include "ivas_prot_fx.h"

@@ -144,9 +145,9 @@ ivas_error ivas_ism_config_fx(
    {
        /* combined format: decision about bitrates per channel - variable during the session (at one ivas_total_brate) */
        // bits_ism = (Word16) ( ism_total_brate / FRAMES_PER_SEC );
        bits_ism = extract_l( Mpy_32_32( 42949673, ism_total_brate ) ); // 42949673 is 1/FRAMES_PER_SEC in Q31
        tmp1 = BASOP_Util_Divide1616_Scale( bits_ism, n_ISms, &exp );   // Q15 - exp
        set16_fx( bits_element, shr( tmp1, sub( 15, exp ) ), n_ISms );
        bits_ism = extract_l( Mpy_32_32_r( ONE_BY_FRAMES_PER_SEC_Q31, ism_total_brate ) ); // Q0
        tmp1 = extract_h( Mpy_32_16_r( one_by_q_level[n_ISms], bits_ism ) );
        set16_fx( bits_element, tmp1, n_ISms );
        bits_element[n_ISms - 1] = add( bits_element[n_ISms - 1], bits_ism % n_ISms ); // Q0
        move16();

@@ -156,11 +157,9 @@ ivas_error ivas_ism_config_fx(
    {
        /* ISM format: decision about bitrates per channel - constant during the session (at one ivas_total_brate) */
        // bits_ism = (Word16) ( ism_total_brate / FRAMES_PER_SEC );
        //  1 / 50 * 2 ^ 31 -- > 42949673, --> Q31,
        //(Q31 +Q0) - Q31 --> Q0
        bits_ism = extract_l( Mpy_32_32( 42949673, ism_total_brate ) ); // 42949673 is 1/FRAMES_PER_SEC in Q31
        tmp1 = BASOP_Util_Divide1616_Scale( bits_ism, n_ISms, &exp );   // Q15 - exp
        set16_fx( bits_element, shr( tmp1, sub( 15, exp ) ), n_ISms );
        bits_ism = extract_l( Mpy_32_32_r( ONE_BY_FRAMES_PER_SEC_Q31, ism_total_brate ) ); // Q0
        tmp1 = extract_h( Mpy_32_16_r( one_by_q_level[n_ISms], bits_ism ) );
        set16_fx( bits_element, tmp1, n_ISms );
        bits_element[n_ISms - 1] = add( bits_element[n_ISms - 1], bits_ism % n_ISms ); // Q0
        move16();
        bitbudget_to_brate( bits_element, element_brate, n_ISms );
+27 −35
Original line number Diff line number Diff line
@@ -88,7 +88,6 @@ ivas_error ivas_cpe_dec_fx(
    ivas_error error;
    Word32 cpe_brate;
    Word32 element_brate_ref;
    Word32 quo, rem;

    error = IVAS_ERR_OK;
    move32();
@@ -269,9 +268,9 @@ ivas_error ivas_cpe_dec_fx(
    {
        IF( hCPE->hStereoTD->tdm_LRTD_flag )
        {
            iDiv_and_mod_32( L_shr( hCPE->element_brate, 1 ), FRAMES_PER_SEC, &quo, &rem, 0 );
            sts[0]->bits_frame_nominal = extract_l( quo );
            sts[1]->bits_frame_nominal = extract_l( quo );
            i = extract_l( Mpy_32_32_r( L_shr( hCPE->element_brate, 1 ), ONE_BY_FRAMES_PER_SEC_Q31 ) );
            sts[0]->bits_frame_nominal = i;
            sts[1]->bits_frame_nominal = i;
            move16();
            move16();
        }
@@ -316,23 +315,22 @@ ivas_error ivas_cpe_dec_fx(
            move32();
            IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) )
            {
                iDiv_and_mod_32( cpe_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
                sts[1]->bit_stream = sts[0]->bit_stream + sub( sub( extract_l( quo ), 1 ), nb_bits_metadata );
                i = extract_l( Mpy_32_32_r( cpe_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
                sts[1]->bit_stream = sts[0]->bit_stream + sub( sub( i, 1 ), nb_bits_metadata );
                IF( hCPE->brate_surplus < 0 )
                {
                    iDiv_and_mod_32( L_abs( hCPE->brate_surplus ), FRAMES_PER_SEC, &quo, &rem, 0 );
                    quo = L_negate( quo );
                    i = negate( extract_l( Mpy_32_32_r( L_abs( hCPE->brate_surplus ), ONE_BY_FRAMES_PER_SEC_Q31 ) ) );
                }
                ELSE
                {
                    iDiv_and_mod_32( hCPE->brate_surplus, FRAMES_PER_SEC, &quo, &rem, 0 );
                    i = extract_l( Mpy_32_32_r( hCPE->brate_surplus, ONE_BY_FRAMES_PER_SEC_Q31 ) );
                }
                sts[1]->bit_stream = sts[1]->bit_stream + extract_l( quo );
                sts[1]->bit_stream = sts[1]->bit_stream + i;
            }
            ELSE
            {
                iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
                sts[1]->bit_stream = sts[0]->bit_stream + sub( sub( extract_l( quo ), 1 ), nb_bits_metadata );
                i = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
                sts[1]->bit_stream = sts[0]->bit_stream + sub( sub( i, 1 ), nb_bits_metadata );
            }

            IF( EQ_32( ivas_total_brate, IVAS_SID_5k2 ) )
@@ -365,9 +363,8 @@ ivas_error ivas_cpe_dec_fx(
                    nb_bits = sub( nb_bits, nb_bits_metadata );
                    IF( hCPE->brate_surplus < 0 )
                    {
                        iDiv_and_mod_32( L_abs( hCPE->brate_surplus ), FRAMES_PER_SEC, &quo, &rem, 0 );
                        quo = L_negate( quo );
                        nb_bits = add( nb_bits, extract_l( quo ) );
                        i = negate( extract_l( Mpy_32_32_r( L_abs( hCPE->brate_surplus ), ONE_BY_FRAMES_PER_SEC_Q31 ) ) );
                        nb_bits = add( nb_bits, i );
                    }
                }

@@ -399,19 +396,17 @@ ivas_error ivas_cpe_dec_fx(
        /* signal bitrate for BW selection in the SCh */
        sts[0]->bits_frame_channel = 0;
        move16();
        iDiv_and_mod_32( hCPE->element_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
        sts[1]->bits_frame_channel = extract_l( quo );
        sts[1]->bits_frame_channel = extract_l( Mpy_32_32_r( hCPE->element_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
        move16();
        IF( hCPE->brate_surplus < 0 )
        {
            iDiv_and_mod_32( L_abs( hCPE->brate_surplus ), FRAMES_PER_SEC, &quo, &rem, 0 );
            quo = L_negate( quo );
            i = negate( extract_l( Mpy_32_32_r( L_abs( hCPE->brate_surplus ), ONE_BY_FRAMES_PER_SEC_Q31 ) ) );
        }
        ELSE
        {
            iDiv_and_mod_32( hCPE->brate_surplus, FRAMES_PER_SEC, &quo, &rem, 0 );
            i = extract_l( Mpy_32_32_r( hCPE->brate_surplus, ONE_BY_FRAMES_PER_SEC_Q31 ) );
        }
        sts[1]->bits_frame_channel = add( sts[1]->bits_frame_channel, extract_l( quo ) );
        sts[1]->bits_frame_channel = add( sts[1]->bits_frame_channel, i );
        move16();
        IF( st_ivas->hQMetaData != NULL )
        {
@@ -429,14 +424,13 @@ ivas_error ivas_cpe_dec_fx(
        {
            IF( hCPE->brate_surplus < 0 )
            {
                iDiv_and_mod_32( L_abs( hCPE->brate_surplus ), FRAMES_PER_SEC, &quo, &rem, 0 );
                quo = L_negate( quo );
                i = negate( extract_l( Mpy_32_32_r( L_abs( hCPE->brate_surplus ), ONE_BY_FRAMES_PER_SEC_Q31 ) ) );
            }
            ELSE
            {
                iDiv_and_mod_32( hCPE->brate_surplus, FRAMES_PER_SEC, &quo, &rem, 0 );
                i = extract_l( Mpy_32_32_r( hCPE->brate_surplus, ONE_BY_FRAMES_PER_SEC_Q31 ) );
            }
            brate_surplus[0] = L_shr( L_mult( extract_l( L_shr( quo, 1 ) ), FRAMES_PER_SEC ), 1 );
            brate_surplus[0] = L_shr( L_mult( shr( i, 1 ), FRAMES_PER_SEC ), 1 );
            move32();
            brate_surplus[1] = L_sub( hCPE->brate_surplus, brate_surplus[0] );
            move32();
@@ -467,10 +461,9 @@ ivas_error ivas_cpe_dec_fx(
                sts[n]->total_brate = hCPE->element_brate;
                move32();
            }
            iDiv_and_mod_32( sts[n]->total_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
            sts[n]->bits_frame_nominal = extract_l( quo );
            iDiv_and_mod_32( hCPE->element_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
            sts[n]->bits_frame_channel = extract_l( L_shr( quo, sub( n_channels, 1 ) ) );
            sts[n]->bits_frame_nominal = extract_l( Mpy_32_32_r( sts[n]->total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
            i = extract_l( Mpy_32_32_r( hCPE->element_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
            sts[n]->bits_frame_channel = shr( i, sub( n_channels, 1 ) );
            move16();
            move16();

@@ -481,14 +474,13 @@ ivas_error ivas_cpe_dec_fx(
            {
                IF( brate_surplus[n] < 0 )
                {
                    iDiv_and_mod_32( L_abs( brate_surplus[n] ), FRAMES_PER_SEC, &quo, &rem, 0 );
                    quo = L_negate( quo );
                    i = negate( extract_l( Mpy_32_32_r( L_abs( brate_surplus[n] ), ONE_BY_FRAMES_PER_SEC_Q31 ) ) );
                }
                ELSE
                {
                    iDiv_and_mod_32( brate_surplus[n], FRAMES_PER_SEC, &quo, &rem, 0 );
                    i = extract_l( Mpy_32_32_r( brate_surplus[n], ONE_BY_FRAMES_PER_SEC_Q31 ) );
                }
                sts[n]->bits_frame_channel = add( sts[n]->bits_frame_channel, extract_l( quo ) );
                sts[n]->bits_frame_channel = add( sts[n]->bits_frame_channel, i );
                sts[n]->total_brate = L_add( sts[n]->total_brate, brate_surplus[n] );
                move16();
                move32();
@@ -586,8 +578,8 @@ ivas_error ivas_cpe_dec_fx(
        {
            tdm_configure_dec_fx( st_ivas->ivas_format, st_ivas->ism_mode, hCPE, &tdm_ratio_idx, nb_bits_metadata );

            iDiv_and_mod_32( sts[0]->total_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
            sts[1]->bit_stream = sts[0]->bit_stream + extract_l( quo );
            i = extract_l( Mpy_32_32_r( sts[0]->total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
            sts[1]->bit_stream = sts[0]->bit_stream + i;
        }
        ELSE
        {
+3 −5
Original line number Diff line number Diff line
@@ -1248,7 +1248,6 @@ void ivas_dirac_dec_read_BS_fx(
{
    Word16 i, j, b, dir, orig_dirac_bands;
    Word16 next_bit_pos_orig;
    Word32 quo, rem;

    test();
    test();
@@ -1256,8 +1255,7 @@ void ivas_dirac_dec_read_BS_fx(
    {
        next_bit_pos_orig = st->next_bit_pos;
        move16();
        iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
        st->next_bit_pos = extract_l( L_sub( quo, 1 ) );
        st->next_bit_pos = sub( extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ), 1 );
        move16();
        if ( last_bit_pos > 0 )
        {
@@ -1347,8 +1345,8 @@ void ivas_dirac_dec_read_BS_fx(
        move16();

        /* subtract mode signaling bits, since bitstream was moved after mode reading */
        iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
        st->next_bit_pos = extract_l( L_sub( L_sub( quo, 1 ), SID_FORMAT_NBITS + SBA_PLANAR_BITS + SBA_ORDER_BITS ) );
        i = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
        st->next_bit_pos = sub( sub( i, 1 ), SID_FORMAT_NBITS + SBA_PLANAR_BITS + SBA_ORDER_BITS );

        move16();
        /* 1 bit flag for signaling metadata to read */
+48 −58
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@
#include "ivas_prot_rend_fx.h"
#include "rom_com.h"
#include "ivas_rom_com.h"
#include "ivas_rom_com_fx.h"
#include "ivas_stat_enc.h"
#include "prot_fx.h"
#include "wmc_auto.h"
@@ -583,9 +584,8 @@ ivas_error ivas_dec_setup(
            move16();
            nchan_ism = 1;
            move16();
            Word32 res_dec, res_frac;
            iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
            k = extract_l( L_sub( res_dec, 1 ) );
            k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
            k = sub( k, 1 );

            WHILE( st_ivas->bit_stream[k] && ( nchan_ism < MAX_NUM_OBJECTS ) )
            {
@@ -635,9 +635,8 @@ ivas_error ivas_dec_setup(
        ELSE IF( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) )
        {
            /* read number of MASA transport channels */
            Word32 res_dec, res_frac;
            iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
            IF( st_ivas->bit_stream[res_dec - 1] )
            k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
            IF( st_ivas->bit_stream[k - 1] )
            {
                st_ivas->nchan_transport = 2;
                move16();
@@ -650,7 +649,7 @@ ivas_error ivas_dec_setup(
                move16();
            }
            /* this should be non-zero if original input format was MASA_ISM_FORMAT */
            st_ivas->nchan_ism = add( st_ivas->bit_stream[L_sub( res_dec, 3 )], shl( st_ivas->bit_stream[L_sub( res_dec, 2 )], 1 ) );
            st_ivas->nchan_ism = add( st_ivas->bit_stream[sub( k, 3 )], shl( st_ivas->bit_stream[sub( k, 2 )], 1 ) );

            IF( GT_16( st_ivas->nchan_ism, 0 ) )
            {
@@ -719,9 +718,8 @@ ivas_error ivas_dec_setup(
            move16();

            /* for the DISC mode the number of objects are written at the end of the bitstream, in the MASA metadata */
            Word32 res_dec, res_frac;
            iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
            st_ivas->nchan_ism = add( add( shl( st_ivas->bit_stream[res_dec - 1], 1 ), st_ivas->bit_stream[res_dec - 2] ), 1 );
            k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
            st_ivas->nchan_ism = add( add( shl( st_ivas->bit_stream[k - 1], 1 ), st_ivas->bit_stream[k - 2] ), 1 );
            move16();
            st_ivas->ism_mode = ivas_omasa_ism_mode_select_fx( ivas_total_brate, st_ivas->nchan_ism );
            move16();
@@ -742,9 +740,8 @@ ivas_error ivas_dec_setup(
        ELSE IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
        {
            /* the number of objects is written at the end of the bitstream, in the SBA metadata */
            Word32 res_dec, res_frac;
            iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
            st_ivas->nchan_ism = add( add( shl( st_ivas->bit_stream[res_dec - 1], 1 ), st_ivas->bit_stream[res_dec - 2] ), 1 );
            k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
            st_ivas->nchan_ism = add( add( shl( st_ivas->bit_stream[k - 1], 1 ), st_ivas->bit_stream[k - 2] ), 1 );
            move16();

            /* read Ambisonic (SBA) planar flag */
@@ -879,9 +876,8 @@ ivas_error ivas_dec_setup(
                move16();
                BREAK;
            case SID_MASA_2TC:; // empyt statement for declaration
                Word32 res_dec, res_frac;
                iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
                IF( EQ_16( st_ivas->bit_stream[( res_dec - 1 ) - SID_FORMAT_NBITS], 1 ) )
                k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
                IF( EQ_16( st_ivas->bit_stream[( k - 1 ) - SID_FORMAT_NBITS], 1 ) )
                {
                    st_ivas->element_mode_init = IVAS_CPE_MDCT;
                    move16();
@@ -955,9 +951,8 @@ ivas_error ivas_dec_setup(
            move16();
            nchan_ism = 1;
            move16();
            Word32 res_dec, res_frac;
            iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
            k = extract_l( L_sub( L_sub( res_dec, 1 ), SID_FORMAT_NBITS ) );
            k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
            k = sub( sub( k, 1 ), SID_FORMAT_NBITS );
            move16();

            WHILE( st_ivas->bit_stream[k] && ( nchan_ism < MAX_NUM_OBJECTS ) )
@@ -1215,9 +1210,8 @@ static ivas_error ivas_read_format(
            case SID_MASA_2TC:
                st_ivas->ivas_format = MASA_FORMAT;
                move32();
                Word32 res_dec, res_frac;
                iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
                IF( EQ_32( st_ivas->bit_stream[res_dec - 1], 1 ) )
                k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
                IF( EQ_32( st_ivas->bit_stream[k - 1], 1 ) )
                {
                    st_ivas->element_mode_init = IVAS_CPE_MDCT;
                    move16();
@@ -1509,7 +1503,7 @@ ivas_error ivas_init_decoder_fx(
    Word16 sce_id, cpe_id;
    Word16 numCldfbAnalyses, numCldfbSyntheses;
    Word16 granularity, n_channels_transport_jbm;
    Word32 output_Fs, ivas_total_brate;
    Word32 output_Fs, ivas_total_brate, tmp_br, tmp32;
    Word32 delay_ns;
    AUDIO_CONFIG output_config;
    DECODER_CONFIG_HANDLE hDecoderConfig;
@@ -1870,11 +1864,10 @@ ivas_error ivas_init_decoder_fx(
        st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas );
        move16();

        iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &tmp_br, &tmp32, 0 );
        FOR( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ )
        {
            Word32 res_dec, res_frac;
            iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &res_dec, &res_frac, 0 );
            IF( NE_32( ( error = create_sce_dec( st_ivas, sce_id, res_dec ) ), IVAS_ERR_OK ) )
            IF( NE_32( ( error = create_sce_dec( st_ivas, sce_id, tmp_br ) ), IVAS_ERR_OK ) )
            {
                return error;
            }
@@ -1882,11 +1875,11 @@ ivas_error ivas_init_decoder_fx(
            reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] );
        }

        iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &tmp_br, &tmp32, 0 );
        tmp_br = L_shl( tmp_br, CPE_CHANNELS_LOG2 );
        FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
        {
            Word32 res_dec, res_frac;
            iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &res_dec, &res_frac, 0 );
            IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, (res_dec) *CPE_CHANNELS ) ), IVAS_ERR_OK ) )
            IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )
            {
                return error;
            }
@@ -1898,13 +1891,11 @@ ivas_error ivas_init_decoder_fx(
        }

        /* create CPE element for DFT Stereo like upmix */
        iDiv_and_mod_32( ivas_total_brate, add( st_ivas->nSCE, st_ivas->nCPE ), &tmp_br, &tmp32, 0 );
        test();
        IF( st_ivas->sba_dirac_stereo_flag && ( st_ivas->nCPE == 0 ) )
        {
            Word32 res_dec, res_frac;
            iDiv_and_mod_32( ivas_total_brate, add( st_ivas->nSCE, st_ivas->nCPE ), &res_dec, &res_frac, 0 );

            IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, res_dec ) ), IVAS_ERR_OK ) )
            IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )
            {
                return error;
            }
@@ -1952,11 +1943,10 @@ ivas_error ivas_init_decoder_fx(
            }
        }

        iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &tmp_br, &tmp32, 0 );
        FOR( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ )
        {
            Word32 res_dec, res_frac;
            iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &res_dec, &res_frac, 0 );
            IF( NE_32( ( error = create_sce_dec( st_ivas, sce_id, res_dec ) ), IVAS_ERR_OK ) )
            IF( NE_32( ( error = create_sce_dec( st_ivas, sce_id, tmp_br ) ), IVAS_ERR_OK ) )
            {
                return error;
            }
@@ -1964,11 +1954,11 @@ ivas_error ivas_init_decoder_fx(
            reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] );
        }

        iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &tmp_br, &tmp32, 0 );
        tmp_br = L_shl( tmp_br, CPE_CHANNELS_LOG2 );
        FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
        {
            Word32 res_dec, res_frac;
            iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &res_dec, &res_frac, 0 );
            IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, L_shl( res_dec, 1 ) ) ), IVAS_ERR_OK ) )
            IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )
            {
                return error;
            }
@@ -2075,11 +2065,11 @@ ivas_error ivas_init_decoder_fx(
            move16();
        }

        iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &tmp_br, &tmp32, 0 );
        tmp_br = L_shl( tmp_br, CPE_CHANNELS_LOG2 );
        FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
        {
            Word32 res_dec, res_frac;
            iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &res_dec, &res_frac, 0 );
            IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, L_shl( res_dec, 1 ) ) ), IVAS_ERR_OK ) )
            IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )
            {
                return error;
            }
@@ -2091,12 +2081,11 @@ ivas_error ivas_init_decoder_fx(
        }

        /* create CPE element for DFT Stereo like upmix */
        iDiv_and_mod_32( ivas_total_brate, add( st_ivas->nSCE, st_ivas->nCPE ), &tmp_br, &tmp32, 0 );
        test();
        IF( st_ivas->sba_dirac_stereo_flag && st_ivas->nCPE == 0 )
        {
            Word32 res_dec, res_frac;
            iDiv_and_mod_32( ivas_total_brate, add( st_ivas->nSCE, st_ivas->nCPE ), &res_dec, &res_frac, 0 );
            IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, res_dec ) ), IVAS_ERR_OK ) )
            IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )
            {
                return error;
            }
@@ -2261,11 +2250,12 @@ ivas_error ivas_init_decoder_fx(
            move16();
            st_ivas->element_mode_init = IVAS_CPE_MDCT;
            move16();

            iDiv_and_mod_32( ivas_total_brate, sub( st_ivas->nchan_transport, 1 ), &tmp_br, &tmp32, 0 );
            tmp_br = L_shl( tmp_br, CPE_CHANNELS_LOG2 );
            FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
            {
                Word32 res_dec, res_frac;
                iDiv_and_mod_32( ivas_total_brate, sub( st_ivas->nchan_transport, 1 ), &res_dec, &res_frac, 0 );
                IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, L_shl( res_dec, 1 ) ) ), IVAS_ERR_OK ) )
                IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )
                {
                    return error;
                }
@@ -2308,11 +2298,13 @@ ivas_error ivas_init_decoder_fx(

            st_ivas->element_mode_init = IVAS_CPE_MDCT;
            move16();

            iDiv_and_mod_32( ivas_total_brate, sub( st_ivas->nchan_transport, 1 ), &tmp_br, &tmp32, 0 );
            tmp_br = L_shl( tmp_br, CPE_CHANNELS_LOG2 );
            FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
            {
                Word32 res_dec, res_frac;
                iDiv_and_mod_32( ivas_total_brate, sub( st_ivas->nchan_transport, 1 ), &res_dec, &res_frac, 0 );
                IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, L_shl( res_dec, 1 ) ) ), IVAS_ERR_OK ) )
                IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )

                {
                    return error;
                }
@@ -2345,12 +2337,11 @@ ivas_error ivas_init_decoder_fx(

            st_ivas->hParamMC->proto_matrix_int_e = 0;
            move16();

            iDiv_and_mod_32( ivas_total_brate, add( st_ivas->nSCE, st_ivas->nCPE ), &tmp_br, &tmp32, 0 );
            FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
            {
                Word32 res_dec, res_frac;
                iDiv_and_mod_32( ivas_total_brate, add( st_ivas->nSCE, st_ivas->nCPE ), &res_dec, &res_frac, 0 );

                IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, res_dec ) ), IVAS_ERR_OK ) )
                IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )
                {
                    return error;
                }
@@ -2458,11 +2449,10 @@ ivas_error ivas_init_decoder_fx(
            }

            /* create CPE element for DFT Stereo like upmix */
            iDiv_and_mod_32( ivas_total_brate, add( st_ivas->nSCE, st_ivas->nCPE ), &tmp_br, &tmp32, 0 );
            IF( st_ivas->sba_dirac_stereo_flag )
            {
                Word32 res_dec, res_frac;
                iDiv_and_mod_32( ivas_total_brate, add( st_ivas->nSCE, st_ivas->nCPE ), &res_dec, &res_frac, 0 );
                IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, res_dec ) ), IVAS_ERR_OK ) )
                IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )
                {
                    return error;
                }
Loading