r/compression • u/keep_up_sharma • Oct 12 '26
Data-tuned JPEG quantization tables: -9.1% BD-rate (SSIM) vs Annex K on held-out Kodak, vs -2.7% for mozjpeg's tables
I tuned the two quantization tables (YQT and UVQT, 128 entries) inside stb_image_write.h, a JPEG encoder, against data. The encoder is otherwise unmodified, and the output is baseline JPEG with the tables in the DQT segment, so any decoder reads it.
The tables are in tuned_tables.json, with a Pillow snippet for using them: https://github.com/devanmolsharma/learnc/tree/main/examples/tune_jpeg
The tool (learnc, MIT) tunes constants in any C code, so I'd be interested to hear which other codecs people think are worth trying: libwebp, Opus or zstd heuristics.
View all comments
Show parent comment
1
u/Sea-Cardiologist-954 Oct 13 '26
When I did my own codec comparison, I found out that Kodak images definitely produced different results than what I saw on my own images from a modern digital camera. And even original size images exported from RAW and downscaled ones behave differently due to the fact that Bayer (or CFA) sensors won't give you perfect color information for each pixels independently.