Commit 21f07257 authored by Dominik Weckbecker's avatar Dominik Weckbecker 💬
Browse files

fix formula for nCPE at all OSBA bitrates

parent 3374e955
Loading
Loading
Loading
Loading
+23 −5
Original line number Diff line number Diff line
@@ -514,7 +514,16 @@ ivas_error ivas_dec_setup(
                /*correct number of CPEs for discrete ISM coding*/
                if ( st_ivas->ini_frame > 0 && st_ivas->ism_mode == ISM_SBA_MODE_DISC )
                {
#ifdef NONBE_FIX_ISM_XOVER_BR
                    {
                        int16_t n;

                        n = st_ivas->nchan_transport + st_ivas->nchan_ism;
                        st_ivas->nCPE = ( n / 2 ) + ( n % 2 );
                    }
#else
                    st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1;
#endif
                }
            }
#ifdef NONBE_FIX_ISM_XOVER_BR
@@ -1598,7 +1607,16 @@ ivas_error ivas_init_decoder(

        if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC )
        {
#ifdef NONBE_FIX_ISM_XOVER_BR
            {
                int16_t n_all;

                n_all = st_ivas->nchan_transport + st_ivas->nchan_ism;
                st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 );
            }
#else
            st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1;
#endif
            st_ivas->element_mode_init = IVAS_CPE_MDCT;
        }

+20 −2
Original line number Diff line number Diff line
@@ -515,7 +515,16 @@ ivas_error ivas_sba_dec_reconfigure(
                return error;
            }

#ifdef NONBE_FIX_ISM_XOVER_BR
            {
                int16_t n_all;

                n_all = st_ivas->nchan_transport + st_ivas->nchan_ism;
                st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 );
            }
#else
            st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1;
#endif
		}
        else if ( ism_mode_old == ISM_SBA_MODE_DISC && st_ivas->ism_mode == ISM_MODE_NONE )
        {
@@ -538,7 +547,16 @@ ivas_error ivas_sba_dec_reconfigure(
        }
        else if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC )
        {
#ifdef NONBE_FIX_ISM_XOVER_BR
            {
                int16_t n_all;

                n_all = st_ivas->nchan_transport + st_ivas->nchan_ism;
                st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 );
            }
#else
            st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1;
#endif
			nCPE_old = st_ivas->nCPE;
            nchan_transport_old = st_ivas->nchan_transport;
            nchan_transport_old += st_ivas->nchan_ism;
+11 −3
Original line number Diff line number Diff line
@@ -736,8 +736,16 @@ ivas_error ivas_init_encoder(
        else
        {
            /* allocate and initialize MCT core coder */
            st_ivas->nCPE += ( st_ivas->hEncoderConfig->nchan_ism + 1 ) >> 1;
#ifdef NONBE_FIX_ISM_XOVER_BR
            {
                int16_t n_all;

                n_all = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism;
                st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 );
            }
#else
            st_ivas->nCPE += ( st_ivas->hEncoderConfig->nchan_ism + 1 ) >> 1;
#endif
            for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
            {
                if ( ( error = create_cpe_enc( st_ivas, cpe_id, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK )
+20 −2
Original line number Diff line number Diff line
@@ -340,7 +340,16 @@ ivas_error ivas_osba_enc_reconfig(

        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;

                n_all = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism;
                st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 );
            }
#else
            st_ivas->nCPE += ( st_ivas->hEncoderConfig->nchan_ism + 1 ) >> 1;
#endif
		}
        else if ( old_ism_mode == ISM_SBA_MODE_DISC && st_ivas->ism_mode == ISM_MODE_NONE )
        {
@@ -348,7 +357,16 @@ ivas_error ivas_osba_enc_reconfig(
        }
        else if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC )
        {
#ifdef NONBE_FIX_ISM_XOVER_BR
            {
                int16_t n_all;

                n_all = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism;
                st_ivas->nCPE = ( n_all / 2 ) + ( n_all % 2 );
            }
#else
            st_ivas->nCPE += ( st_ivas->hEncoderConfig->nchan_ism + 1 ) >> 1;
#endif
			nCPE_old = st_ivas->nCPE;
            nchan_transport_old = st_ivas->nchan_transport;
            nchan_transport_old += st_ivas->hEncoderConfig->nchan_ism;