diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 91bf07a9ff08d6ebce11dc12e05139800c50eb50..ec8674238c8310e957333d77e602bb331474b8c6 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 bb7652a6a274fff01ff23ae6632104db970079be..32992f858cce30fa40d629832247cd3751b7f4a4 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -168,7 +168,7 @@ #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_694_OMASA_ACELP /* Nokia: Issue #694: OMASA crash in ACELP with extreme item */ - +#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 d5ef4c81c0f93a3567282ffc5342e8e8a625cb82..f949a16decbc11c75c22dda1c14f4601e3a7985b 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 )