From 3d84027e81b1c614cc684a14e3728e7fa8170472 Mon Sep 17 00:00:00 2001 From: Michael Schug Date: Wed, 23 Aug 2023 10:35:08 +0200 Subject: [PATCH 1/4] fix memory leak for paramupmix when switching mc bitrates --- lib_com/options.h | 1 + lib_dec/ivas_mct_dec.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index be3261f808..8f091e90d0 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -168,6 +168,7 @@ #define FIX_718_JBM_MD_UDPATE /* Fhg: fix issue #718, wrong setting of the update flag in the TD obj renderer in the JBM path */ #define FIX_719_CRASH_IN_CLEANUP /* VA: issue 719: fix Decoder crash after call to goto to cleanup */ +#define FIX_722_MEMORY_LEAK_IN_PARAMUPMIX /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 0271035526..92437cea0c 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -938,6 +938,12 @@ static ivas_error ivas_mc_dec_reconfig( /* LFE handle */ ivas_lfe_dec_close( &( st_ivas->hLFE ) ); } +#ifdef FIX_722_MEMORY_LEAK_IN_PARAMUPMIX + else if ( last_mc_mode == MC_MODE_PARAMUPMIX ) + { + ivas_mc_paramupmix_dec_close( &( st_ivas->hMCParamUpmix ) ); + } +#endif } else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { -- GitLab From 028e34373330e0764ab8859ce9f5618fafe48c2d Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 24 Aug 2023 13:02:57 +1000 Subject: [PATCH 2/4] Fix for LFE re-allocation during MC reconfig --- lib_dec/ivas_mct_dec.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 92437cea0c..4d1f67e77c 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -934,15 +934,22 @@ static ivas_error ivas_mc_dec_reconfig( { ivas_mct_dec_close( &st_ivas->hMCT ); } - +#ifndef FIX_722_MEMORY_LEAK_IN_PARAMUPMIX /* LFE handle */ ivas_lfe_dec_close( &( st_ivas->hLFE ) ); +#endif } #ifdef FIX_722_MEMORY_LEAK_IN_PARAMUPMIX else if ( last_mc_mode == MC_MODE_PARAMUPMIX ) { ivas_mc_paramupmix_dec_close( &( st_ivas->hMCParamUpmix ) ); } + + if ( st_ivas->hLFE != NULL ) + { + /* LFE handle */ + ivas_lfe_dec_close( &( st_ivas->hLFE ) ); + } #endif } else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) @@ -979,10 +986,19 @@ static ivas_error ivas_mc_dec_reconfig( if ( last_mc_mode == MC_MODE_MCT ) { ivas_mct_dec_close( &st_ivas->hMCT ); +#ifndef FIX_722_MEMORY_LEAK_IN_PARAMUPMIX + /* LFE handle */ + ivas_lfe_dec_close( &( st_ivas->hLFE ) ); +#endif + } +#ifdef FIX_722_MEMORY_LEAK_IN_PARAMUPMIX + if ( st_ivas->hLFE != NULL ) + { /* LFE handle */ ivas_lfe_dec_close( &( st_ivas->hLFE ) ); } +#endif } if ( st_ivas->mc_mode != MC_MODE_MCMASA ) -- GitLab From 7cfb9740bf0378ced64e304f0bd21a7eee7ea3e2 Mon Sep 17 00:00:00 2001 From: rtyag Date: Wed, 30 Aug 2023 15:05:49 +1000 Subject: [PATCH 3/4] rename the switch to CR_ as it is potentially non-BE --- lib_com/options.h | 3 +-- lib_dec/ivas_mct_dec.c | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 8f091e90d0..7d27548667 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -168,8 +168,6 @@ #define FIX_718_JBM_MD_UDPATE /* Fhg: fix issue #718, wrong setting of the update flag in the TD obj renderer in the JBM path */ #define FIX_719_CRASH_IN_CLEANUP /* VA: issue 719: fix Decoder crash after call to goto to cleanup */ -#define FIX_722_MEMORY_LEAK_IN_PARAMUPMIX - /* ################## End BE DEVELOPMENT switches ######################### */ /* #################### Start NON-BE CR switches ########################## */ @@ -181,6 +179,7 @@ #define CR_FIX_586_BPF_DFT_MEM /* FhG: issue 586: set input memory of DFT analysis of BPF signal to zero for HQ core to fix issue with PLC and bitrate switching */ #define CR_FIX_ISM_DTX_INFINITE_CNG_ON_TRAILING_SILENCE /* FhG: fix for cng in ISM DTX on sudden silence periods */ #define CR_FIX_698_SBA_MSAN /* Dlb: issue 698: Uninitialized memory read in SBA init */ +#define CR_FIX_722_MEMORY_LEAK_IN_PARAMUPMIX /*Dlb : issue 722: memory leak fix in MC param upmix mode with BR switching*/ /* ##################### End NON-BE CR switches ########################### */ diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 4d1f67e77c..30ffb7d350 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -934,12 +934,12 @@ static ivas_error ivas_mc_dec_reconfig( { ivas_mct_dec_close( &st_ivas->hMCT ); } -#ifndef FIX_722_MEMORY_LEAK_IN_PARAMUPMIX +#ifndef CR_FIX_722_MEMORY_LEAK_IN_PARAMUPMIX /* LFE handle */ ivas_lfe_dec_close( &( st_ivas->hLFE ) ); #endif } -#ifdef FIX_722_MEMORY_LEAK_IN_PARAMUPMIX +#ifdef CR_FIX_722_MEMORY_LEAK_IN_PARAMUPMIX else if ( last_mc_mode == MC_MODE_PARAMUPMIX ) { ivas_mc_paramupmix_dec_close( &( st_ivas->hMCParamUpmix ) ); @@ -986,13 +986,13 @@ static ivas_error ivas_mc_dec_reconfig( if ( last_mc_mode == MC_MODE_MCT ) { ivas_mct_dec_close( &st_ivas->hMCT ); -#ifndef FIX_722_MEMORY_LEAK_IN_PARAMUPMIX +#ifndef CR_FIX_722_MEMORY_LEAK_IN_PARAMUPMIX /* LFE handle */ ivas_lfe_dec_close( &( st_ivas->hLFE ) ); #endif } -#ifdef FIX_722_MEMORY_LEAK_IN_PARAMUPMIX +#ifdef CR_FIX_722_MEMORY_LEAK_IN_PARAMUPMIX if ( st_ivas->hLFE != NULL ) { /* LFE handle */ -- GitLab From baf6719876270909cec39356ded7006f9b134e2a Mon Sep 17 00:00:00 2001 From: rtyag Date: Tue, 5 Sep 2023 16:47:21 +1000 Subject: [PATCH 4/4] rename the switch --- lib_com/options.h | 2 +- lib_dec/ivas_mct_dec.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index fd7208ff54..5e2a350624 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -166,7 +166,7 @@ #define NONBE_FIX_736_FOA_BR_SWITCH /* FhG/Dlb : Issue 736: FOA bitrate switching decoding crashes in in ivas_spar_to_dirac */ #define NONBE_FIX_746_NONDIEGETIC_MD /* Eri: Issue 746: The non-diegetic panning flag affects the encoder bitstream even if extended metadata is not enabled. Crashes the decoder.*/ -#define CR_FIX_722_MEMORY_LEAK_IN_PARAMUPMIX /*Dlb : issue 722: memory leak fix in MC param upmix mode with BR switching*/ +#define NONBE_FIX_722_MEMORY_LEAK_IN_PARAMUPMIX /*Dlb : issue 722: memory leak fix in MC param upmix mode with BR switching*/ /* ##################### End NON-BE switches ############################# */ diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index dd09eb0645..f85cd6dded 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -928,12 +928,12 @@ static ivas_error ivas_mc_dec_reconfig( { ivas_mct_dec_close( &st_ivas->hMCT ); } -#ifndef CR_FIX_722_MEMORY_LEAK_IN_PARAMUPMIX +#ifndef NONBE_FIX_722_MEMORY_LEAK_IN_PARAMUPMIX /* LFE handle */ ivas_lfe_dec_close( &( st_ivas->hLFE ) ); #endif } -#ifdef CR_FIX_722_MEMORY_LEAK_IN_PARAMUPMIX +#ifdef NONBE_FIX_722_MEMORY_LEAK_IN_PARAMUPMIX else if ( last_mc_mode == MC_MODE_PARAMUPMIX ) { ivas_mc_paramupmix_dec_close( &( st_ivas->hMCParamUpmix ) ); @@ -980,13 +980,13 @@ static ivas_error ivas_mc_dec_reconfig( if ( last_mc_mode == MC_MODE_MCT ) { ivas_mct_dec_close( &st_ivas->hMCT ); -#ifndef CR_FIX_722_MEMORY_LEAK_IN_PARAMUPMIX +#ifndef NONBE_FIX_722_MEMORY_LEAK_IN_PARAMUPMIX /* LFE handle */ ivas_lfe_dec_close( &( st_ivas->hLFE ) ); #endif } -#ifdef CR_FIX_722_MEMORY_LEAK_IN_PARAMUPMIX +#ifdef NONBE_FIX_722_MEMORY_LEAK_IN_PARAMUPMIX if ( st_ivas->hLFE != NULL ) { /* LFE handle */ -- GitLab