Commit 67f02ef0 authored by Dominik Weckbecker's avatar Dominik Weckbecker 💬
Browse files

fix decoder-side bitrate switching in OSBA

parent 6a7dca9f
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -270,7 +270,11 @@ ivas_error ivas_corecoder_dec_reconfig(
        }
        else if ( st_ivas->hMCT != NULL && st_ivas->nCPE > 1 )
        {
#ifdef NONBE_FIX_ISM_XOVER_BR
            if ( ( error = mct_dec_reconfigure( st_ivas, nchan_transport_real != nchan_transport_old ) ) != IVAS_ERR_OK )
#else
            if ( ( error = mct_dec_reconfigure( st_ivas, st_ivas->nchan_transport != nchan_transport_old ) ) != IVAS_ERR_OK )
#endif
            {
                return error;
            }
+14 −15
Original line number Diff line number Diff line
@@ -124,6 +124,7 @@ ivas_error ivas_sba_dec_reconfigure(
    ivas_error error;
    ISM_MODE ism_mode_old;
    int16_t granularity_new;
    int16_t n_all;

    ism_mode_old = st_ivas->ism_mode;
    hDecoderConfig = st_ivas->hDecoderConfig;
@@ -453,7 +454,7 @@ ivas_error ivas_sba_dec_reconfigure(
    /*-----------------------------------------------------------------*
     * Allocate, initialize, and configure SCE/CPE/MCT handles
     *-----------------------------------------------------------------*/

    n_all = st_ivas->nchan_transport;
    if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
    {
        if ( ism_mode_old == ISM_MODE_NONE && st_ivas->ism_mode == ISM_SBA_MODE_DISC )
@@ -516,12 +517,8 @@ ivas_error ivas_sba_dec_reconfigure(
            }

#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
@@ -542,18 +539,18 @@ ivas_error ivas_sba_dec_reconfigure(
                    st_ivas->hHrtfTD = NULL;
                }
            }
#ifdef NONBE_FIX_ISM_XOVER_BR
            n_all = st_ivas->nchan_transport;
#endif
            nchan_transport_old += st_ivas->nchan_ism;

			st_ivas->ism_mode = ISM_MODE_NONE;
        }
        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;
            nCPE_old = st_ivas->nCPE;
@@ -563,7 +560,9 @@ ivas_error ivas_sba_dec_reconfigure(
        }
    }

    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 )
    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 )
    {
        return error;
    }