mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-03-29 07:58:06 -04:00
spa: use the right AVX2 flags
Our AVX optimizations are really AVX2 so rename the files and functions and use the right HAVE_AVX2 and cpu flags to compile and select the right functions. Fixes #5072
This commit is contained in:
parent
5871f88b81
commit
8eb60b132c
15 changed files with 66 additions and 66 deletions
|
|
@ -143,9 +143,9 @@ static void test_f32(void)
|
|||
run_test("test_f32", "sse", mix_f32_sse);
|
||||
}
|
||||
#endif
|
||||
#if defined (HAVE_AVX)
|
||||
if (cpu_flags & SPA_CPU_FLAG_AVX) {
|
||||
run_test("test_f32", "avx", mix_f32_avx);
|
||||
#if defined (HAVE_AVX2)
|
||||
if (cpu_flags & SPA_CPU_FLAG_AVX2) {
|
||||
run_test("test_f32", "avx2", mix_f32_avx2);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,15 +35,15 @@ if have_sse2
|
|||
simd_cargs += ['-DHAVE_SSE2']
|
||||
simd_dependencies += audiomixer_sse2
|
||||
endif
|
||||
if have_avx and have_fma
|
||||
audiomixer_avx = static_library('audiomixer_avx',
|
||||
['mix-ops-avx.c'],
|
||||
c_args : [avx_args, fma_args, '-O3', '-DHAVE_AVX', '-DHAVE_FMA'],
|
||||
if have_avx2 and have_fma
|
||||
audiomixer_avx2 = static_library('audiomixer_avx2',
|
||||
['mix-ops-avx2.c'],
|
||||
c_args : [avx2_args, fma_args, '-O3', '-DHAVE_AVX2', '-DHAVE_FMA'],
|
||||
dependencies : [ spa_dep ],
|
||||
install : false
|
||||
)
|
||||
simd_cargs += ['-DHAVE_AVX', '-DHAVE_FMA']
|
||||
simd_dependencies += audiomixer_avx
|
||||
simd_cargs += ['-DHAVE_AVX2', '-DHAVE_FMA']
|
||||
simd_dependencies += audiomixer_avx2
|
||||
endif
|
||||
|
||||
audiomixer_lib = static_library('audiomixer',
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
#include <immintrin.h>
|
||||
|
||||
void
|
||||
mix_f32_avx(struct mix_ops *ops, void * SPA_RESTRICT dst, const void * SPA_RESTRICT src[],
|
||||
mix_f32_avx2(struct mix_ops *ops, void * SPA_RESTRICT dst, const void * SPA_RESTRICT src[],
|
||||
uint32_t n_src, uint32_t n_samples)
|
||||
{
|
||||
n_samples *= ops->n_channels;
|
||||
|
|
@ -26,9 +26,9 @@ struct mix_info {
|
|||
static struct mix_info mix_table[] =
|
||||
{
|
||||
/* f32 */
|
||||
#if defined(HAVE_AVX)
|
||||
{ SPA_AUDIO_FORMAT_F32, 0, SPA_CPU_FLAG_AVX, 4, mix_f32_avx },
|
||||
{ SPA_AUDIO_FORMAT_F32P, 0, SPA_CPU_FLAG_AVX, 4, mix_f32_avx },
|
||||
#if defined(HAVE_AVX2)
|
||||
{ SPA_AUDIO_FORMAT_F32, 0, SPA_CPU_FLAG_AVX2, 4, mix_f32_avx2 },
|
||||
{ SPA_AUDIO_FORMAT_F32P, 0, SPA_CPU_FLAG_AVX2, 4, mix_f32_avx2 },
|
||||
#endif
|
||||
#if defined (HAVE_SSE)
|
||||
{ SPA_AUDIO_FORMAT_F32, 0, SPA_CPU_FLAG_SSE, 4, mix_f32_sse },
|
||||
|
|
|
|||
|
|
@ -144,6 +144,6 @@ DEFINE_FUNCTION(f32, sse);
|
|||
#if defined(HAVE_SSE2)
|
||||
DEFINE_FUNCTION(f64, sse2);
|
||||
#endif
|
||||
#if defined(HAVE_AVX)
|
||||
DEFINE_FUNCTION(f32, avx);
|
||||
#if defined(HAVE_AVX2)
|
||||
DEFINE_FUNCTION(f32, avx2);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -220,11 +220,11 @@ static void test_f32(void)
|
|||
run_test("test_f32_4_sse", src, 4, out_4, sizeof(out_4), SPA_N_ELEMENTS(out_4), mix_f32_sse);
|
||||
}
|
||||
#endif
|
||||
#if defined(HAVE_AVX)
|
||||
if (cpu_flags & SPA_CPU_FLAG_AVX) {
|
||||
run_test("test_f32_0_avx", NULL, 0, out, sizeof(out), SPA_N_ELEMENTS(out), mix_f32_avx);
|
||||
run_test("test_f32_1_avx", src, 1, in_1, sizeof(in_1), SPA_N_ELEMENTS(in_1), mix_f32_avx);
|
||||
run_test("test_f32_4_avx", src, 4, out_4, sizeof(out_4), SPA_N_ELEMENTS(out_4), mix_f32_avx);
|
||||
#if defined(HAVE_AVX2)
|
||||
if (cpu_flags & SPA_CPU_FLAG_AVX2) {
|
||||
run_test("test_f32_0_avx", NULL, 0, out, sizeof(out), SPA_N_ELEMENTS(out), mix_f32_avx2);
|
||||
run_test("test_f32_1_avx", src, 1, in_1, sizeof(in_1), SPA_N_ELEMENTS(in_1), mix_f32_avx2);
|
||||
run_test("test_f32_4_avx", src, 4, out_4, sizeof(out_4), SPA_N_ELEMENTS(out_4), mix_f32_avx2);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue