Intra-Frame Prediction Explained: Why AVIF Beats JPEG
Date Published
TL;DR >- JPEG codes each 8x8 block almost independently, predicting only the DC term from the previous block, which is the direct cause of its blocking artifacts (ITU-T T.81).- Modern codecs predict a whole block from already-decoded neighbors, then code only the small residual, which is far cheaper to store.- Intra mode counts climbed fast: JPEG 0 spatial modes, VP8/WebP up to 10 for 4x4 luma, HEVC 35, and AV1 56 directional angles plus 5 non-directional (RFC 6386; HEVC intra literature; Chen et al., AV1 tools).- AVIF is literally an AV1 intra-coded keyframe in a HEIF container, and HEIC is an HEVC keyframe, which is why both compress like modern video I-frames (Netflix Tech Blog; Library of Congress).- AVIF runs about 50% smaller than JPEG at equal quality; WebP runs 25 to 34% smaller at equal SSIM (Netflix Tech Blog; Google WebP Study).
Ask why AVIF beats JPEG and you will usually hear "better math" or "newer format." Both answers dodge the actual mechanism. JPEG and AVIF differ most in a single stage that JPEG barely has: predicting each block from its neighbors before coding anything.
This is the stage that separates a 1992 still-image codec from a 2018 video codec repurposed for stills. JPEG treats blocks as near-strangers. AV1, the engine inside AVIF, treats each block as mostly guessable from what surrounds it, then stores only the guess's error. This post traces that difference from JPEG's independent blocks to AV1's 61 intra modes and its chroma-from-luma trick. For the full arc, see our complete guide to image compression. Here we settle prediction.
What intra-frame prediction actually is
Intra-frame prediction means guessing a block's pixels from neighboring pixels already decoded in the same image, then storing only the difference between the guess and the truth. "Intra" means the prediction stays inside one frame, using no other image. The stored difference, the residual, is small and near-zero when the guess is good, so it compresses far better than raw pixels.
The economics are the whole point. Real images are locally smooth: a patch of sky, a cheek, a wall changes gradually. If a codec can extend the color and gradient of the neighbors into the current block, the residual it must actually encode is tiny. You are no longer coding the image; you are coding how much the image deviates from a sensible prediction of itself.
This is why the word "intra" matters for still images specifically. Video codecs also do inter prediction, guessing from other frames, but a single photo has no other frames. Everything a modern codec does to a JPEG-style still is intra prediction plus the transform and entropy stages we cover in entropy coding explained.
Why does JPEG produce blocking artifacts?
JPEG blocks because it codes each 8x8 block almost independently, sharing nothing between neighbors except a single predicted DC term. In JPEG, the 8x8 DCT blocks are coded essentially on their own, with only the DC coefficient predicted from the previous block via DPCM, and that independence is the direct cause of visible blocking (ITU-T T.81). Each block is quantized in isolation, so their edges do not line up.
Picture the failure at low quality. Two adjacent 8x8 blocks each get quantized separately, each drifts a little differently from the original, and at their shared border those two independent approximations do not match. The eye reads the mismatch as a hard grid. Because nothing in baseline JPEG forces neighboring blocks to agree, the grid is structural, not a tuning bug.
That single design choice, independent blocks, is the flaw every later codec set out to fix. If blocks could instead be built from their neighbors, their edges would align by construction, and the coder would spend bits only on genuine detail rather than re-encoding the smooth background of every block from scratch.
Citation capsule: JPEG codes each 8x8 DCT block essentially independently, predicting only the DC coefficient from the previous block, so neighboring blocks are quantized in isolation and their edges fail to align at low quality. That independence is the direct structural cause of JPEG's characteristic blocking artifacts (ITU-T T.81).
How do modern codecs predict a block from its neighbors?
They build a full prediction of the block from the row of pixels above it and the column to its left, both already decoded, then code only the residual. The encoder tries several prediction patterns, directional and non-directional, picks the one that leaves the smallest residual, and signals which mode it chose. Because the prediction reuses real neighboring pixels, block edges line up and the grid disappears.
The modes fall into two families. Directional modes extend neighbors along a specific angle, ideal for edges and textures with a clear orientation, a roof line, a wall's shadow. Non-directional modes handle the rest: DC fills a block with the average of its neighbors for flat regions, while planar and smooth modes interpolate a gentle gradient across the block for skies and soft shading. AV1's five non-directional modes are DC, PAETH, SMOOTH, SMOOTH_V, and SMOOTH_H (Chen et al., AV1 tools).
The block sizes are flexible too, which JPEG's fixed 8x8 grid never allowed. AV1 partitions using superblocks up to 128x128 pixels, recursively split down to 4x4, so a flat sky can be one large predicted block while a detailed edge gets many small ones (AV1 Tool Description). It also cleans residual ringing with an in-loop CDEF filter that deringes 8x8 units along the detected edge direction (AV1 Tool Description).
A modern codec predicts a block from decoded neighbors and codes a near-empty residual, while JPEG's independently quantized blocks mismatch at their edges (ITU-T T.81; AOMedia AV1).
How many intra prediction modes do codecs have?
The count exploded from zero to dozens in a generation, and the mode count is a rough proxy for how precisely a codec can predict a block. JPEG has no spatial intra modes at all. VP8/WebP offers up to 10 modes for a 4x4 luma block. HEVC offers 35. AV1 offers 56 directional angles plus 5 non-directional modes, 61 in total (RFC 6386; HEVC intra literature; Chen et al., AV1 tools).
The AV1 directional count is not arbitrary; it is built from structure. AV1 starts with 8 nominal directional angles spanning 45 to 203 degrees, then refines each with an angle-delta from minus 3 to plus 3 in 3-degree steps, which yields 8 x 7 = 56 directional angles, on top of the 5 non-directional modes (Chen et al., AV1 tools). HEVC's 33 angular modes are symmetric about the vertical, horizontal, and diagonal axes, so only about 9 base directions are physically distinct (HEVC intra literature).
Codec | Spatial intra modes | Detail |
|---|---|---|
JPEG | 0 | Only DC coefficient predicted from previous block |
VP8 / WebP | up to 10 | 4x4 luma: 10 modes; 16x16 luma and 8x8 chroma: 4 modes (DC/V/H/TM) |
HEVC / HEIC | 35 | Planar (0) + DC (1) + 33 angular |
AV1 / AVIF | 61 | 56 directional angles + 5 non-directional (DC, PAETH, SMOOTH, SMOOTH_V, SMOOTH_H) |
Sources: ITU-T T.81; RFC 6386; HEVC intra literature; Chen et al., AV1 tools.
Spatial intra modes climb from JPEG's 0 to AV1's 61 (56 directional plus 5 non-directional) (RFC 6386; Chen et al., AV1 tools).
More modes is not free, and this is the part vendor comparisons skip. Each extra mode is another candidate the encoder must try and another symbol it must signal per block. AV1's 61 modes are why AVIF encodes so slowly compared to JPEG. The mode count buys ratio, but you pay for it in encode CPU, which is the real reason AVIF adoption lags its compression advantage. The bytes are cheaper; making them is not.
AVIF is an AV1 keyframe, and HEIC is an HEVC keyframe
The cleanest way to understand AVIF and HEIC is that each is a single video keyframe saved as an image. AVIF is an AV1 intra-coded keyframe wrapped in a HEIF-style container (Netflix Tech Blog). HEIC is HEVC intra images in the same HEIF family, standardized as ISO/IEC 23008-12 in 2017 and adopted by Apple in iOS 11 that year (Library of Congress).
This framing explains almost everything about their behavior. A video codec's keyframe, its I-frame, is the frame coded with no reference to other frames, using only intra prediction. That is exactly what a still image needs. So the industry did not design new still-image codecs from scratch; it took the intra-only path of AV1 and HEVC, which already carried dozens of directional modes, planar and DC prediction, and flexible block sizes, and wrapped it in an image container.
The payoff is measured. AVIF runs about 50% smaller than JPEG at equal quality, though the exact figure is content-dependent (Netflix Tech Blog). Even WebP, based on the older VP8, comes in 25 to 34% smaller than JPEG at equal SSIM across the Kodak and Tecnick sets (Google WebP Study). The still-image gains come straight from the video codec's intra toolkit. For how these formats stack up in practice, see how JPEG compression works.
Why AVIF avoids the low-quality-JPEG look
AVIF dodges JPEG's blocky failure because its blocks are built from their neighbors rather than coded in isolation, so their edges align by construction. Where JPEG quantizes each 8x8 block on its own and lets the borders mismatch, AV1 predicts each block from decoded neighbors and codes only a small residual, then runs an in-loop CDEF filter that deringes along edge directions (AV1 Tool Description).
The difference is most visible exactly where JPEG looks worst. On a smooth gradient, JPEG's independent blocks each drift and produce banding and a grid; AV1's planar and smooth modes predict the gradient directly, leaving almost nothing to code and no seams to misalign. On a hard edge, JPEG's fixed 8x8 grid cuts across it awkwardly; AV1 can split to a 4x4 block and pick a directional mode aligned to the edge. So as you lower quality, AVIF degrades into softness rather than JPEG's hard grid, which reads as far less objectionable to the eye. Why does that matter for delivery? Because the ugliness of an artifact, not just its size, is what users notice, a theme we push in why file size is the wrong metric.
Does chroma-from-luma help stills more than video?
Yes, and by a measurable margin. AV1's chroma-from-luma (CfL) tool predicts a block's chroma from its already-reconstructed luma using a linear model, and it reduces BD-rate (measured in CIEDE2000) by 4.87% on still images versus 2.41% on video, so stills benefit roughly twice as much (Trudeau, Egge, Barr, arXiv:1711.03951).
The reason is intuitive once stated. CfL exploits the correlation between brightness and color structure within a block: where luma has an edge, chroma usually does too. In video, much of that redundancy is already captured by predicting from previous frames, so intra CfL adds less. In a still image there is no previous frame, so all the color-luma correlation is left for CfL to capture, and it captures more. This is a concrete case of a general rule: intra tools matter more for stills precisely because inter tools are unavailable.
It also sharpens the point of this whole post. The features that make AVIF and HEIC strong on photographs, dozens of intra modes, planar prediction, chroma-from-luma, are the intra half of a video codec, and the still-image use case leans on that half harder than video ever does. This connects to the color-sampling story in chroma subsampling explained. At Inverity, we lean on that measured difference when we pick per-image formats, because the codec that wins on a photo is often the one whose intra prediction fits that specific content.
FAQ
How many intra prediction modes does AV1 have versus HEVC?
AV1 has 61 intra modes, 56 directional angles plus 5 non-directional (DC, PAETH, SMOOTH, SMOOTH_V, SMOOTH_H), while HEVC has 35, being planar, DC, and 33 angular (Chen et al., AV1 tools; HEVC intra literature). AV1's directional count comes from 8 nominal angles refined by an angle-delta of minus 3 to plus 3.
Is AVIF just an AV1 video frame saved as an image?
Essentially, yes. AVIF is an AV1 intra-coded keyframe wrapped in a HEIF-style container (Netflix Tech Blog). A keyframe is coded using only intra prediction, with no reference to other frames, which is exactly what a single still image needs. That is why AVIF inherits AV1's full intra toolkit.
Why does AVIF avoid JPEG's blocky look at low quality?
Because AVIF predicts each block from decoded neighbors and codes only the residual, so block edges align, whereas JPEG codes 8x8 blocks independently and their edges mismatch (ITU-T T.81). AV1 also deringes with an in-loop CDEF filter (AV1 Tool Description), so AVIF degrades into softness rather than a hard grid.
What is the difference between DC, planar, and directional prediction?
DC fills a block with the average of its neighbors, good for flat regions. Planar and smooth modes interpolate a gentle gradient across the block, good for skies and soft shading. Directional modes extend neighbors along a specific angle, good for oriented edges and textures. AV1 carries 5 non-directional and 56 directional modes (Chen et al., AV1 tools).
Does HEIC use the same technology as AVIF?
The same idea, a different codec. HEIC is HEVC intra images in a HEIF container; AVIF is AV1 intra images in the same container family (Library of Congress; Netflix Tech Blog). Both are a video codec's keyframe saved as a still. AV1 offers more intra modes (61 versus HEVC's 35), so AVIF typically compresses tighter.
The stage JPEG never had
The gap between JPEG and AVIF is not mystical. It is one stage, intra prediction, that JPEG barely implements and modern codecs treat as central. JPEG codes blocks in isolation and pays for it with a visible grid. AV1 and HEVC predict each block from its neighbors across dozens of modes, code only the residual, and their edges align by design.
Seen this way, AVIF and HEIC are not new inventions so much as the intra half of a video codec, saved as a picture, and the still-image case leans on that intra machinery, chroma-from-luma included, harder than video does. If you are choosing a format, the real question is which codec's prediction fits your content, not which has the biggest version number. For the sibling stage that turns these residuals into bytes, read entropy coding explained, and the codec picture is nearly whole.