Search code examples
swiftmathfftaccelerate-framework

what size should the output array be when pass reference to fft function? Image processing


How can I calculate output array size for fft function? Im using swift 4 and Accelerate framework (func vDSP_fft_zop), but I think it is no matter. Also have question what difference if we use 1d and 2d array of pixels?


Solution

  • Output array size is equal to input one: 1024 complex pairs give 1024 complex pairs.

    Usually FFT works with sizes like 2^N (256, 1024, 2048 etc) (if data size is smaller - fill the rest with zeros), but some implementations could work with arbitrary sizes.

    Data organization for 2d FTT might depend on implementation (for example, library FFTW for 2D requires array with [K+1][K] dimensions) so check documentation for clues