Commit 371f593c authored by fotopoulou's avatar fotopoulou
Browse files

some fixes and clean up under NONBE_FIX_ISM_XOVER_BR

parent 9e947ac3
Loading
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -468,6 +468,11 @@ ivas_error ivas_dec_setup(
                st_ivas->sba_order += 2 * st_ivas->bit_stream[num_bits_read];
                num_bits_read += SBA_ORDER_BITS;
            }
#else
            if ( ivas_total_brate < IVAS_256k )
            {
                st_ivas->sba_order = 3;
            }
#endif
            if ( st_ivas->ini_frame > 0 && ivas_total_brate != st_ivas->last_active_ivas_total_brate )
            {
@@ -495,7 +500,7 @@ ivas_error ivas_dec_setup(
                        int16_t n;

                        n = st_ivas->nchan_transport + st_ivas->nchan_ism;
                        st_ivas->nCPE = ( n / 2 ) + ( n % 2 );
                        st_ivas->nCPE = (n+1)>>1;
                    }
#else
                    st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1;
@@ -1589,7 +1594,7 @@ ivas_error ivas_init_decoder(
                int16_t n_all;

                n_all = st_ivas->nchan_transport + st_ivas->nchan_ism;
                st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 );
                st_ivas->nCPE = ( n_all + 1 ) >> 1;
            }
#else
            st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1;
+14 −11
Original line number Diff line number Diff line
@@ -70,7 +70,11 @@ void ivas_sba_set_cna_cng_flag(
        st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 1;
        st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 1;
    }
#ifdef NONBE_FIX_ISM_XOVER_BR
    else if ( st_ivas->nchan_transport == 2 && st_ivas->ivas_format != SBA_ISM_FORMAT )
#else
    else if ( st_ivas->nchan_transport == 2 )
#endif
    {
        for ( n = 0; n < CPE_CHANNELS; n++ )
        {
@@ -125,7 +129,7 @@ ivas_error ivas_sba_dec_reconfigure(
    ISM_MODE ism_mode_old;
    int16_t granularity_new;
#ifdef NONBE_FIX_ISM_XOVER_BR
    int16_t n_all;
    int16_t nchan_transport;
#endif

    ism_mode_old = st_ivas->ism_mode;
@@ -458,7 +462,7 @@ ivas_error ivas_sba_dec_reconfigure(
     *-----------------------------------------------------------------*/

#ifdef NONBE_FIX_ISM_XOVER_BR
    n_all = st_ivas->nchan_transport;
    nchan_transport = st_ivas->nchan_transport;
#endif
    if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
    {
@@ -530,10 +534,8 @@ ivas_error ivas_sba_dec_reconfigure(
            }

#ifdef NONBE_FIX_ISM_XOVER_BR
            {
                int16_t n_all_1 = st_ivas->nchan_transport + st_ivas->nchan_ism;
                st_ivas->nCPE = ( n_all_1 / 2 ) + ( n_all_1 % 2 );
            }
            nchan_transport += st_ivas->nchan_ism;
            st_ivas->nCPE = ( nchan_transport + 1) >> 1;
#else
            st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1;
#endif
@@ -552,7 +554,7 @@ ivas_error ivas_sba_dec_reconfigure(
            }

#ifdef NONBE_FIX_ISM_XOVER_BR
            n_all = st_ivas->nchan_transport;
            nchan_transport = st_ivas->nchan_transport;
#endif
            nchan_transport_old += st_ivas->nchan_ism;

@@ -561,8 +563,9 @@ ivas_error ivas_sba_dec_reconfigure(
        else if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC )
        {
#ifdef NONBE_FIX_ISM_XOVER_BR
            n_all = st_ivas->nchan_transport + st_ivas->nchan_ism;
            st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 );
            nchan_transport = st_ivas->nchan_transport + st_ivas->nchan_ism;
            st_ivas->nCPE = ( nchan_transport + 1) >> 1;
            nchan_transport_old += st_ivas->nchan_ism;
#else
            st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1;
            nCPE_old = st_ivas->nCPE;
@@ -574,8 +577,8 @@ ivas_error ivas_sba_dec_reconfigure(

#ifdef NONBE_FIX_ISM_XOVER_BR
    if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old,
                                                sba_dirac_stereo_flag_old, st_ivas->hDecoderConfig->ivas_total_brate / n_all,
                                                ( st_ivas->hDecoderConfig->ivas_total_brate / n_all ) * CPE_CHANNELS ) ) != IVAS_ERR_OK )
                                                sba_dirac_stereo_flag_old, st_ivas->hDecoderConfig->ivas_total_brate / nchan_transport,
                                                ( st_ivas->hDecoderConfig->ivas_total_brate / nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK )
#else
    if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK )
#endif
+1 −1
Original line number Diff line number Diff line
@@ -742,7 +742,7 @@ ivas_error ivas_init_encoder(
                int16_t n_all;

                n_all = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism;
                st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 );
                st_ivas->nCPE = ( n_all + 1 ) >> 1;
            }
#else
            st_ivas->nCPE += ( st_ivas->hEncoderConfig->nchan_ism + 1 ) >> 1;
+5 −0
Original line number Diff line number Diff line
@@ -504,6 +504,11 @@ void ivas_mct_core_enc(
        {
            nAvailBits -= IVAS_COMBINED_FORMAT_SIGNALLING_BITS;
        }
#else
        if ( ivas_format == SBA_ISM_FORMAT && nChannels > 4 )
        {
            nAvailBits -= IVAS_COMBINED_FORMAT_SIGNALLING_BITS;
        }
#endif
    }

+14 −26
Original line number Diff line number Diff line
@@ -181,13 +181,14 @@ ivas_error ivas_osba_enc_reconfig(
    int32_t ivas_total_brate;
    ivas_error error;
    ENCODER_CONFIG_HANDLE hEncoderConfig;
#ifdef NONBE_FIX_ISM_XOVER_BR
    int16_t n_all, n_all_old = 0;
#endif


    error = IVAS_ERR_OK;
    hEncoderConfig = st_ivas->hEncoderConfig;
    ivas_total_brate = hEncoderConfig->ivas_total_brate;
#ifdef NONBE_FIX_ISM_XOVER_BR
    int16_t nchan_transport;
#endif

    if ( ivas_total_brate != hEncoderConfig->last_ivas_total_brate )
    {
@@ -216,20 +217,6 @@ ivas_error ivas_osba_enc_reconfig(
        nCPE_old = st_ivas->nCPE;
        nSCE_old = st_ivas->nSCE;

#ifdef NONBE_FIX_ISM_XOVER_BR
        if ( old_ism_mode == ISM_MODE_NONE )
        {
            n_all_old = nchan_transport_old;
        }
        else if ( old_ism_mode == ISM_SBA_MODE_DISC )
        {
            n_all_old = nchan_transport_old + st_ivas->hEncoderConfig->nchan_ism;
        }
        else
        {
            assert( 0 && "This should not happen!" );
        }
#endif
        st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, hEncoderConfig->sba_order );
        analysis_order_old = ivas_sba_get_analysis_order( hEncoderConfig->last_ivas_total_brate, hEncoderConfig->sba_order );
        nbands_old = st_ivas->hQMetaData->q_direction->cfg.nbands;
@@ -357,14 +344,14 @@ ivas_error ivas_osba_enc_reconfig(
         *-----------------------------------------------------------------*/

#ifdef NONBE_FIX_ISM_XOVER_BR
        n_all = st_ivas->nchan_transport;
        nchan_transport = st_ivas->nchan_transport;
#endif
        if ( old_ism_mode == ISM_MODE_NONE && st_ivas->ism_mode == ISM_SBA_MODE_DISC )
        {
#ifdef NONBE_FIX_ISM_XOVER_BR
            {
                int16_t n_all_1 = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism;
                st_ivas->nCPE = ( n_all_1 / 2 ) + ( n_all_1 % 2 );
                nchan_transport = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism;
                st_ivas->nCPE = ( nchan_transport + 1) >> 1;
            }
#else
            st_ivas->nCPE += ( st_ivas->hEncoderConfig->nchan_ism + 1 ) >> 1;
@@ -372,17 +359,18 @@ ivas_error ivas_osba_enc_reconfig(
        }
        else if ( old_ism_mode == ISM_SBA_MODE_DISC && st_ivas->ism_mode == ISM_MODE_NONE )
        {
#ifdef NONBE_FIX_ISM_XOVER_BR
            n_all = st_ivas->nchan_transport;
#else

            nchan_transport_old += st_ivas->hEncoderConfig->nchan_ism;
#ifdef NONBE_FIX_ISM_XOVER_BR
            nchan_transport = st_ivas->nchan_transport;
#endif
        }
        else if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC )
        {
#ifdef NONBE_FIX_ISM_XOVER_BR
            n_all = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism;
            st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 );
            nchan_transport_old += st_ivas->hEncoderConfig->nchan_ism;
            nchan_transport = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism;
            st_ivas->nCPE = ( nchan_transport + 1) >> 1;
#else
            st_ivas->nCPE += ( st_ivas->hEncoderConfig->nchan_ism + 1 ) >> 1;
            nCPE_old = st_ivas->nCPE;
@@ -392,7 +380,7 @@ ivas_error ivas_osba_enc_reconfig(
        }

#ifdef NONBE_FIX_ISM_XOVER_BR
        if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, n_all_old, ivas_total_brate / n_all, ( ivas_total_brate / n_all ) * CPE_CHANNELS, MC_MODE_NONE ) ) != IVAS_ERR_OK )
        if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old,  nchan_transport_old, ivas_total_brate / nchan_transport, ( ivas_total_brate / nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ) ) != IVAS_ERR_OK )
#else
        if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, ivas_total_brate / st_ivas->nchan_transport, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ) ) != IVAS_ERR_OK )
#endif