mozilla / mozjpeg

Improved JPEG encoder.
Other
5.43k stars 417 forks source link

Butteraugli quality metric #262

Open magicgoose opened 7 years ago

magicgoose commented 7 years ago

https://github.com/google/butteraugli (it's one of the key points in guetzli, btw)

AFAIK this metric is more faithful than different variants of SSIM and PSNR, so… maybe mozjpeg could (optionally) use this metric to achieve even better results?

butteraugli takes an image pair and outputs "heatmap" of perceptual difference, so it may be used to iteratively tune quantization levels per block until the quality is almost flat and close to the intended level, I think maybe it's possible to do this reasonably fast.

If mozjpeg gets this metric then (I think) it should be able to consistently beat guetzli on all inputs. (when using the same chroma subsampling scheme)

kornelski commented 7 years ago

Guetzli already makes an excellent use of that metric. If Butteraugli works for you, then Guetzli is the best you can get. You can compress its files a bit further losslessly with MozJPEG's jpegtran.

But I don't see how MozJPEG could use this metric without becoming Guetzli, with all its limitations.

magicgoose commented 7 years ago

MozJPEG uses progressive encoding (which is more efficient; Guetzli team already stated that progressive encoding is not planned btw) and has more wide useful quality range (guetzli is described as useful only for almost-perfect quality levels). And, anyway, having to use 2 tools (if progressive jpeg is desired) is not ideal. MozJPEG could become the universal solution.

MozJPEG doesn't have to carry all limitations of Guetzli too, because it already has a selectable quality metric (last time I checked), so it probably can be made to use 1 metric for 1 quality range, 2nd for another, etc, if that is needed. Or maybe I'm not sure which limitations do you mean?

kornelski commented 7 years ago

MozJPEG's tuning for visual metric is done only by proxy via quantization table presets, and therefore only works for single-channel metrics. It wouldn't do anything meaningful when tuned for butteraugli. For butteraugli you really need full-color pixel-based analysis, which does bring the computation cost and complexity of guetzli.

CoolOppo commented 7 years ago

Couldn't you add quantization table presets based on Butteraugli metrics?

kornelski commented 7 years ago

It would produce meaningless results.

Simplifying, qtable presets only model sharpness of "grayscale" metrics, and guetzli/butteraugli focuses on relationships between colors.

magicgoose commented 7 years ago

For butteraugli you really need full-color pixel-based analysis, which does bring the computation cost and complexity of guetzli

Maybe this is not a bad thing, as long as it's opt-out