Class Dct1dDirect

java.lang.Object
imagingbook.spectral.dct.Dct1dDirect
All Implemented Interfaces:
Dct1d
Direct Known Subclasses:
Dct1dDirect.Double, Dct1dDirect.Float

public abstract class Dct1dDirect extends Object

Calculates the 1D DFT using tabulated cosine values for float or double data (see sub-classes Dct1dDirect.Float and Dct1dDirect.Double, respectively). This implementation is considerably faster than the naive version without cosine tables (see Dct1dSlow). Other optimizations are possible. Note that this class has no public constructor - instantiate sub-class Dct1dDirect.Float or Dct1dDirect.Double instead, as shown below. See Sec. 20.1 of [1] for additional details.

Usage example (for float data):

 float[] data = {1, 2, 3, 4, 5, 3, 0};
 Dct1d.Float dct = new Dct1dDirect.Float(data.length);
 dct.forward(data);
 dct.inverse(data);
 ...
 

[1] W. Burger, M.J. Burge, Digital Image Processing – An Algorithmic Introduction, 3rd ed, Springer (2022).

Version:
2022/10/23
See Also:
  • Method Details

    • getSize

      public int getSize()
      Description copied from interface: Dct1d
      Returns the size of this DCT (length of data vectors).
      Specified by:
      getSize in interface Dct1d
      Returns:
      the size of this DCT