From 21263d0b9af15051fa8b27ae0f804b43441b29b2 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Thu, 15 Jan 2026 13:41:32 +0200 Subject: [PATCH] Fix float issue 1501 by adding a skip if number of two dir bands is zero. --- lib_com/options.h | 1 + lib_enc/ivas_masa_enc.c | 29 ++++++++++++++++++----------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index ead3299785..7c9ac82c60 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -169,6 +169,7 @@ #define FIX_1479_MSAN_SPAR_UNINITIALIZED_VALUE /* Dolby: Fix for issue 1479, MSAN error due to uninitialized value in SPAR */ #define REMOVE_UNUSED_CODE_IVAS_DEC /* VA: remove unused code in ivas_jbm_dec_tc_fx() */ #define REMOVE_CAM_FROM_IVAS /* VA: basop issue 210: remove obsoelte CAM code from IVAS */ +#define FIX_FLOAT_1501_UNIT_VALUE_IN_OMASA /* Nokia: Fix float issue 1501, uninitialized value in ivas_masa_combine_directions for OMASA */ /* #################### End BE switches ################################## */ diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 0da38f8e2e..fb855326e2 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -1232,22 +1232,29 @@ void ivas_masa_combine_directions( } } - /* Estimate the importance of having two directions instead of one */ - for ( i = 0; i < numCodingBands; i++ ) +#ifdef FIX_FLOAT_1501_UNIT_VALUE_IN_OMASA + if ( hMasa->config.numTwoDirBands > 0 ) { - importance[i] = 0.0f; - for ( j = 0; j < numSf; j++ ) +#endif + /* Estimate the importance of having two directions instead of one */ + for ( i = 0; i < numCodingBands; i++ ) { - tempImportance = hMeta->directional_meta[0].energy_ratio[j][i] + hMeta->directional_meta[1].energy_ratio[j][i] - sumVecLen[j][i]; - importance[i] += tempImportance; + importance[i] = 0.0f; + for ( j = 0; j < numSf; j++ ) + { + tempImportance = hMeta->directional_meta[0].energy_ratio[j][i] + hMeta->directional_meta[1].energy_ratio[j][i] - sumVecLen[j][i]; + importance[i] += tempImportance; + } + importance[i] /= (float) numSf; + importance[i] *= hMasa->data.importanceWeight[i]; } - importance[i] /= (float) numSf; - importance[i] *= hMasa->data.importanceWeight[i]; - } - /* Determine bands where to use two directions */ - find_n_largest( importance, indicesOfLargest, numCodingBands, hMasa->config.numTwoDirBands ); + /* Determine bands where to use two directions */ + find_n_largest( importance, indicesOfLargest, numCodingBands, hMasa->config.numTwoDirBands ); +#ifdef FIX_FLOAT_1501_UNIT_VALUE_IN_OMASA + } +#endif for ( i = 0; i < numCodingBands; i++ ) { hMasa->data.twoDirBands[i] = 0; -- GitLab