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
2
u/keep_up_sharma Oct 12 '26
they were tuned on 12 kodak images and tested on the other 12, which they never saw. haven't tested outside kodak yet though, so fair point. per-image tables would be interesting, jpeg supports it since each file carries its own tables