Commit 5cec3af8 authored by vaclav's avatar vaclav
Browse files

fix NONBE_1324_TC_BUFFER_MEMOERY_KEEP

parent 12c27fc8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -178,6 +178,7 @@
#define NONBE_1122_KEEP_EVS_MODE_UNCHANGED              /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR.  */
#define NONBE_FIX_1326_MASA_EXTREND_CUSTOMLS_OUT        /* FhG: Fix crash for external renderer MASA to custom LS rendering, number of output channels not set correctly */
#define NONBE_1325_TD_STEREO_QUANT_LSF_SEC              /* Nokia: issue 1325: fix for usage of active_cnt variable in TD stereo LSFQ */
#define NONBE_1324_TC_BUFFER_MEMOERY_KEEP               /* VA: issue 1324: do not reset TSM memory in JBM bitrate switching */

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

+24 −0
Original line number Diff line number Diff line
@@ -2382,6 +2382,11 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure(
    const int16_t n_samples_granularity     /* i  : new granularity of the renderer/buffer  */
)
{
#ifdef NONBE_1324_TC_BUFFER_MEMOERY_KEEP
    float tc_buffer_mem[CPE_CHANNELS * MAX_JBM_L_FRAME48k];
    int16_t num_tc_buffer_mem;
    AUDIO_CONFIG output_config;
#endif
#ifdef JBM_MEMORY_OPT
    ivas_error error;
#else
@@ -2391,7 +2396,18 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure(
    DECODER_TC_BUFFER_HANDLE hTcBuffer;

    hTcBuffer = st_ivas->hTcBuffer;
#ifdef NONBE_1324_TC_BUFFER_MEMOERY_KEEP
    output_config = st_ivas->hDecoderConfig->output_config;

    num_tc_buffer_mem = 0;
    if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
    {
        /* keep CPE_CHANNELS channels of the TC buffer for smooth transition for swithing within 1 CPE and TD decorr. on and off */
        num_tc_buffer_mem = min( hTcBuffer->nchan_buffer_full, CPE_CHANNELS );
        mvr2r( hTcBuffer->tc_buffer, tc_buffer_mem, num_tc_buffer_mem * NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) );
    }

#endif
    /* if granularity changes, adapt subframe_nb_slots */
    if ( n_samples_granularity != hTcBuffer->n_samples_granularity )
    {
@@ -2510,6 +2526,14 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure(
    }
#endif

#ifdef NONBE_1324_TC_BUFFER_MEMOERY_KEEP
    if ( num_tc_buffer_mem > 0 )
    {
        /* propagate CPE_CHANNELS channels of the TC buffer */
        mvr2r( tc_buffer_mem, hTcBuffer->tc_buffer, num_tc_buffer_mem * NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) );
    }

#endif
    return IVAS_ERR_OK;
}