Framework

Accelerate

Make large-scale mathematical computations and image calculations, optimized for high performance and low-energy consumption.

Overview

Accelerate provides high-performance, energy-efficient computation on the CPU by leveraging its vector-processing capability. The following Accelerate libraries abstract that capability so that code written for them executes appropriate instructions for the processor available at runtime:

  • vImage. A wide range of image-processing functions, including Core Graphics and Core Video interoperation, format conversion, and image manipulation.

  • vDSP. Digital signal processing functions, including 1D and 2D fast Fourier transforms, biquadratic filtering, vector and matrix arithmetic, convolution, and type conversion.

  • vForce. Functions for performing arithmetic and transcendental functions on vectors.

  • Sparse Solvers, BLAS, and LAPACK. Libraries for performing linear algebra on sparse and dense matrices.

  • BNNS. Subroutines for constructing and running neural networks.

Although not part of the Accelerate framework, the following libraries are closely related:

  • simd. A module for performing computations on small vectors and matrices.

  • Compression. Algorithms for lossless data compression; supports LZFSE, LZ4, LZMA, and ZLIB algorithms.

Topics

Image Processing Essentials

Creating a Core Graphics Image Format

Provide descriptions of Core Graphics image formats for conversions to and from vImage.

Creating and Populating Buffers from Core Graphics Images

Initialize vImage buffers from Core Graphics images.

Creating a Core Graphics Image from a vImage Buffer

Create displayable representations of vImage buffers.

Applying vImage Operations to Regions of Interest

Limit the effect of vImage operations to rectangular regions of interest.

Optimizing Image Processing Performance

Improve your app's performance by converting image buffer formats from interleaved to planar.

vImage

Manipulate large images using the CPU’s vector processor.

Signal Processing Essentials

Controlling vDSP Operations with Stride

Operate selectively on the elements of a vector at regular intervals.

Use Linear Interpolation to Construct New Data Points

Fill the gaps in arrays of numerical data using linear interpolation.

Using vDSP for Vector-based Arithmetic

Increase the performance of common mathematical tasks with vDSP vector-vector and vector-scalar operations.

Resampling a Signal with Decimation

Reduce the sample rate of a signal, by specifying a decimation factor and applying a custom antialiasing filter.

vDSP

Perform basic arithmetic operations and common digital signal processing routines on large vectors.

Core Video Interoperation

Reading From and Writing to Core Video Pixel Buffers

Transfer image data between Core Video pixel buffers and vImage buffers to integrate vImage operations into a Core Image workflow

Applying vImage Operations to Video Sample Buffers

Use vImage’s convert-any-to-any function to perform real-time image processing of video frames streamed from your device’s camera.

Real-Time Video Effects with vImage

Use vImage to apply effects to a video feed in real time.

Core Video Interoperability

Pass image data between Core Video and vImage.

Vectors, Matrices, and Quaternions

Working with Vectors

Use vectors to calculate geometric values, calculate dot products and cross products, and interpolate between values.

Working with Matrices

Solve simultaneous equations and transform points in space.

Working with Quaternions

Rotate points around the surface of a sphere, and interpolate between them.

Rotating a Cube by Transforming Its Vertices

Rotate a cube through a series of keyframes using quaternion interpolation to transition between them.

simd

Perform computations on small vectors and matrices.

Fourier and Cosine Transforms

Finding the Component Frequencies in a Composite Sine Wave

Use 1D fast Fourier transform to compute the frequency components of a signal.

Using Windowing with Discrete Fourier Transforms

Multiply signal data by window sequence values to reduce spectral leakage.

Signal Extraction from Noise

Use Accelerate’s discrete cosine transform to remove noise from a signal.

Halftone Descreening with 2D Fast Fourier Transform

Reduce or remove periodic artifacts from images.

Audio Processing

Equalizing Audio with vDSP

Shape audio output using discrete cosine transforms and biquadratic filters.

Biquadratic IIR Filters

Apply biquadratic filters to single- and multi-channel data.

Conversion Between Image Formats

Building a Basic Conversion Workflow

Learn the fundamentals of the convert-any-to-any function by converting a CMYK image to an RGB image.

Converting Color Images to Grayscale

Convert a color image to grayscale using matrix multiplication.

Standardizing Arbitrary Image Formats for Processing

Convert assets with disparate color spaces and bit depths to a standard working format for applying vImage operations.

Converting Luminance and Chrominance Planes to an ARGB Image

Create a displayable ARGB image from the luminance and chrominance information supplied by your device’s camera.

Conversion

Convert an image to a different format.

Image Resampling

Resampling in vImage

Learn how vImage resamples image data during geometric operations.

Reducing Artifacts in Resampled Images

Avoid ringing effects introduced by the default Lanczos algorithm when scaling an image by using a custom resampling filter.

Image Shearing

Shear images horizontally and vertically.

Convolution and Morphology

Blurring an Image

Filter an image by convolving it with custom and high-speed kernels.

Adding a Bokeh Effect

Simulate a bokeh effect by applying dilation.

Convolution

Apply a convolution kernel to an image.

Morphology

Dilate and erode images.

Color and Tone Adjustment

Adjusting the Brightness and Contrast of an Image

Use a gamma function to apply a linear or exponential curve.

Specifying Histograms with vImage

Calculate the histogram of one image and apply it to a second image.

Transform

Apply color transformations to images.

Histogram

Calculate and or manipulate an image's histogram.

Sparse Matrices

Creating Sparse Matrices

Create sparse matrices for factorization and solving systems.

Implementing Iterative Methods

Use iterative methods to solve large problems faster and with a lower memory overhead than with direct methods.

Solving Systems Using Direct Methods

Use direct methods to solve systems of equations where the coefficient matrix is sparse.

Solving Systems Using Iterative Methods

Use iterative methods to solve systems of equations where the coefficient matrix is sparse.

Creating a Sparse Matrix from Coordinate Format Arrays

Use separate coordinate format arrays to create sparse matrices.

Sparse Solvers

Solve systems of equations where the coefficient matrix is sparse.

Compression

Compressing and Decompressing Data with Buffer Compression

Compress a string, write it to the file system, and decompress the same file using buffer compression.

Compressing and Decompressing Files with Stream Compression

Perform compression or the appropriate kind of decompression to a file based on its path extension.

Compressing and Decompressing Data with Input and Output Filters

Compress and decompress streamed or from-memory data, using input and output filters.

Compressing and Decompressing Files with Swift Stream Compression

Perform compression for all files and decompression for files with supported extension types.

Arithmetic and Transcendental Functions

vecLib

Perform computations on large vectors.

Linear Algebra

BLAS

Apple’s implementation of the Basic Linear Algebra Subprograms (BLAS).

Neural Networks

BNNS

Implement and run neural networks, using previously obtained training data.

Definite Integration

Quadrature

Approximates the definite integral of a function over a finite or infinite interval.