From 30d24adf96ebd4c643b4e9115a07fc31df72d093 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Wed, 7 Jan 2026 10:23:45 -0500 Subject: [PATCH 1/2] find target improvement --- lib_com/options.h | 1 + lib_enc/find_tar_fx.c | 46 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 2c70dd14f..cf6fac866 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -134,6 +134,7 @@ #define NONBE_OPT_2239_IVAS_FILTER_PROCESS /* Dolby: Issue 2239, optimize ivas_filter_process_fx. */ #define NONBE_OPT_2193_EIG2X2 /* Dolby: Issue 2193, optimize eig2x2_fx. */ #define BE_FIX_2240_COMPUTE_COV_MTC_FX_FAST /* FhG: Speeds up covariance calculation e.g. 60 WMOPS for encoding -mc 7_1_4 24400 48 */ +#define OPT_2308_FIND_TARGET /* VA: Issue 2308, Speeds up computation and improve accuracy of the impulse response */ /* #################### End BASOP optimization switches ############################ */ diff --git a/lib_enc/find_tar_fx.c b/lib_enc/find_tar_fx.c index 5b3ab4792..f6408d096 100644 --- a/lib_enc/find_tar_fx.c +++ b/lib_enc/find_tar_fx.c @@ -173,7 +173,12 @@ void find_targets_ivas_fx( { Word16 i; Word16 temp[M + 6 * L_SUBFR]; /* error of quantization */ +#ifndef OPT_2308_FIND_TARGET Word16 scale, scaleq, j, d, s, s2, tmp; +#else + Word16 scale, scaleq, j, d, s, tmp; + Word32 s2; +#endif Word16 Aqs[M + 1]; Word32 h1_32[6 * L_SUBFR]; Word16 sf; @@ -233,17 +238,27 @@ void find_targets_ivas_fx( { Copy( p_Aq, Aqs, M + 1 ); /* Q12 */ s = add( scaleq, 1 ); +#ifndef OPT_2308_FIND_TARGET s2 = shr( 16384, d ); +#else + s2 = L_shr( ( 16384 << 16 ), d ); +#endif } ELSE { Copy_Scale_sig( p_Aq, Aqs, M + 1, d ); /* Q12 */ s = add( scale, 1 ); +#ifndef OPT_2308_FIND_TARGET s2 = 16384; move16(); +#else + s2 = ( 16384 << 16 ); + move32(); +#endif } set32_fx( h1_32, 0, L_subfr ); +#ifndef OPT_2308_FIND_TARGET FOR( i = 0; i < M; i++ ) { Ltmp64 = W_mult_16_16( Ap[i], s2 ); /* Q27 */ @@ -273,7 +288,38 @@ void find_targets_ivas_fx( h1_32[i] = W_extract_l( Ltmp64 ); /* Q27 */ move32(); } +#else + FOR( i = 0; i < M; i++ ) + { + Ltmp64 = W_mult_32_16( s2, Ap[i] ); /* Q27 */ + FOR( j = 1; j <= i; j++ ) + { + Ltmp64 = W_msu_32_16( Ltmp64, L_shl_sat( h1_32[i - j], s ), Aqs[j] ); /* Q27 */ + } + h1_32[i] = W_sat_m( Ltmp64 ); /* Q27 */ + move32(); + } + + Ltmp64 = W_mult_32_16( s2, Ap[i]); /* Q27 */ + FOR( j = 1; j <= M; j++ ) + { + Ltmp64 = W_msu_32_16( Ltmp64, L_shl_sat( h1_32[i - j], s ), Aqs[j] ); /* Q27 */ + } + h1_32[M] = W_sat_m( Ltmp64 ); /* Q27 */ + move32(); + + FOR( i = M + 1; i < L_subfr; i++ ) + { + Ltmp64 = W_msu_32_16( 0, L_shl_sat( h1_32[i - 1], s ), Aqs[1] ); /* Q27 */ + FOR( j = 2; j <= M; j++ ) + { + Ltmp64 = W_msu_32_16( Ltmp64, L_shl_sat( h1_32[i - j], s ), Aqs[j] ); /* Q27 */ + } + h1_32[i] = W_sat_m( Ltmp64 ); /* Q27 */ + move32(); + } +#endif sf = sub( L_norm_arr( h1_32, L_subfr ), 1 ); Copy_Scale_sig32_16( h1_32, h1, L_subfr, sf ); // Q11 + sf -- GitLab From 4ecbc5df9b8cd0a8cf59881a6ea5874c7f302e49 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Wed, 7 Jan 2026 10:29:55 -0500 Subject: [PATCH 2/2] fix clang --- lib_enc/find_tar_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/find_tar_fx.c b/lib_enc/find_tar_fx.c index f6408d096..a315c4301 100644 --- a/lib_enc/find_tar_fx.c +++ b/lib_enc/find_tar_fx.c @@ -300,7 +300,7 @@ void find_targets_ivas_fx( move32(); } - Ltmp64 = W_mult_32_16( s2, Ap[i]); /* Q27 */ + Ltmp64 = W_mult_32_16( s2, Ap[i] ); /* Q27 */ FOR( j = 1; j <= M; j++ ) { Ltmp64 = W_msu_32_16( Ltmp64, L_shl_sat( h1_32[i - j], s ), Aqs[j] ); /* Q27 */ -- GitLab