From fa85b99baf450592273f18a34ad33be4ee1567f5 Mon Sep 17 00:00:00 2001 From: knj Date: Wed, 19 Apr 2023 13:59:42 +0200 Subject: [PATCH 1/2] add complexity optimization for paramMC modes --- lib_com/ivas_cnst.h | 6 ++++++ lib_com/ivas_fb_mixer.c | 4 ++++ lib_com/ivas_mdft_imdft.c | 5 +++++ lib_com/ivas_rom_com.c | 24 ++++++++++++++++++++++++ lib_com/ivas_rom_com.h | 3 +++ lib_com/options.h | 2 ++ lib_enc/ivas_mc_param_enc.c | 8 ++++++++ 7 files changed, 52 insertions(+) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 0b326ba8a5..e5285467c8 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1351,6 +1351,9 @@ typedef enum #define PARAM_MC_BAND_TO_MDCT_BAND_RATIO 16 /* Ratio of resolution of CLDFB Bands to MDCT Bands */ #define PARAM_MC_SLOT_ENC_NS 2500000L #define PARAM_MC_MDFT_NO_SLOTS 8 +#ifdef PARAMMC_SHORT_ENC_MDFT +#define PARAM_MC_CLDFB_TO_MDFT_FAC 2 +#endif /*----------------------------------------------------------------------------------* * LFE Coding Constants @@ -1561,6 +1564,9 @@ typedef enum #define IVAS_320_PT_LEN 320 #define IVAS_240_PT_LEN 240 #define IVAS_160_PT_LEN 160 +#ifdef PARAMMC_SHORT_ENC_MDFT +#define IVAS_120_PT_LEN 120 +#endif #define IVAS_80_PT_LEN 80 #define IVAS_40_PT_LEN 40 diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index 3e0d68049a..f42e8bde74 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -156,7 +156,11 @@ ivas_error ivas_fb_set_cfg( { pFb_cfg->fb_latency = NS2SA( sampling_rate, DELAY_FB_1_NS ); pFb_cfg->fade_len = NS2SA( sampling_rate, DELAY_FB_1_NS ); +#ifdef PARAMMC_SHORT_ENC_MDFT + pFb_cfg->prior_input_length = NS2SA( sampling_rate, DELAY_DIRAC_ENC_CMP_NS ) + NS2SA( sampling_rate, PARAM_MC_SLOT_ENC_NS ); +#else pFb_cfg->prior_input_length = NS2SA( sampling_rate, DELAY_DIRAC_ENC_CMP_NS ) + 3 * NS2SA( sampling_rate, PARAM_MC_SLOT_ENC_NS ); +#endif } *pFb_cfg_out = pFb_cfg; diff --git a/lib_com/ivas_mdft_imdft.c b/lib_com/ivas_mdft_imdft.c index e6f276575e..a9f5bac532 100644 --- a/lib_com/ivas_mdft_imdft.c +++ b/lib_com/ivas_mdft_imdft.c @@ -82,6 +82,11 @@ static void ivas_get_mdft_twid_factors( case IVAS_160_PT_LEN: *ppTwid = &ivas_mdft_coeff_cos_twid_160[0]; break; +#ifdef PARAMMC_SHORT_ENC_MDFT + case IVAS_120_PT_LEN: + *ppTwid = &ivas_mdft_coeff_cos_twid_120[0]; + break; +#endif case IVAS_80_PT_LEN: *ppTwid = &ivas_mdft_coeff_cos_twid_80[0]; break; diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index f04538c479..493622e37e 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -3980,6 +3980,30 @@ const float ivas_cos_twiddle_160[IVAS_160_PT_LEN >> 1] = 0.0760120586092433f, 0.0564205163668375f, 0.0368072229413588f, 0.0171797396307788f }; +#ifdef PARAMMC_SHORT_ENC_MDFT +const float ivas_mdft_coeff_cos_twid_120[IVAS_120_PT_LEN + 1] = +{ + 1.0000000000f, 0.9999143276f, 0.9996573250f, 0.9992290362f, 0.9986295348f, 0.9978589232f, 0.9969173337f, + 0.9958049276f, 0.9945218954f, 0.9930684570f, 0.9914448614f, 0.9896513868f, 0.9876883406f, 0.9855560591f, + 0.9832549076f, 0.9807852804f, 0.9781476007f, 0.9753423205f, 0.9723699204f, 0.9692309097f, 0.9659258263f, + 0.9624552365f, 0.9588197349f, 0.9550199445f, 0.9510565163f, 0.9469301295f, 0.9426414911f, 0.9381913359f, + 0.9335804265f, 0.9288095529f, 0.9238795325f, 0.9187912101f, 0.9135454576f, 0.9081431738f, 0.9025852843f, + 0.8968727415f, 0.8910065242f, 0.8849876375f, 0.8788171127f, 0.8724960071f, 0.8660254038f, 0.8594064115f, + 0.8526401644f, 0.8457278217f, 0.8386705679f, 0.8314696123f, 0.8241261886f, 0.8166415552f, 0.8090169944f, + 0.8012538127f, 0.7933533403f, 0.7853169309f, 0.7771459615f, 0.7688418321f, 0.7604059656f, 0.7518398075f, + 0.7431448255f, 0.7343225094f, 0.7253743710f, 0.7163019434f, 0.7071067812f, 0.6977904598f, 0.6883545757f, + 0.6788007455f, 0.6691306064f, 0.6593458151f, 0.6494480483f, 0.6394390020f, 0.6293203910f, 0.6190939493f, + 0.6087614290f, 0.5983246006f, 0.5877852523f, 0.5771451900f, 0.5664062369f, 0.5555702330f, 0.5446390350f, + 0.5336145159f, 0.5224985647f, 0.5112930861f, 0.5000000000f, 0.4886212415f, 0.4771587603f, 0.4656145203f, + 0.4539904997f, 0.4422886902f, 0.4305110968f, 0.4186597375f, 0.4067366431f, 0.3947438564f, 0.3826834324f, + 0.3705574375f, 0.3583679495f, 0.3461170571f, 0.3338068592f, 0.3214394653f, 0.3090169944f, 0.2965415750f, + 0.2840153447f, 0.2714404499f, 0.2588190451f, 0.2461532930f, 0.2334453639f, 0.2206974350f, 0.2079116908f, + 0.1950903220f, 0.1822355255f, 0.1693495038f, 0.1564344650f, 0.1434926220f, 0.1305261922f, 0.1175373975f, + 0.1045284633f, 0.0915016187f, 0.0784590957f, 0.0654031292f, 0.0523359562f, 0.0392598158f, 0.0261769483f, + 0.0130895956f, 0.0000000000f +}; +#endif + const float ivas_sin_twiddle_80[IVAS_80_PT_LEN >> 1] = { -0.00490871880799799f, -0.0441642771270674f, -0.0833517373318975f, -0.122410675199216f, diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index a095c9e4b4..0d5bb063e7 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -364,6 +364,9 @@ extern const float ivas_cos_twiddle_80[IVAS_80_PT_LEN >> 1]; extern const float ivas_mdft_coeff_cos_twid_240[IVAS_240_PT_LEN + 1]; extern const float ivas_mdft_coeff_cos_twid_160[IVAS_160_PT_LEN + 1]; +#ifdef PARAMMC_SHORT_ENC_MDFT +extern const float ivas_mdft_coeff_cos_twid_120[IVAS_120_PT_LEN + 1]; +#endif extern const float ivas_mdft_coeff_cos_twid_80[IVAS_80_PT_LEN + 1]; extern const float ivas_mdft_coeff_cos_twid_40[IVAS_40_PT_LEN + 1]; extern const float ivas_mdft_coeff_cos_twid_960[IVAS_960_PT_LEN + 1]; diff --git a/lib_com/options.h b/lib_com/options.h index c188222e22..79d728e1d4 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -171,6 +171,8 @@ #define FIX_401_DIRAC_RENDERER_META_READ_INDICES /* Nokia: Issue 401: Fix metadata reading indices in DirAC renderer. */ +#define PARAMMC_SHORT_ENC_MDFT /* FhG: Issue 410: complexity optimization for parametric Multichannel modes */ + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index db9945d0ce..91cd92fbd9 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -199,7 +199,11 @@ ivas_error ivas_param_mc_enc_open( /* parameter band grouping: 60 band CLDFB to 240 band MDFT resolution */ for ( i = 0; i < hParamMC->hMetadataPMC.num_parameter_bands + 1; i++ ) { +#ifdef PARAMMC_SHORT_ENC_MDFT + hParamMC->band_grouping[i] *= PARAM_MC_CLDFB_TO_MDFT_FAC; +#else hParamMC->band_grouping[i] *= CLDFB_TO_MDFT_FAC; +#endif } /* set correct coded band width */ @@ -682,7 +686,11 @@ static void ivas_param_mc_param_est_enc( for ( ts = start_ts; ts < num_time_slots; ts++ ) { +#ifdef PARAMMC_SHORT_ENC_MDFT + ivas_fb_mixer_get_windowed_fr( hParamMC->hFbMixer, pcm_in, p_slot_frame_f_real, p_slot_frame_f_imag, l_ts, l_ts ); +#else ivas_fb_mixer_get_windowed_fr( hParamMC->hFbMixer, pcm_in, p_slot_frame_f_real, p_slot_frame_f_imag, l_ts, 2 * l_ts ); +#endif ivas_fb_mixer_update_prior_input( hParamMC->hFbMixer, pcm_in, l_ts ); for ( i = 0; i < nchan_input; i++ ) { -- GitLab From 52a3bf829ff5d302f05abc619976a7a1af7c4f7a Mon Sep 17 00:00:00 2001 From: knj Date: Wed, 19 Apr 2023 14:47:14 +0200 Subject: [PATCH 2/2] fix use-of-uninitialized value error in MC bitrate switching --- lib_enc/ivas_mc_param_enc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index 91cd92fbd9..14eca6afee 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -339,7 +339,11 @@ ivas_error ivas_param_mc_enc_reconfig( /* parameter band grouping: 60 band CLDFB to 240 band MDFT resolution */ for ( i = 0; i < hParamMC->hMetadataPMC.num_parameter_bands + 1; i++ ) { +#ifdef PARAMMC_SHORT_ENC_MDFT + hParamMC->band_grouping[i] *= PARAM_MC_CLDFB_TO_MDFT_FAC; +#else hParamMC->band_grouping[i] *= CLDFB_TO_MDFT_FAC; +#endif } /* set correct coded band width */ -- GitLab