1
1
/*
2
- * Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/>
3
- * (C) 2020 Vladimir Sadovnikov <[email protected] >
2
+ * Copyright (C) 2023 Linux Studio Plugins Project <https://lsp-plug.in/>
3
+ * (C) 2023 Vladimir Sadovnikov <[email protected] >
4
4
*
5
5
* This file is part of lsp-dsp-lib
6
6
* Created on: 31 мар. 2020 г.
@@ -29,26 +29,28 @@ namespace lsp
29
29
{
30
30
void complex_div2 (float *dst_re, float *dst_im, const float *src_re, const float *src_im, size_t count);
31
31
void complex_rdiv2 (float *dst_re, float *dst_im, const float *src_re, const float *src_im, size_t count);
32
- void complex_div3 (float *dst_re, float *dst_im, const float *t_re, const float *t_im, const float *b_re, const float *b_im, size_t count);
33
32
}
34
33
35
34
IF_ARCH_X86 (
36
35
namespace sse
37
36
{
38
37
void complex_div2 (float *dst_re, float *dst_im, const float *src_re, const float *src_im, size_t count);
39
38
void complex_rdiv2 (float *dst_re, float *dst_im, const float *src_re, const float *src_im, size_t count);
40
- void complex_div3 (float *dst_re, float *dst_im, const float *t_re, const float *t_im, const float *b_re, const float *b_im, size_t count);
41
39
}
42
40
43
41
namespace avx
44
42
{
45
43
void complex_div2 (float *dst_re, float *dst_im, const float *src_re, const float *src_im, size_t count);
46
44
void complex_rdiv2 (float *dst_re, float *dst_im, const float *src_re, const float *src_im, size_t count);
47
- void complex_div3 (float *dst_re, float *dst_im, const float *t_re, const float *t_im, const float *b_re, const float *b_im, size_t count);
48
45
49
46
void complex_div2_fma3 (float *dst_re, float *dst_im, const float *src_re, const float *src_im, size_t count);
50
47
void complex_rdiv2_fma3 (float *dst_re, float *dst_im, const float *src_re, const float *src_im, size_t count);
51
- void complex_div3_fma3 (float *dst_re, float *dst_im, const float *t_re, const float *t_im, const float *b_re, const float *b_im, size_t count);
48
+ }
49
+
50
+ namespace avx512
51
+ {
52
+ void complex_div2 (float *dst_re, float *dst_im, const float *src_re, const float *src_im, size_t count);
53
+ void complex_rdiv2 (float *dst_re, float *dst_im, const float *src_re, const float *src_im, size_t count);
52
54
}
53
55
)
54
56
@@ -57,7 +59,6 @@ namespace lsp
57
59
{
58
60
void complex_div2 (float *dst_re, float *dst_im, const float *src_re, const float *src_im, size_t count);
59
61
void complex_rdiv2 (float *dst_re, float *dst_im, const float *src_re, const float *src_im, size_t count);
60
- void complex_div3 (float *dst_re, float *dst_im, const float *t_re, const float *t_im, const float *b_re, const float *b_im, size_t count);
61
62
}
62
63
)
63
64
@@ -66,15 +67,13 @@ namespace lsp
66
67
{
67
68
void complex_div2 (float *dst_re, float *dst_im, const float *src_re, const float *src_im, size_t count);
68
69
void complex_rdiv2 (float *dst_re, float *dst_im, const float *src_re, const float *src_im, size_t count);
69
- void complex_div3 (float *dst_re, float *dst_im, const float *t_re, const float *t_im, const float *b_re, const float *b_im, size_t count);
70
70
}
71
71
)
72
72
}
73
73
74
74
typedef void (* complex_div2_t ) (float *dst_re, float *dst_im, const float *src_re, const float *src_im, size_t count);
75
- typedef void (* complex_div3_t ) (float *dst_re, float *dst_im, const float *t_re, const float *t_im, const float *b_re, const float *b_im, size_t count);
76
75
77
- UTEST_BEGIN (" dsp.complex" , div )
76
+ UTEST_BEGIN (" dsp.complex" , div2 )
78
77
79
78
void call(const char *text, size_t align, complex_div2_t func1, complex_div2_t func2)
80
79
{
@@ -127,85 +126,25 @@ UTEST_BEGIN("dsp.complex", div)
127
126
}
128
127
}
129
128
130
- void call (const char *text, size_t align, complex_div3_t func1, complex_div3_t func2)
131
- {
132
- if (!UTEST_SUPPORTED (func1))
133
- return ;
134
- if (!UTEST_SUPPORTED (func2))
135
- return ;
136
-
137
- UTEST_FOREACH (count, 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 ,
138
- 32 , 33 , 37 , 48 , 49 , 64 , 65 , 0x3f , 100 , 999 , 0x1fff )
139
- {
140
- for (size_t mask=0 ; mask <= 0x3f ; ++mask)
141
- {
142
- printf (" Testing %s on input buffer of %d numbers, mask=0x%x...\n " , text, int (count), int (mask));
143
-
144
- FloatBuffer src1_re (count, align, mask & 0x01 );
145
- FloatBuffer src1_im (count, align, mask & 0x02 );
146
- src1_re.randomize_sign ();
147
- src1_im.randomize_sign ();
148
- FloatBuffer src2_re (count, align, mask & 0x04 );
149
- FloatBuffer src2_im (count, align, mask & 0x08 );
150
- src2_re.randomize_sign ();
151
- src2_im.randomize_sign ();
152
- FloatBuffer dst1_re (count, align, mask & 0x10 );
153
- FloatBuffer dst1_im (count, align, mask & 0x20 );
154
- FloatBuffer dst2_re (count, align, mask & 0x10 );
155
- FloatBuffer dst2_im (count, align, mask & 0x20 );
156
-
157
- // Call functions
158
- func1 (dst1_re, dst1_im, src1_re, src1_im, src2_re, src2_im, count);
159
- func2 (dst2_re, dst2_im, src1_re, src1_im, src2_re, src2_im, count);
160
-
161
- UTEST_ASSERT_MSG (src1_re.valid (), " Source buffer 1 RE corrupted" );
162
- UTEST_ASSERT_MSG (src1_im.valid (), " Source buffer 1 IM corrupted" );
163
- UTEST_ASSERT_MSG (src2_re.valid (), " Source buffer 2 RE corrupted" );
164
- UTEST_ASSERT_MSG (src2_im.valid (), " Source buffer 2 IM corrupted" );
165
- UTEST_ASSERT_MSG (dst1_re.valid (), " Destination buffer 1 RE corrupted" );
166
- UTEST_ASSERT_MSG (dst1_im.valid (), " Destination buffer 1 IM corrupted" );
167
- UTEST_ASSERT_MSG (dst2_re.valid (), " Destination buffer 2 RE corrupted" );
168
- UTEST_ASSERT_MSG (dst2_im.valid (), " Destination buffer 2 IM corrupted" );
169
-
170
- // Compare buffers
171
- if ((!dst2_re.equals_absolute (dst1_re, 1e-4 )) || (!dst2_im.equals_absolute (dst1_im, 1e-4 )))
172
- {
173
- src1_re.dump (" src1_re" );
174
- src1_im.dump (" src1_im" );
175
- src2_re.dump (" src2_re" );
176
- src2_im.dump (" src2_im" );
177
- dst1_re.dump (" dst1_re" );
178
- dst1_im.dump (" dst1_im" );
179
- dst2_re.dump (" dst2_re" );
180
- dst2_im.dump (" dst2_im" );
181
- UTEST_FAIL_MSG (" Output of functions for test '%s' differs" , text);
182
- }
183
- }
184
- }
185
- }
186
-
187
129
UTEST_MAIN
188
130
{
189
131
#define CALL (generic, func, align ) \
190
132
call (#func, align, generic, func)
191
133
192
134
IF_ARCH_X86 (CALL (generic::complex_div2, sse::complex_div2, 16 ));
193
135
IF_ARCH_X86 (CALL (generic::complex_rdiv2, sse::complex_rdiv2, 16 ));
194
- IF_ARCH_X86 (CALL (generic::complex_div3, sse::complex_div3, 16 ));
195
136
IF_ARCH_X86 (CALL (generic::complex_div2, avx::complex_div2, 32 ));
196
137
IF_ARCH_X86 (CALL (generic::complex_rdiv2, avx::complex_rdiv2, 32 ));
197
- IF_ARCH_X86 (CALL (generic::complex_div3, avx::complex_div3, 32 ));
198
138
IF_ARCH_X86 (CALL (generic::complex_div2, avx::complex_div2_fma3, 32 ));
199
139
IF_ARCH_X86 (CALL (generic::complex_rdiv2, avx::complex_rdiv2_fma3, 32 ));
200
- IF_ARCH_X86 (CALL (generic::complex_div3, avx::complex_div3_fma3, 32 ));
140
+ IF_ARCH_X86 (CALL (generic::complex_div2, avx512::complex_div2, 64 ));
141
+ IF_ARCH_X86 (CALL (generic::complex_rdiv2, avx512::complex_rdiv2, 64 ));
201
142
202
143
IF_ARCH_ARM (CALL (generic::complex_div2, neon_d32::complex_div2, 16 ));
203
144
IF_ARCH_ARM (CALL (generic::complex_rdiv2, neon_d32::complex_rdiv2, 16 ));
204
- IF_ARCH_ARM (CALL (generic::complex_div3, neon_d32::complex_div3, 16 ));
205
145
206
146
IF_ARCH_AARCH64 (CALL (generic::complex_div2, asimd::complex_div2, 16 ));
207
147
IF_ARCH_AARCH64 (CALL (generic::complex_rdiv2, asimd::complex_rdiv2, 16 ));
208
- IF_ARCH_AARCH64 (CALL (generic::complex_div3, asimd::complex_div3, 16 ));
209
148
}
210
149
211
150
UTEST_END;
0 commit comments