Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jfor.jfor.tools.jpeg
Class DCT  view DCT download DCT.java

java.lang.Object
  extended byorg.jfor.jfor.tools.jpeg.DCT

class DCT
extends java.lang.Object

DCT - A Java implementation of the Discreet Cosine Transform. This class incorporates quality scaling as implemented in the JPEG-6a library.


Field Summary
private static int dctBlockSize
          DCT Block Size - default 8
private  java.lang.Object[] divisors
          Divisors
private  java.lang.Object[] quantum
          Quantum
 
Constructor Summary
(package private) DCT(int quality)
          Constructs a new DCT object.
 
Method Summary
 void dispose()
          Dispose.
(package private)  double[][] forwardDCT(float[][] input)
          This method preforms a DCT on a block of image data using the AAN method as implemented in the IJG Jpeg-6a library.
private  double[][] forwardDCTExtreme(float[][] input)
          This method preforms forward DCT on a block of image data using the literal method specified for a 2-D Discrete Cosine Transform.
(package private)  int[] getQuantumArray(int index)
          Gets a value from quantum.
private  void initMatrix(int quality)
          This method sets up the quantization matrix for luminance and chrominance using the Quality parameter.
(package private)  int[] quantizeBlock(double[][] inputData, int code)
          This method quantitizes data and rounds it to the nearest integer.
private  int[] quantizeBlockExtreme(double[][] inputData, int code)
          This is the method for quantizing a block DCT'ed with forwardDCTExtreme This method quantitizes data and rounds it to the nearest integer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

quantum

private java.lang.Object[] quantum
Quantum


divisors

private java.lang.Object[] divisors
Divisors


dctBlockSize

private static int dctBlockSize
DCT Block Size - default 8

Constructor Detail

DCT

DCT(int quality)
Constructs a new DCT object. Initializes the cosine transform matrix these are used when computing the DCT and it's inverse. This also initializes the run length counters and the ZigZag sequence. Note that the image quality can be worse than 25 however the image will be extemely pixelated, usually to a block size of N.

Method Detail

dispose

public void dispose()
Dispose.


getQuantumArray

int[] getQuantumArray(int index)
Gets a value from quantum.


quantizeBlock

int[] quantizeBlock(double[][] inputData,
                    int code)
This method quantitizes data and rounds it to the nearest integer.


initMatrix

private void initMatrix(int quality)
This method sets up the quantization matrix for luminance and chrominance using the Quality parameter.


forwardDCTExtreme

private double[][] forwardDCTExtreme(float[][] input)
This method preforms forward DCT on a block of image data using the literal method specified for a 2-D Discrete Cosine Transform. It is included as a curiosity and can give you an idea of the difference in the compression result (the resulting image quality) by comparing its output to the output of the AAN method below. It is ridiculously inefficient. For now the final output is unusable. The associated quantization step needs some tweaking. If you get this part working, please let me know.


forwardDCT

double[][] forwardDCT(float[][] input)
This method preforms a DCT on a block of image data using the AAN method as implemented in the IJG Jpeg-6a library.


quantizeBlockExtreme

private int[] quantizeBlockExtreme(double[][] inputData,
                                   int code)
This is the method for quantizing a block DCT'ed with forwardDCTExtreme This method quantitizes data and rounds it to the nearest integer.