For Programmers: Free Programming Magazines  


Home > Archive > Compression > December 2005 > DCT & IDCT (AAN) method









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author DCT & IDCT (AAN) method
Bendigi

2005-12-04, 3:55 am

Hi,

Before spilling my guts with the problem, allow me to give some
background to attract the intended audience.

I am simply implementing a java version of the IDCT (AAN Float method)
as described in the Jpeg6a IJG library. The only help I could find so
far was James R. Ws and BioElectroMech's Jpeg Encoder, I am simply
extending the idea by implementing the inverse DCT and dequantization
step which was missing. Anyone out there that has done this before ?

I am quite close but I think there is a bug, I have implemented the
RangeLimiter as well, not sure if the bit shifting is being done
correctly.

So anyone with more experience please reply or point me to a previous
implmentation for code comparission, I would be honored if James
R.Ws joins this topic.

--
Bendigi

Bendigi

2005-12-04, 6:55 pm

Btw:

As of now I have implemented also the Integer version of the IDCT
described in the above library but I get wierd results.
It's actually pretty funny, i'm gonna try to describe the problem.

FUNNY #1
------------------------------------------------------------------------------------------------------
When I scale the quantizing tables using the
INTEGER AANScaleFactor and use INTEGER DCT and IDCT i get:

ORIGINAL
-----------------------
87 99 104 104 103 102 108 113
86 98 104 103 103 104 109 116
83 96 99 101 101 103 108 115
79 91 96 97 100 102 105 111
77 90 97 100 99 100 103 109
77 93 99 100 99 99 103 109
78 93 99 99 99 101 103 110
79 92 98 100 102 100 103 110

EXTRACTED
-----------------------
126 128 126 126 126 126 126 126
126 126 128 128 126 126 126 128
126 128 126 126 128 126 128 126
126 126 126 126 128 126 126 126
126 126 126 126 126 126 126 126
126 128 126 128 128 126 128 126
126 126 128 126 126 128 126 126
126 126 126 128 128 126 128 126

FUNNY #2
------------------------------------------------------------------------------------------------------
When I scale the quantizing tables using the
FLOAT AANScaleFactor and use FLOAT DCT and IDCT i get:

ORIGINAL
-----------------------
87 99 104 104 103 102 108 113
86 98 104 103 103 104 109 116
83 96 99 101 101 103 108 115
79 91 96 97 100 102 105 111
77 90 97 100 99 100 103 109
77 93 99 100 99 99 103 109
78 93 99 99 99 101 103 110
79 92 98 100 102 100 103 110

EXTRACTED
-----------------------
0 0 0 0 0 0 0 12
0 0 0 0 0 0 0 33
0 0 0 0 0 0 0 24
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0

FUNNY #3
------------------------------------------------------------------------------------------------------
but when I scale the quantizing tables using the
INTEGER AANScaleFactor and use FLOAT DCT and IDCT i get:

ORIGINAL
-----------------------
87 99 104 104 103 102 108 113
86 98 104 103 103 104 109 116
83 96 99 101 101 103 108 115
79 91 96 97 100 102 105 111
77 90 97 100 99 100 103 109
77 93 99 100 99 99 103 109
78 93 99 99 99 101 103 110
79 92 98 100 102 100 103 110

EXTRACTED
-----------------------
85 98 104 104 101 101 107 114
84 97 103 103 102 103 109 116
81 94 98 100 100 102 107 116
77 89 95 97 99 101 106 111
74 88 96 99 98 99 104 109
74 91 98 100 97 98 102 110
75 91 98 97 98 99 103 110
77 91 96 99 101 99 103 110

PRETTY CLOSE BUT I NEED TO MAKE SURE IT'S CORRECT and I have also tried
to use the FLOAT Scale and the Integer and bad results as well, I can't
pinpoint the problem since it works in that particular case. Any
suggestions ?

/////////////////////////////////////////////////////////////////////////////////////
THE FLOAT SCALE
public double AANscaleFactor1[] = {
1.0, 1.387039845, 1.306562965, 1.175875602,
1.0, 0.785694958, 0.541196100, 0.275899379
};
////////////////////////////////////////////////////////////////////////////////////
THE INTEGER SCALE
public int AANscaleFactor2[] = {
/* precomputed values scaled up by 14 bits */
16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520,
22725, 31521, 29692, 26722, 22725, 17855, 12299, 6270,
21407, 29692, 27969, 25172, 21407, 16819, 11585, 5906,
19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315,
16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520,
12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552,
8867, 12299, 11585, 10426, 8867, 6967, 4799, 2446,
4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247
};

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com