Commit f94397df authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Merge branch '2054-basop-PortMr2140-from-float' into 'main'

[non-BE] [allow-regression] Port MR2140 from float to BASOP - Keep TSM memory in JBM bitrate switching

Closes #2054

See merge request !2291
parents e18c9336 13972502
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -113,6 +113,7 @@
#define FIX_NCHAN_BUFFERS                               /* VA: issue 1322: Correct the number of float buffers (channels) at the decoder */
#define FIX_RENDERER_STACK                              /* VA: issue 1322: reduction of renderers' buffers size */
#define JBM_MEMORY_OPT                                  /* VA: issue 916: optimization of RAM in the JBM decoder */
/*#define NONBE_1324_TC_BUFFER_MEMOERY_KEEP*/           /* VA: issue 1324: do not reset TSM memory in JBM bitrate switching */
#define FIX_1370_EXTERNAL_ORIENTATION_CHECK             /* Nokia: add sanity check for Euler angles for external orientations */
#define FIX_1413_IGF_INIT_PRINTOUT                      /* FhG: use correct variable for IGF initiliazation */
#define CODE_IMPROVEMENTS
+34 −0
Original line number Diff line number Diff line
@@ -3638,6 +3638,10 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure_fx(
    const Word16 n_samples_granularity     /* i  : new granularity of the renderer/buffer  */
)
{
#ifdef NONBE_1324_TC_BUFFER_MEMOERY_KEEP
    Word16 ch_idx, num_tc_buffer_mem, n_samples_still_available;
    Word32 tc_buffer_mem[MAX_INTERN_CHANNELS][L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES - 1];
#endif
#ifdef JBM_MEMORY_OPT
    ivas_error error;
#else
@@ -3649,6 +3653,28 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure_fx(
    hTcBuffer = st_ivas->hTcBuffer;
    move16();

#ifdef NONBE_1324_TC_BUFFER_MEMOERY_KEEP
    num_tc_buffer_mem = 0;
    move16();
    n_samples_still_available = 0;
    move16();

    IF( st_ivas->hDecoderConfig->Opt_tsm )
    {
        /* save samples of the TC buffer from the previous frame */
        num_tc_buffer_mem = s_min( hTcBuffer->nchan_transport_internal, nchan_transport_internal );
        n_samples_still_available = sub( hTcBuffer->n_samples_buffered, hTcBuffer->n_samples_rendered );

        /* what is remaining from last frame needs always be smaller than the new granularity */
        assert( n_samples_still_available < n_samples_granularity );

        FOR( ch_idx = 0; ch_idx < num_tc_buffer_mem; ch_idx++ )
        {
            Copy32( hTcBuffer->tc_buffer_old_fx[ch_idx] + hTcBuffer->n_samples_flushed, tc_buffer_mem[ch_idx], n_samples_still_available );
        }
    }

#endif
    /* if granularity changes, adapt subframe_nb_slots */
    IF( NE_16( n_samples_granularity, hTcBuffer->n_samples_granularity ) )
    {
@@ -3759,6 +3785,14 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure_fx(
    }
#endif

#ifdef NONBE_1324_TC_BUFFER_MEMOERY_KEEP
    /* propagate samples of the TC buffer from the previous frame */
    FOR( ch_idx = 0; ch_idx < num_tc_buffer_mem; ch_idx++ )
    {
        Copy32( tc_buffer_mem[ch_idx], hTcBuffer->tc_buffer_old_fx[ch_idx], n_samples_still_available );
    }

#endif
    return IVAS_ERR_OK;
}