Class Dct1dSlow

java.lang.Object
imagingbook.spectral.dct.Dct1dSlow
All Implemented Interfaces:
Dct1d, Dct1d.Double

public class Dct1dSlow extends Object implements Dct1d.Double

Calculates the 1D discrete cosine transform (DFT) on double data. This is a naive implementation which calculates cosines repeatedly (i.e., does NOT use pre-calculated cosine tables), intended for demonstration purposes only. See Sec. 20.1 (Prog. 20.1) of [1] for additional details.

Usage example:

 double[] data = {1, 2, 3, 4, 5, 3, 0};
 Dct1d.Double dct = new Dct1dSlow(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:
  • Nested Class Summary

    Nested classes/interfaces inherited from interface imagingbook.spectral.dct.Dct1d

    Dct1d.Double, Dct1d.Float
  • Constructor Summary

    Constructors
    Constructor
    Description
    Dct1dSlow(int M)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    forward(double[] g)
    Performs an "in-place" 1D DCT forward transformation on the supplied data.
    int
    Returns the size of this DCT (length of data vectors).
    void
    inverse(double[] G)
    Performs an "in-place" 1D DCT inverse transformation on the supplied spectrum.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface imagingbook.spectral.dct.Dct1d.Double

    checkSize
  • Constructor Details

    • Dct1dSlow

      public Dct1dSlow(int M)
      Constructor.
      Parameters:
      M - the data size
  • 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
    • forward

      public void forward(double[] g)
      Description copied from interface: Dct1d.Double
      Performs an "in-place" 1D DCT forward transformation on the supplied data. The input signal is replaced by the associated DFT spectrum.
      Specified by:
      forward in interface Dct1d.Double
      Parameters:
      g - the signal to be transformed (modified)
    • inverse

      public void inverse(double[] G)
      Description copied from interface: Dct1d.Double
      Performs an "in-place" 1D DCT inverse transformation on the supplied spectrum. The input spectrum is replaced by the associated signal.
      Specified by:
      inverse in interface Dct1d.Double
      Parameters:
      G - the spectrum to be transformed (modified)