|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--mediaframe.mpeg1.IDCT
This file contains the class "IDCT" which provides methods to perform the inverse discrete cosine transform. Actually a IDFT (inverse discrete fourier transform) is implemented. To gain the DFT values from the DCT values the quantization matrices are multiplied with constants. This occurs only once. The modified quantization values cause a DCT-->DFT transformation during quantization step.
The implementation follows the proposals of Arai, Agiu and Nakajima as well as of Tseng and Miller completed by the extensions made by Feig. The reason is: Their algorithm is a 2-D-approach which consumes only 462 additions, 54 multiplications 6 shifts to the left per block. I thought this were be faster than the ordinary horizontal/vertial- algorithms, which consume more operations. But whether this is really true must be proved (or disproved) by a C implementation. To understand the algorithm refer to: http://rnvs.informatik.tu-chemnitz.de/~ja/MPEG/HTML/IDCT.html The comments assume you are familar with this page. To avoid double arithmetics the constants are multiplied with 2^CONST_BITS and the DCT (DFT) coefficients are multiplied with 2^VAL_BITS. This is not a scientific gained result. I tried some values and as I had the impression the error is quite small I took the appropriate values. But feel free to experiment for your own. BUT: If you change VAL_BITS don't forget to translate "MPEG_video.java"! This value is used there.
| Field Summary | |
private int |
ALLBITS
For small error of integer arithmetics the results of IDFT are divided by 2^ALLBITS. |
private int |
C4
The constanta "C4" (constanta for the IDFT). |
private int |
C4C6
The constanta, equals to C4 * C6 (constants for the IDFT). |
private int |
C4Q
The constanta, equals to C4 * Q (constants for the IDFT). |
private int |
C4R
The constanta, equals to C4 * R (constants for the IDFT). |
private int |
C6
The constanta "C6" (constanta for the IDFT). |
private int |
CONST_BITS
For small error of integer arithmetics the constants are multiplied with 2^CONST_BITS. |
private static int[][] |
IDFT_table
If only one AC coefficient is available the table of pre-computed values is consulted. |
private int[] |
matr1
The storage for temporary results of IDFT algorithm. |
private int[] |
matr2
The storage for temporary results of IDFT algorithm. |
private int |
Q
The constanta "Q" (constanta for the IDFT). |
private int |
R
The constanta "R" (constanta for the IDFT). |
private int |
TWO
The constanta "2" (constanta for the IDFT). |
int |
VAL_BITS
For small error of integer arithmetics the DCT (DFT) coefficients are multiplied with 2^VAL_BITS. |
| Constructor Summary | |
(package private) |
IDCT()
Constructs an IDCT object, initializes the "IDFT_table" and constants. |
| Method Summary | |
private void |
initialize_constants()
Calculates the constants for the IDFT (C4, C6, C4*C6, Q, C4 * Q, R, C4 * R). |
void |
invers_dct_special(int[] coeff,
int pos)
The method "invers_dct_special" is called if only one DCT value appears. |
void |
invers_dct(int[] coeff)
The method "invers_dct" is an implementation of a full IDCT (actually IDFT). |
void |
norm(int[] m1)
The method "norm" performs the modification of the quatization matrices. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private final int CONST_BITS
public final int VAL_BITS
private final int ALLBITS
private final int TWO
private int C6
private int C4C6
private int C4
private int Q
private int C4Q
private int R
private int C4R
private int[] matr1
private int[] matr2
private static int[][] IDFT_table
| Constructor Detail |
IDCT()
| Method Detail |
private void initialize_constants()
public void norm(int[] m1)
m1 - the quatization matrice.
public void invers_dct_special(int[] coeff,
int pos)
coeff - the DC and AC coefficients in de-"zigzag"-ed order.pos - the position of the DCT value in the input array.public void invers_dct(int[] coeff)
coeff - the DC and AC coefficients in de-"zigzag"-ed order.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||