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

Orum
2024-09-04 09:23:42
factorio screenshots more than anything
jonnyawsom3
2024-09-04 09:24:16
Was just sticking to things I already had installed. JXL, WebP, ZSTD, 7z
TheBigBadBoy - 𝙸𝚛
Was just sticking to things I already had installed. JXL, WebP, ZSTD, 7z
2024-09-04 09:44:39
7zip support creating xz archive <:KekDog:805390049033191445> but idk how good it is compared to official tools
A homosapien
Also, turns out using ZSTD on a PPM is the highest compression I could reach, 29.9 MB
2024-09-04 10:01:05
2024-09-04 10:01:14
For some reason compressing it as a .bmp gave the smallest results ¯\_(ツ)_/¯
2024-09-04 10:01:43
And yes you read that right, it's bzip3 not bzip2 😅
Oleksii Matiash
A homosapien
2024-09-05 06:27:41
Impressive. A bit disappointing that they limited block size to 511 MB
CrushedAsian255
2024-09-06 10:20:48
0.06 bpp JPEG XL
2024-09-06 10:20:53
2024-09-06 10:22:51
compared to AVIF @ same bpp
2024-09-06 10:22:52
2024-09-06 10:23:25
source image: <https://www.pexels.com/photo/pink-red-yellow-petaled-flower-in-close-up-shot-85773/>
DNFrozen
2024-09-06 10:25:02
is there a programm that can compress images much better than jxl at the cost of incredible high decompression times and or high ram usage?
CrushedAsian255
2024-09-06 10:25:45
high quality or low quality?
2024-09-06 10:25:53
lossless or lossy?
DNFrozen
2024-09-06 10:26:08
mmh lossless
Oleksii Matiash
2024-09-06 10:26:12
Avif is better in preserving high contrast details, jxl - in more uniform look
CrushedAsian255
2024-09-06 10:26:29
avif sucks for lossless
lonjil
2024-09-06 10:28:36
how does jpegli fare at 0.06 bpp
DNFrozen
2024-09-06 10:29:02
before i found jxl the only way to make a jpg smaller was using one of the pq8 compression programms and these have worse compression results than jxl recompression while making even effort 11 look like the flash
CrushedAsian255
2024-09-06 10:29:22
like don't bother with avif lossless
DNFrozen
2024-09-06 10:30:03
have you tried lossless webp?
RaveSteel
2024-09-06 10:30:43
lossless webp is almost always better than lossless avif from my testing
CrushedAsian255
2024-09-06 10:31:19
yep
2024-09-06 10:31:39
imagine being worse than your predecessor
DNFrozen
2024-09-06 10:31:39
i also had no idea that avif exist before joining this discord
CrushedAsian255
2024-09-06 10:31:55
where did u learn about jxl?
DNFrozen
2024-09-06 10:33:01
https://www.youtube.com/watch?v=FlWjf8asI4Y
2024-09-06 10:33:12
this video
RaveSteel
2024-09-06 10:33:36
we have had quite the influx since that video happened, may or may not be causally related
Demiurge
CrushedAsian255 source image: <https://www.pexels.com/photo/pink-red-yellow-petaled-flower-in-close-up-shot-85773/>
2024-09-06 10:33:38
Wow. From a distance, JXL looks noticeably better than the AVIF. How did you make the AVIF? AVIF usually performs better.
CrushedAsian255
2024-09-06 10:34:06
`avifenc orig.png img.avif -q 21`
Demiurge
2024-09-06 10:34:25
hmm
2024-09-06 10:34:42
fair enough, if it has stupid defaults it's their own damn fault
CrushedAsian255
2024-09-06 10:34:52
im not an expert in AVIF options
lonjil
2024-09-06 10:34:57
jpegli is truly incredibly good at low bit rates
_wb_
2024-09-06 10:35:00
For ultra-low-quality, probably you could get more pleasing/"clean"/avif-like results by first applying some edge-preserving filter before passing the image to the jxl encoder. But I haven't really found any convincing use case where this kind of very low quality is really desirable. Expectations regarding image fidelity are getting higher, not lower. What's the point of making cameras and displays with ever-increasing fidelity (more pixels, higher bitdepth, wider gamut, higher dynamic range) if in the end you're going to ruin the images anyway by compressing them to 0.06 bpp.
Demiurge
CrushedAsian255 im not an expert in AVIF options
2024-09-06 10:35:05
And nobody should have to be
CrushedAsian255
lonjil jpegli is truly incredibly good at low bit rates
2024-09-06 10:35:34
not as bad as i expected for JPEG 1
Demiurge
2024-09-06 10:36:56
The AVIF version looks really, really bad.
2024-09-06 10:37:16
I'm switching between the original, AVIF, and JXL and viewing all 3 from a distance.
CrushedAsian255
2024-09-06 10:38:04
`avifenc orig.png img.avif -q 26 -s 2`
Oleksii Matiash
lonjil how does jpegli fare at 0.06 bpp
2024-09-06 10:38:49
Like from 8-bit game
CrushedAsian255
2024-09-06 10:39:16
no AC
2024-09-06 10:39:17
just DC
2024-09-06 10:39:19
lmao
2024-09-06 10:39:43
actually there is some very basic AC
2024-09-06 10:40:08
Demiurge
2024-09-06 10:40:21
`-s 2` made a huge difference
Oleksii Matiash
DNFrozen have you tried lossless webp?
2024-09-06 10:40:30
Lossless webp mostly shines on artificial images like screenshots
CrushedAsian255
2024-09-06 10:40:43
it's more like png
2024-09-06 10:40:47
just more advanced predictors
Demiurge
2024-09-06 10:40:47
with -s 2 it looks better than jxl but it looks about the same when zoomed out
CrushedAsian255
Demiurge with -s 2 it looks better than jxl but it looks about the same when zoomed out
2024-09-06 10:41:02
both look terrible though, right?
lonjil
2024-09-06 10:41:16
if you stand far enough away they look really good
CrushedAsian255
2024-09-06 10:41:27
only thing is JXL took 0.5s and AVIF took 2.2s
lonjil
2024-09-06 10:41:32
would probably be better to use a lower resolution though 😄
CrushedAsian255
2024-09-06 10:41:46
`Resolution : 2448x3264` probably would help
Demiurge
CrushedAsian255 both look terrible though, right?
2024-09-06 10:42:00
Not when zoomed out.
2024-09-06 10:42:15
The first AVIF looked terrible even when zoomed out
CrushedAsian255
2024-09-06 10:43:15
here is the lowest quality AVIF with the slowest setting
2024-09-06 10:43:39
`-q 0 -s 1`
Oleksii Matiash
CrushedAsian255 here is the lowest quality AVIF with the slowest setting
2024-09-06 10:45:49
Ah, these HEVC-like 'water paint' artefacts. Hate them
lonjil
2024-09-06 10:47:07
here's the flower image at the highest distance setting cjpegli lets you use (d=25). It's 0.137 bpp.
_wb_
2024-09-06 10:51:54
All of this very-low-bitrate stuff is all fun and interesting to look at, as long as you understand that it has very little to do with how codecs perform at usable qualities. To paraphrase <@532010383041363969> : it's like organizing a car race in a muddy swamp and concluding that a John Deere tractor is faster than a Ferrari.
lonjil
2024-09-06 10:53:17
I'm more likely to use d=0.1 than any of these quality levels 😄
CrushedAsian255
2024-09-06 10:53:41
for me it's JPEG: lossless jpeg->jxl PNG: lossless I hardly ever use lossy
2024-09-06 10:54:01
very occasionally lossy modular at -d 0.02 or something
yoochan
2024-09-06 10:54:20
lossy could be used when producing resized photos from raws for display
CrushedAsian255
2024-09-06 10:54:46
anyways here's the lowest quality `cwebp` supports
yoochan lossy could be used when producing resized photos from raws for display
2024-09-06 10:54:49
fair
2024-09-06 10:54:56
im keeping the raws anyways
Demiurge
CrushedAsian255 here is the lowest quality AVIF with the slowest setting
2024-09-06 10:54:58
0.0019 bpp?
CrushedAsian255
2024-09-06 10:55:14
0.019 i think
2024-09-06 10:57:02
`0.0153326445 bpp`
Demiurge
2024-09-06 10:57:29
No... 0.0019 I think...
2024-09-06 10:58:01
Wait
2024-09-06 10:58:11
I'm thinking bytes not bits
2024-09-06 10:58:17
damn
CrushedAsian255
2024-09-06 10:58:22
it's 15314 bytes dimensions are 2448 x 3264 total pixels: 7,990,272 total bits: 122,512 122,512 / 7,990,272 = 0.0153326445 bpp
Demiurge damn
2024-09-06 10:58:53
that makes sense
2024-09-06 10:59:29
what image encoder supports setting the quality so low that you can barely call it an image?
DNFrozen
2024-09-06 10:59:30
can you send the original?
CrushedAsian255
CrushedAsian255 source image: <https://www.pexels.com/photo/pink-red-yellow-petaled-flower-in-close-up-shot-85773/>
2024-09-06 10:59:54
.
Demiurge
CrushedAsian255 what image encoder supports setting the quality so low that you can barely call it an image?
2024-09-06 10:59:59
Any image format allows that, but not all encoders do
2024-09-06 11:00:13
Try GIF or jpeg-turbo
CrushedAsian255
2024-09-06 11:00:15
question edited
2024-09-06 11:02:23
_wb_
2024-09-06 11:02:30
You could change the distance limit in libjxl and see where you can get. With lossy modular you should in principle be able to reach arbitrarily low bpp. With vardct there is probably some minimum size that you can't get under.
CrushedAsian255
_wb_ You could change the distance limit in libjxl and see where you can get. With lossy modular you should in principle be able to reach arbitrarily low bpp. With vardct there is probably some minimum size that you can't get under.
2024-09-06 11:02:55
do i have to compile from source?
2024-09-06 11:03:50
there's this tool called `pngloss` which alters pixels of a png to make it more compressible
2024-09-06 11:03:53
i set it to the max
2024-09-06 11:03:56
2024-09-06 11:04:33
and turned off dithering
DNFrozen
2024-09-06 11:07:35
lets say you have a set of images (all same resolution) that you want to compress together would it save space to throw them all into one big jxl image and treat it like a texture map?
2024-09-06 11:08:23
or would it likely almost the same as compression them individual?
CrushedAsian255
2024-09-06 11:08:27
for icons probably as patches and multiple images can be in the same group
_wb_
2024-09-06 11:08:32
distance 2000 lossy modular
embed
2024-09-06 11:08:40
https://embed.moe/https://cdn.discordapp.com/attachments/803645746661425173/1281571738282627165/pexels-unchalee-srirugsar-14114-85773.jpg.jxl?ex=66dc3430&is=66dae2b0&hm=a35300ccee5d7b96b558cbdc91933e491a87e009155c297f5bfb746b6546457e&
CrushedAsian255
2024-09-06 11:08:52
looks like a not finished progressive jxl
_wb_
2024-09-06 11:10:08
distance 5000 lossy modular. Obviously it just becomes ridiculous at some point.
embed
2024-09-06 11:10:15
https://embed.moe/https://cdn.discordapp.com/attachments/803645746661425173/1281572140428296204/pexels-unchalee-srirugsar-14114-85773.jpg.jxl?ex=66dc3490&is=66dae310&hm=c314095bea0ec123f8f0c8d6cb8659dfd54bcbdc7834025fb7f16aece8243301&
CrushedAsian255
_wb_ distance 5000 lossy modular. Obviously it just becomes ridiculous at some point.
2024-09-06 11:10:33
set distance to INT_MAX
_wb_
2024-09-06 11:11:18
distance 20000 — no color at all survives
embed
2024-09-06 11:11:25
https://embed.moe/https://cdn.discordapp.com/attachments/803645746661425173/1281572426228174848/pexels-unchalee-srirugsar-14114-85773.jpg.jxl?ex=66dc34d4&is=66dae354&hm=cf05d222302da4eacfe45a58eb18ef3d13d7038bffc0a0a968b0e7255f5528cc&
CrushedAsian255
2024-09-06 11:11:39
is colour quantised more than luma
_wb_
2024-09-06 11:12:26
yeah — the scale is not comparable anyway, but yeah generally more bits end up going to luma
CrushedAsian255
2024-09-06 11:16:31
i truncated some bits
lonjil
2024-09-06 11:18:51
lol
https://embed.moe/https://cdn.discordapp.com/attachments/803645746661425173/1281571738282627165/pexels-unchalee-srirugsar-14114-85773.jpg.jxl?ex=66dc3430&is=66dae2b0&hm=a35300ccee5d7b96b558cbdc91933e491a87e009155c297f5bfb746b6546457e&
2024-09-06 11:19:25
that's so blocky that it might as well have been a lower resolution 😄
CrushedAsian255
2024-09-06 11:19:49
im guessing the later squeeze passes have been just set to 0
lonjil
2024-09-06 11:22:19
not entirely, I can see a few gradients inside the blocks
2024-09-06 11:22:28
but probably very close to 0
jonnyawsom3
DNFrozen lets say you have a set of images (all same resolution) that you want to compress together would it save space to throw them all into one big jxl image and treat it like a texture map?
2024-09-06 12:14:21
Depends how similar they are. For satellite imagery it worked quite well https://discord.com/channels/794206087879852103/794206087879852106/1247491487181180940
CrushedAsian255
Depends how similar they are. For satellite imagery it worked quite well https://discord.com/channels/794206087879852103/794206087879852106/1247491487181180940
2024-09-06 12:25:31
Can channels reference previous channels in their prediction?
jonnyawsom3
CrushedAsian255 Can channels reference previous channels in their prediction?
2024-09-06 12:46:07
This specific case was using the -E flag https://discord.com/channels/794206087879852103/806898911091753051/1245440426824171541
lonjil
CrushedAsian255 Can channels reference previous channels in their prediction?
2024-09-06 12:54:03
I don't think there are any previous channel predictors, but values from previous pixels can be used in the decision tree
CrushedAsian255
lonjil I don't think there are any previous channel predictors, but values from previous pixels can be used in the decision tree
2024-09-06 12:54:46
i wonder why, i guess devs decided that RCT and CfL would probably do enough for decorrelation
2024-09-06 12:55:07
can you define custom RCT matricies for extra channels to interact with the main 3 colour channels?
lonjil
2024-09-06 12:55:07
lemme pull up the spec, one sec
CrushedAsian255 can you define custom RCT matricies for extra channels to interact with the main 3 colour channels?
2024-09-06 12:55:51
I don't understand that part of the spec, to be honest, but I'm pretty sure you can put extra channels before or after the main 3 color channels.
2024-09-06 12:56:07
for example, here is a bit of jxl art I made: https://jxl-art.lucaversari.it/?zcode=lZA9C8IwGIRn%2ByveXQr5bl0c7OKkokLnYqMNSJQSRP%2B9adqEgNri9twldwfvvjgCStaqrqUumkpreQWWrJSp5d00kCfbVkltKqNu2j6UqrbuQtiIVJfGALOYqDOcYGl7BsAeiAcaPjEP3Fm7Vj6oj3SCxYLHQjiRwkEawFQMlPMBqAfCPfE8bJC4aWqwTwsPBGe%2FNzChYQTHVVOLfRyFQhLWPkf6G7%2FcjQFS2MAcMKedsP7T%2BbMUSvvUhWZ%2FpzhGoylEvqUyMbrVlY6H3g%3D%3D
2024-09-06 12:56:29
there are 4 extra channels before the color channels
CrushedAsian255
2024-09-06 12:56:42
does `HiddenChannel 4` tell it to put them before the main data?
2024-09-06 12:57:15
so is a "hidden channel" an extra channel before the main colour channels and then "extra channel" a channel that goes after?
lonjil
2024-09-06 12:57:18
yeah. jxl_from_tree does something to tell the encoder to shuffle the channels around like that
CrushedAsian255 so is a "hidden channel" an extra channel before the main colour channels and then "extra channel" a channel that goes after?
2024-09-06 12:57:50
"HiddenChannel" is just an option in the jxl_from_tree language, not a feature of the spec
2024-09-06 12:57:55
it's all just extra channels
CrushedAsian255
lonjil "HiddenChannel" is just an option in the jxl_from_tree language, not a feature of the spec
2024-09-06 12:58:15
oh, so just jxl from tree terminology?
lonjil
2024-09-06 12:58:21
yeah
lonjil lemme pull up the spec, one sec
2024-09-06 01:01:53
yeah no predictors that use previous channels
_wb_
2024-09-06 01:50:08
RCTs cannot have custom matrices but you do have several different RCTs to choose from. All RCTs operate on any 3 subsequent channels (where the channels are R, G, B, and then all the extra channels like alpha and whatever other extra channels you want). There are also RCTs that just do permutations (e.g. RGB to BGR). Chaining those allows you to arbitrarily reorder all the channels.
2024-09-06 01:52:31
There are no predictors that use previous channels, but you can e.g. use an RCT to subtract the previous channel from the current, which boils down to something similar.
CrushedAsian255
2024-09-06 01:55:50
so there is limited support for channel communication / decorrelation
_wb_
2024-09-06 02:09:04
Also you can use Palette in funky ways in principle. E.g. you can make a palette for two 8-bit channels and replace them with a single 16-bit channel where each value encodes the combination of two 8-bit sample values, reordered in whatever way (e.g. the more common combinations first), which could also act as a kind of decorrelation.
monad
DNFrozen is there a programm that can compress images much better than jxl at the cost of incredible high decompression times and or high ram usage?
2024-09-06 07:00:13
there's EMMA <https://encode.su/threads/2459-EMMA-Context-Mixing-Compressor>
DNFrozen before i found jxl the only way to make a jpg smaller was using one of the pq8 compression programms and these have worse compression results than jxl recompression while making even effort 11 look like the flash
2024-09-06 07:04:05
btw https://discord.com/channels/794206087879852103/803645746661425173/937627806408523777
DNFrozen
monad there's EMMA <https://encode.su/threads/2459-EMMA-Context-Mixing-Compressor>
2024-09-06 07:05:47
i already like it
2024-09-06 07:11:14
but it looks like jxl is still smaller
yoochan
monad there's EMMA <https://encode.su/threads/2459-EMMA-Context-Mixing-Compressor>
2024-09-06 07:32:31
the author Marco Paìs said : "I've stopped working on this project, sorry. I've ported a lot of it to paq8px and cmix, so you can check those out."
monad
DNFrozen but it looks like jxl is still smaller
2024-09-06 07:51:31
In general? I doubt it, based on old benchmarks <https://docs.google.com/spreadsheets/d/1ju4q1WkaXT7WoxZINmQpf4ElgMD2VMlqeDN2DuZ6yJ8/edit?gid=174429822#gid=174429822>. And make sure you are giving it PPM over PNG for best results since it is a general compressor.
afed
2024-09-06 07:54:03
and this is a different non-gui EMMA, faster and probably with better compression
DNFrozen
2024-09-06 07:56:55
I have tested one jpg file and but jxl won by a lot and the emma programm only accepts one file at a time as input so compressing all my files like that would be quite annoying
monad
2024-09-06 07:58:50
the cli version is more convenient for larger tests
afed
2024-09-06 08:10:08
it's also not for jpg, general compressors will lose to any sort of recompressors
jonnyawsom3
In reference to that e10 decode I posted before ``` WebP: 3.16 bpp Encode 200 Seconds 4424 MB RAM Decode 813 milliseconds 606 MB RAM JXL e10: 3.76 bpp Encode 3400 Seconds 8036 MB RAM Decode 102437 milliseconds 1781 MB RAM JXL e9: 4.40 bpp Encode 65 Seconds 840 MB RAM Decode 3125 milliseconds 619 MB RAM ``` Tried to measure Decode memory using ffplay since I have it on hand, e10 used up so much CPU my mouse actually stuttered for the first time in years, ended up just using Irfanview from the command line So still some work to do xP
2024-09-07 01:38:26
Tried removing the almost empty Alpha channel (200 KB), and that shaved half a second off the e9 decode time, down to 2600 miliseconds roughly
CrushedAsian255
2024-09-07 01:40:00
did you use `-E 4`?
jonnyawsom3
2024-09-07 01:46:18
Tried from none up to 11, was a 100 milisecond decode difference and density only changed at `-E 1` and `-E 2`
CrushedAsian255
2024-09-07 01:46:58
Are we talking effort or extra channels?
jonnyawsom3
2024-09-07 01:58:43
Extra channels
CrushedAsian255
2024-09-07 01:59:26
not sure why alpha decoding would take 500 ms
jonnyawsom3
2024-09-07 01:59:45
It may be almost completely empty, but it is 80 Megapixels
CrushedAsian255
2024-09-07 02:00:25
is it libjxl taking the extra time or the PNG encoder?
jonnyawsom3
2024-09-07 02:42:39
This was opening in Irfanview since it has a built-in metric, so libjxl
2024-09-07 02:43:12
Reloaded each image 3 times to get consistency, always was within a dozen miliseconds or so
monad
Smallest group size helps with palette, high entropy so only 1% is needed for the MA tree from loose testing
2024-09-07 04:21:50
did you try allowing more palette colors with larger groups?
jonnyawsom3
2024-09-07 04:54:29
Can do tomorrow
Oleksii Matiash
Tried removing the almost empty Alpha channel (200 KB), and that shaved half a second off the e9 decode time, down to 2600 miliseconds roughly
2024-09-07 07:50:48
Hmm, I don't see any alpha chanel in that file
DNFrozen
2024-09-07 07:59:13
can someone tell me what the different effort presets are doing in detail? i assume that there are many parameter combinations and they are just testing a specific subset of them. is that correct?
CrushedAsian255
2024-09-07 08:04:31
https://github.com/libjxl/libjxl/blob/main/doc/encode_effort.md
2024-09-07 08:05:02
e10 on there is now e11 I think
2024-09-07 08:05:11
And what is now e10 is e9 + patches
DNFrozen
2024-09-07 08:11:41
yup I'm testing e11 for my lossless images
Oleksii Matiash
DNFrozen yup I'm testing e11 for my lossless images
2024-09-07 08:29:24
C'ya in a week
DNFrozen
2024-09-07 08:29:52
oh no thats gonna take months
monad
2024-09-07 08:30:07
do you know the kind of content up front, or is there a lot of variety? if you know the content, you can make smarter decisions than e11
DNFrozen
2024-09-07 08:31:46
there are a lot that are similar
2024-09-07 08:32:08
but what better options do i have?
monad
2024-09-07 08:33:38
Well, I can suggest some. Like with photos, you only need to try 5 or 6 configurations rather than the 26 currently tried.
DNFrozen
2024-09-07 08:34:36
i didn't know i can specify the configurations myself
monad
2024-09-07 08:36:24
you can see here that a selection of 4 configurations outperformed former e11's gauntlet of 432 configurations: <https://loathra.com/jxl/bench/20240506.html#all-brute-2>
DNFrozen
2024-09-07 08:42:08
mmh ok but how can i specify specific configurations and where can i find out what my options are when i want to specify one?
monad
2024-09-07 08:43:45
just passing parameters to cjxl.
DNFrozen
2024-09-07 09:07:34
well i gues i have to read some documentation to find out what they are
monad
2024-09-07 09:09:13
cjxl -v -v -v -v ...
Oleksii Matiash
Tried removing the almost empty Alpha channel (200 KB), and that shaved half a second off the e9 decode time, down to 2600 miliseconds roughly
2024-09-07 09:45:38
I'm getting inconsistent results, from 2200 to 2800. Jxl compressed to 3.022 bpp, btw
jonnyawsom3
Oleksii Matiash Hmm, I don't see any alpha chanel in that file
2024-09-07 04:08:54
It looks empty, but the bottom left, bottom right and upper right corners have holes where terrain wasn't generated
Oleksii Matiash I'm getting inconsistent results, from 2200 to 2800. Jxl compressed to 3.022 bpp, btw
2024-09-07 04:10:07
Huh, what settings?
Oleksii Matiash
It looks empty, but the bottom left, bottom right and upper right corners have holes where terrain wasn't generated
2024-09-07 04:10:30
I mean I open it in PS and no layers, no alpha channel
Huh, what settings?
2024-09-07 04:10:58
e10 E3 g3 I100
jonnyawsom3
In reference to that e10 decode I posted before ``` WebP: 3.16 bpp Encode 200 Seconds 4424 MB RAM Decode 813 milliseconds 606 MB RAM JXL e10: 3.76 bpp Encode 3400 Seconds 8036 MB RAM Decode 102437 milliseconds 1781 MB RAM JXL e9: 4.40 bpp Encode 65 Seconds 840 MB RAM Decode 3125 milliseconds 619 MB RAM ``` Tried to measure Decode memory using ffplay since I have it on hand, e10 used up so much CPU my mouse actually stuttered for the first time in years, ended up just using Irfanview from the command line So still some work to do xP
2024-09-07 04:11:01
Only WebP got 3.16 bpp with a stripped Alpha
Oleksii Matiash I mean I open it in PS and no layers, no alpha channel
2024-09-07 04:12:02
I did notice the PNG header is set to RGB, but there's a transparency chunk which cjxl and some decoders don't ignore
Oleksii Matiash
2024-09-07 04:12:36
Maybe we are talking about different files? This one, correct?
jonnyawsom3
2024-09-07 04:12:59
Yes
Oleksii Matiash
2024-09-07 04:14:57
Splitted to parts because of discord. Created with 7z, don't know if it creates standartized files
jonnyawsom3
Oleksii Matiash e10 E3 g3 I100
2024-09-07 04:15:34
On e9, g0 and I1 were best, maybe something about e10 reverses the trend. It takes an hour to encode for me so I couldn't really test many combinations
Oleksii Matiash
2024-09-07 04:16:23
Idk, I did not try other parameters, can try now if it would fit currently free memory
jonnyawsom3
2024-09-07 04:17:16
Lower group size and MA learning also means less memory, so you already ran the worst case, bar e11
Oleksii Matiash
On e9, g0 and I1 were best, maybe something about e10 reverses the trend. It takes an hour to encode for me so I couldn't really test many combinations
2024-09-07 04:17:49
What about -E ?
jonnyawsom3
2024-09-07 04:18:41
-E 1 makes a slight difference, -E 2 and above shaved 6 MB off
The actual command was `cjxl -d 0 -e 9 -I 1 -g 0 -E 3`
2024-09-07 04:20:01
I used the same command for e10
Oleksii Matiash
2024-09-07 04:20:24
Let's wait some time 🙂
jonnyawsom3
2024-09-07 04:20:39
Thanks
Oleksii Matiash
2024-09-07 04:38:27
cjxl -d 0 -e 10 -g 0 -E 3 -I 1 m.png me10.jxl JPEG XL encoder v0.10.2 e148959 [AVX2,SSE2] Encoding [Modular, lossless, effort: 10] Compressed to 34198.7 kB (3.286 bpp). 8880 x 9376, 0.123 MP/s [0.12, 0.12], , 1 reps, 32 threads. used 0:00:10:24.515
2024-09-07 04:41:31
Well, either I'm doing something wrong, or I don't understand how did you get your results cjxl -d 0 -e 9 -g 0 -E 3 -I 1 m.png me9.jxl JPEG XL encoder v0.10.2 e148959 [AVX2,SSE2] Encoding [Modular, lossless, effort: 9] Compressed to 39364.4 kB (3.782 bpp). 8880 x 9376, 6.446 MP/s [6.45, 6.45], , 1 reps, 32 threads.
jonnyawsom3
2024-09-07 05:27:26
I'll have to rerun e9 at least, unless something drastic changed between our versions they should be the same
Oleksii Matiash
2024-09-07 05:31:00
I'm running cjxl -d 0 -e 10 -g 0 -E 3 -I 100 right now, however it is already running much longer than -g 3
2024-09-07 06:10:46
cjxl -d 0 -e 10 -g 0 -E 3 -I 100 m.png me10-1.jxl JPEG XL encoder v0.10.2 e148959 [AVX2,SSE2] Encoding [Modular, lossless, effort: 10] Compressed to 32023.3 kB (3.077 bpp). 8880 x 9376, 0.017 MP/s [0.02, 0.02], , 1 reps, 32 threads.
jonnyawsom3
Oleksii Matiash Well, either I'm doing something wrong, or I don't understand how did you get your results cjxl -d 0 -e 9 -g 0 -E 3 -I 1 m.png me9.jxl JPEG XL encoder v0.10.2 e148959 [AVX2,SSE2] Encoding [Modular, lossless, effort: 9] Compressed to 39364.4 kB (3.782 bpp). 8880 x 9376, 6.446 MP/s [6.45, 6.45], , 1 reps, 32 threads.
2024-09-07 07:46:45
cjxl -d 0 -e 9 -g 0 -E 3 -I 1 minecraft.png e9g9E3I1.jxl JPEG XL encoder v0.10.2 4451ce9 [AVX2,SSE2] Encoding [Modular, lossless, effort: 9] Compressed to 45774.0 kB (4.398 bpp). 8880 x 9376, 1.316 MP/s [1.32, 1.32], , 1 reps, 16 threads.
2024-09-07 07:47:26
So some kind of major regression since 0.10.2 released... 2x slowdown (16 vs 32 threads, so halved) and 0.7 bpp worse density
Oleksii Matiash
cjxl -d 0 -e 9 -g 0 -E 3 -I 1 minecraft.png e9g9E3I1.jxl JPEG XL encoder v0.10.2 4451ce9 [AVX2,SSE2] Encoding [Modular, lossless, effort: 9] Compressed to 45774.0 kB (4.398 bpp). 8880 x 9376, 1.316 MP/s [1.32, 1.32], , 1 reps, 16 threads.
2024-09-07 07:50:14
Let's ensure that I'm doing everything correct, because it is very strange. SHA256 from original png: 61453c464958cad62970675bf901f3a3d675a49d36be62edbf2a0338e04f8543 , correct?
jonnyawsom3
2024-09-07 07:50:48
Identical
Oleksii Matiash
2024-09-07 07:51:13
Hmm
jonnyawsom3
2024-09-07 07:55:33
Hmm, could be this https://github.com/libjxl/libjxl/issues/3441#issuecomment-2024623501
2024-09-07 07:55:49
> This is likely caused by my changes to the palette heuristics (#3420). It is expected when changing such heuristics that for some images, compression will be worse, for others it will be better. On larger sets of images, I saw an improvement on average (e.g. 0.25% improvement on the QOI test set), but such averages do hide a lot of per-image variation, e.g. one image might be 500 bytes larger and the other 600 bytes smaller. > > The only way to avoid such regressions is to try both the old and the new thing whenever a change is made, making the encoder twice as slow. But such an encoder slowdown generally is not justified :)
Orum
2024-09-07 08:15:08
yeah, you really need to test on more than just 1 image
monad
2024-09-07 08:49:54
I recommend at least 500 images
Orum
2024-09-07 09:14:49
I only have 458 for my regular testing corpus 🥹
monad
2024-09-07 09:56:59
I have 1542 for speed vs density, but a little over half that is unique image content since I have versions with metadata and without. Then I have additional 1542 with unique image content for testing density alone.
2024-09-07 10:10:07
for studying highest-density settings, my benchmark applied 4608 settings to 1245 out of roughly 2300 available images (plus a couple thousand settings against smaller subsets)
2024-09-07 10:18:13
e11 can be improved more by further differentiating images. currently it runs 2 trials followed by either 24 or 20 additional based on result (and technically one of the initial trials is probably redundant for density most of the time). run six initial trials, then run 16 or fewer additional trials based on results, it should be denser and faster
2024-09-07 10:21:22
you can imagine continuing to iterate to some logical conclusion, but this technique has the side effect of code bloat, I think
2024-09-07 10:35:41
with four trials, I can distinguish a group containing all photos, a group performing best with lots of allowed palette colors, and a group performing best with no allowed palette colors
Oleksii Matiash
Hmm, could be this https://github.com/libjxl/libjxl/issues/3441#issuecomment-2024623501
2024-09-08 07:40:31
cjxl -d 0 -e 9 -E 3 -g 3 -I 100 m.png m.jxl JPEG XL encoder v0.6.1 a205468 [AVX2,SSE4,Scalar] Read 8880x9376 image, 78.2 MP/s Encoding [Modular, lossless, tortoise], 16 threads. Compressed to 31581648 bytes (3.035 bpp). 8880 x 9376, 0.01 MP/s [0.01, 0.01], 1 reps, 16 threads.
2024-09-08 07:40:40
cjxl -d 0 -e 9 -E 3 -g 3 -I 100 m.png m.jxl JPEG XL encoder v0.9.2 41b8cda [AVX2,SSE4,SSSE3,SSE2] Encoding [Modular, lossless, effort: 9] Compressed to 31796.6 kB (3.055 bpp). 8880 x 9376, 0.014 MP/s [0.01, 0.01], 1 reps, 32 threads.
2024-09-08 09:23:11
<@238552565619359744> 0.11.0 achieves lowest bpp: cjxl -d 0 -e 10 -E 3 -g 3 -I 100 m.png m.jxl JPEG XL encoder v0.11.0 3786abb [AVX2,SSE2] Encoding [Modular, lossless, effort: 10] Compressed to 31409.2 kB (3.018 bpp). 8880 x 9376, 0.015 MP/s [0.02, 0.02], , 1 reps, 32 threads.
jonnyawsom3
2024-09-08 11:57:28
Hmm, good to know with enough time it still sorts itself out
DNFrozen
2024-09-10 04:14:40
hey i want to convert a set of jpg (lossless recompression) and png (lossless) images to jxl with many different parameters to find out how much each set of parameters influence the image size for my images. but even with the help description for each parameter i still don't really know what many of the parameters do and if there is even a point in testing these. can someone help me to narrow it down?
Oleksii Matiash
DNFrozen hey i want to convert a set of jpg (lossless recompression) and png (lossless) images to jxl with many different parameters to find out how much each set of parameters influence the image size for my images. but even with the help description for each parameter i still don't really know what many of the parameters do and if there is even a point in testing these. can someone help me to narrow it down?
2024-09-10 04:39:17
I'm by no mean expert, so this may be wrong or incomplete. For jpegs I use -e and --brotli_effort for jpegs with exif. For pngs these parameters affect compression: -e, -g, -E, -I and also probably --brotli_effort for pngs with metadata. Explanation what each parameter does is above my knowledge, sorry
DNFrozen
2024-09-10 04:46:39
the whole point is to find parameter combinations that are about as effective in terms of compression as effort 11 without having the insane computational effort that effort 11 that tests many different combinations
Oleksii Matiash
DNFrozen the whole point is to find parameter combinations that are about as effective in terms of compression as effort 11 without having the insane computational effort that effort 11 that tests many different combinations
2024-09-10 04:47:28
IIRC <@263300458888691714> did some work in this field
DNFrozen
2024-09-10 04:48:18
when i look at the help and see a parameter like this --codestream_level=K The codestream level. Either `-1`, `5` or `10`. i have still no idea if that is usefull for me because i have no idea what it does
_wb_
2024-09-10 05:07:46
Mostly you can ignore most things and just use --effort. At least that's the goal. We don't want to make it more complicated than that for end-users.
2024-09-10 05:08:54
In other words, if there's a non-default set of options that consistently outperforms the default behavior, please make a pull request to improve the default 🙂
jonnyawsom3
DNFrozen the whole point is to find parameter combinations that are about as effective in terms of compression as effort 11 without having the insane computational effort that effort 11 that tests many different combinations
2024-09-10 07:54:01
If you just want a best overall command, here are the results of Monad's extensive testing https://loathra.com/jxl/bench/20240819.html `cjxl -d 0 -e 10 -E 4 -I 100 -g 3 --patches=0 --brotli_effort=11` should give you the best overall density without wasting an extra month of your life on encoding
DNFrozen
2024-09-10 07:56:08
can i increase the -E parameter infinite or is there a limit?
jonnyawsom3
2024-09-10 07:56:55
At most you'll generally only have RGBA, so 4 channels for the parameter to use, although the maximum is 11
monad
2024-09-10 07:58:25
That's not the best overall command as far as density, it's the one that achieves the highest number of minimum results. Best one kept patches enabled, as seen in the [giant table](https://loathra.com/jxl/bench/20240819.html#data_or_data-3).
jonnyawsom3
2024-09-10 08:00:57
The 3 tables in a row threw me off which one to look at xD
monad
2024-09-10 08:01:11
the biggest
2024-09-10 08:01:28
it shows density of command
DNFrozen
2024-09-10 08:03:03
density of command = most compressed end result?
monad
2024-09-10 08:07:10
So, most people look at smallest total size. That's fair, but biases toward larger images. I sort my tables on bpp, which I _feel_ is more robust, but which biases toward smaller images. This is okay for something like e11, which is increasingly impractical the larger the image.
DNFrozen
2024-09-10 08:08:34
ah yeah -e 11 has been working on a 3760*2684 image for a while now on my pc
monad
2024-09-10 08:09:38
it is the money wasting effort level, for entertainment purposes only
DNFrozen
2024-09-10 08:12:05
when you are after the smallest result should you also add `-I 100` besides -e11 ?
Oleksii Matiash
DNFrozen ah yeah -e 11 has been working on a 3760*2684 image for a while now on my pc
2024-09-10 08:12:13
Expect Christmas gift, not earlier
DNFrozen
2024-09-10 08:12:20
or is that already included?
monad
2024-09-10 08:13:28
e11 overwrites user settings of I, P, E, g, patches, modular_palette_colors, X, Y
DNFrozen
2024-09-10 08:15:00
mmh so e11 is the absolut limit of what you can do? or are the perameters that have aa chance could make it smaller?
monad
2024-09-10 08:15:25
it's not the limit
2024-09-10 08:16:36
for example, in maybe 20% of cases, old e11 can find a smaller image than new e11, but new e11 is smaller on average
DNFrozen
2024-09-10 08:17:50
yeah but are there parameter that let me recreate these results without relying on the old version?
monad
2024-09-10 08:19:23
e11 utilizes 46 configurations (one is probably redundant for density), testing either 26 or 22 per image depending on content. Minimizing my test corpus would require ~115 configurations.
DNFrozen
2024-09-10 08:19:35
can i create a script that does true brute force that reach the best result in case it ever completes execution?
monad
2024-09-10 08:22:21
You can. True brute force won't ever complete. It just won't. So if you want output, you have to make some choices.
DNFrozen
2024-09-10 08:23:49
what are the parameters that i would need to consider for true brute force?
monad
2024-09-10 08:25:12
Well, there's all e11 overwrites which I mentioned above, those are the ones exposed to the cli.
_wb_
2024-09-10 08:25:39
There is no true brute force encoder for lossless jxl except a Kolmogorov search of all bitstreams.
monad
2024-09-10 08:25:59
But there's a lot more stuff possible that isn't exposed to CLI.
_wb_
2024-09-10 08:27:16
Even e11 is just doing multiple heuristics but very far from exhaustive. We only apply RCTs in a limited way, we only try one palette ordering heuristic, we do MA learning in a greedy way, etc etc.
monad
2024-09-10 08:27:42
e11 also tests the no weighted predictor path, which is not exposed to cli
_wb_
2024-09-10 08:27:49
The full search space is just way too huge to even consider doing anything exhaustively.
2024-09-10 08:31:31
Probably with genetic algorithms and AI you could make an encoder that can explore a bigger chunk of the search space and beat e11 with the time/memory budget of e10. There is a lot of room for making more use of the expressivity of the bitstream, in a way what we have in libjxl is just a proof of concept that there exists a somewhat effective encoder.
DNFrozen
2024-09-10 08:32:09
creating a heuristic for such a giant search space sounds difficult.
veluca
2024-09-10 08:32:42
I already know of a better (and possibly slower, or maybe not, who knows) heuristic for the tree search
2024-09-10 08:32:49
just never had time to write it 😄
2024-09-10 08:33:22
well, *probably* better
_wb_
2024-09-10 08:33:34
Why not write a rust encoder for lossless jxl? 🙂
veluca
2024-09-10 08:33:44
eventually 🙂
DNFrozen
2024-09-10 08:33:47
can't wait to start at 0 again when it gets released 🙃
2024-09-10 08:35:09
e11 only increased the time for lossless significant. jpg recompression didn't seem to be affected at all
2024-09-10 08:35:36
but it also wasn't smaller
monad
2024-09-10 08:39:43
e11 doesn't touch lossless jpeg
DNFrozen
2024-09-10 08:40:09
that explains a lot
monad
monad for example, in maybe 20% of cases, old e11 can find a smaller image than new e11, but new e11 is smaller on average
2024-09-10 08:54:53
Of course, this depends on content. so, specifically, on a diverse set of 84 images, new found 43% mins which old did not find, and old found 26% which new did not find. on a subset of 22 photo/film, new found 45% mins which old did not find, and old found non which new did not find.
2024-09-10 08:55:54
The goal was to improve it by an amount where people wouldn't think they should use both versions.
DNFrozen mmh so e11 is the absolut limit of what you can do? or are the perameters that have aa chance could make it smaller?
2024-09-10 09:10:11
with 45 configurations from e11, we achieve 52478644 bytes across a 1245 image set. 139 out of 3840 tested can minimize this set to 52439674 bytes.
2024-09-10 09:17:04
but recall e11 only tries half of those on each image. by trying one set of 36 on each image, I get 52467707 bytes. one set of 26 gives 52515793 bytes.
DNFrozen the whole point is to find parameter combinations that are about as effective in terms of compression as effort 11 without having the insane computational effort that effort 11 that tests many different combinations
2024-09-10 09:46:05
What is your strategy?
DNFrozen
monad What is your strategy?
2024-09-11 01:45:28
i dont have one yet
monad
2024-09-11 09:28:23
```JPEG XL encoder v0.11.0 850f6cdf [AVX2,SSE4,SSE2] Encoding [Modular, lossless, effort: 12] Trying 760320 configurations, please be patient ...```
2024-09-11 09:54:26
e11: 0.492s, 1779 B e12: 18m10.482s, 1752 B
2024-09-11 09:54:40
worth
Oleksii Matiash
2024-09-11 09:59:37
It finished before Sun became red giant? I'm surprised
monad
2024-09-11 10:02:06
Only 30x30 pixels
DNFrozen
2024-09-11 10:02:24
e12 ?😍
monad
2024-09-11 10:02:29
I'm surprised it was that fast too
2024-09-11 10:02:56
<@365440150785753088> you want this shiz?
DNFrozen
2024-09-11 10:03:20
I'll test it for sure
monad
2024-09-11 10:03:26
okay
DNFrozen
2024-09-11 10:05:25
how many configurations is e11 testing?
monad
2024-09-11 10:07:10
either 25(+1) or 22
DNFrozen
2024-09-11 10:09:29
i didn't know there is e12 the help description only mentions e11
monad
2024-09-11 10:10:16
I just made it
DNFrozen
2024-09-11 10:11:08
can you give me the exe?
monad
2024-09-11 10:12:36
I will push to GH in a bit
2024-09-11 10:33:03
<@365440150785753088> <@238552565619359744> <https://github.com/monad0/libjxl/tree/cpu-heater>
2024-09-11 10:37:17
For jonny, it outputs the selected settings at the end. But I didn't add a `--tree_mode` yet, so sometimes you can't actually utilize that.
2024-09-11 10:40:56
A significant portion of this space I am almost certain is useless, because I've tested it. Most of this space, I've never tested.
2024-09-11 10:41:55
But it does just about fulfill the "keep running and never stop" prompt
DNFrozen
2024-09-11 10:42:58
is there a compiled version of new e12 cjxl.exe that I'm missing?
monad
2024-09-11 10:43:12
no
jonnyawsom3
2024-09-11 10:47:00
I know one idea I had was a very rough time estimation extrapolating from average encode time per megapixels
monad
2024-09-11 10:47:44
you could do one encode ahead of time and do the math
2024-09-11 10:48:07
but also this is the dumbest thing you could ever run, so don't use it
DNFrozen is there a compiled version of new e12 cjxl.exe that I'm missing?
2024-09-11 11:07:04
maybe GH would build it for you enabling workflows. but i don't think i want to enable all that on my end, i don't know if it's practical to avoid the unrelated stuff
TheBigBadBoy - 𝙸𝚛
DNFrozen e12 ?😍
2024-09-11 12:01:00
I see I'm not the only want interested in burning my CPU <:KekDog:805390049033191445>
DNFrozen
2024-09-11 12:02:09
yup
CrushedAsian255
2024-09-11 12:05:45
Does it print a progress log?
DNFrozen
2024-09-11 12:06:37
nah i don't check the output
2024-09-11 12:07:25
i just assume that it worked when the process is done and start the next image
CrushedAsian255
2024-09-11 12:07:55
I kinda want to rent one of those 64 core servers for 1 hour to see how slow this is
DNFrozen i just assume that it worked when the process is done and start the next image
2024-09-11 12:08:26
Does it spawn new processes?
DNFrozen
2024-09-11 12:09:20
cjxl doesn't by itself but my java code does
CrushedAsian255
2024-09-11 12:09:33
Oh it’s a custom Java script?
2024-09-11 12:09:44
Not JavaScript script, Java script
2024-09-11 12:09:53
Geez they need Better names
DNFrozen
2024-09-11 12:11:55
i can change the number of paraallel conversion with this txt
2024-09-11 12:12:24
maybe i should just my a gui but i'm too lazy for that so far
CrushedAsian255
2024-09-11 12:13:00
Is that your configuration file?
DNFrozen
2024-09-11 12:13:47
yeah just a file with a number that my programm reads every 5 seconds
TheBigBadBoy - 𝙸𝚛
2024-09-11 12:21:09
mfw not using CLI tool as simple as `parallel cjxl <params> {} {.}.jxl ::: *png` and imagine writing Java code to do this <:NotLikeThis:805132742819053610>
DNFrozen
CrushedAsian255 Geez they need Better names
2024-09-11 12:21:22
and i agree it's confusing that there is java and javascript that are totally different laguages
A homosapien
2024-09-11 12:22:27
For the longest time I actually thought they were related in some way
2024-09-11 12:22:49
turns out they have nothing to do with each other ¯\_(ツ)_/¯
DNFrozen
2024-09-11 12:23:38
i already wrote the code for webp conversion so changing it to jxl was just editing the exe path and the parameters i want
_wb_
2024-09-11 01:42:15
JavaScript started as a scripting language that was created back when Java was very hyped, so I guess they're related in that way 🙂
spider-mario
2024-09-11 03:22:58
reminds me of this: https://james-iry.blogspot.com/2009/05/brief-incomplete-and-mostly-wrong.html > 1995 - Brendan Eich reads up on every mistake ever made in designing a programming language, invents a few more, and creates LiveScript. Later, in an effort to cash in on the popularity of Java the language is renamed JavaScript. Later still, in an effort to cash in on the popularity of skin diseases the language is renamed ECMAScript.
jonnyawsom3
CrushedAsian255 I kinda want to rent one of those 64 core servers for 1 hour to see how slow this is
2024-09-11 09:27:08
Next time I visit my friend I can try and remember to plug in their old Google datacentre server, think it was 64 core 192 GB of memory
CrushedAsian255
Next time I visit my friend I can try and remember to plug in their old Google datacentre server, think it was 64 core 192 GB of memory
2024-09-11 09:42:58
They just have a data centre server?
jonnyawsom3
2024-09-11 09:44:43
They used to work at Google and were friends with one of the datacentre techs. Old servers were getting retired one day, so he bought one of them off of the guy for £120 or something stupid
2024-09-11 10:52:39
<@167354761270525953> I'll carry on here
RaveSteel
2024-09-11 10:52:51
Good idea
username
2024-09-11 10:55:57
context: https://discord.com/channels/794206087879852103/822105409312653333/1283560514735177831
jonnyawsom3
2024-09-11 11:03:20
97.3 MB GIF to 77.6 MB APNG, so at least I was right for the first half
2024-09-11 11:08:22
Now the issue is the total animation is 300 Megapixels... And I was already nearing my limit at half of that, so you might have to try it yourself. On the plus side, the APNG tool runs per frame, so the default settings should be fine without blowing up your RAM https://gif2apng.sourceforge.net/
RaveSteel
2024-09-11 11:10:59
I have a lot of RAM, so it'll be fine xd
2024-09-11 11:26:17
But even 32 threads take a whole while to encode smh
2024-09-11 11:26:34
Well, not that I'm surprised
jonnyawsom3
2024-09-11 11:29:56
Frames are small and it only encodes 1 at a time, so probably only using 2 threads at best
RaveSteel
2024-09-11 11:30:18
Thats why I am encoding webp, avif, apng and jxl at the same time lol
CrushedAsian255
2024-09-11 11:31:02
That kind of GIF is probably more suited to video codecs, does AVIF do any good?
RaveSteel
2024-09-11 11:31:13
AVIF conversion is still running
2024-09-11 11:31:23
I'll post after it finished
CrushedAsian255
2024-09-11 11:31:28
Given the slight camera movements it would be hard to find patches of pixels that haven’t moved
2024-09-11 11:31:44
Although AVIF’s horrid lossless performance may ruin that advantage
RaveSteel
2024-09-11 11:31:51
Indeed
2024-09-11 11:32:09
AVIF is especially bad at encoding GIFs in my experience
CrushedAsian255
2024-09-11 11:32:21
Maybe the palette screws with it
RaveSteel
2024-09-11 11:32:23
It just does best with clean lines
CrushedAsian255
2024-09-11 11:32:36
What about lossy?
RaveSteel
2024-09-11 11:32:41
But we'll see how it does with this contender
2024-09-11 11:33:10
Lossy AVIF just smears the result, even at crf1
CrushedAsian255
2024-09-11 11:33:35
Oh yeah, I forgot AVIF is AVIF
RaveSteel
2024-09-11 11:33:41
I have found it to be pretty useless for GIF encoding, especially if the GIFs aren't using palettes
2024-09-11 11:33:57
And yet it is still often better than lossless WebP
2024-09-11 11:34:09
Depending on the content of course
2024-09-11 11:35:33
But with a few hundred animations I encoded lossless AVIF was often very competitive if not better than lossless WebP
2024-09-12 12:28:00
``` 76M ZhEb2N3.apng.e10.jxl 78M ZhEb2N3.apng 81M ZhEb2N3_z9.webp 84M ZhEb2N3.gif.e10.jxl 89M ZhEb2N3_s4_crf10.avif 90M ZhEb2N3.apng.e7.jxl 98M ZhEb2N3.gif 106M ZhEb2N3.gif.e7.jxl 127M ZhEb2N3_s4_crf5.avif 261M ZhEb2N3_s0_crf0.avif ```
2024-09-12 12:28:46
AVIF is indeed really bad for GIF encoding, as I said lol
CrushedAsian255
2024-09-12 12:30:54
Geez how is it worse than the original GOG
2024-09-12 12:31:01
GIF *
RaveSteel
2024-09-12 12:31:09
By a factor of almost 3 nonetheless
2024-09-12 12:31:37
Kinda an achievement tbh
2024-09-12 12:31:51
Lossy AVIF larger than GIF, imagine
CrushedAsian255
2024-09-12 12:32:35
Is AVIF the only one that wasn’t lossless?
2024-09-12 12:32:39
Or was JXL lossy?
RaveSteel
2024-09-12 12:32:54
All lossless except for the two AVIFs
CrushedAsian255
2024-09-12 12:33:18
Lossy AVIF beaten by lossless WebP 🤣
RaveSteel
2024-09-12 12:33:25
Yup
CrushedAsian255
2024-09-12 12:33:41
What were the encore times?
RaveSteel
2024-09-12 12:34:24
A few minutes for everything except for the e10, those were around 50 minutes each
2024-09-12 12:34:41
The lossless AVIF also took around 10-15 minutes
CrushedAsian255
2024-09-12 12:35:07
Still, e7 JXL beat AVIF crf0 and crf5 so just use JXL
2024-09-12 12:35:18
unless you have 50 minutes to do an e10
RaveSteel
2024-09-12 12:35:33
Agreed
CrushedAsian255
2024-09-12 12:36:01
Tbh WebP, not bad
RaveSteel
2024-09-12 12:36:27
Sometimes lossless AVIF beats lossless WebP, but yes, very much depending on the content
CrushedAsian255
2024-09-12 12:37:12
Speed?
RaveSteel
2024-09-12 12:37:34
WebP is much faster, but for me storage is more important
2024-09-12 12:38:03
The WebP was btw also encoded at the highest compression
2024-09-12 12:49:50
WebP also has the big disadvantage that it cannot be played by media players with FFmpeg backend because its libwebp integration is broken since years ago
jonnyawsom3
RaveSteel By a factor of almost 3 nonetheless
2024-09-12 01:32:01
Probably because GIF, PNG and (Kinda) JXL use an 8 bit palette, AVIF would've been turning it into 24 bit
Orum
RaveSteel All lossless except for the two AVIFs
2024-09-12 01:39:06
I see 3 AVIFs though?
RaveSteel
Orum I see 3 AVIFs though?
2024-09-12 01:39:38
Yes, two lossy AVIFs and one lossless AVIF
jonnyawsom3
2024-09-12 01:39:44
CRF0 is lossless at the bottom
Orum
2024-09-12 01:39:53
CRF 0 isn't lossless though <:Thonk:805904896879493180>
RaveSteel
2024-09-12 01:40:33
It wasn't due to a bug in FFmpeg, formerly requiring -aom-params lossless 1, but this has been fixed, crf 0 is lossless nowadays
2024-09-12 01:42:36
Just for fun I tried using <@274048677851430913>'s Frame Stitching tool for some more results. GIF with e1 or e7 was always larger than the APNG. Encoding at e10 from the apng resulted in a filesize of just 75M, being 1MiB smaller than the previous best xd
Orum
2024-09-12 01:42:36
oh, this is in ffmpeg...
RaveSteel
2024-09-12 01:43:27
``` 75M ZhEb2N3.apng.framestitching.e10.jxl 76M ZhEb2N3.apng.e10.jxl 84M ZhEb2N3.gif.e10.jxl 90M ZhEb2N3.apng.e7.jxl 106M ZhEb2N3.gif.e7.jxl ```
Probably because GIF, PNG and (Kinda) JXL use an 8 bit palette, AVIF would've been turning it into 24 bit
2024-09-12 01:46:16
Are you sure it isn't just because AVIF's compression for content like this is bad?
jonnyawsom3
2024-09-12 02:11:30
Oh it's still awful, considering the total pixel count is around 300 Megapixels, and the lossless AVIF is 261 MB...
Kampidh
RaveSteel Just for fun I tried using <@274048677851430913>'s Frame Stitching tool for some more results. GIF with e1 or e7 was always larger than the APNG. Encoding at e10 from the apng resulted in a filesize of just 75M, being 1MiB smaller than the previous best xd
2024-09-12 06:52:51
hmm my tool didn't have auto-cropping ability like ffmpeg's apng, wonder if that can make a big difference too~
spider-mario
RaveSteel ``` 76M ZhEb2N3.apng.e10.jxl 78M ZhEb2N3.apng 81M ZhEb2N3_z9.webp 84M ZhEb2N3.gif.e10.jxl 89M ZhEb2N3_s4_crf10.avif 90M ZhEb2N3.apng.e7.jxl 98M ZhEb2N3.gif 106M ZhEb2N3.gif.e7.jxl 127M ZhEb2N3_s4_crf5.avif 261M ZhEb2N3_s0_crf0.avif ```
2024-09-12 09:48:19
in my testing at low efforts, the jxl was quite a bit smaller if compressed from a gifsicle-optimised version of the gif; I’ll try e10 now
2024-09-12 09:48:40
ah, or perhaps the apng results in a similar effect
monad
2024-09-12 09:49:38
if you didn't flexiGIF, you didn't GIF hard enough
RaveSteel
2024-09-12 10:08:45
Does anyone know of a dataset with very large, possibly lossless images?
monad
2024-09-12 10:12:26
how large?
RaveSteel
2024-09-12 10:12:55
10-50 MB per image
2024-09-12 10:13:14
even larger would also be fine
monad
2024-09-12 10:13:31
is that uncompressed?
RaveSteel
2024-09-12 10:14:06
doesn't really matter tbh, but png or similar would be prefered
2024-09-12 10:14:46
I was thinking of creating one myself from images by NASA, but asking first may yield faster results
monad
2024-09-12 10:16:21
here's one <https://imagecompression.info/test_images/>
RaveSteel
2024-09-12 10:16:34
Thanks
monad
2024-09-12 10:20:07
You can also get the LPCB images here: <https://drive.google.com/drive/folders/1X_F_vhNwJFhPWSW3EeSa-gGhhikkOoYd>
RaveSteel
2024-09-12 10:24:33
Nice! Thank you very much
jonnyawsom3
spider-mario in my testing at low efforts, the jxl was quite a bit smaller if compressed from a gifsicle-optimised version of the gif; I’ll try e10 now
2024-09-12 11:55:39
I was about to say isn't that lossy? Then realised I'm thinking of Gifski
spider-mario
2024-09-12 12:02:06
yeah, as far as I know, it’s just about optimising palettes and “[storing] only the changed portion of each frame”
2024-09-12 12:02:14
which `cjxl` can then take advantage of
2024-09-12 12:02:22
(well, not the palettes, it will find its own)
2024-09-12 12:02:45
it doesn’t try to detect such subrectangles itself in animations, but it does reuse them from input GIFs
jonnyawsom3
2024-09-12 12:15:02
The APNG tools use the same transparency trick, but also change the actual frame dimensions to the minimum change, which cjxl can then use too. So a twinkling star will only need a 3x3 frame instead of 720x580 for example
CrushedAsian255
2024-09-12 12:15:55
can you tell cjxl to move the pane? like if you have an image scrolling by 2px each frame, can you say "last frame but translate down 2px"?
2024-09-12 12:16:21
obviously requiring extra data for the quite literal "edge cases"
jonnyawsom3
2024-09-12 12:16:55
Maybe with Kampidh's editing tool they posted a while ago
CrushedAsian255
2024-09-12 12:17:37
As in does the code stream support it?
spider-mario
2024-09-12 12:17:51
I think at least patches would make this theoretically possible
2024-09-12 12:18:06
by having one big patch that you translate progressively
2024-09-12 12:18:29
provided that the image is static
veluca
spider-mario provided that the image is static
2024-09-12 12:20:09
or efficiently delta coded? you can use patches to move stuff in a duration-0 frame and then blend on top, no?
CrushedAsian255
2024-09-12 12:20:22
How big can a patch be?
veluca
2024-09-12 12:20:32
not sure we have a limit
CrushedAsian255
2024-09-12 12:20:36
Can blending only blend certain pixels?
veluca
2024-09-12 12:20:44
alpha blending for sure, yes
CrushedAsian255
2024-09-12 12:20:52
Like if I set the pixel to transparent it skips over?
_wb_
2024-09-12 12:37:15
patch width and height are just hybriduint encoded so can be anything as long as they stay within the bounds of the referenced frame
CrushedAsian255
_wb_ patch width and height are just hybriduint encoded so can be anything as long as they stay within the bounds of the referenced frame
2024-09-12 12:39:09
just wondering, how does the whole hybriduint thing work?
2024-09-12 12:39:14
that's the part of the spec I really don't get
2024-09-12 12:39:21
the entropy coding is really advanced stuff
_wb_
2024-09-12 12:42:09
so you could definitely making an animation that is based on some scrolling background with some sprites moving around on it, like an oldschool 2D platformer game — you just make an invisible patch frame that contains the full background and all the sprites, and then in each frame take a moving window out of the background as one big patch plus a bunch of patches for the sprites. Basically all the visible frames would be patches-only so very tiny.
CrushedAsian255
_wb_ so you could definitely making an animation that is based on some scrolling background with some sprites moving around on it, like an oldschool 2D platformer game — you just make an invisible patch frame that contains the full background and all the sprites, and then in each frame take a moving window out of the background as one big patch plus a bunch of patches for the sprites. Basically all the visible frames would be patches-only so very tiny.
2024-09-12 12:48:52
sounds really fun
2024-09-12 12:49:04
someone should make a full-blown JXL patches / animation / layers tool
_wb_
CrushedAsian255 just wondering, how does the whole hybriduint thing work?
2024-09-12 12:53:27
Hybriduint is an encoding for unsigned integers that consists of reading one entropy-coded token followed by a variable number of raw bits. How to interpret it depends on the configuration (which is signaled) but generally the first few tokens are directly representing small numbers, and then there are tokens which only represent the number of bits and some of the most significant bits (optionally also some of the least significant bits), and the remaining bits are just read as raw bits. There can also be tokens that represent an lz77 match (then the token+raw bits represents the length of the match, and a next token+raw bits will be read to know the distance). The entropy coding for the tokens can be either ANS or Huffman.
CrushedAsian255
_wb_ Hybriduint is an encoding for unsigned integers that consists of reading one entropy-coded token followed by a variable number of raw bits. How to interpret it depends on the configuration (which is signaled) but generally the first few tokens are directly representing small numbers, and then there are tokens which only represent the number of bits and some of the most significant bits (optionally also some of the least significant bits), and the remaining bits are just read as raw bits. There can also be tokens that represent an lz77 match (then the token+raw bits represents the length of the match, and a next token+raw bits will be read to know the distance). The entropy coding for the tokens can be either ANS or Huffman.
2024-09-12 12:55:34
Oh, so it’s like entropy coding the first byte in a UTF-8 stream?
2024-09-12 12:55:59
Then storing the next bytes raw?
2024-09-12 01:00:36
Also since ANS has fractional bits, how does it know when to send the raw bits?
_wb_
2024-09-12 01:02:23
Basically the assumption is that usually (e.g. when encoding quantized DCT coefficients or prediction residuals), only low-amplitude numbers and the most significant bits of higher-amplitude numbers are worth using entropy coding for; the least significant bits will be basically like noise so you can just as well not bother with entropy coding and use raw bits. (it is possible to include one or more lsb in the token, this is useful because often we turn signed ints into unsigned ints by putting the sign bit at the end, and sometimes the sign bit does benefit from entropy coding)
2024-09-12 01:03:36
the final bitstream is a mix of "update the ANS state" bits (for which we always read 16 bits at a time) and just raw bits
CrushedAsian255
2024-09-12 01:04:05
So a token can mean “0110 (read 4 bits) 1” or “101 (read 9 bits)” or just “100”?
_wb_ the final bitstream is a mix of "update the ANS state" bits (for which we always read 16 bits at a time) and just raw bits
2024-09-12 01:04:22
Does it signal when it’s Update ANS?
_wb_
2024-09-12 01:06:09
no this does not need to be signaled explicitly, it just gets updated whenever it runs out of state bits — encoder and decoder just have to do this in the same way
CrushedAsian255
2024-09-12 01:07:45
How do they make sure they’re doing it the same?
_wb_
2024-09-12 01:19:17
the ANS state is an uint32 and after each read the decoder updates the state, checks if it became smaller than 1 << 16, and if it is, reads 16 more bits. The encoder just has to make sure it writes those 16 bits at the right spot.
CrushedAsian255
2024-09-12 01:21:08
Isn’t ANS read backwards though ?
2024-09-12 01:29:42
What form of ANS is JXL? uANS/ tANS / rANS?
lonjil
CrushedAsian255 What form of ANS is JXL? uANS/ tANS / rANS?
2024-09-12 01:31:51
rANS
_wb_
2024-09-12 01:34:37
it's written backwards so it can be read forwards — it's a bit annoying for the encoder since it has to buffer all symbols, then write them end-to-beginning, and then reverse the resulting bitstream again, or something like that
2024-09-12 01:35:07
(this is why we also have the option to just do Huffman — it's not as good, but a lot easier for the encoder)
RaveSteel
2024-09-12 01:53:41
I have tested a small GIF dataset with 70 items from images I had lying around. JXL, WebP, AVIF and APNG, all with lossless compression of course. e8 for JXL, speed 2 for AVIF, max compression for WebP. There were some GIFS that cjxl could not compress, failing the encode. I have attached them ``` GIF 103M total JXL 96M total WebP 97M total AVIF 313M total APNG 95M total ```
jonnyawsom3
2024-09-12 02:45:35
libjxl version?
RaveSteel
2024-09-12 02:46:51
Oh sorry, forgot to mention that. v0.10.2 36e05143
monad
2024-09-12 02:56:58
I expect the issues go back to earliest releases
jonnyawsom3
2024-09-12 02:58:10
Would've been nice to have JXL'd APNG too since it gives a rough idea of what the format can do
RaveSteel
Would've been nice to have JXL'd APNG too since it gives a rough idea of what the format can do
2024-09-12 02:58:43
I thought of doing that. Can still do it if you'd like
_wb_
2024-09-12 03:14:36
We have really pretty much neglected animation (since usually, video codecs will be a better choice anyway). Maybe we should at least add some basic encode option in libjxl that does auto frame cropping and/or auto converting kReplace frames to kAdd ones.
RaveSteel
2024-09-12 03:20:59
Video codecs are definitely the better choice for longer content, but many artists still deliver GIFs or very short animations with the intention of them looping
jonnyawsom3
2024-09-12 03:25:05
Especially in the case of Discord that disallows any sensible looping format... But then there's also pixel art too
_wb_ We have really pretty much neglected animation (since usually, video codecs will be a better choice anyway). Maybe we should at least add some basic encode option in libjxl that does auto frame cropping and/or auto converting kReplace frames to kAdd ones.
2024-09-12 03:31:16
Threaded frame encoding, difference masking/frame cropping (Likely in the same step, and calling it that for simplicity) and streamed input (Only load up to the current encoding frame) would solve pretty much every issue currently. Beat the others in speed, use the obvious optimization techniques and likely lower memory usage by a decent chunk for longer animations (If streamed GIF is feasable) 'Rolling Patches' could be another idea, only comparing the current frame to the previous, and then searching for old patches in new frames, although I've not checked the spec yet so that could be similar to how it currently works
_wb_
2024-09-12 03:48:21
the frame by frame loading is not really a libjxl problem but just cjxl being too simplistic and assuming it's fine to first load the whole input and then start encoding it. Libjxl does already support encoding one frame at a time, so it's mostly just a matter of code plumbing to change "first load the whole gif/apng, then encode all frames" into "load gif/apng frame, encode it, load next frame, encode it, etc"
jonnyawsom3
2024-09-12 04:04:44
Yeah, just thought I'd write down all the ideas I could come up with
CrushedAsian255
2024-09-13 02:33:06
`cjxl` seems to slowly amplify the DCT coefficients
2024-09-13 02:34:36
gradually infecting the image with black and white lines
2024-09-13 02:35:55
as the file size slowly creeps up
2024-09-13 02:36:07
probably due to the hybriduints having more raw bits
2024-09-13 02:38:27
currently generating a video
2024-09-13 02:50:19
200 iterations per second ran until the encoder started repeating itself
2024-09-13 02:51:07
`-d 1 -e 7`
Tirr
2024-09-13 02:54:33
can you try with `--gaborish 0`?
CrushedAsian255
2024-09-13 02:59:50
sure
2024-09-13 03:02:05
now it's making things more and more yellow
2024-09-13 03:02:19
after 700 iterations
2024-09-13 03:02:28
(the previous went to 7188 iterations)
embed
2024-09-13 03:02:31
https://embed.moe/https://cdn.discordapp.com/attachments/803645746661425173/1283986089559982173/0700.jxl?ex=66e4fcbb&is=66e3ab3b&hm=44b5afd27dc8a0b33229691f08f3145f66aab695bab8d4b99eb0b3a6bfc021e0&
CrushedAsian255
2024-09-13 03:26:38
2024-09-13 03:26:51
10k iters @ 200 iters/s
2024-09-13 03:27:03
`cjxl -d 1 -e 7 --gaborish 0`
jonnyawsom3
2024-09-13 03:39:32
https://github.com/libjxl/libjxl/pull/3563 https://github.com/libjxl/libjxl/pull/3586
2024-09-13 03:39:42
Not sure what libjxl version you're using, but those might help
CrushedAsian255
Not sure what libjxl version you're using, but those might help
2024-09-13 03:40:12
i'm using release 0.10.3
2024-09-13 03:40:29
i'll retest when 0.11.0 releases
jonnyawsom3
2024-09-13 03:43:44
Apparently that might be tomorrow, or today depending on timezones
CrushedAsian255
2024-09-13 03:44:49
nice
RaveSteel
2024-09-13 09:07:31
Since the AI boom started all searches regarding datasets mainly show AI focussed datasets and websites smh
CrushedAsian255
2024-09-13 09:08:11
JPEG AI?
RaveSteel
2024-09-13 09:08:22
No, in general
2024-09-13 09:08:55
All these datasets are now intended for training AI models
2024-09-13 11:31:33
``` 1,5M OpenTTD_8K.jxl 4,1M OpenTTD_8K.png 85M OpenTTD_8K.avif ```
2024-09-13 11:31:59
This may seem like a joke, but it is not
2024-09-13 11:34:27
To give some important context, the AVIF was captured using Valve's gamescope, which uses AVIF for screenshots, so it likely is encoded at the fastest possible speed
2024-09-13 11:36:19
Ok nevermind ``` 1,5M OpenTTD_8K.jxl 4,1M OpenTTD_8K.png 85M OpenTTD_8K.avif 96M OpenTTD_8K_s0_reencode.avif ```
2024-09-13 11:40:31
Encoding times: ``` JXL 0:00.92 seconds AVIF 0:32.40 seconds ```
_wb_
2024-09-13 11:45:34
Lossless avif is basically useless. It's worse than PNG in basically all ways: it has lower limits on bit depth and image dimensions, is slower, compresses worse, and has less software support. There is not a single reason to use it.
yoochan
_wb_ Lossless avif is basically useless. It's worse than PNG in basically all ways: it has lower limits on bit depth and image dimensions, is slower, compresses worse, and has less software support. There is not a single reason to use it.
2024-09-13 11:46:53
it exists !
RaveSteel
2024-09-13 11:47:25
Sadly there is no choice in the matter for gamescope. It will always capture AVIF if lossless capture is enabled.
2024-09-13 11:48:04
I'll try to get a screenshot at 16K and higher and see how it compares lmao
Orum
2024-09-13 11:51:27
basically the only competition for lossless is between JXL and WebP, but the latter is far more limited, and rarely better than JXL
2024-09-13 11:52:12
though even xz beats JXL in some cases so it's very content dependent
jonnyawsom3
RaveSteel ``` 1,5M OpenTTD_8K.jxl 4,1M OpenTTD_8K.png 85M OpenTTD_8K.avif ```
2024-09-13 11:58:55
I was actually thinking about OpenTTD recently, after my friend took a map screenshot of our last game... 5 Gigapixels large... The screenshot function already does chunked encoding, so it *miiight?* be possible to make a JXL patch with *relatively* little effort, although using patches from the game tiles would be another very advanced, time consuming, extremely efficent way
RaveSteel Sadly there is no choice in the matter for gamescope. It will always capture AVIF if lossless capture is enabled.
2024-09-13 12:02:43
I doubt you're using HDR by any chance?
RaveSteel
2024-09-13 12:02:57
Sadly not
2024-09-13 12:03:04
No HDR display available
jonnyawsom3
2024-09-13 12:03:31
Huh... Because AVIF should only enable when HDR is in use, both in Steam and the gamescope code I just looked at
RaveSteel
2024-09-13 12:04:54
AVIF capture is enabled if lossless capture is enabled
jonnyawsom3
2024-09-13 12:05:28
Ah, just checked and it was HDR screenshots only being enabled if AVIF is also enabled on gamescope
RaveSteel
2024-09-13 12:06:02
I was thinking of opening a feature request on the gamescope github to ask for libjxl support
jonnyawsom3
2024-09-13 12:06:38
`rgbAvifImage.format = AVIF_RGB_FORMAT_RGB` Well, at least they are actually lossless for once `pEncoder->speed = AVIF_SPEED_FASTEST;` And it seems like you were right, maybe just different versions?
RaveSteel I was thinking of opening a feature request on the gamescope github to ask for libjxl support
2024-09-13 12:07:06
Show the compression results and I doubt they'll have a reason to say no :P