Class DiscreteCosineTransform

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.awt.event.WindowListener, java.lang.Runnable, java.util.EventListener

    public class DiscreteCosineTransform
    extends AlgorithmBase
    This routines except the SLOW routines are ported from FORTRAN to Java from: ALGORITHM 749, COLLECTED ALGORITHMS FROM ACM. THIS WORK PUBLISHED IN TRANSACTIONS ON MATHEMATICAL SOFTWARE, VOL. 21, NO. 4, December, 1995, P. 372--378. This file contains 4 files separated by lines of the form C*** filename The filenames in this file are: driver.f driverd.f fct.f fctd.f driver.f and fct.f are float versions and driverd.f and fctd.f are double versions.

    From the ACM website:

     ACM Software License Agreement
     
      All software, both binary and source published by the Association for Computing Machinery (hereafter, Software) is copyrighted by the Association (hereafter, ACM) and ownership of all right, title and interest in and to the Software remains with ACM. By using or copying the Software, User agrees to abide by the terms of this Agreement.
      Noncommercial Use
     
      The ACM grants to you (hereafter, User) a royalty-free, nonexclusive right to execute, copy, modify and distribute both the binary and source code solely for academic, research and other similar noncommercial uses, subject to the following conditions:
     
      1. User acknowledges that the Software is still in the development stage and that it is being supplied "as is," without any support services from ACM. Neither ACM nor the author makes any representations or warranties, express or implied, including, without limitation, any representations or warranties of the merchantability or fitness for any particular purpose, or that the application of the software, will not infringe on any patents or other proprietary rights of others.
      2. ACM shall not be held liable for direct, indirect, incidental or consequential damages arising from any claim by User or any third party with respect to uses allowed under this Agreement, or from any use of the Software.
      3. User agrees to fully indemnify and hold harmless ACM and/or the author(s) of the original work from and against any and all claims, demands, suits, losses, damages, costs and expenses arising out of the User's use of the Software, including, without limitation, arising out of the User's modification of the Software.
      4. User may modify the Software and distribute that modified work to third parties provided that: (a) if posted separately, it clearly acknowledges that it contains material copyrighted by ACM (b) no charge is associated with such copies, (c) User agrees to notify ACM and the Author(s) of the distribution, and (d) User clearly notifies secondary users that such modified work is not the original Software.
      5. User agrees that ACM, the authors of the original work and others may enjoy a royalty-free, non-exclusive license to use, copy, modify and redistribute these modifications to the Software made by the User and distributed to third parties as a derivative work under this agreement.
      6. This agreement will terminate immediately upon User's breach of, or non-compliance with, any of its terms. User may be held liable for any copyright infringement or the infringement of any other proprietary rights in the Software that is caused or facilitated by the User's failure to abide by the terms of this agreement.
      7. This agreement will be construed and enforced in accordance with the law of the state of New York applicable to contracts performed entirely within the State. The parties irrevocably consent to the exclusive jurisdiction of the state or federal courts located in the City of New York for all disputes concerning this agreement. 
     
      Commercial Use
     
      Any User wishing to make a commercial use of the Software must contact ACM at permissions@acm.org to arrange an appropriate license. Commercial use includes (1) integrating or incorporating all or part of the source code into a product for sale or license by, or on behalf of, User to third parties, or (2) distribution of the binary or source code to third parties for use with a commercial product sold or licensed by, or on behalf of, User.
     
      Revised 6/98
     
    SLOW routines adapted from: DCT and IDCT - listing 1 Copyright (c) 2001 Emil Mikulic. http://unix4lyfe.org/dct/ Feel free to do whatever you like with this code. Feel free to credit me.
    • Field Detail

      • constructionMethod

        private int constructionMethod
      • filterType

        private int filterType
      • f1

        private double f1
      • f2

        private double f2
      • filterOrder

        private int filterOrder
      • epsilon

        private double epsilon
      • rs

        private double rs
      • transformLength

        private int transformLength
      • testDataType

        private int testDataType
      • printData

        private boolean printData
      • RT2INV

        private final double RT2INV
      • fastAlgorithm

        private boolean fastAlgorithm
      • LENGTH

        private int LENGTH
      • IPOW

        private int IPOW
      • dims

        private int[] dims
      • xDim

        private int xDim
      • yDim

        private int yDim
      • transformImage

        private ModelImage transformImage
    • Constructor Detail

      • DiscreteCosineTransform

        public DiscreteCosineTransform()
      • DiscreteCosineTransform

        public DiscreteCosineTransform​(ModelImage transformImage,
                                       ModelImage inverseImage,
                                       ModelImage srcImg,
                                       int constructionMethod,
                                       int filterType,
                                       double f1,
                                       double f2,
                                       int filterOrder,
                                       double epsilon,
                                       double rs)
      • DiscreteCosineTransform

        public DiscreteCosineTransform​(boolean fastAlgorithm,
                                       int[] dims,
                                       int testDataType,
                                       boolean printData,
                                       int filterType,
                                       double filterVal1,
                                       double filterVal2)
    • Method Detail

      • runAlgorithm

        public void runAlgorithm()
        Description copied from class: AlgorithmBase
        Actually runs the algorithm. Implemented by inheriting algorithms.
        Specified by:
        runAlgorithm in class AlgorithmBase
      • runTest

        public void runTest()
      • RANDOM

        public double RANDOM​(int[] IX,
                             int[] IY,
                             int[] IZ)
      • FCT2D

        public void FCT2D​(double[] F,
                          int xDim,
                          int yDim)
      • IFCT2D

        private void IFCT2D​(double[] F,
                            int xDim,
                            int yDim)
      • FCT

        private void FCT​(double[] F,
                         double[] C,
                         int transformLength,
                         int[] IFAULT)
      • IFCT

        private void IFCT​(double[] F,
                          double[] C,
                          int transformLength,
                          int[] IFAULT)
      • BITREV

        private void BITREV​(double[] F,
                            int transformLength)
      • SCRAMB

        private void SCRAMB​(double[] F,
                            int transformLength)
      • USCRAM

        private void USCRAM​(double[] F,
                            int transformLength)
      • INIFCT

        private void INIFCT​(double[] C,
                            int transformLength,
                            int[] IFAULT)
      • SLOWFCT

        private void SLOWFCT​(double[] F,
                             int transformLength)
      • SLOW2DFCT

        public void SLOW2DFCT​(double[] F,
                              int xDim,
                              int yDim)
      • SLOWIFCT

        private void SLOWIFCT​(double[] F,
                              int transformLength)
      • SLOW2DIFCT

        private void SLOW2DIFCT​(double[] F,
                                int xDim,
                                int yDim)
      • makeGaussianFilter

        private void makeGaussianFilter​(double[] buffer,
                                        double rmsFreq)
      • makeButterworthFilter

        private void makeButterworthFilter​(double[] buffer,
                                           double fr1,
                                           double fr2)
        DOCUMENT ME!
        Parameters:
        fr1 - DOCUMENT ME!
        fr2 - DOCUMENT ME!
      • makeEllipticFilter

        private void makeEllipticFilter​(double[] buffer,
                                        double fr1,
                                        double fr2)
      • Chebyshev

        private double Chebyshev​(int order,
                                 double w)
      • makeChebyshevTypeIFilter

        private void makeChebyshevTypeIFilter​(double[] buffer,
                                              double fr1,
                                              double fr2)
      • makeChebyshevTypeIIFilter

        private void makeChebyshevTypeIIFilter​(double[] buffer,
                                               double fr1,
                                               double fr2)