diff --git a/lib_com/options.h b/lib_com/options.h index b76f0275aa2732495600f2f90abc204254cbd806..1b811a39f8e827c291b37ed61c30dac22a645e3f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -106,6 +106,7 @@ #define HARM_NON_LINEARITY /* VA: basop issue 2345: Remove duplicated code in core-coder: non_linearity_fx() and LP CNG */ #define FIX_2344_ALIGN_PREPROC /* VA: basop issue 2344: Align pre_proc_ivas() between FLP and BASOP */ #define FIX_2334_HARM_CODER_MODIF /* VA: basop issue 2334 : harmonizing coder_modif_function */ +#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_fx.c b/lib_enc/ivas_masa_enc_fx.c index ef6514e639c77ac3ce104b025e9355582d2f3fc9..0cdad4d9285c5f70b8440640e2b541504e0709e3 100644 --- a/lib_enc/ivas_masa_enc_fx.c +++ b/lib_enc/ivas_masa_enc_fx.c @@ -1800,33 +1800,41 @@ void ivas_masa_combine_directions_fx( } } - /* Estimate the importance of having two directions instead of one */ - /* Reduced precision of importance_fx intentionally to Q13 to maintatin 0.0001f resolution */ - FOR( i = 0; i < numCodingBands; i++ ) +#ifdef FIX_FLOAT_1501_UNIT_VALUE_IN_OMASA + IF( GT_16( hMasa->config.numTwoDirBands, 0 ) ) { - importance_fx[i] = 0; - move32(); - FOR( j = 0; j < numSf; j++ ) +#endif + /* Estimate the importance of having two directions instead of one */ + /* Reduced precision of importance_fx intentionally to Q13 to maintatin 0.0001f resolution */ + FOR( i = 0; i < numCodingBands; i++ ) { - tempImportance_fx = L_shr( L_add( hMeta->directional_meta[0].energy_ratio_fx[j][i], hMeta->directional_meta[1].energy_ratio_fx[j][i] ), Q30 - Q13 ); // Q13 - tempImportance_fx = L_sub( tempImportance_fx, L_shr( sumVecLen_fx[j][i], sub( sub( Q31, exp_sumVecLen ), Q13 ) ) ); // Q13 - importance_fx[i] = L_add( importance_fx[i], tempImportance_fx ); // Q13 + importance_fx[i] = 0; move32(); - } + FOR( j = 0; j < numSf; j++ ) + { + tempImportance_fx = L_shr( L_add( hMeta->directional_meta[0].energy_ratio_fx[j][i], hMeta->directional_meta[1].energy_ratio_fx[j][i] ), Q30 - Q13 ); // Q13 + tempImportance_fx = L_sub( tempImportance_fx, L_shr( sumVecLen_fx[j][i], sub( sub( Q31, exp_sumVecLen ), Q13 ) ) ); // Q13 + importance_fx[i] = L_add( importance_fx[i], tempImportance_fx ); // Q13 + move32(); + } - IF( NE_16( numSf, 1 ) ) - { - importance_fx[i] = L_shr( importance_fx[i], 2 ); // Q13 + IF( NE_16( numSf, 1 ) ) + { + importance_fx[i] = L_shr( importance_fx[i], 2 ); // Q13 + move32(); + } + importance_fx[i] = Mpy_32_32( importance_fx[i], hMasa->data.importanceWeight_fx[i] ); //(Q13, Q30) -> Q12 move32(); } - importance_fx[i] = Mpy_32_32( importance_fx[i], hMasa->data.importanceWeight_fx[i] ); //(Q13, Q30) -> Q12 - move32(); + exp_importance = Q31 - Q12; + move16(); + + /* Determine bands where to use two directions */ + find_n_largest_fx( importance_fx, exp_importance, indicesOfLargest, numCodingBands, hMasa->config.numTwoDirBands ); +#ifdef FIX_FLOAT_1501_UNIT_VALUE_IN_OMASA } - exp_importance = Q31 - Q12; - move16(); - /* Determine bands where to use two directions */ - find_n_largest_fx( importance_fx, exp_importance, indicesOfLargest, numCodingBands, hMasa->config.numTwoDirBands ); +#endif FOR( i = 0; i < numCodingBands; i++ ) {