From 55f67372a0a4c8d32599ecd6480ca43a58751e9f Mon Sep 17 00:00:00 2001 From: naghibza Date: Thu, 9 Oct 2025 16:42:13 +0200 Subject: [PATCH 1/2] convert max_band calculation in input of ivas_dirac_config_bands_fx() to fixedpoint. --- lib_com/cnst.h | 8 ++++++-- lib_com/ivas_dirac_com_fx.c | 12 ++++++++++++ lib_com/options.h | 1 + 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/lib_com/cnst.h b/lib_com/cnst.h index 0e1f6dcea..8702ccfac 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -799,9 +799,13 @@ enum #define CLDFB_NO_COL_MAX_SWITCH 6 /* CLDFB resampling - max number of CLDFB col. for switching */ #define CLDFB_NO_COL_MAX_SWITCH_BFI 10 /* CLDFB resampling - max number of CLDFB col. for switching, BFI */ #define CLDFB_OVRLP_MIN_SLOTS 3 /* CLDFB resampling - minimize processing to minimum required for transition frame ACELP->TCX/HQ */ + +#ifndef FIX_FLOATING_POINT_LEFTOVERS #define INV_CLDFB_BANDWIDTH ( 1.f / 800.f ) -#define INV_CLDFB_BANDWIDTH_Q31 ( 2684355l ) -#define INV_CLDFB_BANDWIDTH_MDFT_FAC_Q31 ( 10737418 ) +#endif + +#define INV_CLDFB_BANDWIDTH_Q31 ( 2684355l ) /* ( 1.f / 800.f ) Q31 */ +#define INV_CLDFB_BANDWIDTH_MDFT_FAC_Q31 ( 10737418 ) #define CLDFB_BANDWIDTH 800 #define L_FILT_2OVER3 12 diff --git a/lib_com/ivas_dirac_com_fx.c b/lib_com/ivas_dirac_com_fx.c index 20b04e974..7be684535 100644 --- a/lib_com/ivas_dirac_com_fx.c +++ b/lib_com/ivas_dirac_com_fx.c @@ -218,6 +218,17 @@ ivas_error ivas_dirac_config_fx( } test(); +#ifdef FIX_2085_FLOATING_POINT_LEFTOVERS + IF( EQ_32( ivas_format, SBA_FORMAT ) || EQ_32( ivas_format, SBA_ISM_FORMAT ) ) + { + // 100861_dirac_dec + ivas_dirac_config_bands_fx( band_grouping, IVAS_MAX_NUM_BANDS, extract_l( Mpy_32_32_r( Fs, INV_CLDFB_BANDWIDTH_Q31 ) ), dirac_to_spar_md_bands, hQMetaData->useLowerBandRes, hConfig->enc_param_start_band, hFbMdft, 1 ); + } + ELSE + { + ivas_dirac_config_bands_fx( band_grouping, hConfig->nbands, extract_l( Mpy_32_32_r( Fs, INV_CLDFB_BANDWIDTH_Q31 ) ), NULL, 0, 0, hFbMdft, 1 ); + } +#else IF( EQ_32( ivas_format, SBA_FORMAT ) || EQ_32( ivas_format, SBA_ISM_FORMAT ) ) { // 100861_dirac_dec @@ -227,6 +238,7 @@ ivas_error ivas_dirac_config_fx( { ivas_dirac_config_bands_fx( band_grouping, hConfig->nbands, (Word16) ( Fs * INV_CLDFB_BANDWIDTH + 0.5f ), NULL, 0, 0, hFbMdft, 1 ); } +#endif return error; } diff --git a/lib_com/options.h b/lib_com/options.h index a7fdd482f..10140324e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -112,6 +112,7 @@ #define FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE /* Dolby/FhG: fix for issue 2026: Saturation in SWB TBE re-scaling function preventing StereoDownmix complexity job to complete */ #define FIX_2021_BANDWIDTH_EXTENSION_PROBLEM /* FhG: increase cldfb buffer precision*/ +#define FIX_2085_FLOATING_POINT_LEFTOVERS /* FhG: convert floating-point leftovers in ivas_dirac_config_fx() */ /* #################### Start BASOP porting switches ############################ */ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ -- GitLab From 59af466ed177e61dbae5bc59b90f8572f01614ae Mon Sep 17 00:00:00 2001 From: naghibza Date: Thu, 9 Oct 2025 17:00:27 +0200 Subject: [PATCH 2/2] add FIX_2085_FLOATING_POINT_LEFTOVERS to cnst.h --- lib_com/cnst.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/cnst.h b/lib_com/cnst.h index 8702ccfac..a608fd607 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -800,7 +800,7 @@ enum #define CLDFB_NO_COL_MAX_SWITCH_BFI 10 /* CLDFB resampling - max number of CLDFB col. for switching, BFI */ #define CLDFB_OVRLP_MIN_SLOTS 3 /* CLDFB resampling - minimize processing to minimum required for transition frame ACELP->TCX/HQ */ -#ifndef FIX_FLOATING_POINT_LEFTOVERS +#ifndef FIX_2085_FLOATING_POINT_LEFTOVERS #define INV_CLDFB_BANDWIDTH ( 1.f / 800.f ) #endif -- GitLab