From e24b12dc60251fa6735bafddda21f6af5800ae25 Mon Sep 17 00:00:00 2001 From: Adriana Vasilache Date: Wed, 21 Aug 2024 07:25:45 +0300 Subject: [PATCH 1/3] update fix 819 --- lib_com/ivas_cnst.h | 4 +++- lib_dec/ivas_qmetadata_dec.c | 12 ++++++++++++ lib_enc/ivas_qmetadata_enc.c | 4 ++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 58e8d441b..47f719ef3 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1223,7 +1223,9 @@ enum #define NO_BITS_MASA_ISM_NO_OBJ 2 #ifdef IVAS_FLOAT_FIXED #ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL -#define MASA2TOTAL_THR 0.9799999f +#define MASA2TOTAL_PREC_THRESHOLD 1e-5f //3.051757812500e-05 +#define MASA2TOTAL_PREC_INV_THRESHOLD 1e5f //32768.0f +#define MASA2TOTAL_THR 0.979999f #else #define MASA2TOTAL_THR 0.98f #endif diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index c80e1dbfb..a46a2b0b0 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -8711,6 +8711,10 @@ void ivas_omasa_decode_masa_to_total_fx( move32(); masa_to_total_energy_ratio_fx[i][j] = L_min( ONE_IN_Q30, masa_to_total_energy_ratio_fx[i][j] ); move32(); +#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL1 + masa_to_total_energy_ratio_fx[i][j] = masa_to_total_energy_ratio_fx[i][j] >> 15; /* Q30 to reach the Q10 used before comparing with threshold*/ + masa_to_total_energy_ratio_fx[i][j] = masa_to_total_energy_ratio_fx[i][j] << 15; +#endif k = add( k, 1 ); } } @@ -8722,6 +8726,10 @@ void ivas_omasa_decode_masa_to_total_fx( FOR( j = 0; j < nbands; j++ ) { masa_to_total_energy_ratio_fx[i][j] = masa_to_total_energy_ratio_fx[0][j]; +#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL1 + masa_to_total_energy_ratio_fx[i][j] = masa_to_total_energy_ratio_fx[i][j] >> 15; /* Q30 to reach the Q10 used before comparing with threshold*/ + masa_to_total_energy_ratio_fx[i][j] = masa_to_total_energy_ratio_fx[i][j] << 15; +#endif move32(); } } @@ -8734,6 +8742,10 @@ void ivas_omasa_decode_masa_to_total_fx( FOR( i = 0; i < nblocks; i++ ) { masa_to_total_energy_ratio_fx[i][j] = masa_to_total_energy_ratio_fx[i][0]; +#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL1 + masa_to_total_energy_ratio_fx[i][j] = masa_to_total_energy_ratio_fx[i][j] >> 15; /* Q30 to reach the Q10 used before comparing with threshold*/ + masa_to_total_energy_ratio_fx[i][j] = masa_to_total_energy_ratio_fx[i][j] << 15; +#endif move32(); } } diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index e0a8fdeb1..131297789 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -7808,8 +7808,8 @@ void ivas_omasa_encode_masa_to_total( masa_to_total_energy_ratio[i][j] = max( 0.0f, q_dct_data[k] ); masa_to_total_energy_ratio[i][j] = min( 1.0f, masa_to_total_energy_ratio[i][j] ); #ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL - int_tmp = (int32_t) ( MASA_SUR_COH_PRECISION * masa_to_total_energy_ratio[i][j] ); - masa_to_total_energy_ratio[i][j] = (float) ( int_tmp * MASA_SUR_COH_THRESHOLD ); + int_tmp = (int32_t) (( MASA2TOTAL_PREC_INV_THRESHOLD * masa_to_total_energy_ratio[i][j] )); + masa_to_total_energy_ratio[i][j] = (float) ( int_tmp * MASA2TOTAL_PREC_THRESHOLD ); #endif k++; } -- GitLab From e334b2d9b8114cc6fae8494b6259d45a3b4a3df2 Mon Sep 17 00:00:00 2001 From: Adriana Vasilache Date: Wed, 21 Aug 2024 09:27:03 +0300 Subject: [PATCH 2/3] fix 819 update 2 --- lib_dec/ivas_qmetadata_dec.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 2da6fc614..fb03044d9 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -8719,9 +8719,9 @@ void ivas_omasa_decode_masa_to_total_fx( move32(); masa_to_total_energy_ratio_fx[i][j] = L_min( ONE_IN_Q30, masa_to_total_energy_ratio_fx[i][j] ); move32(); -#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL1 - masa_to_total_energy_ratio_fx[i][j] = masa_to_total_energy_ratio_fx[i][j] >> 15; /* Q30 to reach the Q10 used before comparing with threshold*/ - masa_to_total_energy_ratio_fx[i][j] = masa_to_total_energy_ratio_fx[i][j] << 15; +#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL + masa_to_total_energy_ratio_fx[i][j] = masa_to_total_energy_ratio_fx[i][j] >> 13; /* Q30 to reach the Q17 used before comparing with threshold*/ + masa_to_total_energy_ratio_fx[i][j] = masa_to_total_energy_ratio_fx[i][j] << 13; #endif k = add( k, 1 ); } @@ -8734,9 +8734,9 @@ void ivas_omasa_decode_masa_to_total_fx( FOR( j = 0; j < nbands; j++ ) { masa_to_total_energy_ratio_fx[i][j] = masa_to_total_energy_ratio_fx[0][j]; -#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL1 - masa_to_total_energy_ratio_fx[i][j] = masa_to_total_energy_ratio_fx[i][j] >> 15; /* Q30 to reach the Q10 used before comparing with threshold*/ - masa_to_total_energy_ratio_fx[i][j] = masa_to_total_energy_ratio_fx[i][j] << 15; +#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL + masa_to_total_energy_ratio_fx[i][j] = masa_to_total_energy_ratio_fx[i][j] >> 13; /* Q30 to reach the Q17 used before comparing with threshold*/ + masa_to_total_energy_ratio_fx[i][j] = masa_to_total_energy_ratio_fx[i][j] << 13; #endif move32(); } @@ -8750,9 +8750,9 @@ void ivas_omasa_decode_masa_to_total_fx( FOR( i = 0; i < nblocks; i++ ) { masa_to_total_energy_ratio_fx[i][j] = masa_to_total_energy_ratio_fx[i][0]; -#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL1 - masa_to_total_energy_ratio_fx[i][j] = masa_to_total_energy_ratio_fx[i][j] >> 15; /* Q30 to reach the Q10 used before comparing with threshold*/ - masa_to_total_energy_ratio_fx[i][j] = masa_to_total_energy_ratio_fx[i][j] << 15; +#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL + masa_to_total_energy_ratio_fx[i][j] = masa_to_total_energy_ratio_fx[i][j] >> 13; /* Q30 to reach the Q17 used before comparing with threshold*/ + masa_to_total_energy_ratio_fx[i][j] = masa_to_total_energy_ratio_fx[i][j] << 13; #endif move32(); } -- GitLab From dd3cccdf79178385d3d380894313cd308a2aebec Mon Sep 17 00:00:00 2001 From: Adriana Vasilache Date: Sat, 24 Aug 2024 15:04:56 +0300 Subject: [PATCH 3/3] fix clang --- lib_enc/ivas_qmetadata_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 131297789..edf85f345 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -7808,7 +7808,7 @@ void ivas_omasa_encode_masa_to_total( masa_to_total_energy_ratio[i][j] = max( 0.0f, q_dct_data[k] ); masa_to_total_energy_ratio[i][j] = min( 1.0f, masa_to_total_energy_ratio[i][j] ); #ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL - int_tmp = (int32_t) (( MASA2TOTAL_PREC_INV_THRESHOLD * masa_to_total_energy_ratio[i][j] )); + int_tmp = (int32_t) ( ( MASA2TOTAL_PREC_INV_THRESHOLD * masa_to_total_energy_ratio[i][j] ) ); masa_to_total_energy_ratio[i][j] = (float) ( int_tmp * MASA2TOTAL_PREC_THRESHOLD ); #endif k++; -- GitLab