From 71e7334057e7f82a13ced9b3f7a84788d2513408 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 13 Dec 2024 20:21:53 +0100 Subject: [PATCH] optimize frequent case of v_add_inc_fx() --- lib_com/ivas_tools.c | 25 +++++++++++++++++++++++++ lib_com/options.h | 1 + 2 files changed, 26 insertions(+) diff --git a/lib_com/ivas_tools.c b/lib_com/ivas_tools.c index 5f5bd26d5..5738b6feb 100644 --- a/lib_com/ivas_tools.c +++ b/lib_com/ivas_tools.c @@ -308,10 +308,35 @@ void v_add_inc_fx( const Word16 N /* i : Vector length Q0*/ ) { +#ifndef FIX_1107_VADDINC Word16 i; Word16 ix1 = 0; Word16 ix2 = 0; Word16 iy = 0; +#else + Word16 i, ix1, ix2, iy; + + /* The use of this function is currently always for the interleaved input format, */ + /* that means, the following conditions are always true and thus obsolete. */ + test(); + test(); + test(); + test(); + IF( ( sub( x_inc, 2 ) == 0 ) && ( sub( x2_inc, 2 ) == 0 ) && ( sub( y_inc, 1 ) == 0 ) && ( &x1[1] == &x2[0] ) ) + { + /* Interleaved input case, linear output */ + FOR( i = 0; i < N; i++ ) + { + y[i] = L_add( x1[2 * i + 0], x1[2 * i + 1] ); /*Qx*/ + move32(); + } + return; + } + + ix1 = 0; + ix2 = 0; + iy = 0; +#endif move16(); move16(); move16(); diff --git a/lib_com/options.h b/lib_com/options.h index c644d36d0..cb8918eed 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -96,4 +96,5 @@ #define FIX_1105_OPT_MINIMUM_SL /* FhG: Optimize minimum_s(), minimum_l(), avoid IF */ #define FIX_1104_OPT_GETMINSCALEFAC /* FhG: Optimize get_min_scalefactor(), avoid IF */ #define FIX_1106_SIMPLIFY_SET32FX /* FhG: simplify set32_fx() */ +#define FIX_1107_VADDINC /* FhG: Optimize v_add_inc_fx() for most frequent case */ #endif -- GitLab