From 3292252a2c8fc470fb4bd97efdf6babfc6130098 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 10 May 2024 11:42:20 +0200 Subject: [PATCH 1/3] clang-format --- lib_com/options.h | 1 + lib_dec/ivas_mct_dec.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index b1d421c416..9482072b1d 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -179,6 +179,7 @@ #define NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT /* fix 1070 USAN: nullptr-with-offset and Segfaults in 7_1_4 to BINAURAL and BINAURAL_ROOM_REVERB decoding with bitrate switching and head rotation*/ #define NONBE_FIX_MC_LFE_LPF /* Dlb: Adding the LFE LPF filter back for MC content. */ #define NONBE_FIX_1052_SBA_EXT /* Dlb: SBA external output support */ +#define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 98d9db7163..00b5c7dc48 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -148,6 +148,17 @@ ivas_error ivas_mct_dec( /* MCT side bits decoder */ ivas_mct_side_bits( hMCT, st_ivas->hCPE, nCPE, st_ivas->hCPE[0]->hCoreCoder[0], st_ivas->bfi, st_ivas->hCPE[0]->hCoreCoder[0]->bit_stream, ivas_total_brate, nb_bits_metadata ); +#ifdef NONBE_FIX_1087_OOB_SBA_DTX_RS + /* in case of switching from an SID frame (with ACELP core) to MCT, buffer of 1200 samples is needed -> use synth[] as a temporary buffer */ + if ( st_ivas->hCPE[0]->hCoreCoder[0]->last_core == ACELP_CORE ) + { + for ( n = 0; n < CPE_CHANNELS; n++ ) + { + output[n] = synth[n]; + } + } +#endif + for ( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) { st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect |= st_ivas->BER_detect; @@ -263,7 +274,6 @@ ivas_error ivas_mct_dec( #endif } /* n_channels loop */ - /* synthesis synchronization between stereo modes */ if ( !st_ivas->sba_dirac_stereo_flag || ( st_ivas->ivas_format == SBA_ISM_FORMAT && cpe_id < nCPE - 2 ) ) { -- GitLab From 9692af63468c769ca976736faf267780f5d75961 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 10 May 2024 11:44:05 +0200 Subject: [PATCH 2/3] comment --- lib_dec/ivas_mct_dec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 00b5c7dc48..a384c39e47 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -150,6 +150,7 @@ ivas_error ivas_mct_dec( #ifdef NONBE_FIX_1087_OOB_SBA_DTX_RS /* in case of switching from an SID frame (with ACELP core) to MCT, buffer of 1200 samples is needed -> use synth[] as a temporary buffer */ + /* the pointers are moved back when calling ivas_mdct_core_reconstruct() */ if ( st_ivas->hCPE[0]->hCoreCoder[0]->last_core == ACELP_CORE ) { for ( n = 0; n < CPE_CHANNELS; n++ ) -- GitLab From 7e8ca9f02fc9cd9e5ad7b4e5fd95e9cac35b7a7d Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 14 May 2024 11:24:50 +0200 Subject: [PATCH 3/3] fix within NONBE_FIX_1087_OOB_SBA_DTX_RS --- lib_dec/ivas_mct_dec.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index a384c39e47..d6304e74f2 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -87,6 +87,9 @@ ivas_error ivas_mct_dec( STnsData tnsData[MCT_MAX_BLOCKS][CPE_CHANNELS][NB_DIV]; Decoder_State **sts; float synth[CPE_CHANNELS][L_FRAME_PLUS]; +#ifdef NONBE_FIX_1087_OOB_SBA_DTX_RS + float *p_output_orig[2]; +#endif float output_lfe_ch[L_FRAME48k]; int32_t ivas_total_brate; ivas_error error; @@ -149,12 +152,12 @@ ivas_error ivas_mct_dec( ivas_mct_side_bits( hMCT, st_ivas->hCPE, nCPE, st_ivas->hCPE[0]->hCoreCoder[0], st_ivas->bfi, st_ivas->hCPE[0]->hCoreCoder[0]->bit_stream, ivas_total_brate, nb_bits_metadata ); #ifdef NONBE_FIX_1087_OOB_SBA_DTX_RS - /* in case of switching from an SID frame (with ACELP core) to MCT, buffer of 1200 samples is needed -> use synth[] as a temporary buffer */ - /* the pointers are moved back when calling ivas_mdct_core_reconstruct() */ + /* in case of switching from an SID frame (with ACELP core) to MCT, buffer of L_FRAME_PLUS samples is needed -> use synth[] as a temporary buffer */ if ( st_ivas->hCPE[0]->hCoreCoder[0]->last_core == ACELP_CORE ) { for ( n = 0; n < CPE_CHANNELS; n++ ) { + p_output_orig[n] = output[n]; output[n] = synth[n]; } } @@ -244,6 +247,17 @@ ivas_error ivas_mct_dec( ivas_mdct_core_reconstruct( hCPE, x, synth, fUseTns[cpe_id], 1 ); +#ifdef NONBE_FIX_1087_OOB_SBA_DTX_RS + /* set pointers back */ + if ( cpe_id == 0 && st_ivas->hCPE[0]->hCoreCoder[0]->last_core == ACELP_CORE ) + { + for ( n = 0; n < CPE_CHANNELS; n++ ) + { + output[n] = p_output_orig[n]; + } + } + +#endif /*----------------------------------------------------------------* * CoreCoder Post-processing and updates *----------------------------------------------------------------*/ -- GitLab