| Framework | Accelerate/vecLib |
| Declared in | vDSP.h |
Describes the C API for the correlation, convolution, and filtering functions in vecLib.
vDSP_conv
vDSP_convD
vDSP_zconv
vDSP_zconvD
vDSP_wiener
vDSP_wienerD
vDSP_desamp
vDSP_desampD
vDSP_zrdesamp
vDSP_zrdesampD
vDSP_blkman_window
vDSP_blkman_windowD
vDSP_hamm_window
vDSP_hamm_windowD
vDSP_hann_window
vDSP_hann_windowD
vDSP_f3x3
vDSP_f3x3D
vDSP_f5x5
vDSP_f5x5D
vDSP_imgfir
vDSP_imgfirD
Creates a single-precision Blackman window.
void vDSP_blkman_window( float * C, vDSP_Length N, int FLAG);
vDSP_blkman_window creates a single-precision Blackman window function C, which can be multiplied by a vector using vDSP_vmul. Specify the vDSP_HALF_WINDOW flag to create only the first (n+1)/2 points, or 0 (zero) for full size window.
See also vDSP_vmul.
vDSP.hCreates a double-precision Blackman window.
void vDSP_blkman_windowD (double * C, vDSP_Length N, int FLAG);
vDSP_blkman_window creates a double-precision Blackman window function C, which can be multiplied by a vector using vDSP_vmulD . Specify the vDSP_HALF_WINDOW flag to create only the first (n+1)/2 points, or 0 (zero) for full size window.
See also vDSP_vmulD.
vDSP.hPerforms either correlation or convolution on two vectors; single precision.
vDSP_conv (const float signal[], vDSP_Stride signalStride, const float filter[], vDSP_Stride strideFilter, float result[], vDSP_Stride strideResult, vDSP_Length lenResult, vDSP_Length lenFilter);

If filterStride is positive, vDSP_conv performs correlation. If filterStride is negative,it performs convolution and *filtermust point to the last vector element. The function can run in place, but result cannot be in place with filter.
The value of lenFilter must be less than or equal to 2044. The length of vector signal must satisfy two criteria: it must be
equal to or greater than 12
equal to or greater than the sum of N-1 plus the nearest multiple of 4 that is equal to or greater than the value of lenFilter.
Criteria to invoke vectorized code:
The vectors signal and result must be relatively aligned.
The value of lenFilter must be between 4 and 256, inclusive.
The value of lenResult must be greater than 36.
The values of signalStride and resultStride must be 1.
The value of filterStride must be either 1 or -1.
If any of these criteria is not satisfied, the function invokes scalar code.
vDSP.h Performs either correlation or convolution on two vectors; double precision.
void vDSP_convD (const double signal[], vDSP_Stride signalStride, const double filter[], vDSP_Stride strideFilter, double result[], vDSP_Stride strideResult, vDSP_Length lenResult, vDSP_Length lenFilter);

If filterStride is positive, vDSP_convD performs correlation. If filterStride is negative,it performs convolution and *filtermust point to the last vector element. The function can run in place, but result cannot be in place with filter.
The value of lenFilter must be less than or equal to 2044. The length of vector signal must satisfy two criteria: it must be
equal to or greater than 12
equal to or greater than the sum of N-1 plus the nearest multiple of 4 that is equal to or greater than the value of lenFilter.
Criteria to invoke vectorized code:
No Altivec support for double precision. On a PowerPC processor, this function always invokes scalar code.
vDSP.h Convolution with decimation; single precision.
void vDSP_desamp (float * A, vDSP_Stride I, float * B, float * C, vDSP_Length N, vDSP_Length M);
Single-precision real input vector, 8-byte aligned; length of A >= 12
Desampling factor
Single-precision input filter coefficients
Single-precision real output vector
Output count
Filter coefficient count
Performs finite impulse response (FIR) filtering at selected positions of vector A. desampx can run in place, but C cannot be in place with B. Length of A must be >=(N-1)*I+(nearest multiple of 4 >=M).

vDSP.h Convolution with decimation; double precision.
void vDSP_desampD (double * A, vDSP_Stride I, double * B, double * C, vDSP_Length N, vDSP_Length M);
Double-precision real input vector, 8-byte aligned; length of A >= 12
Desampling factor
Double-precision input filter coefficients
Double-precision real output vector
Output count
Filter coefficient count
Performs finite impulse response (FIR) filtering at selected positions of vector A. desampx can run in place, but C cannot be in place with B. Length of A must be >=(N-1)*I+(nearest multiple of 4 >=M).

vDSP.hFilters an image by performing a two-dimensional convolution with a 3x3 kernel on the input matrix A. The resulting image is placed in the output matrix C; single precision.
void vDSP_f3x3 (float * signal, vDSP_Length rows, vDSP_Length cols, float * filter, float * result);
This performs the operation

The function pads the perimeter of the output image with a border of zeros of width 1.
B is the 3x3 kernel. M and N are the number of rows and columns, respectively, of the two-dimensional input matrix A. M must be greater than or equal to 3. N must be even and greater than or equal to 4.
Criteria to invoke vectorized code:
A, B, and C must be 16-byte aligned.
N must be greater than or equal to 18.
If any of these criteria is not satisfied, the function invokes scalar code.
vDSP.hFilters an image by performing a two-dimensional convolution with a 3x3 kernel on the input matrix A. The resulting image is placed in the output matrix C; double precision.
void vDSP_f3x3D (double * signal, vDSP_Length rows, vDSP_Length cols, double * filter, double * result);
This performs the operation

The function pads the perimeter of the output image with a border of zeros of width 1.
B is the 3x3 kernel. M and N are the number of rows and columns, respectively, of the two-dimensional input matrix A. M must be greater than or equal to 3. N must be even and greater than or equal to 4.
Criteria to invoke vectorized code:
A, B, and C must be 16-byte aligned.
N must be greater than or equal to 18.
If any of these criteria is not satisfied, the function invokes scalar code.
vDSP.hFilters an image by performing a two-dimensional convolution with a 5x5 kernel on the input matrix signal. The resulting image is placed in the output matrix result; single precision.
void vDSP_f5x5 (float * signal, vDSP_Length rows, vDSP_Length cols, float * filter, float * result);
This performs the operation

The function pads the perimeter of the output image with a border of zeros of width 2.
B is the 3x3 kernel. M and N are the number of rows and columns, respectively, of the two-dimensional input matrix A. M must be greater than or equal to 5. N must be even and greater than or equal to 6.
Criteria to invoke vectorized code:
A, B, and C must be 16-byte aligned.
N must be greater than or equal to 20.
If any of these criteria is not satisfied, the function invokes scalar code.
vDSP.hFilters an image by performing a two-dimensional convolution with a 5x5 kernel on the input matrix signal. The resulting image is placed in the output matrix result; double precision.
void vDSP_f5x5D (double * signal, vDSP_Length rows, vDSP_Length cols, double * filter, double * result);
This performs the operation

The function pads the perimeter of the output image with a border of zeros of width 2.
B is the 3x3 kernel. M and N are the number of rows and columns, respectively, of the two-dimensional input matrix A. M must be greater than or equal to 5. N must be even and greater than or equal to 6.
Criteria to invoke vectorized code:
A, B, and C must be 16-byte aligned.
N must be greater than or equal to 20.
If any of these criteria is not satisfied, the function invokes scalar code.
vDSP.hCreates a single-precision Hamming window.
void vDSP_hamm_window (float * C, vDSP_Length N, int FLAG);
vDSP_hamm_window creates a single-precision Hamming window function C, which can be multiplied by a vector using vDSP_vmul . Specify the vDSP_HALF_WINDOW flag to create only the first (n+1)/2 points, or 0 (zero) for full size window.
See also vDSP_vmul.
vDSP.hCreates a double-precision Hamming window.
void vDSP_hamm_windowD (double * C, vDSP_Length N, int FLAG);
vDSP_hamm_windowD creates a double-precision Hamming window function C, which can be multiplied by a vector using vDSP_vmulD . Specify the vDSP_HALF_WINDOW flag to create only the first (n+1)/2 points, or 0 (zero) for full size window.
See also vDSP_vmulD.
vDSP.hCreates a single-precision Hanning window.
void vDSP_hann_window (float * C, vDSP_Length N, int FLAG);
vDSP_hann_window creates a single-precision Hanning window function C, which can be multiplied by a vector using vDSP_vmul .
The FLAG parameter can have the following values:
vDSP_HANN_DENORM creates a denormalized window.
vDSP_HANN_NORM creates a normalized window.
vDSP_HALF_WINDOW creates only the first (N+1)/2 points.
vDSP_HALF_WINDOW can be ORed with any of the other values (i.e., using the C operator |).
See also vDSP_vmul.
vDSP.hCreates a double-precision Hanning window.
void vDSP_hann_windowD (double * C, vDSP_Length N, int FLAG);
vDSP_hann_window creates a double-precision Hanning window function C, which can be multiplied by a vector using vDSP_vmul .
The FLAG parameter can have the following values:
vDSP_HANN_DENORM creates a denormalized window.
vDSP_HANN_NORM creates a normalized window.
vDSP_HALF_WINDOW creates only the first (N+1)/2 points.
vDSP_HALF_WINDOW can ORed with any of the other values (i.e., using the C operator |).
See also vDSP_vmul.
vDSP.hFilters an image by performing a two-dimensional convolution with a kernel; single precision.
void vDSP_imgfir (float * signal, vDSP_Length numRow, vDSP_Length numCol, float * filter, float * result, vDSP_Length fnumRow, vDSP_Length fnumCol);
A complex vector signal input.
Single-precision input matrix
Single-precision filter kernel
Number of rows in numRow and in fnumCol
The complex vector signal output.
Number of columns in numRow and in fnumCol
Single-precision result matrix
The image is given by the input matrix numRow. It has filter rows and fnumRow columns. filter and fnumRow must both be odd and greater than or equal to 5.

numCol is the filter kernel. It has P rows and Q columns. P must be greater than or equal to Q.
filter must be even and greater than P. fnumRow must be even and greater than Q.
The filtered image is placed in the output matrix fnumCol. The functions pad the perimeter of the output image with a border of (P-1)/2 rows of zeros on the top and bottom and (Q-1)/2 columns of zeros on the left and right.
Criteria to invoke vectorized code:
The parameters numRow, numCol, and fnumCol must be 16-byte aligned.
fnumRow must be greater than or equal to 20.
If any of these criteria is not satisfied, the function invokes scalar code.
vDSP.hFilters an image by performing a two-dimensional convolution with a kernel; double precision.
void vDSP_imgfirD (double * signal, vDSP_Length numRow, vDSP_Length numCol, double * filter, double * result, vDSP_Length fnumRow, vDSP_Length fnumCol);
A complex vector signal input.
Double-precision input matrix
Double-precision filter kernel
Number of rows in numRow and in fnumCol
The complex vector signal output.
Number of columns in numRow and in fnumCol
Double-precision result matrix
The image is given by the input matrix numRow. It has filter rows and fnumRow columns. filter and fnumRow must both be odd and greater than or equal to 5.

numCol is the filter kernel. It has P rows and Q columns. P must be greater than or equal to Q.
filter must be even and greater than P. fnumRow must be even and greater than Q.
The filtered image is placed in the output matrix fnumCol. The functions pad the perimeter of the output image with a border of (P-1)/2 rows of zeros on the top and bottom and (Q-1)/2 columns of zeros on the left and right.
Criteria to invoke vectorized code:
The parameters numRow, numCol, and fnumCol must be 16-byte aligned.
fnumRow must be greater than or equal to 20.
If any of these criteria is not satisfied, the function invokes scalar code.
vDSP.h Wiener-Levinson general convolution; single precision.
void vDSP_wiener (vDSP_Length L, float * A, float * C, float * F, float * P, int IFLG, int * IERR);
Input filter length
Single-precision real input vector: coefficients
Single-precision real input vector: input coefficients
Single-precision real output vector: filter coefficients
Single-precision real output vector: error prediction operators
Not currently used, pass zero
Error flag
Performs the operation

solves a set of single-channel normal equations described by:
B[n] = C[0] * A[n] + C[1] * A[n-1] +, . . . ,+ C[N-1] * A[n-N+1] |
for n = {0, N-1} |
where matrix A contains elements of the symmetric Toeplitz matrix shown below. This function can only be done out of place.
Note that A[-n] is considered to be equal to A[n].
vDSP_wiener solves this set of simultaneous equations using a recursive method described by Levinson. See Robinson, E.A., Multichannel Time Series Analysis with Digital Computer Programs. San Francisco: Holden-Day, 1967, pp. 43-46.
|A[0] A[1] A[2] ... A[N-1] | |C[0] | |B[0] | |
|A[1] A[0] A[1] ... A[N-2] | |C[1] | |B[1] | |
|A[2] A[1] A[0] ... A[N-3] | * |C[2] | = |B[2] | |
| ... ... ... ... ... | | ... | | ... | |
|A[N-1]A[N-2]A[N-3] ... A[0] | |C[N-1]| |B[N-1]| |
Typical methods for solving N equations in N unknowns have execution times proportional to N cubed, and memory requirements proportional to N squared. By taking advantage of duplicate elements, the recursion method executes in a time proportional to N squared and requires memory proportional to N. The Wiener-Levinson algorithm recursively builds a solution by computing the m+1 matrix solution from the m matrix solution.
With successful completion,vDSP_wiener returns zero in error flag IERR. If vDSP_wiener fails, IERR indicates in which pass the failure occurred.
vDSP.h Wiener-Levinson general convolution; double precision.
void vDSP_wienerD (vDSP_Length L, double * A, double * C, double * F, double * P, int IFLG, int * IERR);
Input filter length
Double-precision real input vector: coefficients
Double-precision real input vector: input coefficients
Double-precision real output vector: filter coefficients
Double-precision real output vector: error prediction operators
Not currently used, pass zero
Error flag
Performs the operation

solves a set of single-channel normal equations described by:
B[n] = C[0] * A[n] + C[1] * A[n-1] +, . . . ,+ C[N-1] * A[n-N+1] |
for n = {0, N-1} |
where matrix A contains elements of the symmetric Toeplitz matrix shown below. This function can only be done out of place.
Note that A[-n] is considered to be equal to A[n].
vDSP_wiener solves this set of simultaneous equations using a recursive method described by Levinson. See Robinson, E.A., Multichannel Time Series Analysis with Digital Computer Programs. San Francisco: Holden-Day, 1967, pp. 43-46.
|A[0] A[1] A[2] ... A[N-1] | |C[0] | |B[0] | |
|A[1] A[0] A[1] ... A[N-2] | |C[1] | |B[1] | |
|A[2] A[1] A[0] ... A[N-3] | * |C[2] | = |B[2] | |
| ... ... ... ... ... | | ... | | ... | |
|A[N-1]A[N-2]A[N-3] ... A[0] | |C[N-1]| |B[N-1]| |
Typical methods for solving N equations in N unknowns have execution times proportional to N cubed, and memory requirements proportional to N squared. By taking advantage of duplicate elements, the recursion method executes in a time proportional to N squared and requires memory proportional to N. The Wiener-Levinson algorithm recursively builds a solution by computing the m+1 matrix solution from the m matrix solution.
With successful completion,vDSP_wiener returns zero in error flag IERR. If vDSP_wiener fails, IERR indicates in which pass the failure occurred.
vDSP.hPerforms either correlation or convolution on two complex vectors; single precision.
void vDSP_zconv (DSPSplitComplex * signal, vDSP_Stride signalStride, DSPSplitComplex * filter, vDSP_Stride strideFilter, DSPSplitComplex * result, vDSP_Stride strideResult, vDSP_Length lenResult, vDSP_Length lenFilter);
A is the input vector, with stride I, and C is the output vector, with stride K and length N.
B is a filter vector, with stride I and length P. If Jis positive,the function performs correlation. If Jis negative, it performs convolution and Bmust point to the last element in the filter vector. The function can run in place, but Ccannot be in place with B.

The value of N must be less than or equal to 512.
Criteria to invoke vectorized code:
Both the real parts and the imaginary parts of vectors A and C must be relatively aligned.
The values of I and K must be 1.
If any of these criteria is not satisfied, the function invokes scalar code.
vDSP.h Performs either correlation or convolution on two complex vectors; double precision.
void vDSP_zconvD (DSPDoubleSplitComplex * signal, vDSP_Stride signalStride, DSPDoubleSplitComplex * filter, vDSP_Stride strideFilter, DSPDoubleSplitComplex * result, vDSP_Stride strideResult, vDSP_Length lenResult, vDSP_Length lenFilter);
A is the input vector, with stride I, and C is the output vector, with stride K and length N.
B is a filter vector, with stride I and length P. If J is positive, the function performs correlation. If J is negative, it performs convolution and B must point to the last element in the filter vector. The function can run in place, but C cannot be in place with B.

The value of N must be less than or equal to 512.
Criteria to invoke vectorized code:
No Altivec support for double precision. On a PowerPC processor, this function always invokes scalar code.
vDSP.h Complex/real downsample with anti-aliasing; single precision.
void vDSP_zrdesamp (DSPSplitComplex * A, vDSP_Stride I, float * B, DSPSplitComplex * C, vDSP_Length N, vDSP_Length M);
Single-precision complex input vector.
Complex decimation factor.
Filter coefficient vector.
Single-precision complex output vector.
Length of output vector.
Length of real filter vector.
Performs finite impulse response (FIR) filtering at selected positions of input vector A.

Length of A must be at least (N+M-1)*i. This function can run in place, but C cannot be in place with B.
vDSP.h Complex/real downsample with anti-aliasing; double precision.
void vDSP_zrdesampD (DSPDoubleSplitComplex * A, vDSP_Stride I, double * B, DSPDoubleSplitComplex * C, vDSP_Length N, vDSP_Length M);
Double-precision complex input vector.
Complex decimation factor.
Filter coefficient vector.
Double-precision complex output vector.
Length of output vector.
Length of real filter vector.
Performs finite impulse response (FIR) filtering at selected positions of input vector A.

Length of A must be at least (N+M-1)*i. This function can run in place, but C cannot be in place with B.
vDSP.h
Last updated: 2007-06-15