diff --git a/lib_com/options.h b/lib_com/options.h index 8a491e2499bd71b273c0b4360859c8629157da06..3a4a9e926f48239e7e3e1057b6918aa540d6f70c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -209,6 +209,8 @@ #define FIX_468_16KHZ_PUPMIX /* Dlb: Fix issue 468 for Param Upmix at 16kHz sampling rate */ #define FIX_499_DFT_STEREO_PLC /* Eri: Fix for issue 499: Wrong past memory addressed for computing energy of DFT stereo residual ECU frame */ #define FIX_489_COV_SMOOTHING /* Dlb: Fix covariance smoothing for ParamUpmix */ +#define FIX_501_TABLE_IDX_INIT /* Dlb: Fix for the issue 501 */ + #define FIX_485_STATIC_BUFFERS /* FhG: move static buffers in DirAC parameter estimator to the DirAC struct */ #define FIX_I503_ASAN_ERROR_IND_LIST /* VA: fix issue #503: address sanitizer error with IND_LIST_DYN */ #define FIX_473_JITTER_NONDIEGETIC_PANNING /* FhG,Orange: add missing non-diegetic panning to JITTER */ diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 0d028b2359a02451262458da285d2d94126e103b..f3fd5ed04cd67273b17fcfebfaf3113563bb189e 100755 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -123,7 +123,14 @@ ivas_error ivas_spar_dec_open( return error; } hSpar->hMdDec->td_decorr_flag = 1; +#ifdef FIX_501_TABLE_IDX_INIT + if ( hSpar->hTdDecorr ) + { + hSpar->hTdDecorr->ducking_flag = ivas_spar_br_table_consts[hSpar->hMdDec->table_idx].td_ducking; + } +#else hSpar->hMdDec->table_idx = -1; +#endif /* set FB config. */ active_w_mixing = -1; diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index cf03e7b9d849ac4bdc232cdfee206a5e34a7f419..03f014ecfdc005f2b708eb474f5a2748e3c932a5 100755 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -83,9 +83,11 @@ static ivas_error ivas_spar_set_dec_config( ivas_spar_md_dec_state_t *hMdDec, co static void ivas_parse_parameter_bitstream_dtx( ivas_spar_md_t *pSpar_md, Decoder_State *st, const int16_t bw, const int16_t num_bands, int16_t *num_dmx_per_band, int16_t *num_dec_per_band ); static ivas_error ivas_deindex_real_index( const int16_t *index, const int16_t q_levels, const float min_value, const float max_value, float *quant, const int16_t num_ch_dim2 ); - +#ifdef FIX_501_TABLE_IDX_INIT +static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, int16_t *nB, int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, const int16_t use_planar_coeff, const int16_t sba_inactive_mode, const int32_t last_active_brate ); +#else static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, int16_t *nB, int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, const int16_t use_planar_coeff, const int16_t sba_inactive_mode ); - +#endif /*------------------------------------------------------------------------- * ivas_spar_md_dec_matrix_open() @@ -289,11 +291,29 @@ ivas_error ivas_spar_md_dec_open( return error; } +#ifdef FIX_501_TABLE_IDX_INIT + if ( hDecoderConfig->ivas_total_brate == IVAS_SID_5k2 ) + { + if ( sid_format == SID_SBA_2TC ) + { + hMdDec->table_idx = ivas_get_spar_table_idx( IVAS_48k, sba_order, SPAR_CONFIG_BW, NULL, NULL ); + } + else + { + hMdDec->table_idx = ivas_get_spar_table_idx( IVAS_24k4, sba_order, SPAR_CONFIG_BW, NULL, NULL ); + } + } + else + { + hMdDec->table_idx = ivas_get_spar_table_idx( hDecoderConfig->ivas_total_brate, sba_order, SPAR_CONFIG_BW, NULL, NULL ); + } +#else hMdDec->table_idx = 0; /* just to initialize state variables*/ if ( ( hDecoderConfig->ivas_total_brate == IVAS_SID_5k2 ) && ( sid_format == SID_SBA_2TC ) ) { hMdDec->table_idx = ivas_get_spar_table_idx( IVAS_48k, sba_order, SPAR_CONFIG_BW, NULL, NULL ); } +#endif if ( ( error = ivas_spar_md_dec_init( hMdDec, hDecoderConfig, num_channels, sba_order ) ) != IVAS_ERR_OK ) { return error; @@ -671,7 +691,12 @@ void ivas_spar_md_dec_process( ivas_spar_dec_parse_md_bs( hMdDec, st0, &nB, &bw, &dtx_vad, st_ivas->hDecoderConfig->ivas_total_brate, - ivas_spar_br_table_consts[hMdDec->table_idx].usePlanarCoeff, st_ivas->hQMetaData->sba_inactive_mode ); + ivas_spar_br_table_consts[hMdDec->table_idx].usePlanarCoeff, st_ivas->hQMetaData->sba_inactive_mode +#ifdef FIX_501_TABLE_IDX_INIT + , + st_ivas->last_active_ivas_total_brate +#endif + ); #if 0 { @@ -1707,7 +1732,12 @@ static void ivas_spar_dec_parse_md_bs( int16_t *dtx_vad, const int32_t ivas_total_brate, const int16_t use_planar_coeff, - const int16_t sba_inactive_mode ) + const int16_t sba_inactive_mode +#ifdef FIX_501_TABLE_IDX_INIT + , + const int32_t last_active_brate +#endif +) { int16_t i, j, k, num_bands; int16_t ii, jj, ndec, ndm, b, idx; @@ -1718,6 +1748,9 @@ static void ivas_spar_dec_parse_md_bs( int16_t planarCP; float quant[IVAS_SPAR_MAX_C_COEFF]; int16_t do_repeat[IVAS_MAX_NUM_BANDS]; +#ifdef FIX_501_TABLE_IDX_INIT + int16_t bw_final, bw_fact; +#endif *dtx_vad = 1; *bands_bw = 1; @@ -1790,13 +1823,33 @@ static void ivas_spar_dec_parse_md_bs( ivas_parse_parameter_bitstream_dtx( &hMdDec->spar_md, st0, *bands_bw, *nB, hMdDec->spar_md_cfg.num_dmx_chans_per_band, hMdDec->spar_md_cfg.num_decorr_per_band ); + +#ifdef FIX_501_TABLE_IDX_INIT + if ( last_active_brate >= IVAS_24k4 ) + { + bw_final = 1; + } + else + { + bw_final = 2; + } + bw_fact = *bands_bw / bw_final; +#endif for ( i = *nB - 1; i >= 0; i-- ) { +#ifdef FIX_501_TABLE_IDX_INIT + ndec = hMdDec->spar_md_cfg.num_decorr_per_band[bw_fact * i]; + + for ( b = bw_fact - 1; b >= 0; b-- ) + { + idx = i * bw_fact + b; +#else ndec = hMdDec->spar_md_cfg.num_decorr_per_band[( *bands_bw ) * i]; for ( b = *bands_bw - 1; b >= 0; b-- ) { idx = i * *bands_bw + b; +#endif for ( j = 0; j < FOA_CHANNELS - 1; j++ ) { hMdDec->spar_md.band_coeffs[idx].pred_re[j] = hMdDec->spar_md.band_coeffs[i].pred_re[j]; @@ -1809,8 +1862,13 @@ static void ivas_spar_dec_parse_md_bs( } } +#ifdef FIX_501_TABLE_IDX_INIT + *bands_bw = bw_final; + *nB = num_bands / bw_final; +#else *nB = num_bands; *bands_bw = 1; +#endif return; }