Skip to content

Commit

Permalink
Make jxl quality behave more like jpg quality
Browse files Browse the repository at this point in the history
Summary:
Experimentation has shown that for a particular quality setting Q, jxl compresses "harder", meaing the resulting file is much smaller, but also, the MS-SSIM score is much lower, making it difficult to compare behavior and switch between jpg and jxl.
This diff "bumps" the effective jxl quality, so as make jxl generate files with a slightly higher score than jpg for quality settings between 80 and 95, while remaining smaller than jpg files. Note that this behavior is very data dependent and the observation made while using rgb8 images. There is no ambition that this adjustment is perfect, only to make behaviors much more coherent. Note that H.265 and H.264 generate even better MS-SSIM scores for this range.
Without this change, jxl is just way out of the pack.

Reviewed By: kiminoue7

Differential Revision: D51570593

fbshipit-source-id: 7a3b751101c22d796a0fd27d79b9748842278f0a
  • Loading branch information
Georges Berenger authored and facebook-github-bot committed Nov 29, 2023
1 parent eb171ff commit 19eec8b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions vrs/utils/PixelFrameJxl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ JxlEncoder* getThreadJxlEncoder() {
}

inline float percent_to_butteraugli_distance(float quality) {
// Make quality behave more like jpg's quality setting accoding to MS-SSIM. Very empirical.
float to100 = 100 - quality;
quality = 100 - to100 / 4;
// Quality calculation inspired by cjxl.cc
// Extended to work meaningfully between 99.99 and 99.999, so with quality = 99.999,
// the file size is now getting close to that of lossless.
Expand Down

0 comments on commit 19eec8b

Please sign in to comment.