IJG/JPEG/DCT help needed

IJG/JPEG/DCT help needed

Post by Dave Lou » Sat, 28 Nov 1998 04:00:00



Hi all.  Is anyone out there familiar with the IJG API?  Here's my
situation.  I am working on a filter that requires explicit knowledge of the
DCT coefficients stored in the JPEG file.  To get these I am calling
jpeg_read_coefficients().  My problem is that while most of the values are
reasonable (in fact I get an approximation of the image,) several are beyond
what I understand the limit of the DCT algorithm supports.  For example, the
dc coefficient for the luminance component of a pure black image has a value
of -1024 when it should be -128.  I have tried scaling everything down by a
eight but this results in some fractional values which should not
technically be possible from the 8 bit representation of JPEG files.  Is
there some special scaling system?  If you don't know the answer to my
specific question, I would still appreciate some suggestions on who I could
contact.  I have already searched the documentation that comes with IJG and
have found nothing.  Thanks in advance for all your help,

Dave

 
 
 

IJG/JPEG/DCT help needed

Post by Tom Lan » Sun, 29 Nov 1998 04:00:00



> I am working on a filter that requires explicit knowledge of the DCT
> coefficients stored in the JPEG file.  To get these I am calling
> jpeg_read_coefficients().  My problem is that while most of the values
> are reasonable (in fact I get an approximation of the image,) several
> are beyond what I understand the limit of the DCT algorithm supports.
> For example, the dc coefficient for the luminance component of a pure
> black image has a value of -1024 when it should be -128.

Sounds right to me --- the DC component is eight times the average
of the pixel values (after subtracting 128 from each pixel value,
that is).  Working through the DCT equations might offer some more
insight here.

Quote:> I have tried scaling everything down by a eight but this results in
> some fractional values which should not technically be possible from
> the 8 bit representation of JPEG files.

Say what?  The accuracy of DCT coefficients isn't directly related
to the accuracy of the original samples, if that's what you're
expecting.  The form of the equations that the JPEG committee used
produces both DC and AC coefficients that have a range eight times
larger than the range of the input samples --- but where you
choose to round off the mathematically-infinitely-precise values
of either the samples or the coefficients is pretty much up to you.

For example, if you work through the IJG compression-side DCT code
(jcdctmgr.c and jfdct*.c) you'll find that the DCT coefficients
are represented with three fractional bits up until the last
possible moment where they get quantized by the Q-table divisors.
We didn't have to do it that way, but it gives a small accuracy
improvement at little cost.

Quote:> If you don't know the answer to my specific question, I would still
> appreciate some suggestions on who I could contact.  I have already
> searched the documentation that comes with IJG and have found nothing.

Er, there is an email contact address in the docs...

                        regards, tom lane
                        organizer, Independent JPEG Group

 
 
 

1. 12 bit DCT samples with the IJG JPEG code

Has anybody out there ported the IJG JPEG algorithm to 12 bit samples? I've
already changed the appropriate include files, but I ran into trouble when
I tried to provide Huffman tables for this precision. The problem is that I
can't use IJGs optimization feature because I need to use an externally
defined huffman table. Any suggestions concerning the format of that table
in the source code are very welcome.

Thanks for your help

   Andy Lietz.

2. Help with Floppy Tapes (anyone)

3. Modify IJG JPEG Library to display JPEG on Palm

4. - FBI - corrupt puppets & return of McCarthyism

5. Anyone got an Intel asm version of IJG's DCT?

6. Resolution of IP address?

7. IJG's DCT (AAN)

8. Windows Toolbar

9. IJG's DCT accuracy

10. jpeg_idct_islow in JPEG lib from IJG

11. IJG jpeg compression

12. IJG jpeg compression fails when built with Visual C...error solved

13. IJG jpeg compression fails when built with Visual C++ 6.0 under Win NT