SAO — Sample Adaptive Offset — is HEVC's second in-loop filter, running after the deblocking filter to clean up two specific kinds of compression artefacts that deblocking doesn't catch. Where deblocking smooths block boundaries, SAO adjusts individual pixel values inside blocks to nudge them closer to what the original frame looked like. It does this in two complementary modes that the encoder picks per region.

Edge Offset (EO) targets ringing artefacts near sharp edges — those faint repeated lines parallel to a high-contrast boundary that aggressive quantization produces. The encoder identifies the edge direction (horizontal, vertical, or one of the two diagonals) and applies small corrections along that direction. Band Offset (BO) targets banding in smooth gradients — the visible "steps" of colour on a sunset sky. The encoder splits the brightness range into 32 bands and applies a small offset to four consecutive bands, smoothing the gradient without affecting the rest of the image. Both modes send their corrections as part of the bitstream so every decoder applies the same fix.

For a product team, SAO is invisible plumbing that contributes to HEVC's quality advantage over H.264 at the same bitrate. There's nothing to tune; the encoder turns it on by default. The successor codecs evolved the idea further: AV1 replaced SAO with cdef (Constrained Directional Enhancement Filter), and VVC kept SAO while adding alf (Adaptive Loop Filter) on top. The general lesson: each generation adds more sophisticated cleanup filters, each filter targets a specific kind of compression damage, and the cumulative effect is what lets newer codecs produce visibly cleaner-looking video at every bitrate.