<!--
{
  "documentType" : "article",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/in-place-functions-for-2d-complex-fft",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "In-Place Functions for 2D Complex FFT"
}
-->

# In-Place Functions for 2D Complex FFT

Perform fast Fourier transforms in place on 2D complex data.

## Discussion

The functions in this group use the following operation for a complex-to-complex transform:

```swift
N0 = 1 << Log2N0;
N1 = 1 << Log2N1;

if (IC1 == 0) IC1 = IC0*N0;

scale = 0 < Direction ? 1 : 1. / (N1*N0);

// Define a complex matrix, h:
for (j1 = 0; j1 < N1; ++j1)
for (j0 = 0; j0 < N0; ++j0)
    h[j1][j0] = C->realp[j1*IC1 + j0*IC0]
          + i * C->imagp[j1*IC1 + j0*IC0];

// Perform Discrete Fourier Transform.
for (k1 = 0; k1 < N1; ++k1)
for (k0 = 0; k0 < N0; ++k0)
    H[k1][k0] = scale * sum(sum(h[j1][j0]
        * e**(-Direction*2*pi*i*j0*k0/N0), 0 <= j0 < N0)
        * e**(-Direction*2*pi*i*j1*k1/N1), 0 <= j1 < N1);

// Store result.
for (k1 = 0; k1 < N1; ++k1)
for (k0 = 0; k0 < N0; ++k0)
{
    C->realp[k1*IC1 + k0*IC0] = Re(H[k1][k0]);
    C->imagp[k1*IC1 + k0*IC0] = Im(H[k1][k0]);
}
```

The temporary buffer versions perform the same operation but use a temporary buffer for improved performance.

## Topics

### In-Place FFT Functions

[`extern void vDSP_fft2d_zip(FFTSetup __Setup, const DSPSplitComplex *__C, vDSP_Stride __IC0, vDSP_Stride __IC1, vDSP_Length __Log2N0, vDSP_Length __Log2N1, FFTDirection __Direction);`](/documentation/Accelerate/vDSP_fft2d_zip)

Computes a 2D forward or inverse in-place, single-precision complex FFT.

[`extern void vDSP_fft2d_zipD(FFTSetupD __Setup, const DSPDoubleSplitComplex *__C, vDSP_Stride __IC0, vDSP_Stride __IC1, vDSP_Length __Log2N0, vDSP_Length __Log2N1, FFTDirection __Direction);`](/documentation/Accelerate/vDSP_fft2d_zipD)

Computes a 2D forward or inverse in-place, double-precision complex FFT.

### In-Place FFT Functions with Temporary Buffer

[`extern void vDSP_fft2d_zipt(FFTSetup __Setup, const DSPSplitComplex *__C, vDSP_Stride __IC1, vDSP_Stride __IC0, const DSPSplitComplex *__Buffer, vDSP_Length __Log2N0, vDSP_Length __Log2N1, FFTDirection __Direction);`](/documentation/Accelerate/vDSP_fft2d_zipt)

Computes a 2D forward or inverse in-place, single-precision complex FFT using a temporary buffer.

[`extern void vDSP_fft2d_ziptD(FFTSetupD __Setup, const DSPDoubleSplitComplex *__C, vDSP_Stride __IC0, vDSP_Stride __IC1, const DSPDoubleSplitComplex *__Buffer, vDSP_Length __Log2N0, vDSP_Length __Log2N1, FFTDirection __Direction);`](/documentation/Accelerate/vDSP_fft2d_ziptD)

Computes a 2D forward or inverse in-place, double-precision complex FFT using a temporary buffer.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)