Formatting a JPEG File Format: Entropy Coded Segment (ECS) Format?

I find it difficult to understand the ITU-T T.81 specification for the JPEG file format. Hopefully someone else tried to parse the jpeg files and / or find out about the details of this format.

The specification indicates that the ECS0 segment begins after the SOS segment, but I can’t find where in the specification it actually talks about the format of the ECS0 segment or how to detect its start. Simple JPEG implementations on the Internet have limited help because they assume a lot of things about the files they parse.

Can someone point me in the right direction?

FYI: JPEG file format specification here .

+6
file format jpeg
source share
1 answer

When a standard talks about ECS, it does not refer to it as a segment type, such as SOS, with a header and a size component; this is literally the original Huffman compressed stream representing the MCU that contains the image data. It is complemented by filling in an integer number of bytes and can be interleaved with RST headers (formally, RST headers are separate for ECS).

When the standard says ECS 0 , it means the 0 (first) start of ECS, and not a specific type of ECS, for example, as SOF0 / SOF1 / SOF2 / etc - different types.

An example of a basic DCT:

FF DA // SOS header 00 08 // 8 bytes 01 // 1 channel 01 00 // channel 1 QT 0 HT 0 00 3F 00 // start/end spectral selector, successive approximation bit high/low 12 34 56 78 ... // Huffman-compressed MCU raw data (sequence of Fuffman codes looked-up in AC/DC Huffman tables) FF D9 // EOI 

A convenient free program for explaining the structure of JFIF is JPEGsnoop ( http://www.impulseadventure.com/photo/jpeg-snoop.html ). The menu has the option "Full Decode", which shows the original Huffman data stream, how it is mapped to Huffman symbols, gets de-quantized and then mapped to DCT components.

+4
source share

All Articles