Commit f0eeab6d authored by vaclav's avatar vaclav
Browse files

Merge branch...

Merge branch '2050-basop-PortMr1825-from-float-bug-in-renderer-flush-in-ism-jbm-bitrate-switching' into 'main'

Port MR1825 from float to BASOP - Bug in renderer flush in ISM JBM bitrate switching

Closes #2050

See merge request !2283
parents bb9f8996 84ba2593
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -153,6 +153,7 @@
#define FIX_1349_TNS_CRASH                              /* FhG: Fix crash in TNS entropy coding, in case order of joint TNS coding is reduced to 0 */
#define NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING           /* Ericsson: issue 1180, corrected long term mute loop attnuation after 200ms  in PhECU-PLC  */
#define FIX_1179_USAN_PHASEECU                          /* Eri: issue 1179:  better handling of 16 bit wrap around for very long(>200ms) FER-bursts   */
#define NONBE_1200_ISM_JBM_BRATE_SW_FLUSH               /* VA: issue 1200: fix bug in renderer flush in ISM JBM bitrate switching */

// object-editing feature porting
#define OBJ_EDITING_API                                 /* object editing changes related to the API */
+36 −10
Original line number Diff line number Diff line
@@ -149,7 +149,9 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx(
        ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->hDecoderConfig->output_config );
    }

#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH
    {
#endif
        test();
        test();
        /* transfer subframe info from DirAC or ParamMC to central tc buffer */
@@ -171,25 +173,40 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx(
                render what still fits in the new granularity */
        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 );

        IF( LT_16( tc_granularity_new, st_ivas->hTcBuffer->n_samples_granularity ) ){
        IF( LT_16( tc_granularity_new, st_ivas->hTcBuffer->n_samples_granularity ) )
        {
#ifdef FIX_HRTF_LOAD
            /* flush already done in IVAS_DEC_ReadFormat() */
#else
            IF( NE_32( ( error = ivas_jbm_dec_flush_renderer_fx( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, data ) ), IVAS_ERR_OK ) ){
#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;
        move16();

#endif
        IF( NE_32( ( error = ivas_jbm_dec_flush_renderer_fx( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, data ) ), IVAS_ERR_OK ) )
        {
            return error;
        }
#ifdef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH

        st_ivas->nchan_transport = nchan_transport_ref;
        move16();
#endif
#endif
        }
        /* JBM: when granularity goes up set samples to discard at the beginning of the frame */
        ELSE
        IF( GT_16( tc_granularity_new, st_ivas->hTcBuffer->n_samples_granularity ) )
        ELSE IF( GT_16( tc_granularity_new, st_ivas->hTcBuffer->n_samples_granularity ) )
        {
            IF( NE_32( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ), IVAS_ERR_OK ) )
            {
                return error;
            }
        }
#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH
    }
#endif

    IF( NE_16( st_ivas->ism_mode, last_ism_mode ) )
    {
@@ -333,19 +350,26 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx(
     * floating-point output audio buffers
     *-----------------------------------------------------------------*/

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

        IF( NE_32( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ), IVAS_ERR_OK ) )
        {
            return error;
        }
#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH
    }
#endif

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

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

@@ -394,7 +418,9 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx(

            Copy( 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
    return IVAS_ERR_OK;
+6 −2
Original line number Diff line number Diff line
@@ -3723,8 +3723,12 @@ ivas_error IVAS_DEC_ReadFormat(
            render what still fits in the new granularity */
            Word16 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;
            move16();
#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

#endif
            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