From 042320d65ded5003586a6a41dedc5f79cb70bc12 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 13 Dec 2024 21:12:13 +0100 Subject: [PATCH] optimize mctStereoIGF_dec_fx() --- lib_com/options.h | 1 + lib_dec/ivas_mct_dec_mct_fx.c | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 3e62b995b..945329baa 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -98,4 +98,5 @@ #define FIX_1106_SIMPLIFY_SET32FX /* FhG: simplify set32_fx() */ #define FIX_1107_VADDINC /* FhG: Optimize v_add_inc_fx() for most frequent case */ #define FIX_1009_OPT_PARAMMC_RENDER /* FhG: Optimize ivas_param_mc_dec_render_fx() */ +#define FIX_1109_OPTIM_MCT_STEREO_IGF_DEC /* FhG: optimize mctStereoIGF_dec_fx() */ #endif diff --git a/lib_dec/ivas_mct_dec_mct_fx.c b/lib_dec/ivas_mct_dec_mct_fx.c index 1f8954e67..3ed0998d1 100644 --- a/lib_dec/ivas_mct_dec_mct_fx.c +++ b/lib_dec/ivas_mct_dec_mct_fx.c @@ -315,6 +315,7 @@ void mctStereoIGF_dec_fx( test(); IF( NE_16( hMCT->hBlockData[b]->hStereoMdct->IGFStereoMode[k], SMDCT_DUAL_MONO ) || NE_16( hMCT->hBlockData[b]->hStereoMdct->mdct_stereo_mode[k], SMDCT_DUAL_MONO ) ) { +#ifndef FIX_1109_OPTIM_MCT_STEREO_IGF_DEC tmp = BASOP_Util_Divide1616_Scale( sts[0]->hTcxCfg->tcx_coded_lines, nSubframes, &tmp_e ); L_spec[0] = shr( tmp, add( 15, negate( tmp_e ) ) ); move16(); @@ -324,6 +325,18 @@ void mctStereoIGF_dec_fx( tmp = BASOP_Util_Divide1616_Scale( sts[0]->hTcxDec->L_frameTCX, nSubframes, &tmp_e ); L_frameTCX_nSubframe = shr( tmp, add( 15, negate( tmp_e ) ) ); +#else + Word16 shr_div, shr_k; + + assert( nSubframes == 1 || nSubframes == 2 ); + /* Note: nSubframes is in limited range [1, 2] for this function */ + + shr_div = sub( nSubframes, 1 ); /* 2 -> 1, 1 -> 0 */ + L_spec[0] = shr( sts[0]->hTcxCfg->tcx_coded_lines, shr_div ); + move16(); + L_frame_nSubframe = shr( sts[0]->L_frame, shr_div ); + L_frameTCX_nSubframe = shr( sts[0]->hTcxDec->L_frameTCX, shr_div ); +#endif init_tcx_info_fx( sts[0], L_frame_nSubframe, L_frameTCX_nSubframe, k, bfi, &tcx_offset[0], &tcx_offsetFB[0], &L_frame[0], &L_frameTCX[0], &left_rect[0], &L_spec[0] ); @@ -333,14 +346,28 @@ void mctStereoIGF_dec_fx( decoder_tcx_IGF_stereo_fx( sts, hMCT->hBlockData[b]->hStereoMdct, hMCT->hBlockData[b]->mask, p_x, p_x_e, p_x_len, L_frame[0], left_rect[0], k, bfi, 1 /* MCT_flag */ ); // Shifting output with variable exponent back to Q12 +#ifdef FIX_1109_OPTIM_MCT_STEREO_IGF_DEC + shr_k = sub( 31 - Q12, p_x_e[0][k] ); +#endif FOR( Word16 i = 0; i < p_x_len[0][k]; i++ ) { +#ifndef FIX_1109_OPTIM_MCT_STEREO_IGF_DEC p_x[0][k][i] = L_shr( p_x[0][k][i], sub( 31 - Q12, p_x_e[0][k] ) ); +#else + p_x[0][k][i] = L_shr( p_x[0][k][i], shr_k ); +#endif move32(); } +#ifdef FIX_1109_OPTIM_MCT_STEREO_IGF_DEC + shr_k = sub( 31 - Q12, p_x_e[1][k] ); +#endif FOR( Word16 i = 0; i < p_x_len[1][k]; i++ ) { +#ifndef FIX_1109_OPTIM_MCT_STEREO_IGF_DEC p_x[1][k][i] = L_shr( p_x[1][k][i], sub( 31 - Q12, p_x_e[1][k] ) ); +#else + p_x[1][k][i] = L_shr( p_x[1][k][i], shr_k ); +#endif move32(); } } -- GitLab