class CrImage::FftUtil

Overview

Utility class for Fast Fourier Transforms

At some point in the future, this may be moved to its own shard.

Defined in:

cr-image/fft_util.cr

Class Method Summary

Class Method Detail

def self.fft1d(inp : Array(Float64), buffer : Array(Complex) | Nil = nil) : Array(Complex) #

Perform Fast Fourier Transform on inp.

Can optionally pass in buffer which must be the same length as inp


[View source]
def self.fft1d(inp : Array(Complex), buffer : Array(Complex) = inp.dup) : Array(Complex) #

Perform Fast Fourier Transform on inp.

Can optionally pass in buffer which must be the same length as inp


[View source]
def self.fft1d_unsafe(ret : Array(Complex) | Slice(Complex), buffer : Array(Complex) | Slice(Complex) = ret.dup) : Array(Complex) | Slice(Complex) #

Calculates Fast Fourier Transform of ret. Uses and modifies ret in place.

Can optionally pass in buffer which must be the same length as inp. This method makes no bound checks or error checks.


[View source]
def self.fft2d(width : Int32, inp : Array(Float64), buffer : Array(Complex) | Nil = nil) : Array(Complex) #

Perform Fast Fourier Transform, treating as inp as a 2 dimensional array with width.

Can optionally pass in buffer which must be an array at least the larger of width or inp.size // width.


[View source]
def self.fft2d(width : Int32, inp : Array(Complex), buffer : Array(Complex) | Nil = nil) : Array(Complex) #

Perform Fast Fourier Transform, treating as inp as a 2 dimensional array with width.

Can optionally pass in buffer which must be an array at least the larger of width or inp.size // width.


[View source]
def self.fft2d_unsafe(width : Int32, ret : Array(Complex), buffer : Array(Complex)) : Array(Complex) #

Perform Fast Fourier Transform, using and rewriting ret for the output, as a 2 dimensional array with width. buffer must be an array of length at least the longer of width or height of the input array.


[View source]
def self.ifft1d(inp : Array(Complex), buffer : Array(Complex) = inp.dup) : Array(Complex) #

Perform Inverse Fast Fourier Transform on inp.

Can optionally pass in buffer which must be at least the same size of inp.


[View source]
def self.ifft1d_unsafe(ret : Array(Complex) | Slice(Complex), buffer : Array(Complex) = ret.dup) : Array(Complex) | Slice(Complex) #

Perform Inverse Fast Fourier Transform on ret. Will use and overwrite the original values in ret to do so.

Can optionally pass in buffer which must be at least the same size of inp. This method makes no bound checks or error checks.


[View source]
def self.ifft2d(width : Int32, inp : Array(Complex), buffer : Array(Complex) | Nil = nil) : Array(Complex) #

Perform Inverse Fast Fourier Transform, treating as inp as a 2 dimensional array with width.

Can optionally pass in buffer which must be an array at least the larger of width or inp.size // width.


[View source]
def self.ifft2d_unsafe(width : Int32, ret : Array(Complex), buffer : Array(Complex)) : Array(Complex) #

[View source]