(root)/Notes/Notes/notes/jpeg.md RSS

JPEG

a widespread lossy data compression format for images

see png, data compression

JPEG Compression

--- https://youtu.be/0me3guauqOU

the initial step in jpeg› compression is converting the image to the ycbcr color space. human eyes are more sensitive to luma and less sensitive to chroma. therefore, reducing the resolution of the chroma components of an image has little effect on perceived image quality. chroma subsamlping does so by "choosing" the chroma of one pixel and applying it to the surrounding pixels. chroma downsampling does so by averaging the chroma of a group of pixels and applying it to the group

an image can be represented in the frequency domain through discrete cosine transforms. real-world images tend to have more low-frequency components; human eyes are less sensitive to high-frequency components. therefore, discarding high-frequency components has little effect on perceived image quality. jpeg applies the discrete cosine transform to 8 by 8 pixel groups from each ycbcr channel. then, it divides through a hadamard product the frequency components by a quantization table then rounds to the nearest integer; this process is called quantization. quantization tables are provided by the jpeg standard, chosen through visual experiments to discard high-frequency components and are the main way for jpeg to define jpeg› compression quality

quantized frequency components are then compressed further through a combination of run-length encoding and huffman coding