Friday, September 18, 2020

[khvmlwue] Preprocessing JPEG to decrease compression degradation

Write the hypothetical program "preprocess" invoked below that modifies an image before JPEG compression to minimize the losses caused by JPEG compression and decompression.  imgdiff computes some perceptual image difference metric.

preprocess < | cjpeg [...options...] | djpeg [...options...] > image.out
imgdiff image.out

This is for situations like uploading to an image hosting site (e.g., Facebook) in which you do not have control over the JPEG reencoding that the site will do to your pictures.

Inspiration was the RGB -> YCbCr -> RGB color space transformation (future post), which causes some input colors (actually about 75% of all possible RGB input colors) to map to different output colors.  Could an input color be modified so that the output color is, or is closer to, the original input color?

Dithering is more sophisticated possibility, but I don't know if it can work, because JPEG compression tends to destroy the high frequency features of dithering.

No comments :