Skip to content
Permalink
Browse files
[Cocoa] Stop using non-prefixed vDSP functions in 32-bit builds
https://bugs.webkit.org/show_bug.cgi?id=182898
<rdar://problem/37195079>

Reviewed by Tim Horton.

There's no need to use non-prefixed vDSP function aliases on 32-bit builds.
The vDSP-prefixed versions are available on all Cocoa platforms we currently support.

* platform/audio/DirectConvolver.cpp:
(WebCore::DirectConvolver::process):
* platform/audio/VectorMath.cpp:
(WebCore::VectorMath::vsmul):
(WebCore::VectorMath::vadd):
(WebCore::VectorMath::vmul):
(WebCore::VectorMath::zvmul):


Canonical link: https://commits.webkit.org/198654@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
aestes committed Feb 17, 2018
1 parent 78dc89c commit 8511361f9285da73b357bd8fea972a16d4a1b45c
Showing with 19 additions and 37 deletions.
  1. +19 −0 Source/WebCore/ChangeLog
  2. +0 −7 Source/WebCore/platform/audio/DirectConvolver.cpp
  3. +0 −30 Source/WebCore/platform/audio/VectorMath.cpp
@@ -1,3 +1,22 @@
2018-02-16 Andy Estes <aestes@apple.com>

[Cocoa] Stop using non-prefixed vDSP functions in 32-bit builds
https://bugs.webkit.org/show_bug.cgi?id=182898
<rdar://problem/37195079>

Reviewed by Tim Horton.

There's no need to use non-prefixed vDSP function aliases on 32-bit builds.
The vDSP-prefixed versions are available on all Cocoa platforms we currently support.

* platform/audio/DirectConvolver.cpp:
(WebCore::DirectConvolver::process):
* platform/audio/VectorMath.cpp:
(WebCore::VectorMath::vsmul):
(WebCore::VectorMath::vadd):
(WebCore::VectorMath::vmul):
(WebCore::VectorMath::zvmul):

2018-02-16 Ryan Haddad <ryanhaddad@apple.com>

Unreviewed, rolling out r228575.
@@ -74,14 +74,7 @@ void DirectConvolver::process(AudioFloatArray* convolutionKernel, const float* s
memcpy(inputP, sourceP, sizeof(float) * framesToProcess);

#if USE(ACCELERATE)
#if defined(__ppc__) || defined(__i386__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
conv(inputP - kernelSize + 1, 1, kernelP + kernelSize - 1, -1, destP, 1, framesToProcess, kernelSize);
#pragma clang diagnostic pop
#else
vDSP_conv(inputP - kernelSize + 1, 1, kernelP + kernelSize - 1, -1, destP, 1, framesToProcess, kernelSize);
#endif // defined(__ppc__) || defined(__i386__)
#else
// FIXME: The macro can be further optimized to avoid pipeline stalls. One possibility is to maintain 4 separate sums and change the macro to CONVOLVE_FOUR_SAMPLES.
#define CONVOLVE_ONE_SAMPLE \
@@ -49,43 +49,20 @@ namespace VectorMath {

#if USE(ACCELERATE)
// On the Mac we use the highly optimized versions in Accelerate.framework
// In 32-bit mode (__ppc__ or __i386__) <Accelerate/Accelerate.h> includes <vecLib/vDSP_translate.h> which defines macros of the same name as
// our namespaced function names, so we must handle this case differently. Other architectures (64bit, ARM, etc.) do not include this header file.

void vsmul(const float* sourceP, int sourceStride, const float* scale, float* destP, int destStride, size_t framesToProcess)
{
#if defined(__ppc__) || defined(__i386__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
::vsmul(sourceP, sourceStride, scale, destP, destStride, framesToProcess);
#pragma clang diagnostic pop
#else
vDSP_vsmul(sourceP, sourceStride, scale, destP, destStride, framesToProcess);
#endif
}

void vadd(const float* source1P, int sourceStride1, const float* source2P, int sourceStride2, float* destP, int destStride, size_t framesToProcess)
{
#if defined(__ppc__) || defined(__i386__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
::vadd(source1P, sourceStride1, source2P, sourceStride2, destP, destStride, framesToProcess);
#pragma clang diagnostic pop
#else
vDSP_vadd(source1P, sourceStride1, source2P, sourceStride2, destP, destStride, framesToProcess);
#endif
}

void vmul(const float* source1P, int sourceStride1, const float* source2P, int sourceStride2, float* destP, int destStride, size_t framesToProcess)
{
#if defined(__ppc__) || defined(__i386__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
::vmul(source1P, sourceStride1, source2P, sourceStride2, destP, destStride, framesToProcess);
#pragma clang diagnostic pop
#else
vDSP_vmul(source1P, sourceStride1, source2P, sourceStride2, destP, destStride, framesToProcess);
#endif
}

void zvmul(const float* real1P, const float* imag1P, const float* real2P, const float* imag2P, float* realDestP, float* imagDestP, size_t framesToProcess)
@@ -99,14 +76,7 @@ void zvmul(const float* real1P, const float* imag1P, const float* real2P, const
sc2.imagp = const_cast<float*>(imag2P);
dest.realp = realDestP;
dest.imagp = imagDestP;
#if defined(__ppc__) || defined(__i386__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
::zvmul(&sc1, 1, &sc2, 1, &dest, 1, framesToProcess, 1);
#pragma clang diagnostic pop
#else
vDSP_zvmul(&sc1, 1, &sc2, 1, &dest, 1, framesToProcess, 1);
#endif
}

void vsma(const float* sourceP, int sourceStride, const float* scale, float* destP, int destStride, size_t framesToProcess)

0 comments on commit 8511361

Please sign in to comment.