Skip to content

Commit b41e167

Browse files
committed
AVX-512 implementation of mid/side conversion routines
1 parent 5256707 commit b41e167

File tree

6 files changed

+579
-8
lines changed

6 files changed

+579
-8
lines changed

include/private/dsp/arch/x86/avx512/msmatrix.h

Lines changed: 521 additions & 0 deletions
Large diffs are not rendered by default.

src/main/x86/avx512.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include <private/dsp/arch/x86/avx512/copy.h>
4545
#include <private/dsp/arch/x86/avx512/float.h>
4646
#include <private/dsp/arch/x86/avx512/complex.h>
47+
#include <private/dsp/arch/x86/avx512/msmatrix.h>
4748
#undef PRIVATE_DSP_ARCH_X86_AVX512_IMPL
4849

4950
namespace lsp
@@ -85,6 +86,13 @@
8586
CEXPORT1(vl, complex_div3);
8687
CEXPORT1(vl, complex_rcp1);
8788
CEXPORT1(vl, complex_rcp2);
89+
90+
CEXPORT1(vl, lr_to_ms);
91+
CEXPORT1(vl, lr_to_mid);
92+
CEXPORT1(vl, lr_to_side);
93+
CEXPORT1(vl, ms_to_lr);
94+
CEXPORT1(vl, ms_to_left);
95+
CEXPORT1(vl, ms_to_right);
8896
}
8997
} /* namespace avx2 */
9098
} /* namespace lsp */

src/test/ptest/msmatrix/conv2.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
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]>
44
*
55
* This file is part of lsp-dsp-lib
66
* Created on: 31 мар. 2020 г.
@@ -48,6 +48,12 @@ namespace lsp
4848
void lr_to_ms(float *m, float *s, const float *l, const float *r, size_t count);
4949
void ms_to_lr(float *l, float *r, const float *m, const float *s, size_t count);
5050
}
51+
52+
namespace avx512
53+
{
54+
void lr_to_ms(float *m, float *s, const float *l, const float *r, size_t count);
55+
void ms_to_lr(float *l, float *r, const float *m, const float *s, size_t count);
56+
}
5157
)
5258

5359
IF_ARCH_ARM(
@@ -108,13 +114,15 @@ PTEST_BEGIN("dsp.msmatrix", conv2, 5, 1000)
108114
CALL(generic::lr_to_ms);
109115
IF_ARCH_X86(CALL(sse::lr_to_ms));
110116
IF_ARCH_X86(CALL(avx::lr_to_ms));
117+
IF_ARCH_X86(CALL(avx512::lr_to_ms));
111118
IF_ARCH_ARM(CALL(neon_d32::lr_to_ms));
112119
IF_ARCH_AARCH64(CALL(asimd::lr_to_ms));
113120
PTEST_SEPARATOR;
114121

115122
CALL(generic::ms_to_lr);
116123
IF_ARCH_X86(CALL(sse::ms_to_lr));
117124
IF_ARCH_X86(CALL(avx::ms_to_lr));
125+
IF_ARCH_X86(CALL(avx512::ms_to_lr));
118126
IF_ARCH_ARM(CALL(neon_d32::ms_to_lr));
119127
IF_ARCH_AARCH64(CALL(asimd::ms_to_lr));
120128
PTEST_SEPARATOR2;

src/test/ptest/msmatrix/conv2x1.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
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]>
44
*
55
* This file is part of lsp-dsp-lib
66
* Created on: 31 мар. 2020 г.
@@ -54,6 +54,14 @@ namespace lsp
5454
void ms_to_left(float *l, const float *m, const float *s, size_t count);
5555
void ms_to_right(float *r, const float *m, const float *s, size_t count);
5656
}
57+
58+
namespace avx512
59+
{
60+
void lr_to_mid(float *m, const float *l, const float *r, size_t count);
61+
void lr_to_side(float *s, const float *l, const float *r, size_t count);
62+
void ms_to_left(float *l, const float *m, const float *s, size_t count);
63+
void ms_to_right(float *r, const float *m, const float *s, size_t count);
64+
}
5765
)
5866

5967
IF_ARCH_ARM(
@@ -117,27 +125,31 @@ PTEST_BEGIN("dsp.msmatrix", conv2x1, 5, 1000)
117125
CALL(generic::lr_to_mid);
118126
IF_ARCH_X86(CALL(sse::lr_to_mid));
119127
IF_ARCH_X86(CALL(avx::lr_to_mid));
128+
IF_ARCH_X86(CALL(avx512::lr_to_mid));
120129
IF_ARCH_ARM(CALL(neon_d32::lr_to_mid));
121130
IF_ARCH_AARCH64(CALL(asimd::lr_to_mid));
122131
PTEST_SEPARATOR;
123132

124133
CALL(generic::lr_to_side);
125134
IF_ARCH_X86(CALL(sse::lr_to_side));
126135
IF_ARCH_X86(CALL(avx::lr_to_side));
136+
IF_ARCH_X86(CALL(avx512::lr_to_side));
127137
IF_ARCH_ARM(CALL(neon_d32::lr_to_side));
128138
IF_ARCH_AARCH64(CALL(asimd::lr_to_side));
129139
PTEST_SEPARATOR;
130140

131141
CALL(generic::ms_to_left);
132142
IF_ARCH_X86(CALL(sse::ms_to_left));
133143
IF_ARCH_X86(CALL(avx::ms_to_left));
144+
IF_ARCH_X86(CALL(avx512::ms_to_left));
134145
IF_ARCH_ARM(CALL(neon_d32::ms_to_left));
135146
IF_ARCH_AARCH64(CALL(asimd::ms_to_left));
136147
PTEST_SEPARATOR;
137148

138149
CALL(generic::ms_to_right);
139150
IF_ARCH_X86(CALL(sse::ms_to_right));
140151
IF_ARCH_X86(CALL(avx::ms_to_right));
152+
IF_ARCH_X86(CALL(avx512::ms_to_right));
141153
IF_ARCH_ARM(CALL(neon_d32::ms_to_right));
142154
IF_ARCH_AARCH64(CALL(asimd::ms_to_right));
143155
PTEST_SEPARATOR2;

src/test/utest/msmatrix/conv2.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
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]>
44
*
55
* This file is part of lsp-dsp-lib
66
* Created on: 31 мар. 2020 г.
@@ -46,6 +46,12 @@ namespace lsp
4646
void lr_to_ms(float *m, float *s, const float *l, const float *r, size_t count);
4747
void ms_to_lr(float *l, float *r, const float *m, const float *s, size_t count);
4848
}
49+
50+
namespace avx512
51+
{
52+
void lr_to_ms(float *m, float *s, const float *l, const float *r, size_t count);
53+
void ms_to_lr(float *l, float *r, const float *m, const float *s, size_t count);
54+
}
4955
)
5056

5157
IF_ARCH_ARM(
@@ -133,6 +139,9 @@ UTEST_BEGIN("dsp.msmatrix", conv2)
133139
IF_ARCH_X86(CALL(generic::lr_to_ms, avx::lr_to_ms, 32));
134140
IF_ARCH_X86(CALL(generic::ms_to_lr, avx::ms_to_lr, 32));
135141

142+
IF_ARCH_X86(CALL(generic::lr_to_ms, avx512::lr_to_ms, 64));
143+
IF_ARCH_X86(CALL(generic::ms_to_lr, avx512::ms_to_lr, 64));
144+
136145
IF_ARCH_ARM(CALL(generic::lr_to_ms, neon_d32::lr_to_ms, 16));
137146
IF_ARCH_ARM(CALL(generic::ms_to_lr, neon_d32::ms_to_lr, 16));
138147

src/test/utest/msmatrix/conv2x1.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
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]>
44
*
55
* This file is part of lsp-dsp-lib
66
* Created on: 31 мар. 2020 г.
@@ -52,6 +52,14 @@ namespace lsp
5252
void ms_to_left(float *l, const float *m, const float *s, size_t count);
5353
void ms_to_right(float *r, const float *m, const float *s, size_t count);
5454
}
55+
56+
namespace avx512
57+
{
58+
void lr_to_mid(float *m, const float *l, const float *r, size_t count);
59+
void lr_to_side(float *s, const float *l, const float *r, size_t count);
60+
void ms_to_left(float *l, const float *m, const float *s, size_t count);
61+
void ms_to_right(float *r, const float *m, const float *s, size_t count);
62+
}
5563
)
5664

5765
IF_ARCH_ARM(
@@ -139,6 +147,11 @@ UTEST_BEGIN("dsp.msmatrix", conv2x1)
139147
IF_ARCH_X86(CALL(generic::ms_to_left, avx::ms_to_left, 32));
140148
IF_ARCH_X86(CALL(generic::ms_to_right, avx::ms_to_right, 32));
141149

150+
IF_ARCH_X86(CALL(generic::lr_to_mid, avx512::lr_to_mid, 64));
151+
IF_ARCH_X86(CALL(generic::lr_to_side, avx512::lr_to_side, 64));
152+
IF_ARCH_X86(CALL(generic::ms_to_left, avx512::ms_to_left, 64));
153+
IF_ARCH_X86(CALL(generic::ms_to_right, avx512::ms_to_right, 64));
154+
142155
IF_ARCH_ARM(CALL(generic::lr_to_mid, neon_d32::lr_to_mid, 16));
143156
IF_ARCH_ARM(CALL(generic::lr_to_side, neon_d32::lr_to_side, 16));
144157
IF_ARCH_ARM(CALL(generic::ms_to_left, neon_d32::ms_to_left, 16));

0 commit comments

Comments
 (0)