Skip to content

[Accelerate] [vDSP] DFT, FFT, DCT, and Biquad #24207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d17f5c5
Swift overlay to vDSP cascaded biquad IIR filter.
Mar 15, 2019
7989a9e
update comment in test
Mar 15, 2019
0e04f8d
Swift overlay to vDSP Discrete Cosine Transform
Mar 15, 2019
444712a
Swift Overlays to vDSP Fast Fourier Transform and Discrete Fourier Tr…
Mar 16, 2019
ec57052
Tests for DFT and FFT
Mar 16, 2019
5dae4b1
Some refactoring and begin documentation.
Mar 16, 2019
0a98301
Swift overlays to FFT and DFT operations.
Mar 17, 2019
fe7df71
Merge branch 'master' into accelerate-vDSP-biquad
FlexMonkey Mar 27, 2019
a5febe7
Refactor Tests
FlexMonkey Mar 27, 2019
35229bd
Merge branch 'master' into accelerate-vDSP-discreteCosineTransform
FlexMonkey Mar 27, 2019
a3fff73
Merge branch 'master' into accelerate-vDSP-fourierTransform
FlexMonkey Mar 27, 2019
01002f9
Refactor Tests
FlexMonkey Mar 27, 2019
e774ae7
Merge branch 'master' into accelerate-vDSP-discreteCosineTransform
FlexMonkey Apr 1, 2019
8048380
Provide transform function that returns the result. Refactoring: para…
FlexMonkey Apr 1, 2019
38b7cb2
Merge branch 'master' into accelerate-vDSP-biquad
FlexMonkey Apr 1, 2019
0ec88cb
Add apply() function that returns the result.
FlexMonkey Apr 1, 2019
613d57d
Merge branch 'master' into accelerate-vDSP-fourierTransform
FlexMonkey Apr 1, 2019
4d15bd8
Added a version of DFT transform that returns the result.
FlexMonkey Apr 1, 2019
8a28fb2
update some DFT comments
FlexMonkey Apr 8, 2019
96dc6fe
Remove FFT overlays from this branch to separate DFT and FFT pull req…
FlexMonkey Apr 8, 2019
dd0a330
[Accelerate] [vDSP] Swift Overlays to FFT Operations
FlexMonkey Apr 8, 2019
1985948
Merge branch 'accelerate-vDSP-discreteCosineTransform' into Accelerat…
Apr 20, 2019
8377f22
Merge remote-tracking branch 'origin/accelerate-vDSP-fourierTransform…
Apr 20, 2019
f3490ca
Merge remote-tracking branch 'origin/accelerate-vDSP-biquad' into Acc…
Apr 20, 2019
4c64150
Merge branch 'accelerate-vDSP-FFT' into Accelerate_DFT-FFT-DCT-Biquad
Apr 20, 2019
6999b74
Composite Branch
Apr 20, 2019
0727d18
Merge branch 'master' into Accelerate_DFT-FFT-DCT-Biquad
stephentyrone Apr 22, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions stdlib/public/Darwin/Accelerate/Accelerate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,13 @@ public enum vDSP {}

/// An enum that acts as a namespace for Swift overlays to vForce based functions.
public enum vForce {}

extension vDSP {
public struct VectorizableFloat {
public typealias Scalar = Float
}

public struct VectorizableDouble {
public typealias Scalar = Double
}
}
50 changes: 25 additions & 25 deletions stdlib/public/Darwin/Accelerate/AccelerateBuffer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@
/// provide the withUnsafeBufferPointer function.
@available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *)
public protocol AccelerateBuffer {
/// The buffer's element type.
associatedtype Element

/// The number of elements in the buffer.
var count: Int { get }

/// Calls a closure with a pointer to the object's contiguous storage.
func withUnsafeBufferPointer<R>(
_ body: (UnsafeBufferPointer<Element>) throws -> R
) rethrows -> R
/// The buffer's element type.
associatedtype Element
/// The number of elements in the buffer.
var count: Int { get }
/// Calls a closure with a pointer to the object's contiguous storage.
func withUnsafeBufferPointer<R>(
_ body: (UnsafeBufferPointer<Element>) throws -> R
) rethrows -> R
}

/// A mutable object composed of count elements that are stored contiguously
Expand All @@ -36,29 +36,29 @@ public protocol AccelerateBuffer {
/// MutableCollections, but they need not be.
@available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *)
public protocol AccelerateMutableBuffer: AccelerateBuffer {
/// Calls the given closure with a pointer to the object's mutable
/// contiguous storage.
mutating func withUnsafeMutableBufferPointer<R>(
_ body: (inout UnsafeMutableBufferPointer<Element>) throws -> R
) rethrows -> R
/// Calls the given closure with a pointer to the object's mutable
/// contiguous storage.
mutating func withUnsafeMutableBufferPointer<R>(
_ body: (inout UnsafeMutableBufferPointer<Element>) throws -> R
) rethrows -> R
}

@available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *)
public extension AccelerateBuffer where Self: Collection {
func withUnsafeBufferPointer<R>(
_ body: (UnsafeBufferPointer<Element>) throws -> R
) rethrows -> R {
return try withContiguousStorageIfAvailable(body)!
}
func withUnsafeBufferPointer<R>(
_ body: (UnsafeBufferPointer<Element>) throws -> R
) rethrows -> R {
return try withContiguousStorageIfAvailable(body)!
}
}

@available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *)
extension AccelerateMutableBuffer where Self: MutableCollection {
public mutating func withUnsafeMutableBufferPointer<R>(
_ body: (inout UnsafeMutableBufferPointer<Element>) throws -> R
) rethrows -> R {
return try withContiguousMutableStorageIfAvailable(body)!
}
public mutating func withUnsafeMutableBufferPointer<R>(
_ body: (inout UnsafeMutableBufferPointer<Element>) throws -> R
) rethrows -> R {
return try withContiguousMutableStorageIfAvailable(body)!
}
}

@available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *)
Expand Down
7 changes: 6 additions & 1 deletion stdlib/public/Darwin/Accelerate/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ include("../../../../cmake/modules/StandaloneOverlay.cmake")
add_swift_target_library(swiftAccelerate ${SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES} IS_SDK_OVERLAY
Accelerate.swift
AccelerateBuffer.swift
Quadrature.swift
vDSP_Arithmetic.swift
vDSP_Biquad.swift
vDSP_ClippingLimitThreshold.swift
vDSP_ComplexConversion.swift
vDSP_ComplexOperations.swift
vDSP_Conversion.swift
vDSP_Convolution.swift
vDSP_DCT.swift
vDSP_DFT.swift
vDSP_DecibelConversion.swift
vDSP_FFT.swift
vDSP_FFT_DFT_Common.swift
vDSP_FIR.swift
vDSP_FillClearGenerate.swift
vDSP_Geometry.swift
Expand All @@ -23,7 +29,6 @@ add_swift_target_library(swiftAccelerate ${SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES
vDSP_SingleVectorOperations.swift
vDSP_SlidingWindow.swift
vForce_Operations.swift
Quadrature.swift

"${SWIFT_SOURCE_DIR}/stdlib/linker-support/magic-symbols-for-install-name.c"

Expand Down
Loading