Commit b746a955 authored by vaclav's avatar vaclav
Browse files

Merge branch '1199-bug-in-renderer-flush-in-omasa-jbm-bitrate-switching' into 'main'

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

See merge request !1824
parents 9af190bf 30ae8f90
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -188,6 +188,7 @@
#define FIX_1139_REV_COLORATION_SHORT_T60               /* Nokia,FhG: Fix issue 1139, prevent sound coloration artefacts at very low reverberation times */
#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 NONBE_1199_OMASA_JBM_BRATE_SW_FLUSH             /* VA: issue 1199: fix bug in renderer flush in OMASA JBM bitrate switching */

/* ##################### End NON-BE switches ########################### */

+12 −0
Original line number Diff line number Diff line
@@ -572,6 +572,9 @@ ivas_error ivas_dec_setup(
            }

            /* this should be non-zero if original input format was MASA_ISM_FORMAT */
#ifdef NONBE_1199_OMASA_JBM_BRATE_SW_FLUSH
            st_ivas->ism_mode = ISM_MODE_NONE;
#endif
            st_ivas->nchan_ism = st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 3] + 2 * st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 2];

            if ( st_ivas->nchan_ism > 0 )
@@ -589,6 +592,7 @@ ivas_error ivas_dec_setup(
                {
                    st_ivas->nchan_ism = 1;
                }

                /* for MASA_ISM_FORMAT at input the number of MASA transport channels is always 2 and the corresponding bit is not used here*/
                st_ivas->nchan_transport = 2;
                element_mode_flag = 1;
@@ -832,6 +836,14 @@ ivas_error ivas_dec_setup(
            }
        }

#ifdef NONBE_1199_OMASA_JBM_BRATE_SW_FLUSH
        if ( st_ivas->ini_frame > 0 && st_ivas->ivas_format == MASA_FORMAT )
        {
            st_ivas->nchan_ism = 0;
            st_ivas->ism_mode = ISM_MODE_NONE;
        }

#endif
        if ( st_ivas->ivas_format == ISM_FORMAT )
        {
            ISM_MODE last_ism_mode = st_ivas->ism_mode;
+3 −1
Original line number Diff line number Diff line
@@ -151,7 +151,7 @@ ivas_error ivas_masa_decode(
    {
        if ( !( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) )
        {
#ifdef FIX_HRTF_LOAD
#if ( defined FIX_HRTF_LOAD || defined NONBE_1199_OMASA_JBM_BRATE_SW_FLUSH )
            if ( ivas_format == MASA_FORMAT )
            {
                /* re-read the number of objects, needed in case of bad frame  */
@@ -1490,6 +1490,7 @@ ivas_error ivas_masa_dec_reconfigure(

    ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &tmp, &tmp, &tmp, st_ivas->ivas_format, st_ivas->ism_mode, ism_total_brate );

#ifndef NONBE_1199_OMASA_JBM_BRATE_SW_FLUSH
    if ( st_ivas->ivas_format == MASA_FORMAT )
    {
        if ( st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
@@ -1501,6 +1502,7 @@ ivas_error ivas_masa_dec_reconfigure(
        st_ivas->ism_mode = ISM_MODE_NONE;
    }

#endif
    {
        int16_t tc_nchan_to_allocate;
        int16_t tc_nchan_transport;
+2 −0
Original line number Diff line number Diff line
@@ -1146,11 +1146,13 @@ ivas_error IVAS_DEC_ReadFormat(

            // 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

#ifndef NONBE_1199_OMASA_JBM_BRATE_SW_FLUSH
            if ( st_ivas->ivas_format == MASA_FORMAT )
            {
                st_ivas->nchan_ism = 0; // ToDo: temporary hack to keep FIX_HRTF_LOAD bit-exact but this is likely a bug in the main -> see issue #1199
            }

#endif
            if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity )
            {
                if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &st_ivas->hIntSetup, mc_mode_old, ism_mode_old, &hIvasDec->nSamplesFlushed, pcm_type_API_to_internal( hIvasDec->pcmType ), hIvasDec->flushbuffer ) ) != IVAS_ERR_OK )