From fa733b1b898c4fb393a949d98226968630d84f3e Mon Sep 17 00:00:00 2001 From: rhb Date: Fri, 5 May 2023 16:06:38 +0200 Subject: [PATCH 1/2] complexity optimization for adaptive smoothing --- lib_com/options.h | 2 ++ lib_dec/ivas_spar_decoder.c | 8 ++++++++ lib_dec/ivas_spar_md_dec.c | 8 ++++++++ lib_dec/ivas_stat_dec.h | 5 +++++ 4 files changed, 23 insertions(+) mode change 100644 => 100755 lib_com/options.h mode change 100644 => 100755 lib_dec/ivas_spar_decoder.c mode change 100644 => 100755 lib_dec/ivas_spar_md_dec.c mode change 100644 => 100755 lib_dec/ivas_stat_dec.h diff --git a/lib_com/options.h b/lib_com/options.h old mode 100644 new mode 100755 index d841a798e2..a9a0229876 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -167,11 +167,13 @@ #define FIX_427_MAXIMUM_S_INDEX /* VA: issue 427: fix return index of function maximum_s() */ #define FIX_431_PARAMMC_PLC_INTERPOLATOR /* FhG: Issue 431: fix missing interpolator reset for ParamMC PCL */ #define FIX_391_SBA /* Dlb: Fix for issue 391 for SBA */ +#define LBR_ADAP_SMOOTHING_OPT /* FhG: complexity optimization of adaptive smoothing in low-bitrate SBA */ #define FIX_425_MASA_BRSW_RENDERER /* Nokia: Issue 425: renderer not reconfigure in MASA bitrate switching */ #define EUALER2QUAT_FIX /*Dlb :fix for issue 430 issue in euler2quat, sign of quat y is inverted*/ #define HR_METADATA /* Nok: encode directional MASA metadata with more bits at 384k and 512k */ + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c old mode 100644 new mode 100755 index f0588ae303..1613354244 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -1176,10 +1176,14 @@ void ivas_spar_dec_upmixer( if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == AUDIO_CONFIG_HOA3 ) ) ) { +#ifdef LBR_ADAP_SMOOTHING_OPT + ivas_spar_calc_smooth_facs( cldfb_in_ts_re[0], cldfb_in_ts_im[0], num_spar_bands, &hSpar->hFbMixer->pFb->fb_bin_to_band, hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_buf ); +#else for ( in_ch = 0; in_ch < numch_in; in_ch++ ) { ivas_spar_calc_smooth_facs( cldfb_in_ts_re[in_ch], cldfb_in_ts_im[in_ch], num_spar_bands, &hSpar->hFbMixer->pFb->fb_bin_to_band, hSpar->hMdDec->smooth_fac[in_ch], hSpar->hMdDec->smooth_buf[in_ch] ); } +#endif } for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) @@ -1195,7 +1199,11 @@ void ivas_spar_dec_upmixer( { for ( in_ch = 0; in_ch < numch_in; in_ch++ ) { +#ifdef LBR_ADAP_SMOOTHING_OPT + mixer_mat[out_ch][in_ch][spar_band] = ( 1 - hSpar->hMdDec->smooth_fac[spar_band] ) * mixer_mat[out_ch][in_ch][spar_band] + hSpar->hMdDec->smooth_fac[spar_band] * hSpar->hMdDec->mixer_mat_prev2[out_ch][in_ch][spar_band]; +#else mixer_mat[out_ch][in_ch][spar_band] = ( 1 - hSpar->hMdDec->smooth_fac[in_ch][spar_band] ) * mixer_mat[out_ch][in_ch][spar_band] + hSpar->hMdDec->smooth_fac[in_ch][spar_band] * hSpar->hMdDec->mixer_mat_prev2[out_ch][in_ch][spar_band]; +#endif hSpar->hMdDec->mixer_mat_prev2[out_ch][in_ch][spar_band] = mixer_mat[out_ch][in_ch][spar_band]; } } diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c old mode 100644 new mode 100755 index 1552734434..6c37db1d2d --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -536,6 +536,13 @@ ivas_error ivas_spar_md_dec_init( set_f( hMdDec->spar_md.en_ratio_slow, 0.0f, IVAS_MAX_NUM_BANDS ); set_f( hMdDec->spar_md.ref_pow_slow, 0.0f, IVAS_MAX_NUM_BANDS ); +#ifdef LBR_ADAP_SMOOTHING_OPT + set_zero( hMdDec->smooth_fac, IVAS_MAX_NUM_BANDS ); + for ( i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) + { + set_zero( hMdDec->smooth_buf[i], 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); + } +#else for ( i = 0; i < IVAS_SPAR_MAX_CH; i++ ) { set_zero( hMdDec->smooth_fac[i], IVAS_MAX_NUM_BANDS ); @@ -547,6 +554,7 @@ ivas_error ivas_spar_md_dec_init( set_zero( hMdDec->smooth_buf[i][j], 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); } } +#endif for ( i = 0; i < IVAS_SPAR_MAX_CH; i++ ) { for ( j = 0; j < IVAS_SPAR_MAX_CH; j++ ) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h old mode 100644 new mode 100755 index ad453cd5bd..2e2ab9c77a --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -806,8 +806,13 @@ typedef struct ivas_spar_md_dec_state_t int16_t table_idx; int16_t dtx_vad; int16_t spar_hoa_md_flag; +#ifdef LBR_ADAP_SMOOTHING_OPT + float smooth_buf[IVAS_MAX_NUM_BANDS][2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1]; + float smooth_fac[IVAS_MAX_NUM_BANDS]; +#else float smooth_buf[IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS][2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1]; float smooth_fac[IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS]; +#endif float mixer_mat_prev2[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS]; } ivas_spar_md_dec_state_t; -- GitLab From 31a964f3ec0da59183c3442f3a5ef6aefc7506c1 Mon Sep 17 00:00:00 2001 From: rhb Date: Fri, 5 May 2023 16:09:58 +0200 Subject: [PATCH 2/2] add issue number to description in options.h --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index a9a0229876..d31179d95b 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -167,7 +167,7 @@ #define FIX_427_MAXIMUM_S_INDEX /* VA: issue 427: fix return index of function maximum_s() */ #define FIX_431_PARAMMC_PLC_INTERPOLATOR /* FhG: Issue 431: fix missing interpolator reset for ParamMC PCL */ #define FIX_391_SBA /* Dlb: Fix for issue 391 for SBA */ -#define LBR_ADAP_SMOOTHING_OPT /* FhG: complexity optimization of adaptive smoothing in low-bitrate SBA */ +#define LBR_ADAP_SMOOTHING_OPT /* FhG: Issue 436: complexity optimization of adaptive smoothing in low-bitrate SBA */ #define FIX_425_MASA_BRSW_RENDERER /* Nokia: Issue 425: renderer not reconfigure in MASA bitrate switching */ -- GitLab