libjxl: Regression in lossy nonphotographic image quality

The first two posts are just talking about metrics (which don’t really matter), for visual comparisons you can skip here


Summary In my limited testing, libjxl 0.8.2 outperforms libjxl 0.10.2 in nonphotographic images like artwork/screenshots. Similar behavior can be seen in photographic images but the gap in quality is smaller and could be with in margin of error.

Environment Libjxl 0.10.2 and 0.8.2 are downloaded from the releases page Identical behavior on Windows 10 and Ubuntu 22.04

Testing Methodology Nonphotographic image: _ultraman Photographic image: donald-michael-chambers-x2d-xcd55v-4

I libjxl 0.10.2 distances 0.75, 1.5, and 3 to represent high-medium-low quality benchmarks. These 0.10.2 images will be used as reference, I adjusted the distance setting in 0.8.2 to match the bbp of the reference images. Then I measured the subsequent outputs using four metrics, ssimulacra2, butteraugli, butteraugli (3-norm), and dssim. Since dssim does not allow .jxl input, I converted the images into a 16-bit png for the most quality and consistency.

I noticed that in benchmark_xl 0.8.2, ssimularcra2 and butteraugli gave different results for the same image when compared to those in the 0.10.2 library. For the sake of consistency, I have decided that tools provided in 0.10.2 are more accurate than those in 0.8.2, therefore I have replaced the ssimulacra2 and butteraugli numbers with the those provided in the latest release.

Side note: Since I’m replacing certain variables for 0.8.2 tables, the “Aggregate” row is not accurate, it shouldn’t be necessary anyways since the difference is quite noticeable.

Nonphotographic image comparisons: 0.8.2

_ultraman.png
Encoding      kPixels    Bytes          BPP  E MP/s  D MP/s     Max norm  SSIMULACRA2        pnorm       BPP*pnorm   Bugs
-------------------------------------------------------------------------------------------------------------------------
jxl:d0.594       1387   312905    1.8035754   5.065  88.485   1.05268490  88.36280502   0.475509   0.857616334878    0
jxl:d1.22        1387   198023    1.1413989   5.118 106.640   1.67951285  83.06127014   0.756590   0.863580964129    0
jxl:d2.62        1387   122924    0.7085304   5.472 113.922   3.41860055  74.48578629   1.146457   0.812299869103    0
Aggregate:       1387   196753    1.1340793   5.215 102.439   1.82155991  82.18873767   0.744380   0.844186007485    0

0.10.2

_ultraman.png
Encoding      kPixels    Bytes          BPP  E MP/s  D MP/s     Max norm  SSIMULACRA2   PSNR        pnorm       BPP*pnorm   QABPP   Bugs
----------------------------------------------------------------------------------------------------------------------------------------
jxl:d0.75        1387   313129    1.8048665   4.101  86.106   1.20206707  87.80768917  44.70   0.46107022  0.832170203284   2.170    0
jxl:d1.5         1387   199238    1.1484021   4.211  98.007   2.00189194  82.26755929  41.30   0.75180506  0.863374498072   2.299    0
jxl:d3           1387   123075    0.7094007   4.376 110.069   3.62111758  72.93681785  37.61   1.22165818  0.866645225771   2.569    0
Aggregate:       1387   197282    1.1371303   4.228  97.570   2.05780390  80.76737921  41.10   0.75094364  0.853920767103   2.340    0

dssim metrics

High quality (~1.80 bpp)
0.00028548	_ultraman-0.8.2
0.00029972	_ultraman-0.10.2
Medium quality (~1.14 bpp)
0.00075359	_ultraman-0.8.2
0.00076116	_ultraman-0.10.2
Low quality (~0.71 bpp)
0.00174440	_ultraman-0.8.2
0.00192789	_ultraman-0.10.2

Photographic image comparisons: 0.8.2

donald-michael-chambers-x2d-xcd55v-4.png
Encoding       kPixels    Bytes          BPP  E MP/s  D MP/s     Max norm  SSIMULACRA2        pnorm       BPP*pnorm   Bugs
--------------------------------------------------------------------------------------------------------------------------
jxl:d0.614       6370   620830    0.7796923   5.601 161.527   1.07826220  88.77737185   0.41565914  0.323904888692    0
jxl:d1.39        6370   342875    0.4306122   5.771 169.412   1.85036587  83.73489551   0.67712914  0.291309491353    0
jxl:d3.17         6370   169212    0.2125110   5.545 106.820   3.31106091  73.83532398   1.18592679  0.252022503415    0
Aggregate:        6370   330089    0.4145544   5.638 142.982   1.87781044  82.08119056   0.69367425  0.287565746072    0

0.10.2

donald-michael-chambers-x2d-xcd55v-4.png
Encoding      kPixels    Bytes          BPP  E MP/s  D MP/s     Max norm  SSIMULACRA2   PSNR        pnorm       BPP*pnorm   QABPP   Bugs
----------------------------------------------------------------------------------------------------------------------------------------
jxl:d0.75        6370   620482    0.7792548   7.007 122.930   1.18638035  88.24965401  48.27   0.44016851  0.343003408582   0.924    0
jxl:d1.5         6370   342590    0.4302540   7.295 149.051   2.14467233  83.09617108  44.74   0.73977772  0.318292357622   0.923    0
jxl:d3           6370   169512    0.2128878   5.143 163.187   3.78650298  73.32046639  41.27   1.24507709  0.265061695613   0.806    0
Aggregate:       6370   330295    0.4148124   6.406 144.066   2.12785027  81.31545211  44.67   0.74012570  0.307013311650   0.883    0

dssim metrics

High quality (~0.78 bbp)
0.00016938	donald-0.8.2-hq.png
0.00020154	donald-0.10.2-hq.png
Medium quality (~0.43 bbp)
0.00053243	donald-0.8.2-mq.png
0.00056884	donald-0.10.2-mq.png
Low quality (~0.21 bbp)
0.00165394	donald-0.8.2-lq.png
0.00167708	donald-0.10.2-lq.png

Analysis/Conclusion For artwork, it’s clear to see that 0.8.2 has consistently scored higher in all tested metrics by significant amount. Libjxl 0.10.2 lags behind in quality and in speed for the same bbp. The speed regression is really strange since 0.10.2 should be much faster. I guess it slowed down for small and medium sized images. (should this is a separate issue?) On the other hand, the photo consistently scored higher in all metrics as well, but the gap is smaller, so its probably within margin of error. Most likely there is no regression for the photo. Also, here is where 0.10.2 outperforms 0.8.2 in terms of speed, maybe because it’s a larger image?

PS: I also noticed that 0.9.2 gives similar subpar results compared to 0.8.2 but I didn’t have the time to go into it with detail. So it seems that the regression happened in between 0.8.2 and 0.9.2. So more testing is needed regardless. Also, if somebody can provide me with a script that automates this process, that would make my life a lot easier.

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 3
  • Comments: 23 (13 by maintainers)

Most upvoted comments

Just a quick follow-up: I’m comparing version 0.10.2 with the latest master version (commit 45e688c) to see how things have changed. I retested the images ultraman.png and tf2_wallpaper.png, both at a distance of 3.

Here are the results:

comp1 comp2

It seems that a small amount of chroma banding is now gone. Additionally, the chroma noise issues have been resolved as well.

Overall, it’s a significant improvement. While there is still some excessive blurring compared to version 0.8.2, the quality has definitely improved.

I did a little testing and the the encoding defaults have changed between 0.9 and 0.10. For lossy images, the alpha channel was originally compressed with the same distance as the color channels. Now, alpha is lossless by default, which drastically inflates file sizes for all RBGA images. If this was an intentional change, I don’t see it documented anywhere.

# JPEG XL encoder v0.8.0 adfc39bc [AVX3,AVX2,SSE4,SSSE3,Unknown]
Read 1920x1070 image, 720686 bytes, 196.2 MP/s
Encoding [VarDCT, d1.000, effort: 7], 
Compressed to 86933 bytes (0.339 bpp).
1920 x 1070, 3.63 MP/s [3.63, 3.63], 1 reps, 16 threads.
# JPEG XL encoder v0.9.2 41b8cda [AVX2,SSE4,SSE2]
Encoding [VarDCT, d1.000, effort: 7]
Compressed to 110.8 kB (0.432 bpp).
1920 x 1070, 4.922 MP/s [4.92, 4.92], 1 reps, 16 threads.
# JPEG XL encoder v0.10.0 19bcd82 [AVX2,SSE4,SSE2]
Encoding [VarDCT, d1.000, effort: 7]
Compressed to 135.8 kB (0.529 bpp).
1920 x 1070, 4.440 MP/s [4.44, 4.44], 1 reps, 16 threads.
# JPEG XL encoder v0.10.2 e148959 [AVX2,SSE4,SSE2]
Encoding [VarDCT, d1.000, effort: 7]
Compressed to 135.8 kB (0.529 bpp).
1920 x 1070,  4.516 MP/s [4.52, 4.52], , 1 reps, 16 threads.

indexBg not sure if there’s undocumented change in definitions of distance, effort etc. but i do also find the compression ratio regression across versions from 0.8.0 to 0.10.2 on almost all -d [>0] -e settings.

just tried this particular image from random website (k i admit it’s the firm i’m working at) though, found this issue related, so i guess maybe not worth creating a new issue.

maybe just another piece of sample data. btw interestingly, on this image, the lossless encoding has a big jump on compression ratio between -e 7 and -e 8