JPEG Standard Explained: Part 1 vs Part 2 vs Part 3
The JPEG image compression specification (ISO/IEC 10918 / ITU-T T.80 series) is divided into multiple distinct sections that govern digital image encoding, verification, and file handling. Part 1 defines the foundational mathematical processes, encoding modes, and bitstream syntax for image compression; Part 2 establishes the compliance testing procedures to verify decoder and encoder accuracy; and Part 3 introduces extensions to the core standard, notably defining the official SPIFF file container, variable quantization, and advanced metadata handling.
Part 1: Requirements and Guidelines (ISO/IEC 10918-1 / ITU-T T.81)
Part 1 represents the core foundation of the JPEG standard. It specifies the mathematical algorithms for converting continuous-tone still images into compressed bitstreams and vice versa. The primary features defined in Part 1 include:
- Coding Modes:
- Baseline Sequential DCT: The widely used standard requiring 8-bit sample precision, Discrete Cosine Transform (DCT) processing, uniform quantization, and Huffman entropy coding.
- Extended DCT: Adds support for 12-bit sample precision, progressive display capabilities (where images render from low to high quality in multiple passes), and arithmetic entropy coding as an alternative to Huffman coding.
- Lossless Coding: A spatial, predictive compression method based on Differential Pulse Code Modulation (DPCM) rather than DCT, supporting 2-bit through 16-bit precision.
- Hierarchical Coding: Encodes an image at multiple resolutions so that lower-resolution versions can be decoded without decompressing the full-resolution data.
- Syntax and Markers: Establishes the basic structural markers required to parse compressed streams, such as Start of Image (SOI), Start of Frame (SOF), Define Quantization Table (DQT), Define Huffman Table (DHT), and End of Image (EOI).
Part 2: Compliance Testing (ISO/IEC 10918-2 / ITU-T T.83)
While Part 1 explains how compression must be implemented, Part 2 provides the framework to prove whether a given implementation conforms to those specifications. It contains no new compression algorithms, focusing entirely on quality control and standardization:
- Compliance Criteria: Establishes pass/fail metrics for encoders and decoders claiming compliance with Part 1 modes.
- Test Bitstreams: Provides reference image files and bitstreams designed to test boundary conditions, syntax parsing, and error-handling capabilities.
- Numerical Precision Verification: Specifies tolerance limits for mathematical operations, particularly the Inverse Discrete Cosine Transform (IDCT), to prevent cumulative rounding errors across different hardware and software decoders.
Part 3: Extensions (ISO/IEC 10918-3 / ITU-T T.84)
Part 3 builds on Part 1 by introducing optional features designed to overcome architectural limitations identified after the initial deployment of the standard:
- SPIFF (Still Picture Interchange File Format): An official, standardized file format designed to replace the ad-hoc JFIF (JPEG File Interchange Format). SPIFF provides formal definitions for color spaces, pixel aspect ratios, compression types, and embedded ICC color profiles.
- Variable Quantization: Allows an encoder to change quantization scales at the block level within an image, enabling selective quality improvements across regions of interest.
- Selective Refinement: Enables decoders to progressively improve the image quality of specific regions rather than the entire frame at once.
- Composite Images and Tiling: Adds support for assembling larger scenes from smaller image tiles and overlaying distinct image layers.
- Extension Markers: Introduces specialized application markers (particularly APP8) to carry extended data, higher-level metadata, and multi-component registration information without breaking compatibility with baseline Part 1 decoders.