JPEG Restart Markers: Sequential vs Progressive
JPEG images utilize restart markers to enhance error recovery and enable multi-threaded decoding by periodically resetting the entropy-coding state. While both sequential and progressive formats define the frequency of these markers using the Define Restart Interval (DRI) header, the structural placement of the markers differs significantly. In sequential JPEGs, restart markers are inserted at fixed intervals across a single, linear progression of spatial pixel blocks. In progressive JPEGs, restart markers are distributed across multiple scans, repeating throughout the image across various spectral bands and bit-depth layers.
Function of Restart Markers
A restart marker (ranging from RST0 to RST7) clears the entropy decoder’s state, forces bitstream alignment to the next byte boundary, and resets DC prediction to zero. This segmentation prevents bit errors in one block from corrupting the remainder of the file and allows independent decoding of distinct segments. The DRI marker dictates how many Minimum Coded Units (MCUs) must be processed between each restart marker.
Placement in Sequential JPEG Files
Sequential JPEGs store image data in a single top-to-bottom scan where each MCU contains the full set of interleaved color components (typically Y, Cb, and Cr) and all 64 DCT coefficients (one DC and 63 AC).
- Spatial Uniformity: Restart markers are placed strictly after every N spatial MCUs. If a restart interval of 10 is defined, a marker appears after every 10 complete spatial blocks across the image grid.
- Single Linear Sequence: The restart markers cycle continuously from RST0 through RST7 and back to RST0 in a predictable, single-pass stream until the entire image is coded.
- Direct Spatial Mapping: Each restart segment corresponds directly to an isolated, contiguous horizontal strip or group of pixels in the rendered image.
Placement in Progressive JPEG Files
Progressive JPEGs decompose image data into multiple distinct scans covering the entire frame. These scans isolate either specific frequency bands (spectral selection) or specific bit-planes of coefficients (successive approximation).
- Per-Scan Placement: The restart interval defined by the DRI marker applies individually to each scan. A restart marker appears every N MCUs within the active scan, and the marker sequence always resets (starting fresh with RST0) at the beginning of each new scan header (SOS marker).
- Varying MCU Definitions: In a progressive scan, an MCU does not represent a complete, fully rendered spatial block. Depending on the scan parameters, an MCU may consist of only the DC coefficient of a single component, or a subset of AC coefficients across non-interleaved blocks. Consequently, the restart markers delineate subsets of frequency data rather than fully decoded spatial blocks.
- Layered Repetition: Because the image is transmitted in multiple passes, restart markers are placed over the same spatial image regions repeatedly. The first scan places restart markers between low-frequency approximations, while subsequent scans place restart markers between high-frequency detail packets for those identical pixel locations.
Key Operational Differences
- Entropy Scope: In sequential files, a restart marker isolates complete pixel data. In progressive files, a restart marker isolates only the specific coefficient band or bit-plane belonging to that particular pass.
- Counter Resets: Sequential files cycle RST0–RST7 unbroken from the beginning of the image data to the end. Progressive files reset the counter to RST0 at the start of every single scan pass, regardless of where the previous pass left off.
- Parallel Processing Granularity: In sequential files, decoders can split the bitstream at restart markers to render complete horizontal image bands in parallel. In progressive files, decoders must track restart markers across separate coefficient layers, meaning parallelization operates on frequency refinements rather than independent, fully rendered pixel segments.