mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
@inline(__always) does not imply inlinable, which means that it effectively does nothing in the context of the Accelerate overlay. I have replaced all of these with @inlinable where that can be done as a one-line change. Functions that switch over open enums and more complex API (DCT, DFT, FFT) will require more sophisticated corrections, which we can undertake in later commits. For now, they have been rolled back to simply being normal public API.
75 lines
3.1 KiB
Swift
75 lines
3.1 KiB
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
extension vDSP {
|
|
|
|
/// Converts split complex to interleaved complex; single-precision.
|
|
///
|
|
/// - Parameter splitComplexVector: Source vector.
|
|
/// - Parameter interleavedComplexVector: Destination vector.
|
|
@inlinable
|
|
@available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *)
|
|
public static func convert(splitComplexVector: DSPSplitComplex,
|
|
toInterleavedComplexVector interleavedComplexVector: inout [DSPComplex]) {
|
|
|
|
withUnsafePointer(to: splitComplexVector) {
|
|
vDSP_ztoc($0, 1,
|
|
&interleavedComplexVector, 2,
|
|
vDSP_Length(interleavedComplexVector.count))
|
|
}
|
|
}
|
|
|
|
/// Converts interleaved complex to split complex; single-precision.
|
|
///
|
|
/// - Parameter interleavedComplexVector: Source vector.
|
|
/// - Parameter splitComplexVector: Destination vector.
|
|
@inlinable
|
|
@available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *)
|
|
public static func convert(interleavedComplexVector: [DSPComplex],
|
|
toSplitComplexVector splitComplexVector: inout DSPSplitComplex) {
|
|
|
|
vDSP_ctoz(interleavedComplexVector, 2,
|
|
&splitComplexVector, 1,
|
|
vDSP_Length(interleavedComplexVector.count))
|
|
}
|
|
|
|
/// Converts split complex to interleaved complex; double-precision.
|
|
///
|
|
/// - Parameter splitComplexVector: Source vector.
|
|
/// - Parameter interleavedComplexVector: Destination vector.
|
|
@inlinable
|
|
@available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *)
|
|
public static func convert(splitComplexVector: DSPDoubleSplitComplex,
|
|
toInterleavedComplexVector interleavedComplexVector: inout [DSPDoubleComplex]) {
|
|
|
|
withUnsafePointer(to: splitComplexVector) {
|
|
vDSP_ztocD($0, 1,
|
|
&interleavedComplexVector, 2,
|
|
vDSP_Length(interleavedComplexVector.count))
|
|
}
|
|
}
|
|
|
|
/// Converts interleaved complex to split complex; double-precision.
|
|
///
|
|
/// - Parameter interleavedComplexVector: Source vector.
|
|
/// - Parameter splitComplexVector: Destination vector.
|
|
@inlinable
|
|
@available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *)
|
|
public static func convert(interleavedComplexVector: [DSPDoubleComplex],
|
|
toSplitComplexVector splitComplexVector: inout DSPDoubleSplitComplex) {
|
|
|
|
vDSP_ctozD(interleavedComplexVector, 2,
|
|
&splitComplexVector, 1,
|
|
vDSP_Length(interleavedComplexVector.count))
|
|
}
|
|
}
|