Compression Artifact
A compression artefact is a visible or audible distortion in digital media resulting from the use of lossy data compression. It appears in images, sound recordings and video when part of the original data is discarded so that the media can be stored within a target file size or transmitted within the available bandwidth or bit rate. If insufficient data are retained to represent the signal faithfully, perceptible degradation occurs and artefacts become apparent. Although lossy compression algorithms are designed to remove information that is, in theory, less important to human perception, in practice they frequently introduce errors that users find objectionable.
Lossless formats, such as WAV for audio or Portable Network Graphics (PNG) for images, and uncompressed media such as Red Book CD audio and Laserdisc video, do not suffer from compression artefacts, since no information is discarded. Minimising perceivable artefacts is therefore a central design goal of lossy codecs. Nevertheless, artists sometimes deliberately exploit compression artefacts in styles such as glitch art and datamoshing, where the distortions are used for creative effect.
Nature and causes of compression artefacts
Technically, a compression artefact is a form of data error due to quantisation in lossy coding. Many modern compression algorithms operate by transforming data into another domain, representing it as a sum of basis functions. In transform coding, the signal is projected onto these basis functions and the resulting coefficients are quantised to reduce the number of bits required.
The discrete cosine transform (DCT) is particularly prominent and underlies standards such as JPEG for images, MP3 for audio and MPEG formats for video. At low bit rates the quantisation of DCT coefficients becomes coarse, forcing many high-frequency components to zero. The reconstructed signal then resembles one of the basis functions (or a small combination of them) more than the original content, giving rise to characteristic blocky, blurred or noisy artefacts.
Because the encoder must meet a fixed bit rate or file size, it may lack the “intelligence” to distinguish between distortions that are subjectively negligible and those that are very noticeable. When the psycho-visual or psychoacoustic model is inaccurate, or when compression is overly aggressive, artefacts become clearly visible or audible.
Compression artefacts in images
In still images, compression artefacts are especially associated with block-based DCT coding as used in JPEG. Several characteristic distortions may appear:
- Contouring and staircase effects: gradual tonal transitions become stepped, particularly along smooth gradients or curved edges.
- Aliasing along curves: edges that should be smooth appear jagged or “staircased”.
- Blockiness or macroblocking: the image seems to be divided into square blocks, especially in areas of flat colour or heavy compression.
- Quilting or checkerboarding: block boundaries form a visible grid pattern across the image.
Other lossy image schemes using pattern matching or symbol substitution, such as those employed in certain facsimile and document formats, can introduce subtle but serious errors. For instance, visually similar characters or digits may be confused so that a printed 6 is incorrectly replaced by an 8, which is problematic for legal and technical documents.
Block boundary artefacts
Block boundary artefacts, often called macroblocking, arise directly from the principles of block-based transform coding. An image is divided into small blocks, and a transform such as the DCT is applied to each block separately. To compress the data, the transform coefficients are quantised. At very low bit rates, only the low-frequency components may be preserved, and in the most extreme case only the DC coefficient (representing the average colour of the block) remains.
This process yields blocks that are uniformly coloured or blurred. Because quantisation is applied independently to each block, neighbouring blocks are reconstructed slightly differently, creating visible discontinuities at block boundaries. These discontinuities are most noticeable in smooth regions, where there is little natural detail to mask the effect.
Reduction of image compression artefacts
Many techniques have been proposed to reduce the visibility of image artefacts while retaining standard compression formats. Most of these are post-processing methods, applied after decoding:
- Smoothing or deblocking filters to soften visible block boundaries.
- Edge-preserving filters to reduce noise while maintaining sharp edges.
- Proprietary “JPEG artefact removal” tools in photo-editing software and consumer devices (often labelled as MPEG noise reduction or similar).
Some more sophisticated approaches alter the decompression step itself. For example, instead of simply multiplying each quantised DCT coefficient by its quantisation step size, intelligent noise can be added to the dequantised coefficient, turning uniform blocks into a fine grain reminiscent of high-speed photographic film. Because this noise is introduced inside the decoder, not as a separate post-process, it can operate transparently on large numbers of existing JPEG images.
Additional tuning at the encoding stage, such as adjusting quantisation tables, overshooting and then clamping DCT values, can reduce ringing and posterisation, both of which typically arise at low quality settings when DC values or low-frequency components are poorly balanced.
Compression artefacts in video
Video compression artefacts combine distortions from still-image compression with effects introduced by motion prediction. In standards such as MPEG-1, MPEG-2 and MPEG-4, frames are predicted from previously decoded frames using motion compensation, in which blocks of pixels are shifted according to motion vectors.
When block-based prediction and heavy quantisation are used together, the resulting artefacts can persist across several frames. Distortions may appear to move with the optic flow of the scene, giving an impression midway between a painted texture and grime that clings to moving objects. Transmission errors in the compressed bitstream can further degrade quality, causing large-scale corruption or temporarily disrupting the decoding process. Until the next independently coded intra-frame (I-frame) is received, the decoder may propagate these errors, leading to lingering ghost images and blocky distortions.
Motion-compensation block boundary artefacts
In motion-compensated video, the picture is predicted by copying blocks (macroblocks or smaller partitions) from past or future frames. When adjacent blocks refer to different areas of the reference frame, or use significantly different motion vectors, there will be a discontinuity at the boundary between them. This produces visible block boundary artefacts aligned with the motion-compensation grid, which can be particularly distracting around moving objects and textured areas.
Mosquito noise
Another characteristic video artefact is mosquito noise, a shimmering pattern of dots or speckles that appears around sharp edges, particularly in areas of motion. It is essentially a temporal manifestation of ringing and edge busyness from DCT-based still-image compression, but observed frame after frame so that the disturbance seems to “swarm” around the object, reminiscent of a cloud of mosquitoes.
Mosquito noise is again linked to block-based DCT coding and is prevalent in many MPEG-derived formats at low to moderate bit rates.
Video artefact reduction
To mitigate video compression artefacts, deblocking filters are widely used. These may be applied purely as post-processing on decoded frames, or integrated within the codec itself. In a closed-loop prediction system, the encoder incorporates a decoder internally. If deblocking is performed inside this loop, the smoothed picture becomes the reference for predicting future frames, thereby preventing the spread of block artefacts.
Such built-in filters, often described as in-loop deblocking filters, are specified in standards including VC-1, H.263 Annex J, H.264/AVC and H.265/HEVC, and they play a significant role in improving subjective video quality at constrained bit rates.
Compression artefacts in audio
Lossy audio compression, as in formats such as MP3 or other perceptual codecs, relies on a psychoacoustic model of human hearing. Signals are typically transformed into a time–frequency representation using, for example, a modified discrete cosine transform (MDCT). The encoder then exploits masking effects, such as:
- Frequency masking: a quiet tone at a given frequency becomes inaudible when played together with a louder tone nearby in frequency.
- Temporal masking: sounds occurring immediately before or after a loud transient may be masked by it.
Components judged inaudible or negligible are removed, and the remaining spectral values are quantised. When compression is light and the psychoacoustic model conservative, artefacts are typically minimal. Under heavy compression, or when the model fails to track perception accurately, distortions become audible. Common artefacts include:
- Ringing: smearing of sharp attacks or transients.
- Pre-echo: a faint echo of a transient heard slightly before the main sound, a consequence of transform block boundaries.
- “Birdies” or warbling tones: artificial high-pitched tones or modulated noises that are not present in the original signal.