From f7d3da918b4dc6ed4f5edb44b7fc544d55208fb2 Mon Sep 17 00:00:00 2001 From: Adriana Vasilache Date: Mon, 28 Oct 2024 20:04:32 +0200 Subject: [PATCH] fix 982 --- lib_com/options.h | 2 +- lib_dec/ivas_masa_dec.c | 6 ++++++ lib_dec/ivas_qmetadata_dec.c | 11 +++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index f1023d3b6..3ff81cd74 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -194,7 +194,7 @@ #define NONBE_FIX_943_PORT_1208_DFT_STEREO_PLC_BURST /* Ericsson: BASOP Issue 943, Float Issue 1208, fix for overflow of sample offset counter for burst error in DFT Stereo PLC. */ #define FIX_853_DECODE_MASA_ISM_AZIMUTH_PREC /* Nokia: Fixes ivas_decode_masaism_metadata decision logic change due to precision difference; needs corresponding fix in floating point */ #define FIX_953_WRONG_ENERGY_RATIO_MASA_EXT /* Nok: Fix 953 wrong energy ratio value after shift and cast to Word8 */ - +#define FIX_982_WRONG_DECODED_ENERGY_RATIO /* Nokia: Fix 982 wrong energy in EXT mode and in second direction when present */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index f3962ced2..da6d2360e 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -4377,6 +4377,12 @@ static void create_masa_ext_out_meta_fx( { FOR( b_new = bandMap[b_old]; b_new < bandMap[b_old + 1]; b_new++ ) { +#ifdef FIX_982_WRONG_DECODED_ENERGY_RATIO + IF( EQ_32( hQMetaData->q_direction[dir].band_data[b_old].energy_ratio_fx[sf], ONE_IN_Q30 ) ) + { + hQMetaData->q_direction[dir].band_data[b_old].energy_ratio_fx[sf]--; + } +#endif UWord8 tmp = (UWord8) L_shr( hQMetaData->q_direction[dir].band_data[b_old].energy_ratio_fx[sf], Q30 - 8 ); // Q8 move16(); extOutMeta->directToTotalRatio[dir][sf][b_new] = tmp; // Q8 diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index f213a059d..2e17020cd 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -1725,6 +1725,16 @@ Word16 ivas_qmetadata_dec_decode_hr_384_512( IF( EQ_32( hQMetaData->no_directions, 2 ) ) { #ifdef MSAN_FIX +#ifdef FIX_982_WRONG_DECODED_ENERGY_RATIO + FOR( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) + { + FOR( m = 0; m < hQMetaData->q_direction[0].cfg.nblocks; m++ ) + { + hQMetaData->q_direction[1].band_data[b].energy_ratio_fx[m] = W_round64_L( W_nrg_ratio[1][b][m] ); /*Q30*/ + move32(); + } + } +#else FOR( b = 0; b < hQMetaData->q_direction[1].cfg.nbands; b++ ) { FOR( m = 0; m < hQMetaData->q_direction[1].cfg.nblocks; m++ ) @@ -1733,6 +1743,7 @@ Word16 ivas_qmetadata_dec_decode_hr_384_512( move32(); } } +#endif #else FOR( b = 0; b < MASA_MAXIMUM_CODING_SUBBANDS; b++ ) { -- GitLab