这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@jonnyawsom3
Copy link
Collaborator

@jonnyawsom3 jonnyawsom3 commented Apr 18, 2025

Description

This PR changes the encoding parameters for Lossless when --faster_decoding is specified, resulting in up to 80% smaller files and 25% faster decoding. Also includes a flyby fix for lossy Delta Palette encoding on images above 2048*2048.

Progressive Lossless is also improved. Up to 40% smaller files and 20% faster decoding, with an additional 800% encode speed increase, thanks to enabling local MA trees.

These results change depending on encoding parameters, image content, CPU and decoder.
Only libjxl and jxl-oxide were tested, due to jxlatte being too unstable. Oxide proved to be considerably faster for Progressive Lossless and our new level 4 Faster Decoding, suggesting libjxl could be improved by examining it.

Tested on a Ryzen 5600H with a 10 MP image at effort 7.
BPP is now much more inline with the base effort 7 encode, following a logical progression of less density as you increase level.

BPP Main PR Δ (%)
Default Lossless 3.458 3.457 N/A
Faster Decoding 1 15.760 3.497 -77.81
Faster Decoding 2 15.760 3.578 -77.30
Faster Decoding 3 5.755 4.172 -27.51
Faster Decoding 4 5.755 4.478 -22.19
Progressive 7.948 5.047 -36.50

Levels 1-4 now make sense for decoding speed as well, with 3 and 4 now faster than effort 1. Progressive also got a boost.

Decode (MP/s) Main PR Δ (%)
Default Lossless 43.01 43.01 N/A
Faster Decoding 1 134.56 76.60 -43.07
Faster Decoding 2 134.56 84.31 -37.34
Faster Decoding 3 112.98 142.22 +5.69
Faster Decoding 4 112.98 169.22 +25.76
Progressive 35.41 41.72 +21.24

A bonus major speed up for progressive lossless encoding too, using Local MA trees but still buffering the full image.

Encode (MP/s) Main PR Δ (%)
Progressive 0.65 4.81 +740

Fixes #2812
Fixes #3532

Pull Request Checklist

  • CLA Signed: Have you signed the Contributor License Agreement (individual or corporate, as appropriate)? Only contributions from signed contributors can be accepted.
  • Authors: Have you considered adding your name to the AUTHORS file?
  • Code Style: Have you ensured your code adheres to the project's coding style guidelines? You can use ./ci.sh lint for automatic code formatting.

Please review the full contributing guidelines for more details.

@Galaxy4594
Copy link
Contributor

Yippie!

@Melirius
Copy link
Contributor

Melirius commented Apr 25, 2025

Congrats! Unfortunately I concentrated on other things from #4028, and it stroke back.

@Melirius
Copy link
Contributor

Have you checked also influence of this fix on density? #4135

@Galaxy4594
Copy link
Contributor

Thanks! You gave me a possible lead on fixing the --faster_decoding regression I just found. And just when we passed conformance, I swear we can't get a break. 😅

@jonnyawsom3 jonnyawsom3 marked this pull request as ready for review April 26, 2025 18:04
@jonnyawsom3
Copy link
Collaborator Author

Going to hold on #4207 before merging with main again, to hopefully pass all checks.

@Melirius
Copy link
Contributor

Going to hold on #4207 before merging with main again, to hopefully pass all checks.

WASM is failing too, hmm...

@jonnyawsom3
Copy link
Collaborator Author

WASM is failing too, hmm...

Last I checked it was a cache error, so should be fine next time it runs

@jonsneyers jonsneyers enabled auto-merge April 29, 2025 12:50
@jonsneyers jonsneyers added this pull request to the merge queue Apr 29, 2025
Merged via the queue into libjxl:main with commit a8dd904 Apr 29, 2025
87 of 88 checks passed
@Galaxy4594
Copy link
Contributor

@Melirius As it turns out, #4154 is the culprit of the small regression for --faster_decoding. I read your PR and I understand why some files have gone up in size, so how could this be fixed?

Settings Pre-PR (BPP) Post-PR (BPP) Δ (%)
Effort 7 7.550 7.572 +0.291
Faster decoding 1 7.630 7.651 +0.275
Faster decoding 2 7.742 7.754 +0.155
Faster decoding 3 8.125 8.376 +3.089
Progressive 8.195 8.194 -0.012

@Melirius
Copy link
Contributor

Melirius commented May 5, 2025

Just increase the number of buckets per property, this is the only sane way.

@Galaxy4594 Galaxy4594 mentioned this pull request May 6, 2025
lgritz pushed a commit to AcademySoftwareFoundation/OpenImageIO that referenced this pull request Jul 3, 2025
Fixes #4584
A minor edit with large consequences.

Previously the setting would encode uncompressed files due to a bug,
causing the much faster encoding as stated in the old description.

In the upcoming v0.12 libjxl release, [my
PR](libjxl/libjxl#4201) overhauls the setting,
to correctly scale decode speed at the cost of density.

---------

Signed-off-by: Jonathan Brown <jonathanbr30@gmail.com>
@eustas
Copy link
Contributor

eustas commented Jul 10, 2025

When setting cparams_.options.wp_tree_mode = ModularOptions::TreeMode::kNoWP; if predictor is Weighted it should be downgraded. Preparing a PR

@jonnyawsom3
Copy link
Collaborator Author

Ah, I thought we'd done that. Thanks for catching it. Probably use Gradient instead as that's closest.

zachlewis pushed a commit to zachlewis/OpenImageIO that referenced this pull request Aug 1, 2025
…ftwareFoundation#4812)

Fixes AcademySoftwareFoundation#4584
A minor edit with large consequences.

Previously the setting would encode uncompressed files due to a bug,
causing the much faster encoding as stated in the old description.

In the upcoming v0.12 libjxl release, [my
PR](libjxl/libjxl#4201) overhauls the setting,
to correctly scale decode speed at the cost of density.

---------

Signed-off-by: Jonathan Brown <jonathanbr30@gmail.com>
zachlewis pushed a commit to zachlewis/OpenImageIO that referenced this pull request Sep 1, 2025
…ftwareFoundation#4812)

Fixes AcademySoftwareFoundation#4584
A minor edit with large consequences.

Previously the setting would encode uncompressed files due to a bug,
causing the much faster encoding as stated in the old description.

In the upcoming v0.12 libjxl release, [my
PR](libjxl/libjxl#4201) overhauls the setting,
to correctly scale decode speed at the cost of density.

---------

Signed-off-by: Jonathan Brown <jonathanbr30@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

faster_decoding=1 or faster_decoding=2 has extremely bad size with lossless images. progressive encoding of lossless images is broken

5 participants