diff --git a/src/frameworks/Accelerate/vecLib/vDSP/CMakeLists.txt b/src/frameworks/Accelerate/vecLib/vDSP/CMakeLists.txt
index 99432798f..6ef701609 100644
--- a/src/frameworks/Accelerate/vecLib/vDSP/CMakeLists.txt
+++ b/src/frameworks/Accelerate/vecLib/vDSP/CMakeLists.txt
@@ -5,7 +5,8 @@ set(DYLIB_COMPAT_VERSION "1.0.0")
set(DYLIB_CURRENT_VERSION "671.250.4")
add_darling_library(vDSP SHARED
- src/vDSP.c
+ src/vDSP.c
+ src/extrema.c
)
make_fat(vDSP)
target_link_libraries(vDSP system)
diff --git a/src/frameworks/Accelerate/vecLib/vDSP/include/vDSP/vDSP.h b/src/frameworks/Accelerate/vecLib/vDSP/include/vDSP/vDSP.h
index 047f32ff0..c6b437c5b 100644
--- a/src/frameworks/Accelerate/vecLib/vDSP/include/vDSP/vDSP.h
+++ b/src/frameworks/Accelerate/vecLib/vDSP/include/vDSP/vDSP.h
@@ -21,6 +21,9 @@
#ifndef _vDSP_H_
#define _vDSP_H_
+typedef unsigned long vDSP_Length;
+typedef long vDSP_Stride;
+
void* vDSP_DCT_CreateSetup(void);
void* vDSP_DCT_Execute(void);
void* vDSP_DFT_CreateSetup(void);
@@ -144,7 +147,6 @@ void* vDSP_hann_window(void);
void* vDSP_hann_windowD(void);
void* vDSP_imgfir(void);
void* vDSP_imgfirD(void);
-void* vDSP_maxmgv(void);
void* vDSP_maxmgvD(void);
void* vDSP_maxmgvi(void);
void* vDSP_maxmgviD(void);
diff --git a/src/frameworks/Accelerate/vecLib/vDSP/src/basic.c b/src/frameworks/Accelerate/vecLib/vDSP/src/basic.c
new file mode 100644
index 000000000..ecdd15b23
--- /dev/null
+++ b/src/frameworks/Accelerate/vecLib/vDSP/src/basic.c
@@ -0,0 +1,36 @@
+/*
+ This file is part of Darling.
+
+ Copyright (C) 2020 Lubos Dolezel
+
+ Darling is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Darling is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Darling. If not, see .
+*/
+
+#include
+
+void vDSP_vsadd(const float *__A, vDSP_Stride __IA, const float *__B, float *__C, vDSP_Stride __IC, vDSP_Length __N)
+{
+ if (__IA == 1 && __IC == 1)
+ {
+ #pragma clang loop vectorize(enable)
+ for (vDSP_Length i = 0; i < __N; i++)
+ __C[i] = __A[i] + __B[i];
+ }
+ else
+ {
+ #pragma clang loop vectorize(enable)
+ for (vDSP_Length i = 0; i < __N; i++)
+ __C[i * __IC] = __A[i * __IA] + __B[i * __IA];
+ }
+}
diff --git a/src/frameworks/Accelerate/vecLib/vDSP/src/extrema.c b/src/frameworks/Accelerate/vecLib/vDSP/src/extrema.c
new file mode 100644
index 000000000..9afede655
--- /dev/null
+++ b/src/frameworks/Accelerate/vecLib/vDSP/src/extrema.c
@@ -0,0 +1,45 @@
+/*
+ This file is part of Darling.
+
+ Copyright (C) 2020 Lubos Dolezel
+
+ Darling is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Darling is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Darling. If not, see .
+*/
+
+#include
+#include
+
+void vDSP_maxmgv(const float *__A, vDSP_Stride __IA, float *__C, vDSP_Length __N)
+{
+ *__C = -INFINITY;
+
+ if (__N != 1)
+ {
+ #pragma clang loop vectorize(enable)
+ for (vDSP_Length i = 0; i < __N; i++)
+ {
+ if (*__C < fabsf(__A[i * __IA]))
+ *__C = fabsf(__A[i * __IA]);
+ }
+ }
+ else
+ {
+ #pragma clang loop vectorize(enable)
+ for (vDSP_Length i = 0; i < __N; i++)
+ {
+ if (*__C < fabsf(__A[i]))
+ *__C = fabsf(__A[i]);
+ }
+ }
+}
diff --git a/src/frameworks/Accelerate/vecLib/vDSP/src/vDSP.c b/src/frameworks/Accelerate/vecLib/vDSP/src/vDSP.c
index 780e7b69e..24c037abc 100644
--- a/src/frameworks/Accelerate/vecLib/vDSP/src/vDSP.c
+++ b/src/frameworks/Accelerate/vecLib/vDSP/src/vDSP.c
@@ -767,11 +767,13 @@ void* vDSP_imgfirD(void)
return NULL;
}
+/*
void* vDSP_maxmgv(void)
{
if (verbose) puts("STUB: vDSP_maxmgv called");
return NULL;
}
+*/
void* vDSP_maxmgvD(void)
{
@@ -1991,11 +1993,13 @@ void* vDSP_vrvrsD(void)
return NULL;
}
+/*
void* vDSP_vsadd(void)
{
if (verbose) puts("STUB: vDSP_vsadd called");
return NULL;
}
+*/
void* vDSP_vsaddD(void)
{