Package com.openstego.desktop.util.dct
Class DCT
- java.lang.Object
-
- com.openstego.desktop.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.
-
-
Constructor Summary
Constructors Constructor Description DCT()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dequantize8x8(double[][] transform)
De-quantize the DCT matrix based on the quantization tablevoid
fwdDct8x8(int[][] input, double[][] output)
Perform forward DCT on the 8x8 matrixvoid
fwdDctBlock8x8(int[][] input, int col, int row, double[][] output)
Perform forward DCT on a given 8x8 block of the input matrixvoid
fwdDctInPlaceNxN(double[][] coeffs)
Perform forward DCT in place for N x N matrixvoid
fwdDctNxM(int[][] pixels, double[][] dcts)
Perform forward DCT for N x M matrixvoid
fwdDctNxN(int[][] pixels, double[][] dcts)
Perform forward DCT for N x N matrixvoid
initDct8x8()
Initialize DCT mechanism for 8x8 blockvoid
initDctNxM(int cols, int rows)
Initialize DCT mechanism for N x M matrixvoid
initDctNxN(int width, int height)
Initialize DCT mechanism for N x M matrixvoid
initQuantum8x8()
Initialize quantization table based on the qualityvoid
initQuantumJpegChromin()
Initialize quantization table based on JPEG chrominance quantizationvoid
initQuantumJpegLumin()
Initialize quantization table based on JPEG luminance quantizationvoid
invDct8x8(double[][] input, int[][] output)
Perform inverse DCT on the 8x8 matrixvoid
invDctBlock8x8(double[][] input, int[][] output, int col, int row)
Perform inverse DCT to given 8x8 block of the output matrixvoid
invDctInPlaceNxN(double[][] coeffs)
Perform inverse DCT in place for N x N matrixvoid
invDctNxM(double[][] dcts, int[][] pixels)
Perform inverse DCT on the N x M matrixvoid
invDctNxN(double[][] dcts, int[][] pixels)
Perform inverse DCT on the N x N matrixint
isMidFreqCoeff8x8(int coeff)
Check whether the coefficient is part of the middle frequenciesvoid
quantize8x8(double[][] transform)
Quantize the DCT matrix based on the quantization table
-
-
-
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
-
-
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 columnsrows
- 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 matrixdcts
- DCT matrix
-
invDctNxM
public void invDctNxM(double[][] dcts, int[][] pixels)
Perform inverse DCT on the N x M matrix- Parameters:
dcts
- Input DCT matrixpixels
- 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 matrixheight
- 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 matrixdcts
- DCT matrix
-
invDctNxN
public void invDctNxN(double[][] dcts, int[][] pixels)
Perform inverse DCT on the N x N matrix- Parameters:
dcts
- Input DCT matrixpixels
- 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 matrixoutput
- 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 matrixcol
- Starting column number for the 8x8 blockrow
- Starting row number for the 8x8 blockoutput
- Output matrix
-
invDct8x8
public void invDct8x8(double[][] input, int[][] output)
Perform inverse DCT on the 8x8 matrix- Parameters:
input
- Input matrixoutput
- 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 matrixcol
- Starting column number for the 8x8 blockrow
- 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
-
-