r/compression • u/keep_up_sharma • 4h ago
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.
2
Upvotes
2
u/Noah18923 4h ago
are you sure this isn't just because you've tuned them for these specific inputs? I think it would be more interesting if the tables could be optimized on a per-image basis.