Class DCT
java.lang.Object
com.openstego.desktop.util.dct.DCT
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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
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
Initialize quantization table based on the qualityvoid
Initialize quantization table based on JPEG chrominance quantizationvoid
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 Details
-
NJPEG
public static final int NJPEGConstant for the JPEG block size- See Also:
-
QUALITY
public static final int QUALITYDefault JPEG quality to use for encoding- See Also:
-
-
Constructor Details
-
DCT
public DCT()
-
-
Method Details
-
initDctNxM
Initialize DCT mechanism for N x M matrix- Parameters:
cols
- Number of columnsrows
- Number of rows- Throws:
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
Initialize DCT mechanism for N x M matrix- Parameters:
width
- Width of the matrixheight
- Height of the matrix- Throws:
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
-