From 010a721cb3c58fb603a70b773f6c495cd59d79f1 Mon Sep 17 00:00:00 2001 From: advasila Date: Mon, 4 Sep 2023 15:48:18 +0300 Subject: [PATCH 1/2] fix coherence crash --- lib_com/ivas_cnst.h | 4 ++++ lib_com/options.h | 2 +- lib_dec/ivas_qmetadata_dec.c | 21 ++++++++++++++++++--- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 91bf07a9ff..ec8674238c 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1187,7 +1187,11 @@ enum #define QMETADATA_MAXBIT_REQ_MASA 900 /* max bit-bit/direction for avoiding requantization in MASA path */ #define QMETADATA_MAXBIT_REQ_SBA 400 /* max bit-bit/direction for avoiding requantization in SBA path */ +#ifdef NONBE_FIX_760_COHERENCE_MASA +#define MASA_COH_LIMIT_2IDX 96 /* limit for sum of values across components for having two joint indexes */ +#else #define MASA_COH_LIMIT_2IDX 144 /* limit for sum of values across components for having two joint indexes */ +#endif #define QMETADATA_MAX_NO_DIRECTIONS 2 #define MASA_MAX_BITS 1300 /* max. bit-budget for MASA metadata */ diff --git a/lib_com/options.h b/lib_com/options.h index d945683e41..42476a6cf0 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -167,7 +167,7 @@ #define NONBE_FIX_736_FOA_BR_SWITCH /* FhG/Dlb : Issue 736: FOA bitrate switching decoding crashes in in ivas_spar_to_dirac */ #define NONBE_FIX_746_NONDIEGETIC_MD /* Eri: Issue 746: The non-diegetic panning flag affects the encoder bitstream even if extended metadata is not enabled. Crashes the decoder.*/ - +#define NONBE_FIX_760_COHERENCE_MASA /* Nokia: Issue 760: fixes decoder crash for some cases when all energy ratios are 1 */ /* ##################### End NON-BE switches ############################# */ /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index d5ef4c81c0..f949a16dec 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -3774,9 +3774,13 @@ static int16_t read_coherence_data( uint16_t byteBuffer; int16_t idx_ER; int16_t min_index; - +#ifdef NONBE_FIX_760_COHERENCE_MASA + int16_t extra_cv; +#endif coding_subbands = hQMetaData->q_direction[idx_dir].cfg.nbands; - +#ifdef NONBE_FIX_760_COHERENCE_MASA + extra_cv = (int16_t) ( coding_subbands / MASA_FACTOR_CV_COH ); +#endif q_direction = &( hQMetaData->q_direction[idx_dir] ); bit_pos = *p_bit_pos; nbits = 0; @@ -3787,12 +3791,19 @@ static int16_t read_coherence_data( { if ( hrmasa_flag ) { +#ifdef NONBE_FIX_760_COHERENCE_MASA + idx_ER = 7 - ( q_direction->band_data[j].energy_ratio_index_mod[0] >> 1 ) + extra_cv; +#else idx_ER = 7 - ( q_direction->band_data[j].energy_ratio_index_mod[0] >> 1 ) + coding_subbands / MASA_FACTOR_CV_COH; +#endif } else { - +#ifdef NONBE_FIX_760_COHERENCE_MASA + idx_ER = 7 - q_direction->band_data[j].energy_ratio_index_mod[0] + extra_cv; +#else idx_ER = 7 - q_direction->band_data[j].energy_ratio_index_mod[0] + coding_subbands / MASA_FACTOR_CV_COH; +#endif } no_cv_vec[j] = idx_ER + 1; } @@ -3812,7 +3823,11 @@ static int16_t read_coherence_data( if ( byteBuffer & 1 ) { /* decode GR min removed */ +#ifdef NONBE_FIX_760_COHERENCE_MASA + nbits += read_GR_min_removed_data( bitstream, &bit_pos, no_cv_vec, coding_subbands, decoded_idx, MASA_MAX_NO_CV_SUR_COH + extra_cv ); +#else nbits += read_GR_min_removed_data( bitstream, &bit_pos, no_cv_vec, coding_subbands, decoded_idx, MASA_MAX_NO_CV_SUR_COH ); +#endif for ( j = 0; j < coding_subbands; j++ ) { if ( no_cv_vec[j] > 1 ) -- GitLab From 3280495d20a029e82201a96d45e6b2d53851254f Mon Sep 17 00:00:00 2001 From: advasila Date: Tue, 5 Sep 2023 16:17:25 +0300 Subject: [PATCH 2/2] align switches --- lib_com/options.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index a34cb85e84..80a3603feb 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -167,8 +167,6 @@ #define NONBE_FIX_736_FOA_BR_SWITCH /* FhG/Dlb : Issue 736: FOA bitrate switching decoding crashes in in ivas_spar_to_dirac */ #define NONBE_FIX_746_NONDIEGETIC_MD /* Eri: Issue 746: The non-diegetic panning flag affects the encoder bitstream even if extended metadata is not enabled. Crashes the decoder.*/ #define NONBE_FIX_729_ASAN_2ISM_ACELP /* VA: issue 729: fix ASAN ACELP errors with 2 ISM coding using LTV */ - - #define NONBE_FIX_760_COHERENCE_MASA /* Nokia: Issue 760: fixes decoder crash for some cases when all energy ratios are 1 */ /* ##################### End NON-BE switches ############################# */ -- GitLab