From f82c3b61eca6f5e92c3b902f7137130e2f4d1401 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 19 Dec 2025 11:49:57 +0100 Subject: [PATCH 1/3] introduce REMOVE_UNUSED_CODE_IVAS_DEC --- lib_com/ivas_prot.h | 5 ++++- lib_com/options.h | 1 + lib_dec/ivas_jbm_dec.c | 18 ++++++++++++++++-- lib_dec/ivas_sba_dirac_stereo_dec.c | 8 +++++++- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index be936f2c37..d919dcb3e3 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3567,8 +3567,11 @@ int16_t ivas_sba_remapTCs( void ivas_sba_dirac_stereo_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output[CPE_CHANNELS], /* o : output synthesis signal */ - const int16_t output_frame, /* i : output frame length per channel */ + const int16_t output_frame /* i : output frame length per channel */ +#ifndef REMOVE_UNUSED_CODE_IVAS_DEC + , const int16_t mcmasa /* i : McMASA flag */ +#endif ); void ivas_sba_dirac_stereo_config( diff --git a/lib_com/options.h b/lib_com/options.h index de58cbabd7..e6b214a414 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -173,6 +173,7 @@ #define FIX_2287_MCT_MDCT_STEREO_DATA_MALLOC_SIZE /* FhG: correct allocation size for STEREO_MDCT_DEC_DATA struct */ #define FIX_2271_OOB_INDEXING_IN_PIT_OL2 /* VA: Fix for issue 2271, to silence clang18 */ #define FIX_2273_OOB_INDEXING_IN_PIT_FR4 /* VA: Fix to silence clang on ptr init */ +#define REMOVE_UNUSED_CODE_IVAS_DEC /* VA: remove unused code in ivas_jbm_dec_tc_fx() */() /* #################### End BE switches ################################## */ diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 4f0acd6364..df177a72e5 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -105,6 +105,7 @@ ivas_error ivas_jbm_dec_tc( * Decoding + pre-rendering *----------------------------------------------------------------*/ +#ifndef REMOVE_UNUSED_CODE_IVAS_DEC if ( st_ivas->bfi && st_ivas->ini_frame == 0 ) { /* zero output when first frame(s) is lost */ @@ -120,7 +121,9 @@ ivas_error ivas_jbm_dec_tc( st_ivas->hSCE[0] = NULL; #endif } - else if ( st_ivas->ivas_format == STEREO_FORMAT ) + else +#endif + if ( st_ivas->ivas_format == STEREO_FORMAT ) { st_ivas->hCPE[0]->element_brate = ivas_total_brate; if ( ( error = ivas_cpe_dec( st_ivas, 0, p_output, output_frame, 0 ) ) != IVAS_ERR_OK ) @@ -197,7 +200,6 @@ ivas_error ivas_jbm_dec_tc( { set_s( nb_bits_metadata, 0, MAX_SCE ); - /* read parameters from the bitstream */ if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hQMetaData != NULL ) { @@ -267,7 +269,11 @@ ivas_error ivas_jbm_dec_tc( ivas_spar_dec_gen_umx_mat( st_ivas->hSpar->hMdDec, st_ivas->nchan_transport, IVAS_MAX_NUM_BANDS, st_ivas->bfi, ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, ivas_total_brate, st_ivas->last_active_ivas_total_brate ) ); } +#ifdef REMOVE_UNUSED_CODE_IVAS_DEC + ivas_sba_dirac_stereo_dec( st_ivas, p_output, output_frame ); +#else ivas_sba_dirac_stereo_dec( st_ivas, p_output, output_frame, st_ivas->ivas_format == MC_FORMAT ); +#endif } else if ( st_ivas->ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE && ( ivas_total_brate > IVAS_SID_5k2 || ( ivas_total_brate <= IVAS_SID_5k2 && st_ivas->nCPE > 0 && st_ivas->hCPE[0]->nchan_out == 1 ) ) ) { @@ -469,7 +475,11 @@ ivas_error ivas_jbm_dec_tc( ivas_spar_dec_gen_umx_mat( st_ivas->hSpar->hMdDec, st_ivas->nchan_transport, IVAS_MAX_NUM_BANDS, st_ivas->bfi, ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ) ); +#ifdef REMOVE_UNUSED_CODE_IVAS_DEC + ivas_sba_dirac_stereo_dec( st_ivas, &p_output[sba_ch_idx], output_frame ); +#else ivas_sba_dirac_stereo_dec( st_ivas, &p_output[sba_ch_idx], output_frame, 0 ); +#endif } /* HP filtering */ @@ -695,7 +705,11 @@ ivas_error ivas_jbm_dec_tc( if ( st_ivas->sba_dirac_stereo_flag ) /* use the flag to trigger the DFT upmix */ { +#ifdef REMOVE_UNUSED_CODE_IVAS_DEC + ivas_sba_dirac_stereo_dec( st_ivas, p_output, output_frame ); +#else ivas_sba_dirac_stereo_dec( st_ivas, p_output, output_frame, 1 ); +#endif } /* HP filtering */ diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c index 44e8d81d93..9269774368 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -827,8 +827,11 @@ void ivas_sba_dirac_stereo_smooth_parameters( void ivas_sba_dirac_stereo_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output[CPE_CHANNELS], /* i/o: output synthesis signal */ - const int16_t output_frame, /* i : output frame length per channel */ + const int16_t output_frame /* i : output frame length per channel */ +#ifndef REMOVE_UNUSED_CODE_IVAS_DEC + , const int16_t mcmasa /* i : McMASA flag */ +#endif ) { int16_t dtx_flag, fd_cng_flag; @@ -842,6 +845,9 @@ void ivas_sba_dirac_stereo_dec( SCE_DEC_HANDLE hSCE; CPE_DEC_HANDLE hCPE; STEREO_DFT_DEC_DATA_HANDLE hStereoDft; +#ifdef REMOVE_UNUSED_CODE_IVAS_DEC + int16_t mcmasa = st_ivas->ivas_format == MC_FORMAT; +#endif hSCE = st_ivas->hSCE[0]; hCPE = st_ivas->hCPE[0]; -- GitLab From d32e83f3c167c591ce05272a85fa8a4b690b03fe Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 19 Dec 2025 12:01:54 +0100 Subject: [PATCH 2/3] clang-format --- lib_dec/ivas_sba_dirac_stereo_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c index 9269774368..c3d321a9e3 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -830,7 +830,7 @@ void ivas_sba_dirac_stereo_dec( const int16_t output_frame /* i : output frame length per channel */ #ifndef REMOVE_UNUSED_CODE_IVAS_DEC , - const int16_t mcmasa /* i : McMASA flag */ + const int16_t mcmasa /* i : McMASA flag */ #endif ) { -- GitLab From e8f262c85f02de7fa01f62a5e41935d2e8c0c779 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 19 Dec 2025 13:20:07 +0100 Subject: [PATCH 3/3] harmonization with basop --- lib_dec/ivas_sba_dirac_stereo_dec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c index c3d321a9e3..126d29b1e1 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -837,6 +837,7 @@ void ivas_sba_dirac_stereo_dec( int16_t dtx_flag, fd_cng_flag; int16_t sba_mono_flag; int16_t memOffset; + int32_t output_Fs; float tmp_buf[NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; float tmp_synth[L_FRAME16k]; float hb_gain[NB_DIV]; @@ -849,6 +850,8 @@ void ivas_sba_dirac_stereo_dec( int16_t mcmasa = st_ivas->ivas_format == MC_FORMAT; #endif + output_Fs = st_ivas->hDecoderConfig->output_Fs; + hSCE = st_ivas->hSCE[0]; hCPE = st_ivas->hCPE[0]; hStereoDft = hCPE->hStereoDft; @@ -868,7 +871,7 @@ void ivas_sba_dirac_stereo_dec( memOffset = NS2SA( output_frame * FRAMES_PER_SEC, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ); ivas_sba_dirac_stereo_config( hStereoDft->hConfig ); - hStereoDft->nbands = ivas_sba_dirac_stereo_band_config( hStereoDft->band_limits, st_ivas->hDecoderConfig->output_Fs, hStereoDft->NFFT, ( ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) && !mcmasa ) ); + hStereoDft->nbands = ivas_sba_dirac_stereo_band_config( hStereoDft->band_limits, output_Fs, hStereoDft->NFFT, ( ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) && !mcmasa ) ); stereo_dft_dec_update( hStereoDft, output_frame, 1 /*st_ivas->sba_dirac_stereo_flag*/ ); if ( st_ivas->nchan_transport > 1 ) { @@ -901,7 +904,7 @@ void ivas_sba_dirac_stereo_dec( /* DFT Stereo upmix */ stereo_dft_dec( hStereoDft, hCPE->hCoreCoder[0], DFT, NULL, NULL, 1 /*st_ivas->sba_dirac_stereo_flag*/, sba_mono_flag, ( st_ivas->hSpar != NULL && !mcmasa ) ? st_ivas->hSpar->hMdDec : NULL, ( st_ivas->hSpar != NULL && !mcmasa ) ? st_ivas->hSpar->hFbMixer->cross_fade_start_offset : 0, - st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_transport, ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ) ); + output_Fs, st_ivas->nchan_transport, ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ) ); /* DFT synthesis */ stereo_dft_dec_synthesize( hCPE, DFT, 0, output[0], output_frame ); -- GitLab