The discrete cosine transform (DCT) is the per-block frequency transform at the heart of nearly every mainstream codec - H.264/AVC, HEVC, AV1. After a frame is split into blocks, the DCT rewrites each block's pixels as a sum of wave patterns, from a flat average-brightness wave up to fine ripples; smooth blocks need only the first few waves, detailed blocks need many. Representing the block as waves is what makes the next step possible: quantization can round off or delete the small high-frequency coefficients to save bits. Crucially, the DCT is computed on each block independently and never models correlation across block boundaries, which is the root of blocking - two neighbors can round to two different flat tones with a visible seam between them. The transform is also why ringing appears, since a sharp edge packs its energy into the highest-frequency coefficients that quantization truncates first. The DCT itself is lossless and reversible; the loss happens in the quantization that follows it.

Book cover: Video Streaming, Volume 3 of the Fora Soft Video Engineering HandbookBook cover: Video Encoding, Volume 1 of the Fora Soft Video Engineering HandbookBook cover: AI for Video, Volume 6 of the Fora Soft Video Engineering Handbook

The handbook · 7 volumes

Fora Soft Video Engineering Handbook

The discrete cosine transform is where most codecs decide which detail to throw away, and its grid explains blocking and ringing. We wrote seven volumes covering the whole video stack, and for the DCT start with Volume 1: transforms and quantization, block structure, deblocking and the artifacts they cause in H.264, HEVC and AV1. Written by Nikolay Sapunov, CEO at Fora Soft.

Browse the handbook on Amazon →7 volumes · 9,000+ pages · Kindle & paperback

Trying to understand why the DCT grid shows up as artifacts in your encodes?

Send us problem clips and settings: we trace the artifacts to DCT block size and quantization and recommend encoder changes to reduce them. 250+ video products shipped since 2005.

Book a 30-min call →WhatsApp →Email us →