JPEG XL

Info

rules 57
github 35276
reddit 647

JPEG XL

tools 4225
website 1655
adoption 20712
image-compression-forum 0

General chat

welcome 3810
introduce-yourself 291
color 1414
photography 3435
other-codecs 23765
on-topic 24923
off-topic 22701

Voice Channels

General 2147

Archived

bot-spam 4380

benchmarks

jonnyawsom3
A homosapien What does butteraugli say?
2025-04-17 12:35:17
`JPEG` 79.53930745 2.5103836060 3-norm: 1.302746 `-d 1` 83.28755927 1.7946568727 3-norm: 0.618410 `-d 0.1` 92.68645483 0.2948192954 3-norm: 0.077324 `jpegli` 84.81737455 1.4984853268 3-norm: 0.691113
A homosapien
2025-04-17 12:38:52
can you send over the original image
jonnyawsom3
2025-04-17 12:39:05
I think it's not taking into account that dark areas have extremely limited value ranges, so it just sees "Oh, it's only off by 7, that's not noticeable". It might even be related to the desaturation issue
Traneptora
I think it's not taking into account that dark areas have extremely limited value ranges, so it just sees "Oh, it's only off by 7, that's not noticeable". It might even be related to the desaturation issue
2025-04-17 01:11:36
libjxl is very much supposed to take that into account
2025-04-17 01:12:02
one of the main selling points that has been advertized about libjxl is that it does that
2025-04-17 01:12:06
what you're observing is probably a bug
jonnyawsom3
2025-04-17 01:42:07
The issue exists all the way back in v0.6, so if it's a bug, it's a very longstanding one
monad
2025-04-17 01:51:52
IMO, d0.1 looks way better than JPEG. indistinguishable at reasonable viewing distance while the jpeg has noticeable distortion in flicker test. the comparison only gets worse zooming in.
jonnyawsom3
2025-04-17 01:54:17
d0.1 was 6.3 MB, the JPEG was 2.8 MB
monad
2025-04-17 01:55:28
sure, and it looks way better, checks out
jonnyawsom3
2025-04-17 01:56:14
Looks worse than the JPEG to me, still smoothened and quantized slightly
2025-04-17 01:59:29
Flicker at 1:1 between original and JPEG I can't see any difference, JPEG and d0.1 I can see it brightens and smooths slightly
2025-04-17 02:23:37
`--intensity_target 20000 -d 2.8` seems to compensate, giving a smaller file without crushing the blacks
2025-04-17 02:23:50
Obviously, not ideal...
A homosapien
So, libjxl *really* doesn't like dark areas. Original, `-d 1`, `-d 0.1` and classic JPEG at under half the bpp of `-d 0.1` while still looking better
2025-04-17 04:17:10
Okay, taking a look at the full image, on my SDR laptop I had to turn up my brightness all the way to even see the blurring, and the smudging is honestly not *that* bad.
2025-04-17 04:20:52
Same with my HDR phone, I had to turn my brightness up to see it, it's not super glaring imo. Also you could just target HDR displays like so `--intensity_target 2000 -d 1.4`
jonnyawsom3
A homosapien Okay, taking a look at the full image, on my SDR laptop I had to turn up my brightness all the way to even see the blurring, and the smudging is honestly not *that* bad.
2025-04-17 04:21:44
At 100% zoom? It was obivous to me and I only have SDR
A homosapien
2025-04-17 04:22:16
Is you monitor well-calibrated? Well acutally I don't even know if my own monitor is well-calibrated...
2025-04-17 04:23:40
Yes I compared at 100% zoom
2025-04-17 04:24:14
Let me try another monitor
2025-04-17 04:48:17
wait a minute
2025-04-17 04:48:38
I think color profile shenanigans are happening
2025-04-17 05:14:04
Yup I was right, instead having a proper sRGB color profile, it had a gamma chunk of 2.2 🤢. All color-managed software I have displayed the image too dark, meaning I can't actually see the compression in the blacks since the image as a whole was darker.
Quackdoc
2025-04-17 05:15:52
just use good software [av1_dogelol](https://cdn.discordapp.com/emojis/867794291652558888.webp?size=48&name=av1_dogelol)
2025-04-17 05:16:20
and by that I mean mac, only mac
A homosapien
2025-04-17 05:16:53
Tell artists that
2025-04-17 05:19:22
I swear, why are drawing programs using PNG gamma chunks (which often have the wrong values) compared to a proper sRGB profile/P3 profile?
2025-04-17 05:19:54
Okay I had to strip all the color metadata and append a sRGB profile
2025-04-17 05:20:06
NOW I can see the blacks being compressed
Quackdoc just use good software [av1_dogelol](https://cdn.discordapp.com/emojis/867794291652558888.webp?size=48&name=av1_dogelol)
2025-04-17 05:24:21
If I used software with no color management it would have avoided this issue lol <:kekw:808717074305122316> "gamma chunk? what gamma chunk?" - qimgv & windows photo viewer
jonnyawsom3
A homosapien Yup I was right, instead having a proper sRGB color profile, it had a gamma chunk of 2.2 🤢. All color-managed software I have displayed the image too dark, meaning I can't actually see the compression in the blacks since the image as a whole was darker.
2025-04-17 05:25:23
~~The file I was actually testing with was a `-o 1 -f 9` Oxipng pass, to get rid of the redundant Alpha, I guess maybe that made it sRGB too~~ Nope
2025-04-17 05:25:53
Or Irfanview probably either read it properly or ignored it and did sRGB since it's ancient
A homosapien
2025-04-17 05:28:52
Every time I run into color management issues, it's due to PNG's gamma chunk. (Looking at you FFMPEG <:PepeGlasses:878298516965982308>) The values are always improperly set and the image always looks too dark or too bright.
Quackdoc
2025-04-17 05:29:27
the weird thing about having a gamma 2.2 chunk is that it should be correct in the vast majority of cases. only in the case of an inverse oetf display should it display incorrectly, which is really just the status quo
A homosapien
2025-04-17 05:36:32
It should be the same, but it's not. ~~It looks terrible in color managed software, a simple sRGB color profile does not have these issues. Libjxl is doing something wrong here.~~
2025-04-17 05:36:56
Also, this has a domino effect with JXL, it takes in the incorrect color data and does crappy compression
jonnyawsom3
A homosapien Also, this has a domino effect with JXL, it takes in the incorrect color data and does crappy compression
2025-04-17 05:44:03
Yep. Original, Gamma, sRGB
A homosapien
2025-04-17 05:44:34
Infranview ignores the gamma chunk and just assumes sRGB ~~(as it should)~~
2025-04-17 05:45:15
BUT, libjxl doesn't ignore it and assumes the image is actually darker it should be
jonnyawsom3
2025-04-17 05:46:00
But as Quack said, shouldn't Gamma 2.2 be essentially the same as sRGB?
A homosapien
2025-04-17 05:47:12
~~I think it might be an error on libjxl's part~~
2025-04-17 05:47:44
looking at jxlinfo reveals something
2025-04-17 05:49:28
``` jxlinfo PNG-gamma.jxl JPEG XL image, 2654x3753, (possibly) lossless, 8-bit RGB+Alpha Color space: RGB, D65, sRGB primaries, gamma(0.454550) transfer function, rendering intent: Relative jxlinfo PNG-nogamma.jxl JPEG XL image, 2654x3753, (possibly) lossless, 8-bit RGB Color space: RGB, D65, sRGB primaries, sRGB transfer function, rendering intent: Relative ```
Quackdoc
2025-04-17 05:51:41
when decoding without specifing color profile, they should decode to the same [Hmm](https://cdn.discordapp.com/emojis/1113499891314991275.webp?size=48&name=Hmm)
2025-04-17 05:51:55
might it be whatever software is being used that libjxl is interfacing with?
A homosapien
2025-04-17 05:53:20
The original PNG has a gamma chunk of 2.2, and then I tested the same PNG with color metadata stripped out. Compressed with cjxl 0.11
jonnyawsom3
2025-04-17 05:59:44
Simplest answer would be checking for a gamma of 0.45455 and using the sRGB enum, since it's already detecting everything else
A homosapien
2025-04-17 06:02:10
how about just [ignoring it](https://cdn.discordapp.com/emojis/862625638238257183.webp?size=48&name=av1_chad)
jonnyawsom3
2025-04-17 06:02:30
I mean for lossy, it should be, that's what I meant
2025-04-17 06:02:39
Colorspaces are already simplified
Quackdoc
2025-04-17 06:02:55
man i wish stuff just handled color properly
jonnyawsom3
2025-04-17 06:05:12
IIRC <@604964375924834314> is the main colorspace man, maybe they have some input about the gamma weirdness
A homosapien
2025-04-17 06:14:25
FFMPEG has similar issues with gamma as well, PNG screencaps from videos looked too bright, nuking color data made it look correct again.
_wb_
2025-04-17 06:41:51
IIRC the issue is that PNG with gamma2.2 is not the same as PNG with sRGB tf, but lots of viewers display them in the same way. Libjxl does the right thing but it will cause visible difference to the original if you are looking at it in a viewer that does the wrong thing. This mostly affects the darks.
A homosapien
2025-04-17 07:05:28
hmm, are both paint.net and GIMP doing gamma incorrectly then? They both render JXLs with `gamma(0.454550) transfer function` too dark
Quackdoc
_wb_ IIRC the issue is that PNG with gamma2.2 is not the same as PNG with sRGB tf, but lots of viewers display them in the same way. Libjxl does the right thing but it will cause visible difference to the original if you are looking at it in a viewer that does the wrong thing. This mostly affects the darks.
2025-04-17 07:14:27
afaik PNG's srgb tf is ambiguous and pretty much means "whatever you think sRGB is" or in 90% of cases, a noop. in color managed setups, whether or not sRGB is treated by doing a pure 2.2 or an inverse oetf is up to the application (and really should be able to be override on a per image case)
2025-04-17 07:14:41
a pure 2.2 tag is explicit and should "always be handled correctly"
jonnyawsom3
A homosapien hmm, are both paint.net and GIMP doing gamma incorrectly then? They both render JXLs with `gamma(0.454550) transfer function` too dark
2025-04-17 08:00:18
The first thing the artist themselves said was "Why is it so dark", so either libjxl is doing something wrong or all the art programs aren't displaying the canvas correctly. Might be another case of 'de-facto standard' rather than actual standard...
Quackdoc
The first thing the artist themselves said was "Why is it so dark", so either libjxl is doing something wrong or all the art programs aren't displaying the canvas correctly. Might be another case of 'de-facto standard' rather than actual standard...
2025-04-17 08:21:22
what are program ? I know lots don't display properly without a shit ton of fighting
2025-04-17 08:21:53
also "why is it so dark " is something many graphics designers have heard when shipping images to customers xD
2025-04-17 08:22:00
thanks srgb
jonnyawsom3
2025-04-17 08:22:35
In this case, sRGB is what they wanted
Quackdoc
2025-04-17 08:23:16
sRGB will never be consistent
jonnyawsom3
Quackdoc what are program ? I know lots don't display properly without a shit ton of fighting
2025-04-17 08:24:01
https://www.escapemotions.com/products/rebelle/about
Quackdoc
2025-04-17 08:24:31
never used it nor know anyone who does so can't comment t.t
_wb_
Quackdoc afaik PNG's srgb tf is ambiguous and pretty much means "whatever you think sRGB is" or in 90% of cases, a noop. in color managed setups, whether or not sRGB is treated by doing a pure 2.2 or an inverse oetf is up to the application (and really should be able to be override on a per image case)
2025-04-17 08:55:22
The `sRGB` chunk means specifically the sRGB primaries and the sRGB tf and there is no nothing ambiguous. But of course in practice there are many applications that don't properly do color management. In particular many applications will just ignore any tags except explicit ICC profiles.
A homosapien
2025-04-17 09:35:15
It's a problem ~~with lossy JXL specifically,~~ it decodes too dark compared to the original PNG
jonnyawsom3
2025-04-17 09:38:06
I was going to say earlier but wasn't sure if it was Irfanview bugging out. Lossy JXL is dark and has the severe compression, lossless is the same brightness as the original PNG/sRGB
A homosapien
2025-04-17 09:42:50
yeah it's strange, the extra dark image ~~only~~ appears when it's encoded as a lossy jxl, then decoded by any software. Same with jpegli
jonnyawsom3
2025-04-17 09:47:14
I think it's because the XYB interally means it gets converted to the requested output format, so libjxl is doing the gamma to sRGB conversion, but lossless relies on the viewer to handle gamma again
A homosapien
2025-04-17 09:49:28
I see why your artist friend says, "It's too dark". The image is brighter and the darks are more visible in *Rebelle 7*, but in Google Chrome and in JPEG XL they appear darker.
2025-04-17 09:49:37
It doesn't carry over
jonnyawsom3
2025-04-17 10:05:40
<@568056047701590026> maybe you can file a bug report for Rebelle, if we explain what the problem is. Basically the PNG it makes is a lot darker than your canvas, but only in certain software
Quackdoc
_wb_ The `sRGB` chunk means specifically the sRGB primaries and the sRGB tf and there is no nothing ambiguous. But of course in practice there are many applications that don't properly do color management. In particular many applications will just ignore any tags except explicit ICC profiles.
2025-04-17 10:08:11
does PNG specify whether or not the sRGB function should use the inverse oetf or the pure 2.2? iirc ICC defines it with inverse oetf
A homosapien
2025-04-17 10:18:17
Rebelle 7 is outputting an image that looks different natively in software compared to basically every color-managed viewer I've tested. So I think Rebelle 7's fault for setting inaccurate sRGB values, ~~mainly because the program itself is not even color-managed, it doesn't respond to any color profiles or anything.~~ The base edition isn't color managed, you need to pay extra for proper colors. <:PepeSad:815718285877444619>
Quackdoc
2025-04-17 10:20:15
it doesn't seem to specify but the sRGB w3 spec hints towards 2.2
2025-04-17 10:21:13
oops meant my reply to be in regards to PNG spec
A homosapien
2025-04-17 10:24:47
I think Rebelle 7 is setting the wrong transfer curve. It think the program itself displays the workspace using the sRGB transfer curve, but then sets gamma 2.2 for PNG export, which leads to a minor discrepancy between what the artist sees on the canvas and the saved image. It's the opposite of "what you see is what you get" which is really bad for artists.
2025-04-17 10:35:46
God my head hurts
Quackdoc
2025-04-17 10:45:31
ita more likely that it is displaying "as is" then tagging 2.2 which is the reccomended default for png
2025-04-17 10:46:59
it does have color management options https://escapemotions.com/products/rebelle/manual/starting-painting/color-management
2025-04-17 10:47:42
> If you do not want to use the color management and assign a profile to your Rebelle artwork, select "Don't color manage". This option uses your monitor profile as the working space. It removes any embedded profiles when opening images, and does not tag when saving.
2025-04-17 10:47:55
this seems likely
jonnyawsom3
2025-04-17 10:48:59
Pro edition for functional image export 💀
Quackdoc
2025-04-17 10:50:48
wait its a different edition? RIP
HDYLY
<@568056047701590026> maybe you can file a bug report for Rebelle, if we explain what the problem is. Basically the PNG it makes is a lot darker than your canvas, but only in certain software
2025-04-17 03:18:10
hmmmm
2025-04-17 03:18:27
ill check again cus they updated
𝕰𝖒𝖗𝖊
2025-04-17 07:57:21
**Source:** https://www.dpreview.com/sample-galleries/4314410403/fujifilm-gfx-100-ii-pre-production-sample-gallery/1213608457 `11,648 × 8,736 (102 MP) | Real Life Camera Photography` **Encoders:** ``` cwebp 1.4.0 cjxl v0.12.0 e3961729 avifenc 1.1.1 (svt-psy 68a84a2) cjpegli (Google - git upstream, 2025-04-17) ``` **Parameters:** ``` cjxl --allow_expert_options --codestream_level "10" -e "11" --container="0" -x strip="exif" -x strip="xmp" -x strip="jumbf" -x strip="iptc" -x strip="jhgm" --noise="0" --keep_invisible="0" --photon_noise_iso="0" --gaborish="1" --dots="1" --compress_boxes="1" --brotli_effort="11" --progressive_dc="0" --epf="0" --resampling="1" --ec_resampling="1" --upsampling_mode="-1" cwebp -preset "photo" -hint "photo" -m "6" -segments "4" -pass "10" -noalpha -sharp_yuv oavif -s "0" # tune=4, psy-rd=0, qpscs=0, -g 2x2 cjpegli -p "2" --chroma_subsampling="420" ```
2025-04-17 07:58:20
username
𝕰𝖒𝖗𝖊 **Source:** https://www.dpreview.com/sample-galleries/4314410403/fujifilm-gfx-100-ii-pre-production-sample-gallery/1213608457 `11,648 × 8,736 (102 MP) | Real Life Camera Photography` **Encoders:** ``` cwebp 1.4.0 cjxl v0.12.0 e3961729 avifenc 1.1.1 (svt-psy 68a84a2) cjpegli (Google - git upstream, 2025-04-17) ``` **Parameters:** ``` cjxl --allow_expert_options --codestream_level "10" -e "11" --container="0" -x strip="exif" -x strip="xmp" -x strip="jumbf" -x strip="iptc" -x strip="jhgm" --noise="0" --keep_invisible="0" --photon_noise_iso="0" --gaborish="1" --dots="1" --compress_boxes="1" --brotli_effort="11" --progressive_dc="0" --epf="0" --resampling="1" --ec_resampling="1" --upsampling_mode="-1" cwebp -preset "photo" -hint "photo" -m "6" -segments "4" -pass "10" -noalpha -sharp_yuv oavif -s "0" # tune=4, psy-rd=0, qpscs=0, -g 2x2 cjpegli -p "2" --chroma_subsampling="420" ```
2025-04-17 08:06:16
is this meant to test encoder quality at max effort settings and such for encoders? If so I would recommend adding `-af` to cwebp, also it might make sense as well to add `-metadata icc` to retain possibly present color profiles in source images as without it they will look wrong. also why do you have epf turned off for cjxl? and also is there a reason you aren't doing XYB with jpegli?
𝕰𝖒𝖗𝖊
username is this meant to test encoder quality at max effort settings and such for encoders? If so I would recommend adding `-af` to cwebp, also it might make sense as well to add `-metadata icc` to retain possibly present color profiles in source images as without it they will look wrong. also why do you have epf turned off for cjxl? and also is there a reason you aren't doing XYB with jpegli?
2025-04-17 08:12:11
Thanks, I will definitely retest again in the future. Yes, this test disregards speed. For reference, on my machine (9950x), and with this image, `cjpegli` is simply instant, webp is the slowest. `avif` is considerably faster than `cjxl` because I can use `--lp=5` with around 50G ram usage. Yes, I forgot adding `-af` for `webp`, you are right. I ould also add `-metadata icc`. I disabled `EPF` for `cjxl` because I did internal bd-rate curve test with it beforehand. It probably looks psychovisually better but it decreased bd-rate efficiency.
_wb_
2025-04-17 08:18:05
I am not convinced e11 cjxl produces better results than e7 for lossy
𝕰𝖒𝖗𝖊
_wb_ I am not convinced e11 cjxl produces better results than e7 for lossy
2025-04-17 08:18:28
but would it produce worse?
_wb_
2025-04-17 08:18:36
It could
2025-04-17 08:19:30
It's less tested and may well overfit for butteraugli instead of producing good visual quality
2025-04-17 08:20:04
As a metric, I can recommend CVVDP, by the way
Orum
2025-04-17 08:20:08
yeah, who uses e 11?
𝕰𝖒𝖗𝖊
2025-04-17 08:21:49
my older test
2025-04-17 08:22:06
It was kind of consistent
_wb_
2025-04-17 08:22:17
All metrics except butteraugli-max are pessimistic about jxl compared to the results we get in subjective studies, interestingly. They are optimistic about avif. With that I mean that the metrics assign too high scores to avif images and too low scores to jxl images, compared to the ground truth of actual human observers.
𝕰𝖒𝖗𝖊
2025-04-17 08:22:45
That was also my observation. I am actually extremely surprised with the results.
2025-04-17 08:23:24
The breaking point should have been around 70~ ssimu2
2025-04-17 08:23:27
maybe even less
_wb_
2025-04-17 08:29:05
2025-04-17 08:30:20
This is plotting the average metric score (averaged over 5 images) at a given visual quality in JND for various codecs, for various metrics.
2025-04-17 08:31:17
JPEG AI manages to fool all the metrics basically, probably since it was mostly trained using metrics, so all metrics are very optimistic about it as a result
2025-04-17 08:31:58
But you can also see that metrics tend to be pessimistic about jxl.
2025-04-17 08:36:14
For HDR images, the amount of codec bias in metrics is even more pronounced, to the point that doing a codec comparison based on metrics will lead to pretty incorrect conclusions.
𝕰𝖒𝖗𝖊
_wb_ As a metric, I can recommend CVVDP, by the way
2025-04-17 08:54:19
Thanks for this recommendation and also the PDFs are really interesting
_wb_ For HDR images, the amount of codec bias in metrics is even more pronounced, to the point that doing a codec comparison based on metrics will lead to pretty incorrect conclusions.
2025-04-17 08:55:14
Still in 2025, there is still no way to batch test image/video quality
2025-04-17 08:55:37
Do you think it's borderline useless? (metric testing)
_wb_
2025-04-17 08:58:06
It's useful because it's so much faster and cheaper than subjective testing
2025-04-17 08:58:58
Probably it is also still useful to tweak encoders, as long as you are careful not to blindly trust metrics
2025-04-17 09:01:02
But things like Bjøntegard BD rates have to be taken with a very big grain of salt, since a metric can easily say something is 20% better while it has a 40% bias the other way so in reality it is 20% worse.
2025-04-17 09:02:51
At the current JPEG meeting we will be issuing a call for proposals for AIC-4, which is objective metrics. Besides just the usual correlations, we will also look at codec bias. I hope this activity will lead to better metrics with less codec bias.
𝕰𝖒𝖗𝖊
_wb_ Probably it is also still useful to tweak encoders, as long as you are careful not to blindly trust metrics
2025-04-17 09:05:51
I guess this is the key.
_wb_ But things like Bjøntegard BD rates have to be taken with a very big grain of salt, since a metric can easily say something is 20% better while it has a 40% bias the other way so in reality it is 20% worse.
2025-04-17 09:07:05
Oh obviously. Especially for this test, since there are many more data points closer to the low BPP side, the "summarized" results are extremely biased
2025-04-17 09:08:25
and all of the percentage difference comes from the relative bd-rate curve. It would change if quality range is changed or if you remove an encoder from the list (or add another one)
jonnyawsom3
_wb_ I am not convinced e11 cjxl produces better results than e7 for lossy
2025-04-17 09:53:30
e11 lossy is internally remapped to e10. I encountered it with my resampling PR, so I had to move the slower downsampling to e10 instead
𝕰𝖒𝖗𝖊
e11 lossy is internally remapped to e10. I encountered it with my resampling PR, so I had to move the slower downsampling to e10 instead
2025-04-17 10:14:45
true
2025-04-17 10:15:54
encoding a 102MP image 100 times, with actual E11 would be hell 😁
jonnyawsom3
𝕰𝖒𝖗𝖊 encoding a 102MP image 100 times, with actual E11 would be hell 😁
2025-04-17 10:38:19
I almost disabled the remapping, but I think it would just do e11 on the 1:8 modular DC image
𝕰𝖒𝖗𝖊 **Source:** https://www.dpreview.com/sample-galleries/4314410403/fujifilm-gfx-100-ii-pre-production-sample-gallery/1213608457 `11,648 × 8,736 (102 MP) | Real Life Camera Photography` **Encoders:** ``` cwebp 1.4.0 cjxl v0.12.0 e3961729 avifenc 1.1.1 (svt-psy 68a84a2) cjpegli (Google - git upstream, 2025-04-17) ``` **Parameters:** ``` cjxl --allow_expert_options --codestream_level "10" -e "11" --container="0" -x strip="exif" -x strip="xmp" -x strip="jumbf" -x strip="iptc" -x strip="jhgm" --noise="0" --keep_invisible="0" --photon_noise_iso="0" --gaborish="1" --dots="1" --compress_boxes="1" --brotli_effort="11" --progressive_dc="0" --epf="0" --resampling="1" --ec_resampling="1" --upsampling_mode="-1" cwebp -preset "photo" -hint "photo" -m "6" -segments "4" -pass "10" -noalpha -sharp_yuv oavif -s "0" # tune=4, psy-rd=0, qpscs=0, -g 2x2 cjpegli -p "2" --chroma_subsampling="420" ```
2025-04-17 11:00:39
Many of the parameters you specified are set automatically, some even being harmful to density or non-functional. `--codestream_level` is set automatically, and forcing it to 10 could cause it to waste a few bytes. `--container 0` does nothing since it uses a bare codestream if no metadata is present. `-x strip=all` works the same as specifying them separately. Instead of `-x strip="jumbf"` you should use `----allow_jpeg_reconstruction 0`, if you don't want reconstruction. `--noise` is non-functional, so disabled by default `--keep_invisible` only applies to Alpha, which JPEG doesn't have, also only for Lossless with it being 0 for lossy `--photon_noise_iso` is disabled by default `--gaborish` adjusts based on quality, with it being bad at low quality/lossless `--dots` is non-functional like `--noise`, only increasing memory usage and encode time `--compress_boxes` is enabled by default `--epf` adjusts based on image/quality, so forcing it off introduces blocking Resampling only triggers at distance 20 (soon distance 10), so that's redundant too `--upsampling_mode` only applies when Resampling is active And finally, if think you're doing Lossless JPEG Transcoding. Not lossy encoding like the other formats. You need to add `-j 0` or `----lossless_jpeg 0`
𝕰𝖒𝖗𝖊
2025-04-17 11:01:10
I have --lossless_jpeg 0
2025-04-17 11:01:24
I tested these settings prior-hand
2025-04-17 11:01:53
As you said, most of these are already, the defaults
2025-04-17 11:02:02
some of these don't affect the scores negatively or positively
2025-04-17 11:02:11
and some of them increase the scores (EPF=0)
2025-04-17 11:02:22
it can psychovisually be better
2025-04-17 11:02:36
I disabled it similar to disabling psy-rd with svt
2025-04-17 11:03:30
I rechecked again: ``` --container="0" \ --lossless_jpeg="0" \ --allow_jpeg_reconstruction="0" ```
jonnyawsom3
2025-04-17 11:07:07
Ah, good. It might be interesting for you to try v0.8 of cjxl too, as it has some... *Different* characteristics
𝕰𝖒𝖗𝖊
Ah, good. It might be interesting for you to try v0.8 of cjxl too, as it has some... *Different* characteristics
2025-04-17 11:10:26
Hmm, would it be meaningful to add it to a comparison like this? If it's too close to 0.12; then it would be noise though
2025-04-17 11:11:21
If it behaves better against metrics, I can use that but it would be less meaningful though
2025-04-17 11:11:28
or not?
jonnyawsom3
𝕰𝖒𝖗𝖊 Hmm, would it be meaningful to add it to a comparison like this? If it's too close to 0.12; then it would be noise though
2025-04-17 11:16:04
```cjxl Test.png 12.jxl JPEG XL encoder v0.12.0 [_AVX2_,SSE4,SSE2] Encoding [VarDCT, d1.000, effort: 7] Compressed to 374.5 kB (1.445 bpp). 1920 x 1080, 2.696 MP/s [2.70, 2.70], , 1 reps, 16 threads. cjxl8 Test.png 8.jxl JPEG XL encoder v0.8.2 954b460 [AVX2,SSE4,SSSE3,Unknown] Read 1920x1080 image, 2865313 bytes, 131.8 MP/s Encoding [VarDCT, d1.000, effort: 7], Compressed to 307180 bytes (1.185 bpp). 1920 x 1080, 2.27 MP/s [2.27, 2.27], 1 reps, 16 threads. ssimulacra2 Test.png 12.jxl 85.82864552 ssimulacra2 Test.png 8.jxl 84.73574296``` Depends on the image, but it can be quite a lot better. There's more in https://discord.com/channels/794206087879852103/1278292301038227489
𝕰𝖒𝖗𝖊
2025-04-17 11:16:58
What's the reason though? Why did it deviate?
jonnyawsom3
2025-04-17 11:20:09
This PR changed how libjxl measures quality while making decisions. It helped for a few difficult images, but harmed most others instead https://github.com/libjxl/libjxl/pull/2836
𝕰𝖒𝖗𝖊
This PR changed how libjxl measures quality while making decisions. It helped for a few difficult images, but harmed most others instead https://github.com/libjxl/libjxl/pull/2836
2025-04-17 11:27:54
Thanks. I decided to test 0.8 and 0.12 on the particular image I am testing, and then use the best performing one.
jonnyawsom3
2025-04-17 11:32:02
Oh, and if you do use `--xyb` on cjpegli, also use `--chroma_subampling 444` due to hard quality limits for 4:2:0
𝕰𝖒𝖗𝖊
2025-04-17 11:35:27
I tested with xyb now, and it is really better
Oh, and if you do use `--xyb` on cjpegli, also use `--chroma_subampling 444` due to hard quality limits for 4:2:0
2025-04-17 11:35:39
though I tested 444 before and it was way worse (on metrics)
2025-04-17 11:35:52
maybe it would behave better with xyb
jonnyawsom3
2025-04-17 11:36:27
I cite this almost weekly, but it could be useful to decide cutoffs for subsampling https://giannirosato.com/blog/post/jpegli-xyb/
𝕰𝖒𝖗𝖊
2025-04-17 11:37:35
I got this without -xyb
jonnyawsom3
2025-04-17 11:39:55
Is that averaged across the full quality range?
𝕰𝖒𝖗𝖊
username is this meant to test encoder quality at max effort settings and such for encoders? If so I would recommend adding `-af` to cwebp, also it might make sense as well to add `-metadata icc` to retain possibly present color profiles in source images as without it they will look wrong. also why do you have epf turned off for cjxl? and also is there a reason you aren't doing XYB with jpegli?
2025-04-17 11:50:34
`-af` improved the scores. `-pre 3` improved it further. `-preset & -hint` already improve them. `-metadata icc or all` doesn't change scores. Exact same. Maybe the ref image doesn't have icc? Here see the output: ``` cwebp -preset "photo" -hint "photo" -m "6" -pass "10" -q "80" reference.jpg -o "test.webp" -af -pre 3 -progress -metadata all -v Time to read input: 0.322s Saving file 'test.webp' Time to encode picture: 76.614s File: reference.jpg Dimension: 11648 x 8736 Output: 3461904 bytes Y-U-V-All-PSNR 44.02 49.13 49.63 45.19 dB (0.27 bpp) block count: intra4: 129748 (32.64%) intra16: 267740 (67.36%) skipped: 71651 (18.03%) bytes used: header: 924 (0.0%) mode-partition: 446433 (12.9%) Residuals bytes |segment 1|segment 2|segment 3|segment 4| total macroblocks: | 1%| 3%| 15%| 81%| 397488 quantizer: | 32 | 32 | 24 | 18 | filter level: | 30 | 36 | 14 | 14 | Metadata: * EXIF data: 65460 bytes * XMP data: 12255 bytes ```
Is that averaged across the full quality range?
2025-04-17 11:51:05
as far as I remember, it must be the full range. I'll retest with --xyb and send the scores
jonnyawsom3
2025-04-17 11:52:41
That might cause an issue then. Since 444 is wasteful for the extremely low quality range, but 420 can't reach high quality at all. So it will always look bad unless adjusted for the quality setting
username
2025-04-17 11:53:26
something to note about `--xyb` is it uses a special chroma subsampling amount/mode if you don't define `--chroma_subsampling` at all
𝕰𝖒𝖗𝖊
username something to note about `--xyb` is it uses a special chroma subsampling amount/mode if you don't define `--chroma_subsampling` at all
2025-04-17 11:58:22
Okay so I can also test non-specified vs --chroma_subsampling Thanks for the tip
username
2025-04-18 12:01:54
oh also with cwebp if you are curious what the different hints/presets set/change internally here is it all: https://github.com/webmproject/libwebp/blob/874069042ead095f8a8d6bdd35b9b145ce80af43/src/enc/config_enc.c#L60
2025-04-18 12:02:25
above the line I linked to are the defaults if no hint/preset is defined
𝕰𝖒𝖗𝖊
That might cause an issue then. Since 444 is wasteful for the extremely low quality range, but 420 can't reach high quality at all. So it will always look bad unless adjusted for the quality setting
2025-04-18 01:59:39
2025-04-18 01:59:46
You are right
2025-04-18 02:00:13
2025-04-18 02:01:06
Before 60 SSIMU2, and before 2.5 Butter-3norm; it splits
jonnyawsom3
2025-04-18 02:02:11
I should really try and make a PR so that it changes based on quality
𝕰𝖒𝖗𝖊
2025-04-18 02:05:31
It seems (the split) extremely sharp and deterministic. I don't think this would change drastically among different images
jonnyawsom3
𝕰𝖒𝖗𝖊 It seems (the split) extremely sharp and deterministic. I don't think this would change drastically among different images
2025-04-18 02:32:26
Do you have the quality/distance value where 444 overtook 420? Metrics don't cleanly map to input targets and it'd save me running my own tests
𝕰𝖒𝖗𝖊
2025-04-18 02:32:43
Let me check
Do you have the quality/distance value where 444 overtook 420? Metrics don't cleanly map to input targets and it'd save me running my own tests
2025-04-18 02:52:07
For butter 3-norm the splitting point where 444 better is: ``` cjpegli "${ref}" "${output}" -q "84" -p "2" --xyb --chroma_subsampling=420 cjpegli "${ref}" "${output}" -q "21" -p "2" --xyb --chroma_subsampling=444 ```
2025-04-18 02:53:14
Both encodes have a similar size but 444 is smaller and has better score: ``` 420: BPP=2385518 SCORE=2.622476 444: BPP=2372800 SCORE=2.556109 ```
2025-04-18 02:53:27
let me check for ssimu2
2025-04-18 02:56:35
It's 26 (or 25) to 87 for ssimu2
jonnyawsom3
2025-04-18 02:59:48
Hmm, that makes it a bit more complicated... I didn't consider how far 420 stretches out into the high quality range before 444 takes over. Maybe I'll take a more conservative approach of switching at `-q 30`, so there's bpp overshoot from 444 but not lack of quality from 420. XYB needs 444 to be compatible with JXL Transcoding too, so we want most files to use it
𝕰𝖒𝖗𝖊
2025-04-18 03:00:26
If you ask me making 444 the default makes more sense here
jonnyawsom3
2025-04-18 03:00:30
I was considering disabling 420 for XYB entirely, but it does make quite a difference
𝕰𝖒𝖗𝖊
2025-04-18 03:00:37
looking at the results, 420 is terrible and less intuitive
2025-04-18 03:00:50
a user might select a score as high as 87 and get an actual output of 30
2025-04-18 03:01:45
Should I test not specifying it? username above said that it also had another mode
A homosapien
𝕰𝖒𝖗𝖊 For butter 3-norm the splitting point where 444 better is: ``` cjpegli "${ref}" "${output}" -q "84" -p "2" --xyb --chroma_subsampling=420 cjpegli "${ref}" "${output}" -q "21" -p "2" --xyb --chroma_subsampling=444 ```
2025-04-18 03:02:19
Oh the reason why 420 scores so poorly is because of a bug https://github.com/libjxl/libjxl/issues/3605
2025-04-18 03:02:32
You should not specify it
2025-04-18 03:02:36
Because if you do, it triggers different behavior for some reason
2025-04-18 03:02:53
This is only for XYB by the way
jonnyawsom3
2025-04-18 03:02:58
I'm looking at the code now and... I have no idea what it's doing
2025-04-18 03:03:18
It says it's subsampling Blue, but B is the only *non-*subsampled channel...
𝕰𝖒𝖗𝖊
2025-04-18 03:03:19
For benchmarking purposes, I was thinking on doing a 2 pass approach (encode low bitrates with 420, and rest of it with 444)
jonnyawsom3
2025-04-18 03:04:24
Because of the JXL transcoding and weird behaviour, I might just set XYB to be 444 by default. It can always be overridden with the flag. If you have the same crossover for YCbCr 420 and 444 I can still add that at least
𝕰𝖒𝖗𝖊
A homosapien You should not specify it
2025-04-18 03:05:31
*"something to note about --xyb is it uses a special chroma subsampling amount/mode if you don't define --chroma_subsampling at all"*
2025-04-18 03:05:46
so is it a bug or a feature? lol
A homosapien
2025-04-18 03:07:39
I would consider that a bug honestly. Imagine getting crappy results by using a common feature
2025-04-18 03:08:06
Or just poor documentation I suppose
𝕰𝖒𝖗𝖊
2025-04-18 03:21:01
2025-04-18 03:21:07
This is interesting
A homosapien You should not specify it
2025-04-18 03:22:04
Specifying is still better up until some point (around -q 20 to 26)
A homosapien
2025-04-18 03:22:52
Not a usable quality tbh
jonnyawsom3
2025-04-18 03:23:46
It's because of using XYB instead of YBX
2025-04-18 03:24:13
It's subsampling luma
A homosapien
2025-04-18 03:24:34
yeah, thats the bug I was talking about
username
2025-04-18 03:26:31
doesn't `--xyb` internally use RGB JPEGs..?
jonnyawsom3
2025-04-18 03:27:20
Yes, but it still subsamples the RGB channels
username
2025-04-18 03:29:03
oh yeah wait I forgot about the whole XYB color transform part of `--xyb` whoops. I've been awake for quite a while..
jonnyawsom3
2025-04-18 03:51:33
Made some changes, will test them soon™
2025-04-18 04:06:12
In [my fork](<https://github.com/jonnyawsom3/jpegli>) I've set XYB to 444 unless overridden with the flag. Maybe <@604964375924834314> (sorry for another ping) could help me change it from XYB to YBX, then the normal subsampling flags would work correctly and unmanaged viewers wouldn't be bright pink and green (But still tinted)
2025-04-18 09:48:43
Oh, also <@1028567873007927297> IIRC you wanted the APP14 marker for XYB, so I enabled that in the fork too
username
In [my fork](<https://github.com/jonnyawsom3/jpegli>) I've set XYB to 444 unless overridden with the flag. Maybe <@604964375924834314> (sorry for another ping) could help me change it from XYB to YBX, then the normal subsampling flags would work correctly and unmanaged viewers wouldn't be bright pink and green (But still tinted)
2025-04-18 10:01:34
it would be nice to still have a way to enable/set the blue channel subsampling because afaik there is no option for it otherwise. I mean if what you are proposing with YBX comes true then it probably won't be relevant anymore but unless/until that happens I don't think the option for blue channel subsampling should be removed entirely.
jonnyawsom3
username it would be nice to still have a way to enable/set the blue channel subsampling because afaik there is no option for it otherwise. I mean if what you are proposing with YBX comes true then it probably won't be relevant anymore but unless/until that happens I don't think the option for blue channel subsampling should be removed entirely.
2025-04-18 10:04:54
I was going to duplicate all the subsampling options for XYB, but it felt very messy for what shouldn't be an issue in the first place
Demiurge
Oh, also <@1028567873007927297> IIRC you wanted the APP14 marker for XYB, so I enabled that in the fork too
2025-04-18 10:09:06
Merge request 😲
2025-04-18 10:17:12
Alternatively, the YBX data could be stored in a traditional old YCbCr JPEG. The JPEG decoder will convert it to incorrect RGB values and then a color profile can be attached that converts the incorrect RGB data to the correct RGB values.
2025-04-18 10:19:07
The incorrect and correct data can look pretty similar unless you swap the color channels :)
2025-04-18 10:19:58
If you want it to be more obvious that it's being viewed incorrectly then swap the channels, otherwise put X where Cr is and B where Cb is
2025-04-18 10:24:36
If you multiply the transform matrices of the reverse-YBX transform with the forward-YCrCb transform, you will get the matrix that will reverse the incorrect reverse-YCrCb and apply the correct reverse-YBX transform
2025-04-18 10:25:01
I know it hurts to think about
2025-04-18 10:26:06
You can even have an option, to swap channels to make it easier to tell if the colors are wrong.
2025-04-18 10:26:14
And no need for an app14 tag anymore
2025-04-18 10:26:50
Why not do it that way?
2025-04-18 10:27:06
No need to worry about chroma subsampling compatibility problems either
jonnyawsom3
2025-04-18 10:27:38
If you saw the horrors of the codebase, you wouldn't be asking so much
Demiurge
2025-04-18 10:27:50
Is there any reason whatsoever to do it the current way instead?
If you saw the horrors of the codebase, you wouldn't be asking so much
2025-04-18 10:28:26
Oh I saw it lol. 😂
jonnyawsom3
2025-04-18 10:28:36
At least let us figure out what YBX looks like, since it's not a perfect match anyway and I don't have the knowledge to do it
Demiurge
2025-04-18 10:28:50
C++ template hell
username
2025-04-18 10:29:15
I don't think that's how that works (with my understanding at least). imagine the random assortment of numbers below is a palette of colors or something: ``` 2 6 1 x 8 5 x 0 ``` now imagine that the numbers with "x" don't exist anymore after a lossy color transform and are simply changed into nearby existing numbers. alright well now how do you reverse that? the answer is you don't because the data simply doesn't exist anymore and there is no way to tell if a number is what it was before or shifted over because of it not existing during the transform.
jonnyawsom3
2025-04-18 10:29:21
Even the current implementation tints my images pink in Irfanview, enough that I noticed immediately with color management enabled but not working perfectly
username
2025-04-18 10:30:20
afaik XYB JPEG is done with RGB instead of YCbCr to avoid a double lossy color transform
Demiurge
username I don't think that's how that works (with my understanding at least). imagine the random assortment of numbers below is a palette of colors or something: ``` 2 6 1 x 8 5 x 0 ``` now imagine that the numbers with "x" don't exist anymore after a lossy color transform and are simply changed into nearby existing numbers. alright well now how do you reverse that? the answer is you don't because the data simply doesn't exist anymore and there is no way to tell if a number is what it was before or shifted over because of it not existing during the transform.
2025-04-18 10:31:04
Yeah I heard that the JPEG color transform itself is lossy but it can also be done at whatever precision you want I think? And it's better quality than webp's transform
2025-04-18 10:31:53
The worst thing that will happen is banding
2025-04-18 10:32:57
Maybe theoretically using an app14 RGB JPEG that disables the color transform entirely could give you less banding and better color
2025-04-18 10:33:40
By avoiding the rounding errors in the color transform of the decoder by disabling the transform completely with the app14 marker
jonnyawsom3
2025-04-18 10:33:46
RGB works fine, XYB causes CDNs to incorrectly subsample Luma when using JPEG or WebP, so YXB should be used ideally.
2025-04-18 10:35:12
I can't recall the conditions required for jpegli's high bitdepth, but it may need RGB to avoid the transform but still use the 12 bit DCTs(?)
Demiurge
username afaik XYB JPEG is done with RGB instead of YCbCr to avoid a double lossy color transform
2025-04-18 10:36:42
There would only be 1 color transform. The one in the decoder. The encoder would store XYB data in the channels meant for YCbCr and use a color profile to correct the difference between a reverse-YCbCr and a reverse-YBX
2025-04-18 10:37:22
I guess that is 2...
2025-04-18 10:37:42
1 by the jpeg decoder and 1 by the color management engine
2025-04-18 10:38:06
So yeah you're right... RGB JPEG is better for that reason...
2025-04-18 10:38:49
Assuming low-precision, 8-bit JPEG decoding
2025-04-18 10:40:07
If it's using RGB/XYB then it should never use chroma subsampling.
2025-04-18 10:40:12
Just my hot take
2025-04-18 10:41:34
Even if you ask for it, it should refuse. It's a bad idea. Compatibility mess. Not just for cjxl, but also some decoders might assume chroma subsampling = YCbCr
jonnyawsom3
2025-04-18 10:45:49
I remember Jon saying something along the lines of > Chroma Subsampling is a sledgehammer when you should be using a scalpel
damian101
2025-04-18 04:21:34
decode speed improvement with chroma subsampling is nice
_wb_
2025-04-18 04:22:56
sure, and so is the speed improvement with downsampling the entire image 🙂
damian101
2025-04-18 04:24:08
chroma subsampling is perceptually almost free on most content
_wb_
2025-04-18 04:25:12
sure — except when it isn't
damian101
2025-04-18 04:26:26
Downscaling in linear light for the subsampled chroma planes gets you half-way there at least. But almost nothing does that...
Demiurge
2025-04-18 06:26:54
So then I humbly suggest that XYB JPEG should never be chroma subsampled since RGB JPEG is traditionally never doing that and it even totally precludes lossless JPEG transcode...
2025-04-18 06:27:12
Even when explicitly requesting both at once it should refuse...
gb82
decode speed improvement with chroma subsampling is nice
2025-04-18 11:31:30
not important to consider for JPEG imo. plus, you really do lose fidelity near the high end, this is testable
Traneptora
But as Quack said, shouldn't Gamma 2.2 be essentially the same as sRGB?
2025-04-19 04:04:35
no, gamma45 and sRGB are not the same, notably in the smaller end of the curve
jonnyawsom3
2025-04-19 04:06:05
Oxipng actually strips the gamma with `-s`, which is only meant to strip chunks that don't impact rendering
Traneptora
2025-04-19 04:06:49
umbrielpng strips `gAMA` and `cHRM` but only if `sRGB`, `cICP`, or `iCCP` are present
2025-04-19 04:07:03
if none of those three are present, it leaves the fallback ones intact
Oxipng actually strips the gamma with `-s`, which is only meant to strip chunks that don't impact rendering
2025-04-19 04:07:28
you want to strip all non-color metadata, my tool umbrielpng does that well
2025-04-19 04:08:10
it leaves critical chunks, color data chunks (except as mentioned above), animation chunks like fcTL and fdAT, and tRNS, and hIST if it's necessary
2025-04-19 04:08:13
and strips all the others
2025-04-19 04:08:57
sBIT is stripped if it's maximal
2025-04-19 04:09:17
it doesn't decompress IDAT so there's no re-zlibbing
2025-04-19 04:09:22
you may need to use another tool for that
2025-04-19 04:09:37
https://github.com/Traneptora/umbrielpng/blob/main/umbrielpng.c
A homosapien
2025-04-19 04:10:31
Oxipng my beloved
Traneptora
2025-04-19 04:10:58
umbrielpng is not a PNG optimizer, it's a PNG viewer that has the ability to strip unnecessary chunks
Quackdoc
Traneptora no, gamma45 and sRGB are not the same, notably in the smaller end of the curve
2025-04-19 04:11:01
is there a specific message in spec that specifies the behavior sRGB? as far as I can tell it's left ambiguous
Traneptora
Quackdoc is there a specific message in spec that specifies the behavior sRGB? as far as I can tell it's left ambiguous
2025-04-19 04:11:51
a citation of IEC 61966-2-1
Quackdoc
2025-04-19 04:12:57
ah I see, indeed then
2025-04-19 04:13:02
~~god I hate color~~
Traneptora
Quackdoc is there a specific message in spec that specifies the behavior sRGB? as far as I can tell it's left ambiguous
2025-04-19 04:14:39
the spec also cites H.273 though, which is actually free
2025-04-19 04:15:11
for cICP it cites H.273, which can be found: https://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-H.273-202407-I!!PDF-E&type=items
2025-04-19 04:15:31
H.273 cites this formula
2025-04-19 04:15:55
for Lc normalized between 0 and 1
Quackdoc
2025-04-19 04:15:58
I will never not hate that `IEC 61966-2-1 sRGB` and `reference sRGB` are not the same thing
Traneptora
2025-04-19 04:16:32
in either case, gamma45 is H.273 TRC 4
2025-04-19 04:16:37
and sRGB is H.273 TRC 13
2025-04-19 04:16:41
they do have different formulas
2025-04-19 04:17:03
the problem is a lot of software treats them as the same
2025-04-19 04:17:19
because a lot of old PNGs would write gamma45 fallback chunks without sRGB chunks when they really wanted sRGB
2025-04-19 04:17:44
so as a result, a lot of software started interpreting gamma45 as though it were sRGB, assuming that's what the authoring software intended
jonnyawsom3
2025-04-19 04:17:51
Like we encountered the other day
Traneptora
2025-04-19 04:17:58
imagemagick does this too
2025-04-19 04:18:10
libjxl just treats the files as correct
2025-04-19 04:18:27
it doesn't make any attempt to assume what the encoder probably meant, and instead just reads what the file says
2025-04-19 04:18:34
which IMO nowadays is correct behavior
Quackdoc
2025-04-19 04:18:41
to be fair, a lot of authors probably have no clue wtf they meant [av1_dogelol](https://cdn.discordapp.com/emojis/867794291652558888.webp?size=48&name=av1_dogelol)
Traneptora
2025-04-19 04:18:46
I ran into this issue with the conformance sample lz77_flower
2025-04-19 04:18:52
it's tagged gamma45
2025-04-19 04:19:14
with uses_original_profile = true
2025-04-19 04:19:19
so libjxl decodes it to a gamma45 PNG
2025-04-19 04:20:01
jxlatte (at least at the time) would not write PNGs that are not sRGB or PQ, so it will transform it into sRGB before writing the PNG out
Quackdoc
2025-04-19 04:21:02
I need an AI that will tell me if an image should be decoded with gamma2.2 or inverse oetf lmao
_wb_
Traneptora it doesn't make any attempt to assume what the encoder probably meant, and instead just reads what the file says
2025-04-19 08:04:22
Making such assumptions is a kind of paternalistic behavior in software that I think should be avoided. It is better to be literal and assume that everything is what it says it is, rather than trying to correct common mistakes automatically, which only introduces ambiguity and inconsistency.
2025-04-19 08:06:45
If you have a PNG file with only a gamma chunk, and you are expecting it to be interpreted as sRGB, then you should fix the PNG file by stripping the gamma chunk, not by making viewers ignore it.
Traneptora
2025-04-19 08:07:47
Speaking of weird gamma, I have some PNGs with an iccp that is being read by libjxl and converted to an enum space
2025-04-19 08:09:02
it's got EBU primaries and gamma 0.53 I think
2025-04-19 08:09:08
does that ring a bell?
2025-04-19 08:09:24
does this space have a name?
2025-04-19 08:10:11
something like 1/1.9 gamma
_wb_
2025-04-19 08:28:42
Maybe this one? http://www.eci.org/doku.php?id=en:colourstandards:workingcolorspaces
2025-04-19 08:30:15
I have seen that one used in the wild by one of our customers, I don't remember which one but I think they were from Germany
Traneptora
2025-04-19 09:13:58
``` Custom primaries: red(x=0.630003,y=0.339989), green(x=0.295044,y=0.604926), blue(x=0.154992,y=0.076980)gamma(0.555315) ```
2025-04-19 09:14:02
these are the exact values
_wb_ Maybe this one? http://www.eci.org/doku.php?id=en:colourstandards:workingcolorspaces
2025-04-19 09:14:59
2025-04-19 09:15:06
idk if this is the same one
2025-04-19 09:18:40
> Copyright 2007 Apple Inc., all rights reserved.
2025-04-19 09:18:44
this is the cptr tag
2025-04-19 09:19:26
this is what we get from ffmpeg
2025-04-19 09:19:28
``` [libjxl @ 0x63f632f13600] Unsupported gamma transfer: 0.555315 [libjxl @ 0x63f632f13600] Falling back on iec61966-2-1/sRGB transfer Input #0, jpegxl_pipe, from 'test.jxl': Duration: N/A, bitrate: N/A Stream #0:0: Video: jpegxl (libjxl), rgb24(pc, gbr/ebu3213/iec61966-2-1), 600x450, 25 fps, 25 tbr, 25 tbn ```
monad
2025-04-20 02:39:38
```images Mpx (mean) colors/px (mean) | share | share colors (mean) tag 489 100.00% 0.41 100.00% 44049 0.11 all 32 6.54% 0.25 3.95% 15063 0.06 albedo 27 5.52% 0.79 10.58% 67442 0.07 algorithmic 31 6.34% 0.70 10.71% 85620 0.11 digital_painting 56 11.45% 0.21 5.90% 27049 0.13 logo 49 10.02% 0.44 10.60% 53513 0.15 lossy 34 6.95% 0.30 4.99% 49998 0.20 normal 68 13.91% 0.50 16.97% 74106 0.16 photo 71 14.52% 0.19 6.58% 475 0.00 pixel_art 68 13.91% 0.30 9.98% 33012 0.13 texture 28 5.73% 0.57 7.82% 32444 0.05 ui 37 7.57% 0.67 12.19% 86602 0.13 watermark 118 24.13% 0.44 25.91% 58164 0.17 content_other unique mins Mpx/s real (mean) B bpp (mean) mins | Mpx/s CPU (mean) best of 84881853 3.2853109 100.00% ···· 0.00209219644 0.0055602251 all 84891279 3.2858903 97.34% 97.34% 0.0088010715 0.0087908659 paq8px_208fix1_12 100551374 3.9033083 1.84% 1.84% 0.00344114548 0.020874815 cjxl_0.11.0_d0e11 107694944 4.1801616 ····· ···· 0.1798265 0.1943867 cjxl_0.11.0_d0e10 115760718 4.4603495 0.82% 0.82% 0.2861193 0.495180 cwebp_1.3.2_z9mt``` paq8px compressing PAM, others converting from stripped PNG
2025-04-20 02:46:15
```images Mpx (mean) colors/px (mean) | share | share colors (mean) tag 19 100.00% 0.93 100.00% 95825 0.10 algorithmic 19 100.00% 0.93 100.00% 95825 0.10 jxl_art bpp (mean) unique mins Mpx/s real (mean) B | mins | Mpx/s CPU (mean) best of 2599676 1.103348 100.00% ···· 0.0019206458 0.005364068 all 2602292 1.104399 68.42% 68.42% 0.009261715 0.009258667 paq8px_208fix1_12 3495219 1.528870 31.58% 31.58% 0.0038084687 0.02133666 cjxl_0.11.0_d0e11 4283113 1.866336 ····· ···· 0.149306 0.168312 cjxl_0.11.0_d0e10 6155918 2.646459 ····· ···· 0.56353 0.99170 cwebp_1.3.2_z9mt```
𝕰𝖒𝖗𝖊
2025-04-20 08:05:06
**Base command:** ``` cjpegli -p "2" --xyb ``` - **Source:** `134.5 MP (13385x10264)` - **Filesize:** `101 MB` - **Camera:** `Phase One IQ4` - **Link to source:** https://flic.kr/p/2kXUoje
2025-04-20 08:06:45
<@238552565619359744> 444 and not specified are close to each other but still, there is a difference
2025-04-20 08:07:23
It's interesting how early the scores flatlined.
2025-04-20 08:07:45
This test took some time...
jonnyawsom3
2025-04-20 08:13:25
Hmm, I have *yet another* datapoint you could add for the high quality range, disabling adaptive quantization https://discord.com/channels/794206087879852103/1301682361502531594
2025-04-20 08:13:43
Probably only run that with 444 to save time
𝕰𝖒𝖗𝖊
2025-04-20 08:14:53
Interesting. Some options are not documented?
2025-04-20 08:15:02
`--xyb` is one of them.
2025-04-20 08:15:13
First, I thought Google's implementation doesn't have that but it does.
2025-04-20 09:07:25
<@238552565619359744>
2025-04-20 09:07:41
both 444 xyb
jonnyawsom3
𝕰𝖒𝖗𝖊 Interesting. Some options are not documented?
2025-04-20 09:15:57
Just like `cjxl`, `cjpegli` also has `-h -v -v`
2025-04-20 09:17:02
Interesting, I guess the AQ issue is only for YCbCr
Orum
𝕰𝖒𝖗𝖊 It's interesting how early the scores flatlined.
2025-04-20 01:36:29
"Tonight, on *'Graphs that need a logarithmic X axis...'*"
jonnyawsom3
username it would be nice to still have a way to enable/set the blue channel subsampling because afaik there is no option for it otherwise. I mean if what you are proposing with YBX comes true then it probably won't be relevant anymore but unless/until that happens I don't think the option for blue channel subsampling should be removed entirely.
2025-04-20 02:32:47
I (think I) just added that now, but now I'm thinking... Why does it only subsample blue? Not X along with B?
2025-04-20 02:53:58
It's messy, but <@207980494892040194> can help us test and tweak it later <https://github.com/jonnyawsom3/jpegli/tree/jpegliSubsampling>
username
It's messy, but <@207980494892040194> can help us test and tweak it later <https://github.com/jonnyawsom3/jpegli/tree/jpegliSubsampling>
2025-04-20 05:13:16
copy paste error?
jonnyawsom3
2025-04-20 05:16:27
Fixed
username it would be nice to still have a way to enable/set the blue channel subsampling because afaik there is no option for it otherwise. I mean if what you are proposing with YBX comes true then it probably won't be relevant anymore but unless/until that happens I don't think the option for blue channel subsampling should be removed entirely.
2025-04-21 08:24:29
Tried it a bit ago, it was between 0.03 and 0.05 bpp smaller, so not really worth it for sacrificing the 20% transcoding
2025-04-21 08:25:24
That was 444, 440, 422 and 420
2025-04-21 08:25:43
Might be better if X was subsampled too, but it doesn't seem worth it at all
2025-04-22 08:23:03
<@179701849576833024> didn't you have a threadripper or an EPYC server that you used to test chunked encoding?
veluca
2025-04-22 08:23:21
I do have a threadripper yes
jonnyawsom3
2025-04-22 08:25:24
We got chunked working for progressive lossless, but me and <@207980494892040194> only have 8 core CPUs, so we can't see how far it scales. Don't suppose you'd like to help us make the most lobsided bar chart ever? xD
2025-04-22 08:27:02
Could actually test our faster decoding tweaks too, since it seems hardware dependant
A homosapien
2025-04-22 08:27:46
Actually I only have 6-core CPUs
jonnyawsom3
2025-04-22 08:28:17
And mine is an 8 year old 8 core
2025-04-22 08:29:54
So good to know our changes work in less than ideal conditions, especially since most of it is about threading
In [my fork](<https://github.com/jonnyawsom3/jpegli>) I've set XYB to 444 unless overridden with the flag. Maybe <@604964375924834314> (sorry for another ping) could help me change it from XYB to YBX, then the normal subsampling flags would work correctly and unmanaged viewers wouldn't be bright pink and green (But still tinted)
2025-04-22 09:26:19
I just realised I'm a fool. XYB is stored in RGB JPEG, so there *is* no YCbCr to take advantage of. This is the best it can look while being stored as RGB
damian101
2025-04-22 10:54:19
Chroma subsampling should be possible for XYB...
CrushedAsian255
2025-04-23 01:50:06
I always thought it would make more sense as YXB as why is your luma channel not the first one?
_wb_
2025-04-23 05:43:08
It usually is the first one in most of the signalling.
2025-04-23 05:43:55
I think it was called XYB just to sound more like XYZ
CrushedAsian255
_wb_ I think it was called XYB just to sound more like XYZ
2025-04-23 07:28:28
Ah so it’s just naming conventions?
_wb_
2025-04-23 07:29:22
well it is a bit messy, in jxl sometimes the component order is XYB and sometimes it is YXB
CrushedAsian255
_wb_ well it is a bit messy, in jxl sometimes the component order is XYB and sometimes it is YXB
2025-04-23 07:49:47
Probably should have just been defined as YXB
damian101
CrushedAsian255 Ah so it’s just naming conventions?
2025-04-23 11:13:31
XYZ is another colorspace. Very old iirc, from analog times, but still used as an intermediary reference colorspace for a lot of conversion.
CrushedAsian255
XYZ is another colorspace. Very old iirc, from analog times, but still used as an intermediary reference colorspace for a lot of conversion.
2025-04-23 11:14:02
is it at least good?
Quackdoc
2025-04-23 11:14:51
it's the reference pretty much
damian101
CrushedAsian255 is it at least good?
2025-04-23 11:16:17
Well, good for what 😅 It is actually used for some lossy encoding, in Digital Cinema for example, so I'm quite certain it isolates luminance (to Y, I strongly assume) like all the other colorspaces that are used to perform lossy encoding in.
Quackdoc
2025-04-23 11:16:20
XYZ typically (but not always) refers to CIE XYZ, which is the typical human visible range of color
damian101
2025-04-23 11:17:20
Yeah, it supposedly defines all visible colors...
CrushedAsian255
2025-04-23 11:18:55
why wouldn't everything use it then?
Quackdoc
2025-04-23 11:19:11
because it's inefficient
2025-04-23 11:20:15
also, XYZ is best reffered to as a color model, as its not the same thing as a colorspace
2025-04-23 11:20:57
color space is a bit overloaded here.
damian101
CrushedAsian255 why wouldn't everything use it then?
2025-04-23 11:21:39
1. Probably not very perceptually uniform, so encoding it is is not as efficient as it can be. 2. The simple YCbCr colorspaces are the only ones widely supported, really. One reason for that is because the math to and from RGB is so simple.
2025-04-23 11:24:06
The only reason JXL can actually always use XYB is because it's used internally, part of the spec and the decoder.
Quackdoc
2025-04-23 11:25:35
there are a myriad of other reasons like it simply being expensive to compute
damian101
2025-04-23 11:27:05
sure
2025-04-23 11:27:24
that's a reason why YCbCr still rules, as I mentioned...
Quackdoc
2025-04-23 11:28:35
indeed. in the end, it's a good color model/space to be aware of, but it's not exactly the most useful out of scientific uses or using as an inbetween
2025-04-23 11:29:55
xyY is a bit more useful since it splits chromaticity from luminance but other then that, also not super useful
damian101
Quackdoc xyY is a bit more useful since it splits chromaticity from luminance but other then that, also not super useful
2025-04-23 11:31:36
doesn't XYZ do that?
2025-04-23 11:31:53
or do you mean it does it more perfectly
Quackdoc
2025-04-23 11:35:21
no, XYZ is additive, chromaticity is based on luminance, one sec there is a good PDF describing this
2025-04-23 11:38:48
https://graphics.stanford.edu/courses/cs148-10-summer/docs/2010--kerr--cie_xyz.pdf
dogelition
Quackdoc XYZ typically (but not always) refers to CIE XYZ, which is the typical human visible range of color
2025-04-23 11:54:34
not quite, it's basically a linear combination of the LMS sensitivity curves of the human eye. but not all XYZ/LMS triples correspond to real colors, since the curves overlap (so e.g. you can't activate only the Y/M sensor with real light)
2025-04-23 11:55:51
you get the chromaticity diagram of all colors humans can see by iterating over all wavelengths, seeing what XYZ values those result in, converting that to xy (chromaticity only) and then drawing that as a 2d shape
Quackdoc also, XYZ is best reffered to as a color model, as its not the same thing as a colorspace
2025-04-23 12:00:29
why would it not be a color space?
CrushedAsian255
dogelition not quite, it's basically a linear combination of the LMS sensitivity curves of the human eye. but not all XYZ/LMS triples correspond to real colors, since the curves overlap (so e.g. you can't activate only the Y/M sensor with real light)
2025-04-23 12:06:23
What happens if you try converting the impossible colours into other colourspace and display them
dogelition
2025-04-23 12:06:51
if you convert them to color space with real primaries you get negative values
2025-04-23 12:07:12
e.g. same thing as converting bt.2020 colors to bt.709, mathematically it works out fine but for colors that don't exist in bt.709 you end up with negative values
Lumen
2025-04-23 12:09:07
oh so that is why I notice negative values coming to my vapoursynth filter sometimes
2025-04-23 12:09:36
I once found a -0.8 and of course my inverse transfer function wasnt built to support that so it created issues ahah
dogelition
2025-04-23 12:10:29
yep, you do run into issues when you use a transfer function, but as long as you stay within linear xyz/rgb values everything is fine
Lumen
2025-04-23 12:12:54
I am impressed by the fact that CPUs are so slow to process images typically, doing RGB to XYB seem so fast to me
CrushedAsian255
2025-04-23 12:13:07
How SIMDable is it
Lumen
2025-04-23 12:13:14
or the fact that SSIMU2 is only 6 gaussian blurs and yet it manages to be only 20 fps
Quackdoc
dogelition why would it not be a color space?
2025-04-23 12:13:23
as I said, colorspace here is an overloaded word, as a colorspace more commonly refers to the "gamut, transfer, whitepoint" which doesn't *really* apply to XYZ.
Lumen
CrushedAsian255 How SIMDable is it
2025-04-23 12:13:26
well it's pixel by pixel
2025-04-23 12:13:39
so it is basically << 1ms on my gpu
2025-04-23 12:13:55
need to check again my traces but probably around 330 microseconds
Quackdoc
2025-04-23 12:13:56
while it is a color space by one definiton, it isnt by another
dogelition not quite, it's basically a linear combination of the LMS sensitivity curves of the human eye. but not all XYZ/LMS triples correspond to real colors, since the curves overlap (so e.g. you can't activate only the Y/M sensor with real light)
2025-04-23 12:15:06
indeed, and this is part of why xyY exists, but that's not super duper relevant to the point at hand, the major point is "it's made to encompass the typical human visible spectrum"
Lumen I am impressed by the fact that CPUs are so slow to process images typically, doing RGB to XYB seem so fast to me
2025-04-23 12:16:20
Indeed, without optimization, cpu processing sucks. gpus are just really fast if loops [av1_dogelol](https://cdn.discordapp.com/emojis/867794291652558888.webp?size=48&name=av1_dogelol)
dogelition
Quackdoc as I said, colorspace here is an overloaded word, as a colorspace more commonly refers to the "gamut, transfer, whitepoint" which doesn't *really* apply to XYZ.
2025-04-23 12:16:51
idk, i think the only reason you could say it doesn't apply is because "white" doesn't make sense there, but alternatively and equivalently you can define a color space as primaries (in XYZ) + a transfer function
2025-04-23 12:17:20
and it doesn't differ from other linear color spaces in that sense, other than the fact that it just "happens" to have (1,0,0), (0,1,0), (0,0,1) as the primaries
Lumen
2025-04-23 12:17:33
it would be very cool to have CPUs and GPUs working closer together and not have this insane communication problem between them this is sort of what AVX tries to achieve but it is not great at it and greatly affected by low memory bandwidth
Quackdoc
2025-04-23 12:17:45
yeah, you can use XYZ to make a colorspace in that definition, but in isolation it wouldn't. in general I just hate overloaded terms
Lumen it would be very cool to have CPUs and GPUs working closer together and not have this insane communication problem between them this is sort of what AVX tries to achieve but it is not great at it and greatly affected by low memory bandwidth
2025-04-23 12:17:53
apu says hellp
2025-04-23 12:18:05
AMD actually had an SDK for this at one point but it is long gone afaik
Lumen
2025-04-23 12:18:07
yep, APUs seem cool
2025-04-23 12:18:54
in big server compute chips, we are starting to see CPU X GPU merges in great way
2025-04-23 12:18:58
like gracehopper chips
2025-04-23 12:19:20
way more powerful than APUs
Quackdoc
2025-04-23 12:19:26
I mean, riscv with RVV is practically that
2025-04-23 12:19:59
I do know people are actually working on fully fledged vulkan capable gpus using riscv
CrushedAsian255
Lumen it would be very cool to have CPUs and GPUs working closer together and not have this insane communication problem between them this is sort of what AVX tries to achieve but it is not great at it and greatly affected by low memory bandwidth
2025-04-23 12:22:21
Apple silicon?
Lumen
CrushedAsian255 Apple silicon?
2025-04-23 12:22:54
not fast enough
CrushedAsian255
2025-04-23 12:22:59
Or more like PS2 EE and PS3 CELL?
Quackdoc
2025-04-23 12:24:34
in the end, shared memory can only go so far, you need the actual programming APIs to properly share resources
CrushedAsian255
Lumen yep, APUs seem cool
2025-04-23 12:25:21
Auxiliary power unit?
_wb_
2025-04-23 01:10:26
Usually "color model" is used to mean "family of color spaces", e.g. RGB and CMYK are two different color models but they both can mean many things, i.e. contain many color spaces. The only thing that is fixed really is the vague meaning of the components. A "color space" is something with an exact colorimetric interpretation, e.g. sRGB or Rec.2100PQ, or U.S. Web Coated SWOP v2. XYB, CIE XYZ, CIE Lab: these are color models and also color spaces. RGB, CMYK, LMS: color models but not by themselves a color space (you need to be more specific and define more stuff to define a color space). YCbCr, YCoCg, HSV/HSB/HSL: these are color transforms that can be applied relative to any RGB color space (or even to CMYK color spaces)
jonnyawsom3
Chroma subsampling should be possible for XYB...
2025-04-23 01:44:55
It is, and I re-implemented it. cjpegli subsamples the B channel by default, but specifying 420, ect would subample Y due to it being the second channel in XYB. I fixed that in my fork, but I'll try subsampling X too, since single channel subsampling isn't doing much for density. jpegli used XYB instead of YBX because the internal RGB maps best to XYB R = Green - Magenta G = Luminance B = Blue - Yellow And the others explained why YCbCr XYB is a bad idea
Lumen
2025-04-23 01:51:18
I thought you were always supposed to downscale in linear RGB and then rechange color space so how would you do you do XYB -> -Y- |-> linRGB -> downsapled lin RGB -> X-B then you assemble the planes?
damian101
Lumen I thought you were always supposed to downscale in linear RGB and then rechange color space so how would you do you do XYB -> -Y- |-> linRGB -> downsapled lin RGB -> X-B then you assemble the planes?
2025-04-23 02:05:42
That's ideal, yes.
Quackdoc
It is, and I re-implemented it. cjpegli subsamples the B channel by default, but specifying 420, ect would subample Y due to it being the second channel in XYB. I fixed that in my fork, but I'll try subsampling X too, since single channel subsampling isn't doing much for density. jpegli used XYB instead of YBX because the internal RGB maps best to XYB R = Green - Magenta G = Luminance B = Blue - Yellow And the others explained why YCbCr XYB is a bad idea
2025-04-23 02:08:40
rgb565 mfs living it up rn
jonnyawsom3
2025-04-23 02:10:45
Considering how harshly B gets crunched, it might as well be XYB682
spider-mario
Quackdoc XYZ typically (but not always) refers to CIE XYZ, which is the typical human visible range of color
2025-04-23 02:28:41
what else than CIE XYZ can it refer to?
Quackdoc
2025-04-23 02:32:42
~~heretics~~ people sometimes apply arbitrary transforms and stuff onto it like transfers, gamut limitations and other weird things
spider-mario
2025-04-23 02:42:41
urk
CrushedAsian255
_wb_ Usually "color model" is used to mean "family of color spaces", e.g. RGB and CMYK are two different color models but they both can mean many things, i.e. contain many color spaces. The only thing that is fixed really is the vague meaning of the components. A "color space" is something with an exact colorimetric interpretation, e.g. sRGB or Rec.2100PQ, or U.S. Web Coated SWOP v2. XYB, CIE XYZ, CIE Lab: these are color models and also color spaces. RGB, CMYK, LMS: color models but not by themselves a color space (you need to be more specific and define more stuff to define a color space). YCbCr, YCoCg, HSV/HSB/HSL: these are color transforms that can be applied relative to any RGB color space (or even to CMYK color spaces)
2025-04-23 02:51:15
Ah so colour model is more like the philosophy and the space is the specific numerical values used?
Meow
2025-04-23 03:06:28
```byte sec command ---- 15,322,826 0.308 oxipng -a -f 0 --zc 1 ---- 10,070,544 0.321 qoi 8,256,669 6.875 oxipng -o 4 7,352,613 0.173 cjxl -d 0 -e 1 6,242,268 37.836 cwebp -lossless -m 6 -q 100 5,570,090 2.190 cjxl -d 0 5,323,164 311.01 cjxl -d 0 -e 10 -E 4 -I 100 -g 3```
dogelition
2025-04-23 03:08:15
isn't CIE XYZ really just an RGB color space? i don't see how it's fundamentally different from any other RGB color space with linear transfer function and imaginary primaries
spider-mario
2025-04-23 03:18:05
pretty much
2025-04-23 03:18:18
it’s similar to the older CIE RGB but the matching functions have only positive values
2025-04-23 03:19:02
well, not that much older apparently (same year)
2025-04-23 03:19:23
https://commons.wikimedia.org/wiki/File:CIE1931_RGBCMF2.png CIE RGB’s matching functions, vs XYZ’s: https://commons.wikimedia.org/wiki/File:CIE_1931_XYZ_Color_Matching_Functions.svg
2025-04-23 03:21:55
if you take a vertical line and run it from one end to the other, the triplets you encounter form the spectral locus in the chromaticity diagram (the curved part of the outline https://commons.wikimedia.org/wiki/File:PlanckianLocus.png)
2025-04-23 03:23:30
https://ars.els-cdn.com/content/image/3-s2.0-B9781845699727500011-f01-04-9781845699727.jpg
2025-04-23 03:23:32
nice illustration
Meow
Meow ```byte sec command ---- 15,322,826 0.308 oxipng -a -f 0 --zc 1 ---- 10,070,544 0.321 qoi 8,256,669 6.875 oxipng -o 4 7,352,613 0.173 cjxl -d 0 -e 1 6,242,268 37.836 cwebp -lossless -m 6 -q 100 5,570,090 2.190 cjxl -d 0 5,323,164 311.01 cjxl -d 0 -e 10 -E 4 -I 100 -g 3```
2025-04-24 06:13:34
JXL works pretty good on this image
jonnyawsom3
veluca I do have a threadripper yes
2025-04-25 08:53:21
When you have some time, would you mind trying `cjxl -d 0 -p` with this PR on a large image and comparing it to main? We're assuming a near linear speed increase with thread count, but it'd be nice to confirm it https://github.com/libjxl/libjxl/actions/runs/14654098262
RaveSteel
2025-04-25 09:09:07
Much faster on my 7950x ``` main $ time cjxl -d 0 -p OpenTTD_16K.png OpenTTD_16K_main.jxl JPEG XL encoder v0.11.1 794a5dcf [AVX2,SSE4,SSE2] Encoding [Modular, lossless, effort: 7] Compressed to 52390.6 kB (3.158 bpp). 15360 x 8640, 2.924 MP/s [2.92, 2.92], , 1 reps, 32 threads. real 0m46,823s user 1m3,303s sys 0m5,618s ------------------- PR time cjxl -d 0 -p OpenTTD_16K.png OpenTTD_16K_pr.jxl JPEG XL encoder v0.12.0 2695d26 [_AVX2_,SSE4,SSE2] Encoding [Modular, lossless, effort: 7] Compressed to 24022.1 kB (1.448 bpp). 15360 x 8640, 8.916 MP/s [8.92, 8.92], , 1 reps, 32 threads. real 0m16,344s user 0m54,789s sys 0m5,524s ``` PR cjxl also improves the loading times ``` [Loader::qt] OpenTTD_16K_main.jxl "image/jxl" QImage::Format_RGBX64 "sRGB" transform:none 1279ms [Loader::qt] OpenTTD_16K_pr.jxl "image/jxl" QImage::Format_RGBX64 "sRGB" transform:none 595ms ```
2025-04-25 09:10:44
The "Compressed to 52390.6 kB (3.158 bpp)" for your version is incorrect btw, the image is only 23M large
2025-04-25 09:12:35
Which may actually be the reason why the loading times are improved
jonnyawsom3
RaveSteel The "Compressed to 52390.6 kB (3.158 bpp)" for your version is incorrect btw, the image is only 23M large
2025-04-25 09:18:35
Yeah I... Don't know what happened there. The readout is correct for us and is around half the size of main too
2025-04-25 09:19:17
Looks like your terminal is duplicating the output for some reason?
RaveSteel
2025-04-25 09:21:09
Ah, it may be due to a crash I've had before pasting this
2025-04-25 09:21:17
RAM ran out lol
2025-04-25 09:21:39
So safe to disregard I guess
2025-04-25 09:26:23
I corrected my post with the values from a rerun
jonnyawsom3
2025-04-25 09:27:50
3x faster and 2x smaller, nice
RaveSteel
2025-04-25 09:28:10
I wonder how it scales with veluca's Threadripper
jonnyawsom3
2025-04-25 09:28:31
We did try reducing memory usage too, but it completely broke the compression
A homosapien
2025-04-25 09:30:54
Maybe in a future PR
RaveSteel
2025-04-25 09:40:30
Memory usage was about the same as main, so nothing to complain about in my book
2025-04-25 09:43:01
Your build is also around 0.5 seconds faster in non-progressive, so 3.5 seconds instead of 4 seconds
Traneptora
RaveSteel The "Compressed to 52390.6 kB (3.158 bpp)" for your version is incorrect btw, the image is only 23M large
2025-04-25 11:32:08
compare via ssimulacra2 or someth
2025-04-25 11:32:28
my experience is a DRASTIC change in file size is more often than not just a bug
RaveSteel
2025-04-25 11:32:54
They were the same, it was an error on my part, I had tried my hand at a very large image and crashed. So just an error copy pasting by me
Traneptora
2025-04-25 11:33:13
well a crash would make it smaller <:KEK:1283989161111715913>
RaveSteel
2025-04-25 11:33:19
xd
Traneptora
RaveSteel Much faster on my 7950x ``` main $ time cjxl -d 0 -p OpenTTD_16K.png OpenTTD_16K_main.jxl JPEG XL encoder v0.11.1 794a5dcf [AVX2,SSE4,SSE2] Encoding [Modular, lossless, effort: 7] Compressed to 52390.6 kB (3.158 bpp). 15360 x 8640, 2.924 MP/s [2.92, 2.92], , 1 reps, 32 threads. real 0m46,823s user 1m3,303s sys 0m5,618s ------------------- PR time cjxl -d 0 -p OpenTTD_16K.png OpenTTD_16K_pr.jxl JPEG XL encoder v0.12.0 2695d26 [_AVX2_,SSE4,SSE2] Encoding [Modular, lossless, effort: 7] Compressed to 24022.1 kB (1.448 bpp). 15360 x 8640, 8.916 MP/s [8.92, 8.92], , 1 reps, 32 threads. real 0m16,344s user 0m54,789s sys 0m5,524s ``` PR cjxl also improves the loading times ``` [Loader::qt] OpenTTD_16K_main.jxl "image/jxl" QImage::Format_RGBX64 "sRGB" transform:none 1279ms [Loader::qt] OpenTTD_16K_pr.jxl "image/jxl" QImage::Format_RGBX64 "sRGB" transform:none 595ms ```
2025-04-25 11:34:19
Is this an AMD cpu?
RaveSteel
2025-04-25 11:34:22
Yes
2025-04-25 11:34:28
16 cores 32 threads
Traneptora
2025-04-25 11:34:38
Would you do me a solid and test Hydrium?
2025-04-25 11:34:45
I only have Intel
RaveSteel
2025-04-25 11:34:50
sure
Traneptora
2025-04-25 11:35:12
it's lossy ofc
2025-04-25 11:35:30
but im just curious the single threaded perf
RaveSteel
2025-04-25 11:35:41
Should I compile or just download latest?
Traneptora
2025-04-25 11:35:49
compile
2025-04-25 11:36:02
no published since some changes
2025-04-25 11:36:15
Considering creating a way to allow hydrium to multithread
2025-04-25 11:36:56
currently the library is not thread-safe wrt the same encoder instance. (it's stateless so it's thread safe in that regard)
RaveSteel
2025-04-25 11:39:20
It's compiled now, but how do I actually use this? I have no binary after building. I assume this is an error on my part
2025-04-25 11:39:48
Ah, nvm, I forgot to run ninja
Traneptora
2025-04-25 11:40:09
you may also want to configure with -Dbuildtype=release
2025-04-25 11:40:27
compiler opts matter a lot
2025-04-25 11:40:32
particularly automatic fma
RaveSteel
2025-04-25 11:41:11
Where do I put this flag? into meson.build?
Traneptora
2025-04-25 11:41:22
cli
2025-04-25 11:41:53
`meson setup build/ --reconfigure -Dbuildtype=release`
2025-04-25 11:42:12
`ninja -C build/`
RaveSteel
2025-04-25 11:42:16
Done
2025-04-25 11:42:25
Ok, I'll test now
Traneptora
Traneptora currently the library is not thread-safe wrt the same encoder instance. (it's stateless so it's thread safe in that regard)
2025-04-25 11:43:08
Id probably implement it so there's a subencoder struct and each tile can be sent on a separate thread which the caller must set up, and then once they send all the tiles and join all the threads they can call finalize or someth
RaveSteel
2025-04-25 11:50:02
For a 15360x8640 image it took 6,563s to encode with default settings, but this would not load in my image viewer and ate up around 6GB of RAM. Encoding with --one-frame was slightly slower, at 7,984s, but the image loaded quite fast in my image viewer. Should I try a smaller image? Or is this expected?
2025-04-25 11:50:07
Here's the image
2025-04-25 11:50:15
2025-04-25 11:51:15
Hydrium's encoded JXL was 38MB
jonnyawsom3
2025-04-25 11:54:32
OpenTTD my beloved
RaveSteel
2025-04-25 11:56:58
The encoded JXL can also not be decoded with djxl
2025-04-25 11:57:05
So something is very wrong with it
2025-04-25 11:57:16
A reencode does not fix this
monad
2025-04-26 12:03:42
actually cannot be decoded or just takes too many resources? it was known some time ago that hydrium takes major resources for decode
2025-04-26 12:04:00
but I have not kept up with it
jonnyawsom3
Traneptora my experience is a DRASTIC change in file size is more often than not just a bug
2025-04-26 12:04:34
In this case, it was fixing a bug. Progressive lossless was causing a severe issue with palette and squeeze, seemingly triggering pallete on the smallest squeeze step and causing it to double the bpp on the rest of the file. Then we also enabled YCoCg for an extra 0.6 bpp or so
monad actually cannot be decoded or just takes too many resources? it was known some time ago that hydrium takes major resources for decode
2025-04-26 12:05:18
I vaguely recall using an 8K test file and it used 12GB of memory, 16K is likely hitting a limit
RaveSteel
monad actually cannot be decoded or just takes too many resources? it was known some time ago that hydrium takes major resources for decode
2025-04-26 12:05:38
Well, could be that it takes some time, but I waited for 5 minutes and it didn't decode, so I assume it will not even if I wait longer
monad
2025-04-26 12:06:29
I think that is an incorrect assumption. it just takes an impractically long time in my experience
RaveSteel
2025-04-26 12:06:53
Could certainly be the case
Traneptora
RaveSteel For a 15360x8640 image it took 6,563s to encode with default settings, but this would not load in my image viewer and ate up around 6GB of RAM. Encoding with --one-frame was slightly slower, at 7,984s, but the image loaded quite fast in my image viewer. Should I try a smaller image? Or is this expected?
2025-04-26 12:07:53
whatbabout --tile-size=3?
2025-04-26 12:08:08
surprised one frame is slower
RaveSteel
2025-04-26 12:08:32
Maybe it's slower because the encoder fails at encoding the image?
Traneptora
2025-04-26 12:09:09
default setting hydrium encodes decode very slowly with libjxl
RaveSteel
Traneptora whatbabout --tile-size=3?
2025-04-26 12:09:47
I have encoded and will now try decoding
2025-04-26 12:10:29
Ok, this one decoded quite fast and works as expected
2025-04-26 12:10:57
Encode time was 7,075s
2025-04-26 12:11:59
Decode time in my image viewer was a whopping 24.5 seconds
2025-04-26 12:12:44
That's around 30 times higher than the 800ms it takes with libjxl
Traneptora
2025-04-26 12:21:26
interesting
2025-04-26 12:21:47
that's somewhat what I expected
2025-04-26 12:21:58
7s for a 16k image though is a bit much
2025-04-26 12:22:26
how long does it take to encode it with `cjxl -e 3 --num_threads=0`
RaveSteel
2025-04-26 12:23:46
7,155s, almost the same
jonnyawsom3
2025-04-26 12:25:37
I keep misreading it as thousands because of the comma, thinking "damn I know hydrium is slow but 2 hours seems a bit much" xD
RaveSteel
2025-04-26 12:26:30
That's due to my locale :p
2025-04-26 12:26:40
And I am too lazy to replace it every time
Traneptora
2025-04-26 12:27:18
I know what u meant so it's fine
RaveSteel 7,155s, almost the same
2025-04-26 12:27:43
ah okay. atm my tests are that it's comparable to cjxl -e 3 on a single thread
2025-04-26 12:27:48
speed-wise
2025-04-26 12:27:53
but uses considerably less memory
RaveSteel
2025-04-26 12:28:03
So around same result for time I got
Traneptora
2025-04-26 12:28:09
ye
2025-04-26 12:28:15
what happens if you wrap it in memusage
2025-04-26 12:28:34
specifically heap peak
RaveSteel
2025-04-26 12:29:17
cjxl: Memory usage summary: heap total: 13113988389, heap peak: 1889278942, stack peak: 34032 hydrium: Memory usage summary: heap total: 2709580194, heap peak: 425811326, stack peak: 4944
2025-04-26 12:30:36
Significantly less
Traneptora
2025-04-26 12:30:53
my guess is that a good fraction of that 425 MB is buffered by the frontend