How HEIC Uses HEVC Video Compression Over JPEG
HEIC (High Efficiency Image Container) achieves superior file sizes and visual fidelity by adopting the compression architecture of HEVC (H.265) video encoding rather than modernizing the legacy JPEG format. While JPEG relies on static, independent block-based algorithms developed in the early 1990s, HEIC treats still photography as an isolated keyframe within a video sequence. By leveraging HEVC’s advanced intra-frame prediction, flexible block partitioning, and internal filtering techniques, HEIC compresses image data roughly twice as effectively as standard JPEG without loss of visual quality.
Intra-Frame Coding: The Core of HEVC Stills
At a technical level, video streams consist of intra-coded frames (I-frames) that require no other video frames to decode, and inter-coded frames (P-frames and B-frames) that rely on temporal data across time. HEIC functions by adapting the HEVC Main Still Picture profile, effectively saving a standalone I-frame.
Legacy JPEG compresses every image uniformly by dividing it into rigid 8x8 pixel blocks and converting them to frequency domain representations using a Discrete Cosine Transform (DCT). In contrast, HEIC replaces this fixed-grid approach with the full spatial toolset developed to minimize bitrate in high-definition video pipelines.
Coding Tree Units Replace Fixed Blocks
HEIC eliminates JPEG's fixed 8x8 pixel grid in favor of Coding Tree Units (CTUs), the fundamental processing unit of HEVC.
- Variable Block Sizes: A CTU can scale up to 64x64 pixels and be recursively divided into smaller Coding Units (CUs) as small as 4x4 pixels via a quad-tree structure.
- Content Adaptability: Smooth areas, such as clear skies, are encoded in large 64x64 or 32x32 blocks with minimal data overhead. Intricate, detailed regions (such as foliage or text) are subdivided into smaller blocks.
- Elimination of Blocking Artifacts: JPEG's static 8x8 division creates noticeable grid-like seams when heavily compressed. Dynamic CTUs preserve sharp boundaries while allocating fewer bits to uniform spaces.
Advanced Directional Intra-Prediction
JPEG carries out very little spatial prediction; it primarily calculates differences between the DC (average color) values of adjacent blocks. HEVC expands this spatial reasoning dramatically:
- 35 Prediction Modes: When encoding a block, HEVC analyzes surrounding reconstructed pixels and predicts the content using 33 angular directions, a planar mode (for smooth surfaces), and a DC mode (for flat color).
- Residual Encoding: Instead of encoding the entire raw block, HEIC generates a mathematical prediction of that block and subtracts it from the actual image. It then only encodes the "residual"—the minor difference between prediction and reality. This drastically cuts the total data payload compared to JPEG's direct-transform method.
Transform and In-Loop Filtering Techniques
HEVC incorporates precision transform and filtering mechanisms designed to keep video streams clear at minimal bitrates, all of which benefit HEIC files:
- DCT and DST Transforms: While JPEG strictly relies on standard DCT, HEVC applies both integer Discrete Cosine Transforms and Discrete Sine Transforms (DST) across varying block sizes (from 4x4 to 32x32), avoiding rounding errors and better fitting sharp edges.
- Deblocking Filter: HEVC runs an automated deblocking filter directly inside the decoding loop to smooth artificial block boundaries generated during quantization.
- Sample Adaptive Offset (SAO): Following the deblocking filter, SAO analyzes edge artifacts and pixel intensity shifts, applying localized offsets to reconstruct original signal peaks and color gradations accurately.
Container Architecture Derived from Video Formats
Beyond raw pixel compression, HEIC derives its structural framework from video container formats. JPEG utilizes the JFIF wrapper, which generally handles only a single flat image stream.
HEIC relies on the ISO Base Media File Format (ISOBMFF)—the same standard underlying modern MP4 video files. This structural heritage enables HEIC to store image sequences (such as burst shots or animations), stereo views, auxiliary image maps (such as depth data and alpha channels), and non-destructive image edits within a unified, lightweight package that legacy JPEG cannot natively accommodate.