DSPRelated.com
Forums

JavaScript JPEG Implementation Help

Started by mlazarov March 3, 2007
Hello,

For a bit of fun I am currently writing an implementation of a monochrome
baseline DCT JPEG encoder in JavaScript. I am currently using the IJG DCT
implementation and the standard quantization and Huffman tables described
in ITU-T.81. However the resultant images don't appear correct, I feel
that this is because the information I've found relating to entropy coding
is unclear and varies. I was hoping somebody could provide me with some
test cases and correct results.

Regards,

Max


>Hello, > >For a bit of fun I am currently writing an implementation of a
monochrome
>baseline DCT JPEG encoder in JavaScript. I am currently using the IJG
DCT
>implementation and the standard quantization and Huffman tables
described
>in ITU-T.81. However the resultant images don't appear correct, I feel >that this is because the information I've found relating to entropy
coding
>is unclear and varies. I was hoping somebody could provide me with some >test cases and correct results. > >Regards, > >Max > > >
To be specific, can somebody please give me at least one 8 x 8 block of values, along with the result of the FDCT, quantization (using standard tables), zig-zag encoding (however trivial that seems), and entropy coding (bit string broken up by run/size pairs and resultant sequence of bytes). Hopefully this will be enough to narrow down the source of the problem. Also here is a link to the current version of my code: http://www.insightrepair.com/max/jpeg/ I am only certain that this will work in Firefox as there are several Firefox-specific features used in the JavaScript. The left picture is the input (converted from PPM to BMP) and the right picture is the output of the JPEG encoding. Please let me know if these results are indicative of a common problem with writing a JPEG encoder.