webmproject / sjpeg

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

Riskiness score underestimates visible distortion #14

Open sp-1234 opened 6 years ago

sp-1234 commented 6 years ago

sjpeg recommends sharp YUV for this image (https://user-images.githubusercontent.com/19407943/33548263-53136816-d8ef-11e7-8994-6a6cfded7912.png):

Riskiness: 60.1 (recommended yuv_mode: SharpYUV420)

But in fact only YUV444 gives transparent results for this image; any chroma subsampling adds very obvious changes to the image.

skal65535 commented 6 years ago

Yes, this image is very challenging.

The threshold between SharpYUV420 and YUV444 is set at the riskiness score of 70 (see kThreshSharpYU420 in jpeg_tools.cc:186).. Ideally, the threshold should be made dependent of the targeted quality. The current setting corresponds to some sweet-spot around quality 70-80, which is obviously not enough for this particular difficult image.

hope it helps, skal/

Note that 'vjpeg' can show the riskiness-map (instead of just having the total riskiness score) by pressing the 'r' key. Here's the result:

vjpeg_risk_map

As can be seen, all of the image is problematic. Usually only few areas are (crisps edge, etc.).