Commit 6e7273ab authored by vaclav's avatar vaclav
Browse files

Merge branch '1200-bug-in-renderer-flush-in-ism-jbm-bitrate-switching' into 'main'

[non-BE] Resolve "Bug in renderer flush in ISM JBM bitrate switching"

See merge request !1825
parents 568f825a 750b2467
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -196,6 +196,7 @@
#define NONBE_FIX_1208_DFT_STEREO_PLC_BURST             /* Ericsson: Issue 1208, fix for overflow of sample offset counter for burst error in DFT Stereo PLC. */
#define NONBE_FIX_1208_DFT_STEREO_PLC_BURST             /* Ericsson: Issue 1208, fix for overflow of sample offset counter for burst error in DFT Stereo PLC. */
#define FIX_1206_ZERO_OUT_IMDCT_BUFFERS_FOR_MCT_IGNORE  /* FhG: zero out all relevant imdct buffers in MCT decoding of channels with mct_chan_mode == MCT_CHAN_MODE_IGNORE */
#define FIX_1206_ZERO_OUT_IMDCT_BUFFERS_FOR_MCT_IGNORE  /* FhG: zero out all relevant imdct buffers in MCT decoding of channels with mct_chan_mode == MCT_CHAN_MODE_IGNORE */
#define NONBE_1199_OMASA_JBM_BRATE_SW_FLUSH             /* VA: issue 1199: fix bug in renderer flush in OMASA JBM bitrate switching */
#define NONBE_1199_OMASA_JBM_BRATE_SW_FLUSH             /* VA: issue 1199: fix bug in renderer flush in OMASA JBM bitrate switching */
#define NONBE_1200_ISM_JBM_BRATE_SW_FLUSH               /* VA: issue 1200: fix bug in renderer flush in ISM JBM bitrate switching */




/* ##################### End NON-BE switches ########################### */
/* ##################### End NON-BE switches ########################### */
+27 −4
Original line number Original line Diff line number Diff line
@@ -133,7 +133,9 @@ static ivas_error ivas_ism_bitrate_switching_dec(
        ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->hDecoderConfig->output_config );
        ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->hDecoderConfig->output_config );
    }
    }


#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH
    {
    {
#endif
        /* transfer subframe info from DirAC or ParamMC to central tc buffer */
        /* transfer subframe info from DirAC or ParamMC to central tc buffer */
        /* only do this if we are not having done everything already in the TC decoding part and having only played out from the TC buffer */
        /* only do this if we are not having done everything already in the TC decoding part and having only played out from the TC buffer */
        if ( last_ism_mode == ISM_MODE_PARAM && st_ivas->hSpatParamRendCom != NULL && st_ivas->hTcBuffer->tc_buffer_mode != TC_BUFFER_MODE_BUFFER )
        if ( last_ism_mode == ISM_MODE_PARAM && st_ivas->hSpatParamRendCom != NULL && st_ivas->hTcBuffer->tc_buffer_mode != TC_BUFFER_MODE_BUFFER )
@@ -154,10 +156,19 @@ static ivas_error ivas_ism_bitrate_switching_dec(
#ifdef FIX_HRTF_LOAD
#ifdef FIX_HRTF_LOAD
            /* flush already done in IVAS_DEC_ReadFormat() */
            /* flush already done in IVAS_DEC_ReadFormat() */
#else
#else
#ifdef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH
        /* write back info for correct rendering of the flushable samples */
        int16_t nchan_transport_ref = st_ivas->nchan_transport;
        st_ivas->nchan_transport = nchan_transport_old;

#endif
        if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK )
        if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK )
        {
        {
            return error;
            return error;
        }
        }
#ifdef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH
        st_ivas->nchan_transport = nchan_transport_ref;
#endif
#endif
#endif
        }
        }
        /* JBM: when granularity goes up set samples to discard at the beginning of the frame */
        /* JBM: when granularity goes up set samples to discard at the beginning of the frame */
@@ -168,7 +179,9 @@ static ivas_error ivas_ism_bitrate_switching_dec(
                return error;
                return error;
            }
            }
        }
        }
#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH
    }
    }
#endif


    if ( st_ivas->ism_mode != last_ism_mode )
    if ( st_ivas->ism_mode != last_ism_mode )
    {
    {
@@ -326,19 +339,26 @@ static ivas_error ivas_ism_bitrate_switching_dec(
     * floating-point output audio buffers
     * floating-point output audio buffers
     *-----------------------------------------------------------------*/
     *-----------------------------------------------------------------*/


#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH
    {
    {
#endif
        nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 );
        nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 );


        if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK )
        if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK )
        {
        {
            return error;
            return error;
        }
        }
#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH
    }
    }
#endif


    /*-----------------------------------------------------------------*
    /*-----------------------------------------------------------------*
     * JBM TC buffers
     * JBM TC buffers
     *-----------------------------------------------------------------*/
     *-----------------------------------------------------------------*/

#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH
    {
    {
#endif
        int16_t tc_nchan_full_new;
        int16_t tc_nchan_full_new;
        DECODER_TC_BUFFER_HANDLE hTcBuffer;
        DECODER_TC_BUFFER_HANDLE hTcBuffer;


@@ -374,7 +394,9 @@ static ivas_error ivas_ism_bitrate_switching_dec(


            mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
            mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
        }
        }
#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH
    }
    }
#endif


#ifdef FIX_HRTF_LOAD
#ifdef FIX_HRTF_LOAD
    return IVAS_ERR_OK;
    return IVAS_ERR_OK;
@@ -465,6 +487,7 @@ ivas_error ivas_ism_dec_config(
        /* ISM mode switching */
        /* ISM mode switching */
        if ( st_ivas->ism_mode != last_ism_mode )
        if ( st_ivas->ism_mode != last_ism_mode )
        {
        {

#ifdef FIX_HRTF_LOAD
#ifdef FIX_HRTF_LOAD
            if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode ) ) != IVAS_ERR_OK )
            if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode ) ) != IVAS_ERR_OK )
#else
#else
+4 −2
Original line number Original line Diff line number Diff line
@@ -1043,9 +1043,11 @@ ivas_error IVAS_DEC_ReadFormat(
            /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv
            /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv
            render what still fits in the new granularity */
            render what still fits in the new granularity */
            int16_t tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs );
            int16_t tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs );

#ifdef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH
            st_ivas->nchan_transport = nchan_transport_old;
#else
            // st_ivas->nchan_transport = nchan_transport_old; // ToDo: temporarily deactivated to keep FIX_HRTF_LOAD bit-exact but this is likely a bug in the main -> see issue #1200
            // st_ivas->nchan_transport = nchan_transport_old; // ToDo: temporarily deactivated to keep FIX_HRTF_LOAD bit-exact but this is likely a bug in the main -> see issue #1200

#endif
#ifndef NONBE_1199_OMASA_JBM_BRATE_SW_FLUSH
#ifndef NONBE_1199_OMASA_JBM_BRATE_SW_FLUSH
            if ( st_ivas->ivas_format == MASA_FORMAT )
            if ( st_ivas->ivas_format == MASA_FORMAT )
            {
            {