How can I parse a progressive JPG

649 Views Asked by At

I am writing a 'clean-room' program that requires parsing/unparsing of jpegs. I have found all the information I need to parse/unparse baseline jpegs, but I cannot find the information that I need to parse/unparse progressive jpegs.

I need to be able to convert the compressed data to macroblocks and back, so most available frameworks are too high level. I also want to understand what is going on, hence the 'clean room' approach.

Can anybody help me please? A specification of the SOF1 header would be useful, as would be the layout of the compressed data in the scan segment.

Thanks in advance.

1

There are 1 best solutions below

5
user3344003 On

If you want to figure this out, I'd get this book:

https://www.amazon.com/Compressed-Image-File-Formats-JPEG/dp/0201604434/ref=sr_1_5?ie=UTF8&qid=1486949641&sr=8-5&keywords=jpeg

It explains it all in easy-to-understand terms. The author has source code at

http://colosseumbuilders.com/sourcecode/imagelib403.zip

that is designed to be easy to understand.

The SOF1 header is the same as all other SOF headers. You need to have a copy of the JPEG standard (as obtuse as it is). The other sources above will help you get through it.