google / jpegli

BSD 3-Clause "New" or "Revised" License
131 stars 12 forks source link

`-q` and `--quality` flags on `cjpegli` are ignored #29

Closed Ampflower closed 1 month ago

Ampflower commented 2 months ago

Describe the bug cjpegli's quality flag doesn't use the equivalent distance like cjxl does, instead using the distance of 1 regardless of input.

To Reproduce

  1. Have any PNG to convert.
  2. Build jpegli
  3. Run cjpegli input.png output.jpg -q 70

Expected behavior For the distance to be roughly 2.5, rather than 1.

Screenshots Images inapplicable as it is a logic problem. Instead, a log:

$ ./cjpegli input.png output.jpg -q 70 -v -v
Read 1920x1080 image, 1856814 bytes.
Encoding [YUV d1.000 AQ p2 OPT]
Compressed to 203130 bytes (0.784 bpp).
1920 x 1080,  40.560 MP/s [40.56, 40.56], , 1 reps, 1 threads.

Environment

Additional context Happens regardless of any input. However, the -d flag works as expected, with changes in the log corresponding.

$ ./cjpegli input.png output.jpg -d 3 -v -v
Read 1920x1080 image, 1856814 bytes.
Encoding [YUV d3.000 AQ p2 OPT]
Compressed to 195866 bytes (0.756 bpp).
1920 x 1080,  40.999 MP/s [41.00, 41.00], , 1 reps, 1 threads.
pegleGrot commented 1 month ago

I don't think the "d1.000" output there really means it's the same as -d 1. If you try different -q ## values, in practice the output size will be different, I presume.