net.sourceforge.openstego.util.dct
Class DCT

java.lang.Object
  extended by net.sourceforge.openstego.util.dct.DCT

public class DCT
extends java.lang.Object

Class to handle Discrete Cosine Transforms (DCT). This class is conversion of C to Java for the file "dct.c" file provided by Peter Meerwald at: http://www.cosy.sbg.ac.at/~pmeerw/Watermarking/ Refer to his thesis on watermarking: Peter Meerwald, Digital Image Watermarking in the Wavelet Transfer Domain, Master's Thesis, Department of Scientific Computing, University of Salzburg, Austria, January 2001.


Field Summary
static int NJPEG
          Constant for the JPEG block size
static int QUALITY
          Default JPEG quality to use for encoding
 
Constructor Summary
DCT()
           
 
Method Summary
 void dequantize8x8(double[][] transform)
          De-quantize the DCT matrix based on the quantization table
 void fwdDct8x8(int[][] input, double[][] output)
          Perform forward DCT on the 8x8 matrix
 void fwdDctBlock8x8(int[][] input, int col, int row, double[][] output)
          Perform forward DCT on a given 8x8 block of the input matrix
 void fwdDctInPlaceNxN(double[][] coeffs)
          Perform forward DCT in place for N x N matrix
 void fwdDctNxM(int[][] pixels, double[][] dcts)
          Perform forward DCT for N x M matrix
 void fwdDctNxN(int[][] pixels, double[][] dcts)
          Perform forward DCT for N x N matrix
 void initDct8x8()
          Initialize DCT mechanism for 8x8 block
 void initDctNxM(int cols, int rows)
          Initialize DCT mechanism for N x M matrix
 void initDctNxN(int width, int height)
          Initialize DCT mechanism for N x M matrix
 void initQuantum8x8()
          Initialize quantization table based on the quality
 void initQuantumJpegChromin()
          Initialize quantization table based on JPEG chrominance quantization
 void initQuantumJpegLumin()
          Initialize quantization table based on JPEG luminance quantization
 void invDct8x8(double[][] input, int[][] output)
          Perform inverse DCT on the 8x8 matrix
 void invDctBlock8x8(double[][] input, int[][] output, int col, int row)
          Perform inverse DCT to given 8x8 block of the output matrix
 void invDctInPlaceNxN(double[][] coeffs)
          Perform inverse DCT in place for N x N matrix
 void invDctNxM(double[][] dcts, int[][] pixels)
          Perform inverse DCT on the N x M matrix
 void invDctNxN(double[][] dcts, int[][] pixels)
          Perform inverse DCT on the N x N matrix
 int isMidFreqCoeff8x8(int coeff)
          Check whether the coefficient is part of the middle frequencies
 void quantize8x8(double[][] transform)
          Quantize the DCT matrix based on the quantization table
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NJPEG

public static final int NJPEG
Constant for the JPEG block size

See Also:
Constant Field Values

QUALITY

public static final int QUALITY
Default JPEG quality to use for encoding

See Also:
Constant Field Values
Constructor Detail

DCT

public DCT()
Method Detail

initDctNxM

public void initDctNxM(int cols,
                       int rows)
                throws java.lang.IllegalArgumentException
Initialize DCT mechanism for N x M matrix

Parameters:
cols - Number of columns
rows - Number of rows
Throws:
java.lang.IllegalArgumentException

fwdDctNxM

public void fwdDctNxM(int[][] pixels,
                      double[][] dcts)
Perform forward DCT for N x M matrix

Parameters:
pixels - Input matrix
dcts - DCT matrix

invDctNxM

public void invDctNxM(double[][] dcts,
                      int[][] pixels)
Perform inverse DCT on the N x M matrix

Parameters:
dcts - Input DCT matrix
pixels - Output matrix

initDctNxN

public void initDctNxN(int width,
                       int height)
                throws java.lang.IllegalArgumentException
Initialize DCT mechanism for N x M matrix

Parameters:
width - Width of the matrix
height - Height of the matrix
Throws:
java.lang.IllegalArgumentException

fwdDctNxN

public void fwdDctNxN(int[][] pixels,
                      double[][] dcts)
Perform forward DCT for N x N matrix

Parameters:
pixels - Input matrix
dcts - DCT matrix

invDctNxN

public void invDctNxN(double[][] dcts,
                      int[][] pixels)
Perform inverse DCT on the N x N matrix

Parameters:
dcts - Input DCT matrix
pixels - Output matrix

fwdDctInPlaceNxN

public void fwdDctInPlaceNxN(double[][] coeffs)
Perform forward DCT in place for N x N matrix

Parameters:
coeffs - DCT matrix

invDctInPlaceNxN

public void invDctInPlaceNxN(double[][] coeffs)
Perform inverse DCT in place for N x N matrix

Parameters:
coeffs - DCT matrix

initQuantum8x8

public void initQuantum8x8()
Initialize quantization table based on the quality


initQuantumJpegLumin

public void initQuantumJpegLumin()
Initialize quantization table based on JPEG luminance quantization


initQuantumJpegChromin

public void initQuantumJpegChromin()
Initialize quantization table based on JPEG chrominance quantization


quantize8x8

public void quantize8x8(double[][] transform)
Quantize the DCT matrix based on the quantization table

Parameters:
transform - DCT matrix

dequantize8x8

public void dequantize8x8(double[][] transform)
De-quantize the DCT matrix based on the quantization table

Parameters:
transform - DCT matrix

initDct8x8

public void initDct8x8()
Initialize DCT mechanism for 8x8 block


fwdDct8x8

public void fwdDct8x8(int[][] input,
                      double[][] output)
Perform forward DCT on the 8x8 matrix

Parameters:
input - Input matrix
output - Output matrix

fwdDctBlock8x8

public void fwdDctBlock8x8(int[][] input,
                           int col,
                           int row,
                           double[][] output)
Perform forward DCT on a given 8x8 block of the input matrix

Parameters:
input - Input matrix
col - Starting column number for the 8x8 block
row - Starting row number for the 8x8 block
output - Output matrix

invDct8x8

public void invDct8x8(double[][] input,
                      int[][] output)
Perform inverse DCT on the 8x8 matrix

Parameters:
input - Input matrix
output - Output matrix

invDctBlock8x8

public void invDctBlock8x8(double[][] input,
                           int[][] output,
                           int col,
                           int row)
Perform inverse DCT to given 8x8 block of the output matrix

Parameters:
input - Input matrix (8x8)
output - Output matrix
col - Starting column number for the 8x8 block
row - Starting row number for the 8x8 block

isMidFreqCoeff8x8

public int isMidFreqCoeff8x8(int coeff)
Check whether the coefficient is part of the middle frequencies

Parameters:
coeff - Coefficient number
Returns:
Integer to indicate band of frequency


Copyright © 2007-2009 Samir Vaidya. All Rights Reserved.