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

libjxl

_wb_
2021-04-14 04:03:49
Could probably also do strips of 2048x256 within those tiles
2021-04-14 04:04:11
But I guess 4 megapixel units should be good enough
2021-04-14 04:05:04
We designed the bitstream to be ok for huge images, but we focused the implementation on the web use case for now, since we think it is most critical for adoption
tufty
2021-04-14 04:05:46
sure, it's a marginal thing, I agree anyway, thank you for your help
_wb_
2021-04-14 04:07:00
Well it's something I want to have too at some point, especially decoding in chunks
tufty
2021-04-14 04:07:57
something like libjpeg shrink-on-load would be very handy too I see you can read out the DC components, is anything more on those lines planned?
_wb_
2021-04-14 04:09:19
For now we focus on what is needed for progressive decode (again, the web use case), which is not entirely the same as shrink-on-load but similar
tufty
2021-04-14 04:09:47
yes, we'd like shrink-on-load to help with eg. fast thumbnail generation
_wb_
2021-04-14 04:10:49
1:8 is always first in the bitstream (at least in the vardct case), so for thumbnail generation that is often good enough
tufty
2021-04-14 04:12:00
yes, that sounds great we'll probably merge load and save for the next release and tag it as experimental thanks for this nice thing btw
_wb_
2021-04-14 04:14:19
Are you a libvips dev?
tufty
2021-04-14 04:14:29
yes, it's my baby
_wb_
2021-04-14 04:14:32
Cool
2021-04-14 04:15:21
Libvips looks like it could be useful for Cloudinary's use case too
spider-mario
2021-04-14 04:15:38
that’s very nice, I had come across it before and it seemed very appealing
2021-04-14 04:16:04
it made me wish I had ideas of stuff to implement so that I could use it πŸ˜„
_wb_
2021-04-14 04:16:14
We are currently doing a lot with ImageMagick that could probably also be done with libvips
tufty
2021-04-14 04:17:20
is cloudinary still using graphicsmagick? yes, libvips ought to be quicker and use less memory, though of course you can make benchmarks fall either way
_wb_
2021-04-14 04:18:25
We use imagemagick for lots of things, and my own code for some of the hot paths
2021-04-14 04:18:43
I use opencv too for some stuff
tufty
2021-04-14 04:19:09
oh, nice
2021-04-14 04:19:54
opencv used to have rather slow read and write, though it was very quick once you had the image in memory I've not timed it for a while now
_wb_
2021-04-14 04:20:44
I don't use the opencv image format stuff, just things like convolutions are quite fast in it
tufty
2021-04-14 04:21:58
I think libvips convolutions are a bit quicker, but again you'd need benchmarks etc. libvips does run-time AVX2 code generation for conv
2021-04-14 04:22:59
oh, and it's threaded too, of course anyway ... off topic
_wb_
2021-04-14 04:23:16
For image loading/writing I just use libjpeg-turbo/mozjpeg directly. For PSD and TIFF I wrote my own decoder to do downscale on decode
2021-04-14 04:24:01
We do everything single-threaded, we have enough image-level parallelism anyway
2021-04-14 04:25:03
We decode/process/encode about 5k images per second on average iirc
tufty
2021-04-14 04:25:27
wow that's a lot!
2021-04-14 04:25:47
would image-level threading lower latency, perhaps?
_wb_
2021-04-14 04:26:09
It would, but latency is only for first request anyway
2021-04-14 04:26:46
So most customers don't care that much about it, as long as we can keep it below one or two seconds
2021-04-14 04:27:19
Subsequent requests are cached with several layers of caching so they get fast responses anyway
2021-04-14 04:27:54
For video we of course need to parallelize, but for images so far we don't
tufty
2021-04-14 04:28:37
if latency were much lower you'd need less caching, which might translate into infrastructure savings I guess
_wb_
2021-04-14 04:30:08
Caching is cheaper than cpu costs
2021-04-14 04:31:14
Also to get good latency (on most requests) you need caching close to the end user, but CDN edges don't have enough compute to do what we want
tufty
2021-04-14 04:31:34
I think that depends -- storage can be expensive one of those tricky things you have to look at in detail to make a calculation
2021-04-14 04:32:12
true, you certainly don't want edge nodes doing anything serious
_wb_
2021-04-14 04:32:28
Yes, there are many trade-offs and it's tricky to make good decisions
2021-04-14 04:32:45
We have considered going multithreaded for avif encoding πŸ˜…
tufty
2021-04-14 04:33:01
haha I bet!
2021-04-14 04:33:11
avif is a beast
BlueSwordM
2021-04-15 03:43:29
Huh, that's an interesting bug report: https://gitlab.com/wg1/jpeg-xl/-/issues/211
2021-04-15 03:43:41
I don't have that issue with Clang/LLVM12 on OpenMandriva latest.
Deleted User
2021-04-20 01:17:53
Are we still in an active development phase? The last release was almost one month ago. <:ugly:805106754668068868>
Crixis
2021-04-20 01:42:54
they are working on chromium
_wb_
2021-04-20 01:47:46
Stuff is still happening yes, just nothing urgent/important enough to do a new release for
2021-04-20 01:48:50
Also this week it is JPEG meeting week, which keeps some of us like me quite busy
Scientia
2021-04-20 06:34:37
Can't wait til next sync with the jxl_from_tree improvements <:BlobYay:806132268186861619>
Nova Aurora
2021-04-20 06:35:34
How long until standardization?
_wb_
2021-04-20 06:45:41
Standardization of what?
Nova Aurora
2021-04-20 06:46:39
Final published IS
_wb_
2021-04-20 06:49:28
ISO/IEC 18181 part 1 (the jxl codestream) is basically done: the FDIS text was ready in January, we are now waiting for the ballot results which we will probably have in July if all goes well. Then before it actually becomes a published IS depends mostly on the speed of the ISO editors and the process I guess, but in practice it doesn't matter that much: after FDIS no more technical changes can be made so the spec is final (modulo later corrigenda, revisions and amendments, but that is always the case).
Nova Aurora
2021-04-20 06:50:12
So sounds like autumn to me <:Poggers:805392625934663710>
_wb_
2021-04-20 06:51:31
Part 2, the file format, i.e. how to add exif/xmp metadata to a codestream and how to reconstruct a jpeg bitstream (not pixels but a bit-exact jpeg file), we hope to advance to FDIS in the current JPEG meeting, so to be approved on Friday if all goes well.
2021-04-20 06:53:05
So part 2 will probably be 2022 already before it's a published IS, but technically we are in agreement on what it will be and the current implementation already does things that are conforming to what will be the final part 2 spec.
2021-04-20 06:54:17
Part 3, conformance testing, is currently only a working draft and we hope to advance it to CD (committee draft) status at this meeting. If the CD ballot approves, we can then move to DIS and FDIS and IS.
2021-04-20 06:54:52
Part 4, reference software, was approved as a CD and we hope to advance it to DIS stage at this meeting.
2021-04-20 06:57:45
In practice, the adoption can start now, it does not need to wait for the slow ISO process to complete. Before FDIS of part 1 it was premature, since the bitstream could still change, but since January it can be used in practice.
Nova Aurora
2021-04-20 06:58:42
I was just asking because some people think if it's still a draft standard, people will think it's not ready'
veluca
2021-04-20 07:14:02
well, technically it is a (Final) Draft International Standard
2021-04-20 07:14:22
but it is perhaps not obvious that no technical changes can be made at that point
zebefree
2021-04-20 07:54:13
Adoption isn't going to take off if people can't get the spec. Can they add it to https://standards.iso.org/ittf/PubliclyAvailableStandards/index.html ? Is that a topic for this meeting?
_wb_
2021-04-20 08:12:48
we have brought it up but so far the answer seems to be no
Scientia
2021-04-20 08:14:03
So the spec will always be behind the ISO paywall, or are there going to be different versions of the spec from different organizations?
2021-04-20 08:14:09
Just interested
fab
2021-04-20 08:14:35
not understood, it's the ISO or the jpeg that wants the spec to not be public
Scientia
2021-04-20 08:14:48
It's ISO
fab
2021-04-20 08:15:17
but jpeg why has iso standards
2021-04-20 08:15:32
even vp9 has it?
Scientia
2021-04-20 08:15:32
So it can have a standard
2021-04-20 08:15:50
It needs it for adoption and just to be standardized
2021-04-20 08:16:02
vp9 I'm almost sure has it
fab
2021-04-20 08:16:03
what it iso, what works do Jon for that?
Scientia
2021-04-20 08:19:06
It's just how they chose to standardize, Jon can probably say why, it probably has something to do with it being a jpeg format
fab
2021-04-20 08:19:14
or a vp9 developer
2021-04-20 08:19:26
what they did
veluca
2021-04-20 08:19:51
I don't quite understand what makes it possible i.e. for hevc to have a public standard and for JPEG XL not to
2021-04-20 08:20:31
anyway, the code of the reference implementation is a sufficient approximation of a spec for now IMHO - and in the longer term, we'll likely write something outside of ISO itself that can be used as a spec...
fab
2021-04-20 08:20:34
dou you all attend ISO
2021-04-20 08:20:40
or conferences
2021-04-20 08:20:57
13 hours only Jon
2021-04-20 08:21:02
or also others
Scientia
2021-04-20 08:21:04
Jon said he was doing a lot of jpeg conferences but idk about ISO
fab
2021-04-20 08:21:06
like veluca
2021-04-20 08:21:16
or every nationality and every member
2021-04-20 08:21:23
who has created the standard
2021-04-20 08:21:27
as far i read
veluca
2021-04-20 08:21:58
JPEG is Joint Photograpic Expert Group, where Joint means it is part of ISO and a bunch of other things
fab
2021-04-20 08:22:23
ok
2021-04-20 08:22:33
also you attended 13 hours of conferences
veluca
2021-04-20 08:22:40
ISO, IEC, ITU
Scientia
2021-04-20 08:22:41
Well that explains my question about why you standardized via ISO ( :
fab
2021-04-20 08:22:41
or did you have permission to leave earlier ??
veluca
2021-04-20 08:23:25
how does it? πŸ˜›
2021-04-20 08:23:50
there was a call for proposals from ISO a while back, PIK and FLIF decided to participate and join forces and make JPEG XL
2021-04-20 08:23:56
(it's a tl;dr)
2021-04-20 08:24:25
I was not involved yet when this happened (I started working at Google and on JPEG XL in September 2018, the call for proposal was before that)
Scientia
2021-04-20 08:25:02
I mean jpeg is a part of ISO so it makes sense that a standard from jpeg would make their standard with ISO
veluca
2021-04-20 08:25:11
yes, of course
2021-04-20 08:25:35
but the interesting part of the decision was deciding to make it a JPEG standard
Scientia
2021-04-20 08:25:41
Ohh
2021-04-20 08:25:54
I guess maybe for the jpeg name
zebefree
2021-04-20 08:26:03
Can we make a FLIFv2 that adopts all of the changes made by JPEG XL from its FLIF origin, and then publicly release that spec?
veluca
2021-04-20 08:26:09
probably at least in part πŸ˜„
Scientia
2021-04-20 08:26:15
Since it's supposed to succeed jpeg
2021-04-20 08:26:18
And PNG
veluca
2021-04-20 08:26:29
we can make a public not-officially-a-spec of JPEG XL with no issues
2021-04-20 08:26:48
except for the time it would take to write it (tl;dr: a while xD)
fab
2021-04-20 08:27:28
no jpeg xl is enough for at least 10 years
2021-04-20 08:27:40
and will be for the public
veluca
2021-04-20 08:28:22
I wrote a fairly large chunk of the JXL spec (of course with lots of help from others, but still), and let me tell you - not looking forward to doing it again
2021-04-20 08:29:24
having said that - the next ISO meeting is at 6 am tomorrow morning, and my brain requires sleep πŸ˜†
_wb_
2021-04-20 09:06:47
2021-04-20 09:08:50
time to sleep indeed, again a 6 am session tomorrow
Scope
2021-04-21 06:07:44
`jpeg-xl-ab7c5e9b-mingw64-avx2` <https://encode.su/threads/3564-JXL-version-0-3-released?p=69454&viewfull=1#post69454>
Scientia
2021-04-22 10:44:56
how do you actually install jxl after compiling from ci.sh?
2021-04-22 10:45:14
like the equivalent of `make install`
2021-04-23 01:18:33
figured it out after reading more documentation myself
2021-04-23 01:19:00
after running ci.sh you go to the build dir and use `sudo cmake --install .` this command
2021-04-23 01:19:12
<:Hypers:808826266060193874>
monad
2021-04-23 06:43:37
`make install` should work too
Scientia
2021-04-23 07:09:55
Nah, ci.sh doesn't make a makefile
2021-04-23 07:10:00
For some reason
2021-04-23 07:10:21
But it does make the cmake files needed to install it with the above command ( :
veluca
2021-04-23 07:15:41
you can also do `ninja install` πŸ˜›
2021-04-23 07:16:08
(ci.sh uses ninja instead of make, it is slightly faster to figure out what to rebuild IIRC - also less verbose)
Scientia
2021-04-23 07:22:12
interesting
Jake
2021-04-25 08:29:03
Sigh
2021-04-25 08:29:31
vcpkg is complaining about there being no visual studio instances.
2021-04-25 08:29:36
When I have visual studio installed.
2021-04-25 08:34:46
This is why I hate compiling things.
2021-04-25 08:38:02
Oh, thanks for that link, Scope.
2021-04-25 08:43:30
Well, my processor didn't seem to like that build.
2021-04-25 08:43:55
It's late, I'll figure it out in the morning.
Scope
2021-04-25 08:44:07
<#822120855449894942>
2021-04-25 08:44:40
(there are also non-AVX2 builds)
Jake
2021-04-25 08:45:07
Yeah, that's probably why it didn't work. Didn't notice that was AVX2.
veluca
2021-04-25 11:46:19
unless it's avx2-only it ought to work though
BlueSwordM
2021-05-04 05:59:19
Oh, that's the Firefox guy who's working on JXL: https://gitlab.com/wg1/jpeg-xl/-/issues/226
_wb_
2021-05-04 07:27:34
Yes, related. Maybe the issue was found when adding a test example to firefox...
2021-05-04 07:28:31
but like I answered, this isn't actually an issue, you just cannot assume a jpeg decodes to the same pixels with every jpeg decoder
2021-05-04 07:29:30
(this is one of the reasons why I don't consider "JPEG -> PNG -> lossless compression in whatever format" to be an actually fully lossless thing to do)
2021-05-04 08:28:03
Well, we do have a very different API than libjpeg-turbo, so we could certainly not be just a drop-in replacement for libjpeg-turbo where applications that support jpeg via libjpeg-turbo would suddenly support jxl too. That wouldn't work for various reasons, even if we would spend the effort to mimick libjpeg's API, since: - some applications use the low-level api and expect to be able to get access to the raw DCT8x8 coefficients etc (something that doesn't exist in the case of generic VarDCT or modular) - applications would only get 8-bit RGB, no alpha, no high bit depth, no animation
2021-05-04 08:30:37
What we _could_ do however is to make the libjxl decoder also take JPEG bitstreams as input, and decode it to pixels in the same way as if you'd recompress it as jxl and decode that to pixels (but of course without the intermediate step of doing the recompression). That way, applications that support libjxl would no longer need to link to libjpeg(-turbo) to be able to load JPEG files.
2021-05-04 08:35:07
Assuming a single libjxl for both encode and decode, that would come at nearly no cost in binary size, since the jxl encoder needs to be able to parse JPEG input anyway (to do lossless recompression). Only if you want a decode-only libjxl_dec, it would add a bit to the binary size of the decoder if it also has to handle jpeg inputs directly. But still a lot less than having to ship/statically link to both libjxl_dec **and** libjpeg_turbo.
2021-05-04 09:25:14
https://jpeg.org/jpeg/software.html
2021-05-04 09:30:40
they are currently actually making ISO/IEC 10918-7, 2nd edition that contains some version of both of these, so they are actual reference implementations
2021-05-04 09:31:24
but ISO of course doesn't want to be sued over a bug, nor play helpdesk for people who have some compilation issue or something
2021-05-04 09:31:40
those are as official as it gets
2021-05-04 09:33:10
see https://jpeg.org/jpeg2000/software.html for an example
2021-05-04 09:34:27
(I suppose they will soon add "Reference software (active)" in the "Notes" column for both libjpeg-turbo and libjpeg)
2021-05-04 09:36:43
for JPEG 2000 there is one active reference software (OpenJPEG) and two old ones (JasPer and JJ2000) that are no longer maintained afaik but they are still considered reference software (described in part 5 of the j2k standard, I assume)
2021-05-04 09:37:40
and then they mention Kakadu and ffmpeg on the software page but they are not official reference software
2021-05-04 09:39:01
only time will tell. At the moment I see no reason for forks or maintenance stopping, I think the current libjxl devs have pretty much aligned goals and targets for it
2021-05-04 09:40:23
libjpeg-turbo was a fork specifically aimed at speed, I don't know why they couldn't just contribute the simd patches directly to the original IJG implementation but maybe they didn't want them (sometimes slow and simple code has its advantages too)
2021-05-04 09:41:39
mozjpeg was a fork specifically aimed at better but slower compression, and it could not be done without forking because libjpeg-turbo is aimed specifically at maximum speed and doesn't care (much) about better compression
2021-05-04 09:43:16
then there's Thomas Richter's libjpeg (https://github.com/thorfdbg/libjpeg), also confusingly named libjpeg but not related to the original IJG libjpeg, which aims at completeness: it actually implements everything in the JPEG spec, including exotic things the other implementations never bothered to implement.
2021-05-04 09:45:47
completeness/correctness, speed, and good compression are to some extent contradictory targets, and that naturally leads to differences of opinion and possibly forks
2021-05-04 09:47:04
(there's also the story of the IJG libjpeg where they at some point started adding new stuff that isn't in the spec, pissing off everyone else)
2021-05-04 09:52:27
Anyway, for libjxl we aim at providing several trade-offs between speed and compression (so that is unlikely to lead to a fork, we just have encode stuff disabled at faster speed settings if it's too slow), and we also aim at being complete, because if there is one lesson to learn from the old JPEG, it is that partial implementations lead to *de facto* standards that are just that subset of the spec β€” if there had been complete implementations of JPEG (and a not-hastily-designed file format) from the start, then things like lossless JPEG, 12-bit JPEG, JPEGs with alpha, somewhat better compressed JPEGs with arithmetic coding, etc would all have been there all the time (those are all in the 1992 spec!) - probably even making PNG redundant.
2021-05-04 09:53:19
So I do not anticipate any major disagreements on what direction to go with libjxl.
2021-05-04 09:53:34
But you can never predict the future of course, who knows what will happen in 20 years.
Crixis
2021-05-04 10:17:24
it fail, cjxl fail also with cmyk jpeg
_wb_
2021-05-04 11:01:21
We fail on anything that is inconvenient/impossible to do with VarDCT
Deleted User
_wb_ What we _could_ do however is to make the libjxl decoder also take JPEG bitstreams as input, and decode it to pixels in the same way as if you'd recompress it as jxl and decode that to pixels (but of course without the intermediate step of doing the recompression). That way, applications that support libjxl would no longer need to link to libjpeg(-turbo) to be able to load JPEG files.
2021-05-04 12:52:10
Please make this happen! πŸ‘ 🀩 πŸ‘ libjxl produces noticeable less banding than libjpeg on many JPEGs.
_wb_
_wb_ We fail on anything that is inconvenient/impossible to do with VarDCT
2021-05-04 01:02:23
(which means: CMYK we don't do because varDCT expects 3 color channels, weird subsampling factors like 3x subsampled we don't do because it doesn't happen in the wild and we haven't implemented it, and things that are in the spec but most decoders don't decode we also don't do, like arithmetic coding, hierarchical, 12-bit, lossless, etc. Nearly all JPEGs that exist in the wild (with exception of CMYK ones) can be losslessly recompressed though.)
Please make this happen! πŸ‘ 🀩 πŸ‘ libjxl produces noticeable less banding than libjpeg on many JPEGs.
2021-05-04 01:04:11
maybe open a gitlab issue with this as a feature request for it, to remind us. I think it's a good idea, but it needs to be discussed because there are also potential downsides (decoder binary size grows, attack surface w.r.t. security grows, etc).
fab
2021-05-04 02:25:19
but now that you set 1 gb limit for RAM in web jxl
2021-05-04 02:25:48
what happen when you load a 7000x6000 reddit image on reddit
2021-05-04 02:26:07
for decoding i used 1,2 gb ram on modular
2021-05-04 02:26:13
with 6000 weight
Pieter
2021-05-04 02:26:17
it is alllowed to refuse decoding it
fab
2021-05-04 02:27:04
with vardct it will use at least 2 gb ram
2021-05-04 02:27:17
that's on sse4.1
2021-05-04 02:27:29
and people who have new computers?
2021-05-04 02:27:34
all basically?
2021-05-04 02:27:47
how they will watch gs on reddit
2021-05-04 02:28:14
is already decided
2021-05-04 02:28:22
can't we make a petition
Pieter
2021-05-04 02:28:32
the layers/profiles don't care about actual decoder memory, but on general properties like resolution
fab
2021-05-04 02:28:44
ah thanks
_wb_
2021-05-04 02:30:00
it is kind of always the case that if you don't have the memory, it won't work.
fab
2021-05-04 02:30:43
with jpg there is an imposition to resize the size
2021-05-04 02:30:48
we don't want resize the size
2021-05-04 02:30:51
we want full size
2021-05-04 02:30:56
wallpapers
2021-05-04 02:30:58
images
2021-05-04 02:31:01
whatever is
2021-05-04 02:31:08
7000x5460 at least
2021-05-04 02:31:27
what is limit on ram and resolution?
2021-05-04 02:59:06
?
_wb_
2021-05-04 03:18:59
Level 5 is limited to 2^18 pixels in width or height (262144 pixels), and 2^28 total pixels (268 megapixels).
2021-05-04 03:20:07
Level 10 is limited to 2^30 pixels in width or height (a gigapixel in just one row or column) and 2^40 total pixels (one terapixel)
2021-05-04 03:22:21
Since the current encoder/decoder don't do chunked encoding / cropped decoding yet, with the current implementation you need at least ~4 (and usually more like ~7) bytes of memory per pixel to be able to decode an image.
2021-05-04 03:23:06
so for a terapixel image you need ~7 terabytes of memory, which obviously nobody actually has
monad
2021-05-04 03:26:49
Do you anticipate encoder trade-offs for memory vs cpu time in the future?
fab
2021-05-04 03:55:06
ah ok so no problem
2021-05-04 03:55:18
we'll see 42 mpx images
Pieter
2021-05-04 03:57:21
<@794205442175402004> So with the current codebase, you can't write a level 5 compliant decoder with less than 2 GIB of RAM?
_wb_
2021-05-04 04:04:17
Compliance tests will not include such huge images, and for a (software) decoder it is fine if it depends on available memory, it is just not allowed to flat out refuse to decode an image because it is "too large" even if it does have the memory to decode it
Pieter
2021-05-04 04:08:41
fair
_wb_
2021-05-04 04:11:06
It is allowed to refuse to decode a 300000x1 image if it wants to, even if that's not a big number of pixels
2021-05-04 04:11:34
(and still conform to level 5)
fab
2021-05-04 04:15:56
and mobile
2021-05-04 04:16:00
what they will do
_wb_
2021-05-04 04:16:12
In practice, likely in browsers they won't actually check any size limit, and maybe just fail to allocate the memory and show a broken image or a crashed tab
fab
2021-05-04 04:16:14
likely what resolution will load reddit mobile
2021-05-04 04:16:27
if there is no webp copy
2021-05-04 04:16:31
what they will do
2021-05-04 04:16:34
load a 42 mpx jxl
2021-05-04 04:16:39
and use 2,5 gb of ram
2021-05-04 04:16:52
not sure if now is less with new 0.4.0 branch
_wb_
2021-05-04 04:16:53
Most websites that take user uploaded images enforce dimension limits of their own
fab
2021-05-04 04:17:07
reddit i have seen 42 mpx images
2021-05-04 04:17:21
you can upload italy
_wb_
2021-05-04 04:18:12
42 megapixels are 126 megabytes uncompressed whatever format you use, and likely 168 megabytes since usually rgba buffers are used
2021-05-04 04:18:28
(for HDR you can double that number)
fab
2021-05-04 04:18:45
so jxl get coded to png
2021-05-04 04:18:49
before reading it
_wb_
2021-05-04 04:18:56
It is not very different between jpeg, png and jxl
fab
2021-05-04 04:18:59
or it needs only for editing
2021-05-04 04:19:26
UNTIL gimp plugin comes
2021-05-04 04:19:30
how it works
_wb_
2021-05-04 04:38:04
I do not understand what your question is.
fab
2021-05-04 05:42:38
when someone opens a jxl in chrome
2021-05-04 05:42:50
what happen in %appdata temp
2021-05-04 05:42:58
does it creates a png file
2021-05-04 05:43:17
what happens with gimp
2021-05-04 05:43:24
what happens with other software
2021-05-04 05:43:54
what happened with old jpeg
2021-05-04 05:44:09
what is the standardized behaviour of jpeg, jpeg xl
_wb_
2021-05-04 05:49:08
When you open a jxl in chrome it decodes it to memory
2021-05-04 05:49:31
Creating a png file is more effort than decoding a typical jxl
fab
2021-05-04 05:56:55
ok
Scientia
fab UNTIL gimp plugin comes
2021-05-04 07:41:08
the gimp plugin is already existent, though i don't think it can write unless you compile with a specific flag
improver
2021-05-04 07:55:58
i think file format signatures as used in that plugin are outdated
Scientia
2021-05-04 09:27:19
it was able to open my jxl files okay
tufty
2021-05-05 12:01:29
FYI ... libvips has merged jxl support to master and it's now being fuzzed! no bugs found yet, I guess you've already fuzzed a lot jxl support should be a feature of libvips 8.11 (due in a month or so), and then appear in downstream projects like sharp etc. no animation support yet, but most other features are exposed (I think)
veluca
2021-05-05 12:05:15
yes, we're doing quite a lot of fuzzing ourselves too πŸ™‚ but more fuzzing is always good!
2021-05-05 12:39:59
I don't know if it offers more than fuzzing with Google's internal fuzzer πŸ˜›
2021-05-05 12:40:57
(it's probably the same thing)
_wb_
2021-05-05 12:50:50
(to the tune of "Smelly Cat") β™« Fuzzer-bug, fuzzer-bug What are they feeding you Fuzzer-bug, fuzzer-bug It's not your fault β™«
Deleted User
2021-05-05 02:02:39
Is it possible to do a lossless transcode from JPEG to XL plus also adding noise=1 to the JXL?
2021-05-05 02:04:11
Or more generally asked: Could the noise parameter be changed by adding/removing a few JXL bytes?
2021-05-05 02:06:57
If I understood correctly (I think <@!179701849576833024> talked about it), then it is simply a signal for the decoder to display noise.
veluca
2021-05-05 03:01:03
it tells the encoder to, in lossy mode, try to figure out a good noise model for the image
Deleted User
2021-05-05 03:04:07
Is it possible to simply add the noise model of a specific JXL to another JXL?
veluca
2021-05-05 03:15:30
not unless you change the source code yourself atm
_wb_
2021-05-05 03:30:21
So yes, bitstream-wise, and no, current tooling wise.
Deleted User
2021-05-05 04:06:16
(I probably should have started this conversation in another channel.) I would just like to try out how noise would look on a transcoded JPEG. Is there a way to detect the appropriate offset where generic noise can be added to such file (when only having the bitstream)?
_wb_
2021-05-05 04:18:46
Editing jxl bitstreams in a hex editor is near impossible, because headers are not byte aligned and data is ANS encoded (so changing one value often causes many bytes to change)
2021-05-05 04:19:41
It will be easier to just hack the encoder code to override noise with some hardcoded values.
2021-05-05 04:21:06
(not sure if noise in non-XYB is allowed/implemented, <@179701849576833024> do you know?)
veluca
2021-05-05 04:31:40
allowed, yes. implemented, also (at least in the decoder). will do something sensible... eh...
2021-05-05 04:32:24
probably yes in YCbCr, but otherwise, I wouldn't bet on it
_wb_
2021-05-05 04:36:00
RGB is not _that_ different from XYB (it just has a poor man's luma that is just G, and a weird X that is R)
Deleted User
2021-05-05 05:11:50
A Hamming distance of 2 is practically nothing! πŸ˜„
tufty
2021-05-06 12:03:24
yes, libvips is fuzzing libjxl on google's oss-fuzz: https://github.com/google/oss-fuzz/blob/master/projects/libvips/build.sh#L147-L185 no more features than the usual clang fuzzers afaik, but they throw a lot of cpu at it and have nice tooling etc.
2021-05-06 12:08:04
it's just an experiment, we only added libjxl fuzzing two days ago (I think)
KAGAMI
2021-05-06 05:38:43
I got a question about security multiple times: is libjxl being fuzzed?
_wb_
2021-05-06 05:39:36
Oh yes
2021-05-06 05:43:06
2021-05-06 05:45:16
Still finding fuzzerbugs too, though I do have the feeling that the cases are getting more exotic and we will soon be at a point where it becomes hard to find another fuzzerbug
veluca
2021-05-06 05:46:44
branch 0.4.x should be the "more stable" branch going forward, where we include new commits etc only if they've been fuzzed for a while or are bug fixes
2021-05-06 05:46:54
(well, until a 0.5.x branch exists)
tufty
2021-05-07 07:18:27
git master is failing to build for me on ubuntu 20.10, perhaps it's getting confused between the system brotli and the built-in one? I see: $ cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=OFF .. ... $ cmake --build . ... [ 73%] Building C object third_party/brotli/CMakeFiles/brotlidec.dir/c/dec/state.c.o [ 74%] Linking C shared library libbrotlidec.so /usr/bin/cmake: symbol lookup error: /lib/x86_64-linux-gnu/libbrotlidec.so.1: undefined symbol: _kBrotliPrefixCodeRanges gmake[2]: *** [third_party/brotli/CMakeFiles/brotlidec.dir/build.make:130: third_party/brotli/libbrotlidec.so.1.0.7] Error 127 ie. it's trying to link against the system brotli for some reason I don't understand
KAGAMI
2021-05-07 07:26:26
Hey, have Google ever hit this build problem?: https://github.com/google/highway/issues/183 I think Chromium is also in minor platforms
veluca
KAGAMI Hey, have Google ever hit this build problem?: https://github.com/google/highway/issues/183 I think Chromium is also in minor platforms
2021-05-07 07:48:19
never got that, but AFAIU it's because hwy is only implemented for x86, ppc and arm (and wasm, but whatever) and we don't really have a "fallback to non-simd" that works by default
KAGAMI
veluca never got that, but AFAIU it's because hwy is only implemented for x86, ppc and arm (and wasm, but whatever) and we don't really have a "fallback to non-simd" that works by default
2021-05-07 08:30:15
Hmm, the patch is already there, so it should be good πŸš€
2021-05-07 10:34:42
So the request is: could you update highway when you sync next time? Thanks πŸ˜‰
tufty
tufty git master is failing to build for me on ubuntu 20.10, perhaps it's getting confused between the system brotli and the built-in one? I see: $ cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=OFF .. ... $ cmake --build . ... [ 73%] Building C object third_party/brotli/CMakeFiles/brotlidec.dir/c/dec/state.c.o [ 74%] Linking C shared library libbrotlidec.so /usr/bin/cmake: symbol lookup error: /lib/x86_64-linux-gnu/libbrotlidec.so.1: undefined symbol: _kBrotliPrefixCodeRanges gmake[2]: *** [third_party/brotli/CMakeFiles/brotlidec.dir/build.make:130: third_party/brotli/libbrotlidec.so.1.0.7] Error 127 ie. it's trying to link against the system brotli for some reason I don't understand
2021-05-07 11:57:26
I had a ":" at the end of my LD_LIBRARY_PATH and cmake got confused ... sorry for the noise
Deleted User
_wb_ maybe open a gitlab issue with this as a feature request for it, to remind us. I think it's a good idea, but it needs to be discussed because there are also potential downsides (decoder binary size grows, attack surface w.r.t. security grows, etc).
2021-05-07 04:17:24
How do I assign a dev to the issue? 😁 https://gitlab.com/wg1/jpeg-xl/-/issues/232
improver
2021-05-07 05:14:40
wow it really looks perceptibly better
tufty
2021-05-07 05:34:51
I noticed something funny about libjxl lcms usage libjxl isn't setting the cmsFLAGS_NOCACHE flag, which (I think?) means you will see races there's a comment about lcms races in https://gitlab.com/wg1/jpeg-xl/-/blob/master/lib/jxl/docs/color_management.md#cms-library would adding the flag possibly fix this? note that lcms itself sets this flag when it calls cmsCreateTransformTHR(), so it would seem to be recommended
veluca
2021-05-07 05:36:15
well, we're using skcms anyway in most code paths, so I think that's not too much of a problem πŸ™‚
tufty
2021-05-07 05:36:47
Here's lcms setting the flag: https://github.com/mm2/Little-CMS/blob/master/src/cmscnvrt.c#L1029 the cache being referred to is a one-pixel cache, which can help single-threaded applications, but which will race if you try to use the same transform from several threads
2021-05-07 05:38:04
ah, ok ... as long as you never call cmsDoTransform() from several threads I'm sure it's OK
veluca
2021-05-07 05:38:05
ah, yes, I believe we workaround that in some way
tufty
2021-05-07 05:39:15
jolly good -- just a thought
Deleted User
improver wow it really looks perceptibly better
2021-05-07 05:45:36
bonus: djxl --bits_per_sample=10 (and converted back to 8 bpc)
2021-05-07 05:46:09
zero banding :O
2021-05-07 05:46:26
<@&803357352664891472> How is this possible?
2021-05-07 05:46:34
8bpc PNG to lossy 8bpc JXL to 8bpc PNG looks worse than 8bpc PNG to lossy 8bpc JXL to 10bpc PNG
veluca
2021-05-07 05:46:39
maybe it's just me, but I see quite a bit of banding πŸ˜›
Deleted User
2021-05-07 05:46:40
So JXL knows that the original PNG contained dithering or noise but won't put back this information when decoding back to the same bit depth? But is fully capable to undo SDR dithering/noise and produce true high bit depths upon request? 😲 ???
_wb_
2021-05-07 05:46:59
We don't do dithering when producing 8bit output
Deleted User
veluca maybe it's just me, but I see quite a bit of banding πŸ˜›
2021-05-07 05:47:09
Download the original.
veluca
2021-05-07 05:47:24
yeah, in the original
_wb_
2021-05-07 05:47:25
Lossy jxl is not 8bpc internally
2021-05-07 05:47:51
It's XYB and 32-bit float internally
Scientia
zero banding :O
2021-05-07 05:51:05
I can see very much of banding
2021-05-07 05:51:43
The original has less
2021-05-07 05:51:47
But it still exists
Deleted User
_wb_ It's XYB and 32-bit float internally
2021-05-07 05:52:35
I tried -c 1 and saw the same result. So JXL stores 8-bit int images as 32-bit float and still manages to save so much space? <:WhatThe:806133036059197491>
_wb_
2021-05-07 05:53:44
-c 1 doesn't do anything when recompressing jpeg or doing vardct
YAGPDB.xyz
2021-05-07 05:53:44
Unrecognized token IDENT (`doesn`) in expression
_wb_
2021-05-07 05:54:26
Lossy compression does not store pixels
2021-05-07 05:54:44
It stores quantized dct coefficients
2021-05-07 05:55:14
What it actually encodes are mostly signed integers close to zero
2021-05-07 05:56:04
But after dequantization things are done with float precision, and gradients can be without banding
Deleted User
2021-05-07 05:57:08
Would there be a noticeable difference in size when dequantization would use 8-bit internally? Or would it just look worse?
_wb_
2021-05-07 05:58:02
That would just look worse and have no impact on file size, since the bitstream only contains the quantized values
2021-05-07 05:58:24
Dequant is something the decoder does as part of the decoding process
Deleted User
_wb_ -c 1 doesn't do anything when recompressing jpeg or doing vardct
2021-05-07 05:59:24
cjxl sky.png sky.jxl --> 16 kiB
2021-05-07 05:59:48
cjxl sky.png -c 1 sky1.jxl --> 38 kiB 🀨
_wb_
2021-05-07 06:00:08
Ah if it does something then it is probably something broken
Deleted User
2021-05-07 06:01:45
Looks fine to me, the bands are slightly different.
_wb_
2021-05-07 06:06:12
I wonder what it does. VarDCT in RGB instead of XYB? I'm surprised that it even works
veluca
2021-05-07 06:14:12
it does work, it just doesn't compress well
_wb_
2021-05-07 06:14:55
It just uses the XYB quantization constants?
2021-05-07 06:15:37
Does it end up doing things in linear RGB or in whatever the input space was?
Deleted User
2021-05-07 06:15:41
<@!179701849576833024> <@!427945413669158912> Here is the direct link: <https://cdn.discordapp.com/attachments/804324493420920833/840283238223577119/10.webp>
Scientia
2021-05-07 06:16:05
I looked at the original
2021-05-07 06:16:10
There's slight banding
veluca
_wb_ It just uses the XYB quantization constants?
2021-05-07 06:16:33
yup
Scientia
2021-05-07 06:16:36
Difficult to see on my phone
veluca
_wb_ Does it end up doing things in linear RGB or in whatever the input space was?
2021-05-07 06:16:40
input space
Deleted User
Scientia Difficult to see on my phone
2021-05-07 06:17:05
Sorry, then it's your display's fault ;)
2021-05-07 06:31:31
<@!794205442175402004> Will the result be the same as dithering if the decoder would add a small bit of noise for every JXL that didn't use --noise=1?
_wb_
2021-05-07 06:32:39
Not really the same thing
2021-05-07 06:36:37
Dithering is just to render stuff nicer at 8-bit, currently we basically just round every pixel value to the nearest 8-bit integer when converting the internal floats to ints, which introduces slight banding that can be avoided with dithering (just alternating between rounding up and down in a checkerboard way would already help a bit)
Pieter
2021-05-07 06:42:50
Floyd-Steinberg?
Deleted User
2021-05-07 06:42:50
But if you add noise to the 32-bit info, trivial rounding to 8-bit wouldn't be an issue.
_wb_
2021-05-07 06:45:14
Yes, adding noise is one way to do dithering
2021-05-07 06:45:52
Doesn't need to be fancy dithering though, it's not like we're converting stuff to 1-bit
2021-05-07 07:33:32
https://c.tenor.com/QPapotlLW18AAAAM/dance-cute.gif
2021-05-07 07:34:15
We may have the first fully feature-complete decoder on the private dev repo now, with the commits <@179701849576833024> added today
username
2021-05-07 07:35:46
wait like with progressive, hdr and animation support?
_wb_
2021-05-07 07:36:21
libjxl already supported those things, there the issue is in making the chrome integration also support it
2021-05-07 07:37:28
Feature-complete in the sense that it can decode everything that is in the spec, not just the things the current encoder happens to produce
2021-05-07 07:38:38
This is an important stage, it is needed to be sure a decoder will be able to decode anything a future encoder might produce
improver
2021-05-07 07:39:30
is there test file repo for all these features?
_wb_
2021-05-07 07:39:31
We have backwards-compatibility since end of December in the sense that what the encoder produces is spec-compliant so remains decodable.
2021-05-07 07:40:04
But now we (hopefully, if we don't discover any bugs/missed cases) have forward compatibility too
improver
2021-05-07 07:40:17
i mean you guys probably already test on some kind of actual files even if theyre made by hand
veluca
_wb_ We may have the first fully feature-complete decoder on the private dev repo now, with the commits <@179701849576833024> added today
2021-05-07 07:40:39
also <@!604964375924834314>
_wb_
2021-05-07 07:41:29
Building such a test file repo and ensuring that it is covering all corners of the spec is one of the mandates for the jxl adhoc group to be done before the next jpeg meeting.
veluca
improver i mean you guys probably already test on some kind of actual files even if theyre made by hand
2021-05-07 07:41:42
most of those more exotic features are hand-tested πŸ™‚ there are a few things that have actual bitstreams in, but not everything
_wb_
2021-05-07 07:43:21
jxl art might actually be a way to add more bitstreams
2021-05-07 07:45:22
Win win: more art options, and more conformance bitstreams :)
Scope
2021-05-07 07:45:55
Splines would be nice to see
veluca
2021-05-07 07:56:39
well, a splines encoder would be hard, but a way to manually specify weird patch types and splines would be very very useful for testing...
Ringo
2021-05-07 07:58:17
ooh, jxl art as test files
Kleis Auke
tufty Here's lcms setting the flag: https://github.com/mm2/Little-CMS/blob/master/src/cmscnvrt.c#L1029 the cache being referred to is a one-pixel cache, which can help single-threaded applications, but which will race if you try to use the same transform from several threads
2021-05-07 07:58:48
I took a quick look at jpeg-xl's use of lcms. It seems that a transform is created for each thread to allow thread-safe usage. <https://gitlab.com/wg1/jpeg-xl/-/blob/040eae8105b61b312a67791213091103f4c0d034/lib/jxl/enc_color_management.cc#L869-881> <https://gitlab.com/wg1/jpeg-xl/-/blob/040eae8105b61b312a67791213091103f4c0d034/lib/jxl/enc_color_management.h#L59-60> Probably that could be replaced by creating a single transform with the `cmsFLAGS_NOCACHE` flag, similar to libvips. <https://github.com/libvips/libvips/blob/41cff4e9d0838498487a00623462204eb10ee5b8/libvips/colour/icc_transform.c#L361-L373>
veluca
Kleis Auke I took a quick look at jpeg-xl's use of lcms. It seems that a transform is created for each thread to allow thread-safe usage. <https://gitlab.com/wg1/jpeg-xl/-/blob/040eae8105b61b312a67791213091103f4c0d034/lib/jxl/enc_color_management.cc#L869-881> <https://gitlab.com/wg1/jpeg-xl/-/blob/040eae8105b61b312a67791213091103f4c0d034/lib/jxl/enc_color_management.h#L59-60> Probably that could be replaced by creating a single transform with the `cmsFLAGS_NOCACHE` flag, similar to libvips. <https://github.com/libvips/libvips/blob/41cff4e9d0838498487a00623462204eb10ee5b8/libvips/colour/icc_transform.c#L361-L373>
2021-05-07 07:59:30
<@!604964375924834314> <@!768090355546587137> are the ones that take care of that I believe πŸ˜›
spider-mario
2021-05-07 08:00:05
yes, what I recall is a `thread_local cmsContext`
2021-05-07 08:00:42
ah, or that vector, yeah
veluca
2021-05-07 08:01:13
would replacing it with a single transform with cmsFLAGS_NOCACHE make things easier in any way?
spider-mario
2021-05-07 08:01:26
now that it’s already written anyway, not sure
Kleis Auke
2021-05-07 08:07:25
It could remove that `transforms_` vector and some unnecessary `cmsCreateTransformTHR` calls, which might speed things up, otherwise there is no real benefit (I think).
Deleted User
2021-05-07 09:21:17
Can JPEG XL become an alternative to DNG in case of original, non-demosaiced data?
2021-05-07 09:22:29
It should be theoretically possible (it's been discussed before), but it was just an idea back then.
2021-05-07 09:26:32
Simple case of RGGB Bayer could be handled by saving R(G1+G2)B at half resolution (either lossless Modular or lossy VarDCT for data savings) and G1-G2 in a separate Modular channel (which could also be optionally lossily compressed). There's a problem of metadata since we have to know the original CFA order (RGGB, GRBG etc.), but it still shouldn't break forward compatibility.
2021-05-07 09:28:21
And there are other CFAs, like Huawei's RYYB, Quad Bayer, Samsung's Nonacell, Fujifilm's X-Trans, ...
2021-05-07 09:33:28
How should we decide what we put into visible RGB data (which pixels do we average and how much are they downsampled)? X-Trans can be naively downsampled into RGB in multiple ways and we have to arbitrarily decide which one to use.
2021-05-07 09:35:25
What about partially non-RGB sensors (RYYB, RGBW, RGBE) or completely non-RGB sensors (CYYM)?
2021-05-07 09:36:24
<@&803357352664891472> sorry to ping you all, but I think this problem should be solved before claiming JPEG XL fully frozen and forward compatible.
veluca
2021-05-07 09:42:43
Just to clarify, "fully frozen" is for web usage scenarios, where I don't quite think debayering patterns are exactly common (we don't ever plan to support that in Chrome, say)
2021-05-07 09:44:35
We can always make something like a second edition that includes ways to express interesting debayering patterns or stuff like that, as long as it is intended to be used in non-web scenarios (where I believe fwd compatibility is a lot less important)
_wb_
2021-05-07 09:45:13
CMYK and Bayered data are not for the web, we can add support for those but it will not be level 5 and simple decoders will not be required to decode those exactly right
Deleted User
2021-05-07 10:09:02
Let's just hope that they'll be at least *somehow* decodable in Chrome. With lowered resolution, maybe a bit worse color and brightness rendering, but it should show *something reasonable*.
2021-05-07 10:09:15
And thanks for the answer.
improver
2021-05-07 10:15:07
why do you want them? it's not like chrome can render DNGs, can it?
Deleted User
2021-05-07 10:34:32
JPEG XL could compress raw files more and with better quality while having to provide fallback RGB image (because of it being directly involved during decompressing back to Bayer, see: my "Simple case of RGGB Bayer [...] shouldn't break forward compatibility" wall of text above).
improver
2021-05-07 10:49:49
I see. Yeah I can see how it can be possible. Just not sure whether there's a lot of use for viewing them. For previewing stuff in browser before downloading to do further processing?
2021-05-07 10:51:49
Would need some additional metadata to indicate that there's extra stuff to complement image. But I think it could be done. Just not sure whether that hackyness is worth it. But it's not for me to decide.
raysar
JPEG XL could compress raw files more and with better quality while having to provide fallback RGB image (because of it being directly involved during decompressing back to Bayer, see: my "Simple case of RGGB Bayer [...] shouldn't break forward compatibility" wall of text above).
2021-05-08 04:02:27
We need a DNJXL file πŸ˜„ i'm agree, only using metadata without file format normalisation cannot be a good solution. The easy way is to force adobe to add jxl inside dng πŸ˜„
BlueSwordM
2021-05-08 04:36:06
So, I think I might have found a bug related to butteraugli...
2021-05-08 04:36:25
You see, aomenc-av1 now has `--tune=butteraugli`
2021-05-08 04:36:39
It seems to segfault after a certain number of frames when activated no matter what.
2021-05-08 04:37:41
I get this interesting atomic issue that is extremely similar to the one found here if I enable debug mode in aomenc: https://gitlab.com/wg1/jpeg-xl/-/issues/85
2021-05-08 04:37:59
`/usr/include/c++/10/bits/atomic_base.h:217: void std::atomic_flag::clear(std::memory_order): Assertion '__b != memory_order_acq_rel' failed.` <:Thonk:805904896879493180>
_wb_
Let's just hope that they'll be at least *somehow* decodable in Chrome. With lowered resolution, maybe a bit worse color and brightness rendering, but it should show *something reasonable*.
2021-05-08 04:44:54
Yes, that would happen. The deltaG channel would be ignored by applications like Chrome that do not know how to deal with it, and you'd basically get a 1:2 image.
BlueSwordM `/usr/include/c++/10/bits/atomic_base.h:217: void std::atomic_flag::clear(std::memory_order): Assertion '__b != memory_order_acq_rel' failed.` <:Thonk:805904896879493180>
2021-05-08 04:49:08
Is that with the same butteraugli code as in libjxl, or an older version of it?
BlueSwordM
_wb_ Is that with the same butteraugli code as in libjxl, or an older version of it?
2021-05-08 04:49:27
Same actually, with the current master build.
2021-05-08 04:50:24
One thing I'm noticing is that it's not clearing memory with each encoded frame, and the encoder just starts running out of memory and then segfaults randomly<:Thonk:805904896879493180>
_wb_
2021-05-08 04:51:37
Memleak? Hm probably best to open a gitlab issue to further investigate it
BlueSwordM
_wb_ Memleak? Hm probably best to open a gitlab issue to further investigate it
2021-05-08 04:52:44
There might not be a need afterall actually.
2021-05-08 04:52:51
Look what I found that does not seem to have been fixed. ```void ButteraugliComparator::ReleaseTemp() const { temp_in_use_.clear(std::memory_order_acq_rel); }```
2021-05-08 04:54:50
Was the fix actually ever merged into master?
2021-05-08 04:55:06
```void ButteraugliComparator::ReleaseTemp() const { temp_in_use_.clear(std::memory_order_release); }```
_wb_
2021-05-08 04:58:34
πŸ€”
2021-05-08 05:03:28
🀦
2021-05-08 05:51:28
Thanks for the find, <@321486891079696385> !
BlueSwordM
2021-05-08 06:01:02
No problem.
2021-05-08 06:03:16
What's interesting though is that the patched build of JXL and new aomenc still results in tune_butteraugli making the encoder crash interestingly enough.
2021-05-08 06:03:23
I'll try it out with the next JXL patch comes out since it's already quite late here.
tufty
2021-05-08 11:36:10
I think oss-fuzz might have found a nasty JXL memory bomb -- I have a 2800 byte file that needs c. 5GB of ram just to get the dimensions this is with git master libjxl file is here: http://www.rollthepotato.net/~john/mem.jxl I can open an issue if that would be helpful
2021-05-08 11:38:57
the sequence of returns from JxlDecoderProcessInput() is BASIC_INFO, COLOR_ENCODING, memuse is about 30mb at this point, all normal, then the next call to JxlDecoderProcessInput() takes a long time (several seconds), memuse jumps to 5GB and it returns DEC_ERROR
_wb_
2021-05-08 11:49:47
πŸ€”
2021-05-08 11:53:02
jxlinfo mem.jxl xsize: 130780 ysize: 108984 have_container: 0 uses_original_profile: 1 bits_per_sample: 8 exponent_bits_per_sample: 0 intensity_target: 255.000000 min_nits: 0.000000 relative_to_max_display: 0 linear_below: 0.000000 have_preview: 0 have_animation: 0 orientation: 1 num_extra_channels: 0 alpha_bits: 0 alpha_exponent_bits: 0 alpha_premultiplied: 0 color profile: format: JPEG XL encoded color profile color_space: 0 white_point: 1 white_point XY: 0.312700 0.329000 primaries: 1 red primaries XY: 0.639999 0.330010 green primaries XY: 0.300004 0.600003 blue primaries XY: 0.150002 0.059997 transfer_function: 13 rendering_intent: 1
2021-05-08 11:53:29
djxl mem.jxl Read 2998 compressed bytes [v0.3.7 | SIMD supported: Neon] No output file specified. Decoding will be performed, but the result will be discarded. ../lib/jxl/codec_in_out.h:65: JXL_FAILURE: Image too big. ../lib/jxl/dec_file.cc:117: JXL_RETURN_IF_ERROR code=1: VerifyDimensions(&io->constraints, xsize, ysize) Failed to decompress to pixels.
2021-05-08 11:54:19
jxlinfo/djxl return quickly for me
veluca
2021-05-08 11:54:48
``` luca@desktop ~/jpeg-xlm/build ξ‚ all_fuzz $ /usr/bin/time ./tools/djxl mem.jxl Read 2998 compressed bytes [v0.3.7 | SIMD supported: AVX2,SSE4,Scalar] No output file specified. Decoding will be performed, but the result will be discarded. ../lib/jxl/codec_in_out.h:65: JXL_FAILURE: Image too big. ../lib/jxl/dec_file.cc:118: JXL_RETURN_IF_ERROR code=1: VerifyDimensions(&io->constraints, xsize, ysize) Failed to decompress to pixels. Command exited with non-zero status 1 0.00user 0.00system 0:00.18elapsed 7%CPU (0avgtext+0avgdata 10220maxresident)k 0inputs+0outputs (0major+1319minor)pagefaults 0swaps ```
2021-05-08 11:55:02
also for me (but it's on the private repository, fwiw)
tufty
2021-05-08 11:58:40
huh I don't have jxlinfo, I guess I must have disabled it during build
veluca
2021-05-08 11:59:03
I think it's in examples/jxlinfo
tufty
2021-05-08 11:59:43
I think djxl is giving up after BASIC_INFO (it sees the crazy size), but it should get to JXL_DEC_NEED_IMAGE_OUT_BUFFER without needing a lot of memory, shouldn't it? I'd expect any very large amount of ram to be allocated there
veluca
2021-05-08 12:01:10
no, there's need for intermediate buffers to hold stuff that can get as large as the image itself
2021-05-08 12:01:23
(I'm working on getting rid of them, but it takes a while...)
tufty
2021-05-08 12:03:23
ah I see! at the moment when I scan a JXL image to get the metadata I call JxlDecoderProcessInput() until I see NEED_IMAGE_OUT_BUFFER but it sounds like I should stop after JXL_DEC_COLOR_ENCODING, is that correct?
veluca
2021-05-08 12:04:11
I suggest you do something similar to examples/jxlinfo.c
2021-05-08 12:04:12
πŸ™‚
tufty
2021-05-08 12:13:37
if you subscribe to JXL_DEC_COLOR_ENCODING, is it /always/ returned, even if an image has no color encoding info? the docs don't say
veluca
2021-05-08 12:15:35
there is no such thing as not having color encoding info
tufty
2021-05-08 12:16:35
ah, good to know, I'll stop after COLOR_ENCODING then, thank you!
veluca
2021-05-08 12:16:47
yw πŸ™‚
Deleted User
_wb_ Dithering is just to render stuff nicer at 8-bit, currently we basically just round every pixel value to the nearest 8-bit integer when converting the internal floats to ints, which introduces slight banding that can be avoided with dithering (just alternating between rounding up and down in a checkerboard way would already help a bit)
2021-05-08 07:53:15
Would such checkerboard dither affect solid colors or would djxl have to limit dithering to DCT gradients?
_wb_
2021-05-08 08:09:17
Hm, good question
2021-05-08 08:10:24
I suppose it depends on what the solid color is
2021-05-08 08:12:06
I would do something like instead of doing `int pixel = floatval + 0.5` (which is basically what we do now), alternate between doing + 0.25 and + 0.75
2021-05-08 08:12:52
So if the actual value of the solid color is 123.9, then it will become solid 124
2021-05-08 08:13:21
But if the actual value is 123.4, then it will checkerboard-alternate between 123 and 124
2021-05-08 08:13:38
Which kinda makes sense
Deleted User
2021-05-08 09:55:58
How would I add https://jxl-art.surma.technology/?zcode=c8osSUktKMlQMDTg4spMU%2FBTsFMw4FJQ0FUITi1BYhlxAQA%3D as a layer to a typical JXL image?
Jyrki Alakuijala
2021-05-09 04:01:30
Matt, I believe we will eventually get the dithering right in the mainstream version
2021-05-09 04:02:04
for the first launches we take minimal risk in having additional new features and additional computation
2021-05-09 04:02:50
in earlier versions (pik) we used to have 2x2 ordered dithering already
2021-05-09 04:03:54
my understanding is that quality is currently comparable (or better) than previous tech (jpeg, webp, avif)
2021-05-09 04:04:14
for the first launch is the safest to be marginally better in all attributes
2021-05-09 04:05:50
when dithering is added there are two main consequences: the smallest amount of additional computation, and compatibility with some existing systems is slightly reduced (like PNG files will be somewhat larger)
2021-05-09 04:10:23
I had asked Zoltan to add dithering in pik for the same reasons you have now and those reasons have not changed for jpeg xl
2021-05-09 04:10:52
just we consider right now decoding speed and simplicity to be even higher priorities for the first launch
2021-05-09 04:10:54
---
2021-05-09 04:11:54
if there is a degradation, i.e., jpeg xl is worse than jpeg (and other codecs) because of lack of the dithering, then the lack of dithering adds to the launch risk and we should now reconsider the removal
Deleted User
How would I add https://jxl-art.surma.technology/?zcode=c8osSUktKMlQMDTg4spMU%2FBTsFMw4FJQ0FUITi1BYhlxAQA%3D as a layer to a typical JXL image?
2021-05-09 09:00:19
Oh, by the way: https://jxl-art.surma.technology/?zcode=c8osSUktKMlQMDTg4spMU%2FBTsFMw4FJQ0FUITi1BYhkaGBgAAA%3D%3D Zoom in and you'll see a barrel distortion, zoom out and you'll get a pincushion distortion πŸ™ƒ
Jyrki Alakuijala Matt, I believe we will eventually get the dithering right in the mainstream version
2021-05-09 12:18:52
Just wondering though... is a "jxlmux" planned? (Btw, could you hire more people?^^)
Jyrki Alakuijala for the first launch is the safest to be marginally better in all attributes
2021-05-09 12:20:25
But -d 1 isn't visually lossless for gradients by default. πŸ™ƒ
Jyrki Alakuijala when dithering is added there are two main consequences: the smallest amount of additional computation, and compatibility with some existing systems is slightly reduced (like PNG files will be somewhat larger)
2021-05-09 12:22:49
Would it be better to only apply dithering when the user encoded an image with a new flag --dither=1? So you wouldn't need to worry about PNG file sizes for the default case.
Oh, by the way: https://jxl-art.surma.technology/?zcode=c8osSUktKMlQMDTg4spMU%2FBTsFMw4FJQ0FUITi1BYhkaGBgAAA%3D%3D Zoom in and you'll see a barrel distortion, zoom out and you'll get a pincushion distortion πŸ™ƒ
2021-05-09 12:27:24
Well, sadly you should also use dithering when resampling images. So: extend 8-bit to e.g. 16-bit --- convert sRGB to RGB --- scale down image (e.g. Lanczos) --- convert back to sRGB --- dither to 256 colors per channel --- drop LSBs to get final 8-bit output.
_wb_
Would it be better to only apply dithering when the user encoded an image with a new flag --dither=1? So you wouldn't need to worry about PNG file sizes for the default case.
2021-05-09 12:39:09
That cannot really be done without changing the spec
2021-05-09 12:40:07
Applications can ask for output in 32-bit float, or in 16-bit int, and then it will be up to them to dither
2021-05-09 12:41:24
But I agree that in case application ask for 8-bit int output, we can/should do some dithering to alleviate the limits of 8-bit color displays
2021-05-09 12:43:13
<@179701849576833024> what would be the speed impact of doing rounding with checkerboard-alternating 0.25f/0.75f instead of 0.5f when doing float to int?
veluca
2021-05-09 12:44:30
probably none
2021-05-09 12:44:45
I doubt it would look good though
_wb_
2021-05-09 12:45:09
There are two codepaths that produce 8-bit output: a fast one that does inverse XYB in int16, and a slow one that ends up with floats which then get converted to ints at the very end
veluca
2021-05-09 12:45:24
the int16 one is only for arm though
2021-05-09 12:46:15
there's two places where the conversion to int happens, and IIRC they use NearestInt, not +0.5 followed by a truncate
_wb_
2021-05-09 12:46:51
NearestInt does something different than that?
veluca
2021-05-09 12:46:54
so one would need to do something slightly different for getting some dithering out of it
2021-05-09 12:47:09
I think it translates to some asm instruction
2021-05-09 12:48:28
but we could replace it with +0.25 / +0.75 + truncate, probably not too different in speed
2021-05-09 12:48:46
however, I don't know if a checkerboard pattern is a good dithering pattern
_wb_
2021-05-09 12:48:53
Or do an explicit +- 0.25 before nearestint
2021-05-09 12:49:27
It's not very good, but better than nothing at all
2021-05-09 12:49:51
Could do some 4x4 pattern too I guess
veluca
2021-05-09 12:49:54
I dunno, I think it might produce visible lines
2021-05-09 12:50:13
but yes, we can use any fixed pattern easily
_wb_
2021-05-09 12:50:38
I remember a gitlab issue about this where someone tried some things
2021-05-09 12:51:15
https://gitlab.com/wg1/jpeg-xl/-/issues/136
Deleted User
2021-05-09 12:51:26
checkerboard works okayish:
veluca
2021-05-09 12:52:49
doesn't look very good to me
Deleted User
2021-05-09 12:52:50
compared to nearest int:
veluca
2021-05-09 12:53:14
(how did you generate those?)
2021-05-09 12:53:58
well, OK, it's a clear improvement πŸ˜„
2021-05-09 12:54:03
still see some banding though
_wb_
2021-05-09 12:55:40
From the gitlab issue: ``` float grid16[4][4] = {.15,.45,.35,.85, .75,.55,.25,.65, .35,.65,.45,.75, .15,.85,.55,.25}; ```
Deleted User
veluca (how did you generate those?)
2021-05-09 12:56:13
I rendered JXL to a 16-bit PNG and screened the 16-bit JXL art on top in GIMP. Conversion to 8-bit was then without additional dithering.
veluca still see some banding though
2021-05-09 12:56:48
Yes, some ordered 4x4 or 8x8 would be way better.
_wb_
2021-05-09 12:56:59
4x4 should be good for simd
2021-05-09 12:58:23
8x8 is probably overkill
2021-05-09 01:00:52
A 2x2 pattern that is not symmetric might also be slightly better, maybe
veluca
2021-05-09 01:01:47
could do 4x4 ordered dithering with no real problems
_wb_
2021-05-09 01:02:07
0.2 0.65 0.8 0.35 or so
veluca
2021-05-09 01:03:28
kinda want to try it now actually... can you share the jxl file?
_wb_
2021-05-09 01:03:28
Symmetric 2x2 only makes it effectively 9-bit, while asymmetric 2x2 makes it effectively 10-bit, right?
veluca
2021-05-09 01:03:39
<@456226577798135808>
2021-05-09 01:03:51
(unless you already did :D)
_wb_
2021-05-09 01:13:27
There's a good test image in https://gitlab.com/wg1/jpeg-xl/-/issues/136
Deleted User
Well, sadly you should also use dithering when resampling images. So: extend 8-bit to e.g. 16-bit --- convert sRGB to RGB --- scale down image (e.g. Lanczos) --- convert back to sRGB --- dither to 256 colors per channel --- drop LSBs to get final 8-bit output.
2021-05-09 01:15:08
Are you sure you responded to a right thread? I was talking about an optical illusion while in motion (it doesn't exist if you stop zooming in/out), something completely unrelated to dithering.
veluca
2021-05-09 01:30:16
2021-05-09 01:30:21
2021-05-09 01:30:32
2021-05-09 01:30:37
2021-05-09 01:30:45
this is 4x4 ordered dithering
2021-05-09 01:30:55
if it has a performance impact, I couldn't measure it
_wb_
2021-05-09 01:35:01
That's quite a visible difference - I cannot see any banding in the dithered one, while in the nondithered one it is quite obvious
veluca
2021-05-09 01:35:52
I can see some banding in both for the gray one
2021-05-09 01:36:01
but yes, it does look quite a bit better
Jim
2021-05-09 01:39:02
I see banding in all of them but more noticeable in the gray images.
_wb_
2021-05-09 01:39:42
Jim make sure not to look at discord's downscales, they suck
veluca
2021-05-09 01:39:49
(be careful about the zoom level, any kind of zooming will completely destroy the effects of dithering)
Jim
2021-05-09 01:41:04
I was looking at the original at 100%.
_wb_
2021-05-09 01:42:21
Might be good to try to get dithering in Chrome's pipeline too (because browser downscaling is quite common and will make whatever dither the decoding produces irrelevant or less relevant)
veluca
2021-05-09 01:42:24
ok then πŸ˜„ in my case I had to look at 80% as reported by chrome to actually get 100% because of some interface scaling
_wb_ Might be good to try to get dithering in Chrome's pipeline too (because browser downscaling is quite common and will make whatever dither the decoding produces irrelevant or less relevant)
2021-05-09 01:42:57
pretty hard if you store data in uint8 in the first place though - or do you mean after browser downscaling?
_wb_
2021-05-09 01:43:11
I mean after browser downscaling
Jim
2021-05-09 01:43:29
I tried in Chrome & Firefox on 2 different monitors. Noticeable in all, though even more noticeable when the image was fitted to the viewport (downscaled).
veluca
2021-05-09 01:44:32
the question though is whether the dithered versions look better or not πŸ™‚
Jim
2021-05-09 01:45:58
Very slightly better but mostly when downscaled. At 100% it seemed just as noticeable.
_wb_
2021-05-09 01:46:12
Maybe your 100% is not 1:1 then
veluca
2021-05-09 01:46:16
yeah
2021-05-09 01:46:24
can you look at them in an image viewer?
_wb_
2021-05-09 01:46:30
It is annoyingly hard to do 1:1 viewing in browsers nowadays
2021-05-09 01:48:23
On my macbook, "100%" means "quite a bit upscaled"
Jim
2021-05-09 01:48:40
Odd, in the image viewer the downscaled version it was almost unnoticeable but at 100% it was even more noticeable than in the browser.
2021-05-09 01:49:35
The non dithered version looks better at 100% than the dithered in the image viewer.