From e06d098aacfaae1d8c4f8fb75b073852c906cea1 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:16:23 +0200 Subject: [PATCH 01/31] [cleanup] accept NONBE_FIX_2507 --- lib_com/options.h | 1 - lib_enc/tcx_utils_enc_fx.c | 11 ----------- 2 files changed, 12 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 8cfd1dc74..5daa5d097 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -91,7 +91,6 @@ #define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_SWB_fenv_fx2 /* FhG: Avoid overflow of SWB_fenv_fx in SWB_BWE_encoding_fx because of very small energies. */ #define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */ #define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527 /* Fix crash from issue #2527 */ -#define NONBE_FIX_2507 /* Fix porting error in SQ_gain_estimate_fx() */ #define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ #define HARMONIZE_2499_CONFIGUREFDCNGDEC /* FhG: basop issue 2499: harmonoize configureFdCngDec */ #define FIX_BASOP_2530_IVAS_DECISION_MAT /* VA: Fix ambiguous usage of extract_l() */ diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index 201f07b23..392ff1215 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -1254,7 +1254,6 @@ Word16 SQ_gain_estimate_fx( if ( GT_32( tmp32, 0xFF20 ) ) /* 0xFF20 -> 0.3*log2(10); */ { ener = L_add( ener, tmp32 ); -#ifdef NONBE_FIX_2507 /* if SNR is above target -> break and increase offset */ IF( GT_32( ener, target ) ) { @@ -1262,16 +1261,6 @@ Word16 SQ_gain_estimate_fx( BREAK; } } -#else - } - - /* if SNR is above target -> break and increase offset */ - IF( GT_32( ener, target ) ) - { - offset = L_add( offset, fac ); - BREAK; - } -#endif } } -- GitLab From 45ee94db5fc47d3220da97a4cb28cf606f4ae866 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:17:13 +0200 Subject: [PATCH 02/31] [cleanup] accept HARMONIZE_2499_CONFIGUREFDCNGDEC --- lib_com/ivas_prot_fx.h | 10 - lib_com/options.h | 1 - lib_com/prot_fx.h | 20 -- lib_dec/core_switching_dec_fx.c | 4 - lib_dec/fd_cng_dec_fx.c | 235 ----------------------- lib_dec/ivas_stereo_mdct_stereo_dec_fx.c | 10 - lib_dec/ivas_stereo_switching_dec_fx.c | 4 - 7 files changed, 284 deletions(-) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index db72688d8..1b2848c13 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1624,16 +1624,6 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot_fx( const Word16 nchan_in /* i : number of input channels */ ); -#ifndef HARMONIZE_2499_CONFIGUREFDCNGDEC -void configureFdCngDec_ivas_fx( - HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the FD-based CNG process */ - const Word16 bwidth, - const Word32 total_brate, - const Word16 L_frame, - const Word16 last_L_frame, - const Word16 element_mode -); -#endif void synchonize_channels_mdct_sid_fx( Decoder_State *sts[CPE_CHANNELS], /* i/o: decoder state structure */ diff --git a/lib_com/options.h b/lib_com/options.h index 5daa5d097..82da798e2 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -92,7 +92,6 @@ #define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */ #define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527 /* Fix crash from issue #2527 */ #define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ -#define HARMONIZE_2499_CONFIGUREFDCNGDEC /* FhG: basop issue 2499: harmonoize configureFdCngDec */ #define FIX_BASOP_2530_IVAS_DECISION_MAT /* VA: Fix ambiguous usage of extract_l() */ #define SIMPLIFY_CORE_ENC /* VA: basop issue 2430: Simplify ivas_core_enc_fx() */ #define FIX_2402_SIMPLIFY_ARI_CODEC /* FhG: basop issue 2402: simplified arithmetic in TCX arithmetic coder */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 477786325..7edb70be4 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -6483,16 +6483,6 @@ void initFdCngDec_fx( void deleteFdCngDec_fx( HANDLE_FD_CNG_DEC *hFdCngDec ); -#ifndef HARMONIZE_2499_CONFIGUREFDCNGDEC -/* Configure CLDFB-CNG */ -void configureFdCngDec_fx( - HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the CLDFB-based CNG process */ - Word16 bandwidth, - Word32 bitrate, - Word16 L_frame, - const Word16 Last_L_frame, - const Word16 element_mode ); -#else void configureFdCngDec_fx( HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the FD-based CNG process */ const Word16 bwidth, @@ -6500,7 +6490,6 @@ void configureFdCngDec_fx( const Word16 L_frame, const Word16 last_L_frame, const Word16 element_mode ); -#endif Word16 ApplyFdCng_fx( Word16 *timeDomainInput, /* i : pointer to time domain input */ @@ -8477,15 +8466,6 @@ void v_mult16_fx( const Word16 N /* i : Vector length */ ); -#ifndef HARMONIZE_2499_CONFIGUREFDCNGDEC -void configureFdCngDec_fx( - HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the FD-based CNG process */ - const Word16 bwidth, - const Word32 total_brate, - const Word16 L_frame, - const Word16 last_L_frame, - const Word16 element_mode ); -#endif Word32 sum2_f_16_fx( const Word16 *vec, /* i : input vector */ diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index 347898801..dffd05863 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -1928,11 +1928,7 @@ ivas_error core_switching_pre_dec_fx( } ELSE { -#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC configureFdCngDec_fx( st->hFdCngDec, st->bwidth, st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); -#else - configureFdCngDec_ivas_fx( st->hFdCngDec, st->bwidth, st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); -#endif } } ELSE diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 6f4363229..7cd664338 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -199,233 +199,6 @@ void initFdCngDec_fx( return; } -#ifndef HARMONIZE_2499_CONFIGUREFDCNGDEC -/* - configureFdCngDec_fx - - Parameters: - - hs i/o: Contains the variables related to the FD-based CNG process - numSlots i : Number of time slots in CLDFB matrix - numCoreBands i : Number of core bands - regularStopBand i : Number of CLDFB bands to be considered - CLDFBscale i : cldfb scale factor - - Function: - configure FD_CNG - - Returns: - void -*/ -void configureFdCngDec_fx( - HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the CLDFB-based CNG process */ - Word16 bwidth, /*Q0*/ - Word32 total_brate, /*Q0*/ - Word16 L_frame, /*Q0*/ - const Word16 Last_L_frame, /*Q0*/ - const Word16 element_mode /*Q0*/ ) -{ - Word16 j, stopBandFR; - HANDLE_FD_CNG_COM hsCom = hFdCngDec->hFdCngCom; - - - hsCom->CngBandwidth = bwidth; /*Q0*/ - move16(); - if ( EQ_16( hsCom->CngBandwidth, FB ) ) - { - hsCom->CngBandwidth = SWB; - move16(); - } - test(); - IF( total_brate != FRAME_NO_DATA && NE_32( total_brate, SID_2k40 ) ) - { - hsCom->CngBitrate = total_brate; /*Q0*/ - move32(); - } - ELSE IF( EQ_32( hsCom->CngBitrate, -1 ) ) - { - /* set minimum active CBR bitrate if CngBitrate is uninitialized */ - hsCom->CngBitrate = ACELP_7k20; - move32(); - if ( element_mode > EVS_MONO ) - { - hsCom->CngBitrate = IVAS_13k2; - move32(); - } - } - - /* FD-CNG config for MDCT-Stereo is always the same (since for > 48 kbps only) */ - /* This may need adjustment in the future if 2TC DTX for some mode uses MDCT-Stereo DTX for lower bitrates too */ - if ( EQ_16( element_mode, IVAS_CPE_MDCT ) ) - { - hsCom->CngBitrate = IVAS_48k; - move32(); - } - - hsCom->numSlots = 16; - move16(); - - /* NB configuration */ - IF( bwidth == NB ) - { - hsCom->FdCngSetup = FdCngSetup_nb; - hsCom->numCoreBands = 16; - move16(); - hsCom->regularStopBand = 16; - move16(); - } - - /* WB configuration */ - ELSE IF( EQ_16( bwidth, WB ) ) - { - /* FFT 6.4kHz, no CLDFB */ - test(); - test(); - IF( LE_32( hsCom->CngBitrate, ACELP_8k00 ) && EQ_16( L_frame, L_FRAME ) ) - { - hsCom->FdCngSetup = FdCngSetup_wb1; - hsCom->numCoreBands = 16; - move16(); - hsCom->regularStopBand = 16; - move16(); - } - /* FFT 6.4kHz, CLDFB 8.0kHz */ - ELSE IF( LE_32( hsCom->CngBitrate, ACELP_13k20 ) || EQ_16( L_frame, L_FRAME ) ) - { - hsCom->FdCngSetup = FdCngSetup_wb2; - hsCom->numCoreBands = 16; - move16(); - hsCom->regularStopBand = 20; - move16(); - IF( - EQ_16( L_frame, L_FRAME16k ) ) - { - hsCom->FdCngSetup = FdCngSetup_wb2; - hsCom->numCoreBands = 20; - move16(); - hsCom->regularStopBand = 20; - move16(); - hsCom->FdCngSetup.fftlen = 640; - move16(); - hsCom->FdCngSetup.stopFFTbin = 256; - move16(); - } - } - /* FFT 8.0kHz, no CLDFB */ - ELSE - { - hsCom->FdCngSetup = FdCngSetup_wb3; - hsCom->numCoreBands = 20; - move16(); - hsCom->regularStopBand = 20; - move16(); - } - } - - /* SWB/FB configuration */ - ELSE - { - /* FFT 6.4kHz, CLDFB 14kHz */ - IF( - EQ_16( L_frame, L_FRAME ) ) - { - hsCom->FdCngSetup = FdCngSetup_swb1; - hsCom->numCoreBands = 16; - move16(); - hsCom->regularStopBand = 35; - move16(); - } - /* FFT 8.0kHz, CLDFB 16kHz */ - ELSE - { - hsCom->FdCngSetup = FdCngSetup_swb2; - hsCom->numCoreBands = 20; - move16(); - hsCom->regularStopBand = 40; - move16(); - test(); - if ( EQ_16( Last_L_frame, L_FRAME ) && EQ_16( element_mode, IVAS_CPE_DFT ) ) - { - hsCom->regularStopBand = 35; - move16(); - } - } - } - hsCom->fftlen = hsCom->FdCngSetup.fftlen; /*Q0*/ - move16(); - hsCom->stopFFTbin = hsCom->FdCngSetup.stopFFTbin; /*Q0*/ - move16(); - - /* Configure the SID quantizer and the Confort Noise Generator */ - - hsCom->startBand = 2; - move16(); - hsCom->stopBand = add( hsCom->FdCngSetup.sidPartitions[( hsCom->FdCngSetup.numPartitions - 1 )], 1 ); /*Q0*/ - move16(); - initPartitions( hsCom->FdCngSetup.sidPartitions, hsCom->FdCngSetup.numPartitions, hsCom->startBand, hsCom->stopBand, hsCom->part, - &hsCom->npart, hsCom->midband, hsCom->psize, hsCom->psize_norm, &hsCom->psize_norm_exp, hsCom->psize_inv, 0 ); - - hsCom->nFFTpart = 21; - move16(); - if ( EQ_16( hsCom->stopFFTbin, 256 ) ) - { - hsCom->nFFTpart = 20; - move16(); - } - if ( EQ_16( hsCom->stopFFTbin, 160 ) ) - { - hsCom->nFFTpart = 17; - move16(); - } - - hsCom->nCLDFBpart = sub( hsCom->npart, hsCom->nFFTpart ); - move16(); - FOR( j = 0; j < hsCom->nCLDFBpart; j++ ) - { - hsCom->CLDFBpart[j] = sub( hsCom->part[( j + hsCom->nFFTpart )], sub( hsCom->stopFFTbin, hsCom->startBand ) ); /*Q0*/ - move16(); - hsCom->CLDFBpsize_inv[j] = hsCom->psize_inv[( j + hsCom->nFFTpart )]; /*Q15*/ - move16(); - } - - stopBandFR = 1000 / 25; - move16(); - if ( GT_16( stopBandFR, hsCom->stopFFTbin ) ) - { - stopBandFR = hsCom->stopFFTbin; /*Q0*/ - move16(); - } - initPartitions( hsCom->FdCngSetup.shapingPartitions, hsCom->FdCngSetup.numShapingPartitions, - hsCom->startBand, hsCom->stopFFTbin, hFdCngDec->part_shaping, &hFdCngDec->npart_shaping, hFdCngDec->midband_shaping, - hFdCngDec->psize_shaping, hFdCngDec->psize_shaping_norm, &hFdCngDec->psize_shaping_norm_exp, hFdCngDec->psize_inv_shaping, - stopBandFR ); - hFdCngDec->nFFTpart_shaping = hFdCngDec->npart_shaping; /*Q0*/ - move16(); - - SWITCH( hsCom->fftlen ) - { - case 512: - hsCom->fftlenShift = 8; - move16(); - hsCom->fftlenFac = 32767 /*1.0 Q15*/; - move16(); - BREAK; - case 640: - hsCom->fftlenShift = 9; - move16(); - hsCom->fftlenFac = 20480 /*0.625 Q15*/; - move16(); - BREAK; - default: - assert( !"Unsupported FFT length for FD-based CNG" ); - BREAK; - } - BASOP_getTables( &hsCom->olapWinAna, NULL, NULL, shr( hsCom->fftlen, 1 ) ); - BASOP_getTables( &hsCom->olapWinSyn, NULL, NULL, shr( hsCom->fftlen, 2 ) ); - hsCom->frameSize = shr( hsCom->fftlen, 1 ); - move16(); -} -#endif /* @@ -4141,11 +3914,7 @@ void generate_masking_noise_mdct_ivas_fx( * * Initialize an instance of type FD_CNG *-------------------------------------------------------------------*/ -#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC void configureFdCngDec_fx( -#else -void configureFdCngDec_ivas_fx( -#endif HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the FD-based CNG process */ const Word16 bwidth, /*Q0*/ const Word32 total_brate, /*Q0*/ @@ -4352,28 +4121,24 @@ void configureFdCngDec_ivas_fx( SWITCH( hsCom->fftlen ) { case 512: -#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC IF( GT_16( element_mode, EVS_MONO ) ) { hsCom->olapWinAna_fx = olapWinAna512_fx; /*Q30*/ hsCom->fftSineTab_fx = NULL; hsCom->olapWinSyn_fx = olapWinSyn256_fx; /*Q15*/ } -#endif hsCom->fftlenShift = 8; move16(); hsCom->fftlenFac = 32767 /*1.0 Q15*/; move16(); BREAK; case 640: -#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC IF( GT_16( element_mode, EVS_MONO ) ) { hsCom->olapWinAna_fx = olapWinAna640_fx; /*Q30*/ hsCom->fftSineTab_fx = fftSineTab640_fx; /*Q15*/ hsCom->olapWinSyn_fx = olapWinSyn320_fx; /*Q15*/ } -#endif hsCom->fftlenShift = 9; move16(); hsCom->fftlenFac = 20480 /*0.625 Q15*/; diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c index 29df46c61..6e5fa6b77 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c @@ -37,9 +37,7 @@ #include "prot_fx.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" -#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC #include "prot_fx.h" -#endif /*-------------------------------------------------------------------* @@ -644,22 +642,14 @@ void synchonize_channels_mdct_sid_fx( test(); IF( EQ_16( sts[0]->first_CNG, 1 ) && EQ_16( sts[1]->first_CNG, 0 ) ) { -#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC configureFdCngDec_fx( st->hFdCngDec, st->bwidth, st->element_brate, st->L_frame, st->last_L_frame, st->element_mode ); -#else - configureFdCngDec_ivas_fx( st->hFdCngDec, st->bwidth, st->element_brate, st->L_frame, st->last_L_frame, st->element_mode ); -#endif } } IF( sts[0]->first_CNG == 0 ) { /* configure CNG after reading first side info from SID to get correct values for L_frame and bwidth if first SID is also first valid frame */ -#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC configureFdCngDec_fx( st->hFdCngDec, st->bwidth, st->element_brate, st->L_frame, st->last_L_frame, st->element_mode ); -#else - configureFdCngDec_ivas_fx( st->hFdCngDec, st->bwidth, st->element_brate, st->L_frame, st->last_L_frame, st->element_mode ); -#endif } } diff --git a/lib_dec/ivas_stereo_switching_dec_fx.c b/lib_dec/ivas_stereo_switching_dec_fx.c index 985e1d461..f0684a3f4 100644 --- a/lib_dec/ivas_stereo_switching_dec_fx.c +++ b/lib_dec/ivas_stereo_switching_dec_fx.c @@ -663,11 +663,7 @@ ivas_error stereo_memory_dec_fx( } initFdCngDec_fx( st, st->cldfbSyn->scale ); -#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC configureFdCngDec_fx( st->hFdCngDec, st->bwidth, st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); -#else - configureFdCngDec_ivas_fx( st->hFdCngDec, st->bwidth, st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); -#endif } /* allocate stereo CNG structure */ -- GitLab From 8eabd9605d124198e998588e5b6c79bb5778e2d6 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:17:59 +0200 Subject: [PATCH 03/31] [cleanup] accept FIX_BASOP_2530_IVAS_DECISION_MAT --- lib_com/options.h | 1 - lib_enc/ivas_decision_matrix_enc_fx.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 82da798e2..3a94b1522 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -92,7 +92,6 @@ #define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */ #define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527 /* Fix crash from issue #2527 */ #define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ -#define FIX_BASOP_2530_IVAS_DECISION_MAT /* VA: Fix ambiguous usage of extract_l() */ #define SIMPLIFY_CORE_ENC /* VA: basop issue 2430: Simplify ivas_core_enc_fx() */ #define FIX_2402_SIMPLIFY_ARI_CODEC /* FhG: basop issue 2402: simplified arithmetic in TCX arithmetic coder */ #define FIX_2402_REPL_EVS_ARI_CODEC_ENC /* FhG: basop issue 2402: replace EVS arith encoder with IVAS arith encoder */ diff --git a/lib_enc/ivas_decision_matrix_enc_fx.c b/lib_enc/ivas_decision_matrix_enc_fx.c index 06e6723cf..391b5c65a 100644 --- a/lib_enc/ivas_decision_matrix_enc_fx.c +++ b/lib_enc/ivas_decision_matrix_enc_fx.c @@ -336,11 +336,7 @@ void ivas_decision_matrix_enc_fx( st->extl = WB_BWE; move16(); } -#ifdef FIX_BASOP_2530_IVAS_DECISION_MAT ELSE IF( GE_32( st->total_brate, MIN_BRATE_WB_BWE ) && !st->flag_ACELP16k ) -#else - ELSE IF( GE_16( extract_l( st->total_brate ), MIN_BRATE_WB_BWE ) && !st->flag_ACELP16k ) -#endif { test(); test(); -- GitLab From 2bf928e6f6d88c59cafe950602a2476f441f4fc1 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:19:04 +0200 Subject: [PATCH 04/31] [cleanup] accept FIX_BASOP_2546_HARMONIZE_TCX_SCALAR --- lib_com/options.h | 1 - lib_enc/cod_tcx_fx.c | 22 -- lib_enc/prot_fx_enc.h | 25 --- lib_enc/tcx_utils_enc_fx.c | 401 ------------------------------------- 4 files changed, 449 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 3a94b1522..758d18c33 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -95,7 +95,6 @@ #define SIMPLIFY_CORE_ENC /* VA: basop issue 2430: Simplify ivas_core_enc_fx() */ #define FIX_2402_SIMPLIFY_ARI_CODEC /* FhG: basop issue 2402: simplified arithmetic in TCX arithmetic coder */ #define FIX_2402_REPL_EVS_ARI_CODEC_ENC /* FhG: basop issue 2402: replace EVS arith encoder with IVAS arith encoder */ -#define FIX_BASOP_2546_HARMONIZE_TCX_SCALAR /* FhG: Fix issue 2546 Harmonize function tcx_scalar_quantization_rateloop*/ #define FIX_BASOP_2532_cx_e /* FhG: Fix issue 2532 about additional exponent variable*/ #define FIX_BASOP_2551_HARM_SCALAR_QUAN /* FhG: issue 2551: Harmonize function pair tcx_scalar_quantization_fx*/ #define HARMONIZE_2543_SQ_gain /* FhG: Harmonize SQ_gain */ diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index e136f9b1d..1ea7d3f8c 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -1632,23 +1632,6 @@ void QuantizeSpectrum_fx( phm_cfg = hm_cfg; move16(); } -#ifndef FIX_BASOP_2546_HARMONIZE_TCX_SCALAR - sqBits = tcx_scalar_quantization_rateloop_fx( spectrum, *spectrum_e, - sqQ, - L_spec, - &sqGain, &sqGain_e, - hTcxCfg->sq_rounding, - hTcxEnc->memQuantZeros, - prm_lastnz, /* lastnz */ - sqTargetBits, - &nEncoded, - &stop, - sqBits_noStop, - sqBits, - hTcxCfg->tcxRateLoopOpt, - tcxonly, - phm_cfg ); -#else Word16 max_iter = 4; move16(); IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) ) @@ -1675,7 +1658,6 @@ void QuantizeSpectrum_fx( st->element_mode ); // sqBits = tcx_scalar_quantization_rateloop_ivas_fx(spectrum_fx, *spectrum_e, sqQ, L_spec, &sqGain_fx, &sqGain_e, st->hTcxCfg->sq_rounding, hTcxEnc->memQuantZeros, prm_lastnz, /* lastnz */ sqTargetBits, &nEncoded, &stop, sqBits_noStop, sqBits, st->hTcxCfg->tcxRateLoopOpt, st->tcxonly, phm_cfg, max_iter, st->element_mode); -#endif // !FIX_BASOP_2546_HARMONIZE_TCX_SCALAR IF( ctxHmBits > 0 ) /* Mapping tool is enabled */ @@ -3280,11 +3262,7 @@ void QuantizeTCXSpectrum_fx( max_iter = 2; move16(); } -#ifndef FIX_BASOP_2546_HARMONIZE_TCX_SCALAR - sqBits = tcx_scalar_quantization_rateloop_ivas_fx( spectrum_fx, *spectrum_e, sqQ, L_spec, &sqGain_fx, &sqGain_e, st->hTcxCfg->sq_rounding, hTcxEnc->memQuantZeros, prm_lastnz, /* lastnz */ sqTargetBits, &nEncoded, &stop, sqBits_noStop, sqBits, st->hTcxCfg->tcxRateLoopOpt, st->tcxonly, phm_cfg, max_iter, st->element_mode ); -#else sqBits = tcx_scalar_quantization_rateloop_fx( spectrum_fx, *spectrum_e, sqQ, L_spec, &sqGain_fx, &sqGain_e, st->hTcxCfg->sq_rounding, hTcxEnc->memQuantZeros, prm_lastnz, /* lastnz */ sqTargetBits, &nEncoded, &stop, sqBits_noStop, sqBits, st->hTcxCfg->tcxRateLoopOpt, st->tcxonly, phm_cfg, max_iter, st->element_mode ); -#endif // !FIX_BASOP_2546_HARMONIZE_TCX_SCALAR IF( ctxHmBits > 0 ) { /* Mapping tool is enabled */ diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 6ae14c438..7d7ddd59b 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -1156,33 +1156,8 @@ void tcx_scalar_quantization_fx( const Word16 alfe_flag ); #endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN -#ifndef FIX_BASOP_2546_HARMONIZE_TCX_SCALAR -Word16 tcx_scalar_quantization_rateloop_fx( - Word32 *x, /* i : i coefficients */ - Word16 x_e, /* i : exponent */ - Word16 *xq, /* o : quantized coefficients */ - Word16 L_frame, /* i : frame length */ - Word16 *gain, /* i/o: quantization gain */ - Word16 *gain_e, /* i/o: gain exponent */ - Word16 offset, /* i : rounding offset (deadzone) */ - Word8 const *memQuantZeros, /* i : coefficients to be set to 0 */ - Word16 *lastnz_out, /* i/o: last nonzero coeff index */ - Word16 target, /* i : target number of bits */ - Word16 *nEncoded, /* o : number of encoded coeff */ - Word16 *stop, /* i/o: stop param */ - Word16 sqBits_in_noStop, /* i : number of sqBits as determined in prev. quant. stage, w/o using stop mechanism (ie might exceed target bits) */ - Word16 sqBits_in, /* i : number of sqBits as determined in prev. quant. stage, using stop mechanism (ie always <= target bits) */ - Word16 tcxRateLoopOpt, /* i : turns on/off rateloop optimization */ - const Word8 tcxonly, - CONTEXT_HM_CONFIG *hm_cfg /* i : configuration of the context-based harmonic model */ -); -#endif -#ifndef FIX_BASOP_2546_HARMONIZE_TCX_SCALAR -Word16 tcx_scalar_quantization_rateloop_ivas_fx( -#else Word16 tcx_scalar_quantization_rateloop_fx( -#endif // !FIX_BASOP_2546_HARMONIZE_TCX_SCALAR Word32 *x, /* i : input coefficients Q = 31 - x_e*/ Word16 x_e, /* i : exponent Q0*/ Word16 *xq, /* o : quantized coefficients Q0*/ diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index 392ff1215..d6944e0aa 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -1499,309 +1499,8 @@ void tcx_scalar_quantization_fx( return; } -#ifndef FIX_BASOP_2546_HARMONIZE_TCX_SCALAR -Word16 tcx_scalar_quantization_rateloop_fx( - Word32 *x, /* i : input coefficients */ - Word16 x_e, /* i : exponent */ - Word16 *xq, /* o : quantized coefficients */ - Word16 L_frame, /* i : frame length */ - Word16 *gain, /* i/o: quantization gain */ - Word16 *gain_e, /* i/o: gain exponent */ - Word16 offset, /* i : rounding offset (deadzone) */ - Word8 const *memQuantZeros_fx, /* i : coefficients to be set to 0 */ - Word16 *lastnz_out, /* i/o: last nonzero coeff index */ - Word16 target, /* i : target number of bits */ - Word16 *nEncoded, /* o : number of encoded coeff */ - Word16 *stop, /* i/o: stop param */ - Word16 sqBits_in_noStop, /* i : number of sqBits as determined in prev. quant. stage, w/o using stop mechanism (ie might exceed target bits) */ - Word16 sqBits_in, /* i : number of sqBits as determined in prev. quant. stage, using stop mechanism (ie always <= target bits) */ - Word16 tcxRateLoopOpt, /* i : turns on/off rateloop optimization */ - const Word8 tcxonly, - CONTEXT_HM_CONFIG *hm_cfg /* i : configuration of the context-based harmonic model */ -) -{ - const Word16 iter_max = 4; - Word16 sqBits; - Word16 stopFlag; - Word8 ubfound, lbfound; - Word16 ub, ub_e, lb, lb_e; - Word16 shift, shiftInv; - Word16 iter; - Word16 sqGain, sqGain_e; - Word16 w_lb, w_ub; - const Word16 kDampen = 10; - Word16 old_stopFlag; - Word16 old_nEncoded; - Word16 old_sqBits; - Word16 mod_adjust0, mod_adjust1; - Word16 inv_target, inv_target_e; - const Word16 kMargin = 0x7AE1; /* 0.96 */ - const Word16 kMarginInv = 0x42AB; /* 1/0.96 (1Q14) */ - Word16 tmp, fac1, fac2; - Word32 tmp32; - Word16 lastnz; - move16(); - move16(); - move16(); - move16(); - - /* Init */ - sqGain = *gain; - move16(); - sqGain_e = *gain_e; - move16(); - stopFlag = *stop; - move16(); - ubfound = 0; - move16(); - lbfound = 0; - move16(); - shift = 0x41DE; /* 10^(1/80), 1Q14 */ - move16(); - shiftInv = 0x78D7; /* 10^(-1/40) */ - move16(); - lb = lb_e = 0; - move16(); - ub = ub_e = 0; - move16(); - w_lb = 0; - move16(); - w_ub = 0; - move16(); - lastnz = *lastnz_out; - move16(); - old_stopFlag = stopFlag; - move16(); - old_nEncoded = *nEncoded; - move16(); - old_sqBits = sqBits_in_noStop; - move16(); - - sqBits = sqBits_in; - move16(); - - mod_adjust0 = extract_l( L_shr( L_max( 0x10000, L_sub( 0x24CCD, L_mult( 0x0052, target ) ) ), 3 ) ); /* 2Q13 */ - mod_adjust1 = div_s( 0x2000, mod_adjust0 ); /* 0Q15 */ - - inv_target_e = 15; - move16(); - inv_target = Inv16( target, &inv_target_e ); - - fac1 = shl( mult( mult( kMarginInv, mod_adjust0 ), inv_target ), 1 ); /* 2Q13 */ - fac2 = mult( mult( kMargin, mod_adjust1 ), inv_target ); - - /* Loop */ - FOR( iter = 0; iter < iter_max; iter++ ) - { - IF( EQ_16( tcxRateLoopOpt, 2 ) ) - { - /* Ajust sqGain */ - IF( stopFlag != 0 ) - { - lbfound = 1; - move16(); - lb = sqGain; - move16(); - lb_e = sqGain_e; - move16(); - w_lb = add( sub( stopFlag, target ), kDampen ); - - IF( ubfound != 0 ) - { - /* common exponent for addition */ - sqGain_e = s_max( lb_e, ub_e ); - - /* multiply and add */ - tmp32 = L_shr( L_mult( lb, w_ub ), sub( sqGain_e, lb_e ) ); - tmp32 = L_add( tmp32, L_shr( L_mult( ub, w_lb ), sub( sqGain_e, ub_e ) ) ); - - /* convert to normalized 16 bit */ - tmp = norm_l( tmp32 ); - sqGain = round_fx_sat( L_shl( tmp32, tmp ) ); - sqGain_e = sub( sqGain_e, tmp ); - - /* divide */ - sqGain = BASOP_Util_Divide1616_Scale( sqGain, add( w_ub, w_lb ), &tmp ); - sqGain_e = add( sqGain_e, tmp ); - } - ELSE - { - tmp = round_fx( L_shl( L_mult( stopFlag, fac1 ), add( inv_target_e, 15 ) ) ); - sqGain = mult( sqGain, sub( tmp, sub( mod_adjust0, 0x2000 ) ) ); - sqGain = normalize16( sqGain, &sqGain_e ); - sqGain_e = add( sqGain_e, 2 ); - } - } - ELSE - { - ubfound = 1; - move16(); - ub = sqGain; - move16(); - ub_e = sqGain_e; - move16(); - w_ub = add( sub( target, sqBits ), kDampen ); - - IF( lbfound != 0 ) - { - /* common exponent for addition */ - sqGain_e = s_max( lb_e, ub_e ); - - /* multiply and add */ - tmp32 = L_shr( L_mult( lb, w_ub ), sub( sqGain_e, lb_e ) ); - tmp32 = L_add( tmp32, L_shr( L_mult( ub, w_lb ), sub( sqGain_e, ub_e ) ) ); - - /* convert to normalized 16 bit */ - tmp = norm_l( tmp32 ); - sqGain = round_fx_sat( L_shl_sat( tmp32, tmp ) ); - sqGain_e = sub( sqGain_e, tmp ); - - /* divide */ - sqGain = BASOP_Util_Divide1616_Scale( sqGain, add( w_ub, w_lb ), &tmp ); - sqGain_e = add( sqGain_e, tmp ); - } - ELSE - { - tmp = round_fx( L_shl( L_mult( sqBits, fac2 ), add( inv_target_e, 15 ) ) ); - sqGain = mult( sqGain, sub( tmp, add( mod_adjust1, (Word16) 0x8000 ) ) ); - sqGain = normalize16( sqGain, &sqGain_e ); - } - } - } - ELSE /* tcxRateLoopOpt != 2 */ - { - - /* Ajust sqGain */ - IF( stopFlag != 0 ) - { - lbfound = 1; - move16(); - lb = sqGain; - move16(); - lb_e = sqGain_e; - move16(); - - IF( ubfound != 0 ) - { - sqGain = mult( lb, ub ); - sqGain_e = add( lb_e, ub_e ); - sqGain = Sqrt16( sqGain, &sqGain_e ); - } - ELSE - { - shift = shl( mult( shift, shift ), 1 ); - shiftInv = mult( shiftInv, shiftInv ); - - sqGain = mult( sqGain, shift ); - sqGain = normalize16( sqGain, &sqGain_e ); - sqGain_e = add( sqGain_e, 1 ); - } - } - ELSE - { - ubfound = 1; - move16(); - ub = sqGain; - move16(); - ub_e = sqGain_e; - move16(); - - IF( lbfound != 0 ) - { - sqGain = mult( lb, ub ); - sqGain_e = add( lb_e, ub_e ); - sqGain = Sqrt16( sqGain, &sqGain_e ); - } - ELSE - { - sqGain = mult( sqGain, shiftInv ); - sqGain = normalize16( sqGain, &sqGain_e ); - - shift = shl( mult( shift, shift ), 1 ); - shiftInv = mult( shiftInv, shiftInv ); - } - } - } - - /* Quantize spectrum */ - tcx_scalar_quantization_fx( x, x_e, xq, L_frame, sqGain, sqGain_e, offset, memQuantZeros_fx, tcxonly ); - /* Estimate bitrate */ - stopFlag = 1; - move16(); - if ( tcxRateLoopOpt > 0 ) - { - stopFlag = 0; - move16(); - } - - sqBits = ACcontextMapping_encode2_estimate_no_mem_s17_LC_fx( xq, L_frame, - &lastnz, - nEncoded, target, &stopFlag, - hm_cfg ); - - IF( tcxRateLoopOpt > 0 ) - { - test(); - test(); - test(); - test(); - test(); - test(); - IF( ( ( GE_16( *nEncoded, old_nEncoded ) ) && ( GE_16( stopFlag, old_stopFlag ) ) ) || - ( ( GT_16( *nEncoded, old_nEncoded ) ) && ( ( stopFlag == 0 ) && ( old_stopFlag > 0 ) ) ) || - ( ( stopFlag == 0 ) && ( old_stopFlag == 0 ) ) ) - { - *gain = sqGain; - move16(); - *gain_e = sqGain_e; - move16(); - old_nEncoded = *nEncoded; - move16(); - old_stopFlag = stopFlag; - move16(); - old_sqBits = sqBits; - move16(); - *lastnz_out = lastnz; - move16(); - } - } - } /* for ( iter=0 ; iter 0 ) - { - /* Quantize spectrum */ - tcx_scalar_quantization_fx( x, x_e, xq, L_frame, *gain, *gain_e, offset, memQuantZeros_fx, tcxonly ); - - /* Output */ - *nEncoded = old_nEncoded; - move16(); - sqBits = old_sqBits; - move16(); - *stop = old_stopFlag; - move16(); - } - ELSE - { - /* Output */ - *gain = sqGain; - move16(); - *gain_e = sqGain_e; - move16(); - *stop = stopFlag; - move16(); - *lastnz_out = lastnz; - move16(); - } - - return sqBits; -} -#endif // !FIX_BASOP_2546_HARMONIZE_TCX_SCALAR -#ifndef FIX_BASOP_2546_HARMONIZE_TCX_SCALAR -Word16 tcx_scalar_quantization_rateloop_ivas_fx( -#else Word16 tcx_scalar_quantization_rateloop_fx( -#endif // !FIX_BASOP_2546_HARMONIZE_TCX_SCALAR Word32 *x, /* i : input coefficients Q = 31 - x_e*/ Word16 x_e, /* i : exponent Q0*/ Word16 *xq, /* o : quantized coefficients Q0*/ @@ -1850,65 +1549,6 @@ Word16 tcx_scalar_quantization_rateloop_fx( saturated = 0; move16(); /* minSqGain = (float) sqrt( (float) NORM_MDCT_FACTOR / (float) L_frame ); in Q14*/ -#ifndef FIX_BASOP_2546_HARMONIZE_TCX_SCALAR - SWITCH( L_frame ) - { - case 80: - minSqGain = 23170; - BREAK; - case 100: - minSqGain = 20724; - BREAK; - case 160: - minSqGain = 16384; - BREAK; - case 200: - minSqGain = 14654; - BREAK; - case 240: - minSqGain = 13377; - BREAK; - case 300: - minSqGain = 11965; - BREAK; - case 320: - minSqGain = 11585; - BREAK; - case 400: - minSqGain = 10362; - BREAK; - case 480: - minSqGain = 9459; - BREAK; - case 600: - minSqGain = 8461; - BREAK; - case 640: - minSqGain = 8192; - BREAK; - case 800: - minSqGain = 7327; - BREAK; - case 960: - minSqGain = 6689; - BREAK; - case 1200: - minSqGain = 5983; - BREAK; - case 1440: - minSqGain = 5461; - BREAK; - case 1800: - minSqGain = 4885; - BREAK; - case 2048: - minSqGain = 4579; - BREAK; - default: - assert( 0 ); - } - move16(); -#else IF( NE_16( element_mode, EVS_MONO ) ) { SWITCH( L_frame ) @@ -1969,7 +1609,6 @@ Word16 tcx_scalar_quantization_rateloop_fx( } move16(); } -#endif // !FIX_BASOP_2546_HARMONIZE_TCX_SCALAR sqGain = *gain; move16(); @@ -2030,16 +1669,11 @@ Word16 tcx_scalar_quantization_rateloop_fx( lb_e = sqGain_e; move16(); w_lb = add( sub( stopFlag, target ), kDampen ); -#ifndef FIX_BASOP_2546_HARMONIZE_TCX_SCALAR - saturated = 0; - move16(); -#else if ( NE_16( element_mode, EVS_MONO ) ) { saturated = 0; move16(); } -#endif // !FIX_BASOP_2546_HARMONIZE_TCX_SCALAR IF( ubfound != 0 ) { /* common exponent for addition */ @@ -2100,20 +1734,6 @@ Word16 tcx_scalar_quantization_rateloop_fx( sqGain = mult( sqGain, sub( tmp, add( mod_adjust1, (Word16) 0x8000 ) ) ); sqGain = normalize16( sqGain, &sqGain_e ); } -#ifndef FIX_BASOP_2546_HARMONIZE_TCX_SCALAR - Word16 shift_tmp = s_max( sqGain_e, 1 ); - move16(); - test(); - IF( LT_16( shl( sqGain, sub( sqGain_e, shift_tmp ) ), shl( minSqGain, sub( 1, shift_tmp ) ) ) && EQ_16( tcxRateLoopOpt, 3 ) ) - { - sqGain = minSqGain; - move16(); - sqGain_e = 1; - move16(); - saturated = 1; - move16(); - } -#else IF( NE_16( element_mode, EVS_MONO ) ) { Word16 shift_tmp = s_max( sqGain_e, 1 ); @@ -2129,19 +1749,11 @@ Word16 tcx_scalar_quantization_rateloop_fx( move16(); } } -#endif // !FIX_BASOP_2546_HARMONIZE_TCX_SCALAR - } -#ifndef FIX_BASOP_2546_HARMONIZE_TCX_SCALAR - ELSE - { - BREAK; /* we cannot go any lower anyway*/ } -#else ELSE IF( NE_16( element_mode, EVS_MONO ) ) { BREAK; /* we cannot go any lower anyway*/ } -#endif // FIX_BASOP_2546_HARMONIZE_TCX_SCALAR } ELSE /* tcxRateLoopOpt != 2 */ { @@ -2200,9 +1812,6 @@ Word16 tcx_scalar_quantization_rateloop_fx( /* Quantize spectrum */ #ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN -#ifndef FIX_BASOP_2546_HARMONIZE_TCX_SCALAR - tcx_scalar_quantization_ivas_fx( x, x_e, xq, L_frame, sqGain, sqGain_e, offset, memQuantZeros_fx, tcxonly ); -#else IF( EQ_16( element_mode, EVS_MONO ) ) { tcx_scalar_quantization_fx( x, x_e, xq, L_frame, sqGain, sqGain_e, offset, memQuantZeros_fx, tcxonly ); @@ -2211,7 +1820,6 @@ Word16 tcx_scalar_quantization_rateloop_fx( { tcx_scalar_quantization_ivas_fx( x, x_e, xq, L_frame, sqGain, sqGain_e, offset, memQuantZeros_fx, tcxonly ); } -#endif // !FIX_BASOP_2546_HARMONIZE_TCX_SCALAR #else tcx_scalar_quantization_fx( x, x_e, xq, L_frame, sqGain, sqGain_e, offset, memQuantZeros_fx, tcxonly, element_mode ); #endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN @@ -2223,11 +1831,7 @@ Word16 tcx_scalar_quantization_rateloop_fx( stopFlag = 0; move16(); } -#ifndef FIX_BASOP_2546_HARMONIZE_TCX_SCALAR - IF( GT_16( element_mode, EVS_MONO ) ) -#else IF( NE_16( element_mode, EVS_MONO ) ) -#endif // !FIX_BASOP_2546_HARMONIZE_TCX_SCALAR { sqBits = RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( xq, L_frame, &lastnz, nEncoded, target, &stopFlag, 0, hm_cfg ); } @@ -2271,10 +1875,6 @@ Word16 tcx_scalar_quantization_rateloop_fx( { #ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN -#ifndef FIX_BASOP_2546_HARMONIZE_TCX_SCALAR - /* Quantize spectrum */ - tcx_scalar_quantization_ivas_fx( x, x_e, xq, L_frame, *gain, *gain_e, offset, memQuantZeros_fx, tcxonly ); -#else IF( EQ_16( element_mode, EVS_MONO ) ) { tcx_scalar_quantization_fx( x, x_e, xq, L_frame, *gain, *gain_e, offset, memQuantZeros_fx, tcxonly ); @@ -2283,7 +1883,6 @@ Word16 tcx_scalar_quantization_rateloop_fx( { tcx_scalar_quantization_ivas_fx( x, x_e, xq, L_frame, *gain, *gain_e, offset, memQuantZeros_fx, tcxonly ); } -#endif // !FIX_BASOP_2546_HARMONIZE_TCX_SCALAR #else tcx_scalar_quantization_fx( x, x_e, xq, L_frame, *gain, *gain_e, offset, memQuantZeros_fx, tcxonly, element_mode ); -- GitLab From 1a7a61c8b9a87d39bfa4ec631bdffb2ecd3b06e3 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:19:55 +0200 Subject: [PATCH 05/31] [cleanup] accept FIX_BASOP_2532_cx_e --- lib_com/options.h | 1 - lib_dec/ivas_mc_param_dec_fx.c | 10 ---------- 2 files changed, 11 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 758d18c33..b6d45d918 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -95,7 +95,6 @@ #define SIMPLIFY_CORE_ENC /* VA: basop issue 2430: Simplify ivas_core_enc_fx() */ #define FIX_2402_SIMPLIFY_ARI_CODEC /* FhG: basop issue 2402: simplified arithmetic in TCX arithmetic coder */ #define FIX_2402_REPL_EVS_ARI_CODEC_ENC /* FhG: basop issue 2402: replace EVS arith encoder with IVAS arith encoder */ -#define FIX_BASOP_2532_cx_e /* FhG: Fix issue 2532 about additional exponent variable*/ #define FIX_BASOP_2551_HARM_SCALAR_QUAN /* FhG: issue 2551: Harmonize function pair tcx_scalar_quantization_fx*/ #define HARMONIZE_2543_SQ_gain /* FhG: Harmonize SQ_gain */ #define FIX_ISSUE_2533_EXTRA_CONDITION /* FhG: Fix issue basop 2533 removing the extra condition*/ diff --git a/lib_dec/ivas_mc_param_dec_fx.c b/lib_dec/ivas_mc_param_dec_fx.c index 52576f172..5414ef648 100644 --- a/lib_dec/ivas_mc_param_dec_fx.c +++ b/lib_dec/ivas_mc_param_dec_fx.c @@ -1801,10 +1801,8 @@ void ivas_param_mc_dec_prepare_renderer( } } cx_e = max_e; -#ifdef FIX_BASOP_2532_cx_e cx_next_band_e = max_e; move16(); -#endif move16(); /* we have to do it similar to the encoder in case of attacks (i.e. accumulate two bands) to ensure correct DMX of the target covariance*/ @@ -1819,11 +1817,7 @@ void ivas_param_mc_dec_prepare_renderer( Scale_sig32( cx_fx, len, -Q1 ); // add one bit head room Scale_sig32( cx_next_band_fx, len, -Q1 ); // add one bit head room cx_e = add( cx_e, Q1 ); -#ifndef FIX_BASOP_2532_cx_e - cx_next_band_e = add( cx_e, Q1 ); -#else cx_next_band_e = add( cx_next_band_e, Q1 ); -#endif // !FIX_BASOP_2532_cx_e } v_add_fx( cx_fx, cx_next_band_fx, cx_fx, len ); Copy32( cx_fx, cx_next_band_fx, len ); @@ -1842,11 +1836,7 @@ void ivas_param_mc_dec_prepare_renderer( IF( is_next_band ) { -#ifndef FIX_BASOP_2532_cx_e - ivas_param_mc_get_mixing_matrices_fx( hParamMC, hSynthesisOutputSetup, cx_next_band_fx, cx_next_band_e, add( param_band_idx, is_next_band ), hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp, nchan_out_transport, hParamMC->synthesis_conf, nchan_transport, nchan_out_cov ); -#else ivas_param_mc_get_mixing_matrices_fx( hParamMC, hSynthesisOutputSetup, cx_next_band_fx, cx_e, add( param_band_idx, is_next_band ), hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp, nchan_out_transport, hParamMC->synthesis_conf, nchan_transport, nchan_out_cov ); -#endif } ELSE { -- GitLab From c6612256ed22b6a1103cc56a927a8dd48f6194a0 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:20:43 +0200 Subject: [PATCH 06/31] [cleanup] accept HARMONIZE_2543_SQ_gain --- lib_com/options.h | 1 - lib_enc/cod_tcx_fx.c | 22 ------- lib_enc/prot_fx_enc.h | 19 ------ lib_enc/tcx_utils_enc_fx.c | 129 ------------------------------------- 4 files changed, 171 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index b6d45d918..6ae0b9b43 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -96,7 +96,6 @@ #define FIX_2402_SIMPLIFY_ARI_CODEC /* FhG: basop issue 2402: simplified arithmetic in TCX arithmetic coder */ #define FIX_2402_REPL_EVS_ARI_CODEC_ENC /* FhG: basop issue 2402: replace EVS arith encoder with IVAS arith encoder */ #define FIX_BASOP_2551_HARM_SCALAR_QUAN /* FhG: issue 2551: Harmonize function pair tcx_scalar_quantization_fx*/ -#define HARMONIZE_2543_SQ_gain /* FhG: Harmonize SQ_gain */ #define FIX_ISSUE_2533_EXTRA_CONDITION /* FhG: Fix issue basop 2533 removing the extra condition*/ #define HARMONIZE_2537_SetTCXModeInfo /* FhG: Harmonize SetTCXModeInfo - IVAS_VERSION OBVIOUSLY NOT FITTING FOR EVS - pipes not green */ #define HARMONIZE_2537_GetTCXMaxenergyChange /* FhG: Harmonize GetTCXMaxenergyChange */ diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index 1ea7d3f8c..163b03ea9 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -1432,18 +1432,11 @@ void QuantizeSpectrum_fx( /* Quantize original spectrum */ -#ifdef HARMONIZE_2543_SQ_gain sqGain = SQ_gain_fx( OriginalSpectrum, OriginalSpectrum_e, shl( mult( hTcxEnc->tcx_target_bits_fac, sqTargetBits ), 1 ), L_spec, &sqGain_e, EVS_MONO ); -#else - sqGain = SQ_gain_fx( OriginalSpectrum, OriginalSpectrum_e, - shl( mult( hTcxEnc->tcx_target_bits_fac, sqTargetBits ), 1 ), - L_spec, - &sqGain_e ); -#endif #ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN tcx_scalar_quantization_fx( OriginalSpectrum, OriginalSpectrum_e, @@ -1544,18 +1537,11 @@ void QuantizeSpectrum_fx( PeriodicityIndex = -1; move16(); -#ifdef HARMONIZE_2543_SQ_gain sqGain = SQ_gain_fx( spectrum, *spectrum_e, shl( mult( hTcxEnc->tcx_target_bits_fac, sqTargetBits ), 1 ), L_spec, &sqGain_e, EVS_MONO ); -#else - sqGain = SQ_gain_fx( spectrum, *spectrum_e, - shl( mult( hTcxEnc->tcx_target_bits_fac, sqTargetBits ), 1 ), - L_spec, - &sqGain_e ); -#endif /* Quantize spectrum */ #ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN @@ -3089,11 +3075,7 @@ void QuantizeTCXSpectrum_fx( } /* Quantize original spectrum */ -#ifdef HARMONIZE_2543_SQ_gain sqGain_fx = SQ_gain_fx( spectrum_fx, *spectrum_e, ( mult( hTcxEnc->tcx_target_bits_fac, shl( sqTargetBits, 1 ) ) ), L_spec, &sqGain_e, 1 /*signal non-EVS*/ ); -#else - sqGain_fx = SQ_gain_ivas_fx( spectrum_fx, *spectrum_e, ( mult( hTcxEnc->tcx_target_bits_fac, shl( sqTargetBits, 1 ) ) ), L_spec, &sqGain_e ); -#endif #ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN tcx_scalar_quantization_ivas_fx( spectrum_fx, *spectrum_e, sqQ, L_spec, sqGain_fx, sqGain_e, st->hTcxCfg->sq_rounding, hTcxEnc->memQuantZeros, st->tcxonly ); @@ -3187,11 +3169,7 @@ void QuantizeTCXSpectrum_fx( } ELSE { -#ifdef HARMONIZE_2543_SQ_gain sqGain_fx = SQ_gain_fx( spectrum_fx, *spectrum_e, shl( mult( hTcxEnc->tcx_target_bits_fac, sqTargetBits ), 1 ), L_spec, &sqGain_e, 1 /*signal non-EVS*/ ); -#else - sqGain_fx = SQ_gain_ivas_fx( spectrum_fx, *spectrum_e, shl( mult( hTcxEnc->tcx_target_bits_fac, sqTargetBits ), 1 ), L_spec, &sqGain_e ); -#endif } /* Quantize spectrum */ #ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 7d7ddd59b..58ac252bb 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -1106,7 +1106,6 @@ void AdaptLowFreqEmph_fx( const Word16 lg ); /* o : SQ gain */ -#ifdef HARMONIZE_2543_SQ_gain Word16 SQ_gain_fx( Word32 x[], /* i : vector to quantize */ Word16 x_e, /* i : exponent */ @@ -1115,24 +1114,6 @@ Word16 SQ_gain_fx( Word16 *gain_e, /* o : SQ gain exponent */ Word16 element_mode /* i : is EVS or not */ ); -#else -Word16 SQ_gain_fx( - Word32 x[], /* i : vector to quantize */ - Word16 x_e, /* i : exponent */ - Word16 nbitsSQ, /* i : number of bits targeted */ - Word16 lg, /* i : vector size (2048 max) */ - Word16 *gain_e /* o : SQ gain exponent */ -); - -/* o : SQ gain */ -Word16 SQ_gain_ivas_fx( - Word32 x[], /* i : vector to quantize */ - Word16 x_e, /* i : exponent */ - Word16 nbitsSQ, /* i : number of bits targeted */ - Word16 lg, /* i : vector size (2048 max) */ - Word16 *gain_e /* o : SQ gain exponent */ -); -#endif /* o : SQ gain */ Word16 SQ_gain_estimate_fx( diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index d6944e0aa..757cfeb8f 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -827,124 +827,8 @@ void PsychAdaptLowFreqEmph_fx( return; } -#ifndef HARMONIZE_2543_SQ_gain -/* o: SQ gain */ -Word16 SQ_gain_fx( - Word32 x[], /* i : vector to quantize */ - Word16 x_e, /* i : exponent */ - Word16 nbitsSQ, /* i : number of bits targeted */ - Word16 lg, /* i : vector size (2048 max) */ - Word16 *gain_e ) /* o : SQ gain exponent */ -{ - Word16 i, iter, lg_4, s, tmp16; - Word32 ener, tmp32; - Word32 target, fac, offset; - Word32 en[N_MAX / 4]; - - lg_4 = shr( lg, 2 ); - - /* energy of quadruples with 9dB offset */ - FOR( i = 0; i < lg_4; i++ ) - { - /* normalization */ - s = 15; - move16(); - - tmp16 = norm_l( x[0] ); - IF( x[0] != 0 ) - { - s = s_min( s, tmp16 ); - } - - tmp16 = norm_l( x[1] ); - IF( x[1] != 0 ) - { - s = s_min( s, tmp16 ); - } - - tmp16 = norm_l( x[2] ); - IF( x[2] != 0 ) - { - s = s_min( s, tmp16 ); - } - tmp16 = norm_l( x[3] ); - IF( x[3] != 0 ) - { - s = s_min( s, tmp16 ); - } - - s = sub( s, 2 ); /* 2 bits headroom */ - - /* calc quadruple energy */ - ener = L_deposit_l( 1 ); - - tmp16 = extract_h( L_shl( x[0], s ) ); - ener = L_mac( ener, tmp16, tmp16 ); - - tmp16 = extract_h( L_shl( x[1], s ) ); - ener = L_mac( ener, tmp16, tmp16 ); - - tmp16 = extract_h( L_shl( x[2], s ) ); - ener = L_mac( ener, tmp16, tmp16 ); - - tmp16 = extract_h( L_shl( x[3], s ) ); - ener = L_mac( ener, tmp16, tmp16 ); - - s = shl( sub( x_e, s ), 1 ); - - /* log */ - tmp32 = L_add( BASOP_Util_Log2( ener ), L_shl( L_deposit_l( s ), 25 ) ); /* log2, 6Q25 */ - en[i] = L_shr( tmp32, 9 ); /* 15Q16 */ - move32(); - x += 4; - } - - /* SQ scale: 4 bits / 6 dB per quadruple */ - target = L_mult( 0x3FC8, sub( nbitsSQ, shr( lg, 4 ) ) ); /* 0x3FC8 -> 0.15*log2(10) */ - fac = L_add( 0x2A854B, 0 ); /* -> 12.8f*log2(10); */ - offset = L_add( fac, 0 ); - - /* find offset (0 to 128 dB with step of 0.125dB) */ - FOR( iter = 0; iter < 10; iter++ ) - { - fac = L_shr( fac, 1 ); - offset = L_sub( offset, fac ); - ener = L_deposit_l( 0 ); - - FOR( i = 0; i < lg_4; i++ ) - { - tmp32 = L_sub( en[i], offset ); - - /* avoid SV with 1 bin of amp < 0.5f */ - IF( GT_32( tmp32, 0xFF20 ) ) /* 0xFF20 -> 0.3*log2(10); */ - { - ener = L_add( ener, tmp32 ); - } - - /* if ener is above target -> break and increase offset */ - IF( GT_32( ener, target ) ) - { - offset = L_add( offset, fac ); - BREAK; - } - } - } - - offset = L_add( L_shr( offset, 1 ), 0x17EB0 ); /* 0x17EB0 -> 0.45*log2(10) */ - - *gain_e = add( extract_h( offset ), 1 ); - move16(); - offset = L_sub( L_and( offset, 0xFFFF ), 0x10000 ); - tmp16 = extract_h( BASOP_Util_InvLog2( L_shl( offset, 9 ) ) ); - - /* return gain */ - - return tmp16; -} -#endif /* o: SQ gain */ -#ifdef HARMONIZE_2543_SQ_gain Word16 SQ_gain_fx( Word32 x[], /* i : vector to quantize */ Word16 x_e, /* i : exponent */ @@ -953,15 +837,6 @@ Word16 SQ_gain_fx( Word16 *gain_e, /* o : SQ gain exponent */ Word16 element_mode /* i : is EVS or not */ ) -#else -Word16 SQ_gain_ivas_fx( - Word32 x[], /* i : vector to quantize */ - Word16 x_e, /* i : exponent */ - Word16 nbitsSQ, /* i : number of bits targeted */ - Word16 lg, /* i : vector size (2048 max) */ - Word16 *gain_e /* o : SQ gain exponent */ -) -#endif { Word16 i, iter, lg_4, s, tmp16; Word32 ener, tmp32; @@ -1021,12 +896,8 @@ Word16 SQ_gain_ivas_fx( s = shl( sub( x_e, s ), 1 ); /* log */ -#ifdef HARMONIZE_2543_SQ_gain test(); IF( EQ_32( ener, 1 ) && GT_16( element_mode, EVS_MONO ) ) -#else - IF( EQ_32( ener, 1 ) ) -#endif { en[i] = -131072; /* log10(0.01) in Q16 */ move32(); -- GitLab From 0f7c72de0748cd224afaf3f8c2d0a86d67a488c7 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:21:34 +0200 Subject: [PATCH 07/31] [cleanup] accept FIX_ISSUE_2533_EXTRA_CONDITION --- lib_com/options.h | 1 - lib_dec/ivas_mc_param_dec_fx.c | 16 ---------------- 2 files changed, 17 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 6ae0b9b43..8b8c351c4 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -96,7 +96,6 @@ #define FIX_2402_SIMPLIFY_ARI_CODEC /* FhG: basop issue 2402: simplified arithmetic in TCX arithmetic coder */ #define FIX_2402_REPL_EVS_ARI_CODEC_ENC /* FhG: basop issue 2402: replace EVS arith encoder with IVAS arith encoder */ #define FIX_BASOP_2551_HARM_SCALAR_QUAN /* FhG: issue 2551: Harmonize function pair tcx_scalar_quantization_fx*/ -#define FIX_ISSUE_2533_EXTRA_CONDITION /* FhG: Fix issue basop 2533 removing the extra condition*/ #define HARMONIZE_2537_SetTCXModeInfo /* FhG: Harmonize SetTCXModeInfo - IVAS_VERSION OBVIOUSLY NOT FITTING FOR EVS - pipes not green */ #define HARMONIZE_2537_GetTCXMaxenergyChange /* FhG: Harmonize GetTCXMaxenergyChange */ #define HARMONIZE_2508_InitTransientDetection /* FhG: harmonize GetAttackForTCXDecision derivates for evs/ivas */ diff --git a/lib_dec/ivas_mc_param_dec_fx.c b/lib_dec/ivas_mc_param_dec_fx.c index 5414ef648..4a191876c 100644 --- a/lib_dec/ivas_mc_param_dec_fx.c +++ b/lib_dec/ivas_mc_param_dec_fx.c @@ -1830,21 +1830,6 @@ void ivas_param_mc_dec_prepare_renderer( { CONTINUE; } -#ifndef FIX_ISSUE_2533_EXTRA_CONDITION - IF( NE_32( hParamMC->synthesis_conf, PARAM_MC_SYNTH_MONO_STEREO ) ) - { - IF( is_next_band ) - { - - ivas_param_mc_get_mixing_matrices_fx( hParamMC, hSynthesisOutputSetup, cx_next_band_fx, cx_e, add( param_band_idx, is_next_band ), hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp, nchan_out_transport, hParamMC->synthesis_conf, nchan_transport, nchan_out_cov ); - } - ELSE - { - - ivas_param_mc_get_mixing_matrices_fx( hParamMC, hSynthesisOutputSetup, cx_fx, cx_e, add( param_band_idx, is_next_band ), hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp, nchan_out_transport, hParamMC->synthesis_conf, nchan_transport, nchan_out_cov ); - } - } -#else IF( is_next_band ) { @@ -1855,7 +1840,6 @@ void ivas_param_mc_dec_prepare_renderer( ivas_param_mc_get_mixing_matrices_fx( hParamMC, hSynthesisOutputSetup, cx_fx, cx_e, add( param_band_idx, is_next_band ), hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp, nchan_out_transport, hParamMC->synthesis_conf, nchan_transport, nchan_out_cov ); } -#endif } } -- GitLab From 92223ed0da62c15806cd93d412821599ec39b335 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:22:29 +0200 Subject: [PATCH 08/31] [cleanup] accept HARMONIZE_2537_SetTCXModeInfo --- lib_com/options.h | 1 - lib_enc/ivas_core_pre_proc_fx.c | 4 - lib_enc/ivas_mdct_core_enc_fx.c | 4 - lib_enc/ivas_stereo_mdct_core_enc_fx.c | 4 - lib_enc/prot_fx_enc.h | 11 -- lib_enc/transient_detection_fx.c | 156 ------------------------- 6 files changed, 180 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 8b8c351c4..1dac5844a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -96,7 +96,6 @@ #define FIX_2402_SIMPLIFY_ARI_CODEC /* FhG: basop issue 2402: simplified arithmetic in TCX arithmetic coder */ #define FIX_2402_REPL_EVS_ARI_CODEC_ENC /* FhG: basop issue 2402: replace EVS arith encoder with IVAS arith encoder */ #define FIX_BASOP_2551_HARM_SCALAR_QUAN /* FhG: issue 2551: Harmonize function pair tcx_scalar_quantization_fx*/ -#define HARMONIZE_2537_SetTCXModeInfo /* FhG: Harmonize SetTCXModeInfo - IVAS_VERSION OBVIOUSLY NOT FITTING FOR EVS - pipes not green */ #define HARMONIZE_2537_GetTCXMaxenergyChange /* FhG: Harmonize GetTCXMaxenergyChange */ #define HARMONIZE_2508_InitTransientDetection /* FhG: harmonize GetAttackForTCXDecision derivates for evs/ivas */ #define HARMONIZE_2564_GetEnergyCldfb /* FhG: harmonize GetEnergyCldfb derivates for evs/ivas */ diff --git a/lib_enc/ivas_core_pre_proc_fx.c b/lib_enc/ivas_core_pre_proc_fx.c index 22bf0522b..014ea9ea7 100644 --- a/lib_enc/ivas_core_pre_proc_fx.c +++ b/lib_enc/ivas_core_pre_proc_fx.c @@ -405,11 +405,7 @@ void pre_proc_ivas_fx( } IF( NE_16( st->element_mode, IVAS_CPE_MDCT ) ) { -#ifdef HARMONIZE_2537_SetTCXModeInfo SetTCXModeInfo_fx( st, st->hTranDet, &st->hTcxCfg->tcx_curr_overlap_mode ); -#else - SetTCXModeInfo_ivas_fx( st, st->hTranDet, &st->hTcxCfg->tcx_curr_overlap_mode ); -#endif } } ELSE IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) ) diff --git a/lib_enc/ivas_mdct_core_enc_fx.c b/lib_enc/ivas_mdct_core_enc_fx.c index e624c2804..bae3e6f55 100644 --- a/lib_enc/ivas_mdct_core_enc_fx.c +++ b/lib_enc/ivas_mdct_core_enc_fx.c @@ -1304,11 +1304,7 @@ void ivas_mdct_core_whitening_enc_fx( FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; -#ifdef HARMONIZE_2537_SetTCXModeInfo SetTCXModeInfo_fx( st, st->hTranDet, &st->hTcxCfg->tcx_curr_overlap_mode ); -#else - SetTCXModeInfo_ivas_fx( st, st->hTranDet, &st->hTcxCfg->tcx_curr_overlap_mode ); -#endif } } diff --git a/lib_enc/ivas_stereo_mdct_core_enc_fx.c b/lib_enc/ivas_stereo_mdct_core_enc_fx.c index 1eaeaad0a..f1de85142 100644 --- a/lib_enc/ivas_stereo_mdct_core_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_core_enc_fx.c @@ -257,11 +257,7 @@ void stereo_mdct_core_enc_fx( FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; -#ifdef HARMONIZE_2537_SetTCXModeInfo SetTCXModeInfo_fx( st, st->hTranDet, &st->hTcxCfg->tcx_curr_overlap_mode ); -#else - SetTCXModeInfo_ivas_fx( st, st->hTranDet, &st->hTcxCfg->tcx_curr_overlap_mode ); -#endif } /* adaptively sync tcx modes*/ test(); diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 58ac252bb..cd52c7b72 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -967,17 +967,6 @@ Word16 GetTCXMaxenergyChange_ivas_fx( const Word16 nPrevSubblocks ); #endif -#ifndef HARMONIZE_2537_SetTCXModeInfo -/** Set TCX window length and overlap configuration - * @param prevEnergyHF previous HF energy. Exponent must be the same as for currEnergyHF. - * @param currEnergyHF current HF energy. Exponent must be the same as for prevEnergyHF. - */ -void SetTCXModeInfo_ivas_fx( - Encoder_State *st, /* i/o: encoder state structure */ - TRAN_DET_HANDLE hTranDet, /* i/o: transient detection handle */ - Word16 *tcxModeOverlap /* o : window overlap of current frame */ -); -#endif /** Set TCX window length and overlap configuration * @param prevEnergyHF previous HF energy. Exponent must be the same as for currEnergyHF. diff --git a/lib_enc/transient_detection_fx.c b/lib_enc/transient_detection_fx.c index f459d3582..87ca187df 100644 --- a/lib_enc/transient_detection_fx.c +++ b/lib_enc/transient_detection_fx.c @@ -898,29 +898,19 @@ static Word16 isLongTermTransient_fx( /*HARMONIZATION DONE...*/ -#ifdef HARMONIZE_2537_SetTCXModeInfo void SetTCXModeInfo_fx( Encoder_State *st, /* i/o: encoder state structure */ TRAN_DET_HANDLE hTranDet, /* i/o: transient detection handle */ Word16 *tcxModeOverlap /* o : window overlap of current frame */ ) -#else -void SetTCXModeInfo_ivas_fx( - Encoder_State *st, /* i/o: encoder state structure */ - TRAN_DET_HANDLE hTranDet, /* i/o: transient detection handle */ - Word16 *tcxModeOverlap /* o : window overlap of current frame */ -) -#endif { TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; Word16 tmp, exp_diff; test(); test(); -#ifdef HARMONIZE_2537_SetTCXModeInfo test(); test(); -#endif IF( EQ_16( st->codec_mode, MODE2 ) || ( GT_16( st->element_mode, EVS_MONO ) && NE_16( st->core, HQ_CORE ) ) ) { assert( hTranDet != NULL ); @@ -930,7 +920,6 @@ void SetTCXModeInfo_ivas_fx( IF( st->tcx10Enabled && st->tcx20Enabled ) { /* window switching based on transient detector output */ -#ifdef HARMONIZE_2537_SetTCXModeInfo Word16 currNrgGTprevNrg; IF( GT_16( st->element_mode, EVS_MONO ) ) { @@ -947,15 +936,6 @@ void SetTCXModeInfo_ivas_fx( /* window switching based on transient detector output */ IF( ( ( hTranDet->transientDetector.bIsAttackPresent ) || currNrgGTprevNrg ) && ( ( NE_16( st->last_core, ACELP_CORE ) ) && ( NE_16( st->last_core, AMR_WB_CORE ) ) ) ) -#else - test(); - test(); - test(); - test(); - /* window switching based on transient detector output */ - IF( ( ( hTranDet->transientDetector.bIsAttackPresent ) || ( EQ_32( BASOP_Util_Cmp_Mant32Exp( Mpy_32_32( st->currEnergyHF_fx, 55063683 /*1.0f/39.0f Q31*/ ), st->currEnergyHF_e_fx, st->prevEnergyHF_fx, 17 ), 1 ) && NE_16( st->element_mode, IVAS_CPE_MDCT ) ) ) && - ( ( NE_16( st->last_core, ACELP_CORE ) ) && ( NE_16( st->last_core, AMR_WB_CORE ) ) ) ) -#endif { hTcxEnc->tcxMode = TCX_10; move16(); @@ -1035,9 +1015,7 @@ void SetTCXModeInfo_ivas_fx( move16(); } } -#ifdef HARMONIZE_2537_SetTCXModeInfo IF( GT_16( st->element_mode, EVS_MONO ) ) -#endif { tmp = BASOP_Util_Divide3232_Scale( ONE_IN_Q21, GetTCXAvgTemporalFlatnessMeasure_ivas_fx( hTranDet, NSUBBLOCKS, 0 ), &exp_diff ); tmp = shl_sat( tmp, exp_diff ); // Q15 @@ -1070,9 +1048,7 @@ void SetTCXModeInfo_ivas_fx( *tcxModeOverlap = ALDO_WINDOW; move16(); } -#ifdef HARMONIZE_2537_SetTCXModeInfo IF( GT_16( st->element_mode, EVS_MONO ) ) -#endif { tmp = BASOP_Util_Divide3232_Scale( ONE_IN_Q21, GetTCXAvgTemporalFlatnessMeasure_ivas_fx( hTranDet, NSUBBLOCKS, 0 ), &exp_diff ); tmp = shl_sat( tmp, exp_diff ); // Q15 @@ -1107,148 +1083,16 @@ void SetTCXModeInfo_ivas_fx( *tcxModeOverlap = FULL_OVERLAP; move16(); } -#ifdef HARMONIZE_2537_SetTCXModeInfo IF( EQ_16( st->element_mode, EVS_MONO ) ) { /* Sanity check */ assert( *tcxModeOverlap != 1 ); } -#endif } return; } -#ifndef HARMONIZE_2537_SetTCXModeInfo -/*-------------------------------------------------------------------* - * SetTCXModeInfo() - * - * - *-------------------------------------------------------------------*/ - -void SetTCXModeInfo_fx( - Encoder_State *st, - TRAN_DET_HANDLE hTranDet, - Word16 *tcxModeOverlap ) -{ - TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; - - assert( hTranDet != NULL ); - - IF( EQ_16( st->codec_mode, MODE2 ) ) - { - /* determine window sequence (1 long or 2 short windows) */ - test(); - IF( st->tcx10Enabled != 0 && st->tcx20Enabled != 0 ) - { - /* window switching based on transient detector output */ - test(); - test(); - test(); - IF( ( ( hTranDet->transientDetector.bIsAttackPresent != 0 ) || ( GT_32( Mpy_32_16_1( st->currEnergyHF_fx, 840 /*1.0f/39.0f Q15*/ ), st->prevEnergyHF_fx ) ) ) && ( ( NE_16( st->last_core, ACELP_CORE ) ) && ( NE_16( st->last_core, AMR_WB_CORE ) ) ) ) - { - move16(); - hTcxEnc->tcxMode = TCX_10; - } - ELSE - { - move16(); - hTcxEnc->tcxMode = TCX_20; - } - } - ELSE - { - /* window selection (non-adaptive) based on flags only */ - IF( st->tcx10Enabled ) - { - move16(); - hTcxEnc->tcxMode = TCX_10; - } - ELSE IF( st->tcx20Enabled ) - { - move16(); - hTcxEnc->tcxMode = TCX_20; - } - ELSE - { - move16(); - hTcxEnc->tcxMode = NO_TCX; - } - } - test(); - test(); - IF( st->last_core == ACELP_CORE || st->last_core == AMR_WB_CORE ) - { - move16(); - st->hTcxCfg->tcx_last_overlap_mode = TRANSITION_OVERLAP; - } - ELSE IF( ( EQ_16( hTcxEnc->tcxMode, TCX_10 ) ) && ( EQ_16( st->hTcxCfg->tcx_curr_overlap_mode, ALDO_WINDOW ) ) ) - { - move16(); - st->hTcxCfg->tcx_last_overlap_mode = FULL_OVERLAP; - } - ELSE - { - move16(); - st->hTcxCfg->tcx_last_overlap_mode = st->hTcxCfg->tcx_curr_overlap_mode; - } - - /* determine window overlaps (0 full, 2 none, or 3 half) */ - IF( EQ_16( hTcxEnc->tcxMode, TCX_10 ) ) - { - IF( hTranDet->transientDetector.attackIndex < 0 ) - { - move16(); - *tcxModeOverlap = HALF_OVERLAP; - } - ELSE - { - move16(); - *tcxModeOverlap = s_and( hTranDet->transientDetector.attackIndex, 3 ); - if ( EQ_16( *tcxModeOverlap, 1 ) ) - { - move16(); - *tcxModeOverlap = FULL_OVERLAP; - } - } - } - ELSE IF( EQ_16( hTcxEnc->tcxMode, TCX_20 ) ) - { - IF( EQ_16( hTranDet->transientDetector.attackIndex, 7 ) ) - { - move16(); - *tcxModeOverlap = HALF_OVERLAP; - } - ELSE IF( EQ_16( hTranDet->transientDetector.attackIndex, 6 ) ) - { - move16(); - *tcxModeOverlap = MIN_OVERLAP; - } - ELSE - { - move16(); - *tcxModeOverlap = ALDO_WINDOW; - } - } - ELSE /* NO_TCX */ - { - move16(); - *tcxModeOverlap = TRANSITION_OVERLAP; - } - test(); - if ( ( EQ_16( st->hTcxCfg->tcx_last_overlap_mode, TRANSITION_OVERLAP ) ) && ( EQ_16( *tcxModeOverlap, ALDO_WINDOW ) ) ) - { - move16(); - *tcxModeOverlap = FULL_OVERLAP; - } - - /* Sanity check */ - assert( *tcxModeOverlap != 1 ); - } - - return; -} -#endif /************************************************/ /* */ -- GitLab From 1046d8c4ee708899669ffb9a1e489aad6839cbc6 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:23:12 +0200 Subject: [PATCH 09/31] [cleanup] accept HARMONIZE_2537_GetTCXMaxenergyChange --- lib_com/options.h | 1 - lib_enc/cod_tcx_fx.c | 8 --- lib_enc/prot_fx_enc.h | 14 ----- lib_enc/tcx_ltp_enc_fx.c | 12 ---- lib_enc/tns_base_enc_fx.c | 4 -- lib_enc/transient_detection_fx.c | 104 ------------------------------- 6 files changed, 143 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 1dac5844a..beab20b7b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -96,7 +96,6 @@ #define FIX_2402_SIMPLIFY_ARI_CODEC /* FhG: basop issue 2402: simplified arithmetic in TCX arithmetic coder */ #define FIX_2402_REPL_EVS_ARI_CODEC_ENC /* FhG: basop issue 2402: replace EVS arith encoder with IVAS arith encoder */ #define FIX_BASOP_2551_HARM_SCALAR_QUAN /* FhG: issue 2551: Harmonize function pair tcx_scalar_quantization_fx*/ -#define HARMONIZE_2537_GetTCXMaxenergyChange /* FhG: Harmonize GetTCXMaxenergyChange */ #define HARMONIZE_2508_InitTransientDetection /* FhG: harmonize GetAttackForTCXDecision derivates for evs/ivas */ #define HARMONIZE_2564_GetEnergyCldfb /* FhG: harmonize GetEnergyCldfb derivates for evs/ivas */ #define FIX_BASOP_2555_FRAMELEN_CALC /* FhG: BASOP issue 2555: Simplify (sub-)framelength calculation in ivas_mdct_core_tns_ns_fx() */ diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index 163b03ea9..79b7cc60f 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -4963,11 +4963,7 @@ void TNSAnalysisStereo_fx( ELSE { Word16 maxEnergyChange_fx; -#ifdef HARMONIZE_2537_GetTCXMaxenergyChange maxEnergyChange_fx = mac_r( L_mult( GetTCXMaxenergyChange_fx( sts[0]->hTranDet, isTCX10, NSUBBLOCKS, 3, 1 /*non-EVS*/ ), 16384 ), GetTCXMaxenergyChange_fx( sts[1]->hTranDet, isTCX10, NSUBBLOCKS, 3, 1 /*non-EVS*/ ), 16384 ); -#else - maxEnergyChange_fx = mac_r( L_mult( GetTCXMaxenergyChange_ivas_fx( sts[0]->hTranDet, isTCX10, NSUBBLOCKS, 3 ), 16384 ), GetTCXMaxenergyChange_ivas_fx( sts[1]->hTranDet, isTCX10, NSUBBLOCKS, 3 ), 16384 ); -#endif IF( GE_16( maxEnergyChange_fx, shl( pTnsParameters[0]->minEnergyChange, Q3 - Q7 ) ) ) { @@ -5261,11 +5257,7 @@ void TNSAnalysisStereo_fx( } ELSE { -#ifdef HARMONIZE_2537_GetTCXMaxenergyChange Word16 maxEnergyChange_fx = GetTCXMaxenergyChange_fx( sts[ch]->hTranDet, isTCX10, NSUBBLOCKS, 3, 1 /*non-EVS*/ ); -#else - Word16 maxEnergyChange_fx = GetTCXMaxenergyChange_ivas_fx( sts[ch]->hTranDet, isTCX10, NSUBBLOCKS, 3 ); -#endif IF( GE_16( maxEnergyChange_fx, shl( pTnsParameters->minEnergyChange, Q3 - Q7 ) ) ) { diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index cd52c7b72..41b13da4e 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -946,26 +946,12 @@ Word32 GetTCXAvgTemporalFlatnessMeasure_ivas_fx( * @param nPrevSubblocks Number of subblocks from the previous frames to use for the calculation. * @param maximum energy change with exponent NRG_CHANGE_E */ -#ifdef HARMONIZE_2537_GetTCXMaxenergyChange Word16 GetTCXMaxenergyChange_fx( TRAN_DET_HANDLE hTranDet, const Word8 isTCX10, const Word16 nCurrentSubblocks, const Word16 nPrevSubblocks, Word16 element_mode ); -#else -Word16 GetTCXMaxenergyChange_fx( - TRAN_DET_HANDLE hTranDet, - const Word8 isTCX10, - const Word16 nCurrentSubblocks, - const Word16 nPrevSubblocks ); - -Word16 GetTCXMaxenergyChange_ivas_fx( - TRAN_DET_HANDLE hTranDet, - const Word8 isTCX10, - const Word16 nCurrentSubblocks, - const Word16 nPrevSubblocks ); -#endif /** Set TCX window length and overlap configuration diff --git a/lib_enc/tcx_ltp_enc_fx.c b/lib_enc/tcx_ltp_enc_fx.c index dde520d3a..a90bac6a3 100644 --- a/lib_enc/tcx_ltp_enc_fx.c +++ b/lib_enc/tcx_ltp_enc_fx.c @@ -418,11 +418,7 @@ void tcx_ltp_encode_fx( tempFlatness = GetTCXAvgTemporalFlatnessMeasure_fx( hTranDet, NSUBBLOCKS, nPrevSubblocks ); -#ifdef HARMONIZE_2537_GetTCXMaxenergyChange maxEnergyChange = GetTCXMaxenergyChange_fx( hTranDet, (const Word8) isTCX10, NSUBBLOCKS, nPrevSubblocks, EVS_MONO ); -#else - maxEnergyChange = GetTCXMaxenergyChange_fx( hTranDet, (const Word8) isTCX10, NSUBBLOCKS, nPrevSubblocks ); -#endif /* Switch LTP on */ test(); @@ -772,20 +768,12 @@ void tcx_ltp_encode_ivas_fx( IF( EQ_16( st->element_mode, IVAS_CPE_DFT ) ) { tempFlatness_fx = extract_h( L_shl_sat( GetTCXAvgTemporalFlatnessMeasure_ivas_fx( st->hTranDet, NSUBBLOCKS - NSUBBLOCKS_SHIFT, add( nPrevSubblocks, NSUBBLOCKS_SHIFT ) ), 2 ) ); -#ifdef HARMONIZE_2537_GetTCXMaxenergyChange maxEnergyChange_fx = GetTCXMaxenergyChange_fx( st->hTranDet, (const Word8) isTCX10, NSUBBLOCKS - NSUBBLOCKS_SHIFT, add( nPrevSubblocks, NSUBBLOCKS_SHIFT ), st->element_mode ); // Q3 -#else - maxEnergyChange_fx = GetTCXMaxenergyChange_ivas_fx( st->hTranDet, (const Word8) isTCX10, NSUBBLOCKS - NSUBBLOCKS_SHIFT, add( nPrevSubblocks, NSUBBLOCKS_SHIFT ) ); // Q3 -#endif } ELSE { tempFlatness_fx = extract_h( L_shl_sat( ( GetTCXAvgTemporalFlatnessMeasure_ivas_fx( st->hTranDet, NSUBBLOCKS, nPrevSubblocks ) ), 2 ) ); // Q7 -#ifdef HARMONIZE_2537_GetTCXMaxenergyChange maxEnergyChange_fx = GetTCXMaxenergyChange_fx( st->hTranDet, (const Word8) isTCX10, NSUBBLOCKS, nPrevSubblocks, st->element_mode ); // Q3 -#else - maxEnergyChange_fx = GetTCXMaxenergyChange_ivas_fx( st->hTranDet, (const Word8) isTCX10, NSUBBLOCKS, nPrevSubblocks ); // Q3 -#endif } /* Switch LTP on */ diff --git a/lib_enc/tns_base_enc_fx.c b/lib_enc/tns_base_enc_fx.c index 08793acf4..37883fb48 100644 --- a/lib_enc/tns_base_enc_fx.c +++ b/lib_enc/tns_base_enc_fx.c @@ -405,11 +405,7 @@ Word16 DetectTnsFilt_fx( } ELSE { -#ifdef HARMONIZE_2537_GetTCXMaxenergyChange maxEnergyChange = GetTCXMaxenergyChange_fx( hTranDet, isTCX10, NSUBBLOCKS, 3, 1 /*non-EVS*/ ); -#else - maxEnergyChange = GetTCXMaxenergyChange_ivas_fx( hTranDet, isTCX10, NSUBBLOCKS, 3 ); -#endif IF( sub( maxEnergyChange, shl( pTnsParameters->minEnergyChange, Q3 - Q7 ) ) >= 0 ) { diff --git a/lib_enc/transient_detection_fx.c b/lib_enc/transient_detection_fx.c index 87ca187df..c4519b82a 100644 --- a/lib_enc/transient_detection_fx.c +++ b/lib_enc/transient_detection_fx.c @@ -547,113 +547,22 @@ Word32 GetTCXAvgTemporalFlatnessMeasure_ivas_fx( return i; } -#ifndef HARMONIZE_2537_GetTCXMaxenergyChange -Word16 GetTCXMaxenergyChange_fx( - TRAN_DET_HANDLE hTranDet, - const Word8 isTCX10, - const Word16 nCurrentSubblocks, - const Word16 nPrevSubblocks ) -{ - Word16 i; - TransientDetector const *pTransientDetector; - SubblockEnergies const *pSubblockEnergies; - Word16 nDelay; - Word16 nRelativeDelay; - Word16 const *pSubblockNrgChange; - Word16 maxEnergyChange; - Word16 nTotBlocks; - pTransientDetector = &hTranDet->transientDetector; - pSubblockEnergies = pTransientDetector->pSubblockEnergies; - move16(); - nDelay = pTransientDetector->nDelay; - nRelativeDelay = sub( pSubblockEnergies->nDelay, nDelay ); - pSubblockNrgChange = NULL; - nTotBlocks = nCurrentSubblocks + nPrevSubblocks; - move16(); - - assert( nTotBlocks > 0 ); - maxEnergyChange = 0 /*0.0f Q7*/; - move16(); - - assert( ( nPrevSubblocks <= nRelativeDelay ) && ( nCurrentSubblocks <= NSUBBLOCKS + nDelay ) ); - pSubblockNrgChange = &pSubblockEnergies->subblockNrgChange[nRelativeDelay - nPrevSubblocks]; - - IF( s_or( pTransientDetector->bIsAttackPresent, isTCX10 ) ) /* frame is TCX-10 */ - { - Word32 const *pSubblockNrg = &pSubblockEnergies->subblockNrg[sub( nRelativeDelay, nPrevSubblocks )]; - Word32 nrgMin, nrgMax; - Word16 idxMax = 0; - move16(); - - nrgMax = L_add( pSubblockNrg[0], 0 ); - - /* find subblock with maximum energy */ - FOR( i = 1; i < nTotBlocks; i++ ) - { - if ( LT_32( nrgMax, pSubblockNrg[i] ) ) - { - idxMax = i; - move16(); - } - nrgMax = L_max( nrgMax, pSubblockNrg[i] ); - } - - nrgMin = L_add( nrgMax, 0 ); - - /* find minimum energy after maximum */ - FOR( i = idxMax + 1; i < nTotBlocks; i++ ) - { - nrgMin = L_min( nrgMin, pSubblockNrg[i] ); - } - /* lower maxEnergyChange if energy doesn't decrease much after energy peak */ - /* if (nrgMin > 0.375f * nrgMax) */ - if ( LT_32( Mpy_32_16_1( nrgMax, 12288 /*0.375f Q15*/ ), nrgMin ) ) - { - nTotBlocks = sub( idxMax, 3 ); - } - } - - FOR( i = 0; i < nTotBlocks; i++ ) - { - maxEnergyChange = s_max( maxEnergyChange, pSubblockNrgChange[i] ); - } - - move16(); - i = maxEnergyChange; - - return i; -} -#endif - -#ifdef HARMONIZE_2537_GetTCXMaxenergyChange Word16 GetTCXMaxenergyChange_fx( TRAN_DET_HANDLE hTranDet, const Word8 isTCX10, const Word16 nCurrentSubblocks, const Word16 nPrevSubblocks, Word16 element_mode ) -#else -Word16 GetTCXMaxenergyChange_ivas_fx( - TRAN_DET_HANDLE hTranDet, - const Word8 isTCX10, - const Word16 nCurrentSubblocks, - const Word16 nPrevSubblocks ) -#endif { Word16 i; TransientDetector const *pTransientDetector; SubblockEnergies const *pSubblockEnergies; Word16 nDelay; Word16 nRelativeDelay; -#ifdef HARMONIZE_2537_GetTCXMaxenergyChange Word16 const *pSubblockNrgChange_16; Word32 const *pSubblockNrgChange_32; Word16 const *pSubblockNrgChange_32_exp; -#else - Word32 const *pSubblockNrgChange; - Word16 const *pSubblockNrgChange_exp; -#endif Word16 maxEnergyChange; Word16 nTotBlocks; @@ -662,12 +571,8 @@ Word16 GetTCXMaxenergyChange_ivas_fx( move16(); nDelay = pTransientDetector->nDelay; nRelativeDelay = sub( pSubblockEnergies->nDelay, nDelay ); -#ifdef HARMONIZE_2537_GetTCXMaxenergyChange pSubblockNrgChange_16 = NULL; pSubblockNrgChange_32 = NULL; -#else - pSubblockNrgChange = NULL; -#endif nTotBlocks = add( nCurrentSubblocks, nPrevSubblocks ); assert( nTotBlocks > 0 ); @@ -675,14 +580,9 @@ Word16 GetTCXMaxenergyChange_ivas_fx( move16(); assert( ( nPrevSubblocks <= nRelativeDelay ) && ( nCurrentSubblocks <= NSUBBLOCKS + nDelay ) ); -#ifdef HARMONIZE_2537_GetTCXMaxenergyChange pSubblockNrgChange_16 = &pSubblockEnergies->subblockNrgChange[nRelativeDelay - nPrevSubblocks]; pSubblockNrgChange_32 = &pSubblockEnergies->subblockNrgChange_32fx[nRelativeDelay - nPrevSubblocks]; pSubblockNrgChange_32_exp = &pSubblockEnergies->subblockNrgChange_exp[nRelativeDelay - nPrevSubblocks]; -#else - pSubblockNrgChange = &pSubblockEnergies->subblockNrgChange_32fx[nRelativeDelay - nPrevSubblocks]; - pSubblockNrgChange_exp = &pSubblockEnergies->subblockNrgChange_exp[nRelativeDelay - nPrevSubblocks]; -#endif IF( s_or( pTransientDetector->bIsAttackPresent, isTCX10 ) ) /* frame is TCX-10 */ { @@ -719,15 +619,12 @@ Word16 GetTCXMaxenergyChange_ivas_fx( } } -#ifdef HARMONIZE_2537_GetTCXMaxenergyChange IF( GT_16( element_mode, EVS_MONO ) ) { -#endif FOR( i = 0; i < nTotBlocks; i++ ) { maxEnergyChange = s_max( maxEnergyChange, extract_l( L_shl_sat( pSubblockNrgChange_32[i], sub( pSubblockNrgChange_32_exp[i], 28 ) ) ) ); // Q3 } -#ifdef HARMONIZE_2537_GetTCXMaxenergyChange } ELSE { @@ -736,7 +633,6 @@ Word16 GetTCXMaxenergyChange_ivas_fx( maxEnergyChange = s_max( maxEnergyChange, pSubblockNrgChange_16[i] ); } } -#endif move16(); i = maxEnergyChange; -- GitLab From 03fc220a31df4fd9cde31ab29732e973d3fbac8e Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:24:27 +0200 Subject: [PATCH 10/31] [cleanup] accept HARMONIZE_2508_InitTransientDetection --- lib_com/options.h | 1 - lib_enc/init_enc_fx.c | 8 - lib_enc/ivas_mct_enc_fx.c | 4 - lib_enc/prot_fx_enc.h | 13 -- lib_enc/stat_enc.h | 4 - lib_enc/transient_detection_fx.c | 335 ------------------------------- 6 files changed, 365 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index beab20b7b..c3ccf0cdb 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -96,7 +96,6 @@ #define FIX_2402_SIMPLIFY_ARI_CODEC /* FhG: basop issue 2402: simplified arithmetic in TCX arithmetic coder */ #define FIX_2402_REPL_EVS_ARI_CODEC_ENC /* FhG: basop issue 2402: replace EVS arith encoder with IVAS arith encoder */ #define FIX_BASOP_2551_HARM_SCALAR_QUAN /* FhG: issue 2551: Harmonize function pair tcx_scalar_quantization_fx*/ -#define HARMONIZE_2508_InitTransientDetection /* FhG: harmonize GetAttackForTCXDecision derivates for evs/ivas */ #define HARMONIZE_2564_GetEnergyCldfb /* FhG: harmonize GetEnergyCldfb derivates for evs/ivas */ #define FIX_BASOP_2555_FRAMELEN_CALC /* FhG: BASOP issue 2555: Simplify (sub-)framelength calculation in ivas_mdct_core_tns_ns_fx() */ #define FIX_BASOP_2095_REMOVE_TABLES_PT01 /* FhG: BASOP issue 2095: remove unused tables, part 01 */ diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index 60760e2fb..52fb9b625 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -1211,19 +1211,11 @@ ivas_error init_encoder_fx( IF( GT_16( st->element_mode, EVS_MONO ) ) { -#ifdef HARMONIZE_2508_InitTransientDetection InitTransientDetection_fx( input_frame, 0, st->hTranDet, 1, 1 /* > EVS_MONO */ ); -#else - InitTransientDetection_ivas_fx( input_frame, 0, st->hTranDet, 1 ); -#endif } ELSE { -#ifdef HARMONIZE_2508_InitTransientDetection InitTransientDetection_fx( input_frame, NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS ), st->hTranDet, 0, EVS_MONO ); -#else - InitTransientDetection_fx( input_frame, NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS ), st->hTranDet ); -#endif } /*-----------------------------------------------------------------* diff --git a/lib_enc/ivas_mct_enc_fx.c b/lib_enc/ivas_mct_enc_fx.c index 6abae475f..4b157fbc2 100644 --- a/lib_enc/ivas_mct_enc_fx.c +++ b/lib_enc/ivas_mct_enc_fx.c @@ -1195,11 +1195,7 @@ static ivas_error ivas_mc_enc_reconfig_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Transient Detection\n" ) ); } -#ifdef HARMONIZE_2508_InitTransientDetection InitTransientDetection_fx( extract_l( Mult_32_16( st->input_Fs, INV_FRAME_PER_SEC_Q15 ) ), NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS ), st->hTranDet, 0, st->element_mode ); -#else - InitTransientDetection_ivas_fx( extract_l( Mult_32_16( st->input_Fs, INV_FRAME_PER_SEC_Q15 ) ), NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS ), st->hTranDet, 0 ); -#endif } IF( st->hIGFEnc == NULL ) diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 41b13da4e..046f15211 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -883,25 +883,12 @@ void calculate_hangover_attenuation_gain_fx( * Don't include the delay of the MDCT overlap. * @param pTransientDetection Structure to be initialized. It contains all transient detectors to be used. */ -#ifdef HARMONIZE_2508_InitTransientDetection void InitTransientDetection_fx( const Word16 nFrameLength, const Word16 nTCXDelay, TRAN_DET_HANDLE hTranDet, const Word16 ext_mem_flag, Word16 element_mode ); -#else -void InitTransientDetection_fx( - const Word16 nFrameLength, - const Word16 nTCXDelay, - TRAN_DET_HANDLE hTranDet ); - -void InitTransientDetection_ivas_fx( - const Word16 nFrameLength, - const Word16 nTCXDelay, - TRAN_DET_HANDLE hTranDet, - const Word16 ext_mem_flag ); -#endif /** Runs transient detection. * Runs all transient detectors defined in pTransientDetection diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index 862292de8..1723edb3f 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -162,11 +162,7 @@ typedef struct /* Attack detection function. */ -#ifdef HARMONIZE_2508_InitTransientDetection typedef void ( *TCheckSubblocksForAttack_fx )( Word32 const *pSubblockNrg, Word32 const *pAccSubblockNrg, Word16 nSubblocks, Word16 nPastSubblocks, Word16 attackRatioThreshold, Word16 *pbIsAttackPresent, Word16 *pAttackIndex, Word16 element_mode ); -#else -typedef void ( *TCheckSubblocksForAttack_fx )( Word32 const *pSubblockNrg, Word32 const *pAccSubblockNrg, Word16 nSubblocks, Word16 nPastSubblocks, Word16 attackRatioThreshold, Word16 *pbIsAttackPresent, Word16 *pAttackIndex ); -#endif /* Transient detector. */ typedef struct TransientDetector diff --git a/lib_enc/transient_detection_fx.c b/lib_enc/transient_detection_fx.c index c4519b82a..24e94941b 100644 --- a/lib_enc/transient_detection_fx.c +++ b/lib_enc/transient_detection_fx.c @@ -42,17 +42,9 @@ /************************************************/ static void InitDelayBuffer( const Word16 nFrameLength, const Word16 nDelay, DelayBuffer *pDelayBuffer ); -#ifdef HARMONIZE_2508_InitTransientDetection static void InitSubblockEnergies_fx( const Word16 nFrameLength, const Word16 nDelay, DelayBuffer *pDelayBuffer, SubblockEnergies *pSubblockEnergies, Word16 element_mode ); static void InitTransientDetector_fx( SubblockEnergies *pSubblockEnergies, const Word16 nDelay, const Word16 nSubblocksToCheck, const TCheckSubblocksForAttack_fx pCheckSubblocksForAttack, const Word16 attackRatioThreshold, TransientDetector *pTransientDetector, Word16 element_mode ); static void RunTransientDetector_fx( TransientDetector *pTransientDetector, Word16 element_mode ); -#else -static void InitSubblockEnergies( const Word16 nFrameLength, const Word16 nDelay, DelayBuffer *pDelayBuffer, SubblockEnergies *pSubblockEnergies ); -static void InitSubblockEnergies_ivas_fx( const Word16 nFrameLength, const Word16 nDelay, DelayBuffer *pDelayBuffer, SubblockEnergies *pSubblockEnergies ); -static void InitTransientDetector_fx( SubblockEnergies *pSubblockEnergies, const Word16 nDelay, const Word16 nSubblocksToCheck, const TCheckSubblocksForAttack_fx pCheckSubblocksForAttack, const Word16 attackRatioThreshold, TransientDetector *pTransientDetector ); -static void InitTransientDetector_ivas_fx( SubblockEnergies *pSubblockEnergies, const Word16 nDelay, const Word16 nSubblocksToCheck, const TCheckSubblocksForAttack_fx pCheckSubblocksForAttack, const Word16 attackRatioThreshold, TransientDetector *pTransientDetector ); -static void RunTransientDetector_fx( TransientDetector *pTransientDetector ); -#endif static void UpdateDelayBuffer( Word16 const *input, const Word16 nSamplesAvailable, DelayBuffer *pDelayBuffer ); static void HighPassFilter_fx( Word16 const *input, const Word16 length, Word16 *pFirState1, Word16 *pFirState2, Word16 *output ); static void UpdateSubblockEnergies( Word16 const *input, const Word16 nSamplesAvailable, SubblockEnergies *pSubblockEnergies ); @@ -72,101 +64,9 @@ static void UpdateSubblockEnergies_ivas_fx( Word16 const *input, const Word16 nS * See TCheckSubblocksForAttack_fx FOR definition of parameters. * It is assumed that the delay of MDCT overlap was not taken into account, so that the last subblock corresponds to the newest input subblock. */ -#ifndef HARMONIZE_2508_InitTransientDetection -static void GetAttackForTCXDecision( - Word32 const *pSubblockNrg, - Word32 const *pAccSubblockNrg, - Word16 nSubblocks, - Word16 nPastSubblocks, - Word16 attackRatioThreshold, - Word16 *pbIsAttackPresent, - Word16 *pAttackIndex ) -{ - Word16 i; - Word16 bIsAttackPresent, attackIndex; - Word16 attackRatioThreshold_1_5; - - assert( nSubblocks >= NSUBBLOCKS ); - assert( nPastSubblocks >= 2 ); - - /* attackRatioThreshold_1_5 = attackRatioThreshold * 1.5, exponent is ATTACKTHRESHOLD_E+1 */ - attackRatioThreshold_1_5 = add( shr( attackRatioThreshold, 2 ), shr( attackRatioThreshold, 1 ) ); - - move16(); - move16(); - bIsAttackPresent = FALSE; - attackIndex = 0; - /* Search for the last attack in the subblocks */ - if ( s_or( (Word16) GT_32( L_shr( pSubblockNrg[-1], ATTACKTHRESHOLD_E ), Mpy_32_16_1( pAccSubblockNrg[-1], attackRatioThreshold ) ), - L_sub( L_shr( pSubblockNrg[-2], ATTACKTHRESHOLD_E ), Mpy_32_16_1( pAccSubblockNrg[-2], attackRatioThreshold ) ) > 0 ) ) - { - move16(); - bIsAttackPresent = TRUE; - } - - FOR( i = 0; i < NSUBBLOCKS; i++ ) - { - IF( GT_32( L_shr( pSubblockNrg[i], ATTACKTHRESHOLD_E ), Mpy_32_16_1( pAccSubblockNrg[i], attackRatioThreshold ) ) ) - { - if ( i < 6 ) - { - move16(); - bIsAttackPresent = TRUE; - } - - if ( s_and( (Word16) NE_16( attackIndex, 2 ), (Word16) NE_16( attackIndex, 6 ) ) ) - { - move16(); - attackIndex = i; - } - } - ELSE /* no attack, but set index anyway in case of strong energy increase */ - { - IF( s_and( ( (Word16) GT_32( L_shr( pSubblockNrg[i], 1 + ATTACKTHRESHOLD_E ), Mpy_32_16_1( pSubblockNrg[sub( i, 1 )], attackRatioThreshold_1_5 ) ) ), - ( L_sub( L_shr( pSubblockNrg[i], 1 + ATTACKTHRESHOLD_E ), Mpy_32_16_1( pSubblockNrg[sub( i, 2 )], attackRatioThreshold_1_5 ) ) > 0 ) ) ) - { - - if ( s_and( (Word16) NE_16( attackIndex, 2 ), (Word16) NE_16( attackIndex, 6 ) ) ) - { - move16(); - attackIndex = i; - } - } - } - } - /* avoid post-echos on click sounds (very short transients) due to TNS aliasing */ - if ( EQ_16( attackIndex, 4 ) ) - { - move16(); - attackIndex = 7; - } - if ( EQ_16( attackIndex, 5 ) ) - { - move16(); - attackIndex = 6; - } - - move16(); - move16(); - *pAttackIndex = attackIndex; - *pbIsAttackPresent = bIsAttackPresent; - - return; -} -#endif /* GetAttackForTCXDecision() version using 32-bit for energy change values */ -#ifndef HARMONIZE_2508_InitTransientDetection -static void GetAttackForTCXDecision_ivas_fx( - Word32 const *pSubblockNrg, - Word32 const *pAccSubblockNrg, - Word16 nSubblocks, - Word16 nPastSubblocks, - Word16 attackRatioThreshold, - Word16 *pbIsAttackPresent, - Word16 *pAttackIndex ) -#else static void GetAttackForTCXDecision_fx( Word32 const *pSubblockNrg, Word32 const *pAccSubblockNrg, @@ -176,15 +76,12 @@ static void GetAttackForTCXDecision_fx( Word16 *pbIsAttackPresent, Word16 *pAttackIndex, Word16 element_mode ) -#endif { Word16 i; Word16 bIsAttackPresent, attackIndex; Word16 attackRatioThreshold_1_5; Word64 W_tmp1, W_tmp2, W_tmp3; -#ifdef HARMONIZE_2508_InitTransientDetection Word32 L_tmp1, L_tmp2, L_tmp3; -#endif assert( nSubblocks >= NSUBBLOCKS ); assert( nPastSubblocks >= 2 ); @@ -195,33 +92,22 @@ static void GetAttackForTCXDecision_fx( move16(); move16(); bIsAttackPresent = FALSE; -#ifdef HARMONIZE_2508_InitTransientDetection attackIndex = EQ_16( element_mode, EVS_MONO ) ? 0 : -1; -#else - attackIndex = -1; -#endif /* Search for the last attack in the subblocks */ IF( s_or( (Word16) GT_32( L_shr( pSubblockNrg[-1], ATTACKTHRESHOLD_E ), Mpy_32_16_1( pAccSubblockNrg[-1], attackRatioThreshold ) ), L_sub( L_shr( pSubblockNrg[-2], ATTACKTHRESHOLD_E ), Mpy_32_16_1( pAccSubblockNrg[-2], attackRatioThreshold ) ) > 0 ) ) { move16(); bIsAttackPresent = TRUE; -#ifdef HARMONIZE_2508_InitTransientDetection if ( GT_16( element_mode, EVS_MONO ) ) { attackIndex = 0; move16(); } -#else - attackIndex = 0; - move16(); - -#endif } FOR( i = 0; i < NSUBBLOCKS; i++ ) { -#ifdef HARMONIZE_2508_InitTransientDetection Word16 condition; IF( EQ_16( element_mode, EVS_MONO ) ) { @@ -236,12 +122,6 @@ static void GetAttackForTCXDecision_fx( condition = (Word16) GT_64( W_tmp1, W_tmp2 ); } IF( condition ) -#else - W_tmp2 = W_shr( W_mult_32_16( pAccSubblockNrg[i], attackRatioThreshold ), 1 ); - W_tmp1 = W_shl( pSubblockNrg[i], ( 15 - ATTACKTHRESHOLD_E ) ); - - IF( GT_64( W_tmp1, W_tmp2 ) ) -#endif { if ( i < 6 ) { @@ -253,10 +133,8 @@ static void GetAttackForTCXDecision_fx( { move16(); attackIndex = i; -#ifdef HARMONIZE_2508_InitTransientDetection IF( GT_16( element_mode, EVS_MONO ) ) { -#endif W_tmp2 = W_shr( W_mult_32_16( pAccSubblockNrg[i], attackRatioThreshold ), 1 ); W_tmp2 = W_add( W_tmp2, W_shr( W_tmp2, 3 ) ); // pAccSubblockNrg[i] * 1.125f W_tmp1 = W_shl( pSubblockNrg[i], ( 15 - ATTACKTHRESHOLD_E ) ); @@ -264,14 +142,11 @@ static void GetAttackForTCXDecision_fx( { attackIndex = add( attackIndex, 1 ); /* avoid minimum overlap to prevent clicks */ } -#ifdef HARMONIZE_2508_InitTransientDetection } -#endif } } ELSE /* no attack, but set index anyway in case of strong energy increase */ { -#ifdef HARMONIZE_2508_InitTransientDetection IF( EQ_16( element_mode, EVS_MONO ) ) { L_tmp2 = Mpy_32_16_1( pSubblockNrg[i - 1], attackRatioThreshold_1_5 ); @@ -281,16 +156,13 @@ static void GetAttackForTCXDecision_fx( } ELSE { -#endif W_tmp2 = W_shr( W_mult_32_16( pSubblockNrg[i - 1], attackRatioThreshold_1_5 ), 1 ); W_tmp1 = W_shl( pSubblockNrg[i], ( 15 - ( ATTACKTHRESHOLD_E + 1 ) ) ); W_tmp3 = W_shr( W_mult_32_16( pSubblockNrg[i - 2], attackRatioThreshold_1_5 ), 1 ); -#ifdef HARMONIZE_2508_InitTransientDetection condition = s_and( ( (Word16) GT_64( W_tmp1, W_tmp2 ) ), ( W_sub( W_tmp1, W_tmp3 ) > 0 ) ); } IF( condition ) -#endif { IF( s_and( (Word16) NE_16( attackIndex, 2 ), (Word16) NE_16( attackIndex, 6 ) ) ) @@ -298,10 +170,8 @@ static void GetAttackForTCXDecision_fx( move16(); attackIndex = i; -#ifdef HARMONIZE_2508_InitTransientDetection IF( GT_32( element_mode, EVS_MONO ) ) { -#endif W_tmp2 = W_mult_32_16( pSubblockNrg[i - 1], attackRatioThreshold ); W_tmp3 = W_mult_32_16( pSubblockNrg[i - 2], attackRatioThreshold ); W_tmp1 = W_shl( pSubblockNrg[i], ( 15 - ATTACKTHRESHOLD_E ) ); @@ -311,9 +181,7 @@ static void GetAttackForTCXDecision_fx( { attackIndex = add( attackIndex, 1 ); /* avoid minimum overlap to prevent clicks */ } -#ifdef HARMONIZE_2508_InitTransientDetection } -#endif } } } @@ -339,20 +207,6 @@ static void GetAttackForTCXDecision_fx( } -#ifndef HARMONIZE_2508_InitTransientDetection -/** Initialize TCX transient detector. - * See InitTransientDetector_fx for definition of parameters. - */ -static void InitTCXTransientDetector( - Word16 nDelay, - SubblockEnergies *pSubblockEnergies, - TransientDetector *pTransientDetector ) -{ - InitTransientDetector_fx( pSubblockEnergies, nDelay, NSUBBLOCKS, GetAttackForTCXDecision, 17408 /*8.5f/(1<delayBuffer ); - /* Init a subblock energies buffer used for the TCX Short/Long decision. */ - InitSubblockEnergies( nFrameLength, nTCXDelay, &hTranDet->delayBuffer, &hTranDet->subblockEnergies ); - - /* Init the TCX Short/Long transient detector. */ - InitTCXTransientDetector( nTCXDelay, &hTranDet->subblockEnergies, &hTranDet->transientDetector ); - - /* We need two past subblocks for the TCX TD and NSUBBLOCKS+1 for the temporal flatness measure FOR the TCX LTP. */ - hTranDet->transientDetector.pSubblockEnergies->nDelay = - add( hTranDet->transientDetector.pSubblockEnergies->nDelay, NSUBBLOCKS + 1 ); - - return; -} -#endif - -#ifdef HARMONIZE_2508_InitTransientDetection void InitTransientDetection_fx( const Word16 nFrameLength, const Word16 nTCXDelay, TRAN_DET_HANDLE hTranDet, const Word16 ext_mem_flag, Word16 element_mode ) -#else -void InitTransientDetection_ivas_fx( - const Word16 nFrameLength, - const Word16 nTCXDelay, - TRAN_DET_HANDLE hTranDet, - const Word16 ext_mem_flag ) -#endif { /* Init the delay buffer. */ InitDelayBuffer( nFrameLength, nTCXDelay, &hTranDet->delayBuffer ); /* Init a subblock energies buffer used for the TCX Short/Long decision. */ -#ifdef HARMONIZE_2508_InitTransientDetection InitSubblockEnergies_fx( nFrameLength, nTCXDelay, &hTranDet->delayBuffer, &hTranDet->subblockEnergies, element_mode ); -#else - InitSubblockEnergies_ivas_fx( nFrameLength, nTCXDelay, &hTranDet->delayBuffer, &hTranDet->subblockEnergies ); -#endif /* Init the TCX Short/Long transient detector. */ -#ifdef HARMONIZE_2508_InitTransientDetection InitTransientDetector_fx( &hTranDet->subblockEnergies, nTCXDelay, NSUBBLOCKS, GetAttackForTCXDecision_fx, 17408 /*8.5f/(1<transientDetector, element_mode ); -#else - InitTransientDetector_ivas_fx( &hTranDet->subblockEnergies, nTCXDelay, NSUBBLOCKS, GetAttackForTCXDecision_ivas_fx, 17408 /*8.5f/(1<transientDetector ); -#endif /*HARMONIZE_2508_InitTransientDetection*/ /* We need two past subblocks for the TCX TD and NSUBBLOCKS+1 for the temporal flatness measure FOR the TCX LTP. */ -#ifdef HARMONIZE_2508_InitTransientDetection IF( ext_mem_flag && GT_16( element_mode, EVS_MONO ) ) { hTranDet->transientDetector.pSubblockEnergies->nDelay = @@ -431,20 +246,6 @@ void InitTransientDetection_ivas_fx( add( hTranDet->transientDetector.pSubblockEnergies->nDelay, NSUBBLOCKS + 1 ); move16(); } -#else - IF( ext_mem_flag ) - { - hTranDet->transientDetector.pSubblockEnergies->nDelay = - add( hTranDet->transientDetector.pSubblockEnergies->nDelay, add( ( NSUBBLOCKS + 1 ), ( NSUBBLOCKS_SHIFT + 1 ) ) ); - move16(); - } - ELSE - { - hTranDet->transientDetector.pSubblockEnergies->nDelay = - add( hTranDet->transientDetector.pSubblockEnergies->nDelay, NSUBBLOCKS + 1 ); - move16(); - } -#endif return; } @@ -657,11 +458,7 @@ void RunTransientDetection_fx( UpdateSubblockEnergies( filteredInput, nSamplesAvailable, pSubblockEnergies ); /* Run transient detectors. */ -#ifdef HARMONIZE_2508_InitTransientDetection RunTransientDetector_fx( pTransientDetector, EVS_MONO ); -#else - RunTransientDetector_fx( pTransientDetector ); -#endif /* Update the delay buffer. */ UpdateDelayBuffer( filteredInput, nSamplesAvailable, &hTranDet->delayBuffer ); @@ -732,11 +529,7 @@ void RunTransientDetection_ivas_fx( UpdateSubblockEnergies_ivas_fx( filteredInput_fx, length, pSubblockEnergies ); /* Run transient detectors. */ -#ifdef HARMONIZE_2508_InitTransientDetection RunTransientDetector_fx( pTransientDetector, 1 /*signal non-EVS*/ ); -#else - RunTransientDetector_fx( pTransientDetector ); -#endif /* Update the delay buffer. */ UpdateDelayBuffer( filteredInput_fx, length, &hTranDet->delayBuffer ); @@ -1015,61 +808,19 @@ static void InitDelayBuffer( return; } -#ifndef HARMONIZE_2508_InitTransientDetection -static void InitSubblockEnergies( - const Word16 nFrameLength, - const Word16 nDelay, - DelayBuffer *pDelayBuffer, - SubblockEnergies *pSubblockEnergies ) -{ - Word16 const nMaxBuffSize = sizeof( pSubblockEnergies->subblockNrg ) / sizeof( pSubblockEnergies->subblockNrg[0] ); - move16(); - - assert( ( pDelayBuffer != NULL ) && ( pSubblockEnergies != NULL ) && ( pDelayBuffer->nSubblockSize * NSUBBLOCKS == nFrameLength ) && ( pDelayBuffer->nSubblockSize > 0 ) ); - - set32_fx( pSubblockEnergies->subblockNrg, MIN_BLOCK_ENERGY, nMaxBuffSize ); - set32_fx( pSubblockEnergies->accSubblockNrg, MIN_BLOCK_ENERGY, nMaxBuffSize + 1 ); - set16_fx( pSubblockEnergies->subblockNrgChange, 0x7fff, nMaxBuffSize ); - pSubblockEnergies->nDelay = idiv1616_1( nDelay, pDelayBuffer->nSubblockSize ); - assert( pSubblockEnergies->nDelay < nMaxBuffSize ); - pSubblockEnergies->nPartialDelay = nDelay % pDelayBuffer->nSubblockSize; - pSubblockEnergies->facAccSubblockNrg = 26624 /*0.8125f Q15*/; /* Energy accumulation factor */ - pSubblockEnergies->firState1 = 0; - pSubblockEnergies->firState2 = 0; - move16(); - move16(); - move16(); - move16(); - move16(); - - pSubblockEnergies->pDelayBuffer = pDelayBuffer; - pDelayBuffer->nDelay = s_max( pDelayBuffer->nDelay, pSubblockEnergies->nPartialDelay ); - - return; -} -#endif -#ifdef HARMONIZE_2508_InitTransientDetection static void InitSubblockEnergies_fx( const Word16 nFrameLength, const Word16 nDelay, DelayBuffer *pDelayBuffer, SubblockEnergies *pSubblockEnergies, Word16 element_mode ) -#else -static void InitSubblockEnergies_ivas_fx( - const Word16 nFrameLength, - const Word16 nDelay, - DelayBuffer *pDelayBuffer, - SubblockEnergies *pSubblockEnergies ) -#endif { assert( ( pDelayBuffer != NULL ) && ( pSubblockEnergies != NULL ) && ( pDelayBuffer->nSubblockSize * NSUBBLOCKS == nFrameLength ) && ( pDelayBuffer->nSubblockSize > 0 ) ); Word16 nMaxBuffSize; -#ifdef HARMONIZE_2508_InitTransientDetection IF( EQ_16( element_mode, EVS_MONO ) ) { nMaxBuffSize = sizeof( pSubblockEnergies->subblockNrg ) / sizeof( pSubblockEnergies->subblockNrg[0] ); @@ -1081,7 +832,6 @@ static void InitSubblockEnergies_ivas_fx( } ELSE { -#endif nMaxBuffSize = NSUBBLOCKS + MAX_TD_DELAY; move16(); @@ -1092,9 +842,7 @@ static void InitSubblockEnergies_ivas_fx( set16_fx( pSubblockEnergies->subblockNrgChange_exp, 16, nMaxBuffSize ); pSubblockEnergies->q_firState = 15; move16(); -#ifdef HARMONIZE_2508_InitTransientDetection } -#endif pSubblockEnergies->nDelay = idiv1616_1( nDelay, pDelayBuffer->nSubblockSize ); assert( pSubblockEnergies->nDelay < nMaxBuffSize ); pSubblockEnergies->nPartialDelay = nDelay % pDelayBuffer->nSubblockSize; @@ -1123,45 +871,7 @@ static void InitSubblockEnergies_ivas_fx( * @param attackRatioThreshold Attack ratio threshold with exponent ATTACKTHRESHOLD_E. * @param pTransientDetector Structure to be initialized. */ -#ifndef HARMONIZE_2508_InitTransientDetection -static void InitTransientDetector_fx( - SubblockEnergies *pSubblockEnergies, - const Word16 nDelay, - const Word16 nSubblocksToCheck, - const TCheckSubblocksForAttack_fx pCheckSubblocksForAttack, - const Word16 attackRatioThreshold, - TransientDetector *pTransientDetector ) -{ - Word16 nMaxBuffSize; - - move16(); - nMaxBuffSize = sizeof( pSubblockEnergies->subblockNrg ) / sizeof( pSubblockEnergies->subblockNrg[0] ); - - assert( ( pSubblockEnergies != NULL ) && ( pSubblockEnergies->pDelayBuffer != NULL ) && ( pTransientDetector != NULL ) && ( pSubblockEnergies->pDelayBuffer->nSubblockSize != 0 ) ); - pTransientDetector->pSubblockEnergies = pSubblockEnergies; - pTransientDetector->nDelay = ( nDelay - pSubblockEnergies->nPartialDelay ) / pSubblockEnergies->pDelayBuffer->nSubblockSize; - move16(); - assert( nDelay == pTransientDetector->nDelay * pSubblockEnergies->pDelayBuffer->nSubblockSize + pSubblockEnergies->nPartialDelay ); - assert( pTransientDetector->nDelay < nMaxBuffSize ); - pSubblockEnergies->nDelay = s_max( pSubblockEnergies->nDelay, pTransientDetector->nDelay ); - assert( nSubblocksToCheck <= NSUBBLOCKS + pTransientDetector->nDelay ); - pTransientDetector->nSubblocksToCheck = nSubblocksToCheck; - move16(); - pTransientDetector->CheckSubblocksForAttack_fx = pCheckSubblocksForAttack; - pTransientDetector->attackRatioThreshold = attackRatioThreshold; - move16(); - pTransientDetector->prev_bIsAttackPresent = FALSE; - move16(); - pTransientDetector->bIsAttackPresent = FALSE; - move16(); - pTransientDetector->attackIndex = -1; - move16(); - - return; -} -#endif -#ifdef HARMONIZE_2508_InitTransientDetection static void InitTransientDetector_fx( SubblockEnergies *pSubblockEnergies, const Word16 nDelay, @@ -1170,17 +880,7 @@ static void InitTransientDetector_fx( const Word16 attackRatioThreshold, TransientDetector *pTransientDetector, Word16 element_mode ) -#else -static void InitTransientDetector_ivas_fx( - SubblockEnergies *pSubblockEnergies, - const Word16 nDelay, - const Word16 nSubblocksToCheck, - const TCheckSubblocksForAttack_fx pCheckSubblocksForAttack, - const Word16 attackRatioThreshold, - TransientDetector *pTransientDetector ) -#endif { -#ifdef HARMONIZE_2508_InitTransientDetection Word16 nMaxBuffSize; IF( EQ_16( element_mode, EVS_MONO ) ) { @@ -1208,23 +908,6 @@ static void InitTransientDetector_ivas_fx( } } -#else - const Word16 nMaxBuffSize = NSUBBLOCKS + MAX_TD_DELAY; - move16(); - - assert( ( pSubblockEnergies != NULL ) && ( pSubblockEnergies->pDelayBuffer != NULL ) && ( pTransientDetector != NULL ) && ( pSubblockEnergies->pDelayBuffer->nSubblockSize != 0 ) ); - pTransientDetector->pSubblockEnergies = pSubblockEnergies; - IF( sub( nDelay, pSubblockEnergies->nPartialDelay ) != 0 ) - { - pTransientDetector->nDelay = idiv1616( sub( nDelay, pSubblockEnergies->nPartialDelay ), pSubblockEnergies->pDelayBuffer->nSubblockSize ); - move16(); - } - ELSE - { - pTransientDetector->nDelay = 0; - move16(); - } -#endif assert( nDelay == pTransientDetector->nDelay * pSubblockEnergies->pDelayBuffer->nSubblockSize + pSubblockEnergies->nPartialDelay ); assert( pTransientDetector->nDelay < nMaxBuffSize ); pSubblockEnergies->nDelay = s_max( pSubblockEnergies->nDelay, pTransientDetector->nDelay ); @@ -1241,17 +924,11 @@ static void InitTransientDetector_ivas_fx( move16(); pTransientDetector->attackIndex = -1; move16(); -#ifdef HARMONIZE_2508_InitTransientDetection IF( GT_16( element_mode, EVS_MONO ) ) { pTransientDetector->pSubblockEnergies->ramp_up_flag = 0x0; move16(); } -#else - pTransientDetector->pSubblockEnergies->ramp_up_flag = 0x0; - move16(); - -#endif return; } @@ -1297,14 +974,9 @@ static void HighPassFilter_fx( return; } -#ifdef HARMONIZE_2508_InitTransientDetection static void RunTransientDetector_fx( TransientDetector *pTransientDetector, Word16 element_mode ) -#else -static void RunTransientDetector_fx( - TransientDetector *pTransientDetector ) -#endif { Word16 const attackRatioThreshold = pTransientDetector->attackRatioThreshold; move16(); @@ -1319,17 +991,10 @@ static void RunTransientDetector_fx( assert( ( pTransientDetector->CheckSubblocksForAttack_fx != NULL ) ); #define WMC_TOOL_SKIP -#ifdef HARMONIZE_2508_InitTransientDetection pTransientDetector->CheckSubblocksForAttack_fx( pSubblockNrg, pAccSubblockNrg, NSUBBLOCKS + nDelay, nRelativeDelay, attackRatioThreshold, &pTransientDetector->bIsAttackPresent, &pTransientDetector->attackIndex, element_mode ); -#else - pTransientDetector->CheckSubblocksForAttack_fx( pSubblockNrg, pAccSubblockNrg, - NSUBBLOCKS + nDelay, nRelativeDelay, - attackRatioThreshold, - &pTransientDetector->bIsAttackPresent, &pTransientDetector->attackIndex ); -#endif #undef WMC_TOOL_SKIP return; -- GitLab From 0915f5dbeed47fa9fbaee1023d878a6bcb617afd Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:25:22 +0200 Subject: [PATCH 11/31] [cleanup] accept FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API --- apps/decoder.c | 6 ------ apps/encoder.c | 6 ------ lib_com/common_api_types.h | 2 -- lib_com/options.h | 1 - lib_util/ivas_rtp_api.h | 13 ------------- lib_util/ivas_rtp_file.c | 14 -------------- lib_util/ivas_rtp_file.h | 4 ---- lib_util/ivas_rtp_payload.c | 15 --------------- 8 files changed, 61 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index ad318fdcc..1bb6db63a 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1766,9 +1766,7 @@ static ivas_error initOnFirstGoodFrame( uint16_t rtpDecSeed = RANDOM_INITSEED_DEC; uint32_t ssrc = ( (uint32_t) IVAS_RTP_OwnRandom( &rtpDecSeed ) & 0x0000FFFF ) | ( (uint32_t) IVAS_RTP_OwnRandom( &rtpDecSeed ) << 16 ); uint16_t seqNumInitVal = IVAS_RTP_OwnRandom( &rtpDecSeed ); -#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API uint8_t payloadType = DEFAULT_IVAS_PAYLOAD_TYPE; /* Dynamic PT are in range [96, 127] */ -#endif if ( ( error = IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ) ) != IVAS_ERR_OK ) { @@ -1805,11 +1803,7 @@ static ivas_error initOnFirstGoodFrame( /* Split Rendering RTPDump Output file */ -#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API if ( ( error = IVAS_RTP_WRITER_Init( srRtp, arg.outputWavFilename, 1000 / ( IVAS_NUM_FRAMES_PER_SEC * splitRendCodecFrameSizeMs ), payloadType, ssrc, seqNumInitVal ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_RTP_WRITER_Init( srRtp, arg.outputWavFilename, 1000 / ( IVAS_NUM_FRAMES_PER_SEC * splitRendCodecFrameSizeMs ), ssrc, seqNumInitVal ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nError: Can't open SR output bitstream file for RTP output %s \n\n", arg.outputWavFilename ); return error; diff --git a/apps/encoder.c b/apps/encoder.c index f58a9dfb8..b3a359304 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -230,9 +230,7 @@ int main( uint16_t rtpEncSeed = RANDOM_INITSEED_ENC; uint32_t ssrc = ( (uint32_t) IVAS_RTP_OwnRandom( &rtpEncSeed ) & 0x0000FFFF ) | ( (uint32_t) IVAS_RTP_OwnRandom( &rtpEncSeed ) << 16 ); uint16_t seqNumInitVal = IVAS_RTP_OwnRandom( &rtpEncSeed ); -#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API uint8_t payloadType = DEFAULT_IVAS_PAYLOAD_TYPE; /* Dynamic PT are in range [96, 127] */ -#endif /*------------------------------------------------------------------------------------------* * Parse command-line arguments @@ -647,11 +645,7 @@ int main( if ( arg.rtpdumpOutput ) { -#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API if ( ( error = IVAS_RTP_WRITER_Init( &ivasRtp, arg.outputBitstreamFilename, arg.numFramesPerPacket, payloadType, ssrc, seqNumInitVal ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_RTP_WRITER_Init( &ivasRtp, arg.outputBitstreamFilename, arg.numFramesPerPacket, ssrc, seqNumInitVal ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nError: Can't open output bitstream file for RTP output %s \n\n", arg.outputBitstreamFilename ); goto cleanup; diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index ccda2dc3f..3b366fb4c 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -72,10 +72,8 @@ #define IVAS_TIME_SCALE_MIN 50 /* min. time-scaling [%] */ #define IVAS_TIME_SCALE_MAX 150 /* max. time-scaling [%] */ -#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API /* RTP constants */ #define DEFAULT_IVAS_PAYLOAD_TYPE ( 96 ) -#endif /*----------------------------------------------------------------------------------* * Common API enum for output audio configurations diff --git a/lib_com/options.h b/lib_com/options.h index c3ccf0cdb..5e172bc95 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -111,7 +111,6 @@ /* #################### Start NON-BE switches ############################ */ /* any switch which is non-be wrt. TS 26.251 V3.0 */ -#define FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API /* Expose Payload Type setting in RTP Header */ #define FIX_2500_RENDCONF_REFACTOR /* Eri: Basop issue #2500: Renderer configuration range check before conversion to fixed point. Harmonize between BASOP/float */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION /* Eri: Basop issue 2023: Distance attenuation scaling, adding clamping of distance att input and listener position */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION_BUGFIX /* Eri: Bug discovered in cleanup of basop issue 2023 */ diff --git a/lib_util/ivas_rtp_api.h b/lib_util/ivas_rtp_api.h index 7a25e4123..038680c1b 100644 --- a/lib_util/ivas_rtp_api.h +++ b/lib_util/ivas_rtp_api.h @@ -306,7 +306,6 @@ void IVAS_RTP_PACK_Close( ); /* Update the RTP Header structure */ -#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API ivas_error IVAS_RTP_PACK_UpdateHeader( IVAS_RTP_PACK_HANDLE hIvasPack, /* i/o: pointer to an IVAS rtp packer handle to be opened */ uint8_t payloadType, /* i : 7-bit payload type indication, negotiated via sdp */ @@ -318,18 +317,6 @@ ivas_error IVAS_RTP_PACK_UpdateHeader( uint16_t numExtensionBytes, /* i : length of the extension data */ uint8_t *extData /* i : extension data pointer */ ); -#else -ivas_error IVAS_RTP_PACK_UpdateHeader( - IVAS_RTP_PACK_HANDLE hIvasPack, /* i/o: pointer to an IVAS rtp packer handle to be opened */ - uint16_t seqNumInitVal, /* i : Initial sequence number to be used for 1st packet */ - uint32_t ssrc, /* i : Unique 32-bit Source ID as negotiated during SDP */ - uint8_t numCC, /* i : numCC indicates no. of contributing sources */ - uint32_t *csrc, /* i : SSRCs of contributing Sources for a mixed stream */ - uint16_t extHeaderId, /* i : extension header ID */ - uint16_t numExtensionBytes, /* i : length of the extension data */ - uint8_t *extData /* i : extension data pointer */ -); -#endif /* Add requests for remote sender using a key value pair api * each key must be provided with a corresponding value type diff --git a/lib_util/ivas_rtp_file.c b/lib_util/ivas_rtp_file.c index 7e741826b..d3227e380 100644 --- a/lib_util/ivas_rtp_file.c +++ b/lib_util/ivas_rtp_file.c @@ -932,7 +932,6 @@ void IVAS_RTP_Term( } } -#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API ivas_error IVAS_RTP_WRITER_Init( IVAS_RTP *rtp, /* i/o : IVAS RTP File writer handle */ const char *outputBitstreamFilename, /* i : RTP Dump filename */ @@ -941,15 +940,6 @@ ivas_error IVAS_RTP_WRITER_Init( uint32_t SSRC, /* i : SSRC for RTP Header */ uint16_t seqNumInitVal /* i : Initial seq number in rtp header */ ) -#else -ivas_error IVAS_RTP_WRITER_Init( - IVAS_RTP *rtp, /* i/o : IVAS RTP File writer handle */ - const char *outputBitstreamFilename, /* i : RTP Dump filename */ - uint32_t numFramesPerPacket, /* i : No. of frames per packet desired */ - uint32_t SSRC, /* i : SSRC for RTP Header */ - uint16_t seqNumInitVal /* i : Initial seq number in rtp header */ -) -#endif { ivas_error error = IVAS_ERR_OK; @@ -971,11 +961,7 @@ ivas_error IVAS_RTP_WRITER_Init( } /* initialize RTP packer header sequence only in file-based mode */ -#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API error = IVAS_RTP_PACK_UpdateHeader( rtp->hPack, payloadType, seqNumInitVal, SSRC, 0, NULL, 0, 0, NULL ); -#else - error = IVAS_RTP_PACK_UpdateHeader( rtp->hPack, seqNumInitVal, SSRC, 0, NULL, 0, 0, NULL ); -#endif if ( error != IVAS_ERR_OK ) { fprintf( stderr, "error in IVAS_RTP_PACK_UpdateHeader(): %d\n", error ); diff --git a/lib_util/ivas_rtp_file.h b/lib_util/ivas_rtp_file.h index cb7dd26ec..0c2b08081 100644 --- a/lib_util/ivas_rtp_file.h +++ b/lib_util/ivas_rtp_file.h @@ -69,11 +69,7 @@ typedef struct IVAS_RTP_SR_INFO srInfo; } IVAS_RTP; -#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API ivas_error IVAS_RTP_WRITER_Init( IVAS_RTP *rtp, const char *outputBitstreamFilename, uint32_t numFramesPerPacket, uint8_t payloadType, uint32_t SSRC, uint16_t seqNumInitVal ); -#else -ivas_error IVAS_RTP_WRITER_Init( IVAS_RTP *rtp, const char *outputBitstreamFilename, uint32_t numFramesPerPacket, uint32_t SSRC, uint16_t seqNumInitVal ); -#endif ivas_error IVAS_RTP_READER_Init( IVAS_RTP *rtp, const char *inputBitstreamFilename, const char *piOutputFilename, bool isExtOutput, const char *outputWavFilename ); void IVAS_RTP_Term( IVAS_RTP *rtp ); ivas_error IVAS_RTP_WriteNextFrame( IVAS_RTP *rtp, uint8_t *au, const IVAS_RTP_SR_INFO *srInfo, int16_t auSizeBits, bool isMono, bool forcePacket ); diff --git a/lib_util/ivas_rtp_payload.c b/lib_util/ivas_rtp_payload.c index 922d4e881..57a2b0aab 100644 --- a/lib_util/ivas_rtp_payload.c +++ b/lib_util/ivas_rtp_payload.c @@ -173,7 +173,6 @@ static const uint32_t amrWBIOFrameSizeInBits[] = { /* Update the RTP Header structure */ -#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API ivas_error IVAS_RTP_PACK_UpdateHeader( IVAS_RTP_PACK_HANDLE hPack, /* i/o: pointer to an IVAS rtp packer handle to be opened */ uint8_t payloadType, /* i : 7-bit payload type indication, negotiated via sdp */ @@ -185,18 +184,6 @@ ivas_error IVAS_RTP_PACK_UpdateHeader( uint16_t numExtensionBytes, /* i : length of the extension data */ uint8_t *extData /* i : extension data pointer */ ) -#else -ivas_error IVAS_RTP_PACK_UpdateHeader( - IVAS_RTP_PACK_HANDLE hPack, /* i/o: pointer to an IVAS rtp packer handle to be opened */ - uint16_t seqNumInitVal, /* i : Initial sequence number to be used for 1st packet */ - uint32_t ssrc, /* i : Unique 32-bit Source ID as negotiated during SDP */ - uint8_t numCC, /* i : numCC indicates no. of contributing sources */ - uint32_t *csrc, /* i : SSRCs of contributing Sources for a mixed stream */ - uint16_t extHeaderId, /* i : extension header ID */ - uint16_t numExtensionBytes, /* i : length of the extension data */ - uint8_t *extData /* i : extension data pointer */ -) -#endif { RTP_HEADER *header = &hPack->header; @@ -205,9 +192,7 @@ ivas_error IVAS_RTP_PACK_UpdateHeader( return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "CC must be less than 16" ); } -#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API header->payloadType = payloadType; -#endif header->seqNumber = seqNumInitVal; header->ssrc = ssrc; header->CC = numCC; -- GitLab From 34a235dcfad7c675cf94180ce89b0c49f854b2f0 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:26:05 +0200 Subject: [PATCH 12/31] [cleanup] accept USE_RTPDUMP --- lib_com/options.h | 1 - lib_util/ivas_rtp_file.c | 52 ---------------------------------------- lib_util/mime_io.c | 4 ---- lib_util/rtpdump.c | 2 -- lib_util/rtpdump.h | 2 -- 5 files changed, 61 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 5e172bc95..e141efe89 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -114,7 +114,6 @@ #define FIX_2500_RENDCONF_REFACTOR /* Eri: Basop issue #2500: Renderer configuration range check before conversion to fixed point. Harmonize between BASOP/float */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION /* Eri: Basop issue 2023: Distance attenuation scaling, adding clamping of distance att input and listener position */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION_BUGFIX /* Eri: Bug discovered in cleanup of basop issue 2023 */ -#define USE_RTPDUMP /* FhG: RTPDUMP format (rtptools standard) instead of custom format */ #define FIX_FLOAT_1569_REND_RENDER_CONFIG_CHECKS /* Nokia: float issue 1569: fix render config checks in renderer */ #define FIX_BASOP_2526_SPAR_MASA_PARAM_MAP_Q_BUG /* Nokia: BASOP issue 2526: Fix wrong Q variable in SPAR to MASA param mapping */ #define FIX_BASOP_2524_MASA_REDUCE_META_BUG /* Nokia: BASOP issue 2524: Fix wrong reset of W_tmp in reduce_metadata_further_fx */ diff --git a/lib_util/ivas_rtp_file.c b/lib_util/ivas_rtp_file.c index d3227e380..4e0feaeea 100644 --- a/lib_util/ivas_rtp_file.c +++ b/lib_util/ivas_rtp_file.c @@ -39,7 +39,6 @@ #define Q15 15 -#ifdef USE_RTPDUMP #include "rtpdump.h" struct IVAS_RTP_FILE @@ -49,14 +48,6 @@ struct IVAS_RTP_FILE uint32_t offset_ms; }; -#else // USE_RTPDUMP - -struct IVAS_RTP_FILE -{ - bool isFileWriter; - FILE *f_rtpstream; -}; -#endif // USE_RTPDUMP static ivas_error IvasRtpFile_Open( const char *filePath, /* i : path to CA config file */ @@ -64,7 +55,6 @@ static ivas_error IvasRtpFile_Open( IVAS_RTP_FILE_HANDLE *phRtpFile /* o : pointer to an IVAS file reader handle */ ) { -#ifdef USE_RTPDUMP RTPDUMP_HANDLE f_rtpstream; RTPDUMP_ERROR rderr; if ( isFileWriter ) @@ -79,14 +69,6 @@ static ivas_error IvasRtpFile_Open( { return IVAS_ERROR( IVAS_ERR_FAILED_FILE_OPEN, "rtpdump open error %d", rderr ); } -#else // USE_RTPDUMP - const char *mode = isFileWriter ? "wb" : "rb"; - FILE *f_rtpstream = fopen( filePath, mode ); - if ( f_rtpstream == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_FILE_OPEN, "could not open: %s\n", filePath ); - } -#endif // USE_RTPDUMP *phRtpFile = calloc( 1, sizeof( struct IVAS_RTP_FILE ) ); if ( *phRtpFile != NULL ) @@ -106,11 +88,7 @@ static ivas_error IvasRtpFile_Close( { if ( ( *phReader )->f_rtpstream != NULL ) { -#ifdef USE_RTPDUMP RTPDUMP_Close( &( *phReader )->f_rtpstream, 1 ); -#else // USE_RTPDUMP - fclose( ( *phReader )->f_rtpstream ); -#endif // USE_RTPDUMP ( *phReader )->f_rtpstream = NULL; } free( *phReader ); @@ -128,7 +106,6 @@ static ivas_error IvasRtpFile_Write( ivas_error error = IVAS_ERR_OK; if ( hRtpFile->isFileWriter ) { -#ifdef USE_RTPDUMP RTPDUMP_RTPPACKET pkt; RTPDUMP_SetDefaultRtpPacketHeader( &pkt ); numBytes = ( numBytes > sizeof( pkt.data ) ) ? sizeof( pkt.data ) : numBytes; @@ -137,11 +114,6 @@ static ivas_error IvasRtpFile_Write( pkt.payloadSize = (unsigned short) ( numBytes - pkt.headerSize ); /* compute time offset in ms from RTP timestamp (16kHz clock) */ error = ( RTPDUMP_WritePacket( hRtpFile->f_rtpstream, &pkt, pkt.timeStamp / 16 ) != RTPDUMP_NO_ERROR ) ? IVAS_ERR_FAILED_FILE_WRITE : IVAS_ERR_OK; -#else // USE_RTPDUMP - uint32_t length = (uint32_t) numBytes; /* Max packet length is < 32 bits*/ - fwrite( &length, sizeof( uint32_t ), 1, hRtpFile->f_rtpstream ); - fwrite( packet, sizeof( uint8_t ), numBytes, hRtpFile->f_rtpstream ); -#endif // USE_RTPDUMP } else { @@ -158,15 +130,11 @@ static ivas_error IvasRtpFile_Read( ) { size_t nread = 0; -#ifndef USE_RTPDUMP - uint32_t length = 0; -#endif // USE_RTPDUMP if ( hRtpFile->isFileWriter ) { return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "File open for writing cannot be read" ); } -#ifdef USE_RTPDUMP RTPDUMP_RTPPACKET pd; RTPDUMP_ERROR rderr = RTPDUMP_ReadPacket( hRtpFile->f_rtpstream, &pd, &hRtpFile->offset_ms ); if ( rderr == RTPDUMP_READ_ENDOFFILE ) @@ -186,26 +154,6 @@ static ivas_error IvasRtpFile_Read( } memcpy( packet, pd.data, nread ); *numBytes = nread; -#else // USE_RTPDUMP - nread = fread( &length, sizeof( uint32_t ), 1, hRtpFile->f_rtpstream ); /* Read Packet Length */ - if ( nread == 0 ) - { - return IVAS_ERR_END_OF_FILE; - } - - *numBytes = length; - if ( ( *numBytes ) > capacity ) - { - fprintf( stderr, "RTP packet > buffer capacity %lu bytes\n", capacity ); - return IVAS_ERR_INVALID_OUTPUT_BUFFER_SIZE; - } - - nread = fread( packet, sizeof( uint8_t ), ( *numBytes ), hRtpFile->f_rtpstream ); /* Read Packet */ - if ( nread < ( *numBytes ) ) - { - return IVAS_ERR_END_OF_FILE; - } -#endif // USE_RTPDUMP return IVAS_ERR_OK; } diff --git a/lib_util/mime_io.c b/lib_util/mime_io.c index 4cc7bea36..de2654d1b 100644 --- a/lib_util/mime_io.c +++ b/lib_util/mime_io.c @@ -318,11 +318,7 @@ static bool readByte( FILE *file, uint8_t *value ) static bool readLong( FILE *file, uint16_t *value ) { char buffer[4] = { 0 }; -#ifdef USE_RTPDUMP if ( fread( buffer, 1, 4, file ) != 4U ) -#else - if ( fread( buffer, 1, 4, file ) != 1U ) -#endif { return false; } diff --git a/lib_util/rtpdump.c b/lib_util/rtpdump.c index 2b5ab064c..0a115ec4e 100644 --- a/lib_util/rtpdump.c +++ b/lib_util/rtpdump.c @@ -281,7 +281,6 @@ RTPDUMP_OpenForWriting( RTPDUMP_HANDLE *phRTPDUMP, const char *filename ) return RTPDUMP_NO_ERROR; } -#ifdef USE_RTPDUMP RTPDUMP_ERROR RTPDUMP_SetHeaderInfo( RTPDUMP_HANDLE hRTPDUMP, uint32_t source, @@ -352,7 +351,6 @@ RTPDUMP_GetHeaderInfo( RTPDUMP_HANDLE hRTPDUMP, return RTPDUMP_NO_ERROR; } -#endif RTPDUMP_ERROR RTPDUMP_ReadPacket( RTPDUMP_HANDLE hRTPDUMP, diff --git a/lib_util/rtpdump.h b/lib_util/rtpdump.h index 32415ab4e..95c716457 100644 --- a/lib_util/rtpdump.h +++ b/lib_util/rtpdump.h @@ -85,7 +85,6 @@ extern "C" RTPDUMP_ERROR RTPDUMP_OpenForWriting( RTPDUMP_HANDLE *phRTPDUMP, const char *filename ); -#ifdef USE_RTPDUMP RTPDUMP_ERROR RTPDUMP_SetHeaderInfo( RTPDUMP_HANDLE hRTPDUMP, uint32_t source, @@ -99,7 +98,6 @@ extern "C" uint16_t *port, uint32_t *startSeconds, uint32_t *startMicroSeconds ); -#endif RTPDUMP_ERROR RTPDUMP_ReadPacket( RTPDUMP_HANDLE hRTPDUMP, -- GitLab From dc691d23f6a00cddbd6a64b4b0cfcd0a299785c3 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:26:54 +0200 Subject: [PATCH 13/31] [cleanup] accept FIX_FLOAT_1569_REND_RENDER_CONFIG_CHECKS --- lib_com/options.h | 1 - lib_rend/lib_rend_fx.c | 16 ---------------- 2 files changed, 17 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index e141efe89..58bff7ba7 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -114,7 +114,6 @@ #define FIX_2500_RENDCONF_REFACTOR /* Eri: Basop issue #2500: Renderer configuration range check before conversion to fixed point. Harmonize between BASOP/float */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION /* Eri: Basop issue 2023: Distance attenuation scaling, adding clamping of distance att input and listener position */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION_BUGFIX /* Eri: Bug discovered in cleanup of basop issue 2023 */ -#define FIX_FLOAT_1569_REND_RENDER_CONFIG_CHECKS /* Nokia: float issue 1569: fix render config checks in renderer */ #define FIX_BASOP_2526_SPAR_MASA_PARAM_MAP_Q_BUG /* Nokia: BASOP issue 2526: Fix wrong Q variable in SPAR to MASA param mapping */ #define FIX_BASOP_2524_MASA_REDUCE_META_BUG /* Nokia: BASOP issue 2524: Fix wrong reset of W_tmp in reduce_metadata_further_fx */ #define FIX_BASOP_2520_PARAMBIN_THRESHOLD_FIX /* Nokia: BASOP issue 2520: Fix wrong threshold in ParamBin */ diff --git a/lib_rend/lib_rend_fx.c b/lib_rend/lib_rend_fx.c index cc63c47f7..e7fedb16a 100644 --- a/lib_rend/lib_rend_fx.c +++ b/lib_rend/lib_rend_fx.c @@ -4840,14 +4840,9 @@ ivas_error IVAS_REND_AddInput_fx( setMaxGlobalDelayNs( hIvasRend ); /* select default reverb size after adding an input */ -#ifdef FIX_FLOAT_1569_REND_RENDER_CONFIG_CHECKS test(); IF( EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) && EQ_32( hIvasRend->selectedRoomReverbSize, DEFAULT_REVERB_UNSET ) ) -#else - IF( EQ_32( hIvasRend->selectedRoomReverbSize, DEFAULT_REVERB_UNSET ) ) -#endif { -#ifdef FIX_FLOAT_1569_REND_RENDER_CONFIG_CHECKS IF( NE_32( error = IVAS_REND_SetReverbRoomSize( hIvasRend, getDefaultReverbSize( hIvasRend->inputsIsm, hIvasRend->inputsMasa, hIvasRend->inputsMc, @@ -4856,13 +4851,6 @@ ivas_error IVAS_REND_AddInput_fx( { return error; } -#else - IVAS_REND_SetReverbRoomSize( hIvasRend, - getDefaultReverbSize( hIvasRend->inputsIsm, - hIvasRend->inputsMasa, - hIvasRend->inputsMc, - hIvasRend->inputsSba ) ); -#endif } return IVAS_ERR_OK; @@ -6149,11 +6137,7 @@ ivas_error IVAS_REND_SetReverbRoomSize( IF( hIvasRend->hRendererConfig != NULL ) { -#ifdef FIX_FLOAT_1569_REND_RENDER_CONFIG_CHECKS IF( NE_32( error = ivas_render_config_change_defaults( hIvasRend->hRendererConfig, hIvasRend->selectedRoomReverbSize ), IVAS_ERR_OK ) ) -#else - IF( EQ_32( error = ivas_render_config_change_defaults( hIvasRend->hRendererConfig, hIvasRend->selectedRoomReverbSize ), IVAS_ERR_OK ) ) -#endif { return error; } -- GitLab From 6fee154febdc9ebc2a2d1cf484f57e794d60b8a2 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:27:41 +0200 Subject: [PATCH 14/31] [cleanup] accept FIX_BASOP_2526_SPAR_MASA_PARAM_MAP_Q_BUG --- lib_com/options.h | 1 - lib_dec/ivas_masa_dec_fx.c | 5 ----- 2 files changed, 6 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 58bff7ba7..897d50ec0 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -114,7 +114,6 @@ #define FIX_2500_RENDCONF_REFACTOR /* Eri: Basop issue #2500: Renderer configuration range check before conversion to fixed point. Harmonize between BASOP/float */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION /* Eri: Basop issue 2023: Distance attenuation scaling, adding clamping of distance att input and listener position */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION_BUGFIX /* Eri: Bug discovered in cleanup of basop issue 2023 */ -#define FIX_BASOP_2526_SPAR_MASA_PARAM_MAP_Q_BUG /* Nokia: BASOP issue 2526: Fix wrong Q variable in SPAR to MASA param mapping */ #define FIX_BASOP_2524_MASA_REDUCE_META_BUG /* Nokia: BASOP issue 2524: Fix wrong reset of W_tmp in reduce_metadata_further_fx */ #define FIX_BASOP_2520_PARAMBIN_THRESHOLD_FIX /* Nokia: BASOP issue 2520: Fix wrong threshold in ParamBin */ #define FIX_BASOP_2510_UNNECESSARY_ASSERT /* Nokia: BASOP issue 2510: Fix by removing assert */ diff --git a/lib_dec/ivas_masa_dec_fx.c b/lib_dec/ivas_masa_dec_fx.c index 7a115c76c..6c80c617d 100644 --- a/lib_dec/ivas_masa_dec_fx.c +++ b/lib_dec/ivas_masa_dec_fx.c @@ -2258,13 +2258,8 @@ void ivas_spar_param_to_masa_param_mapping_fx( move64(); move64(); } -#ifdef FIX_BASOP_2526_SPAR_MASA_PARAM_MAP_Q_BUG transportSignalCrossCorrelation_64[bin] = W_add( transportSignalCrossCorrelation_64[bin], W_mult0_32_32( L_shr_sat( inRe_fx[0][slot][bin], sub( q_cldfb[0][slot], common_q ) ), L_shr_sat( inRe_fx[1][slot][bin], sub( q_cldfb[1][slot], common_q ) ) ) ); // Q(2 * common_q) transportSignalCrossCorrelation_64[bin] = W_add( transportSignalCrossCorrelation_64[bin], W_mult0_32_32( L_shr_sat( inIm_fx[0][slot][bin], sub( q_cldfb[0][slot], common_q ) ), L_shr_sat( inIm_fx[1][slot][bin], sub( q_cldfb[1][slot], common_q ) ) ) ); // Q(2 * common_q) -#else - transportSignalCrossCorrelation_64[bin] = W_add( transportSignalCrossCorrelation_64[bin], W_mult0_32_32( L_shr_sat( inRe_fx[0][slot][bin], sub( q_cldfb[0][slot], common_q ) ), L_shr_sat( inRe_fx[1][slot][bin], sub( q_cldfb[0][slot], common_q ) ) ) ); // Q(2 * common_q) - transportSignalCrossCorrelation_64[bin] = W_add( transportSignalCrossCorrelation_64[bin], W_mult0_32_32( L_shr_sat( inIm_fx[0][slot][bin], sub( q_cldfb[0][slot], common_q ) ), L_shr_sat( inIm_fx[1][slot][bin], sub( q_cldfb[0][slot], common_q ) ) ) ); // Q(2 * common_q) -#endif move64(); move64(); } -- GitLab From c69ba984f4585764188d79f4a625ae848a011b50 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:28:23 +0200 Subject: [PATCH 15/31] [cleanup] accept FIX_BASOP_2524_MASA_REDUCE_META_BUG --- lib_com/options.h | 1 - lib_enc/ivas_masa_enc_fx.c | 10 ---------- 2 files changed, 11 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 897d50ec0..9a634d30b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -114,7 +114,6 @@ #define FIX_2500_RENDCONF_REFACTOR /* Eri: Basop issue #2500: Renderer configuration range check before conversion to fixed point. Harmonize between BASOP/float */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION /* Eri: Basop issue 2023: Distance attenuation scaling, adding clamping of distance att input and listener position */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION_BUGFIX /* Eri: Bug discovered in cleanup of basop issue 2023 */ -#define FIX_BASOP_2524_MASA_REDUCE_META_BUG /* Nokia: BASOP issue 2524: Fix wrong reset of W_tmp in reduce_metadata_further_fx */ #define FIX_BASOP_2520_PARAMBIN_THRESHOLD_FIX /* Nokia: BASOP issue 2520: Fix wrong threshold in ParamBin */ #define FIX_BASOP_2510_UNNECESSARY_ASSERT /* Nokia: BASOP issue 2510: Fix by removing assert */ #define FIX_2515_TDREND_PORT_ERROR_SCALING /* Nokia: BASOP issue 2515: Fix port error by changing to correct scaling */ diff --git a/lib_enc/ivas_masa_enc_fx.c b/lib_enc/ivas_masa_enc_fx.c index 4c5f7ba28..c3562678a 100644 --- a/lib_enc/ivas_masa_enc_fx.c +++ b/lib_enc/ivas_masa_enc_fx.c @@ -2599,26 +2599,16 @@ static void reduce_metadata_further_fx( Word32 x, y, z; Word32 veclen, L_tmp; -#ifndef FIX_BASOP_2524_MASA_REDUCE_META_BUG - W_tmp = 0; - move64(); -#endif FOR( band = 0; band < numCodingBands; band++ ) { xSum = 0; ySum = 0; zSum = 0; -#ifndef FIX_BASOP_2524_MASA_REDUCE_META_BUG - bandSumEnergy = 0; - move32(); -#endif move32(); move32(); move32(); -#ifdef FIX_BASOP_2524_MASA_REDUCE_META_BUG W_tmp = 0; move64(); -#endif FOR( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { -- GitLab From 6b6d954418696f3e47e24216def265b368e078c6 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:29:04 +0200 Subject: [PATCH 16/31] [cleanup] accept FIX_BASOP_2520_PARAMBIN_THRESHOLD_FIX --- lib_com/options.h | 1 - lib_rend/ivas_dirac_dec_binaural_functions_fx.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 9a634d30b..2f1998885 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -114,7 +114,6 @@ #define FIX_2500_RENDCONF_REFACTOR /* Eri: Basop issue #2500: Renderer configuration range check before conversion to fixed point. Harmonize between BASOP/float */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION /* Eri: Basop issue 2023: Distance attenuation scaling, adding clamping of distance att input and listener position */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION_BUGFIX /* Eri: Bug discovered in cleanup of basop issue 2023 */ -#define FIX_BASOP_2520_PARAMBIN_THRESHOLD_FIX /* Nokia: BASOP issue 2520: Fix wrong threshold in ParamBin */ #define FIX_BASOP_2510_UNNECESSARY_ASSERT /* Nokia: BASOP issue 2510: Fix by removing assert */ #define FIX_2515_TDREND_PORT_ERROR_SCALING /* Nokia: BASOP issue 2515: Fix port error by changing to correct scaling */ #define FIX_BASOP_2522_MAP_PARAMS_DIRAC_STEREO /* FhG: BASOP issue 2522: Fix copy and paste error for side_gain calculation in map_params_dirac_to_stereo() */ diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 391e59f53..f82cce810 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -1646,11 +1646,7 @@ static void ivas_dirac_dec_binaural_formulate_target_covariance_matrices_fx( } ELSE IF( NE_32( ivas_format, MASA_ISM_FORMAT ) || ( EQ_32( ivas_format, MASA_ISM_FORMAT ) && LT_16( dirIndex, hSpatParamRendCom->numParametricDirections ) ) ) /* For second of the two simultaneous directions */ { -#ifdef FIX_BASOP_2520_PARAMBIN_THRESHOLD_FIX IF( LT_32( ( ratio_fx = hSpatParamRendCom->energy_ratio2_fx[dirac_read_idx][bin] ), 1073741 /* 0.001 in Q30 */ ) ) -#else - IF( LT_32( ( ratio_fx = hSpatParamRendCom->energy_ratio2_fx[dirac_read_idx][bin] ), 10737418 /* 0.01 in Q30 */ ) ) -#endif { /* This touches only MASA path where second direction always has smaller ratio and * for non-2dir it is zero. As the whole direction contribution is multiplied with -- GitLab From 15d0bf24f34b544b179b0bb934641ba3a4ccefdd Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:29:49 +0200 Subject: [PATCH 17/31] [cleanup] accept FIX_BASOP_2510_UNNECESSARY_ASSERT --- lib_com/options.h | 1 - lib_rend/ivas_dirac_rend_fx.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 2f1998885..c42ded537 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -114,7 +114,6 @@ #define FIX_2500_RENDCONF_REFACTOR /* Eri: Basop issue #2500: Renderer configuration range check before conversion to fixed point. Harmonize between BASOP/float */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION /* Eri: Basop issue 2023: Distance attenuation scaling, adding clamping of distance att input and listener position */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION_BUGFIX /* Eri: Bug discovered in cleanup of basop issue 2023 */ -#define FIX_BASOP_2510_UNNECESSARY_ASSERT /* Nokia: BASOP issue 2510: Fix by removing assert */ #define FIX_2515_TDREND_PORT_ERROR_SCALING /* Nokia: BASOP issue 2515: Fix port error by changing to correct scaling */ #define FIX_BASOP_2522_MAP_PARAMS_DIRAC_STEREO /* FhG: BASOP issue 2522: Fix copy and paste error for side_gain calculation in map_params_dirac_to_stereo() */ #define FIX_2505_IVAS_DEC_SEGFAULT /* FhG: BASOP #2505: Add headroom to input of ivas_rend_crendProcessSubframe_fx() for ivas_mdft_fx() calculation */ diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index 0743705bc..d56272108 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -1257,10 +1257,6 @@ void initDiffuseResponses_fx( move16(); Word16 num_horizontal_speakers_isq = ISqrt16( num_horizontal_speakers, &exp_var1 ); // q15-exp_var1 num_horizontal_speakers_isq = shr( num_horizontal_speakers_isq, negate( exp_var1 ) ); // q15 -#ifndef FIX_BASOP_2510_UNNECESSARY_ASSERT - assert( 0 ); - /*No stream hitting*/ -#endif FOR( i = 0; i < num_channels; i++ ) { diffuse_response_function_fx[i] = mult( diffuse_response_function_fx[i], num_horizontal_speakers_isq ); // q15 -- GitLab From a3fec9cab76257ca951eb4f4ba9dbb879c30a053 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:30:36 +0200 Subject: [PATCH 18/31] [cleanup] accept FIX_2515_TDREND_PORT_ERROR_SCALING --- lib_com/options.h | 1 - lib_rend/ivas_objectRenderer_hrFilt_fx.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index c42ded537..5de33060b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -114,7 +114,6 @@ #define FIX_2500_RENDCONF_REFACTOR /* Eri: Basop issue #2500: Renderer configuration range check before conversion to fixed point. Harmonize between BASOP/float */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION /* Eri: Basop issue 2023: Distance attenuation scaling, adding clamping of distance att input and listener position */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION_BUGFIX /* Eri: Bug discovered in cleanup of basop issue 2023 */ -#define FIX_2515_TDREND_PORT_ERROR_SCALING /* Nokia: BASOP issue 2515: Fix port error by changing to correct scaling */ #define FIX_BASOP_2522_MAP_PARAMS_DIRAC_STEREO /* FhG: BASOP issue 2522: Fix copy and paste error for side_gain calculation in map_params_dirac_to_stereo() */ #define FIX_2505_IVAS_DEC_SEGFAULT /* FhG: BASOP #2505: Add headroom to input of ivas_rend_crendProcessSubframe_fx() for ivas_mdft_fx() calculation */ #define HARMONIZE_DoRTFTn /* VA: harmonize functions DoRTFTn_fx() and DoRTFTn_fx_ivas() */ diff --git a/lib_rend/ivas_objectRenderer_hrFilt_fx.c b/lib_rend/ivas_objectRenderer_hrFilt_fx.c index 88be20e0c..2a404c94b 100644 --- a/lib_rend/ivas_objectRenderer_hrFilt_fx.c +++ b/lib_rend/ivas_objectRenderer_hrFilt_fx.c @@ -84,11 +84,7 @@ ivas_error TDREND_REND_RenderSourceHRFilt_fx( Scale_sig32( Src_p->hrf_left_prev_fx, Src_p->filterlength, sub( Src_p->hrf_left_prev_e, left_filter_e ) ); Scale_sig32( hrf_left_delta_fx, Src_p->filterlength, sub( *hrf_left_delta_e, left_filter_e ) ); Scale_sig32( Src_p->hrf_right_prev_fx, Src_p->filterlength, sub( Src_p->hrf_right_prev_e, right_filter_e ) ); -#ifdef FIX_2515_TDREND_PORT_ERROR_SCALING Scale_sig32( hrf_right_delta_fx, Src_p->filterlength, sub( *hrf_right_delta_e, right_filter_e ) ); -#else - Scale_sig32( hrf_right_delta_fx, Src_p->filterlength, sub( *hrf_right_delta_e, left_filter_e ) ); -#endif Src_p->hrf_left_prev_e = left_filter_e; move16(); *hrf_left_delta_e = left_filter_e; -- GitLab From eb70e5a3857713e6baba0f0492b7ff5cd4c55b69 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:31:26 +0200 Subject: [PATCH 19/31] [cleanup] accept FIX_BASOP_2522_MAP_PARAMS_DIRAC_STEREO --- lib_com/options.h | 1 - lib_dec/ivas_sba_dirac_stereo_dec_fx.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 5de33060b..bf6011a6a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -114,7 +114,6 @@ #define FIX_2500_RENDCONF_REFACTOR /* Eri: Basop issue #2500: Renderer configuration range check before conversion to fixed point. Harmonize between BASOP/float */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION /* Eri: Basop issue 2023: Distance attenuation scaling, adding clamping of distance att input and listener position */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION_BUGFIX /* Eri: Bug discovered in cleanup of basop issue 2023 */ -#define FIX_BASOP_2522_MAP_PARAMS_DIRAC_STEREO /* FhG: BASOP issue 2522: Fix copy and paste error for side_gain calculation in map_params_dirac_to_stereo() */ #define FIX_2505_IVAS_DEC_SEGFAULT /* FhG: BASOP #2505: Add headroom to input of ivas_rend_crendProcessSubframe_fx() for ivas_mdft_fx() calculation */ #define HARMONIZE_DoRTFTn /* VA: harmonize functions DoRTFTn_fx() and DoRTFTn_fx_ivas() */ #define FIX_1574_EFAP_CODE_LINT /* FhG: float issue 1574: Code quality fixes in ivas_efap.c */ diff --git a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c index 1d15b3d29..d31d16522 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c @@ -645,11 +645,7 @@ static void map_params_dirac_to_stereo( move32(); IF( q_sqrt ) { -#ifdef FIX_BASOP_2522_MAP_PARAMS_DIRAC_STEREO side_gain[b + STEREO_DFT_BAND_MAX] = L_shl( side_gain[b + STEREO_DFT_BAND_MAX], q_sqrt ); /*Q31*/ -#else - side_gain[b + STEREO_DFT_BAND_MAX] = L_shl( side_gain[b], q_sqrt ); /*Q31*/ -#endif q_sqrt = 0; move16(); } -- GitLab From 55d4a3dccc8d8a2c7ad438585e265c8e4a07d036 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:32:07 +0200 Subject: [PATCH 20/31] [cleanup] accept FIX_2505_IVAS_DEC_SEGFAULT --- lib_com/options.h | 1 - lib_dec/ivas_dec_render_fx.c | 10 ---------- lib_rend/ivas_crend_fx.c | 4 ---- 3 files changed, 15 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index bf6011a6a..6805502d2 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -114,7 +114,6 @@ #define FIX_2500_RENDCONF_REFACTOR /* Eri: Basop issue #2500: Renderer configuration range check before conversion to fixed point. Harmonize between BASOP/float */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION /* Eri: Basop issue 2023: Distance attenuation scaling, adding clamping of distance att input and listener position */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION_BUGFIX /* Eri: Bug discovered in cleanup of basop issue 2023 */ -#define FIX_2505_IVAS_DEC_SEGFAULT /* FhG: BASOP #2505: Add headroom to input of ivas_rend_crendProcessSubframe_fx() for ivas_mdft_fx() calculation */ #define HARMONIZE_DoRTFTn /* VA: harmonize functions DoRTFTn_fx() and DoRTFTn_fx_ivas() */ #define FIX_1574_EFAP_CODE_LINT /* FhG: float issue 1574: Code quality fixes in ivas_efap.c */ #define FIX_BASOP_2529_MASA_RATIO_SCALINGS /* Nokia: BASOP issue 2529: Fix MASA ratio scalings and verifications */ diff --git a/lib_dec/ivas_dec_render_fx.c b/lib_dec/ivas_dec_render_fx.c index ee5105fde..edfb1a83e 100644 --- a/lib_dec/ivas_dec_render_fx.c +++ b/lib_dec/ivas_dec_render_fx.c @@ -1077,17 +1077,14 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( } ELSE IF( EQ_16( renderer_type_old, RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) { -#ifdef FIX_2505_IVAS_DEC_SEGFAULT Word16 subframe_len, guard_bits, q_shift_min; -#endif /* Convert to CICPxx; used also for ISM->CICP19->binaural_room rendering */ set16_fx( st_ivas->hIsmRendererData->interpolator_fx, 32767, n_samples_granularity ); // 32767=1.0f in Q15 ivas_ism_render_sf_fx( st_ivas, renderer_type_old, p_output_fx, n_samples_granularity ); st_ivas->hCrendWrapper->p_io_qfactor = &st_ivas->hCrendWrapper->io_qfactor; -#ifdef FIX_2505_IVAS_DEC_SEGFAULT IF( NE_32( ( error = getAudioConfigNumChannels( IVAS_AUDIO_CONFIG_7_1_4, &nchan_in ) ), IVAS_ERR_OK ) ) { @@ -1109,25 +1106,18 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( scale_sig32( p_output_fx[i], *nSamplesRendered, q_shift_min ); } *st_ivas->hCrendWrapper->p_io_qfactor = add( Q11, q_shift_min ); -#else - *st_ivas->hCrendWrapper->p_io_qfactor = 11; - - move16(); -#endif IF( NE_32( ( error = ivas_rend_crendProcessSubframe_fx( st_ivas->hCrendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, st_ivas->hDecoderConfig, NULL, NULL, NULL, st_ivas->hTcBuffer, p_output_fx, p_output_fx, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs, 0 ) ), IVAS_ERR_OK ) ) { return error; } -#ifdef FIX_2505_IVAS_DEC_SEGFAULT FOR( Word16 i = 0; i < nchan_in; i++ ) { scale_sig32( p_output_fx[i], *nSamplesRendered, negate( q_shift_min ) ); // Q11 } *st_ivas->hCrendWrapper->p_io_qfactor = Q11; move16(); -#endif } } ELSE diff --git a/lib_rend/ivas_crend_fx.c b/lib_rend/ivas_crend_fx.c index 5e4192891..fb652a389 100644 --- a/lib_rend/ivas_crend_fx.c +++ b/lib_rend/ivas_crend_fx.c @@ -1923,11 +1923,7 @@ static ivas_error ivas_rend_crendConvolver_fx( } } } -#ifdef FIX_2505_IVAS_DEC_SEGFAULT ivas_mdft_fx( pIn, pFreq_buf_re, pFreq_buf_im, subframe_length, subframe_length ); // Input guard bits are added two functions up the call chain before ivas_rend_crendProcessSubframe_fx() is called -#else - ivas_mdft_fx( pIn, pFreq_buf_re, pFreq_buf_im, subframe_length, subframe_length ); -#endif i = add( i, 1 ); } } -- GitLab From 525f8562e2fa24a6be1bdc9afc0f8d4328c90f98 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:32:55 +0200 Subject: [PATCH 21/31] [cleanup] accept HARMONIZE_DoRTFTn --- lib_com/fft_fx.c | 307 ------------------------ lib_com/fft_fx_evs.c | 31 --- lib_com/ivas_mdct_imdct_fx.c | 21 -- lib_com/ivas_prot_fx.h | 8 - lib_com/ivas_rom_com.h | 4 - lib_com/ivas_rom_com_fx.c | 17 -- lib_com/options.h | 1 - lib_com/prot_fx.h | 51 ---- lib_com/rom_com.h | 3 - lib_com/rom_com_fx.c | 266 -------------------- lib_rend/ivas_reverb_fft_filter_fx.c | 8 - lib_rend/ivas_reverb_filter_design_fx.c | 4 - 12 files changed, 721 deletions(-) diff --git a/lib_com/fft_fx.c b/lib_com/fft_fx.c index c87d34566..a6546e6f7 100644 --- a/lib_com/fft_fx.c +++ b/lib_com/fft_fx.c @@ -87,9 +87,6 @@ *-----------------------------------------------------------------*/ static void cdftForw( Word16 n, Word32 *a, const Word16 *ip, const Word16 *w ); -#ifndef HARMONIZE_DoRTFTn -static void bitrv2_SR( Word16 n, const Word16 *ip, Word32 *a ); -#endif static void cftfsub( Word16 n, Word32 *a, const Word16 *w ); static void cft1st( Word16 n, Word32 *a, const Word16 *w ); static void cftmdl( Word16 n, Word16 l, Word32 *a, const Word16 *w ); @@ -1548,11 +1545,7 @@ static void fft5_4( * a low complexity 2-dimensional DFT of 80 points *-----------------------------------------------------------------*/ -#ifdef HARMONIZE_DoRTFTn static void DoRTFT80_fx( -#else -void DoRTFT80_fx( -#endif Word32 *x, /* i/o: real part of input and output data Qx */ Word32 *y /* i/o: imaginary part of input and output data Qx */ ) @@ -1579,11 +1572,7 @@ void DoRTFT80_fx( * a low complexity 2-dimensional DFT of 120 points *-----------------------------------------------------------------*/ -#ifdef HARMONIZE_DoRTFTn static void DoRTFT120_fx( -#else -void DoRTFT120_fx( -#endif Word32 *x, /* i/o: real part of input and output data Qx */ Word32 *y /* i/o: imaginary part of input and output data Qx */ ) @@ -1610,11 +1599,7 @@ void DoRTFT120_fx( * a low complexity 2-dimensional DFT of 160 points *-----------------------------------------------------------------*/ -#ifdef HARMONIZE_DoRTFTn static void DoRTFT160_fx( -#else -void DoRTFT160_fx( -#endif Word32 x[], /* i/o: real part of input and output data Qx */ Word32 y[] /* i/o: imaginary part of input and output data Qx */ ) @@ -1641,11 +1626,7 @@ void DoRTFT160_fx( * a low complexity 2-dimensional DFT of 320 points *-----------------------------------------------------------------*/ -#ifdef HARMONIZE_DoRTFTn static void DoRTFT320_fx( -#else -void DoRTFT320_fx( -#endif Word32 *x, /* i/o: real part of input and output data Qx */ Word32 *y /* i/o: imaginary part of input and output data Qx */ ) @@ -1672,11 +1653,7 @@ void DoRTFT320_fx( * a low complexity 2-dimensional DFT of 480 points *-----------------------------------------------------------------*/ -#ifdef HARMONIZE_DoRTFTn static void DoRTFT480_fx( -#else -void DoRTFT480_fx( -#endif Word32 *x, /* i/o: real part of input and output data Qx */ Word32 *y /* i/o: imaginary part of input and output data Qx */ ) @@ -1703,11 +1680,7 @@ void DoRTFT480_fx( * a low complexity 2-dimensional DFT of 40 points *-----------------------------------------------------------------*/ -#ifdef HARMONIZE_DoRTFTn static void DoRTFT40_fx( -#else -void DoRTFT40_fx( -#endif Word32 *x, /* i/o: real part of input and output data Qx */ Word32 *y /* i/o: imaginary part of input and output data Qx */ ) @@ -1733,11 +1706,7 @@ void DoRTFT40_fx( * a low complexity 2-dimensional DFT of 20 points *-----------------------------------------------------------------*/ -#ifdef HARMONIZE_DoRTFTn static void DoRTFT20_fx( -#else -void DoRTFT20_fx( -#endif Word32 *x, /* i/o: real part of input and output data Qx */ Word32 *y /* i/o: imaginary part of input and output data Qx */ ) @@ -1764,11 +1733,7 @@ void DoRTFT20_fx( * FFT with 128 points *-----------------------------------------------------------------*/ -#ifdef HARMONIZE_DoRTFTn static void DoRTFT128_fx( -#else -void DoRTFT128_fx( -#endif Word32 *x, /* i/o: real part of input and output data Qx */ Word32 *y /* i/o: imaginary part of input and output data Qx */ ) @@ -1815,11 +1780,7 @@ static void cdftForw( ) { /* bit reversal */ -#ifdef HARMONIZE_DoRTFTn bitrv2_SR_fx( n, ip + 2, a ); -#else - bitrv2_SR( n, ip + 2, a ); -#endif /* Do FFT */ cftfsub( n, a, w ); @@ -1828,209 +1789,6 @@ static void cdftForw( } -#ifndef HARMONIZE_DoRTFTn -/*-----------------------------------------------------------------* - * bitrv2_SR() - * Bit reversal - *-----------------------------------------------------------------*/ - -static void bitrv2_SR( - Word16 n, /* i : data length of real and imag Q0 */ - const Word16 *ip, /* i/o: work area for bit reversal Q0 */ - Word32 *a /* i/o: input/output data Qx */ -) -{ - Word16 j, j1, k, k1, m, m2; - Word16 l; - Word32 xr, xi, yr, yi; - - IF( EQ_16( n, 64 ) ) - { - m = 4; - move16(); - l = -1; - move16(); - } - ELSE IF( EQ_16( n, 256 ) ) - { - m = 8; - move16(); - l = -1; - move16(); - } - ELSE IF( EQ_16( n, 16 ) ) - { - m = 2; - move16(); - l = -1; - move16(); - } - ELSE - { - l = n; - move16(); - m = 1; - move16(); - - WHILE( ( m << 3 ) < l ) - { - l = shr( l, 1 ); - m = shl( m, 1 ); - } - l = sub( l, shl( m, 3 ) ); - } - - m2 = shl( m, 1 ); - - IF( l == 0 ) - { - FOR( k = 0; k < m; k++ ) - { - FOR( j = 0; j < k; j++ ) - { - j1 = add( shl( j, 1 ), ip[k] ); - k1 = add( shl( k, 1 ), ip[j] ); - xr = a[j1]; // Qx - move32(); - xi = a[j1 + 1]; // Qx - move32(); - yr = a[k1]; // Qx - move32(); - yi = a[k1 + 1]; // Qx - move32(); - a[j1] = yr; // Qx - move32(); - a[j1 + 1] = yi; // Qx - move32(); - a[k1] = xr; // Qx - move32(); - a[k1 + 1] = xi; // Qx - move32(); - j1 = add( j1, m2 ); - k1 = add( k1, 2 * m2 ); - xr = a[j1]; - move32(); - xi = a[j1 + 1]; - move32(); - yr = a[k1]; - move32(); - yi = a[k1 + 1]; - move32(); - a[j1] = yr; - move32(); - a[j1 + 1] = yi; - move32(); - a[k1] = xr; - move32(); - a[k1 + 1] = xi; - move32(); - j1 = add( j1, m2 ); - k1 = sub( k1, m2 ); - xr = a[j1]; - move32(); - xi = a[j1 + 1]; - move32(); - yr = a[k1]; - move32(); - yi = a[k1 + 1]; - move32(); - a[j1] = yr; - move32(); - a[j1 + 1] = yi; - move32(); - a[k1] = xr; - move32(); - a[k1 + 1] = xi; - move32(); - j1 = add( j1, m2 ); - k1 = add( k1, shl( m2, 1 ) ); - xr = a[j1]; - move32(); - xi = a[j1 + 1]; - move32(); - yr = a[k1]; - move32(); - yi = a[k1 + 1]; - move32(); - a[j1] = yr; - move32(); - a[j1 + 1] = yi; - move32(); - a[k1] = xr; - move32(); - a[k1 + 1] = xi; - move32(); - } - - j1 = add( shl( k, 1 ), add( m2, ip[k] ) ); - k1 = add( j1, m2 ); - xr = a[j1]; - move32(); - xi = a[j1 + 1]; - move32(); - yr = a[k1]; - move32(); - yi = a[k1 + 1]; - move32(); - a[j1] = yr; - move32(); - a[j1 + 1] = yi; - move32(); - a[k1] = xr; - move32(); - a[k1 + 1] = xi; - move32(); - } - } - ELSE - { - FOR( k = 1; k < m; k++ ) - { - FOR( j = 0; j < k; j++ ) - { - j1 = add( shl( j, 1 ), ip[k] ); - k1 = add( shl( k, 1 ), ip[j] ); - xr = a[j1]; - move32(); - xi = a[j1 + 1]; - move32(); - yr = a[k1]; - move32(); - yi = a[k1 + 1]; - move32(); - a[j1] = yr; - move32(); - a[j1 + 1] = yi; - move32(); - a[k1] = xr; - move32(); - a[k1 + 1] = xi; - move32(); - j1 = add( j1, m2 ); - k1 = add( k1, m2 ); - xr = a[j1]; - move32(); - xi = a[j1 + 1]; - move32(); - yr = a[k1]; - move32(); - yi = a[k1 + 1]; - move32(); - a[j1] = yr; - move32(); - a[j1 + 1] = yi; - move32(); - a[k1] = xr; - move32(); - a[k1 + 1] = xi; - move32(); - } - } - } - - return; -} -#endif /*-----------------------------------------------------------------* * cftfsub() @@ -2474,63 +2232,6 @@ static void cftmdl( return; } -#ifndef HARMONIZE_DoRTFTn -void DoRTFTn_fx_ivas( - Word32 *x, /* i/o: real part of input and output data Qx */ - Word32 *y, /* i/o: imaginary part of input and output data Qx */ - const Word16 n /* i : size of the FFT up to 1024 Q0*/ -) -{ - Word16 i; - Word32 z[2048]; - - FOR( i = 0; i < n; i++ ) - { - z[2 * i] = x[i]; // Qx - move32(); - z[( ( i << 1 ) + 1 )] = y[i]; // Qx - move32(); - } - - SWITCH( n ) - { - case ( 16 ): - cdftForw( 2 * n, z, Ip_fft16, w_fft16_fx ); - BREAK; - case ( 32 ): - cdftForw( 2 * n, z, Ip_fft32, w_fft32_fx ); - BREAK; - case ( 64 ): - cdftForw( 2 * n, z, Ip_fft64, w_fft64_fx ); - BREAK; - case ( 128 ): - cdftForw( 2 * n, z, Ip_fft128, w_fft128_fx ); - BREAK; - case ( 256 ): - cdftForw( 2 * n, z, Ip_fft256, w_fft256_fx ); - BREAK; - case ( 512 ): - cdftForw( 2 * n, z, Ip_fft512, w_fft512_fx ); - BREAK; - default: - assert( 0 ); - } - - x[0] = z[0]; // Qx - move32(); - y[0] = z[1]; // Qx - move32(); - FOR( i = 1; i < n; i++ ) - { - x[( n - i )] = z[2 * i]; - move32(); - y[( n - i )] = z[( ( i << 1 ) + 1 )]; - move32(); - } - - return; -} -#endif static void rfft_post( const Word16 *sine_table, // Q15 @@ -3516,11 +3217,7 @@ void DoFFT_fx( DoRTFT320_fx( re2, im2 ); BREAK; case 256: -#ifdef HARMONIZE_DoRTFTn DoRTFTn_fx( re2, im2, NULL, 256 ); -#else - DoRTFTn_fx_ivas( re2, im2, 256 ); -#endif BREAK; case 240: DoRTFT240( re2, im2 ); @@ -3544,11 +3241,7 @@ void DoFFT_fx( DoRTFT80_fx( re2, im2 ); BREAK; case 64: -#ifdef HARMONIZE_DoRTFTn DoRTFTn_fx( re2, im2, NULL, 64 ); -#else - DoRTFTn_fx_ivas( re2, im2, 64 ); -#endif BREAK; case 40: DoRTFT40_fx( re2, im2 ); diff --git a/lib_com/fft_fx_evs.c b/lib_com/fft_fx_evs.c index 8b6413f99..5cbfbc250 100644 --- a/lib_com/fft_fx_evs.c +++ b/lib_com/fft_fx_evs.c @@ -37,9 +37,6 @@ static void fft5_32_16fx( Word16 *zRe, Word16 *zIm, const Word16 *Idx ); static void cdftForw_16fx( Word16 n, Word16 *a, const Word16 *ip, const Word32 *w ); static void cdftForw_fx( Word16 n, Word32 *a, const Word16 *ip, const Word16 *w ); -#ifndef HARMONIZE_DoRTFTn -static void bitrv2_SR_fx( Word16 n, const Word16 *ip, Word32 *a ); -#endif static void cftfsub_fx( Word16 n, Word32 *a, const Word16 *w ); static void cft1st_fx( Word16 n, Word32 *a, const Word16 *w ); static void cftmdl_fx( Word16 n, Word16 l, Word32 *a, const Word16 *w ); @@ -86,51 +83,27 @@ void DoRTFTn_fx( IF( EQ_16( n, 16 ) ) { -#ifdef HARMONIZE_DoRTFTn cdftForw_fx( 2 * n, z, Ip_fft16, w_fft512_fx ); -#else - cdftForw_fx( 2 * n, z, Ip_fft16, w_fft512_fx_evs ); -#endif } ELSE IF( EQ_16( n, 32 ) ) { -#ifdef HARMONIZE_DoRTFTn cdftForw_fx( 2 * n, z, Ip_fft32, w_fft512_fx ); -#else - cdftForw_fx( 2 * n, z, Ip_fft32, w_fft512_fx_evs ); -#endif } ELSE IF( EQ_16( n, 64 ) ) { -#ifdef HARMONIZE_DoRTFTn cdftForw_fx( 2 * n, z, Ip_fft64, w_fft512_fx ); -#else - cdftForw_fx( 2 * n, z, Ip_fft64, w_fft512_fx_evs ); -#endif } ELSE IF( EQ_16( n, 128 ) ) { -#ifdef HARMONIZE_DoRTFTn cdftForw_fx( 2 * n, z, Ip_fft128, w_fft512_fx ); -#else - cdftForw_fx( 2 * n, z, Ip_fft128, w_fft512_fx_evs ); -#endif } ELSE IF( EQ_16( n, 256 ) ) { -#ifdef HARMONIZE_DoRTFTn cdftForw_fx( 2 * n, z, Ip_fft256, w_fft512_fx ); -#else - cdftForw_fx( 2 * n, z, Ip_fft256, w_fft512_fx_evs ); -#endif } ELSE IF( EQ_16( n, 512 ) ) { -#ifdef HARMONIZE_DoRTFTn cdftForw_fx( 2 * n, z, Ip_fft512, w_fft512_fx ); -#else - cdftForw_fx( 2 * n, z, Ip_fft512, w_fft512_fx_evs ); -#endif } ELSE { @@ -197,11 +170,7 @@ static void cdftForw_fx( * Bit reversal *-----------------------------------------------------------------*/ -#ifdef HARMONIZE_DoRTFTn void bitrv2_SR_fx( -#else -static void bitrv2_SR_fx( -#endif Word16 n, /* i : data length of real and imag */ const Word16 *ip, /* i/o : work area for bit reversal */ Word32 *a /* i/o : input/output data Q(q)*/ diff --git a/lib_com/ivas_mdct_imdct_fx.c b/lib_com/ivas_mdct_imdct_fx.c index 304ed9fcc..6e910289d 100644 --- a/lib_com/ivas_mdct_imdct_fx.c +++ b/lib_com/ivas_mdct_imdct_fx.c @@ -54,7 +54,6 @@ #define IVAS_ONE_BY_IMDCT_SCALING_GAIN_Q16 0x08432A51 /* 1 / 2115.165304808f */ -#ifdef HARMONIZE_DoRTFTn /*------------------------------------------------------------------------------------------* * Local functions prototypes @@ -62,7 +61,6 @@ static void ivas_get_twid_factors_fx( const Word16 length, const Word16 **pTwid_re, const Word16 **pTwid_im ); -#endif /*-----------------------------------------------------------------------------------------* * Function ivas_tda_fx() @@ -162,11 +160,7 @@ void ivas_mdct_fx( len_by_2 = shr( length, 1 ); ivas_mdct_scaling_gain = ivas_get_mdct_scaling_gain_fx( len_by_2 ); // Q46 -#ifdef HARMONIZE_DoRTFTn ivas_get_twid_factors_fx( length, &pTwid_re, &pTwid_im ); -#else - ivas_get_twid_factors_fx1( length, &pTwid_re, &pTwid_im ); -#endif FOR( i = 0; i < len_by_2; i++ ) { @@ -311,11 +305,7 @@ void ivas_imdct_fx( Word32 im[IVAS_480_PT_LEN]; len_by_2 = shr( length, 1 ); -#ifdef HARMONIZE_DoRTFTn ivas_get_twid_factors_fx( length, &pTwid_re, &pTwid_im ); -#else - ivas_get_twid_factors_fx1( length, &pTwid_re, &pTwid_im ); -#endif FOR( i = 0; i < len_by_2; i++ ) { re[i] = L_add( Mpy_32_16_1( pIn[length - 2 * i - 1], pTwid_re[i] ), Mpy_32_16_1( pIn[2 * i], pTwid_im[i] ) ); /*stl_arr_index Q24*/ @@ -372,11 +362,7 @@ void ivas_imdct_fx( * Sets/Maps the fft twiddle tables based on fft length *-----------------------------------------------------------------------------------------*/ -#ifdef HARMONIZE_DoRTFTn static void ivas_get_twid_factors_fx( -#else -void ivas_get_twid_factors_fx1( -#endif const Word16 length, // Q0 const Word16 **pTwid_re, // Q15 const Word16 **pTwid_im ) // Q15 @@ -396,13 +382,6 @@ void ivas_get_twid_factors_fx1( *pTwid_re = (const Word16 *) &ivas_cos_twiddle_160_fx[0]; // Q15 *pTwid_im = (const Word16 *) &ivas_sin_twiddle_160_fx[0]; // Q15 } -#ifndef HARMONIZE_DoRTFTn - ELSE IF( EQ_16( length, 80 ) ) - { - *pTwid_re = (const Word16 *) &ivas_cos_twiddle_80_fx[0]; // Q15 - *pTwid_im = (const Word16 *) &ivas_sin_twiddle_80_fx[0]; // Q15 - } -#endif ELSE { assert( !"Not supported FFT length!" ); diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 1b2848c13..910e872b2 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -216,14 +216,6 @@ void ivas_dct_windowing_fx( Word32 *pTemp_lfe ); -#ifndef HARMONIZE_DoRTFTn -void ivas_get_twid_factors_fx1( - const Word16 length, // Q0 - const Word16 **pTwid_re, // Q15 - const Word16 **pTwid_im -); - -#endif Word32 ivas_get_mdct_scaling_gain_fx( const Word16 dct_len_by_2 ); diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index 038dc6341..90de10fd0 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -504,10 +504,6 @@ extern const Word16 ivas_sin_twiddle_320_fx[IVAS_320_PT_LEN >> 1]; extern const Word16 ivas_cos_twiddle_320_fx[IVAS_320_PT_LEN >> 1]; extern const Word16 ivas_sin_twiddle_160_fx[IVAS_160_PT_LEN >> 1]; extern const Word16 ivas_cos_twiddle_160_fx[IVAS_160_PT_LEN >> 1]; -#ifndef HARMONIZE_DoRTFTn -extern const Word16 ivas_sin_twiddle_80_fx[IVAS_80_PT_LEN >> 1]; -extern const Word16 ivas_cos_twiddle_80_fx[IVAS_80_PT_LEN >> 1]; -#endif extern const Word16 nf_tw_smoothing_coeffs_fx[N_LTP_GAIN_MEMS]; extern const Word32 dft_res_gains_q_fx[][2]; extern const Word16 dft_res_cod_alpha_fx[STEREO_DFT_BAND_MAX]; diff --git a/lib_com/ivas_rom_com_fx.c b/lib_com/ivas_rom_com_fx.c index e28706f1c..f8ef32ed0 100644 --- a/lib_com/ivas_rom_com_fx.c +++ b/lib_com/ivas_rom_com_fx.c @@ -3045,23 +3045,6 @@ const Word16 ivas_cos_twiddle_160_fx[ IVAS_160_PT_LEN >> 1 ] = { SHC( 0x13b6 ), SHC( 0x1139 ), SHC( 0x0ebb ), SHC( 0x0c3b ), SHC( 0x09ba ), SHC( 0x0738 ), SHC( 0x04b6 ), SHC( 0x0232 ), }; -#ifndef HARMONIZE_DoRTFTn -const Word16 ivas_sin_twiddle_80_fx[ IVAS_80_PT_LEN >> 1 ] = { - SHC( 0xff60 ), SHC( 0xfa59 ), SHC( 0xf555 ), SHC( 0xf055 ), SHC( 0xeb5c ), SHC( 0xe66a ), SHC( 0xe183 ), SHC( 0xdca7 ), - SHC( 0xd7da ), SHC( 0xd31c ), SHC( 0xce70 ), SHC( 0xc9d8 ), SHC( 0xc555 ), SHC( 0xc0e9 ), SHC( 0xbc96 ), SHC( 0xb85e ), - SHC( 0xb442 ), SHC( 0xb044 ), SHC( 0xac65 ), SHC( 0xa8a8 ), SHC( 0xa50d ), SHC( 0xa195 ), SHC( 0x9e43 ), SHC( 0x9b18 ), - SHC( 0x9814 ), SHC( 0x953a ), SHC( 0x9289 ), SHC( 0x9004 ), SHC( 0x8dab ), SHC( 0x8b7f ), SHC( 0x8982 ), SHC( 0x87b3 ), - SHC( 0x8613 ), SHC( 0x84a3 ), SHC( 0x8365 ), SHC( 0x8257 ), SHC( 0x817b ), SHC( 0x80d1 ), SHC( 0x8059 ), SHC( 0x8014 ), -}; - -const Word16 ivas_cos_twiddle_80_fx[ IVAS_80_PT_LEN >> 1 ] = { - SHC( 0x7fff ), SHC( 0x7fe0 ), SHC( 0x7f8d ), SHC( 0x7f09 ), SHC( 0x7e53 ), SHC( 0x7d6a ), SHC( 0x7c50 ), SHC( 0x7b05 ), - SHC( 0x798a ), SHC( 0x77de ), SHC( 0x7603 ), SHC( 0x73fa ), SHC( 0x71c3 ), SHC( 0x6f5f ), SHC( 0x6cce ), SHC( 0x6a13 ), - SHC( 0x672f ), SHC( 0x6421 ), SHC( 0x60ec ), SHC( 0x5d90 ), SHC( 0x5a10 ), SHC( 0x566c ), SHC( 0x52a6 ), SHC( 0x4ebf ), - SHC( 0x4aba ), SHC( 0x4696 ), SHC( 0x4257 ), SHC( 0x3dfe ), SHC( 0x398c ), SHC( 0x3504 ), SHC( 0x3067 ), SHC( 0x2bb6 ), - SHC( 0x26f4 ), SHC( 0x2223 ), SHC( 0x1d45 ), SHC( 0x185a ), SHC( 0x1367 ), SHC( 0x0e6b ), SHC( 0x096a ), SHC( 0x0465 ), -}; -#endif const Word16 nf_tw_smoothing_coeffs_fx[N_LTP_GAIN_MEMS] = { 13107, 6553, 6553, 6553 diff --git a/lib_com/options.h b/lib_com/options.h index 6805502d2..38e2cd056 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -114,7 +114,6 @@ #define FIX_2500_RENDCONF_REFACTOR /* Eri: Basop issue #2500: Renderer configuration range check before conversion to fixed point. Harmonize between BASOP/float */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION /* Eri: Basop issue 2023: Distance attenuation scaling, adding clamping of distance att input and listener position */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION_BUGFIX /* Eri: Bug discovered in cleanup of basop issue 2023 */ -#define HARMONIZE_DoRTFTn /* VA: harmonize functions DoRTFTn_fx() and DoRTFTn_fx_ivas() */ #define FIX_1574_EFAP_CODE_LINT /* FhG: float issue 1574: Code quality fixes in ivas_efap.c */ #define FIX_BASOP_2529_MASA_RATIO_SCALINGS /* Nokia: BASOP issue 2529: Fix MASA ratio scalings and verifications */ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 7edb70be4..7d541d076 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -3949,13 +3949,11 @@ void fft16( Word32 *re, Word32 *im, Word16 s, Word16 bScale ); void BASOP_cfft( cmplx *pComplexBuf, Word16 sizeOfFft, Word16 *scale, Word32 workBuffer[2 * BASOP_CFFT_MAX_LENGTH] ); void BASOP_rfft( Word32 *x, Word16 sizeOfFft, Word16 *scale, Word16 isign ); -#ifdef HARMONIZE_DoRTFTn void bitrv2_SR_fx( Word16 n, /* i : data length of real and imag Q0 */ const Word16 *ip, /* i/o: work area for bit reversal Q0 */ Word32 *a /* i/o: input/output data Qx */ ); -#endif void DoRTFTn_fx( Word32 *x, /* i/o : real part of i and output data */ @@ -3964,48 +3962,6 @@ void DoRTFTn_fx( const Word16 n /* i : size of the FFT up to 1024 */ ); -#ifndef HARMONIZE_DoRTFTn -void DoRTFT480_fx( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y /* i/o: imaginary part of input and output data */ -); - -void DoRTFT320_fx( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y /* i/o: imaginary part of input and output data */ -); - -void DoRTFT160_fx( - Word32 x[], /* i/o: real part of input and output data */ - Word32 y[] /* i/o: imaginary part of input and output data */ -); - -void DoRTFT128_fx( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y /* i/o: imaginary part of input and output data */ -); - -void DoRTFT120_fx( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y /* i/o: imaginary part of input and output data */ -); - -void DoRTFT80_fx( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y /* i/o: imaginary part of input and output data */ -); - -void DoRTFT40_fx( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y /* i/o: imaginary part of input and output data */ -); - -void DoRTFT20_fx( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y /* i/o: imaginary part of input and output data */ -); - -#endif Word16 RFFTN_fx( Word32 *data, const Word16 *sine_table, @@ -4029,13 +3985,6 @@ void rfft_fx( const Word16 isign /* i : sign */ ); -#ifndef HARMONIZE_DoRTFTn -void DoRTFTn_fx_ivas( - Word32 *x, /* i/o: real part of input and output data */ - Word32 *y, /* i/o: imaginary part of input and output data */ - const Word16 n /* i : size of the FFT up to 1024 */ -); -#endif Word16 find_guarded_bits_fx( const Word32 n ); Word16 L_norm_arr( const Word32 *arr, Word16 size ); diff --git a/lib_com/rom_com.h b/lib_com/rom_com.h index de0c26a5a..4327464ad 100644 --- a/lib_com/rom_com.h +++ b/lib_com/rom_com.h @@ -1065,9 +1065,6 @@ extern const Word16 Ip_fft128[10]; // Q0 extern const Word32 w_fft128_16fx[64]; // Q30 extern const Word16 Ip_fft256[10]; // Q0 extern const Word16 Ip_fft512[18]; // Q0 -#ifndef HARMONIZE_DoRTFTn -extern const Word16 w_fft512_fx_evs[256]; // Q14 -#endif extern const Word16 Idx_dortft40[40]; // Q0 extern const Word16 Odx_fft8_5[8]; // Q0 extern const Word16 ip_edct2_64[6]; // Q0 diff --git a/lib_com/rom_com_fx.c b/lib_com/rom_com_fx.c index cec1be1ce..d2f077a3e 100644 --- a/lib_com/rom_com_fx.c +++ b/lib_com/rom_com_fx.c @@ -18379,11 +18379,7 @@ const Word16 Ip_fft256[10] = {128, 1, 0, 256, 128, 384, 64, 320,192, 448}; // const Word16 Ip_fft512[18] = {256, 1, 0, 512, 256, 768, 128, 640,384, 896, 64, 576, 320, 832, 192, 704,448, 960}; // Q0 -#ifdef HARMONIZE_DoRTFTn const Word16 w_fft512_fx[256] =//Q14 -#else -const Word16 w_fft512_fx_evs[256] =//Q14 -#endif { 16384, 0, 11585, 11585, 15137, 6270, 6270, 15137, 16069, 3196, 9102, 13623, 13623, 9102, 3196, 16069, @@ -30880,268 +30876,6 @@ const Word16 w_fft256_fx[128] = { SHC( 0x7ff6 ), }; -#ifndef HARMONIZE_DoRTFTn -const Word16 w_fft512_fx[256] = { - // Q15 - SHC( 0x7fff ), - SHC( 0x0000 ), - SHC( 0x5a82 ), - SHC( 0x5a82 ), - SHC( 0x7641 ), - SHC( 0x30fb ), - SHC( 0x30fb ), - SHC( 0x7641 ), - SHC( 0x7d8a ), - SHC( 0x18f8 ), - SHC( 0x471c ), - SHC( 0x6a6d ), - SHC( 0x6a6d ), - SHC( 0x471c ), - SHC( 0x18f8 ), - SHC( 0x7d8a ), - SHC( 0x7f62 ), - SHC( 0x0c8b ), - SHC( 0x5133 ), - SHC( 0x62f2 ), - SHC( 0x70e2 ), - SHC( 0x3c56 ), - SHC( 0x2528 ), - SHC( 0x7a7d ), - SHC( 0x7a7d ), - SHC( 0x2528 ), - SHC( 0x3c56 ), - SHC( 0x70e2 ), - SHC( 0x62f2 ), - SHC( 0x5133 ), - SHC( 0x0c8b ), - SHC( 0x7f62 ), - SHC( 0x7fd8 ), - SHC( 0x0647 ), - SHC( 0x55f5 ), - SHC( 0x5ed7 ), - SHC( 0x73b5 ), - SHC( 0x36ba ), - SHC( 0x2b1f ), - SHC( 0x7884 ), - SHC( 0x7c29 ), - SHC( 0x1f19 ), - SHC( 0x41ce ), - SHC( 0x6dca ), - SHC( 0x66cf ), - SHC( 0x4c3f ), - SHC( 0x12c8 ), - SHC( 0x7e9d ), - SHC( 0x7e9d ), - SHC( 0x12c8 ), - SHC( 0x4c3f ), - SHC( 0x66cf ), - SHC( 0x6dca ), - SHC( 0x41ce ), - SHC( 0x1f19 ), - SHC( 0x7c29 ), - SHC( 0x7884 ), - SHC( 0x2b1f ), - SHC( 0x36ba ), - SHC( 0x73b5 ), - SHC( 0x5ed7 ), - SHC( 0x55f5 ), - SHC( 0x0647 ), - SHC( 0x7fd8 ), - SHC( 0x7ff6 ), - SHC( 0x0324 ), - SHC( 0x5842 ), - SHC( 0x5cb4 ), - SHC( 0x7504 ), - SHC( 0x33de ), - SHC( 0x2e11 ), - SHC( 0x776c ), - SHC( 0x7ce3 ), - SHC( 0x1c0b ), - SHC( 0x447a ), - SHC( 0x6c24 ), - SHC( 0x68a6 ), - SHC( 0x49b4 ), - SHC( 0x15e2 ), - SHC( 0x7e1d ), - SHC( 0x7f09 ), - SHC( 0x0fab ), - SHC( 0x4ebf ), - SHC( 0x64e8 ), - SHC( 0x6f5f ), - SHC( 0x3f17 ), - SHC( 0x2223 ), - SHC( 0x7b5d ), - SHC( 0x798a ), - SHC( 0x2826 ), - SHC( 0x398c ), - SHC( 0x7255 ), - SHC( 0x60ec ), - SHC( 0x539b ), - SHC( 0x096a ), - SHC( 0x7fa7 ), - SHC( 0x7fa7 ), - SHC( 0x096a ), - SHC( 0x539b ), - SHC( 0x60ec ), - SHC( 0x7255 ), - SHC( 0x398c ), - SHC( 0x2826 ), - SHC( 0x798a ), - SHC( 0x7b5d ), - SHC( 0x2223 ), - SHC( 0x3f17 ), - SHC( 0x6f5f ), - SHC( 0x64e8 ), - SHC( 0x4ebf ), - SHC( 0x0fab ), - SHC( 0x7f09 ), - SHC( 0x7e1d ), - SHC( 0x15e2 ), - SHC( 0x49b4 ), - SHC( 0x68a6 ), - SHC( 0x6c24 ), - SHC( 0x447a ), - SHC( 0x1c0b ), - SHC( 0x7ce3 ), - SHC( 0x776c ), - SHC( 0x2e11 ), - SHC( 0x33de ), - SHC( 0x7504 ), - SHC( 0x5cb4 ), - SHC( 0x5842 ), - SHC( 0x0324 ), - SHC( 0x7ff6 ), - SHC( 0x7ffd ), - SHC( 0x0192 ), - SHC( 0x5964 ), - SHC( 0x5b9d ), - SHC( 0x75a5 ), - SHC( 0x326e ), - SHC( 0x2f87 ), - SHC( 0x76d9 ), - SHC( 0x7d39 ), - SHC( 0x1a82 ), - SHC( 0x45cd ), - SHC( 0x6b4a ), - SHC( 0x698c ), - SHC( 0x4869 ), - SHC( 0x176d ), - SHC( 0x7dd6 ), - SHC( 0x7f38 ), - SHC( 0x0e1b ), - SHC( 0x4ffb ), - SHC( 0x63ef ), - SHC( 0x7023 ), - SHC( 0x3db8 ), - SHC( 0x23a6 ), - SHC( 0x7aef ), - SHC( 0x7a05 ), - SHC( 0x26a8 ), - SHC( 0x3af2 ), - SHC( 0x719e ), - SHC( 0x61f1 ), - SHC( 0x5269 ), - SHC( 0x0afb ), - SHC( 0x7f87 ), - SHC( 0x7fc2 ), - SHC( 0x07d9 ), - SHC( 0x54ca ), - SHC( 0x5fe3 ), - SHC( 0x7307 ), - SHC( 0x3824 ), - SHC( 0x29a3 ), - SHC( 0x7909 ), - SHC( 0x7bc5 ), - SHC( 0x209f ), - SHC( 0x4073 ), - SHC( 0x6e96 ), - SHC( 0x65dd ), - SHC( 0x4d81 ), - SHC( 0x1139 ), - SHC( 0x7ed5 ), - SHC( 0x7e5f ), - SHC( 0x1455 ), - SHC( 0x4afb ), - SHC( 0x67bd ), - SHC( 0x6cf9 ), - SHC( 0x4325 ), - SHC( 0x1d93 ), - SHC( 0x7c89 ), - SHC( 0x77fa ), - SHC( 0x2c98 ), - SHC( 0x354d ), - SHC( 0x745f ), - SHC( 0x5dc7 ), - SHC( 0x571d ), - SHC( 0x04b6 ), - SHC( 0x7fe9 ), - SHC( 0x7fe9 ), - SHC( 0x04b6 ), - SHC( 0x571d ), - SHC( 0x5dc7 ), - SHC( 0x745f ), - SHC( 0x354d ), - SHC( 0x2c98 ), - SHC( 0x77fa ), - SHC( 0x7c89 ), - SHC( 0x1d93 ), - SHC( 0x4325 ), - SHC( 0x6cf9 ), - SHC( 0x67bd ), - SHC( 0x4afb ), - SHC( 0x1455 ), - SHC( 0x7e5f ), - SHC( 0x7ed5 ), - SHC( 0x1139 ), - SHC( 0x4d81 ), - SHC( 0x65dd ), - SHC( 0x6e96 ), - SHC( 0x4073 ), - SHC( 0x209f ), - SHC( 0x7bc5 ), - SHC( 0x7909 ), - SHC( 0x29a3 ), - SHC( 0x3824 ), - SHC( 0x7307 ), - SHC( 0x5fe3 ), - SHC( 0x54ca ), - SHC( 0x07d9 ), - SHC( 0x7fc2 ), - SHC( 0x7f87 ), - SHC( 0x0afb ), - SHC( 0x5269 ), - SHC( 0x61f1 ), - SHC( 0x719e ), - SHC( 0x3af2 ), - SHC( 0x26a8 ), - SHC( 0x7a05 ), - SHC( 0x7aef ), - SHC( 0x23a6 ), - SHC( 0x3db8 ), - SHC( 0x7023 ), - SHC( 0x63ef ), - SHC( 0x4ffb ), - SHC( 0x0e1b ), - SHC( 0x7f38 ), - SHC( 0x7dd6 ), - SHC( 0x176d ), - SHC( 0x4869 ), - SHC( 0x698c ), - SHC( 0x6b4a ), - SHC( 0x45cd ), - SHC( 0x1a82 ), - SHC( 0x7d39 ), - SHC( 0x76d9 ), - SHC( 0x2f87 ), - SHC( 0x326e ), - SHC( 0x75a5 ), - SHC( 0x5b9d ), - SHC( 0x5964 ), - SHC( 0x0192 ), - SHC( 0x7ffd ), - -}; -#endif const Word16 FFT_RotVector_960_fx[1860] = { // Q15 SHC( 0x7fff ), diff --git a/lib_rend/ivas_reverb_fft_filter_fx.c b/lib_rend/ivas_reverb_fft_filter_fx.c index c8bd561dd..6cf1278fa 100644 --- a/lib_rend/ivas_reverb_fft_filter_fx.c +++ b/lib_rend/ivas_reverb_fft_filter_fx.c @@ -100,11 +100,7 @@ static void fft_wrapper_2ch_fx( Word16 k, mirror_k; Word32 left_re_fx, left_im_fx, right_re_fx, right_im_fx; -#ifdef HARMONIZE_DoRTFTn DoRTFTn_fx( buffer_L_fx, buffer_R_fx, NULL, fft_size ); -#else - DoRTFTn_fx_ivas( buffer_L_fx, buffer_R_fx, fft_size ); -#endif /* separating left and right channel spectra */ buffer_L_fx[0] = L_shl( buffer_L_fx[0], 1 ); // Qx + 1 @@ -172,11 +168,7 @@ static void ifft_wrapper_2ch_fx( move32(); } -#ifdef HARMONIZE_DoRTFTn DoRTFTn_fx( buffer_L, buffer_R, NULL, fft_size ); -#else - DoRTFTn_fx_ivas( buffer_L, buffer_R, fft_size ); -#endif return; } diff --git a/lib_rend/ivas_reverb_filter_design_fx.c b/lib_rend/ivas_reverb_filter_design_fx.c index c783d3e78..a6ffc84f8 100644 --- a/lib_rend/ivas_reverb_filter_design_fx.c +++ b/lib_rend/ivas_reverb_filter_design_fx.c @@ -206,11 +206,7 @@ static void calc_min_phase_fx( /* Convert back and isolate the phase. */ IF( LE_16( fft_size, 512 ) ) /* for size <= 512 using complex-value FFT (more effecient, but available only up to 512 size) */ { -#ifdef HARMONIZE_DoRTFTn DoRTFTn_fx( pFolded_cepstrum_re, pFolded_cepstrum_im, NULL, fft_size ); -#else - DoRTFTn_fx_ivas( pFolded_cepstrum_re, pFolded_cepstrum_im, fft_size ); -#endif /* Copying the img part into the output */ FOR( idx = 1; idx < half_fft_size; idx++ ) -- GitLab From 3805ff49604729a1d86d3101ab81132a6dc39716 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:33:41 +0200 Subject: [PATCH 22/31] [cleanup] accept FIX_1574_EFAP_CODE_LINT --- lib_com/options.h | 1 - lib_rend/ivas_allrad_dec_fx.c | 2 - lib_rend/ivas_efap_fx.c | 78 ----------------------------------- 3 files changed, 81 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 38e2cd056..5a5aa7308 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -114,7 +114,6 @@ #define FIX_2500_RENDCONF_REFACTOR /* Eri: Basop issue #2500: Renderer configuration range check before conversion to fixed point. Harmonize between BASOP/float */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION /* Eri: Basop issue 2023: Distance attenuation scaling, adding clamping of distance att input and listener position */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION_BUGFIX /* Eri: Bug discovered in cleanup of basop issue 2023 */ -#define FIX_1574_EFAP_CODE_LINT /* FhG: float issue 1574: Code quality fixes in ivas_efap.c */ #define FIX_BASOP_2529_MASA_RATIO_SCALINGS /* Nokia: BASOP issue 2529: Fix MASA ratio scalings and verifications */ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ #define FIX_BASOP_2531_MCT_CP_BITRATE /* FhG: BASOP issue 2531: Fix MCT cp_bitrate calculation; affects bitrate switching only */ diff --git a/lib_rend/ivas_allrad_dec_fx.c b/lib_rend/ivas_allrad_dec_fx.c index 18793c211..56b9bd7e9 100644 --- a/lib_rend/ivas_allrad_dec_fx.c +++ b/lib_rend/ivas_allrad_dec_fx.c @@ -118,10 +118,8 @@ ivas_error ivas_sba_get_hoa_dec_matrix_fx( { /* init EFIP */ -#ifdef FIX_1574_EFAP_CODE_LINT /* ensure the handle is NULL before passing, otherwise efap_init_data will think this is allocated memory and return an error */ hEFAP = NULL; -#endif IF( NE_16( ( error = efap_init_data_fx( &( hEFAP ), hOutSetup.ls_azimuth_fx, hOutSetup.ls_elevation_fx, num_spk, EFAP_MODE_EFIP ) ), IVAS_ERR_OK ) ) { diff --git a/lib_rend/ivas_efap_fx.c b/lib_rend/ivas_efap_fx.c index 7b7a5244f..9547c70cf 100644 --- a/lib_rend/ivas_efap_fx.c +++ b/lib_rend/ivas_efap_fx.c @@ -37,9 +37,6 @@ #include "prot_fx.h" #include "ivas_prot_rend_fx.h" #include "ivas_rom_rend.h" -#ifndef FIX_1574_EFAP_CODE_LINT -#include "ivas_stat_dec.h" -#endif #include "wmc_auto.h" #include "ivas_prot_fx.h" @@ -62,9 +59,7 @@ #define Q22_180_DEG 754974720 #define Q22_360_DEG 1509949440 #define Q22_120_DEG 503316480 -#ifdef FIX_1574_EFAP_CODE_LINT #define MAX_AZI_GAP 13421773 /* (1.f / 160.0f) in Q31 */ -#endif #define Q22_240_DEG 1006632960 /*-----------------------------------------------------------------------* @@ -91,11 +86,7 @@ static Word32 get_tri_gain_fx( const Word32 A[2] /*q22*/, const Word32 B[2] /*q2 * EFAP Utils *-----------------------------------------------------------------------*/ -#ifdef FIX_1574_EFAP_CODE_LINT static void add_vertex_fx( EFAP_VERTEX *vtxArray, const Word32 azi /*q22*/, const Word32 ele /*q22*/, const Word16 pos, const EFAP_VTX_DMX_TYPE dmxType ); -#else -static void add_vertex_fx( EFAP_VERTEX *vtxArray, const Word32 azi /*q22*/, const Word32 ele /*q22*/, const Word16 pos, const EFAP_VTX_DMX_TYPE ); -#endif static void efap_sort_s_fx( Word16 *x, Word16 *idx, const Word16 len ); static Word32 vertex_distance_fx( const EFAP_VERTEX *vtxArray, const EFAP_LS_TRIANGLE tri, const Word16 vtxIdx ); @@ -108,11 +99,7 @@ static Word16 get_neighbours_fx( const EFAP_LS_TRIANGLE *triArray, const Word16 static void matrix_times_row_fx( Word32 mat[EFAP_MAX_SIZE_TMP_BUFF][EFAP_MAX_SIZE_TMP_BUFF] /*q31*/, const Word32 *vec /*q31*/, const Word16 L, Word32 *out /*q31*/ ); static void tri_to_poly_fx( const EFAP_VERTEX *vtxArray, const EFAP_LS_TRIANGLE *triArray, const Word16 numVtx, const Word16 numTri, Word16 sortedChan[EFAP_MAX_POLY_SET][EFAP_MAX_CHAN_NUM], Word16 *outLengthPS, Word16 outLengthSorted[EFAP_MAX_POLY_SET] ); -#ifdef FIX_1574_EFAP_CODE_LINT static Word16 compare_poly_fx( Word16 *old_poly, Word16 lenOld, Word16 *new_poly, Word16 lenNew ); -#else -static Word16 compare_poly_fx( Word16 *old, Word16 lenOld, Word16 *new, Word16 lenNew ); -#endif static void sort_channels_vertex_fx( const EFAP_VERTEX *vtxArray, const EFAP_LS_TRIANGLE *triArray, Word16 channels[EFAP_MAX_CHAN_NUM], const Word16 lengthChannels, Word16 idxTri ); static Word32 efap_32mod32( const Word32 x /*q22*/, const Word32 y /*q22*/ ); @@ -149,7 +136,6 @@ ivas_error efap_init_data_fx( move32(); /* Basic init checks */ -#ifdef FIX_1574_EFAP_CODE_LINT IF( hEFAPdata == NULL ) { return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "pointer to EFAP handle is NULL" ); @@ -158,13 +144,9 @@ ivas_error efap_init_data_fx( { return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "EFAP handle must be NULL before initialization" ); } -#endif test(); IF( !speaker_node_azi_deg || !speaker_node_ele_deg ) { -#ifndef FIX_1574_EFAP_CODE_LINT - hEFAPdata = NULL; -#endif return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "EFAP requires arrays of speaker azimuths and elevations" ); } @@ -206,21 +188,13 @@ ivas_error efap_init_data_fx( /* Memory allocation for the polyset array */ IF( ( efap->polyData.polysetArray = (EFAP_POLYSET *) malloc( polyset_size * sizeof( EFAP_POLYSET ) ) ) == NULL ) { -#ifdef FIX_1574_EFAP_CODE_LINT return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP polygon array\n" ) ); -#else - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP bufferS\n" ) ); -#endif } /* Memory allocation for the triangle array */ IF( ( efap->polyData.triArray = (EFAP_LS_TRIANGLE *) malloc( polyset_size * sizeof( EFAP_LS_TRIANGLE ) ) ) == NULL ) { -#ifdef FIX_1574_EFAP_CODE_LINT return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP triangle array\n" ) ); -#else - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP bufferS\n" ) ); -#endif } /*-----------------------------------------------------------------* @@ -387,18 +361,10 @@ void efap_free_data_fx( ( *hEFAPdata )->vtxData.vtxOrder = NULL; free( ( *hEFAPdata )->polyData.polysetArray ); -#ifdef FIX_1574_EFAP_CODE_LINT ( *hEFAPdata )->polyData.polysetArray = NULL; -#else - ( *hEFAPdata )->vtxData.vtxOrder = NULL; -#endif free( ( *hEFAPdata )->polyData.triArray ); -#ifdef FIX_1574_EFAP_CODE_LINT ( *hEFAPdata )->polyData.triArray = NULL; -#else - ( *hEFAPdata )->vtxData.vtxOrder = NULL; -#endif free( ( *hEFAPdata )->bufferLong_fx ); ( *hEFAPdata )->bufferLong_fx = NULL; @@ -675,17 +641,11 @@ static void initial_polyeder_fx( } /* 2. attempt to create a triangle with nonzero area */ -#ifndef FIX_1574_EFAP_CODE_LINT - tmp = 0; - move32(); -#endif v_sub_fx( vtxData->vertexArray[tetrahedron[1]].pos, vtxData->vertexArray[tetrahedron[0]].pos, tmp1, 3, 1 ); // tmp1 Q(31-1) WHILE( LT_16( tetrahedron[2], numVtx ) ) { -#ifdef FIX_1574_EFAP_CODE_LINT tmp = 0; move32(); -#endif v_sub_fx( vtxData->vertexArray[tetrahedron[2]].pos, vtxData->vertexArray[tetrahedron[0]].pos, tmp2, 3, 1 ); // tmp2 Q(31-1) efap_crossp_fx( tmp1, tmp2, tmpCross ); // tmpCross Q29 FOR( i = 0; i < 3; i++ ) @@ -797,9 +757,6 @@ static void add_ghost_speakers_fx( Word16 lengthHorGhst; /* Nb of Horizontal Ghost */ Word16 i, j, k, a; /* Integer for loops */ Word16 num_new; /* Number of new vertices to add */ -#ifndef FIX_1574_EFAP_CODE_LINT - Word32 maxAngle; /* Max azimuth tolerance for extend the LS setup horizontaly */ -#endif Word32 newDiff; /* Angle differences that will help us set the extended LS setup */ Word32 newAzi; /* New azimuth for the new horizontal LS */ Word32 ele[EFAP_MAX_SIZE_TMP_BUFF]; @@ -814,10 +771,6 @@ static void add_ghost_speakers_fx( move32(); numVertex = *numVtx; move16(); -#ifndef FIX_1574_EFAP_CODE_LINT - maxAngle = 13421773; //(1.f / 160.0f) in Q31 - move32(); -#endif /* Extracting Azi and Ele for computation purposes */ FOR( i = 0; i < numVertex; ++i ) @@ -908,11 +861,7 @@ static void add_ghost_speakers_fx( a = add( a, 2 ); lengthHorGhst = add( lengthHorGhst, 2 ); } -#ifdef FIX_1574_EFAP_CODE_LINT ELSE /* fill gaps greater than MAX_AZI_GAP */ -#else - ELSE /* fill gaps greater than maxAngle */ -#endif { /* Here, k correspond to the number of LS whose ele is < 45 deg, should be = numVertex */ sort_l( tmpAzi, k ); // tmpAzi q22 @@ -922,11 +871,7 @@ static void add_ghost_speakers_fx( { tmpAngleDiff[i] = L_sub( tmpAzi[i + 1], tmpAzi[i] ); // q22 move32(); -#ifdef FIX_1574_EFAP_CODE_LINT sectors[i] = ceil_fx( Mpy_32_32( tmpAngleDiff[i], MAX_AZI_GAP ), Q22 ); // q22 -#else - sectors[i] = ceil_fx( Mpy_32_32( tmpAngleDiff[i], maxAngle ), Q22 ); // q22 -#endif move32(); if ( GT_32( sectors[i], Q22_1 /*1 q22*/ ) ) @@ -936,11 +881,7 @@ static void add_ghost_speakers_fx( } tmpAngleDiff[k - 1] = L_sub( L_add( tmpAzi[0], Q22_360_DEG /*360 q22*/ ), tmpAzi[k - 1] ); // q22 -#ifdef FIX_1574_EFAP_CODE_LINT sectors[k - 1] = ceil_fx( Mpy_32_32( tmpAngleDiff[k - 1], MAX_AZI_GAP ), Q22 ); // q22 -#else - sectors[k - 1] = ceil_fx( Mpy_32_32( tmpAngleDiff[k - 1], maxAngle ), Q22 ); // q22 -#endif if ( GT_32( sectors[k - 1], Q22_1 /*1 q22*/ ) ) { @@ -1316,11 +1257,7 @@ static void remap_ghosts_fx( { IF( GT_16( triArray[i].LS[j], g ) ) { -#ifdef FIX_1574_EFAP_CODE_LINT triArray[i].LS[j] = sub( triArray[i].LS[j], 1 ); -#else - triArray[i].LS[j] = sub( g, 1 ); -#endif move16(); } } @@ -2222,11 +2159,7 @@ static void tri_to_poly_fx( /* Output */ *outLengthPS = lenPolySet; move16(); -#ifdef FIX_1574_EFAP_CODE_LINT Copy( sortedLengths, outLengthSorted, lenPolySet ); -#else - Copy( sortedLengths, outLengthSorted, EFAP_MAX_POLY_SET ); -#endif return; } @@ -2238,17 +2171,10 @@ static void tri_to_poly_fx( *-------------------------------------------------------------------------*/ static Word16 compare_poly_fx( -#ifdef FIX_1574_EFAP_CODE_LINT Word16 *old_poly, /* i : Existing polygon */ Word16 lenOld, /* i : Length of existing polygon */ Word16 *new_poly, /* i : New polygon */ Word16 lenNew /* i : Length of new polygon */ -#else - Word16 *old, /* i : Existing polygon */ - Word16 lenOld, /* i : Length of existing polygon */ - Word16 *new, /* i : New polygon */ - Word16 lenNew /* i : Length of new polygon */ -#endif ) { Word16 i, j; @@ -2261,11 +2187,7 @@ static Word16 compare_poly_fx( { FOR( j = count; j < lenNew; ++j ) { -#ifdef FIX_1574_EFAP_CODE_LINT IF( EQ_16( old_poly[i], new_poly[j] ) ) -#else - IF( EQ_16( old[i], new[j] ) ) -#endif { count = add( count, 1 ); BREAK; -- GitLab From 3fe68251ea6fc237756732719b17098d9a80a090 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:34:25 +0200 Subject: [PATCH 23/31] [cleanup] accept FIX_BASOP_2529_MASA_RATIO_SCALINGS --- lib_com/options.h | 1 - lib_enc/ivas_masa_enc_fx.c | 21 --------------------- lib_rend/lib_rend_fx.c | 36 ------------------------------------ lib_util/masa_file_reader.c | 22 ---------------------- 4 files changed, 80 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 5a5aa7308..44c459035 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -114,7 +114,6 @@ #define FIX_2500_RENDCONF_REFACTOR /* Eri: Basop issue #2500: Renderer configuration range check before conversion to fixed point. Harmonize between BASOP/float */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION /* Eri: Basop issue 2023: Distance attenuation scaling, adding clamping of distance att input and listener position */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION_BUGFIX /* Eri: Bug discovered in cleanup of basop issue 2023 */ -#define FIX_BASOP_2529_MASA_RATIO_SCALINGS /* Nokia: BASOP issue 2529: Fix MASA ratio scalings and verifications */ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ #define FIX_BASOP_2531_MCT_CP_BITRATE /* FhG: BASOP issue 2531: Fix MCT cp_bitrate calculation; affects bitrate switching only */ #define FIX_BASOP_2541_OMASA_ENC_FIXES /* Nokia: BASOP issue 2541: Fix function ivas_encode_masaism_metadata_fx */ diff --git a/lib_enc/ivas_masa_enc_fx.c b/lib_enc/ivas_masa_enc_fx.c index c3562678a..6f1a7d5d2 100644 --- a/lib_enc/ivas_masa_enc_fx.c +++ b/lib_enc/ivas_masa_enc_fx.c @@ -2303,17 +2303,9 @@ static void compensate_energy_ratios_fx( move32(); FOR( dir = 0; dir < numDirs; dir++ ) { -#ifdef FIX_BASOP_2529_MASA_RATIO_SCALINGS ratioSum = L_add( ratioSum, L_shr( hMeta->directional_meta[dir].energy_ratio_fx[sf][band], 1 ) ); // accumulate in Q29 -#else - ratioSum = L_add( ratioSum, hMeta->directional_meta[dir].energy_ratio_fx[sf][band] ); // Q30 -#endif } -#ifdef FIX_BASOP_2529_MASA_RATIO_SCALINGS ratioSum = L_add( ratioSum, L_shr( hMeta->common_meta.diffuse_to_total_ratio_fx[sf][band], 1 ) ); // accumulate in Q29 -#else - ratioSum = L_add( ratioSum, hMeta->common_meta.diffuse_to_total_ratio_fx[sf][band] ); // Q30 -#endif IF( ratioSum == 0 ) { @@ -2325,12 +2317,7 @@ static void compensate_energy_ratios_fx( hMeta->common_meta.diffuse_to_total_ratio_fx[sf][band] = ONE_IN_Q30; // Q30 move32(); } -#ifdef FIX_BASOP_2529_MASA_RATIO_SCALINGS ELSE IF( GT_32( L_abs( L_sub( ratioSum, ONE_IN_Q29 ) ), 1 ) ) // else if ( ratioSum != 1.0f ) from float with minor rounding tolerance -#else - // ELSE IF( NE_32( ratioSum, ONE_IN_Q30 ) ) - ELSE /* Removing the check against 1 works well!!! */ -#endif { Word16 exp_diff; FOR( dir = 0; dir < numDirs; dir++ ) @@ -2338,21 +2325,13 @@ static void compensate_energy_ratios_fx( hMeta->directional_meta[dir].energy_ratio_fx[sf][band] = BASOP_Util_Divide3232_Scale_newton( hMeta->directional_meta[dir].energy_ratio_fx[sf][band], ratioSum, &exp_diff ); move32(); -#ifdef FIX_BASOP_2529_MASA_RATIO_SCALINGS hMeta->directional_meta[dir].energy_ratio_fx[sf][band] = L_shl( hMeta->directional_meta[dir].energy_ratio_fx[sf][band], sub( exp_diff, Q2 ) ); // back to Q30 -#else - hMeta->directional_meta[dir].energy_ratio_fx[sf][band] = L_shl( hMeta->directional_meta[dir].energy_ratio_fx[sf][band], sub( exp_diff, Q1 ) ); // Q30 -#endif move32(); } hMeta->common_meta.diffuse_to_total_ratio_fx[sf][band] = BASOP_Util_Divide3232_Scale_newton( hMeta->common_meta.diffuse_to_total_ratio_fx[sf][band], ratioSum, &exp_diff ); move32(); -#ifdef FIX_BASOP_2529_MASA_RATIO_SCALINGS hMeta->common_meta.diffuse_to_total_ratio_fx[sf][band] = L_shl( hMeta->common_meta.diffuse_to_total_ratio_fx[sf][band], sub( exp_diff, Q2 ) ); // back to Q30 -#else - hMeta->common_meta.diffuse_to_total_ratio_fx[sf][band] = L_shl( hMeta->common_meta.diffuse_to_total_ratio_fx[sf][band], sub( exp_diff, Q1 ) ); // Q30 -#endif move32(); } } diff --git a/lib_rend/lib_rend_fx.c b/lib_rend/lib_rend_fx.c index e7fedb16a..1dd55712d 100644 --- a/lib_rend/lib_rend_fx.c +++ b/lib_rend/lib_rend_fx.c @@ -9073,11 +9073,7 @@ static void renderMasaToMasa( IVAS_REND_AudioBuffer outAudio ) { Word16 sf, band, dir, numDirs; -#ifdef FIX_BASOP_2529_MASA_RATIO_SCALINGS Word32 ratioSum_fx; /* Q29 for accumulation */ -#else - Word32 ratioSum_fx; /* Q30 */ -#endif MASA_DECODER_EXT_OUT_META_HANDLE outMeta; MASA_METADATA_FRAME *inMeta; Word32 tmpBuffer_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; @@ -9205,17 +9201,9 @@ static void renderMasaToMasa( move32(); FOR( dir = 0; dir < numDirs; dir++ ) { -#ifdef FIX_BASOP_2529_MASA_RATIO_SCALINGS ratioSum_fx = L_add( ratioSum_fx, L_shr( inMeta->directional_meta[dir].energy_ratio_fx[sf][band], 1 ) ); // accumulate in Q29 -#else - ratioSum_fx = L_add( ratioSum_fx, inMeta->directional_meta[dir].energy_ratio_fx[sf][band] ); -#endif } -#ifdef FIX_BASOP_2529_MASA_RATIO_SCALINGS ratioSum_fx = L_add( ratioSum_fx, L_shr( inMeta->common_meta.diffuse_to_total_ratio_fx[sf][band], 1 ) ); // accumulate in Q29 -#else - ratioSum_fx = L_add( ratioSum_fx, inMeta->common_meta.diffuse_to_total_ratio_fx[sf][band] ); -#endif IF( ratioSum_fx == 0 ) { @@ -9227,11 +9215,7 @@ static void renderMasaToMasa( inMeta->common_meta.diffuse_to_total_ratio_fx[sf][band] = ONE_IN_Q30; move32(); } -#ifdef FIX_BASOP_2529_MASA_RATIO_SCALINGS ELSE IF( GT_32( L_abs( L_sub( ratioSum_fx, ONE_IN_Q29 ) ), 1 ) ) // else if ( ratioSum != 1.0f ) from float with minor rounding tolerance -#else - ELSE IF( NE_32( ratioSum_fx, ONE_IN_Q30 ) ) -#endif { Word16 tmp_e = 0; move16(); @@ -9240,11 +9224,7 @@ static void renderMasaToMasa( FOR( dir = 0; dir < numDirs; dir++ ) { tmp = BASOP_Util_Divide3232_Scale_newton( inMeta->directional_meta[dir].energy_ratio_fx[sf][band], ratioSum_fx, &tmp_e ); -#ifdef FIX_BASOP_2529_MASA_RATIO_SCALINGS inMeta->directional_meta[dir].energy_ratio_fx[sf][band] = L_shl( tmp, sub( tmp_e, 2 ) ); /* Back to Q30 */ -#else - inMeta->directional_meta[dir].energy_ratio_fx[sf][band] = L_shl( tmp, sub( tmp_e, 1 ) ); /* Q30 */ -#endif move32(); } tmp_e = 0; @@ -9252,11 +9232,7 @@ static void renderMasaToMasa( tmp = 0; move32(); tmp = BASOP_Util_Divide3232_Scale_newton( inMeta->common_meta.diffuse_to_total_ratio_fx[sf][band], ratioSum_fx, &tmp_e ); -#ifdef FIX_BASOP_2529_MASA_RATIO_SCALINGS inMeta->common_meta.diffuse_to_total_ratio_fx[sf][band] = L_shl( tmp, sub( tmp_e, 2 ) ); /* Back to Q30 */ -#else - inMeta->common_meta.diffuse_to_total_ratio_fx[sf][band] = L_shl( tmp, sub( tmp_e, 1 ) ); /* Q30 */ -#endif move32(); } } @@ -9271,17 +9247,9 @@ static void renderMasaToMasa( FOR( dir = 0; dir < numDirs; dir++ ) { outMeta->directionIndex[dir][sf][band] = index_theta_phi_16_fx( &inMeta->directional_meta[dir].elevation_fx[sf][band], &inMeta->directional_meta[dir].azimuth_fx[sf][band], masaInput->hMasaPrerend->sph_grid16 ); -#ifdef FIX_BASOP_2529_MASA_RATIO_SCALINGS outMeta->directToTotalRatio[dir][sf][band] = (UWord8) W_extract_h( W_mult_32_16( inMeta->directional_meta[dir].energy_ratio_fx[sf][band], UINT8_MAX << 1 ) ); -#else - outMeta->directToTotalRatio[dir][sf][band] = (UWord8) L_shr( inMeta->directional_meta[dir].energy_ratio_fx[sf][band], Q22 ); -#endif outMeta->diffuseToTotalRatio[sf][band] = (UWord8) sub( outMeta->diffuseToTotalRatio[sf][band], outMeta->directToTotalRatio[dir][sf][band] ); -#ifdef FIX_BASOP_2529_MASA_RATIO_SCALINGS outMeta->spreadCoherence[dir][sf][band] = (UWord8) W_extract_h( W_mult_32_16( L_deposit_h( inMeta->directional_meta[dir].spread_coherence_fx[sf][band] ), UINT8_MAX << 1 ) ); -#else - outMeta->spreadCoherence[dir][sf][band] = (UWord8) shr( inMeta->directional_meta[dir].spread_coherence_fx[sf][band], Q7 ); -#endif move16(); move16(); @@ -9289,11 +9257,7 @@ static void renderMasaToMasa( move16(); } -#ifdef FIX_BASOP_2529_MASA_RATIO_SCALINGS outMeta->surroundCoherence[sf][band] = (UWord8) W_extract_h( W_mult_32_16( L_deposit_h( inMeta->common_meta.surround_coherence_fx[sf][band] ), UINT8_MAX << 1 ) ); -#else - outMeta->surroundCoherence[sf][band] = (UWord8) shr( inMeta->common_meta.surround_coherence_fx[sf][band], Q7 ); -#endif move16(); } } diff --git a/lib_util/masa_file_reader.c b/lib_util/masa_file_reader.c index b96e7fc98..610dfd4c4 100644 --- a/lib_util/masa_file_reader.c +++ b/lib_util/masa_file_reader.c @@ -194,11 +194,7 @@ ivas_error MasaFileReader_readNextFrame( for ( b = 0; b < MASA_FREQUENCY_BANDS; b++ ) { -#ifdef FIX_BASOP_2529_MASA_RATIO_SCALINGS hMeta->directional_meta[i].energy_ratio_fx[j][b] = (Word32) ( ( (int64_t) readOther[b] * ONE_IN_Q30 + 254 ) / 255 ); // Q30 -#else - hMeta->directional_meta[i].energy_ratio_fx[j][b] = (Word32) ( readOther[b] * ONE_IN_Q22 ); // Q30 -#endif } /* Spread coherence */ @@ -209,15 +205,11 @@ ivas_error MasaFileReader_readNextFrame( for ( b = 0; b < MASA_FREQUENCY_BANDS; b++ ) { -#ifdef FIX_BASOP_2529_MASA_RATIO_SCALINGS #ifdef FIX_BASOP_2545_FIX_LTV_REGRESSION_2529 int32_t tmp_coh = ( (int32_t) readOther[b] * ONE_IN_Q15 + 254 ) / 255; hMeta->directional_meta[i].spread_coherence_fx[j][b] = (Word16) ( tmp_coh > MAX_16 ? MAX_16 : tmp_coh ); // Q15, need to clamp #else hMeta->directional_meta[i].spread_coherence_fx[j][b] = (Word16) ( ( (int32_t) readOther[b] * ONE_IN_Q15 + 254 ) / 255 ); // Q15 -#endif -#else - hMeta->directional_meta[i].spread_coherence_fx[j][b] = (Word16) ( readOther[b] * ONE_IN_Q7 ); // Q15 #endif } } @@ -231,11 +223,7 @@ ivas_error MasaFileReader_readNextFrame( for ( b = 0; b < MASA_FREQUENCY_BANDS; b++ ) { -#ifdef FIX_BASOP_2529_MASA_RATIO_SCALINGS hMeta->common_meta.diffuse_to_total_ratio_fx[j][b] = (Word32) ( ( (int64_t) readOther[b] * ONE_IN_Q30 + 254 ) / 255 ); // Q30 -#else - hMeta->common_meta.diffuse_to_total_ratio_fx[j][b] = (Word32) ( readOther[b] * ONE_IN_Q22 ); // Q30 -#endif } /* Surround coherence */ @@ -246,16 +234,11 @@ ivas_error MasaFileReader_readNextFrame( for ( b = 0; b < MASA_FREQUENCY_BANDS; b++ ) { -#ifdef FIX_BASOP_2529_MASA_RATIO_SCALINGS #ifdef FIX_BASOP_2545_FIX_LTV_REGRESSION_2529 int32_t tmp_coh = ( (int32_t) readOther[b] * ONE_IN_Q15 + 254 ) / 255; hMeta->common_meta.surround_coherence_fx[j][b] = (Word16) ( tmp_coh > MAX_16 ? MAX_16 : tmp_coh ); // Q15, need to clamp #else hMeta->common_meta.surround_coherence_fx[j][b] = (Word16) ( ( (int32_t) readOther[b] * ONE_IN_Q15 + 254 ) / 255 ); // Q15 -#endif -#else - hMeta->common_meta.surround_coherence_fx[j][b] = shl( (Word16) readOther[b], 7 ); // Q8->Q15 - move16(); #endif } @@ -267,12 +250,7 @@ ivas_error MasaFileReader_readNextFrame( for ( b = 0; b < MASA_FREQUENCY_BANDS; b++ ) { -#ifdef FIX_BASOP_2529_MASA_RATIO_SCALINGS hMeta->common_meta.remainder_to_total_ratio_fx[j][b] = (Word32) ( ( (int64_t) readOther[b] * ONE_IN_Q30 + 254 ) / 255 ); // Q30 -#else - hMeta->common_meta.remainder_to_total_ratio_fx[j][b] = L_shl( (Word32) readOther[b], Q22 ); // Q8 -> Q30 - move32(); -#endif } } -- GitLab From 8dce4bc0bf49831da7e3f596a1afcf9e456d8472 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:35:19 +0200 Subject: [PATCH 24/31] [cleanup] accept FIX_BASOP_2531_MCT_CP_BITRATE --- lib_com/options.h | 1 - lib_enc/ivas_mct_enc_fx.c | 10 ---------- 2 files changed, 11 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 44c459035..131c55630 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -115,7 +115,6 @@ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION /* Eri: Basop issue 2023: Distance attenuation scaling, adding clamping of distance att input and listener position */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION_BUGFIX /* Eri: Bug discovered in cleanup of basop issue 2023 */ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ -#define FIX_BASOP_2531_MCT_CP_BITRATE /* FhG: BASOP issue 2531: Fix MCT cp_bitrate calculation; affects bitrate switching only */ #define FIX_BASOP_2541_OMASA_ENC_FIXES /* Nokia: BASOP issue 2541: Fix function ivas_encode_masaism_metadata_fx */ #define FIX_BASOP_2545_FIX_LTV_REGRESSION_2529 /* Nokia: BASOP issue 2545: Fix LTV regression caused by issue 2529 fix */ #define FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW /* Orange: float issue 1548: Harmonize non diegetic panning law in ISM and renderers */ diff --git a/lib_enc/ivas_mct_enc_fx.c b/lib_enc/ivas_mct_enc_fx.c index 4b157fbc2..81a8f7942 100644 --- a/lib_enc/ivas_mct_enc_fx.c +++ b/lib_enc/ivas_mct_enc_fx.c @@ -234,24 +234,14 @@ ivas_error ivas_mct_enc_fx( IF( NE_32( ivas_total_brate, st_ivas->hEncoderConfig->last_ivas_total_brate ) ) { Word32 cp_bitrate; -#ifdef FIX_BASOP_2531_MCT_CP_BITRATE Word32 L_tmp; -#endif // cp_bitrate = ivas_total_brate / hMCT->nchan_out_woLFE * CPE_CHANNELS; -#ifdef FIX_BASOP_2531_MCT_CP_BITRATE iDiv_and_mod_32( L_shl( ivas_total_brate, 1 ), hMCT->nchan_out_woLFE, &cp_bitrate, &L_tmp, 0 ); -#else - cp_bitrate = L_shl( L_deposit_l( div_l( ivas_total_brate, hMCT->nchan_out_woLFE ) ), 2 ); // a/b => div_l(a, b/2) or (2 * div_l(a, b)) -#endif IF( EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) { // cp_bitrate = ivas_total_brate / st_ivas->nchan_transport * CPE_CHANNELS; -#ifdef FIX_BASOP_2531_MCT_CP_BITRATE iDiv_and_mod_32( L_shl( ivas_total_brate, 1 ), st_ivas->nchan_transport, &cp_bitrate, &L_tmp, 0 ); -#else - cp_bitrate = L_shl( L_deposit_l( div_l( ivas_total_brate, st_ivas->nchan_transport ) ), 2 ); // a/b => div_l(a, b/2) or (2 * div_l(a, b)) -#endif } IF( st_ivas->hCPE[0]->hCoreCoder[0]->igf ) -- GitLab From e643e0485cc181a3f060bf8ffd02f5988b0d8a7b Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:36:09 +0200 Subject: [PATCH 25/31] [cleanup] accept FIX_BASOP_2541_OMASA_ENC_FIXES --- lib_com/options.h | 1 - lib_enc/ivas_masa_enc_fx.c | 14 -------------- 2 files changed, 15 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 131c55630..2e1c4b3dc 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -115,7 +115,6 @@ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION /* Eri: Basop issue 2023: Distance attenuation scaling, adding clamping of distance att input and listener position */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION_BUGFIX /* Eri: Bug discovered in cleanup of basop issue 2023 */ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ -#define FIX_BASOP_2541_OMASA_ENC_FIXES /* Nokia: BASOP issue 2541: Fix function ivas_encode_masaism_metadata_fx */ #define FIX_BASOP_2545_FIX_LTV_REGRESSION_2529 /* Nokia: BASOP issue 2545: Fix LTV regression caused by issue 2529 fix */ #define FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW /* Orange: float issue 1548: Harmonize non diegetic panning law in ISM and renderers */ #define FIX_FLOAT_1573_POSITION_UPDATE /* Eri: Float issue 1573: For static orientation and listener movement, the PoseUpdated flag is cleared and prevents 5 ms update rate. */ diff --git a/lib_enc/ivas_masa_enc_fx.c b/lib_enc/ivas_masa_enc_fx.c index 6f1a7d5d2..8e98acdeb 100644 --- a/lib_enc/ivas_masa_enc_fx.c +++ b/lib_enc/ivas_masa_enc_fx.c @@ -4815,13 +4815,8 @@ static void ivas_encode_masaism_metadata_fx( eneBand32 = W_extract_h( W_shl( eneBand, shift ) ); eneBand_exp = sub( 63, add( add( hMasa->data.q_energy, 1 ), shift ) ); -#ifdef FIX_BASOP_2541_OMASA_ENC_FIXES energy_ism = L_tmp; // Copy existing value energy_ism_e = L_tmp_e; -#else - energy_ism = 0; - energy_ism_e = 0; -#endif move32(); move16(); FOR( obj = 0; obj < nchan_ism; obj++ ) @@ -4834,20 +4829,11 @@ static void ivas_encode_masaism_metadata_fx( FOR( band = 0; band < omasa_nbands; band++ ) { -#ifndef FIX_BASOP_2541_OMASA_ENC_FIXES - energy_ism = BASOP_Util_Add_Mant32Exp( energy_ism, energy_ism_e, hOmasaEnergy->energy_ism_fx[sf][band], hOmasaEnergy->energy_ism_fx_e[sf][band], &energy_ism_e ); -#endif FOR( obj = 0; obj < nchan_ism; obj++ ) { -#ifdef FIX_BASOP_2541_OMASA_ENC_FIXES L_tmp = Mpy_32_32( hOmasaEnergy->energy_ism_fx[sf][band], hOmasaEnergy->energy_ratio_ism_fx[sf][band][obj] ); // Q = (31 - hOmasaEnergy->energy_ism_fx_e[sf][band]) + Q30 - 31 L_tmp_e = add( 1, hOmasaEnergy->energy_ism_fx_e[sf][band] ); energy_ism_ind[obj] = BASOP_Util_Add_Mant32Exp( energy_ism_ind[obj], energy_ism_ind_e[obj], L_tmp, L_tmp_e, &energy_ism_ind_e[obj] ); -#else - - hOmasaData->masa_to_total_energy_ratio_fx[sf][0] = ONE_IN_Q30; // 1.0f in Q30 - move32(); -#endif } } -- GitLab From 04d3c40dcba28db1c468eedf5bb8d9512eba7545 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:37:00 +0200 Subject: [PATCH 26/31] [cleanup] accept FIX_BASOP_2545_FIX_LTV_REGRESSION_2529 --- lib_com/options.h | 1 - lib_enc/ivas_masa_enc_fx.c | 4 ---- lib_util/masa_file_reader.c | 8 -------- 3 files changed, 13 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 2e1c4b3dc..b955293e5 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -115,7 +115,6 @@ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION /* Eri: Basop issue 2023: Distance attenuation scaling, adding clamping of distance att input and listener position */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION_BUGFIX /* Eri: Bug discovered in cleanup of basop issue 2023 */ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ -#define FIX_BASOP_2545_FIX_LTV_REGRESSION_2529 /* Nokia: BASOP issue 2545: Fix LTV regression caused by issue 2529 fix */ #define FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW /* Orange: float issue 1548: Harmonize non diegetic panning law in ISM and renderers */ #define FIX_FLOAT_1573_POSITION_UPDATE /* Eri: Float issue 1573: For static orientation and listener movement, the PoseUpdated flag is cleared and prevents 5 ms update rate. */ #define FIX_BASOP_2521_DIRAC_STEREO_STEFFI_NRGS /* FhG: BASOP issue 2521: Fix wrong porting for determination of first subframe length in ivas_sba_dirac_stereo_compute_td_stefi_nrgs() */ diff --git a/lib_enc/ivas_masa_enc_fx.c b/lib_enc/ivas_masa_enc_fx.c index 8e98acdeb..553073a2a 100644 --- a/lib_enc/ivas_masa_enc_fx.c +++ b/lib_enc/ivas_masa_enc_fx.c @@ -3129,11 +3129,7 @@ static void average_masa_metadata_fx( hMeta->directional_meta[i].spread_coherence_fx[j][k] = BASOP_Util_Divide3232_Scale( spread_coh_sum_fx, L_add( energy_sum_fx, EPSILON_FX ), &temp2_e ); move16(); temp2_e = add( temp2_e, sub( spread_coh_sum_e, energy_sum_e ) ); -#ifdef FIX_BASOP_2545_FIX_LTV_REGRESSION_2529 hMeta->directional_meta[i].spread_coherence_fx[j][k] = shl_sat( hMeta->directional_meta[i].spread_coherence_fx[j][k], temp2_e ); /*changing q from 15-temp2_e to q15*/ -#else - hMeta->directional_meta[i].spread_coherence_fx[j][k] = shl( hMeta->directional_meta[i].spread_coherence_fx[j][k], temp2_e ); /*changing q from 15-temp2_e to q15*/ -#endif move16(); IF( i == 0 ) { diff --git a/lib_util/masa_file_reader.c b/lib_util/masa_file_reader.c index 610dfd4c4..7a241e531 100644 --- a/lib_util/masa_file_reader.c +++ b/lib_util/masa_file_reader.c @@ -205,12 +205,8 @@ ivas_error MasaFileReader_readNextFrame( for ( b = 0; b < MASA_FREQUENCY_BANDS; b++ ) { -#ifdef FIX_BASOP_2545_FIX_LTV_REGRESSION_2529 int32_t tmp_coh = ( (int32_t) readOther[b] * ONE_IN_Q15 + 254 ) / 255; hMeta->directional_meta[i].spread_coherence_fx[j][b] = (Word16) ( tmp_coh > MAX_16 ? MAX_16 : tmp_coh ); // Q15, need to clamp -#else - hMeta->directional_meta[i].spread_coherence_fx[j][b] = (Word16) ( ( (int32_t) readOther[b] * ONE_IN_Q15 + 254 ) / 255 ); // Q15 -#endif } } @@ -234,12 +230,8 @@ ivas_error MasaFileReader_readNextFrame( for ( b = 0; b < MASA_FREQUENCY_BANDS; b++ ) { -#ifdef FIX_BASOP_2545_FIX_LTV_REGRESSION_2529 int32_t tmp_coh = ( (int32_t) readOther[b] * ONE_IN_Q15 + 254 ) / 255; hMeta->common_meta.surround_coherence_fx[j][b] = (Word16) ( tmp_coh > MAX_16 ? MAX_16 : tmp_coh ); // Q15, need to clamp -#else - hMeta->common_meta.surround_coherence_fx[j][b] = (Word16) ( ( (int32_t) readOther[b] * ONE_IN_Q15 + 254 ) / 255 ); // Q15 -#endif } /* Remainder-to-total ratio */ -- GitLab From bd63a0185cc69c6a00dfdacefc7ba8f8d183ac77 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:37:56 +0200 Subject: [PATCH 27/31] [cleanup] accept FIX_FLOAT_1573_POSITION_UPDATE --- lib_com/options.h | 1 - lib_rend/ivas_objectRenderer_mix_fx.c | 8 -------- 2 files changed, 9 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index b955293e5..bc027de54 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -116,7 +116,6 @@ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION_BUGFIX /* Eri: Bug discovered in cleanup of basop issue 2023 */ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ #define FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW /* Orange: float issue 1548: Harmonize non diegetic panning law in ISM and renderers */ -#define FIX_FLOAT_1573_POSITION_UPDATE /* Eri: Float issue 1573: For static orientation and listener movement, the PoseUpdated flag is cleared and prevents 5 ms update rate. */ #define FIX_BASOP_2521_DIRAC_STEREO_STEFFI_NRGS /* FhG: BASOP issue 2521: Fix wrong porting for determination of first subframe length in ivas_sba_dirac_stereo_compute_td_stefi_nrgs() */ #define FIX_1452_DEFAULT_REVERB /* Nokia/Philips/FhG: Fix default room presets and their usage in renderer */ #define NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 /* FhG: Correct scale inconsistency of old_inp_16k_fx buffer scale. */ diff --git a/lib_rend/ivas_objectRenderer_mix_fx.c b/lib_rend/ivas_objectRenderer_mix_fx.c index 4ead8081d..088d6bda3 100644 --- a/lib_rend/ivas_objectRenderer_mix_fx.c +++ b/lib_rend/ivas_objectRenderer_mix_fx.c @@ -126,15 +126,9 @@ ivas_error TDREND_MIX_LIST_SetOrient_fx( /* Get listener */ List_p = hBinRendererTd->Listener_p; -#ifdef FIX_FLOAT_1573_POSITION_UPDATE /* Evaluate the normalized orientation vectors and set pose update flag */ /* Use OR since the position may have been updated in TDREND_MIX_LIST_SetPos */ List_p->PoseUpdated = s_or( List_p->PoseUpdated, TDREND_SPATIAL_EvalOrthonormOrient_fx( List_p->Front_fx, List_p->Up_fx, List_p->Right_fx, FrontVec_p_fx, UpVec_p_fx, orient_q ) ); // Q0 -#else - /* Evaluate the normalized orientation vectors and set pose update flag */ - List_p->PoseUpdated = TDREND_SPATIAL_EvalOrthonormOrient_fx( List_p->Front_fx, List_p->Up_fx, List_p->Right_fx, FrontVec_p_fx, UpVec_p_fx, orient_q ); // Q0 - move16(); -#endif return IVAS_ERR_OK; } @@ -228,10 +222,8 @@ ivas_error TDREND_MIX_Init_fx( TDREND_SPATIAL_VecInit_fx( hBinRendererTd->Listener_p->Front_fx, 0, 0, -ONE_IN_Q30 ); TDREND_SPATIAL_VecInit_fx( hBinRendererTd->Listener_p->Up_fx, 0, ONE_IN_Q30, 0 ); TDREND_SPATIAL_VecInit_fx( hBinRendererTd->Listener_p->Right_fx, ONE_IN_Q30, 0, 0 ); -#ifdef FIX_FLOAT_1573_POSITION_UPDATE hBinRendererTd->Listener_p->PoseUpdated = FALSE; move16(); -#endif /* Init HR filter set */ IF( *hHrtfTD == NULL ) -- GitLab From d5122b97e1663877195e662e3f9b5a5f4a181b5f Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:38:46 +0200 Subject: [PATCH 28/31] [cleanup] accept FIX_BASOP_2521_DIRAC_STEREO_STEFFI_NRGS --- lib_com/options.h | 1 - lib_dec/ivas_sba_dirac_stereo_dec_fx.c | 43 -------------------- lib_dec/ivas_stat_dec.h | 5 --- lib_dec/ivas_stereo_dft_dec_fx.c | 15 ------- lib_dec/ivas_stereo_icbwe_dec_fx.c | 56 -------------------------- 5 files changed, 120 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index bc027de54..dfb3270fc 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -116,7 +116,6 @@ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION_BUGFIX /* Eri: Bug discovered in cleanup of basop issue 2023 */ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ #define FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW /* Orange: float issue 1548: Harmonize non diegetic panning law in ISM and renderers */ -#define FIX_BASOP_2521_DIRAC_STEREO_STEFFI_NRGS /* FhG: BASOP issue 2521: Fix wrong porting for determination of first subframe length in ivas_sba_dirac_stereo_compute_td_stefi_nrgs() */ #define FIX_1452_DEFAULT_REVERB /* Nokia/Philips/FhG: Fix default room presets and their usage in renderer */ #define NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 /* FhG: Correct scale inconsistency of old_inp_16k_fx buffer scale. */ #define FIX_2547_ALIGN_CONDITIONS_IN_CORE_SW_DEC /* VA : Basop issue 2547: Align conditions in core sw dec */ diff --git a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c index d31d16522..1e39811e2 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c @@ -684,29 +684,19 @@ static void ivas_sba_dirac_stereo_compute_td_stefi_nrgs( const Word16 q_hb_synth ) { Word16 i; -#ifdef FIX_BASOP_2521_DIRAC_STEREO_STEFFI_NRGS Word32 hb_nrg = EPSILON_FIX; Word16 q_hb_nrg_subr = Q31 + Q15 - Q6; /* in case IF( ( EQ_16( core, ACELP_CORE ) && !fd_cng_flag ) || EQ_16( hStereoDft->core_hist[1], ACELP_CORE ) ) is false, we want to end up with Q31, and we subtract Q15 - Q6 below; otherwise, we set it within this condition */ Word16 q_hb_nrg = Q31; Word16 shift, shift_hb_nrg_subr; move32(); -#else - Word32 hb_nrg = EPSILON_FIX; - move32(); - Word32 hb_nrg2 = EPSILON_FIX; - move32(); -#endif -#ifdef FIX_BASOP_2521_DIRAC_STEREO_STEFFI_NRGS shift = L_norm_arr( hb_synth, output_frame ); shift = sub( shift, shr( add( find_guarded_bits_fx( shr( output_frame, 1 ) ), 1 ), 1 ) ); -#endif test(); test(); IF( ( EQ_16( core, ACELP_CORE ) && !fd_cng_flag ) || EQ_16( hStereoDft->core_hist[1], ACELP_CORE ) ) { -#ifdef FIX_BASOP_2521_DIRAC_STEREO_STEFFI_NRGS Word32 L_tmp; Word64 W_tmp; @@ -737,30 +727,6 @@ static void ivas_sba_dirac_stereo_compute_td_stefi_nrgs( hb_nrg = L_add( L_shr( hStereoDft->hb_nrg_subr_fx[0], 1 ), L_shr( hStereoDft->hb_nrg_subr_fx[1], 1 ) ); /* 2 * (q_hb_synth + shift) - 16 - 1 */ q_hb_nrg = sub( q_hb_nrg_subr, 1 ); move16(); -#else - FOR( i = 0; i < shr( output_frame, 2 ); i++ ) - { - hb_nrg2 = Madd_32_32( hb_nrg2, hb_synth[i], hb_synth[i] ); /*2*q_hb_synth-31*/ - } - - hStereoDft->hb_nrg_subr_fx[0] = hb_nrg2; /*2*q_hb_synth-31*/ - move32(); - hStereoDft->q_hb_nrg_subr = sub( shl( q_hb_synth, 1 ), 31 ); - move32(); - hb_nrg = L_add( hb_nrg, hb_nrg2 ); - move32(); - hb_nrg2 = EPSILON_FIX; - move32(); - - FOR( ; i < output_frame; i++ ) - { - hb_nrg2 = Madd_32_32( hb_nrg2, hb_synth[i], hb_synth[i] ); /*2*q_hb_synth-31*/ - } - - hStereoDft->hb_nrg_subr_fx[1] = hb_nrg2; /*2*q_hb_synth-31*/ - move32(); - hb_nrg = L_add( hb_nrg, hb_nrg2 ); -#endif IF( EQ_16( hStereoDft->q_hb_stefi_sig_fx, q_hb_synth ) ) { @@ -789,7 +755,6 @@ static void ivas_sba_dirac_stereo_compute_td_stefi_nrgs( hStereoDft->hb_nrg_subr_fx[1] = 0; move32(); } -#ifdef FIX_BASOP_2521_DIRAC_STEREO_STEFFI_NRGS shift_hb_nrg_subr = s_min( norm_l( hStereoDft->hb_nrg_subr_fx[0] ), norm_l( hStereoDft->hb_nrg_subr_fx[1] ) ); hStereoDft->hb_nrg_subr_fx[0] = ( Mpy_32_16_1( L_shl( hStereoDft->hb_nrg_subr_fx[0], shift_hb_nrg_subr ), shl( hStereoDft->NFFT, 5 ) ) ); /* shl( ., 5) is shortcut for shl( shr( hStereoDft->NFFT, 1 ), 6 ) */ /* q_hb_nrg_subr - (15 - 6) */ @@ -801,14 +766,6 @@ static void ivas_sba_dirac_stereo_compute_td_stefi_nrgs( move32(); hStereoDft->q_hb_nrg[0] = q_hb_nrg; move16(); -#else - hStereoDft->hb_nrg_subr_fx[0] = hStereoDft->hb_nrg_subr_fx[0]; // imult3216(hStereoDft->hb_nrg_subr_fx[0] , shr(hStereoDft->NFFT, 1)); /*hStereoDft->q_hb_nrg_subr*/ - move32(); - hStereoDft->hb_nrg_subr_fx[1] = hStereoDft->hb_nrg_subr_fx[1]; // imult3216(hStereoDft->hb_nrg_subr_fx[1] , shr(hStereoDft->NFFT, 1)); /*hStereoDft->q_hb_nrg_subr*/ - move32(); - hStereoDft->hb_nrg_fx[0] = hb_nrg; - move32(); -#endif hStereoDft->td_gain_fx[0] = 0; move32(); hStereoDft->core_hist[0] = core; /* full signal available for DTX with FD-CNG, thus apply stereo filling on full spectrum like in TCX */ diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index b3c75cb3c..8a1444278 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -199,9 +199,7 @@ typedef struct stereo_dft_dec_data_struct Word32 hb_nrg_fx[STEREO_DFT_CORE_HIST_MAX]; /* Q(q_hb_nrg) */ Word32 hb_nrg_subr_fx[STEREO_DFT_NBDIV]; /* Q(q_hb_nrg_subr) */ -#ifdef FIX_BASOP_2521_DIRAC_STEREO_STEFFI_NRGS Word16 q_hb_nrg[STEREO_DFT_CORE_HIST_MAX]; -#endif Word16 Q_nrg_subr; Word16 prev_Q_stefi_sig; Word16 q_td_gain[STEREO_DFT_CORE_HIST_MAX]; @@ -227,9 +225,6 @@ typedef struct stereo_dft_dec_data_struct Word32 smooth_buf_fx[SBA_DIRAC_STEREO_NUM_BANDS][SBA_DIRAC_NRG_SMOOTH_LONG + 1]; /* Q(q_smooth_buf_fx) */ Word16 smooth_fac_fx[NB_DIV][SBA_DIRAC_STEREO_NUM_BANDS]; /* Q15 */ Word16 q_smooth_buf_fx; -#ifndef FIX_BASOP_2521_DIRAC_STEREO_STEFFI_NRGS - Word16 q_hb_nrg; -#endif Word16 q_hb_nrg_subr; Word16 q_res_mem; diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index 36b6901be..71e20965f 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -202,9 +202,7 @@ void stereo_dft_dec_reset_fx( set32_fx( hStereoDft->hb_stefi_sig_fx, 0, L_FRAME48k + NS2SA( 48000, STEREO_DFT_TD_STEFI_DELAY_NS ) ); set32_fx( hStereoDft->hb_nrg_fx, 0, STEREO_DFT_CORE_HIST_MAX ); -#ifdef FIX_BASOP_2521_DIRAC_STEREO_STEFFI_NRGS set16_fx( hStereoDft->q_hb_nrg, Q31, STEREO_DFT_CORE_HIST_MAX ); -#endif set32_fx( hStereoDft->td_gain_fx, 0, STEREO_DFT_CORE_HIST_MAX ); set16_fx( hStereoDft->q_td_gain, 0, STEREO_DFT_CORE_HIST_MAX ); hStereoDft->q_dft = 0; @@ -670,12 +668,8 @@ void stereo_dft_dec_update_fx( } Copy32( hStereoDft->hb_stefi_sig_fx + output_frame, hStereoDft->hb_stefi_sig_fx, hStereoDft->hb_stefi_delay ); /* Qx */ -#ifdef FIX_BASOP_2521_DIRAC_STEREO_STEFFI_NRGS Copy32( hStereoDft->hb_nrg_fx, hStereoDft->hb_nrg_fx + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); /* q_hb_nrg */ Copy( hStereoDft->q_hb_nrg, hStereoDft->q_hb_nrg + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); -#else - Copy32( hStereoDft->hb_nrg_fx, hStereoDft->hb_nrg_fx + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); /* Qx */ -#endif Copy32( hStereoDft->td_gain_fx, hStereoDft->td_gain_fx + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); /* q_td_gain */ Copy( hStereoDft->q_td_gain, hStereoDft->q_td_gain + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); @@ -2794,7 +2788,6 @@ static void stereo_dft_compute_td_stefi_params_fx( move32(); nrg_pred_DMX = hStereoDft->hb_nrg_fx[1]; move32(); -#ifdef FIX_BASOP_2521_DIRAC_STEREO_STEFFI_NRGS IF( GT_16( hStereoDft->q_hb_nrg[0], hStereoDft->q_hb_nrg[1] ) ) { nrg_DMX = L_shr( nrg_DMX, sub( hStereoDft->q_hb_nrg[0], hStereoDft->q_hb_nrg[1] ) ); @@ -2803,7 +2796,6 @@ static void stereo_dft_compute_td_stefi_params_fx( { nrg_pred_DMX = L_shr( nrg_pred_DMX, sub( hStereoDft->q_hb_nrg[1], hStereoDft->q_hb_nrg[0] ) ); } -#endif op1 = BASOP_Util_Divide3232_Scale( L_add( EPSILON_FIX, nrg_DMX ), L_add( EPSILON_FIX, nrg_pred_DMX ), &q_div ); /* q_div */ q_sqrt = add( Q16, q_div ); @@ -3249,11 +3241,9 @@ void stereo_dft_generate_res_pred_fx( } ELSE IF( hStereoDft->core_hist[STEREO_DFT_STEFFI_DELAY_SHORT / 2] == ACELP_CORE ) { -#ifdef FIX_BASOP_2521_DIRAC_STEREO_STEFFI_NRGS Word16 q_dmx_nrg, q_diff; Word16 norm_dmx_nrg; Word32 L_temp; -#endif /* ACELP -> TCX/HQ core transition */ /* calculate high band energy only */ dmx_nrg = EPSILON_FIX; @@ -3263,7 +3253,6 @@ void stereo_dft_generate_res_pred_fx( dmx_nrg = L_add( dmx_nrg, Madd_32_32( Mpy_32_32( pDFT_DMX[2 * i], pDFT_DMX[2 * i] ), pDFT_DMX[2 * i + 1], pDFT_DMX[2 * i + 1] ) ); /* 2 * q_dft - 31 */ } -#ifdef FIX_BASOP_2521_DIRAC_STEREO_STEFFI_NRGS norm_dmx_nrg = norm_l( dmx_nrg ); dmx_nrg = L_shl( dmx_nrg, norm_dmx_nrg ); q_dmx_nrg = add( sub( shl( hStereoDft->q_dft, 1 ), 31 ), norm_dmx_nrg ); @@ -3319,10 +3308,6 @@ void stereo_dft_generate_res_pred_fx( move32(); /* hStereoDft->q_hb_nrg[0] stays as is */ } -#else - hStereoDft->hb_nrg_fx[0] = L_add( hStereoDft->hb_nrg_fx[0], div_l( dmx_nrg, shr( hStereoDft->NFFT, 2 ) ) ); /* Q15 */ - move32(); -#endif *stop = bin0; move16(); } diff --git a/lib_dec/ivas_stereo_icbwe_dec_fx.c b/lib_dec/ivas_stereo_icbwe_dec_fx.c index fc1526ca9..0ccd2ed43 100644 --- a/lib_dec/ivas_stereo_icbwe_dec_fx.c +++ b/lib_dec/ivas_stereo_icbwe_dec_fx.c @@ -138,11 +138,7 @@ void stereo_icBWE_dec_fx( Word16 nlMixFac_fx[NB_SUBFR16k]; Word16 specMapping_fx; Word16 fb_synth_nonref_fx[L_FRAME48k]; -#ifdef FIX_BASOP_2521_DIRAC_STEREO_STEFFI_NRGS Word32 prev_pow_fx, curr_pow_fx, maxVal1; -#else - Word32 prev_pow_fx, curr_pow_fx, maxVal1, maxVal; -#endif Word16 scale_fx, e_scale_fx; Word16 alpha_fx, winSlope_fx, winLen_fx; Word16 prevgsMapping_fx; @@ -150,10 +146,8 @@ void stereo_icBWE_dec_fx( Word16 icbweM2Ref_fx, ratio_L_fx; Word16 gsMapping_fx; Word32 hb_nrg_fx; -#ifdef FIX_BASOP_2521_DIRAC_STEREO_STEFFI_NRGS Word16 q_hb_nrg, q_hb_nrg_subr; Word16 shift_hb_nrg_subr; -#endif Word16 Q_syn_shb; Word16 shift_prev_pow, synthRef_shift; Word32 L_tmp; @@ -205,31 +199,17 @@ void stereo_icBWE_dec_fx( /* update buffers for TD stereo filling */ IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) ) { -#ifdef FIX_BASOP_2521_DIRAC_STEREO_STEFFI_NRGS q_hb_nrg_subr = Q31 + Q15 - Q6; /* in case IF( EQ_16( st->core, ACELP_CORE ) || EQ_16( st->last_core, ACELP_CORE ) ) is flase, we want to end up with Q31, and we subtract Q15 - Q6 below; otherwise, we set it within this condition */ move16(); -#endif hb_nrg_fx = 0; move32(); -#ifdef FIX_BASOP_2521_DIRAC_STEREO_STEFFI_NRGS q_hb_nrg = Q31; synthRef_shift = L_norm_arr( synthRef_fx, output_frame ); -#else - move32(); - maximum_abs_32_fx( synthRef_fx, output_frame, &maxVal ); - synthRef_shift = norm_l( maxVal ); - if ( maxVal == 0 ) - { - synthRef_shift = 31; - move16(); - } -#endif synthRef_shift = sub( synthRef_shift, shr( add( find_guarded_bits_fx( shr( output_frame, 1 ) ), 1 ), 1 ) ); test(); IF( EQ_16( st->core, ACELP_CORE ) || EQ_16( st->last_core, ACELP_CORE ) ) { -#ifdef FIX_BASOP_2521_DIRAC_STEREO_STEFFI_NRGS Word64 W_tmp = EPSILON_FIX; move64(); @@ -256,32 +236,6 @@ void stereo_icBWE_dec_fx( hb_nrg_fx = L_add( L_shr( hCPE->hStereoDft->hb_nrg_subr_fx[0], 1 ), L_shr( hCPE->hStereoDft->hb_nrg_subr_fx[1], 1 ) ); // 2 * (Qsyn + SynthRef_shift) - 31 - 1 q_hb_nrg = sub( q_hb_nrg_subr, 1 ); move16(); -#else - Word64 W_tmp = 0; - move64(); - tmp = shl_sat( 1, synthRef_shift ); - FOR( i = 0; i < output_frame / 2; i++ ) - { - // needed to be adjusted for q - L_tmp = Mpy_32_16_1( synthRef_fx[i], tmp ); /* Qsyn + SynthRef_shift - 15 */ - W_tmp = W_mac_32_32( W_tmp, L_tmp, L_tmp ); /* 2 * (Qsyn + SynthRef_shift) - 29 */ - } - hb_nrg_fx = W_round48_L( W_tmp ); /* 2 * (Qsyn + SynthRef_shift) - 45 */ - hCPE->hStereoDft->hb_nrg_subr_fx[0] = hb_nrg_fx; /* 2 * (Qsyn + SynthRef_shift) - 45 */ - move32(); - hStereoDft->q_hb_nrg_subr = sub( shl( add( *Q_syn, synthRef_shift ), 1 ), 45 ); - move16(); - W_tmp = 0; - move64(); - FOR( ; i < output_frame; i++ ) - { - L_tmp = Mpy_32_16_1( synthRef_fx[i], tmp ); /* Qsyn + SynthRef_shift - 15 */ - W_tmp = W_mac_32_32( W_tmp, L_tmp, L_tmp ); /* 2 * (Qsyn + SynthRef_shift) - 45 */ - } - - hCPE->hStereoDft->hb_nrg_subr_fx[1] = W_round48_L( W_tmp ); // 2 * (Qsyn + SynthRef_shift) - 45 - hb_nrg_fx = L_add( hCPE->hStereoDft->hb_nrg_subr_fx[0], hCPE->hStereoDft->hb_nrg_subr_fx[1] ); // 2 * (Qsyn + SynthRef_shift) - 45 -#endif Copy32( synthRef_fx, hCPE->hStereoDft->hb_stefi_sig_fx + hCPE->hStereoDft->hb_stefi_delay, output_frame ); /* Qsynth */ } @@ -293,7 +247,6 @@ void stereo_icBWE_dec_fx( hCPE->hStereoDft->hb_nrg_subr_fx[1] = 0; move32(); } -#ifdef FIX_BASOP_2521_DIRAC_STEREO_STEFFI_NRGS shift_hb_nrg_subr = s_min( norm_l( hCPE->hStereoDft->hb_nrg_subr_fx[0] ), norm_l( hCPE->hStereoDft->hb_nrg_subr_fx[1] ) ); hCPE->hStereoDft->hb_nrg_subr_fx[0] = ( Mpy_32_16_1( L_shl( hCPE->hStereoDft->hb_nrg_subr_fx[0], shift_hb_nrg_subr ), shl( hCPE->hStereoDft->NFFT, 5 ) ) ); /* shl( ., 5) is shortcut for shl( shr( hStereoDft->NFFT, 1 ), 6 ) */ /* q_hb_nrg_subr + shift_hb_nrg_subr - (15 - 6) */ @@ -305,15 +258,6 @@ void stereo_icBWE_dec_fx( move32(); hCPE->hStereoDft->q_hb_nrg[0] = q_hb_nrg; move16(); -#else - hCPE->hStereoDft->hb_nrg_subr_fx[0] = ( Mpy_32_16_1( hCPE->hStereoDft->hb_nrg_subr_fx[0], shl( shr( hCPE->hStereoDft->NFFT, 1 ), 6 ) ) ); // 2 * (Qsynth + SynthRef_shift) - 40 // 2 * (Qx + SynthRef_shift) - 31 - 15 - move32(); - hCPE->hStereoDft->hb_nrg_subr_fx[1] = ( Mpy_32_16_1( hCPE->hStereoDft->hb_nrg_subr_fx[1], shl( shr( hCPE->hStereoDft->NFFT, 1 ), 6 ) ) ); // 2 * (Qsynth + SynthRef_shift) - 40 - move32(); - hCPE->hStereoDft->q_hb_nrg_subr = sub( shl( ( *Q_syn + synthRef_shift ), 1 ), 45 + 9 ); - hCPE->hStereoDft->hb_nrg_fx[0] = hb_nrg_fx; // 2 * (Qx + SynthRef_shift) - 31 - move32(); -#endif hCPE->hStereoDft->td_gain_fx[0] = 0; move32(); hCPE->hStereoDft->core_hist[0] = st->core; -- GitLab From 8b435d68d31cf551624b1fc349299fbb93edf176 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:39:29 +0200 Subject: [PATCH 29/31] [cleanup] accept FIX_2547_ALIGN_CONDITIONS_IN_CORE_SW_DEC --- lib_com/options.h | 1 - lib_dec/core_switching_dec_fx.c | 10 ---------- 2 files changed, 11 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index dfb3270fc..8c0084d69 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -118,7 +118,6 @@ #define FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW /* Orange: float issue 1548: Harmonize non diegetic panning law in ISM and renderers */ #define FIX_1452_DEFAULT_REVERB /* Nokia/Philips/FhG: Fix default room presets and their usage in renderer */ #define NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 /* FhG: Correct scale inconsistency of old_inp_16k_fx buffer scale. */ -#define FIX_2547_ALIGN_CONDITIONS_IN_CORE_SW_DEC /* VA : Basop issue 2547: Align conditions in core sw dec */ #define FIX_2547_ALIGN_CONDITIONS_IN_CORE_SW_DEC_EVS /* VA : Basop issue 2547: Align conditions in core sw dec, condition that could affect EVS as well, but adapted to keep EVS BE */ #define FIX_BASOP_2548_ProcessIGF_fx_PREDICTIONGAIN /* FhG: fixes obvious bug for IVAS path. For EVS path, issue is still not resolved */ #define FIX_FMSW_DEC /* float issue 1542: fix JBM issue in format switching */ diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index dffd05863..3cff76bc5 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -183,9 +183,7 @@ void bw_switching_pre_proc_fx( { st_fx->prev_ener_shb_fx = 0; move16(); -#ifdef FIX_2547_ALIGN_CONDITIONS_IN_CORE_SW_DEC IF( st_fx->hBWE_FD != NULL ) -#endif { set16_fx( st_fx->hBWE_FD->prev_SWB_fenv_fx, 0, SWB_FENV ); } @@ -572,11 +570,7 @@ ivas_error core_switching_post_dec_fx( hBWE_TD->bwe_non_lin_prev_scale_fx = L_deposit_l( 0 ); move32(); } -#ifndef FIX_2547_ALIGN_CONDITIONS_IN_CORE_SW_DEC - IF( st_fx->hHQ_core != NULL && !( EQ_16( inner_frame_tbl[st_fx->bwidth], L_FRAME16k ) && EQ_32( st_fx->core_brate, HQ_32k ) ) ) -#else IF( st_fx->hHQ_core != NULL && !( EQ_16( inner_frame_tbl[st_fx->bwidth], L_FRAME16k ) && LE_32( st_fx->core_brate, HQ_32k ) ) ) -#endif { set32_fx( hHQ_core->prev_env_fx, 0, SFM_N_WB ); set32_fx( hHQ_core->prev_normq_fx, 0, SFM_N_WB ); @@ -883,11 +877,7 @@ ivas_error core_switching_post_dec_fx( /* reset WB TBE buffers */ test(); -#ifndef FIX_2547_ALIGN_CONDITIONS_IN_CORE_SW_DEC - IF( NE_16( st_fx->last_extl, WB_TBE ) && EQ_16( st_fx->extl, WB_TBE ) ) -#else IF( NE_16( st_fx->last_extl, WB_TBE ) && EQ_16( st_fx->extl, WB_TBE ) && NE_16( st_fx->last_core, TCX_20_CORE ) && NE_16( st_fx->last_core, TCX_10_CORE ) ) -#endif { wb_tbe_extras_reset_fx( hBWE_TD->mem_genSHBexc_filt_down_wb2_fx, hBWE_TD->mem_genSHBexc_filt_down_wb3_fx ); wb_tbe_extras_reset_synth_fx( hBWE_TD->state_lsyn_filt_shb_fx, hBWE_TD->state_lsyn_filt_dwn_shb_fx, hBWE_TD->state_32and48k_WB_upsample_fx, hBWE_TD->mem_resamp_HB_fx ); -- GitLab From 646f3defaf4b1f9384cee032c20302123ce744d0 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:40:23 +0200 Subject: [PATCH 30/31] [cleanup] accept FIX_2547_ALIGN_CONDITIONS_IN_CORE_SW_DEC_EVS --- lib_com/options.h | 1 - lib_dec/core_switching_dec_fx.c | 5 ----- 2 files changed, 6 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 8c0084d69..9ce33d497 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -118,7 +118,6 @@ #define FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW /* Orange: float issue 1548: Harmonize non diegetic panning law in ISM and renderers */ #define FIX_1452_DEFAULT_REVERB /* Nokia/Philips/FhG: Fix default room presets and their usage in renderer */ #define NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 /* FhG: Correct scale inconsistency of old_inp_16k_fx buffer scale. */ -#define FIX_2547_ALIGN_CONDITIONS_IN_CORE_SW_DEC_EVS /* VA : Basop issue 2547: Align conditions in core sw dec, condition that could affect EVS as well, but adapted to keep EVS BE */ #define FIX_BASOP_2548_ProcessIGF_fx_PREDICTIONGAIN /* FhG: fixes obvious bug for IVAS path. For EVS path, issue is still not resolved */ #define FIX_FMSW_DEC /* float issue 1542: fix JBM issue in format switching */ #define FIX_FMSW_DEC_2 /* float issue 1575: fix crash for format switching when bitsream starts with EVS */ diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index 3cff76bc5..7fa00ef85 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -728,10 +728,6 @@ ivas_error core_switching_post_dec_fx( test(); test(); test(); -#ifndef FIX_2547_ALIGN_CONDITIONS_IN_CORE_SW_DEC_EVS - IF( ( st_fx->hBWE_FD != NULL ) && - ( ( NE_16( st_fx->last_extl, SWB_BWE ) && EQ_16( st_fx->extl, SWB_BWE ) ) || ( NE_16( st_fx->last_extl, FB_BWE ) && EQ_16( st_fx->extl, FB_BWE ) ) || ( ( EQ_16( st_fx->last_core, HQ_CORE ) || EQ_16( st_fx->last_extl, SWB_TBE ) ) && st_fx->extl < 0 && NE_16( st_fx->core, HQ_CORE ) ) || ( EQ_16( st_fx->last_core, ACELP_CORE ) && EQ_16( st_fx->core, ACELP_CORE ) && ( ( NE_16( st_fx->prev_coder_type, INACTIVE ) && EQ_16( st_fx->coder_type, INACTIVE ) ) || ( NE_16( st_fx->prev_coder_type, AUDIO ) && EQ_16( st_fx->coder_type, AUDIO ) ) ) && st_fx->bws_cnt > 0 ) ) ) -#else IF( st_fx->hBWE_FD != NULL && ( ( NE_16( st_fx->last_extl, SWB_BWE ) && EQ_16( st_fx->extl, SWB_BWE ) ) || ( NE_16( st_fx->last_extl, FB_BWE ) && EQ_16( st_fx->extl, FB_BWE ) ) || @@ -750,7 +746,6 @@ ivas_error core_switching_post_dec_fx( ( EQ_16( st_fx->last_core, ACELP_CORE ) && EQ_16( st_fx->core, ACELP_CORE ) && NE_16( st_fx->prev_coder_type, INACTIVE ) && NE_16( st_fx->coder_type, INACTIVE ) && st_fx->bws_cnt > 0 ) ) ) ) ) -#endif { set16_fx( hBWE_FD->L_old_wtda_swb_fx, 0, output_frame ); -- GitLab From ee0e3096615aaeab086244266cb119b137199ac2 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 May 2026 17:41:54 +0200 Subject: [PATCH 31/31] formatting --- lib_com/fft_fx.c | 1 - lib_com/rom_com.h | 14 +++++++------- lib_dec/fd_cng_dec_fx.c | 1 - lib_dec/ivas_stereo_dft_dec_fx.c | 2 +- lib_enc/cod_tcx_fx.c | 1 - lib_enc/tcx_ltp_enc_fx.c | 2 +- lib_enc/transient_detection_fx.c | 3 --- lib_rend/ivas_efap_fx.c | 6 +++--- 8 files changed, 12 insertions(+), 18 deletions(-) diff --git a/lib_com/fft_fx.c b/lib_com/fft_fx.c index a6546e6f7..df681306a 100644 --- a/lib_com/fft_fx.c +++ b/lib_com/fft_fx.c @@ -1789,7 +1789,6 @@ static void cdftForw( } - /*-----------------------------------------------------------------* * cftfsub() * Complex Discrete Fourier Transform diff --git a/lib_com/rom_com.h b/lib_com/rom_com.h index 4327464ad..9a2caa064 100644 --- a/lib_com/rom_com.h +++ b/lib_com/rom_com.h @@ -1065,13 +1065,13 @@ extern const Word16 Ip_fft128[10]; // Q0 extern const Word32 w_fft128_16fx[64]; // Q30 extern const Word16 Ip_fft256[10]; // Q0 extern const Word16 Ip_fft512[18]; // Q0 -extern const Word16 Idx_dortft40[40]; // Q0 -extern const Word16 Odx_fft8_5[8]; // Q0 -extern const Word16 ip_edct2_64[6]; // Q0 -extern const Word16 w_edct2_64_fx[80]; /*Q14 */ -extern const Word16 Idx_dortft20[20]; // Q0 -extern const Word16 Odx_fft4_5[4]; // Q0 -extern const Word16 Ip_fft4[6]; // Q0 +extern const Word16 Idx_dortft40[40]; // Q0 +extern const Word16 Odx_fft8_5[8]; // Q0 +extern const Word16 ip_edct2_64[6]; // Q0 +extern const Word16 w_edct2_64_fx[80]; /*Q14 */ +extern const Word16 Idx_dortft20[20]; // Q0 +extern const Word16 Odx_fft4_5[4]; // Q0 +extern const Word16 Ip_fft4[6]; // Q0 /*----------------------------------------------------------------------------------* * FEC for HQ core diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 7cd664338..3aa0562c3 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -200,7 +200,6 @@ void initFdCngDec_fx( } - /* deleteFdCngDec_fx diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index 71e20965f..60bab87f0 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -668,7 +668,7 @@ void stereo_dft_dec_update_fx( } Copy32( hStereoDft->hb_stefi_sig_fx + output_frame, hStereoDft->hb_stefi_sig_fx, hStereoDft->hb_stefi_delay ); /* Qx */ - Copy32( hStereoDft->hb_nrg_fx, hStereoDft->hb_nrg_fx + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); /* q_hb_nrg */ + Copy32( hStereoDft->hb_nrg_fx, hStereoDft->hb_nrg_fx + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); /* q_hb_nrg */ Copy( hStereoDft->q_hb_nrg, hStereoDft->q_hb_nrg + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); Copy32( hStereoDft->td_gain_fx, hStereoDft->td_gain_fx + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); /* q_td_gain */ Copy( hStereoDft->q_td_gain, hStereoDft->q_td_gain + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index 79b7cc60f..d043aeb49 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -1645,7 +1645,6 @@ void QuantizeSpectrum_fx( // sqBits = tcx_scalar_quantization_rateloop_ivas_fx(spectrum_fx, *spectrum_e, sqQ, L_spec, &sqGain_fx, &sqGain_e, st->hTcxCfg->sq_rounding, hTcxEnc->memQuantZeros, prm_lastnz, /* lastnz */ sqTargetBits, &nEncoded, &stop, sqBits_noStop, sqBits, st->hTcxCfg->tcxRateLoopOpt, st->tcxonly, phm_cfg, max_iter, st->element_mode); - IF( ctxHmBits > 0 ) /* Mapping tool is enabled */ { /* Truncate spectrum */ diff --git a/lib_enc/tcx_ltp_enc_fx.c b/lib_enc/tcx_ltp_enc_fx.c index a90bac6a3..8b10a8f9b 100644 --- a/lib_enc/tcx_ltp_enc_fx.c +++ b/lib_enc/tcx_ltp_enc_fx.c @@ -773,7 +773,7 @@ void tcx_ltp_encode_ivas_fx( ELSE { tempFlatness_fx = extract_h( L_shl_sat( ( GetTCXAvgTemporalFlatnessMeasure_ivas_fx( st->hTranDet, NSUBBLOCKS, nPrevSubblocks ) ), 2 ) ); // Q7 - maxEnergyChange_fx = GetTCXMaxenergyChange_fx( st->hTranDet, (const Word8) isTCX10, NSUBBLOCKS, nPrevSubblocks, st->element_mode ); // Q3 + maxEnergyChange_fx = GetTCXMaxenergyChange_fx( st->hTranDet, (const Word8) isTCX10, NSUBBLOCKS, nPrevSubblocks, st->element_mode ); // Q3 } /* Switch LTP on */ diff --git a/lib_enc/transient_detection_fx.c b/lib_enc/transient_detection_fx.c index 24e94941b..f68923d69 100644 --- a/lib_enc/transient_detection_fx.c +++ b/lib_enc/transient_detection_fx.c @@ -207,8 +207,6 @@ static void GetAttackForTCXDecision_fx( } - - /************************************************/ /* */ /* Interface functions */ @@ -809,7 +807,6 @@ static void InitDelayBuffer( } - static void InitSubblockEnergies_fx( const Word16 nFrameLength, const Word16 nDelay, diff --git a/lib_rend/ivas_efap_fx.c b/lib_rend/ivas_efap_fx.c index 9547c70cf..ba8d2eef7 100644 --- a/lib_rend/ivas_efap_fx.c +++ b/lib_rend/ivas_efap_fx.c @@ -135,7 +135,7 @@ ivas_error efap_init_data_fx( error = IVAS_ERR_OK; move32(); -/* Basic init checks */ + /* Basic init checks */ IF( hEFAPdata == NULL ) { return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "pointer to EFAP handle is NULL" ); @@ -757,8 +757,8 @@ static void add_ghost_speakers_fx( Word16 lengthHorGhst; /* Nb of Horizontal Ghost */ Word16 i, j, k, a; /* Integer for loops */ Word16 num_new; /* Number of new vertices to add */ - Word32 newDiff; /* Angle differences that will help us set the extended LS setup */ - Word32 newAzi; /* New azimuth for the new horizontal LS */ + Word32 newDiff; /* Angle differences that will help us set the extended LS setup */ + Word32 newAzi; /* New azimuth for the new horizontal LS */ Word32 ele[EFAP_MAX_SIZE_TMP_BUFF]; Word32 tmpEle; Word32 tmpAzi[EFAP_MAX_SIZE_TMP_BUFF]; -- GitLab