Skip to content

Commit ad4141a

Browse files
committed
Optimizations of clamp function for 32-bit ARM
1 parent 601edd2 commit ad4141a

File tree

12 files changed

+463
-8
lines changed

12 files changed

+463
-8
lines changed

include/private/dsp/arch/arm/neon-d32/pmath.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#endif /* PRIVATE_DSP_ARCH_ARM_NEON_D32_IMPL */
2828

2929
#include <private/dsp/arch/arm/neon-d32/pmath/abs_vv.h>
30+
#include <private/dsp/arch/arm/neon-d32/pmath/clamp.h>
3031
#include <private/dsp/arch/arm/neon-d32/pmath/cos.h>
3132
#include <private/dsp/arch/arm/neon-d32/pmath/exp.h>
3233
#include <private/dsp/arch/arm/neon-d32/pmath/fmop_kx.h>
@@ -37,6 +38,7 @@
3738
#include <private/dsp/arch/arm/neon-d32/pmath/minmax.h>
3839
#include <private/dsp/arch/arm/neon-d32/pmath/op_kx.h>
3940
#include <private/dsp/arch/arm/neon-d32/pmath/op_vv.h>
41+
#include <private/dsp/arch/arm/neon-d32/pmath/pmix.h>
4042
#include <private/dsp/arch/arm/neon-d32/pmath/pow.h>
4143
#include <private/dsp/arch/arm/neon-d32/pmath/sin.h>
4244
#include <private/dsp/arch/arm/neon-d32/pmath/sqr.h>

include/private/dsp/arch/arm/neon-d32/pmath/clamp.h

Lines changed: 408 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright (C) 2025 Linux Studio Plugins Project <https://lsp-plug.in/>
3+
* (C) 2025 Vladimir Sadovnikov <sadko4u@gmail.com>
4+
*
5+
* This file is part of lsp-dsp-lib
6+
* Created on: 27 нояб. 2025 г.
7+
*
8+
* lsp-dsp-lib is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU Lesser General Public License as published by
10+
* the Free Software Foundation, either version 3 of the License, or
11+
* any later version.
12+
*
13+
* lsp-dsp-lib is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU Lesser General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU Lesser General Public License
19+
* along with lsp-dsp-lib. If not, see <https://www.gnu.org/licenses/>.
20+
*/
21+
22+
#ifndef PRIVATE_DSP_ARCH_ARM_NEON_D32_PMATH_PMIX_H_
23+
#define PRIVATE_DSP_ARCH_ARM_NEON_D32_PMATH_PMIX_H_
24+
25+
#ifndef PRIVATE_DSP_ARCH_ARM_NEON_D32_IMPL
26+
#error "This header should not be included directly"
27+
#endif /* PRIVATE_DSP_ARCH_ARM_NEON_D32_IMPL */
28+
29+
namespace lsp
30+
{
31+
namespace neon_d32
32+
{
33+
34+
} /* namespace neon_d32 */
35+
} /* namespace lsp */
36+
37+
38+
39+
40+
#endif /* PRIVATE_DSP_ARCH_ARM_NEON_D32_PMATH_PMIX_H_ */

src/main/arm/neon-d32.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,11 @@
436436
EXPORT1(uexpander_x1_curve);
437437
EXPORT1(dexpander_x1_gain);
438438
EXPORT1(dexpander_x1_curve);
439+
440+
EXPORT1(clamp_vv1);
441+
EXPORT1(clamp_vv2);
442+
EXPORT1(clamp_kk1);
443+
EXPORT1(clamp_kk2);
439444
}
440445
} /* namespace neon_d32 */
441446
} /* namespace lsp */

src/test/ptest/pmath/clamp_kk1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ PTEST_BEGIN("dsp.pmath", clamp_kk1, 5, 1000)
109109
IF_ARCH_X86(CALL(sse::clamp_kk1));
110110
IF_ARCH_X86(CALL(avx::clamp_kk1));
111111
IF_ARCH_X86(CALL(avx512::clamp_kk1));
112-
// IF_ARCH_ARM(CALL(neon_d32::clamp_kk1));
112+
IF_ARCH_ARM(CALL(neon_d32::clamp_kk1));
113113
// IF_ARCH_AARCH64(CALL(asimd::clamp_kk1));
114114
PTEST_SEPARATOR;
115115
}

src/test/ptest/pmath/clamp_kk2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ PTEST_BEGIN("dsp.pmath", clamp_kk2, 5, 1000)
109109
IF_ARCH_X86(CALL(sse::clamp_kk2));
110110
IF_ARCH_X86(CALL(avx::clamp_kk2));
111111
IF_ARCH_X86(CALL(avx512::clamp_kk2));
112-
// IF_ARCH_ARM(CALL(neon_d32::clamp_kk2));
112+
IF_ARCH_ARM(CALL(neon_d32::clamp_kk2));
113113
// IF_ARCH_AARCH64(CALL(asimd::clamp_kk2));
114114
PTEST_SEPARATOR;
115115
}

src/test/ptest/pmath/clamp_vv1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ PTEST_BEGIN("dsp.pmath", clamp_vv2, 5, 1000)
113113
IF_ARCH_X86(CALL(sse::clamp_vv2));
114114
IF_ARCH_X86(CALL(avx::clamp_vv2));
115115
IF_ARCH_X86(CALL(avx512::clamp_vv2));
116-
// IF_ARCH_ARM(CALL(neon_d32::clamp_vv2));
116+
IF_ARCH_ARM(CALL(neon_d32::clamp_vv2));
117117
// IF_ARCH_AARCH64(CALL(asimd::clamp_vv2));
118118
PTEST_SEPARATOR;
119119
}

src/test/ptest/pmath/clamp_vv2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ PTEST_BEGIN("dsp.pmath", clamp_vv1, 5, 1000)
113113
IF_ARCH_X86(CALL(sse::clamp_vv1));
114114
IF_ARCH_X86(CALL(avx::clamp_vv1));
115115
IF_ARCH_X86(CALL(avx512::clamp_vv1));
116-
// IF_ARCH_ARM(CALL(neon_d32::clamp_vv1));
116+
IF_ARCH_ARM(CALL(neon_d32::clamp_vv1));
117117
// IF_ARCH_AARCH64(CALL(asimd::clamp_vv1));
118118
PTEST_SEPARATOR;
119119
}

src/test/utest/pmath/clamp_kk1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ UTEST_BEGIN("dsp.pmath", clamp_kk1)
118118
IF_ARCH_X86(CALL(generic::clamp_kk1, sse::clamp_kk1, 16));
119119
IF_ARCH_X86(CALL(generic::clamp_kk1, avx::clamp_kk1, 32));
120120
IF_ARCH_X86(CALL(generic::clamp_kk1, avx512::clamp_kk1, 32));
121-
// IF_ARCH_ARM(CALL(generic::clamp_kk1, neon_d32::clamp_kk1, 16));
121+
IF_ARCH_ARM(CALL(generic::clamp_kk1, neon_d32::clamp_kk1, 16));
122122
// IF_ARCH_AARCH64(CALL(generic::clamp_kk1, asimd::clamp_kk1, 16));
123123
}
124124
UTEST_END

src/test/utest/pmath/clamp_kk2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ UTEST_BEGIN("dsp.pmath", clamp_kk2)
118118
IF_ARCH_X86(CALL(generic::clamp_kk2, sse::clamp_kk2, 16));
119119
IF_ARCH_X86(CALL(generic::clamp_kk2, avx::clamp_kk2, 32));
120120
IF_ARCH_X86(CALL(generic::clamp_kk2, avx512::clamp_kk2, 32));
121-
// IF_ARCH_ARM(CALL(generic::clamp_kk2, neon_d32::clamp_kk2, 16));
121+
IF_ARCH_ARM(CALL(generic::clamp_kk2, neon_d32::clamp_kk2, 16));
122122
// IF_ARCH_AARCH64(CALL(generic::clamp_kk2, asimd::clamp_kk2, 16));
123123
}
124124
UTEST_END

0 commit comments

Comments
 (0)