webmproject / sjpeg

SimpleJPEG: simple jpeg encoder
Apache License 2.0
69 stars 12 forks source link

progressive coding #124

Open skal65535 opened 2 months ago

skal65535 commented 2 months ago

jpegrescan can sometimes shrink the size further. There should be an option to have progressive-coded output.

Starting a branch 'prog' for that.

jzern commented 2 months ago

Drive by!

I'm wondering why the output needs to be progressive to see the benefit or if it's just improvement on matrices.

Also: https://github.com/kud/jpegrescan NB: MozJPEG has the same optimisation built-in and is faster, so we recommend using MozJPEG when possible.

Not sure if MozJPEG was tried.

cc: @vrabaud

skal65535 commented 2 months ago

So, jpegrescan, through jpegtran, adds a dedicated Huffman table for each scan. This has a ~40 bytes cost per scan, so is sometimes worth it (as opposed to a unique Huffman table). Quantization tables can't be changed between scans (paragraph B.2.4: "The quantization table specification shall not be altered between progressive DCT scans of a given component.").