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

spider-mario
2021-03-11 09:42:53
`git clone https://github.com/msys2/MINGW-packages; cd MINGW-packages/mingw-w64-ffmpeg; MINGW_ARCH=x86_64 makepkg-mingw -s`
2021-03-11 09:42:55
done
2021-03-11 09:43:13
one can change the `PKGBUILD` in-between to add the desired dependencies and configure flags
2021-03-11 09:45:27
(thatโ€™s even assuming that one needs to build with different options, otherwise `pacman -S mingw-w64-x86_64-ffmpeg` will get you ffmpeg as well)
Scope
2021-03-11 09:46:27
Yes, this is suitable for the lighter version, but if someone needs more, and also include for example several AV1 encoders at the same time and also use the latest builds and automatically update them all at once, it is much more complicated and longer than using ready-made scripts
spider-mario
2021-03-11 09:47:09
my experience with m-ab-s was that it was just more potential ways for the process to go wrong (and with dozens of questions before you get to it)
Scope
2021-03-11 09:48:14
Also, not everyone has an in-depth knowledge of this, especially if some changes and patches are needed
2021-03-11 09:57:22
Like this (a lot of things can be figured out, but not everyone has time to find solutions, especially not for developers and for people using Windows who are less used to compiling different stuff): <https://github.com/m-ab-s/media-autobuild_suite/commit/fcbc9533c4aa91f61dfe19b1c3d3bd80e75ce7eb> <https://github.com/m-ab-s/media-autobuild_suite/commit/9be06f537787561cd0f665c024f0830c31bf6549> <https://github.com/m-ab-s/media-autobuild_suite/commit/d76c779bc84bc0a76fe7e8981f19bb703dab58e4> <https://github.com/m-ab-s/media-autobuild_suite/commit/60bc4ab6ecd040a919ca5a4d10ff6da66b09ec70>
spider-mario
2021-03-11 10:02:37
thanks, this is starting to make a bit more sense to me
2021-03-11 10:04:50
are such patches typically upstreamed? or do they maybe come from the upstream in the first place?
Scope
2021-03-11 10:05:28
As far as I know, some of them are
2021-03-11 10:06:40
Btw https://github.com/AOMediaCodec/libavif/issues/528
2021-03-12 02:28:19
<https://www.reddit.com/r/jpegxl/comments/lyhsum/large_new_sync_to_jpegxl_gitlab_repo/> Btw, why are commits organized in this way or is it some kind of technical issues that it is more convenient in development at the moment?
veluca
2021-03-12 02:31:23
it's more convenient for now, migrating to publishing single commits and accepting external contributions is part of the plan but it will likely take a bit of time still
_wb_
2021-03-12 03:35:34
maybe we can migrate the commit history too
Jyrki Alakuijala
_wb_ maybe we can migrate the commit history too
2021-03-14 03:27:45
I don't want to spend time on improving the version control procedures for the next 2 or 3 weeks
2021-03-14 03:28:14
if there is just a flag that we can use to bring the commit history, we could perhaps do that
spider-mario
2021-03-14 04:09:32
itโ€™s not harder to have the full history
2021-03-14 04:09:45
the question is whether the reasons why we did not publish it in the first place still apply
_wb_
2021-03-14 04:20:20
I think it's ok to have the commit history. The discussions in the code review are probably best kept private though, not sure what stuff I wrote there these past two years but some of it was certainly not meant to be public ๐Ÿ˜…
zebefree
2021-03-17 04:11:32
It looks like 0.3.4 fails to build on macOS
2021-03-17 04:11:39
https://github.com/Homebrew/homebrew-core/runs/2126170861#step:7:842
2021-03-17 04:11:56
`lib/extras/codec_exr.cc:93:12: error: virtual function 'tellg' has a different return type ('uint64_t' (aka 'unsigned long long')) than the function it overrides (which has return type 'Imath_2_5::Int64' (aka 'unsigned long'))`
_wb_
2021-03-17 05:53:52
Ugh is this version dependent on macOS now? It's a 64-bit unsigned int, why is this kind of thing still a problem in 2021...
2021-03-17 05:54:35
Can you upgrade to latest openexr?
zebefree
2021-03-17 06:05:23
It is the latest master of the jpeg-xl repo. The openexr repo at https://github.com/AcademySoftwareFoundation/openexr doesn't even have a codec_exr.cc file.
2021-03-17 06:13:19
I see, codec_exr.cc is apparently the libjxl client code and it extends a base class defined in openexr.
2021-03-17 06:14:02
It looks like Homebrew has openexr 2.5.5, which is the latest version.
_wb_
2021-03-17 06:29:44
https://github.com/AcademySoftwareFoundation/openexr/blob/master/src/lib/OpenEXR/ImfInt64.h
2021-03-17 06:30:36
``` // Deprecated Int64/SInt64 unsigned 64-bit integer type. // Use int64_t and uint64_t instead. ```
2021-03-17 06:32:30
Now I see why it was deprecated: it didn't properly define uint64_t on all platforms as was intended
zebefree
2021-03-17 06:34:09
It looks like openexr changed it from Int64 to uint64_t 14 days ago, but there hasn't been a stable release since then.
2021-03-17 06:34:12
https://github.com/AcademySoftwareFoundation/openexr/commit/12df1e60c089ce08083256e3468690f3da0ea642
_wb_
2021-03-17 06:41:44
Int64 was supposed to be uint64_t all the time
2021-03-17 06:42:01
(they have SInt64 for the signed one)
2021-03-17 06:44:15
But apparently they got it wrong, because on your platform Int64 was an unsigned long which must be uint32 in your case because the compiler complains that it's not equal to unsigned long long / uint64
zebefree
2021-03-17 06:49:27
Int64 is unsigned long and uint64_t is unsigned long long; both are unsigned 64-bit integers but C++ treats long and long long as different even if they are the same size.
_wb_
2021-03-17 06:52:47
Ah really? My compiler didn't complain though. Ugh why can't we just have headache-free int types...
2021-03-17 06:54:13
You can have an `unsigned int` that is only uint16 and an `unsigned long` that is uint32, right? In theory...
Pieter
2021-03-17 06:59:27
yes
2021-03-17 07:00:17
Int64 should probably just be degined as uint64_t ?
_wb_
2021-03-17 07:05:14
Not sure how we can make our openexr input/output code compile with both the old openexr and the new one
zebefree
2021-03-17 07:06:18
openexr 2.5.5 defines Int64 as long unsigned int if that is 64 bits
2021-03-17 07:06:19
https://github.com/AcademySoftwareFoundation/openexr/blob/v2.5.5/IlmBase/Imath/ImathInt64.h#L55
2021-03-17 07:06:38
macOS defines uint64_t as `typedef unsigned long long uint64_t;`
_wb_
2021-03-17 07:08:32
I don't see an easy solution. We can't use Int64 in our code because that doesn't exist anymore in the latest openexr
zebefree
2021-03-17 07:08:35
Linux defines uint64_t as unsigned long int if `__WORDSIZE == 64`
2021-03-17 07:08:52
and unsigned long long int otherwise
2021-03-17 07:26:28
Maybe use Int64 if OPENEXR_VERSION_MAJOR < 3 and uint64_t if OPENEXR_VERSION_MAJOR >= 3 ?
_wb_
2021-03-17 07:32:42
I suppose. Not very elegant to have to do it that way though.
veluca
2021-03-17 08:42:16
not really many other options though
spider-mario
2021-03-17 10:37:55
https://github.com/AcademySoftwareFoundation/Imath/blob/master/docs/PortingGuide2-3.md#finding-and-using-openexr-and-imath-cmake-configs ugh, this looks generally somewhat annoying if we want to support both
2021-03-17 10:38:26
it seems `COMBINED_OPENEXR_VERSION >= 20599` is the check we want
2021-03-17 10:38:53
ah, they define that just above, it doesnโ€™t come from the EXR headers
2021-03-17 10:40:15
> The Int64 and SInt64 types are deprecated in favor of the now-standard int64_t and uint64_t. if they are only deprecated, maybe we can just keep using them?
2021-03-17 10:40:39
let me check again what we said in the MR where the change was made
2021-03-17 10:41:49
apparently, it was in response to https://gitlab.com/wg1/jpeg-xl/-/issues/162, which suggests that OpenEXR::Int64 was problematic
_wb_
2021-03-17 11:13:08
feel free to revert that change if that solves it, I was just assuming there was an issue when we kept using it (and changing it to uint64_t worked for me on the old openexr, so I assumed they just wanted to get rid of Int64 and uint64_t would work anywhere)
veluca
2021-03-17 12:50:32
what if we make it return say `decltype(((base_class*)this)->tellp())` ? ๐Ÿ˜„
2021-03-17 12:50:47
possibly with some `std::decay_t<>` in the mix
Petr
2021-03-18 09:35:26
<@!111445179587624960> or anyone else, do you know whether the GIMP plugin (from libjxl) Windows binary is available for download somewhere?
2021-03-18 09:35:33
I couldn't find it anywhere.
2021-03-18 09:35:44
I'm thinking like this: Many people are on Windows. Anyone can download GIMP (binary). If they become interested in JXL, they will probably want the easiest way possible. And that's where the plugin binary comes in handy.
Scope
2021-03-18 09:36:59
I have not tried and do not know if the GIMP plugin even works in the latest builds
2021-03-18 10:00:43
But Windows, yes, for compiled binary this should be the first priority, since this is the largest percentage of users and not many people compile from sources themselves
spider-mario
2021-03-18 10:25:17
oh, compiling the gimp plugin on windows used to be broken (so we disabled it), but I just tried again and it works now
2021-03-18 10:27:36
itโ€™s dynamically linked, though, so I assume itโ€™s going to be somewhat of a pain to distribute for now
Petr
2021-03-18 10:33:16
What kind of pain? Any volunteers to resolve it? ๐Ÿ™‚
spider-mario
2021-03-18 10:35:17
maybe not a huge pain, but one would need to copy all the required dlls with the plugin and put them next to the .exe
2021-03-18 10:35:29
maybe I can give it a quick try and someone can test?
Petr
spider-mario maybe I can give it a quick try and someone can test?
2021-03-18 10:35:59
I will
spider-mario
2021-03-18 10:45:34
I have something that seems to load (appears in gimpโ€™s โ€œprocedure listโ€) and runs but doesnโ€™t actually seem to work: https://x0.at/lGT.zip
2021-03-18 10:45:39
it fails to load images
2021-03-18 10:46:22
maybe Iโ€™m not supposed to provide the libgimp* libraries myself or something like that
2021-03-18 10:46:41
(and many of the other dlls are likely transitive dependencies of those)
Petr
2021-03-18 12:10:20
Wow, it works here! ๐Ÿ†’
2021-03-18 12:12:06
It didn't work at first. But I gave it another try with a jxl that doesn't have any special characters in the filename (diacritics in my case) and it works!
2021-03-18 12:13:17
There are 2 strange things though:
2021-03-18 12:15:37
1) It throws these messages in a separate console window when generating a preview and when opening the file.
2021-03-18 12:15:51
2021-03-18 12:20:39
2) When finished opening, GIMP shows a dialog asking to convert from "RGB_D65_SRG_Rel_SRG" colour profile to "GIMP built-in sRGB". (The image is CJXLed from an indexed PNG with -s 9 -q 100.)
_wb_
2021-03-18 12:23:14
I suppose GIMP doesn't detect that it is asking you "do you want to convert this sRGB image to sRGB?"
Petr
2021-03-18 12:32:45
In fact, it doesn't make any difference whether I press "Keep" or "Convert" in that dialog. So the jxl plugin just makes GIMP to show the dialog needlessly. Shall I report it as a bug?
2021-03-18 12:33:40
(Not sure what priority the plugin currently is.)
2021-03-18 12:38:05
<@!604964375924834314> Good news! All those DLLs you packed to IGT.zip are not needed. Just the "file-jxl.exe" does the magic.
2021-03-18 12:42:39
When I deleted them from ".\AppData\Roaming\GIMP\2.10\plug-ins" and kept just the exe there, those error messages are gone. ๐Ÿ‘
spider-mario
2021-03-18 01:02:02
oh, nice to know
Petr In fact, it doesn't make any difference whether I press "Keep" or "Convert" in that dialog. So the jxl plugin just makes GIMP to show the dialog needlessly. Shall I report it as a bug?
2021-03-18 01:02:57
if you ask me, this dialog is pretty much always unneeded :p
2021-03-18 01:03:37
but yes, maybe we can do the detection ourselves and somehow assign gimpโ€™s own sRGB profile if it matches
Petr
2021-03-18 01:37:24
The dialog should appear if there's actually something to convert. But I'm not sure whether cjxl stored something like that into the jxl (nothing like that was in the original png).
spider-mario
2021-03-18 01:39:12
if the original PNG had either nothing or an sRGBย tag or an sRGB ICC profile, then cjxl stored {colorspace = RGB, whitepoint = D65, primaries = sRGB, rendering_intent = Relative, transfer_function = sRGB}
2021-03-18 01:39:24
which is represented as a string by RGB_D65_SRG_Rel_SRG
2021-03-18 01:39:54
and then the decoder synthesized a corresponding ICC profile
2021-03-18 01:40:54
so I think it will remove the dialog if the jxl gimp plugin does something like `if (colorspace.IsSRGB()) { /* attach GIMP sRGB profile instead of the one we synthesize */ }`
2021-03-18 01:41:26
the GIMP API probably allows getting that GIMP sRGB profile
2021-03-18 01:44:59
yes, `gimp_color_profile_new_rgb_srgb` should do it
Petr
2021-03-18 02:14:39
All this makes perfect sense. Thanks, <@!604964375924834314> !
spider-mario oh, compiling the gimp plugin on windows used to be broken (so we disabled it), but I just tried again and it works now
2021-03-19 10:09:36
And now that we know that the GIMP plugin works, will it be enabled by default?
spider-mario
2021-03-19 10:10:32
we just merged a change in the internal repository that puts the gimp plugin out of the `if (NOT WIN32)` block
2021-03-19 10:10:39
and which does the sRGB trick mentioned above
2021-03-19 10:10:52
it will still be necessary to pass `-DJPEGXL_ENABLE_PLUGINS=YES` though
2021-03-19 10:11:12
(or edit the `CMakeCache.txt` and rebuild)
2021-03-19 10:12:11
next sync should have this
2021-03-19 10:13:13
oh, and it also removes the console that opened
Petr
2021-03-19 10:16:54
That sounds wonderfully!
2021-03-19 10:20:01
Now the last thing with the plugin is to allow saving (if the rest of the code is ready for it). ๐Ÿ˜Ž
2021-03-19 10:20:10
Thanks!
spider-mario
2021-03-19 10:20:52
oh, true, thereโ€™s that :p but the current code for saving does not allow changing any setting, this is still to be implemented
2021-03-19 10:21:08
we also wanted to migrate the plugin away from the internal C++ API and to the public C API
2021-03-19 10:21:48
and from what I understand, there was also external interest in having it use the new GIMP 3.0 plug-in API instead of 2.10
2021-03-19 10:21:57
not yet sure what that entails
2021-03-19 10:22:51
the changelog for 2.99.4 suggests that presenting settings for saving might become easier:
2021-03-19 10:22:53
> New generic dialog generation and metadata support API for export plug-ins
2021-03-19 10:23:28
https://www.gimp.org/news/2020/12/25/gimp-2-99-4-released/#dialog-generation-for-plug-ins
Petr
2021-03-22 11:32:09
Is it OK that cjxl does lossy by default with PNGs? ๐Ÿ˜ฎ PNG is lossless, JXL supports lossless, so I would guess it would do lossless by defaultโ€ฆ
Crixis
Petr Is it OK that cjxl does lossy by default with PNGs? ๐Ÿ˜ฎ PNG is lossless, JXL supports lossless, so I would guess it would do lossless by defaultโ€ฆ
2021-03-22 11:33:27
You can do good lossy only from lossless
2021-03-22 11:34:29
from lossy format do lossy conversion is not good
Petr
2021-03-22 11:36:08
Absolutely. But lossless from lossless is also charming.
Crixis
2021-03-22 11:38:03
but in this way, with lossless as default in all situation you kill the exceptional jxl Vardct e perception model
Petr
2021-03-22 11:40:50
I don't think so. It's definitely great for photos so it should be used heavily.
Crixis
Petr I don't think so. It's definitely great for photos so it should be used heavily.
2021-03-22 11:41:58
only from who know it exist, for who know a flag is not a problem
Petr
2021-03-22 11:42:25
But if a non-photo converted from PNG becomes much bigger lossy than lossless, something isn't right.
Crixis
Petr But if a non-photo converted from PNG becomes much bigger lossy than lossless, something isn't right.
2021-03-22 11:43:14
why? Vardct is good in a lot of non-photo
Petr
2021-03-22 11:49:57
This inevitably leads me to the following question: What is the status of implementation of fully automatic encoding mentioned here? https://docs.google.com/presentation/d/1LlmUR0Uoh4dgT3DjanLjhlXrk_5W2nJBDqDAMbhe8v8/edit#slide=id.g9b4791a110_0_389 The thing is to choose lossless from lossless *automatically* if the resulting file is smaller than lossy from the same lossless. Just a suggestion. No intention to offend anyone.
Crixis
2021-03-22 11:53:26
there is a small set of image that make lossless smaller than Vardct (pixelart), but the most off all image is good in Vardct example:
2021-03-22 11:53:32
2021-03-22 11:53:37
2021-03-22 11:53:40
2021-03-22 11:54:53
lossless is cool but the main focus jxl I think is perceptually lossless
2021-03-22 11:57:05
``` PNG 42 KB jxl 8 KB jxl-lossless 21 KB ```
Petr
2021-03-22 11:58:02
My example: original screenshot in indexed PNG: 37 kB cjxl default (lossy): 75 kB cjxl -q 100: 45 kB
Crixis
2021-03-22 11:59:25
cool, is not pixelart?
Petr
2021-03-22 12:01:14
Screenshot of icons on my desktop (not to be shared hereโ€ฆ but I will test it on other images too).
Crixis
2021-03-22 12:03:13
a smarter encoder that test also lossless can be perfect if not much slower
2021-03-22 12:04:06
also lossless faster mode have some problems whit a small set of images
Petr
2021-03-22 12:12:53
original screenshot in indexed PNG: 40 kB cjxl default (lossy): 59 kB cjxl -q 100: 34 kB
Crixis
2021-03-22 12:17:19
Screenshot seam a good case for an app to set -q 100 as default
Petr
2021-03-22 12:28:45
Currently the cjxl help says: -q QUALITY, --quality=QUALITY Quality setting (is remapped to --distance). Range: -inf .. 100. 100 = mathematically lossless. Default for already-lossy input (JPEG/GIF). But it sounds weird to me. First, why is GIF considered lossy? Is it because the 256 colours limit? Second, why PNG and GIF (both lossless) aren't treated in the same way?
2021-03-22 12:29:52
If it's intended then my questions are good candidates for FAQ. ๐Ÿ™‚
2021-03-22 12:50:17
Basically, when I first spotted the JPEG XL project, I was fascinated by the fully automatic encoding (mentioned above). So I wonder how real it is now or will be in the futureโ€ฆ
Deleted User
2021-03-22 12:59:14
<@!792428046497611796> I also had some concerns about lossy (`-d 1`) being default for lossless input. I think that discussion may be interesting.
2021-03-22 12:59:14
https://discord.com/channels/794206087879852103/794206170445119489/812871854175944744
Crixis
2021-03-22 01:05:47
I never ear gif as a lossless format
Petr
Crixis I never ear gif as a lossless format
2021-03-22 01:13:59
The compression is lossless indeed.
Crixis
2021-03-22 01:14:41
the output is not the same as the input, I'm wrong? I not know a lot about gif
<@!792428046497611796> I also had some concerns about lossy (`-d 1`) being default for lossless input. I think that discussion may be interesting.
2021-03-22 01:17:29
Also you think all lossless is better?
Deleted User
Crixis Also you think all lossless is better?
2021-03-22 01:18:43
BlueSwordM convinced me otherwise in the link just below the message you've just mentioned.
_wb_
2021-03-22 01:18:46
GIF is lossless if your happen to have an image with less than 256 colors, like JPEG is lossless if you happen to have a bunch of quantized DCT coefficients ๐Ÿ™‚
Crixis
_wb_ GIF is lossless if your happen to have an image with less than 256 colors, like JPEG is lossless if you happen to have a bunch of quantized DCT coefficients ๐Ÿ™‚
2021-03-22 01:19:29
so... ALL codecs are lossless u.u
_wb_
2021-03-22 01:19:42
fully automatic encoding: what we have right now is a perceptual lossy encoder that gives visually pretty consistent results
2021-03-22 01:20:09
I agree that it would also be useful to detect cases where lossy is just not a good idea, and do lossless there
2021-03-22 01:20:33
I mean, doing it in a better way than brute force
2021-03-22 01:21:28
if you now pick the smallest output file between `cjxl` and `cjxl -q 100`, you basically already have something that does the right thing
2021-03-22 01:22:03
(except that it will be very slow to always do a lossless encode just to see that it is indeed larger than the lossy one for 99% of the images)
Deleted User
2021-03-22 01:22:44
Maybe some simple (or not) heuristics?
Crixis
Maybe some simple (or not) heuristics?
2021-03-22 01:23:30
example large same color areas
Deleted User
2021-03-22 01:24:07
I was talking about something like this: https://jmvalin.ca/opus/opus-1.3/
2021-03-22 01:25:07
Chapter: ***Speech/music detection***
2021-03-22 01:26:41
I was previously talking on this server about similarities between Opus and JPEG XL... maybe could we borrow some ideas from them (at least in areas of similarity)?
2021-03-22 01:27:10
Opus also has two modes working in tandem (SILK and CELT) and has to switch between them in a clever way depending on the type of input
2021-03-22 01:29:02
Oh, there it is: https://discord.com/channels/794206087879852103/794206170445119489/804425778057183322
_wb_
2021-03-22 01:35:52
yes, simple heuristic would be best, but to do something really interesting, it could segment the image in photo parts and nonphoto parts, and use lossy for the photo part and lossless for the nonphoto part
2021-03-22 01:42:02
I have ideas on how to do that, just haven't had the time yet to implement it
Petr
_wb_ GIF is lossless if your happen to have an image with less than 256 colors, like JPEG is lossless if you happen to have a bunch of quantized DCT coefficients ๐Ÿ™‚
2021-03-22 01:44:50
Having an original input with up to 256 colours is quite usual. Having a bunch of quantized DCT coefficients is usual only in already lossy stuff. ๐Ÿ™‚ When I was a kid, there were usually computers displaying 16 colours maximum. Lossless made perfect sense for it. That's why I might be a *little* biased for lossless and will always be its advocate, even for JXL. ๐Ÿ™‚
_wb_
2021-03-22 01:47:42
In any case, if 256 colors was actually lossless, it's likely to be a non-photo image for which lossless will be better than VarDCT. And if the original was photographic but reduced to 256 colors to turn it into a GIF, then it's lossy, and doing lossless is prudent to avoid further loss.
2021-03-22 01:48:26
(plus it's silly to let VarDCT spend a lot of effort on replicating the dithering)
2021-03-22 01:49:31
Doing lossless by default on _all_ input, including PNG: yes, there is something to be said for that.
Deleted User
2021-03-22 01:57:48
Some *really* simple yet quite effective heuristics can be used even now. For example: use lossless modular by default if there's encoded palette in input PNG file, and use that palette directly (no need to calculate it twice). If there's no palette, try automatically detecting it (just like `optipng` does) and if there's one, use it and do the rest as above.
_wb_
2021-03-22 01:58:38
The problem is there are many use cases. We try to let defaults do "what most people would want most of the time", and then -d 1 lossy seems OK.
2021-03-22 01:58:58
Yes, the really simple heuristic thing could be added quite easily
2021-03-22 01:59:12
I'm just more interested in the not so simple heuristic thing ๐Ÿ™‚
Deleted User
_wb_ I'm just more interested in the not so simple heuristic thing ๐Ÿ™‚
2021-03-22 02:00:53
Me too! But just like I said before, putting such simple mechanisms (e.g. palette = modular) would be a no-brainer for me during development.
2021-03-22 02:01:29
I'm trying to exploit **every possible property** of both the input and output and remove as much redundancy as possible.
2021-03-22 02:02:54
Using modular when there's a palette (either already encoded in the input PNG or detected by JXL encoder) should be a piece of cake.
Lastrosade
2021-03-22 04:37:52
While using cjxl on a big png I got this error `Command terminated by signal 11`
2021-03-22 04:38:03
This is with `-d 0`
2021-03-22 04:38:20
it works with default parameters
BlueSwordM
2021-03-22 04:39:47
How big?
Lastrosade
2021-03-22 04:39:58
3.4GB
BlueSwordM
2021-03-22 04:40:11
Oh, I think you may be running out of RAM...
Lastrosade
2021-03-22 04:40:26
128GB of ram ?
BlueSwordM
2021-03-22 04:40:37
Ye. On a 233MP PNG image(125MB), the encoder consumes 19GB of RAM already...
Lastrosade
2021-03-22 04:40:50
69536x22230 pixels
BlueSwordM
2021-03-22 04:42:03
Oof, that doesn't surprise me then. 19GB * 6,6 = 125GB if it rises linearly.
2021-03-22 04:42:14
Of course, you can just check how much RAM is used for such a large image.
Lastrosade
2021-03-22 04:44:20
``` J P E G \/ | /\ |_ e n c o d e r [v0.3.4 | SIMD supported: AVX2,SSE4,Scalar] /home/pedr0/libjpeg-xl-git/src/jpeg-xl/lib/extras/codec_png.cc:726: JXL_FAILURE: PNG decode failed: invalid ADLER32 encountered (checking ADLER32 can be disabled) Command terminated by signal 11 40.24user 7.88system 0:52.47elapsed 91%CPU (0avgtext+0avgdata 14830980maxresident)k 27800inputs+16outputs (9major+7335983minor)pagefaults 0swaps ``` I have no idea how to read this
_wb_
2021-03-22 04:51:15
Png decode failed? Interesting
Lastrosade
2021-03-22 04:51:41
with `-d 1` ``` J P E G \/ | /\ |_ e n c o d e r [v0.3.4 | SIMD supported: AVX2,SSE4,Scalar] /home/pedr0/libjpeg-xl-git/src/jpeg-xl/lib/extras/codec_png.cc:726: JXL_FAILURE: PNG decode failed: invalid ADLER32 encountered (checking ADLER32 can be disabled) Read 69536x22230 image, 16.1 MP/s Encoding [VarDCT, d1.000, squirrel], 32 threads. Compressed to 290998414 bytes (1.506 bpp). 69536 x 22230, 1.31 MP/s [1.31, 1.31], 1 reps, 32 threads. 839.76user 483.07system 21:29.28elapsed 102%CPU (0avgtext+0avgdata 73100520maxresident)k 56448520inputs+568456outputs (5984878major+79547645minor)pagefaults 0swaps ```
_wb_
2021-03-22 04:52:44
Looks like a bug in something
2021-03-22 04:53:08
What does -d 0 -s 3 do?
2021-03-22 04:53:51
It might be something related to tree learning not expecting that much data, or something
Lastrosade
2021-03-22 04:55:18
`-d 0 -s 3 ` ``` J P E G \/ | /\ |_ e n c o d e r [v0.3.4 | SIMD supported: AVX2,SSE4,Scalar] /home/pedr0/libjpeg-xl-git/src/jpeg-xl/lib/extras/codec_png.cc:726: JXL_FAILURE: PNG decode failed: invalid ADLER32 encountered (checking ADLER32 can be disabled) Command terminated by signal 11 40.15user 9.23system 0:53.08elapsed 93%CPU (0avgtext+0avgdata 14831192maxresident)k 64inputs+16outputs (0major+7336001minor)pagefaults 0swaps ```
_wb_
2021-03-22 05:00:09
<:Thonk:805904896879493180>
2021-03-22 05:01:23
It doesn't look like it runs out of memory, must be something else
2021-03-22 05:02:22
Maybe run it in gdb to get a backtrace?
Lastrosade
2021-03-22 05:02:45
This is beyond my skills
veluca
2021-03-22 05:35:41
it *should* work even on an image that big.. lossless uses a lot of memory, but...
Lastrosade This is beyond my skills
2021-03-22 05:36:30
you could do `gdb --args <command>`, or maybe share the PNG in an issue on the repo ๐Ÿ™‚ it might be that some place is assuming that something like #pixels will fit in 32 bits
Lastrosade
2021-03-22 05:39:04
``` [6 days since last crash.]$ gdb --args cjxl -d 0 -s 3 heic1502a.png heic1502a_ll.cjxl GNU gdb (GDB) 10.1 Copyright (C) 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from cjxl... (No debugging symbols found in cjxl) (gdb) ```
_wb_
2021-03-22 05:46:35
Type `run -d 0 -s 3 ` and the other args
Lastrosade
2021-03-22 05:52:29
``` Thread 1 "cjxl" received signal SIGSEGV, Segmentation fault. 0x00007ffff755078c in __memmove_avx_unaligned_erms () from /usr/lib/libc.so.6 ```
_wb_
2021-03-22 05:59:34
I guess a cjxl with debug symbols would be more helpful ๐Ÿ˜…
Lastrosade
2021-03-22 06:01:40
What would I have to change in the build process to keep debug symbols
2021-03-22 06:02:15
I'm assuming it would be something with cmake
_wb_
2021-03-22 06:02:38
Compile with `ci.sh opt` (or even `ci.sh debug`)
Lastrosade
2021-03-22 06:05:19
oh this is easy
2021-03-22 06:05:24
for once
2021-03-22 06:12:21
well, I get the same result from gdb with a build done using `ci.sh debug`
_wb_
2021-03-22 06:14:37
Can you print a backtrace?
2021-03-22 06:15:07
`bt`
Lastrosade
2021-03-22 06:15:18
2021-03-22 06:15:22
too long for discord
_wb_
2021-03-22 06:16:36
Looks like it crashes while loading the png, hm
2021-03-22 06:17:37
That apng loading code is likely very buggy, I quickly hacked that just to have something to try animation
2021-03-22 06:18:08
The regular png loading code has already failed because the checksums are wrong or something
2021-03-22 06:18:41
Maybe try converting the png to ppm before encoding, maybe the ppm loading code is less buggy :)
Lastrosade
2021-03-22 06:19:21
if I do that how would I keep the srgb data ?
_wb_
2021-03-22 06:20:26
What color profile does the image have?
2021-03-22 06:21:43
cjxl will assume ppm to be sRGB, but you can tell it it's something else
Lastrosade
2021-03-22 06:24:41
`sRGB IEC61966-2.1`
2021-03-22 06:26:36
It worked with the ppm
_wb_
2021-03-22 06:27:00
Cool
2021-03-22 06:27:49
We should get rid of the apng loader and improve the regular png loader to also do apng (and to not care about wrong checksums)
Lastrosade
2021-03-22 06:54:53
Cool with `cjxl -d 0 -s 3 -x icc_pathname=heic1502a.icc heic1502a.ppm heic1502a.jxl` I can get my unreadable jxl file with proper srgb
2021-03-22 07:01:12
I mean I think
_wb_
2021-03-22 07:01:16
How is compression compared to png with that one?
Lastrosade
2021-03-22 07:01:20
I can't actually check
2021-03-22 07:01:37
png 3.2GB jxl 2.8GB
2021-03-22 07:02:12
But I have no idea as to how much compressed the png actually is
2021-03-22 07:02:47
All I know is that the ppm is the same size as the source psb which is weird
_wb_
2021-03-22 07:02:55
You don't need to add that icc, it should be equal to the default cjxl will choose when getting ppm input
2021-03-22 07:03:13
PSD/PSB can be just uncompressed
2021-03-22 07:04:03
It probably is, if that's a photo
Lastrosade
2021-03-22 07:04:41
its this https://esahubble.org/images/heic1502a/
_wb_
2021-03-22 07:04:42
The compression in PSD is just simple RLE, which is only useful for nonphoto
2021-03-22 07:05:16
Oh, you're trying that one at full res? Courageous ๐Ÿ˜…
2021-03-22 07:09:09
At slower speed settings you might be able to trim off some more bytes, but it will likely take quite a while and lots of memory
2021-03-22 07:12:39
For lossy, just the DC of that image is a 8692x2779 image, i.e. cannot fit it on an 8K screen ๐Ÿ˜…
2021-03-22 07:13:24
Definitely a case where progressive DC is useful :)
Deleted User
Some *really* simple yet quite effective heuristics can be used even now. For example: use lossless modular by default if there's encoded palette in input PNG file, and use that palette directly (no need to calculate it twice). If there's no palette, try automatically detecting it (just like `optipng` does) and if there's one, use it and do the rest as above.
2021-03-24 07:09:52
Just made an issue #188 about that. https://gitlab.com/wg1/jpeg-xl/-/issues/188
BlueSwordM
2021-03-25 04:45:52
So, is it actually possible for an image to become undecodable?
2021-03-25 04:46:06
I seem to have a few lossless image that I can't decode anymore with JXL 0.3.5 ๐Ÿค”
2021-03-25 04:46:47
It's specifically this one.
2021-03-25 05:02:29
I can't also decode this image: https://cdn.discordapp.com/attachments/565354601449127957/824508390457344002/SNCE8P_2021-03-13_21-45-41_s9.jxl Both were encoded with JXL 0.3.4 modular lossless -s 9 -I 1.0 -E 3.
Nova Aurora
2021-03-25 05:06:42
> Read 9124493 compressed bytes [v0.3.0 | SIMD supported: AVX2] > Done. > 6668 x 3840, 11.80 MP/s [11.80, 11.80], 1 reps, 4 threads. > Allocations: 4099 (max bytes in use: 9.642420E+08)
2021-03-25 05:08:25
I have 0.3.2 I think? **OH WOW I'm dumb it shows my version right there (0.3.0)**
2021-03-25 05:08:31
and it worked for me
BlueSwordM
Nova Aurora and it worked for me
2021-03-25 05:09:50
If you can, update to 0.3.5.
2021-03-25 05:10:46
That might have either been an encoder bug(rather low), or perhaps a decoder bug introduced with 0.3.5? I am not sure. I will check tomorrow.
Nova Aurora
BlueSwordM If you can, update to 0.3.5.
2021-03-25 05:23:55
Recompiled from the latest git, now it fails: > โฏ djxl SNCE8P_2021-03-13_21-45-41_s9.jxl decode.png > Read 9124493 compressed bytes [v0.3.5 | SIMD supported: AVX2,SSE4,Scalar] > Failed to decompress to pixels.
monad
BlueSwordM So, is it actually possible for an image to become undecodable?
2021-03-25 05:35:58
You can create weirdly undecodable images with jxl_from_tree. ```if y > -1 - Set 0 if y > 0 - Set 0 - Set 0```
Pieter
2021-03-25 06:04:10
Hmm, why is that undecodable?
_wb_
2021-03-25 06:11:50
Good question.
NeRd
2021-03-25 06:23:27
Also fails for other fairly arbitrary values with the same basic structure: ``` if y > 25 - Set 0 if y > 100 - Set 128 - Set 255 ``` fails, ``` if y > -999 - Set 255 if y > 999 - Set 128 - Set 0 ``` fails, ``` if y > 0 - Set 0 if y > 1 - Set 0 - Set 0 ``` fails, etc.
monad
2021-03-25 06:24:19
Not exactly arbitrary, since they all cause illogical branches.
2021-03-25 06:26:59
I only picked the values I did because in this case the illogical branch shouldn't actually need considered.
_wb_
2021-03-25 06:29:57
Oh I guess it detects the tree has unreachable branches, and assumes the bitstream is corrupt (a normal encoder would not produce branches that are logically unreachable)
Pieter
2021-03-25 06:31:20
How are there unreachable branches?
2021-03-25 06:31:50
Oh, negative y.
monad
2021-03-25 06:31:52
I guess assuming corruption is sensible behavior. But it's ironic that jxl_from_tree encodes the file just fine (or at least doesn't complain).
_wb_
2021-03-25 06:40:56
I think it only does not complain in release builds. In debug builds it does complain.
2021-03-25 06:41:08
Iirc
2021-03-25 06:41:22
Waking up, need coffee first
Pieter
2021-03-25 06:42:52
You could also complain about inner nodes in the tree with two identical subtrees.
2021-03-25 06:43:12
Or inner nodes which have all identical leaves.
_wb_
2021-03-25 06:46:42
They could still have different histograms though, even if they have same predictor/offset
Pieter
2021-03-25 06:47:28
Right, only when the leaves are exactly identical.
_wb_
BlueSwordM So, is it actually possible for an image to become undecodable?
2021-03-25 06:51:37
It shouldn't be. I will investigate later
2021-03-25 07:38:57
OK the illogical tree thing is indeed djxl assuming corruption: ```../lib/jxl/modular/encoding/ma.cc:1064: JXL_FAILURE: Invalid tree ../lib/jxl/modular/encoding/ma.cc:1136: JXL_RETURN_IF_ERROR code=1: DecodeTree(br, &reader, tree_context_map, tree, std::min(tree_size_limit, kMaxTreeSize)) ../lib/jxl/dec_modular.cc:169: JXL_RETURN_IF_ERROR code=1: DecodeTree(reader, &tree, tree_size_limit) ../lib/jxl/dec_frame.cc:223: JXL_RETURN_IF_ERROR code=1: frame_decoder.ProcessSections( section_info.data(), section_info.size(), section_status.data()) ../lib/jxl/dec_file.cc:159: JXL_RETURN_IF_ERROR code=1: dec_ok Failed to decompress to pixels. ```
2021-03-25 07:39:45
jxl_from_tree is not really a serious tool, making it complain could be done but it's not a priority imo
2021-03-25 07:41:44
ok looks like we have a regression in 0.3.5
2021-03-25 07:41:49
a decoder bug
2021-03-25 07:42:19
getting a bunch of ```./lib/jxl/modular/encoding/encoding.cc:463: JXL_FAILURE: Truncated input ../lib/jxl/modular/encoding/encoding.cc:490: JXL_RETURN_IF_ERROR code=1: dec_status ../lib/jxl/dec_modular.cc:284: JXL_FAILURE: Failed to decode modular group ../lib/jxl/dec_frame.cc:575: JXL_RETURN_IF_ERROR code=1: modular_frame_decoder_.DecodeGroup( mrect, br[i - decoded_passes_per_ac_group_[ac_group_id]], minShift, maxShift, ModularStreamId::ModularAC(ac_group_id, i), false) ```
2021-03-25 07:51:45
ok I found the problem, for now don't use 0.3.5 because both encoder and decoder have the bug
2021-03-25 08:07:37
it's a specialized code path (for faster decode) that appears to be not quite exactly equivalent to the generic code path, causing trouble (which went undetected by roundtrip tests because encoder and decoder both use the same buggy code)
Deleted User
2021-03-25 08:10:32
Is everyone affected or just those using "fast decode" path?
fab
2021-03-25 08:15:54
me that i encoded 86 instagram images with modular
_wb_
2021-03-25 08:25:14
it potentially affects everyone
2021-03-25 08:25:31
so don't use 0.3.5 for now
2021-03-25 08:30:20
Quick fix is to let TreeToLookupTable in lib/jxl/modular/encode.h just immediately return false
2021-03-25 08:31:55
Sorry everyone, this is the 'bleeding' that sometimes happens at the bleeding edge
2021-03-25 08:32:51
I reviewed that code and didn't spot any problem, still don't see it.
spider-mario
_wb_ so don't use 0.3.5 for now
2021-03-25 08:47:46
maybe we should announce this more widely, should we put a warning at the top of the description of the 0.3.5 release or something like that?
_wb_
2021-03-25 09:35:44
yes
2021-03-25 09:36:08
it should be a simple fix once the bug is found
2021-03-25 09:36:26
so let's also do a 0.3.6 with the fix today
2021-03-25 09:38:33
luca found the bug
2021-03-25 09:42:14
https://tenor.com/view/cute-little-find-cute-discovery-mantis-wildlife-exploration-gif-19052417
2021-03-25 10:57:50
added a warning to https://gitlab.com/wg1/jpeg-xl/-/releases/v0.3.5
2021-03-25 10:58:05
bug is fixed in the private repo
improver
_wb_ it's a specialized code path (for faster decode) that appears to be not quite exactly equivalent to the generic code path, causing trouble (which went undetected by roundtrip tests because encoder and decoder both use the same buggy code)
2021-03-25 12:47:09
tbh that's not very good testing if it doesn't include all of implementations (not only optimized ones)
2021-03-25 12:47:47
but, well, i guess even in all of impl cases bug could be in some encoding/decoding routines if used symmetrically
_wb_
2021-03-25 12:48:41
yes, well we're adding a test to use the slow path on encode to check that the fast decode path also works there, that would have caught this one
2021-03-25 12:49:35
but the more fundamental way to test such regressions is to have a corpus of jxl bitstreams and reference decodes and check that they still decode to something close to the reference decode
BlueSwordM
2021-03-25 03:25:41
For anybody who wants to download the 0.3.4 release, here's how to do it: `git clone --branch v0.3.4 https://gitlab.com/wg1/jpeg-xl --recursive`
Deleted User
_wb_ Quick fix is to let TreeToLookupTable in lib/jxl/modular/encode.h just immediately return false
2021-03-25 03:26:29
Shouldn't it be `lib/jxl/modular/encoding/encoding.h`?
_wb_
2021-03-25 03:27:15
yes, I was going by memory there
Nova Aurora
_wb_ bug is fixed in the private repo
2021-03-25 04:21:19
When is next sync?
_wb_
2021-03-25 04:22:46
<@!604964375924834314> could we do a sync today? the bug in 0.3.5 is severe enough to get a fix out quickly imo (bad bitstreams might get produced otherwise)
spider-mario
2021-03-25 04:23:05
yep, SG
username
2021-03-25 04:37:19
is the new version gonna be called 0.3.5.1 ๐Ÿค”
_wb_
2021-03-25 04:45:49
Nah just 0.3.6 is ok I think
Deleted User
2021-03-25 04:53:17
"0.3.5 Hotfix version"?
spider-mario
2021-03-25 04:55:31
sounds more rather than less confusing if there is a 0.3.5 that can be used and one that cannot
Deleted User
2021-03-25 04:56:42
Just override the old release silently? <:ugly:805106754668068868>
spider-mario
2021-03-25 05:12:40
0.3.6 is out with the fix
Nova Aurora
spider-mario 0.3.6 is out with the fix
2021-03-25 05:13:18
Thanks for the quick action!
_wb_
Just override the old release silently? <:ugly:805106754668068868>
2021-03-25 05:20:43
Better not to silently fix things when there was an encoder bug that could lead to bad bitstreams.
Petr
2021-03-25 06:56:10
Building for Windows on AppVeyor already finished. ๐Ÿ†’
2021-03-25 08:29:51
The AppVeyor link in the <#822120855449894942> could actually be shortened to https://ci.appveyor.com/project/EwoutH/jpeg-xl
Scope
2021-03-25 08:31:43
Yep (that was my initial suggestion, because the link to Artifacts is not universal)
Deleted User
2021-03-25 10:20:17
*Et voilร .* It's a bash script that relies on OptiPNG's palettization (if it's not installed, it fails silently and falls back to VarDCT). That's a band-aid, but it should kinda work. `cjxl_auto.sh` ```bash #!/usr/bin/env bash for file in "$@"; do if [ ! -f "$(dirname -- $0)/cjxl" ]; then echo "ERROR: cjxl not found in directory." exit 1 fi read -p "Enter VarDCT parameters [default: none]:" params if [ ${file##*.} != "png" ]; then echo "ERROR: $file is not a PNG file." else if [ ! -f "$file" ]; then echo "ERROR: $file doesn't exist." else if file "$file" | grep -q colormap; then for i in {9..3}; do $(dirname -- "$0")/cjxl "$file" "${file%.*}.jxl" -m -s $i -g 3 -E 3 --palette=1024 if [ -f "${file%.*}.jxl" ]; then break fi done else cp "$file" "${file%.*}.tmp.png" if [ -f "${file%.*}.tmp.png" ]; then if command -v optipng &> /dev/null; then optipng -o1 -silent "${file%.*}.tmp.png" fi if file "${file%.*}.tmp.png" | grep -q colormap; then for i in {9..3}; do $(dirname -- "$0")/cjxl "$file" "${file%.*}.jxl" -m -s $i -g 3 -E 3 --palette=1024 if [ -f "${file%.*}.jxl" ]; then break fi done else $(dirname -- "$0")/cjxl "$file" "${file%.*}.jxl" $params fi rm "${file%.*}.tmp.png" else $(dirname -- "$0")/cjxl "$file" "${file%.*}.jxl" $params fi fi fi fi done ``` *(**note:** I normally use tabs in my code but I had to convert to spaces because stupid Discord can't change tab width)*
Lastrosade
*Et voilร .* It's a bash script that relies on OptiPNG's palettization (if it's not installed, it fails silently and falls back to VarDCT). That's a band-aid, but it should kinda work. `cjxl_auto.sh` ```bash #!/usr/bin/env bash for file in "$@"; do if [ ! -f "$(dirname -- $0)/cjxl" ]; then echo "ERROR: cjxl not found in directory." exit 1 fi read -p "Enter VarDCT parameters [default: none]:" params if [ ${file##*.} != "png" ]; then echo "ERROR: $file is not a PNG file." else if [ ! -f "$file" ]; then echo "ERROR: $file doesn't exist." else if file "$file" | grep -q colormap; then for i in {9..3}; do $(dirname -- "$0")/cjxl "$file" "${file%.*}.jxl" -m -s $i -g 3 -E 3 --palette=1024 if [ -f "${file%.*}.jxl" ]; then break fi done else cp "$file" "${file%.*}.tmp.png" if [ -f "${file%.*}.tmp.png" ]; then if command -v optipng &> /dev/null; then optipng -o1 -silent "${file%.*}.tmp.png" fi if file "${file%.*}.tmp.png" | grep -q colormap; then for i in {9..3}; do $(dirname -- "$0")/cjxl "$file" "${file%.*}.jxl" -m -s $i -g 3 -E 3 --palette=1024 if [ -f "${file%.*}.jxl" ]; then break fi done else $(dirname -- "$0")/cjxl "$file" "${file%.*}.jxl" $params fi rm "${file%.*}.tmp.png" else $(dirname -- "$0")/cjxl "$file" "${file%.*}.jxl" $params fi fi fi fi done ``` *(**note:** I normally use tabs in my code but I had to convert to spaces because stupid Discord can't change tab width)*
2021-03-25 10:22:05
I'm not sure I understand what it does exactly
2021-03-25 10:22:26
what is this palettization thing?
2021-03-25 10:23:28
Does it create pallets for image that don't have ones ?
Deleted User
2021-03-25 10:23:37
Yep
Lastrosade
2021-03-25 10:24:48
then it test every speed ? `-s $i`
2021-03-25 10:24:54
that's got to be slow
Deleted User
2021-03-25 10:25:18
No, it's actually for weaker PCs
2021-03-25 10:25:47
If `-s 9` fails due to lack of RAM, lower effort is chosen
Lastrosade
2021-03-25 10:25:53
oh
Deleted User
2021-03-25 10:26:37
The loop breaks when it detects a JXL file
Lastrosade
2021-03-25 10:26:39
oh right yeah ```sh if [ -f "${file%.*}.jxl" ]; then break fi ```
diskorduser
2021-03-26 09:52:49
Just a suggestion. With a flag or something cjxl could write output file automatically with jxl extension. I think it will save sometime on typing. like if I type `cjxl -w image.png` , it should encode to image.jxl .
_wb_
2021-03-26 10:13:26
I guess it could make sense to do that by default, and have an option for benchmarking if you really want to encode without writing anything
Deleted User
2021-03-26 01:27:31
What if I wanted to do something like `cjxl a.png b.jxl` for whatever reason?
Petr
2021-03-26 01:29:08
If the output file is specified, it should be used IMHO.
_wb_
2021-03-26 01:29:25
yes, this would be just for the case when the output file is omitted
2021-03-26 01:29:40
I wonder what to do if the output file already exists btw
2021-03-26 01:29:45
currently we just silently overwrite
2021-03-26 01:30:34
which is probably ok (a lot of tools do that)
diskorduser
2021-03-26 01:30:41
Just silently overwrite like imagemagick?. I think it's harmless
_wb_
2021-03-26 01:31:27
but if we also do implicit output files, it might be a bit more problematic because we're possibly overwriting a file whose filename wasn't even mentioned
2021-03-26 01:32:00
in particular, what if we also let `djxl a.jxl` automatically save the result to `a.png`
2021-03-26 01:32:55
then `cjxl a.png` followed by `djxl a.jxl` would replace a.png with a lossy copy of itself
diskorduser
2021-03-26 01:37:07
Or do something like this ?
fab
2021-03-26 01:37:43
nhw encoder bad
diskorduser
fab nhw encoder bad
2021-03-26 01:38:47
Hmmm. I'm thinking about possibilities like adding suffix to the decoded image
fab
2021-03-26 01:40:27
why, i dn't want it.
diskorduser
2021-03-26 01:40:50
Only if output file was not specified
2021-03-26 01:41:18
Is that a problem?
fab
2021-03-26 01:41:24
to me yes
diskorduser
2021-03-26 01:41:47
How?
fab
2021-03-26 01:41:59
and for software makers
Petr
2021-03-26 02:11:09
Two days ago we discussed that it might be important for users to find out whether (frames of) jxl files are stored losslesly or lossily. Shall I submit an issue not to forget to implement it in libjxl (and jxlinfo), or will it happen "itself"? ๐Ÿ˜„
2021-03-26 02:28:29
itself = one of core devs takes care of it, based on the discussion here
_wb_
2021-03-26 02:29:36
We don't know if a frame is lossless or lossy, only if it's vardct or modular
Deleted User
2021-03-26 02:31:54
Even Modular frames can be lossy
2021-03-26 02:32:51
<@!794205442175402004> if the encoder uses lossy modular (`-m -Q`) or lossy palette, does the decoder know about that? Is that indicated at all in the bitstream?
Petr
_wb_ We don't know if a frame is lossless or lossy, only if it's vardct or modular
2021-03-26 02:36:58
I know. But you mentioned that it's possible to guess that it's lossless if it fulfils certain conditions. So showing at least vardct/modular would be cool and showing a good guess of being lossless would be even cooler. ๐Ÿ™‚ With current formats, advanced users know what's lossless and what's lossy. So the goal here would be to give them this piece of info as well, not to deprive them of something they're used to.
_wb_
<@!794205442175402004> if the encoder uses lossy modular (`-m -Q`) or lossy palette, does the decoder know about that? Is that indicated at all in the bitstream?
2021-03-26 03:01:44
The modular bitstream signals what transforms where used. There are only 3 transforms, but they have parameters and you can potentially do them multiple times (with different parameters). The 3 transforms are RCT, Squeeze, and Palette.
2021-03-26 03:02:25
Squeeze and Palette can be used in a lossless or in a lossy way.
2021-03-26 03:02:54
From the decoder's point of view, there is no difference though.
2021-03-26 03:08:05
Default lossy modular does a default Squeeze transform, and then quantizes the residuals (it does that by dividing them by a constant per zoomlevel/channel, and by setting that constant as the multiplier in the MA tree, with the zero predictor). You could investigate the tree to see if there are leaf nodes with multipliers, since that could indicate lossy compression (but technically you could also do lossless compression using multipliers).
2021-03-26 03:08:39
Default lossy modular also uses XYB instead of RGB, which is a non-reversible color transform so an indication that it's lossy
2021-03-26 03:08:51
(but you could do non-default lossy modular in RGB too)
2021-03-26 03:10:11
In short: forensically, knowing what the current encoder does, you could make an educated guess about whether something is lossy or lossless. But you cannot know for sure.
2021-03-26 03:10:18
It's the same in other formats btw.
2021-03-26 03:12:11
If I give you a PNG8, how can you tell if this is a lossless image that just happens to use only 256 different colors, or the result of e.g. pngquant on what was an image with many thousands of colors?
Petr
_wb_ If I give you a PNG8, how can you tell if this is a lossless image that just happens to use only 256 different colors, or the result of e.g. pngquant on what was an image with many thousands of colors?
2021-03-26 04:55:07
The difference is WHEN the lossy transform happens: Either before, or during encoding. Experienced users use lossless formats for lossless content and lossy for lossy.
2021-03-26 04:58:17
If someone uses pngquant (I love this tool BTW) then the compressibility improves, no nasty DCT-like artifacts are introduced and everyone is happy. The result is perfect for storing losslessly. And I wouldn't hesitate to call it a lossless content.
2021-03-26 05:00:59
Converting it to jxl losslessly makes perfect sense. Lossilyโ€ฆ doesn't.
_wb_
2021-03-26 05:03:57
Pngquant doesn't introduce dct artifacts, but try it on an image with many color gradients and it will not look so great...
Crixis
2021-03-26 05:04:25
Lossy format for lossy content not make much sense
_wb_
2021-03-26 05:07:09
2021-03-26 05:07:25
default pngquant output...
2021-03-26 05:08:11
I would hesitate to call that lossless content
Crixis
2021-03-26 05:09:48
default cjxl
lithium
2021-03-26 05:10:13
Try pingo -pngcolor or -pngfilter ?,can keep RGB24 or RGBA32
_wb_
2021-03-26 05:12:06
I know, most optimizers will do that, just saying color quantization is a lossy operation
2021-03-26 05:12:16
2021-03-26 05:12:25
without the dithering it can be even ridiculously lossy
2021-03-26 05:12:41
artistically lossy, in a way
Petr
Crixis Lossy format for lossy content not make much sense
2021-03-26 05:14:26
My mistake in formulation, sorry. I mean lossy for photos.
2021-03-26 05:15:46
In case of quantisation, it depends on type of input. Many images are very suitable for pngquant.
lithium
2021-03-26 05:17:03
Some people believe pngquant(pal8) can get visual lossless <:FeelsSadMan:808221433243107338>
2021-03-26 05:19:48
I saw some anime content site using webp lossy and png pal8, break every drawing content...
_wb_
2021-03-26 05:20:54
It depends on the input. My point was: given a png8, you cannot really know if it is lossy or lossless.
2021-03-26 05:21:56
Even given a png24, you cannot really know. You can do "near-lossless" techniques with png24, and you can crank them up to visibly lossy...
lithium
2021-03-26 05:24:25
Just hope we can get jpeg xl fixed vardct to convert every drawing content ๐Ÿ™‚
Petr
lithium I saw some anime content site using webp lossy and png pal8, break every drawing content...
2021-03-26 05:41:21
Of course, all operations including quantisation should be used when they make sense.
Crixis
lithium Just hope we can get jpeg xl fixed vardct to convert every drawing content ๐Ÿ™‚
2021-03-26 06:21:01
Avif like Vardct on anime on d 4 and for me jxl is the definitive format
Deleted User
lithium Just hope we can get jpeg xl fixed vardct to convert every drawing content ๐Ÿ™‚
2021-03-26 08:33:10
Or lossy palette generation with on-canvas color mixing
_wb_
2021-03-26 08:40:25
Yes, a jxlquant would be quite great. Make a palette of the most common colors, use delta palette entries and implicit palette colors to do the remaining colors. That will likely be very good for high-fidelity lossy anime-like images.
Pieter
2021-03-27 08:37:21
``` /home/pw/git/jpeg-xl/lib/profiler/profiler.cc: In constructor โ€˜jxl::Results::Results()โ€™: /home/pw/git/jpeg-xl/lib/profiler/profiler.cc:151:42: error: โ€˜void* memset(void*, int, size_t)โ€™ clearing an object of non-trivial type โ€˜struct jxl::{anonymous}::Accumulatorโ€™; use assignment or value-initialization instead [-Werror=class-memaccess] 151 | memset(zones_, 0, sizeof(Accumulator)); ```
2021-03-27 08:43:53
Hmm, checked out again and built again, and now it works.
2021-03-27 08:43:56
Nvm, I guess.
2021-03-27 08:45:59
How do I build jxl_from_tree ?
Deleted User
2021-03-27 08:51:38
https://discord.com/channels/794206087879852103/824000991891554375/825331280236380180
Pieter
https://discord.com/channels/794206087879852103/824000991891554375/825331280236380180
2021-03-27 08:52:50
Dank.
2021-03-27 08:54:09
That's Dutch for "thanks", by the way.
veluca
Pieter That's Dutch for "thanks", by the way.
2021-03-27 09:24:19
I guessed from my (very limited) knowledge of German ๐Ÿ˜›
Deleted User
veluca I guessed from my (very limited) knowledge of German ๐Ÿ˜›
2021-03-28 01:34:07
Me too, it's really similar word "core" among many Indo-European languages, who wouldn't guess ๐Ÿ™‚
Fox Wizard
2021-03-28 10:24:01
Somehow I never actually heard a Dutch person use it though <a:Sadd:821038588346892368>
Pieter
2021-03-28 04:56:04
It's more common to say "bedankt" (thanked), or "dank u"/"dank je" ("thank you"), or "dankuwel"/"dankjewel".
2021-03-28 04:56:19
But that's less funny to use in an international chat.
Fox Wizard
2021-03-28 06:21:55
Ja stroopwafel
Pieter
2021-03-28 06:49:42
My favorite ridiculous Dutch word is probably klokhuis (the center part of an apple, literally "clock house") or boterham (a slice of bread, literally "butter ham").
Fox Wizard
2021-03-28 06:50:00
Hagelslag ;)
Pieter
2021-03-28 06:50:05
You win.
Fox Wizard
2021-03-28 06:50:10
Smeerkaas
2021-03-28 06:50:25
Keukenrol <:kekw:808717074305122316>
Pieter
2021-03-28 06:50:25
Hmm, what's funny about smeerkaas?
Fox Wizard
2021-03-28 06:51:06
It just sounds weird
Pieter
2021-03-28 06:51:57
Ok!
Fox Wizard
2021-03-28 06:52:44
Also, pik zwart <a:ThinkingSphere:821038590091329557>
_wb_
2021-03-28 07:40:47
Dat was denk ik oorspronkelijk pekzwart
2021-03-28 07:40:58
Zo zwart als pek dus
2021-03-28 07:42:31
Pikfuif en fuifpik klinken allebei even slecht. Ik ben blij dat het JPEG XL is geworden ๐Ÿ˜…
Petr
2021-03-29 07:31:00
How difficult would it be to add a version (and possibly other metadata) to Windows binaries of cjxl, djxl and others? Of course it's not the most important thing in the world. I'm just curious.
2021-03-29 07:31:15
example:
_wb_
2021-03-29 07:35:41
I guess we could also add an icon. Someone who knows how to do that should update the build script for windows
Dr. Taco
2021-03-29 12:12:13
ResourceHacker can do that, but I don't know about automating it
VEG
2021-03-31 10:18:17
2021-03-31 10:18:44
An icon with 16x16, 32x32 and 48x48 images inside.
2021-03-31 10:21:33
To add version information, icon or other resources, an *.rc file should be created and compiled using rc compiler, and the result should be passed to a linker with other object files.
2021-03-31 10:21:45
What toolkit is used for building jxl tools for Windows?
2021-03-31 10:28:32
2021-03-31 10:28:51
Seems like it is worth to play a bit with alpha channel to make 16x16 version a bit better.
Deleted User
2021-03-31 10:36:25
Sorry, but you used the old icon design. The new libjxl icon was changed a few weeks back. The official one is now: <:Xjxl:822166843313225758>
2021-03-31 10:36:41
`XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXX` ` XXXX\\\\\\\\\\XXXX XXXX//////////XXXX` ` XXXX\\\\\\\\\\XXXX XXXX//////////XXXX` ` XXXX\\\\\\\\\\XXXX XXXX//////////XXXX` ` XXXX\\\\\\\\\\XXXXXXXX//////////XXXX` ` XXXX\\\\\\\\\\XXXX//////////XXXX` ` XXXX\\\\\\\\\XX/////////XXXX` ` XXXX\\\\\\\XX///////XXXX` ` XXXX\\\\\XX/////XXXX` ` XXXX/////XX\\\\\XXXX` ` ///////////XX\\\\\\\XXXX` ` /////////////XX\\\\\\\\\XXXX` ` //////////////XXXX\\\\\\\\\\XXXX` ` XXXXXXXXXXXXXXXXXXXXXX\\\\\\\\\\XXXX` ` XXXX//////////XXXX XXXXXXXXXXXXXXXXXXX` ` XXXX//////////XXXX XXXX\\\\\\\\\\XXXX` ` XXXX//////////XXXX XXXX\\\\\\\\\\XXXX` `XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXX`
VEG
2021-03-31 10:38:32
Where is a huge version of this icon?
Deleted User
2021-03-31 10:40:21
Should be in the dev repo, but here you can also get it: https://res.cloudinary.com/mattgore/image/upload/v1617230369/jxl_bi_black_cyan.svg
2021-03-31 10:40:51
Yes, that's probably not necessaryy for the smallest versions.
2021-03-31 10:41:56
Luckily .ico supports different images for each size.
VEG
2021-03-31 10:42:18
OK, I'll make a small icon from it tomorrow ๐Ÿ™‚
Deleted User
2021-03-31 10:42:34
๐Ÿ‘
NeRd
2021-04-01 02:20:37
Here's my attempts to make some icon files from that SVG. I've made two versions: one with anti aliasing, and one without. The anti aliased version is larger in file size.
2021-04-01 02:20:43
2021-04-01 02:22:04
Contains 16x16, 32x32 and 48x48 icons.
Petr
Sorry, but you used the old icon design. The new libjxl icon was changed a few weeks back. The official one is now: <:Xjxl:822166843313225758>
2021-04-01 07:50:37
Is this some April fool joke? Where was it discussed?
VEG
2021-04-01 07:50:54
Oh, I forgot that it 1st of April and believed it ๐Ÿ˜†
spider-mario
VEG To add version information, icon or other resources, an *.rc file should be created and compiled using rc compiler, and the result should be passed to a linker with other object files.
2021-04-01 10:24:29
yup, I started looking into this recently but itโ€™s not yet ready (I think we would like not to have to update the version number in 500 different places when we bump it, so the build files should pass it to the .rc as a preprocessor argument)
2021-04-01 10:25:14
having this .ico there would be great, not sure of the legal implications regarding copyright
_wb_
2021-04-01 10:49:10
That's up to <@404585766799278081>. The base image is CC0 so that's no issue.
NeRd
2021-04-01 11:46:20
No worries, I keep forgetting that the CC0 license doesnโ€™t apply to derivatives automatically! Iโ€™d like them to be under the CC0, as the original image was.
Jim
2021-04-01 12:21:29
I heard JPEG XL version 2034 was released today with the most notable feature being that is creates your image from thought. Just just open a directory and think of the image you want and it creates it and saves it in that directory.
NeRd
2021-04-01 01:31:37
I heard that JPEG XXL decided to borrow some ideas from Brotli - the decompressor now includes a database of some of the most popular images on the web, so the .jxxl file just needs to specify which of these images it should decode to.
_wb_
2021-04-01 01:51:12
Yes, the decoder is 5 TB and contains an initialization dictionary consisting of mostly cats but also some celebrities
bonnibel
2021-04-01 01:58:06
as a result the movie cats (2019) is actually more efficient to represent as an animated jxxl than av1 or vvc
Scope
2021-04-01 02:05:46
Btw, this is not far from reality (except it uses a ~1 GB trained model required for decoding, if I am not mistaken): <https://hific.github.io/>
zebefree
2021-04-01 03:32:26
Don't worry, if 5 TB is too much there is also a version that can determine which emoji is closest to your image and output your image as unicode.
spider-mario
2021-04-01 09:23:07
I have forgotten how to count that low.
Pieter
spider-mario I have forgotten how to count that low.
2021-04-01 09:56:18
Googler, I assume?
spider-mario
2021-04-01 09:56:40
๐Ÿ‘
2021-04-01 09:56:57
are you / have you been, too?
Pieter
2021-04-01 09:57:50
I was an SRE 2012-2014.
spider-mario
2021-04-01 09:58:09
oh, cool
Nova Aurora
2021-04-01 10:00:22
SRE?
Pieter
2021-04-01 10:00:29
site reliability engineer
2021-04-01 10:00:44
devops in google-speak, i guess
spider-mario
2021-04-01 10:08:09
we have an internal joke around serving 5TB and my quote on forgetting to count that low
2021-04-01 10:09:00
https://www.quora.com/What-s-an-inside-joke-among-Google-employees/answer/David-Seidman
Pieter
2021-04-01 10:10:51
Does borgmon still exist?
spider-mario
2021-04-01 11:49:26
as far as I know, it does
2021-04-01 11:50:12
https://cloud.google.com/blog/products/devops-sre/welcome-to-the-museum-of-modern-borgmon-art has rather interesting images, by the way
Pieter
2021-04-02 02:40:30
<@604964375924834314> Pretty sure I've seen most of those already. Maybe it wasn't public until recently, but I do recall a museum of borgmon history from 2014.
Some1NamedNate
2021-04-13 01:12:37
Good news everyone! The latest build of Chrome Canary has the JPEG XL library!
Nova Aurora
2021-04-13 01:13:12
Cool!
Some1NamedNate Good news everyone! The latest build of Chrome Canary has the JPEG XL library!
2021-04-13 01:13:27
https://tenor.com/view/futurama-professor-new-goodnews-gif-5110959
BlueSwordM
2021-04-13 01:14:00
Imagine if you wrote Firefox instead <:kekw:808717074305122316>
Nova Aurora
2021-04-13 01:14:07
And coming to firefox in the summer... of somedayโ„ข๏ธ
Some1NamedNate
2021-04-13 01:14:28
*downloads firefox nightly*
Nova Aurora
2021-04-13 01:14:54
Firefox hasn't even started work on it, so I wouldn't hold my breath
BlueSwordM
2021-04-13 01:15:36
Yeah. Unless I become a good Rust/C web dev overnight, you won't see JXL support for a bit.
Some1NamedNate
2021-04-13 01:21:19
2021-04-13 01:21:25
Scientia
2021-04-13 01:24:59
Is the expired flag thing no longer an issue?
Scope
2021-04-13 01:28:48
No, the expired flag is still needed for 92.0.4475.2
Deleted User
2021-04-13 01:32:16
https://chromium-review.googlesource.com/c/chromium/src/+/2818169 > *Extend expiry_milestone for flag enable-jxl.* > **Merged** as __bb58f59__
VEG
Nova Aurora Firefox hasn't even started work on it, so I wouldn't hold my breath
2021-04-13 02:41:09
I think that Mozilla will start to work on it when JPEG XL is released and reference implementation reaches version 1.0.
2021-04-13 02:42:03
It is understandable why Google jumped in so early, because it is involved into JPEG XL development.
BlueSwordM
2021-04-13 02:42:08
Well, let's skip straight from 0.5 to 1.0 then <:megapog:816773962884972565>
VEG
2021-04-13 02:43:41
For example, APNG support was added to Chromium in 2017, 9 years after it was created and supported by Mozilla (in 2008).
2021-04-13 02:44:17
Seems like it was one of the reasons (in addition to "WebP isn't actually always better") why Mozilla didn't support WebP for long time.
2021-04-13 02:45:13
Google adds APNG support in 2017, and Mozilla adds WebP support not so long after.
2021-04-13 02:47:09
According to JPEG XL, I think that Mozilla won't have anything against, and will support it after it is considered to be "ready".
raysar
2021-04-13 03:48:47
there is no valid reason that they don't enable it in their to do list.
190n
2021-04-13 07:26:25
is there any timeline on when the development repository will be fully public (instead of being synced now and then)?
_wb_
2021-04-13 07:48:06
We need to get Alex on the discord again so he can update us on that...
Deleted User
_wb_ We need to get Alex on the discord again so he can update us on that...
2021-04-13 08:56:51
Why did he leave?
_wb_
2021-04-13 09:33:12
I don't think he ever really joined
BlueSwordM
2021-04-13 10:18:50
Yeah he never came in the 1st place ๐Ÿ˜›
Nova Aurora
2021-04-14 12:42:49
First place has always been Jon
190n
2021-04-14 06:14:48
i guess i just want to play with the new jxl_from_tree :P
2021-04-14 06:14:54
why is the repo private anyway?
_wb_
2021-04-14 06:47:20
ISO rules when the spec is not ready yet
Deleted User
2021-04-14 06:47:50
So waiting for IS in June?
_wb_
2021-04-14 06:48:39
We needed to allow the possibility of contributors making closed source contributions (even though nobody wanted that, but ISO rules say you have to allow it)
2021-04-14 06:48:56
No, we can do it now, I think
2021-04-14 06:49:31
Just some practical things to arrange, like setting up the CLA bot and stuff
Deleted User
2021-04-14 06:50:03
I think that improving the code itself is more important right now
spider-mario
2021-04-14 08:59:13
ouch ๐Ÿ˜„
tufty
2021-04-14 03:44:28
Hello everyone, I've been having a quick stab at adding libjxl support to libvips https://github.com/libvips/libvips/pull/2181 I was wondering about chunk read and write, ie. reading and writing images in a series of small chunks of pixels, rather than all at once I don't see the API for this, is it possible or planned with libjxl? I'm probably just being dumb
_wb_
2021-04-14 04:00:15
It is possible with the bitstream, but not so easy, and not yet implemented, let alone exposed via the API
tufty
2021-04-14 04:01:29
ah ok, thanks I'll leave that on the TODO for now then
_wb_
2021-04-14 04:01:30
AC tiles are 256x256, DC tiles are also 256x256 which corresponds to 2048x2048 in the image
tufty
2021-04-14 04:02:09
that sounds promising, so at least 2kx2k tiles should be supported at some point?
_wb_
2021-04-14 04:02:32
Making an encoder that encodes a 2048x2048 at a time should be doable, if you don't care about global optimization of the entropy coding
tufty
2021-04-14 04:03:29
libvips is used with huge images (>200,000 x 200,000 pixels), so chunkwise read and write would be a very useful feature for us, yes