Commit 1ca9814e authored by vaclav's avatar vaclav
Browse files

revert some changes

parent b57e1b78
Loading
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@
#include "options.h"
#include "ivas_cnst.h"
#include "ivas_prot_fx.h"
#include "ivas_rom_com_fx.h"
#include "prot_fx.h"
#include <stdint.h>
#include "wmc_auto.h"
@@ -57,7 +56,7 @@ ivas_error ivas_corecoder_dec_reconfig_fx(
{
    Word16 n, sce_id, cpe_id, output_frame;
    Word16 nSCE_existing, nCPE_existing;
    Word32 tmp_br, ivas_total_brate;
    Word32 ivas_total_brate;
    Word16 nchan_transport_real;
    MC_MODE last_mc_mode;
    DECODER_CONFIG_HANDLE hDecoderConfig;
@@ -410,10 +409,9 @@ ivas_error ivas_corecoder_dec_reconfig_fx(
        /* otherwise create extra dummy CPE */
        ELSE
        {
            /* i = ivas_total_brate / ( st_ivas->nSCE + st_ivas->nCPE ) */
            n = add( st_ivas->nSCE, st_ivas->nCPE );
            tmp_br = Mpy_32_32_r( ivas_total_brate, one_by_q_level[n] );
            IF( NE_32( ( error = create_cpe_dec( st_ivas, 0, tmp_br ) ), IVAS_ERR_OK ) )
            Word32 quo, rem;
            iDiv_and_mod_32( ivas_total_brate, add( st_ivas->nSCE, st_ivas->nCPE ), &quo, &rem, 0 );
            IF( NE_32( ( error = create_cpe_dec( st_ivas, 0, quo ) ), IVAS_ERR_OK ) )
            {
                return error;
            }
+26 −17
Original line number Diff line number Diff line
@@ -1581,7 +1581,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, tmp_br;
    Word32 output_Fs, ivas_total_brate, tmp_br, tmp32;
#ifdef NONBE_FIX_MC_LFE_LPF
    Word32 delay_ns;
#else
@@ -2002,9 +2002,9 @@ 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++ )
        {
            tmp_br = Mpy_32_32_r( ivas_total_brate, one_by_q_level[st_ivas->nchan_transport] );
            IF( NE_32( ( error = create_sce_dec( st_ivas, sce_id, tmp_br ) ), IVAS_ERR_OK ) )
            {
                return error;
@@ -2013,10 +2013,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++ )
        {
            tmp_br = Mpy_32_32_r( ivas_total_brate, one_by_q_level[st_ivas->nchan_transport] );
            IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, L_shl( tmp_br, 1 ) ) ), IVAS_ERR_OK ) )
            IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )
            {
                return error;
            }
@@ -2028,10 +2029,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 );
        test();
        IF( st_ivas->sba_dirac_stereo_flag && ( st_ivas->nCPE == 0 ) )
        {
            tmp_br = Mpy_32_32_r( ivas_total_brate, one_by_q_level[st_ivas->nSCE] );
            IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )
            {
                return error;
@@ -2080,9 +2081,9 @@ 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++ )
        {
            tmp_br = Mpy_32_32_r( ivas_total_brate, one_by_q_level[st_ivas->nchan_transport] );
            IF( NE_32( ( error = create_sce_dec( st_ivas, sce_id, tmp_br ) ), IVAS_ERR_OK ) )
            {
                return error;
@@ -2091,10 +2092,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++ )
        {
            tmp_br = Mpy_32_32_r( ivas_total_brate, one_by_q_level[st_ivas->nchan_transport] );
            IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, L_shl( tmp_br, 1 ) ) ), IVAS_ERR_OK ) )
            IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )
            {
                return error;
            }
@@ -2216,10 +2218,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++ )
        {
            tmp_br = Mpy_32_32_r( ivas_total_brate, one_by_q_level[st_ivas->nchan_transport] );
            IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, L_shl( tmp_br, 1 ) ) ), IVAS_ERR_OK ) )
            IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )
            {
                return error;
            }
@@ -2231,10 +2234,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 );
        test();
        IF( st_ivas->sba_dirac_stereo_flag && st_ivas->nCPE == 0 )
        {
            tmp_br = Mpy_32_32_r( ivas_total_brate, one_by_q_level[add( st_ivas->nSCE, st_ivas->nCPE )] );
            IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )
            {
                return error;
@@ -2400,10 +2403,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++ )
            {
                tmp_br = Mpy_32_32_r( ivas_total_brate, one_by_q_level[sub( st_ivas->nchan_transport, 1 )] );
                IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, L_shl( tmp_br, 1 ) ) ), IVAS_ERR_OK ) )
                IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )
                {
                    return error;
                }
@@ -2446,10 +2451,13 @@ ivas_error ivas_init_decoder_fx(

            st_ivas->element_mode_init = IVAS_CPE_MDCT;
            move16();

            iDiv_and_mod_32( ivas_total_brate, add( st_ivas->nSCE, st_ivas->nCPE ), &tmp_br, &tmp32, 0 );
            tmp_br = L_shl( tmp_br, CPE_CHANNELS_LOG2 );
            FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
            {
                tmp_br = Mpy_32_32_r( ivas_total_brate, one_by_q_level[sub( st_ivas->nchan_transport, 1 )] );
                IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, L_shl( tmp_br, 1 ) ) ), IVAS_ERR_OK ) )
                IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )

                {
                    return error;
                }
@@ -2482,9 +2490,10 @@ 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++ )
            {
                tmp_br = Mpy_32_32_r( ivas_total_brate, one_by_q_level[add( st_ivas->nSCE, st_ivas->nCPE )] );
                IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )
                {
                    return error;
@@ -2593,9 +2602,9 @@ 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 )
            {
                tmp_br = Mpy_32_32_r( ivas_total_brate, one_by_q_level[add( st_ivas->nSCE, st_ivas->nCPE )] );
                IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )
                {
                    return error;
+13 −11
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@
#include "ivas_prot_fx.h"
#include "ivas_stat_enc.h"
#include "ivas_rom_com.h"
#include "ivas_rom_com_fx.h"
#include "wmc_auto.h"
#include "ivas_prot_fx.h"
#include "prot_fx_enc.h"
@@ -442,10 +441,11 @@ ivas_error ivas_init_encoder_fx(
    Word16 nchan_inp_buff;
    Word16 sce_id, cpe_id;
    IVAS_FORMAT ivas_format;
    Word32 input_Fs, ivas_total_brate, tmp_br;
    Word32 input_Fs, ivas_total_brate;
    Word32 element_brate_tmp[MAX_NUM_OBJECTS];
    ENCODER_CONFIG_HANDLE hEncoderConfig;
    ivas_error error;
    Word32 tmp_br, tmp32;

    error = IVAS_ERR_OK;
    move32();
@@ -674,7 +674,7 @@ ivas_error ivas_init_encoder_fx(
            }
        }

        tmp_br = Mpy_32_32_r( ivas_total_brate, one_by_q_level[st_ivas->nchan_transport] );
        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++ )
        {
            IF( ( error = create_sce_enc_fx( st_ivas, sce_id, tmp_br ) ) != IVAS_ERR_OK )
@@ -689,7 +689,8 @@ ivas_error ivas_init_encoder_fx(
            }
        }

        tmp_br = L_shl( Mpy_32_32_r( ivas_total_brate, one_by_q_level[st_ivas->nchan_transport] ), 1 );
        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++ )
        {
            IF( ( error = create_cpe_enc_fx( st_ivas, cpe_id, tmp_br ) ) != IVAS_ERR_OK )
@@ -831,7 +832,8 @@ ivas_error ivas_init_encoder_fx(
                }
            }

            tmp_br = L_shl( Mpy_32_32_r( ivas_total_brate, one_by_q_level[st_ivas->nchan_transport] ), 1 );
            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++ )
            {
                IF( ( error = create_cpe_enc_fx( st_ivas, cpe_id, tmp_br ) ) != IVAS_ERR_OK )
@@ -862,7 +864,8 @@ ivas_error ivas_init_encoder_fx(
            st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->hEncoderConfig->nchan_ism, 1 ), 1 ) ); /* Q0 */
#endif

            tmp_br = L_shl( Mpy_32_32_r( ivas_total_brate, one_by_q_level[st_ivas->nchan_transport] ), 1 );
            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++ )
            {
                IF( ( error = create_cpe_enc_fx( st_ivas, cpe_id, tmp_br ) ) != IVAS_ERR_OK )
@@ -898,8 +901,8 @@ ivas_error ivas_init_encoder_fx(
            st_ivas->nCPE = shr( hEncoderConfig->nchan_inp, CPE_CHANNELS_LOG2 ); /* Q0 */
            move16();

            i = sub( hEncoderConfig->nchan_inp, 1 );
            tmp_br = L_shl( Mpy_32_32_r( L_sub( ivas_total_brate, ivas_total_brate % i ), one_by_q_level[i] - 1 ), 1 );
            iDiv_and_mod_32( ivas_total_brate, sub( hEncoderConfig->nchan_inp, 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++ )
            {
                IF( ( error = create_cpe_enc_fx( st_ivas, cpe_id, tmp_br ) ) != IVAS_ERR_OK )
@@ -935,7 +938,7 @@ ivas_error ivas_init_encoder_fx(
                return error;
            }

            tmp_br = Mpy_32_32_r( ivas_total_brate, one_by_q_level[st_ivas->nCPE] );
            iDiv_and_mod_32( ivas_total_brate, st_ivas->nCPE, &tmp_br, &tmp32, 0 );
            FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
            {
                IF( ( error = create_cpe_enc_fx( st_ivas, cpe_id, tmp_br ) ) != IVAS_ERR_OK )
@@ -961,8 +964,7 @@ ivas_error ivas_init_encoder_fx(
                return error;
            }

            i = add( st_ivas->nCPE, st_ivas->nSCE );
            tmp_br = Mpy_32_32_r( ivas_total_brate, one_by_q_level[i] );
            iDiv_and_mod_32( ivas_total_brate, add( st_ivas->nCPE, st_ivas->nSCE ), &tmp_br, &tmp32, 0 );
            FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
            {
                IF( ( error = create_cpe_enc_fx( st_ivas, cpe_id, tmp_br ) ) != IVAS_ERR_OK )
+18 −11
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@
#include "prot_fx.h"
#include "wmc_auto.h"
#include "ivas_prot_fx.h"
#include "ivas_rom_com_fx.h"
#include "prot_fx_enc.h"
#include "rom_com.h"

@@ -239,11 +238,12 @@ ivas_error ivas_mct_enc_fx(
    {
        Word32 cp_bitrate;
        // cp_bitrate = ivas_total_brate / hMCT->nchan_out_woLFE * CPE_CHANNELS;
        cp_bitrate = Mpy_32_32_r( L_shl( ivas_total_brate, 1 ), one_by_q_level[hMCT->nchan_out_woLFE] );
        cp_bitrate = L_shl( L_deposit_l( div_l( ivas_total_brate, hMCT->nchan_out_woLFE ) ), 2 ); // a/b => div_l(a, b/2) or (2 * div_l(a, b))

        IF( EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) )
        {
            // cp_bitrate = ivas_total_brate / st_ivas->nchan_transport * CPE_CHANNELS;
            cp_bitrate = Mpy_32_32_r( L_shl( ivas_total_brate, 1 ), one_by_q_level[st_ivas->nchan_transport] );
            cp_bitrate = L_shl( L_deposit_l( div_l( ivas_total_brate, st_ivas->nchan_transport ) ), 2 ); // a/b => div_l(a, b/2) or (2 * div_l(a, b))
        }

        IF( st_ivas->hCPE[0]->hCoreCoder[0]->igf )
@@ -564,13 +564,13 @@ ivas_error create_mct_enc_fx(
        move16();
    }

    Word32 L_tmp;
    iDiv_and_mod_32( L_shl( ivas_total_brate, 1 ), hMCT->nchan_out_woLFE, &cp_bitrate, &L_tmp, 0 );
    // cp_bitrate = ivas_total_brate / hMCT->nchan_out_woLFE * CPE_CHANNELS;
    cp_bitrate = Mpy_32_32_r( L_shl( ivas_total_brate, 1 ), one_by_q_level[hMCT->nchan_out_woLFE] );

    IF( EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) )
    {
        iDiv_and_mod_32( L_shl( ivas_total_brate, 1 ), st_ivas->nchan_transport, &cp_bitrate, &L_tmp, 0 );
        // cp_bitrate = ivas_total_brate / st_ivas->nchan_transport * CPE_CHANNELS;
        cp_bitrate = Mpy_32_32_r( L_shl( ivas_total_brate, 1 ), one_by_q_level[st_ivas->nchan_transport] );
    }

    FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
@@ -708,12 +708,13 @@ ivas_error mct_enc_reconfigure_fx(
        }
    }

    Word32 L_tmp;
    iDiv_and_mod_32( L_shl( ivas_total_brate, 1 ), hMCT->nchan_out_woLFE, &cp_bitrate, &L_tmp, 0 );
    // cp_bitrate = ivas_total_brate / hMCT->nchan_out_woLFE * CPE_CHANNELS;
    cp_bitrate = Mpy_32_32_r( L_shl( ivas_total_brate, 1 ), one_by_q_level[hMCT->nchan_out_woLFE] );
    IF( EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) )
    {
        iDiv_and_mod_32( L_shl( ivas_total_brate, 1 ), st_ivas->nchan_transport, &cp_bitrate, &L_tmp, 0 );
        // cp_bitrate = ivas_total_brate / st_ivas->nchan_transport * CPE_CHANNELS;
        cp_bitrate = Mpy_32_32_r( L_shl( ivas_total_brate, 1 ), one_by_q_level[st_ivas->nchan_transport] );
    }

    FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
@@ -1212,19 +1213,25 @@ static ivas_error ivas_mc_enc_reconfig_fx(
    {
        new_brate_SCE = 0;
        move32();
        new_brate_CPE = L_shl( Mpy_32_32_r( st_ivas->hEncoderConfig->ivas_total_brate, one_by_q_level[sub( st_ivas->nchan_transport, 1 )] ), 1 );
        Word32 res_dec, res_frac;
        iDiv_and_mod_32( st_ivas->hEncoderConfig->ivas_total_brate, sub( st_ivas->nchan_transport, 1 ), &res_dec, &res_frac, 0 );
        new_brate_CPE = imult3216( res_dec, CPE_CHANNELS );
    }
    ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) )
    {
        new_brate_SCE = 0;
        move32();
        new_brate_CPE = L_shl( Mpy_32_32_r( st_ivas->hEncoderConfig->ivas_total_brate, one_by_q_level[sub( st_ivas->nchan_transport, 1 )] ), 1 );
        Word32 res_dec, res_frac;
        iDiv_and_mod_32( st_ivas->hEncoderConfig->ivas_total_brate, sub( st_ivas->nchan_transport, 1 ), &res_dec, &res_frac, 0 );
        new_brate_CPE = imult3216( res_dec, CPE_CHANNELS );
    }
    ELSE
    {
        new_brate_SCE = 0; /*st_ivas->hEncoderConfig->ivas_total_brate / st_ivas->nchan_transport;*/
        move32();
        new_brate_CPE = L_shl( Mpy_32_32_r( st_ivas->hEncoderConfig->ivas_total_brate, one_by_q_level[st_ivas->nchan_transport] ), 1 );
        Word32 res_dec, res_frac;
        iDiv_and_mod_32( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, &res_dec, &res_frac, 0 );
        new_brate_CPE = imult3216( res_dec, CPE_CHANNELS );
    }

    IF( NE_32( ( error = ivas_corecoder_enc_reconfig_fx( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, new_brate_SCE, new_brate_CPE, last_mc_mode ) ), IVAS_ERR_OK ) )
+3 −2
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@
#include "ivas_prot_fx.h"
#include "prot_fx.h"
#include "ivas_rom_com.h"
#include "ivas_rom_com_fx.h"
#include "ivas_rom_enc.h"
#include "wmc_auto.h"
#ifdef DEBUGGING
@@ -861,7 +860,9 @@ void ivas_set_ism_importance_interformat_fx(
            }
        }

        Word32 quo = Mpy_32_32_r( ism_total_brate, one_by_q_level[nchan_transport] );
        Word32 quo, rem;
        iDiv_and_mod_32( ism_total_brate, nchan_transport, &quo, &rem, 0 );

        /* do not use the low-rate core-coder mode at highest bit-rates */
        if ( GT_32( quo, IVAS_48k ) )
        {
Loading