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

Pashi
2022-07-06 05:45:08
But I don't want to rush things. If there really are good reasons to take more time in order to increase adoption in the long run then take all the time you need... but ya know, the format is already frozen, ibjxl is just a library...
2022-07-06 05:46:07
It doesn't even have to be the best or the only jxl compatible codec library
Fraetor
2022-07-06 10:12:56
I think it is mostly that there are major API changes until version 1.0, so programs would have to redo a lot of the work of implementing to update.
2022-07-06 10:13:30
But yeah, it would be nice to have a new release soon.
Moritz Firsching
2022-07-06 02:55:07
We are planning on making a 0.7 release very soon, before making verison 1.0!
Pashi
Pashi It doesn't even have to be the best or the only jxl compatible codec library
2022-07-06 03:34:49
It's a chonky c++ library with a huge number of dependencies too...
Fraetor
2022-07-06 04:24:37
Maybe yurume's jxsml will save us all.
fab
Moritz Firsching We are planning on making a 0.7 release very soon, before making verison 1.0!
2022-07-06 04:48:36
i hope you wait for october
2022-07-06 04:48:46
https://discord.com/channels/794206087879852103/794206170445119489/994276090061275186
2022-07-06 04:48:52
just see this stuff
2022-07-06 04:49:11
about jxl vardct quality
2022-07-06 04:49:32
is it too variable and bad
2022-07-06 04:49:49
especially moe than 0.710 d
2022-07-06 04:50:30
spoiler is it epf 3
2022-07-06 04:51:32
wikipedia is already good updated
Deleted User
2022-07-13 01:24:28
I am currently working on a c++ project where I want to convert images to jxl using libjxl However it is not possible in the system to read from file, the image is present as an unsigned int* to raw image data, similarly as in stb_image Can I use this raw image data in libjxl to encode a BLOB or something like that that I can send over TCP to a a JXL decoder where it decoded back into an unsigned int* to raw image data? I can only find the one code example on github where it reads image data from and to file, this is not useful for me. Or more code example in general? Thank you very much
2022-07-13 01:25:42
Also this is not strictly JXL related but if someone here knows how to set ImageMagick in c++ to JXL mode that would probably also solve my problem
Moritz Firsching
Moritz Firsching We are planning on making a 0.7 release very soon, before making verison 1.0!
2022-07-13 01:34:37
we are making good progress and currently are doing some fuzzing to make sure to have a less buggy 0.7 release.
Jim
2022-07-15 02:52:49
69% complete - nice
BlueSwordM
2022-07-16 04:32:59
<@794205442175402004> So, what's the licensing situation on XYB-MSSSIM?
_wb_
2022-07-16 04:33:50
well there's a PR to add it to the libjxl repo so that implies it has the same license (BSD-3)
2022-07-16 04:34:21
i'm still working on it btw, adding back some of the asymmetry that is in SSIMULACRA
2022-07-16 04:34:42
(normal SSIM is symmetric, it doesn't matter which is the original and which is the distorted)
BlueSwordM
_wb_ i'm still working on it btw, adding back some of the asymmetry that is in SSIMULACRA
2022-07-16 04:36:43
Oh very nice. I've been planning to use it in an another encoder tool, so the fact that the licensing is the same is good for me ๐Ÿ˜„
novomesk
2022-07-18 08:29:20
I have following report regarding Integer-overflow in jxl::QuantizedSpline::Dequantize (libjxl 0.6.1 is used). Is it something to worry about?
veluca
2022-07-18 08:54:10
ehhhh, not really
2022-07-18 08:54:22
you'll get weird looking splines at worst, I believe
yurume
2022-07-18 08:55:08
technically speaking it does an addition first and an int-to-float conversion later, which should be swapped I guess
veluca
2022-07-18 09:15:59
I think it got fixed in the meantime but I'm not entirely sure
2022-07-18 09:16:09
either way, IIRC it's not a security problem
190n
2022-07-18 04:14:16
i mean it could be if the compiler were less helpful
remsleep
2022-07-26 06:41:17
trying to build main branch on OSX, getting "error: use of undeclared identifier 'JxlDecoderSetBoxBuffer'; did you mean 'JxlDecoderSetJPEGBuffer'?" should main be building cleanly right now?
Moritz Firsching
2022-07-27 05:52:52
main should be building cleanly right now. Consider filing an issue with some more details
novomesk
2022-07-27 12:44:39
I observed that libjxl from git no longer works with system installed highway 0.17.0 . Does it mean that there should be new release of highway before next libjxl is released?
2022-07-27 12:47:59
https://github.com/google/highway/commit/e41973e26b3a870fcfb63fa2d4f2bcd57fe94de5 suggests that highway 1.0 is near.
Moritz Firsching
2022-07-27 02:26:57
yes
Vincent Torri
2022-07-27 08:09:18
highway 1.0 is released
Traneptora
2022-07-27 08:10:37
noice
2022-07-27 08:11:43
https://github.com/google/highway/releases/tag/1.0.0
2022-07-27 08:11:44
yup
novomesk I observed that libjxl from git no longer works with system installed highway 0.17.0 . Does it mean that there should be new release of highway before next libjxl is released?
2022-07-27 08:12:13
they broke the ABI but not the API, so try recompiling
Vincent Torri
2022-07-27 08:56:08
i've heard that some libjxl devs are prepariing the libjxl 1.0 release, right ?
monad
Vincent Torri i've heard that some libjxl devs are prepariing the libjxl 1.0 release, right ?
2022-07-28 10:45:28
https://discord.com/channels/794206087879852103/848189884614705192/991258530067791962
BlueSwordM
2022-08-03 10:09:10
<@853026420792360980> Do you have an idea of why Lynne views storing DCT values as floats instead of ints as a problem? ```but I do think it should be 16-bit int, not float I'm pretty sure the spec's mention of float is just a suggestion, any half-serious implementation must be fixed-point otherwise jxl is a trashfire of a research codec that will never get adoption```
2022-08-03 10:10:17
Maybe it's because of HW decode or in-order CPU cores absolutely detesting having to use their FPU?
2022-08-03 10:13:02
I mean, for lossless coding, you obviously want to use int DCTs over float DCTs, but for lossy, there is a definite benefit to using float DCTs, unless your system has a bad FPU backend.
Traneptora
BlueSwordM <@853026420792360980> Do you have an idea of why Lynne views storing DCT values as floats instead of ints as a problem? ```but I do think it should be 16-bit int, not float I'm pretty sure the spec's mention of float is just a suggestion, any half-serious implementation must be fixed-point otherwise jxl is a trashfire of a research codec that will never get adoption```
2022-08-03 10:49:56
fixed point is massively faster than floating point and much easier to implement in hardware
2022-08-03 10:50:14
but she is correct that it is just a suggestion. "float" in the spec in most places just refers to real numbers, not implementation
2022-08-03 10:51:18
she is saying that *if* the spec *requires* floats, then it is a problem
2022-08-03 10:51:22
but it doesn't, it just uses real numbers
BlueSwordM
Traneptora but she is correct that it is just a suggestion. "float" in the spec in most places just refers to real numbers, not implementation
2022-08-03 10:52:55
Oh <:kekw:808717074305122316>
2022-08-03 10:53:03
Now that makes a lot more sense.
2022-08-04 04:58:01
Actually, I'm wondering if we'll see optimizations in this regard for libjxl to speedup encoding and decoding.
The_Decryptor
2022-08-04 05:32:44
https://github.com/libjxl/libjxl/pull/836 < There's some fixed-point code already in libjxl
yurume
2022-08-04 05:40:37
oh, I didn't realize that those specialized codes for ARM actually uses fixed point instead of floating point!
BlueSwordM
2022-08-04 06:01:30
But yeah, my main worry with moving from float DCTs would be a slight loss of compression performance in lossy mode, so I wonder if what bombzen is true: real numbers, not an implementation.
_wb_
2022-08-04 06:03:11
Video codecs tend to have fixed point specs because 1) they are designed for hw implementation, 2) they need to be fully specified, because any small error could accumulate to larger errors after many frames.
2022-08-04 06:04:44
Jxl has a 'real numbers' spec plus conformance thresholds that define how much precision implementations need to have to conform to a profile/level
2022-08-04 06:08:04
At some point we'll probably have a hardware profile/level that can be implemented in fixedpoint. It will probably be limited to 10-14 bits worth of precision - maybe there will be more than one of these, the simplest for SDR only.
2022-08-04 06:13:39
Jxl is not a 'hw-only' codec though, and e.g. on modern x86, float arithmetic is actually quite cheap, and so is int32 arithmetic. So we saw no reason to limit the precision to something rather low (say 12-bit) so the whole thing can be implemented in hw.
eddie.zato
2022-08-05 03:24:15
Build `libjxl` with `ucrt64/msys2` and get this: ```bash $ libjxl/build/tools/cjxl -V WARNING: CPU supports 1a00 but software requires 2000000000000000 cjxl v0.7.0 980c90f [AVX2] Copyright (c) the JPEG XL Project ``` CPU - ryzen 7 5700x
JendaLinda
2022-08-05 05:02:40
It's a known issue but it doesn't affect functionality. You don't need to worry about it.
Kleis Auke
2022-08-09 04:49:18
According to <https://github.com/google/highway/issues/882> that "CPU supports ..." warning should be fixed with commit <https://github.com/google/highway/commit/51d5f80987e4dc4771a9f12ccbb548e9416503e6> (v1.0.0), but with that version I still see this warning.
2022-08-09 04:50:29
Ah, I should probably test with commit <https://github.com/google/highway/commit/9b6b473890bb6a43f5cd4786f9c214f0aa4e6420>, which didn't make it into v1.0.0.
Traneptora
2022-08-14 05:27:02
it's indeed a bug in highway, not in libjxl
2022-08-14 10:18:38
What is the preferred replacement to `JxlDecoderDefaultPixelFormat`?
2022-08-14 11:11:36
it appears I'm not using it, I'm just wondering
2022-08-14 11:11:39
just set it manually?
_wb_
2022-08-15 05:44:46
I think nobody is using it, because if you think about it: why would an application use it?
Traneptora
2022-08-15 12:42:17
good point, you'd rather just get whatever pixel format you need
2022-08-15 12:42:28
and if you want to preserve the original, you inspect JxlBasicInfo
2022-08-15 12:42:32
which is currently what ffmpeg does
Siegfried
2022-08-18 12:04:26
Hi, First of all, thanks for this amazing new image format! I have a question regarding the fine tuning of extra extra channel compression and downsampling. I hope this is the right channel for that. Ideally, I'd like to specify a downsampling ratio and quality ratio independent for each extra channel. More or less the same way as I can currently specify a different quantisation on a per channel basis. It would look like that: ``` downsampling quality quality main_framebuffer 1 0.5 extra[0] 1 1.0 extra[1] 2 1.2 extra[2] 4 1.2 ``` So far, I managed to specify: - a quality ratio for the whole image - two downsampling ratios, one for the main framebuffer and one common to all subframes. But I cannot specify a downsampling and quality on a per framebuffer basis. Is such fine tuning possible and did not make the right API calls? Thanks!
_wb_
2022-08-18 03:09:34
This is certainly possible in the codec, but I think the current encode API doesn't expose that fine tuning yet
2022-08-18 03:10:05
Please open an issue to request it, it shouldn't be hard to implement and I agree that this would be a useful thing to have in the API
2022-08-18 03:10:30
there's no reason why e.g. alpha and depth should have the same downsampling and quality
Siegfried
2022-08-18 03:58:42
Thanks for you rapid answer! Added a little bit more context in the issue.
gurpreetgill
2022-08-23 07:58:47
hey! Does chrome not support progressive decoding of JPEG-XL yet? I encoded a jpeg using `cjxl` with the `--progressive` option but chrome seems to be rendering it sequentially rather than progressively
2022-08-23 07:59:21
i am on chrome 104.0.5112.101
_wb_
2022-08-23 08:48:43
nope, not yet. it shows groups incrementally but that's it, iirc
2022-08-23 08:48:53
it should be coming though afaiu
Moritz Firsching
gurpreetgill hey! Does chrome not support progressive decoding of JPEG-XL yet? I encoded a jpeg using `cjxl` with the `--progressive` option but chrome seems to be rendering it sequentially rather than progressively
2022-08-24 11:19:36
I'm working on it
gurpreetgill
Moritz Firsching I'm working on it
2022-08-24 01:09:45
nice, thank you! looking forward to it ๐Ÿ˜„
2022-08-24 01:43:57
Do we have a timeline on when that will be shipped and also when JXL will be enabled by default in Chrome?
2022-08-24 01:44:21
That will be a big boast for adaption for sure!
szabadka
2022-08-29 11:28:32
The first round of encoder simplification, a.k.a. `libjxl-tiny` is ready: https://github.com/libjxl/libjxl-tiny Implements encoding photographic images to JXL using a subset of encoder tools.
_wb_
2022-08-29 01:30:56
nice!
2022-08-29 01:32:52
do you have a description somewhere of what coding tools were removed or used in a simpler way than in libjxl?
2022-08-29 01:33:43
also we should probably do some benchmarking to see how libjxl-tiny performs compared to the various speed settings of libjxl encoding
2022-08-29 01:34:46
(objective metric benchmarking using butteraugli 2-norm and ssimulacra 2)
fab
2022-08-29 01:49:25
Anyone has the compile?
2022-08-29 01:49:37
Does it work?
szabadka
2022-08-30 07:05:40
I added a page to the readme about the coding tools: https://github.com/libjxl/libjxl-tiny/blob/main/doc/coding_tools.md
2022-08-30 07:13:09
As for benchmarking, the speed is between -e 4 and -e 5 (closer to -e 4) and the butteraugli-3-norm*bpp metric is about 5% worse than libjxl -e 7. However, this repository is only meant as a big experiment to see what complexity is necessary for the camera use-case to produce decent quality images. If we find that this particular speed-vs-quality setting makes sense, it should probably be added to the main libjxl encoder.
_wb_
2022-08-30 08:57:53
Are you going to attempt to do a fixedpoint version of things, or will it stay float?
2022-08-30 09:00:35
if things can somehow be done in int16_t (with maybe some int32_t for intermediate results if int16_t precision is not sufficient), it will likely be faster, especially on older arm.
szabadka
2022-08-30 11:14:04
There are no plans to implement a fixedpoint version at this time.
Traneptora
2022-08-30 05:02:32
I know Lynne wants to do her implementation of JPEG XL as fixed point
2022-08-30 05:02:40
but I'm not sure what her progress is on it
Moritz Firsching
gurpreetgill nice, thank you! looking forward to it ๐Ÿ˜„
2022-09-01 01:12:29
https://chromium-review.googlesource.com/c/chromium/src/+/3865432 adds progressive decoding in chrome
_wb_
2022-09-03 08:40:52
is it possible that current djxl does something quite horribly wrong when saving 10-bit images as png?
2022-09-03 08:41:47
looks like it is getting the endianness wrong or something like that
2022-09-03 08:45:28
embed
2022-09-03 08:45:34
https://embed.moe/https://cdn.discordapp.com/attachments/804324493420920833/1015543040003276871/example.jxl
_wb_
2022-09-03 08:46:12
this is what current djxl produces for this image:
2022-09-03 08:48:50
when you add a `--bits_per_sample 16` it does the right thing, but if you don't, it does something quite horribly wrong
Traneptora
_wb_ is it possible that current djxl does something quite horribly wrong when saving 10-bit images as png?
2022-09-03 07:23:13
PNG doesn't support 10-bit so how would you save a 10-bit image as PNG
2022-09-03 07:23:29
PNG only supports 8 and 16-bit per channel
2022-09-03 07:23:33
as well as paletted
_wb_
2022-09-03 07:35:31
I know, but djxl needs to do something sensible when converting a 10-bit jxl to png
2022-09-03 07:35:54
Either quantize to 8-bit or pad to 16-bit, but not whatever it is doing now
2022-09-03 07:37:40
I suppose it's just a matter of having more sensible defaults in the output codec configuration
2022-09-04 06:08:21
That's what it used to do, but I guess something regressed in the process of moving to djxl_ng
Pashi
2022-09-06 11:44:47
how is the current state of the stable decode API? Everyone always talks about the encoder but the decoder is what matters right now.
JendaLinda
2022-09-06 12:14:18
Bit depth that can't be directly represented in PNG must be upscaled to the nearest valid bit depth. The original bit depth is indicated by sBIT chunk. Instead of simple padding with zeros, the values should be upscaled by repeating the highest bits in the empty bits. More info here: https://www.w3.org/TR/PNG-Encoders.html#E.Sample-depth-scaling
novomesk
Pashi how is the current state of the stable decode API? Everyone always talks about the encoder but the decoder is what matters right now.
2022-09-06 12:29:27
Decode API is quite stable, just in 0.7.0 it was extended so you can use it to access metadata boxes (EXIF, XMP)
Pashi
2022-09-06 12:36:40
PNG really does seem needlessly complex, even for image coding experts.
JendaLinda
2022-09-06 03:04:10
PNG compression works exclusively with bytes, so the supported bit depths are only divisors and multiples of 8.
2022-09-06 03:05:50
This technique of upscaling is used pretty often, also for scaling lower bit depths to 8 bpc. Some hardware was using 5 bpc or 6 bps for example.
_wb_
2022-09-06 04:21:48
Is it equivalent to doing the actual calculation? E.g. padding 10 to 16 bits can be done also by multiplying every sample value by 65535/1023 and rounding to nearest integer.
2022-09-06 04:23:43
Just adding zeroes is obviously wrong because then white maps to 65472 instead of 65535, so it's a bit too dark.
JendaLinda
2022-09-06 04:49:52
As long as you get the original values after reducing to original bit depth, it's fine.
_wb_ Is it equivalent to doing the actual calculation? E.g. padding 10 to 16 bits can be done also by multiplying every sample value by 65535/1023 and rounding to nearest integer.
2022-09-06 04:55:03
This formula is mentioned in the documentation too. The bit shifting method was probably suggested for speed.
_wb_
2022-09-06 05:01:51
Yeah, though I am not sure if it still makes any measurable difference nowadays
JendaLinda
2022-09-06 05:08:11
That's fair. CPUs went a long way since then.
BlueSwordM
2022-09-06 05:14:04
Yes, but faster is indeed faster ๐Ÿ™‚
JendaLinda
2022-09-06 05:14:44
In case of JXL, it's using floats anyway, so if the range is 0.0 to 1.0, multiplying by 65535 and setting correct sBIT should do the trick.
Traneptora
2022-09-08 02:13:26
well JXL is using real numbers between 0.0 and 1.0 in the spec, whether it's fixed or floating point is an implementation detail
_wb_
2022-09-08 02:26:51
also they don't have to be between 0 and 1 ๐Ÿ™‚
Traneptora
2022-09-08 02:28:40
true
Pashi
novomesk Decode API is quite stable, just in 0.7.0 it was extended so you can use it to access metadata boxes (EXIF, XMP)
2022-09-09 04:53:37
This is cool. If decode API is stable why's it taking so long for people to link it and use libjxl to add decode support to more software?
novomesk
2022-09-09 07:23:29
Technically, it is not difficult. It depends on each person's priorities and motivation. If they want, they seek solution. If they don't want, they seek excuses.
vtorri
2022-09-14 02:51:36
why is sjpeg support available ? libjpeg-turbo is not sufficient ?
spider-mario
2022-09-14 08:02:11
it is, but we wanted to experiment a bit
vtorri
2022-09-14 11:18:37
couldn't deps.sh be reduced ?
2022-09-14 11:19:11
zlib and libpng are commonly installed these days, and anyway, it's the purpose of cmake to ask for them
2022-09-14 11:19:30
i just don't understand why there is deps.sh
2022-09-14 11:22:08
there are two kinds of poeple : those who develop, and those who use
2022-09-14 11:22:18
devs : they know how to install package
2022-09-14 11:22:31
to compile, even
2022-09-14 11:22:58
the users: they will use their package manager, which will deal with deps anyway
2022-09-14 11:23:25
so, for me, simplify all that stuff, always ask for system libs
2022-09-14 11:23:44
there are package for all of them
_wb_
2022-09-14 11:29:57
System libs are fine for zlib and libpng (though only on linux), but for highway and other deps, usually the system libs will be too old
vtorri
2022-09-14 11:31:42
then remove zlib and libpng
2022-09-14 11:31:57
they have not been updated for years
_wb_
2022-09-14 11:37:25
Libjxl doesn't depend on those anyway, it's only used in cjxl/djxl
vtorri
2022-09-14 11:39:24
it would also be nice if you print a summary at the en of CMakeLists.txt
Jim
2022-09-21 02:07:44
Congrats on the 0.7 release! <:JXL:805850130203934781> https://github.com/libjxl/libjxl/releases/tag/v0.7.0
fab
2022-09-21 02:18:45
Ok on Wikipedia is already updated
2022-09-21 02:18:54
For es it and en
Pashi
2022-09-21 11:42:34
It's nice having a new version after all this time
2022-09-21 11:42:44
Very nice
2022-09-21 11:43:08
Makes it much easier because compiling it is a bitch on most systems
2022-09-21 11:45:09
If it didn't have so many dependencies, and most systems were not so horribly out of date, it wouldn't be so bad to just compile it
BlueSwordM
2022-09-22 12:58:08
<@853026420792360980> <@179701849576833024> Is there like a test suite of XYB images somewhere in libjxl or in other places?
2022-09-22 12:58:30
Something rather nice just popped up, and we'd like to have a test suite of suitable images to be able to test stuff correctly: https://github.com/rust-av/yuvxyb
Traneptora
BlueSwordM <@853026420792360980> <@179701849576833024> Is there like a test suite of XYB images somewhere in libjxl or in other places?
2022-09-22 01:00:39
not that I'm aware of
_wb_
2022-09-22 07:50:22
iirc clang > gcc
2022-09-22 07:51:34
but I dunno if it makes a big difference, a lot of stuff is basically manually vectorized using highway so compiler might not matter that much
2022-09-24 11:55:30
Ideally we would losslessly (though not reversibly) transcode CMY, and decode K to pixels
Pashi
2022-09-25 12:39:01
I thought JPEG XL was a superset of JPEG
Traneptora
Pashi I thought JPEG XL was a superset of JPEG
2022-09-25 03:39:07
VarDCT is able to do anything a particular subset of the JFIF standard supports, namely the widely supported subset
2022-09-25 03:39:28
the original JPEG standard is huge, and even supports things like HDR and the like, it's way before its time
2022-09-25 03:39:56
there's a particularly commonly supported subset of that standard that is often called "JPEG" by itself, and that common subset is what can be transcoded losslessly with VarDCT
Pashi
2022-09-25 05:57:27
And CMYK is not part of that I take it. Also what's "lossless but irreversible" mean?
B_Rรฆd15
2022-09-25 05:59:24
Means you can't recreate the original JPG image (meaning the original bitstream of course you could reencode) from the new JXL
Pashi
2022-09-25 06:19:37
In what sense is it lossless?
yurume
2022-09-25 06:20:08
it doesn't incur any further loss in quality
Pashi
_wb_ Ideally we would losslessly (though not reversibly) transcode CMY, and decode K to pixels
2022-09-25 06:23:36
So it would not be reversible because K would be decoded from DCT coefficients instead of losslessly recompressing them?
_wb_
2022-09-25 06:23:46
Yes
Pashi
2022-09-25 06:23:57
XL doesn't support more than 3 DCT channels?
_wb_
2022-09-25 06:24:04
No
2022-09-25 06:24:18
VarDCT is hardcoded for 3 channels
2022-09-25 06:24:52
It is designed for visual data with 1 luma channel and 2 chroma channels
Pashi
2022-09-25 06:25:47
The format as currently specified will never support multiple DCT channels it sounds like
2022-09-25 06:26:05
If I understand corrently
2022-09-25 06:26:41
additional, not multiple
_wb_
2022-09-25 06:27:06
Extra channels are modular and modular doesn't have dct
2022-09-25 06:27:29
You could of course do something weird like use a second layer for the K
Pashi
2022-09-25 06:28:05
Oh, that's right... But can alpha channel be DCT?
_wb_
2022-09-25 06:28:16
No
Pashi
2022-09-25 06:29:34
So there's no possible way to preserve the coefficients without an extension of the spec
_wb_
2022-09-25 06:30:00
Well you could put cmy in one layer and k in another layer
2022-09-25 06:30:14
Layers are zero-duration frames
Pashi
2022-09-25 06:31:01
But the decoder would have to know about this weird use otherwise one layer would be obscuring the other
_wb_
2022-09-25 06:31:12
Uhm
yurume
2022-09-25 06:31:26
you will need the third layer to actually merge K, doesn't it
_wb_
2022-09-25 06:31:33
There might be a way to make it work while respecting the spec too
Pashi
2022-09-25 06:31:56
Now you're using your noodle
_wb_
2022-09-25 06:31:59
The second layer could use kMul blending
2022-09-25 06:33:36
Then I _think_ that does the right thing as an approximation
2022-09-25 06:34:11
For actual color management it wouldn't work
2022-09-25 06:34:49
But approximately, i.e. the way cmyk jpegs without icc profile work, I think this would be ok
2022-09-25 06:35:15
Interpret cmy as rgb and then multiply everything by k
2022-09-25 06:37:37
Jxl cannot represent cmyk without icc profile, if you have a kBlack channel then you also need an explicit cmyk icc profile
2022-09-25 06:38:10
But this could be a workaround
Pashi
2022-09-25 06:42:10
is it true that most cmyk jpeg out in the wild does not have a profile?
2022-09-25 06:42:57
Also isn't K redundant because cmy is subtractive?
2022-09-25 06:43:20
Well no that's not the reason why it's redundant, but you know what I mean
2022-09-25 06:44:00
But yeah that's definitely designed for printing and ink
_wb_
2022-09-25 06:44:13
K is redundant in theory but not in practice: printing something with black ink will always look nicer than mixing black from CMY
2022-09-25 06:45:14
In particular text as pure K looks a lot better than text made from CMY
Pashi
2022-09-25 06:45:35
yes the print heads are never perfectly aligned either
2022-09-25 06:45:49
it makes a lot of sense for printing
_wb_
2022-09-25 06:45:52
But also sometimes "deep black" is used, which is "darker than black"
Pashi
2022-09-25 06:46:01
But stupid for storage
_wb_
2022-09-25 06:46:10
E.g. full K ink but still some color over it too
2022-09-25 06:47:47
This is why converting CMYK to RGB is not reversible, there are many ways to do the separation between K and CMY
2022-09-25 06:50:06
But also: using jpeg for cmyk is not such a great idea, since the main use of K is to keep text nice and crisp and that's not exactly where jpeg/dct shines...
2022-09-25 07:18:56
This is why we thought it was ok not to support 4-channel dct but to require all extra channels to be modular and only have dct for the 3 'photographic' channels. DCT is great for photographic data but for non-photo it is not effective (compression-wise) and the artifacts are pretty bad.
2022-09-25 07:20:43
All extra channel types we could think of were things that didn't really benefit from dct: alpha, K, selection masks, spot colors, depth maps, thermal, etc: none of them would really benefit from dct and any dct artifacts would probably be quite bad for those
2022-09-25 07:26:34
The philosophy in pik and fuif was similar in some respects, but also quite different in others: pik focused on psychovisual optimization of visual images, specializing on that, which lead to XYB and the VarDCT approach and an encoder that really knows what it is doing (since it works in an absolute color space and knows the semantics of the numbers it is working with), while fuif tried to be as generic and versatile as possible, which lead to modular.
JendaLinda
2022-09-25 07:30:12
As alpha channel is separate from VarDCT, is it possible to select different distance for VarDCT and alpha (or other extra channels)?
_wb_
2022-09-25 07:37:12
Yes
2022-09-25 07:37:30
We should add that to the api
JendaLinda
2022-09-25 07:40:50
Especially when the alpha is very simple, like a cutout from a photo, where alpha has just few levels, lossless alpha would result in smaller file than lossy.
2022-09-25 07:53:37
Lossless alpha has another advantage, VarDCT can safely discard contents of the fully transparent pixels, as it's guaranteed those will be fully transparent after compression.
_wb_
2022-09-25 08:06:31
Currently we do that already - fully transparent pixels get blurred heavily so vardct does not waste bits on them
2022-09-25 08:08:27
(just zeroing fully transparent pixels leads to edge artifacts bleeding into the visible pixels, so instead I made it smear out the visible pixel colors into the invisible pixels)
JendaLinda
2022-09-25 08:43:42
WebP does it too, although it only smears pixels inside the edge DCT blocks, other blocks just fills with black. It also uses lossless transparency.
veluca
2022-09-25 09:01:05
you could do a first grayscale DCT frame with the K data, then use a frame with the CMY data and use patch-blending to put the previous frame in the K channel IIRC
2022-09-25 09:02:17
that way you'd have something equivalent to CMYK JPEG for display, and that can be decoded back to it (although probably doing it bit-exact would require extending/changing the brunsli box a bit)
Pashi
2022-09-25 09:18:45
It sounds like there's nothing stopping JXL from losslessly preserving and recompressing other DCT formats like AVIF and webp?
Fraetor
2022-09-25 09:28:54
I think in principle is may be possible, but no code for it exists. It was mentioned in this issue: https://github.com/libjxl/libjxl/issues/315#issuecomment-880608516
2022-09-25 09:30:18
I think another big consideration is that there arn't the source images in AVIF quite the same. They are almost always created from a JPEG or PNG original currently, and thus you are better off going back to that original source than recompressing a lossy copy.
_wb_
2022-09-25 10:20:29
WebP and avif have directional prediction and encode the residuals with DCT or DCT-like transforms. JXL does not have directional prediction, and its set of transforms overlaps with that of avif/webp but it's not a superset.
JendaLinda
2022-09-25 10:34:46
Lossless JPEG transcoding to JXL is pretty unique feature. I don't know any other format that could do something like that. The structure of JPEG images is also quite simple, that's why they're so flexible. JPEGs can be rotated, flipped, cropped, concatenated etc. You can't do such things with video codecs.
_wb_
2022-09-25 10:43:48
JPEGs are also way more ubiquitous than WebPs and AVIFs. For most WebP/AVIF images in existence now, the original source is typically still available, I would assume. This is not the case for JPEGs.
JendaLinda
2022-09-25 10:52:45
That's right. Most cameras produce JPEGs.
Pashi
2022-09-26 08:07:50
lossy modular takes up more space than lossless modular?
_wb_
2022-09-26 08:19:21
depends on what kind of image and how lossy
2022-09-26 08:19:46
lossy modular disables quite a few transforms that are not safe w.r.t. residual quantization, like palette
Pashi
2022-09-26 08:19:52
You would think that lossy modular would start from lossless as a baseline and only make changes that further shave off bytes
_wb_
2022-09-26 08:19:54
or per-group RCTs
2022-09-26 08:19:58
no it doesn't
2022-09-26 08:20:25
some things are safe to do when doing lossless, but not if you're going to do things in a lossy way
2022-09-26 08:20:53
e.g. changing the RCT per group is fine when doing lossless, but when doing lossy it can introduce visible group boundaries
2022-09-26 08:22:38
same with palette: you can quantize away least significant bits of squeeze residuals if those come from full color channels, but if you do lossy squeeze on palette indices, a one-off can make a pixel a completely different color
Pashi
2022-09-26 08:26:41
I see.
2022-09-26 06:29:58
Maybe someone can make a smarter lossy mode in the future that uses lossless tricks like that but makes the image more compressible similar to GIF optimization tools or pngquant
2022-09-26 06:30:59
No reason why lossy mode can't use everything lossless mode does if youโ€™re clever enough about it.
2022-09-26 06:33:54
Then the artifacts might look nicer too compared to current lossy modular artifacts
2022-09-26 06:44:14
Sharp lines and smooth gradients rather than fuzziness
_wb_
2022-09-26 07:20:12
Yes, approximating an image using the whole modular toolbox including delta palette, lz77, squeeze, MA trees and all the predictors could almost certainly be more effective than what is done now, which is just squeeze and then using the multiplier in MA leaf nodes to quantize the residuals, using just the Zero predictor.
Pashi
2022-09-26 07:21:36
I do get the feeling the current encoder barely scratches the surface of JXL potential
2022-09-26 07:22:07
Hopefully in the future we will see lots of different 3rd party encoders tuned for different things
_wb_
2022-09-26 07:36:47
It's a very expressive bitstream, creative encoder writers can have fun with it for decades, I imagine
2022-09-26 07:37:43
I mean if you see what was possible already in the old jpeg, the difference between libjpeg and mozjpeg is quite big...
2022-09-26 07:40:30
And that's with a bitstream that is not very expressive at all โ€” besides the progressive scan script and the choice of huffman codes and quant tables, the encoder doesn't have many degrees of freedom...
Fox Wizard
_wb_ we need to work on Part 3 - conformance
2022-09-27 09:09:20
Yes :p
dkam
2022-09-29 12:23:01
Hi there! I'm updating a version of cjxl on Ubuntu ( Following along here https://github.com/libjxl/libjxl ). After running `sudo cmake --install .`, cjxl can't find the libjxl_threads library: ```shell libjxl/build $ /usr/local/bin/cjxl --version /usr/local/bin/cjxl: error while loading shared libraries: libjxl_threads.so.0.8: cannot open shared object file: No such file or directory ``` The libraries look like they've been installed: ```shell libjxl/build $ ls -l /usr/local/lib/libjxl* -rw-r--r-- 1 root root 7886642 Sep 29 07:02 /usr/local/lib/libjxl.a -rw-r--r-- 1 root root 3935096 Sep 29 07:02 /usr/local/lib/libjxl_dec.a lrwxrwxrwx 1 root root 13 Sep 29 06:42 /usr/local/lib/libjxl.so -> libjxl.so.0.8 lrwxrwxrwx 1 root root 15 Sep 29 06:42 /usr/local/lib/libjxl.so.0.8 -> libjxl.so.0.8.0 -rw-r--r-- 1 root root 4859336 Sep 29 07:02 /usr/local/lib/libjxl.so.0.8.0 -rw-r--r-- 1 root root 23782 Sep 29 06:55 /usr/local/lib/libjxl_threads.a lrwxrwxrwx 1 root root 21 Sep 29 06:42 /usr/local/lib/libjxl_threads.so -> libjxl_threads.so.0.8 lrwxrwxrwx 1 root root 23 Sep 29 06:42 /usr/local/lib/libjxl_threads.so.0.8 -> libjxl_threads.so.0.8.0 -rw-r--r-- 1 root root 24624 Sep 29 06:55 /usr/local/lib/libjxl_threads.so.0.8.0 ``` What have I missed / done wrong?
_wb_
2022-09-29 12:52:50
looks like something wrong in our install script I guess
2022-09-29 12:53:39
maybe try `sudo ldconfig`?
dkam
2022-09-29 01:05:15
Ha - that fixed it. Thanks!
diskorduser
2022-09-29 03:25:07
Jpg support HDR?
_wb_
2022-09-29 03:29:18
yes and no
2022-09-29 03:29:26
or rather, yes and yes and no
2022-09-29 03:30:03
the original jpeg spec supports up to 12-bit, so it can certainly do HDR. But nobody implements that, and the de facto jpeg is 8-bit only
2022-09-29 03:30:24
but even within 8-bit jpeg, you can kind of do HDR, if you do it carefully
2022-09-29 03:31:46
that is, the actual DCT coefficients are still ~12-bit, so if you implement everything with high precision (not with shortcuts for speed like in libjpeg-turbo), you can actually get a reasonable 10-bit image out of a de facto standard jpeg
2022-09-29 03:33:41
add an ICC profile that corresponds to XYB, and it can kind of be used for HDR โ€” it's not perfect, but probably not really worse than what you get in 10-bit avif
2022-09-29 03:34:50
so yes, the original jpeg spec supports HDR and yes, even the de facto jpeg format supports HDR but no, the widely used decoders like libjpeg-turbo will produce an 8-bit output so it will have banding
JendaLinda
2022-09-29 03:49:12
That's pretty surprising that JPEG could actually do HDR as the hardware capable of that simple wasn't there at the time. Computer screens could do 8bit at most and digital cameras were using sensors designed for capturing analog video. I'm also wondering what materials JPEG used to create the quantization tables as digital photography was kinda in it's early stage. I guess they used photos scanned from film?
_wb_
2022-09-29 03:55:39
Yes, they were really ahead of their time to consider 12-bit while they designed it when most displays could display just 16 colors (4-bit palette)
JendaLinda
2022-09-29 04:03:50
So jxl can losslessly represent 12 bit jpegs, right?
_wb_
2022-09-29 04:07:29
It can, but the jpeg bitstream reconstruction thing is only defined for de facto standard jpegs
2022-09-29 04:07:51
But the data itself could be stored without problems
JendaLinda
2022-09-29 04:26:52
So theoretically jxl can transcode 12 bit JPEG omitting the reconstruction data and the resulting jxl image can be decoded to pixels with the full precision.
2022-09-29 04:36:45
The jbrd itself is curious. I've noticed that if the source jpeg file is just plain JFIF, the JFIF header is clearly visible in the jbrd box. If the source jpeg also includes EXIF, the JFIF header is not visible. Where did it go?
_wb_
2022-09-29 04:47:02
a few of the commonly occurring things are basically hardcoded in the jbrd spec
2022-09-29 04:52:08
for example:
2022-09-29 04:54:38
so strings like "Exif\0\0", "ICC_PROFILE" and that string used for XMP metadata are just hardcoded in the spec instead of getting encoded explicitly in the jbrd
JendaLinda
2022-09-29 05:01:00
Yes, EXIF, ICC and other blocks are moved to their own boxes. JFIF header goes in the jbrd box. The curious thing is that if EXIF is present at the same time, the JFIF header is encoded differently so it's not clearly visible.
_wb_
2022-09-29 05:05:59
well most of jbrd contains brotli-compressed data
2022-09-29 05:07:16
if it's not a lot of stuff to encode, then I guess brotli will fallback to just storing the stuff uncompressed, which is probably why you can see strings like JFIF
2022-09-29 05:07:52
but if there's more stuff, it will compress it and you'll not see it anymore
JendaLinda
2022-09-29 05:28:01
That makes perfect sense.
spider-mario
_wb_ add an ICC profile that corresponds to XYB, and it can kind of be used for HDR โ€” it's not perfect, but probably not really worse than what you get in 10-bit avif
2022-09-29 05:36:03
there is now also a cicp chunk in ICCv4.4, which the nightly of Chrome 108 implements: https://crrev.com/c/3913326
2022-09-29 05:36:11
but low-precision JPEG at the moment
_wb_
2022-09-29 06:05:19
Oh, so you can do PQ/HLG in an icc profile now?
spider-mario
2022-09-29 06:43:03
yes, at long last
2022-09-29 06:43:11
djxl now generates such profiles
2022-09-29 06:43:30
https://github.com/libjxl/libjxl/pull/1753/files
ziemek.z
2022-10-02 06:07:16
HELP PLZ
2022-10-02 06:08:03
I'm working on updating libjxl in Squoosh to v0.7.0 and I'm stuck with something beyond my comprehension ๐Ÿ™
2022-10-02 06:08:05
https://github.com/ziemek99/squoosh/tree/jxl-070
2022-10-02 06:09:14
Clone it, then run `npm install; npm run build` in `codecs/jxl`.
2022-10-02 06:10:22
Wait till the end and see Emscripten's (?) errors... WTF
Pashi
2022-10-03 02:04:11
How backwards-compatible is 0.7?
2022-10-03 02:04:46
Particularly, compile tine compatibility
2022-10-03 02:05:02
With projects that were using an earlier version of libjxl
2022-10-03 02:08:22
How much breakage is there with software using really old libjxl, if you swap the newest libjxl in for the old? How far back do you have to go before you encounter problems of the newer version missing API surface from the old one?
dkam
2022-10-03 03:58:30
Does anyone know how to build ruby-vips on Ubuntu, using my local build, rather than the ubuntu supplied libraries?
_wb_
Pashi How much breakage is there with software using really old libjxl, if you swap the newest libjxl in for the old? How far back do you have to go before you encounter problems of the newer version missing API surface from the old one?
2022-10-03 05:15:23
Depends a bit on what they used. I think the basic decode api hasn't changed much.
Traneptora
2022-10-04 12:56:13
if a JXL is marked as 10-bit or 12-bit
2022-10-04 12:56:29
is there a way to retrieve that 10- or 12-bit data directly?
2022-10-04 12:56:36
without having to receive 16-bit and dithering it down yourself
2022-10-04 12:56:48
or, for the encoder API, send 10 or 12-bit data?
2022-10-04 12:57:08
I ask because lossless in theory should support sending and receiving 10 and 12 even if 16-bit is fine for lossy
_wb_
2022-10-04 02:08:06
https://github.com/libjxl/libjxl/pull/1807
2022-10-04 02:08:38
I guess <@987371399867945100> is already on it
Traneptora
2022-10-04 02:23:05
also keep in mind that in order to accept 12-bit input you have to actually accept 12-bit input
2022-10-04 02:23:16
not just 16-bit input with four leading zeroes
2022-10-04 02:23:37
just like how rgb24 and rgb0 are two different formats
2022-10-04 02:25:21
or output
2022-10-04 02:25:28
this is probably easier if it's done planar, anyway
_wb_
2022-10-04 03:18:04
yeah I guess we'll need to support all the ways in which people may want to do this: 12-bit as 16-bit with lsb being irrelevant, or with msb being zeroes, or literally as 12 bits (so two samples are 3 bytes), where I suppose you can do the packing into bytes in different ways too: `Aaaaaaaa aaaaBbbb bbbbbbbb` is one way (where A is the msb of the 12 bits of the first sample) `aaaaaaaa aaaAbbbb bbbbbbbB` is another way `Aaaaaaaa Bbbbbbbb aaaabbbb` could even also be a way
yurume
2022-10-04 03:39:49
another possibility is to read it as a native endian 4 byte integer, where only lower or upper 24 bits are used depending on the endian
JendaLinda
2022-10-04 03:56:06
That kinda reminds me how 2bpp and 4bpp are packed into bytes, but that makes sense as it aligns well with bytes. 555 and 565 were usually packed into 16bit words. AFAIK 10bit RGB is being packed into 32bit dword, leaving 2 bits unused.
_wb_
2022-10-04 04:19:07
I think we need to implement something that is generic enough to support formats that are actually used (by relatively major things), without going all the way to supporting every possible way we can imagine in which you can put X times N bits into Y bytes
yurume
2022-10-04 04:20:12
probably ceil(N/8) byte plus padding should be the default, with some exceptions made for individual packed formats like 10-10-10-2
2022-10-04 04:22:13
I think OpenGL pixel format (https://registry.khronos.org/OpenGL-Refpages/gl4/html/glTexImage2D.xhtml) is close to a good source for those exceptions, having things like GL_R11f_G11F_B10F
2022-10-04 04:22:41
if we are actually going to cover those cases in the API
JendaLinda
2022-10-04 04:51:32
Agreed, samples padded to whole bytes are easy to convert to anything else by the application. Adding some pixel formats used by common APIs would be nice bonus.
Traneptora
_wb_ yeah I guess we'll need to support all the ways in which people may want to do this: 12-bit as 16-bit with lsb being irrelevant, or with msb being zeroes, or literally as 12 bits (so two samples are 3 bytes), where I suppose you can do the packing into bytes in different ways too: `Aaaaaaaa aaaaBbbb bbbbbbbb` is one way (where A is the msb of the 12 bits of the first sample) `aaaaaaaa aaaAbbbb bbbbbbbB` is another way `Aaaaaaaa Bbbbbbbb aaaabbbb` could even also be a way
2022-10-05 01:38:55
id assume first vs second would be configurable and depend on endianness, third seems unlikely to be useful
szabadka
2022-10-05 10:54:14
https://github.com/libjxl/libjxl/pull/1812 adds support for input/output formats with leading zeros
ziemek.z
ziemek.z I'm working on updating libjxl in Squoosh to v0.7.0 and I'm stuck with something beyond my comprehension ๐Ÿ™
2022-10-05 05:17:22
So I guess it went unnoticed... ๐Ÿ™
_wb_
ziemek.z So I guess it went unnoticed... ๐Ÿ™
2022-10-05 05:30:51
I noticed but have no clue
yurume
2022-10-05 06:09:03
I tried to reproduce that and my nvm tried to build nodejs from scratch somehow
username
2022-10-05 06:48:48
speaking of things that may have possibly gone unnoticed, the benchmark_xl binary is busted on windows and doesn't function anymore in newer commits I don't know which commit broke it but I assume it was around when xyb jpegs where added since I have a binary from before then and it seems to work
2022-10-05 06:49:22
I would make a issue on github but I prefer just using discord
_wb_
2022-10-05 06:52:50
How do you mean, busted? What happens when you run it?
spider-mario
2022-10-05 06:58:23
Iโ€™m getting this: ``` tools\benchmark\benchmark_xl.cc:1121: JXL_CHECK: Args()->AddCommandLineOptions() ```
2022-10-05 06:58:27
let me try and bisect
2022-10-05 07:07:47
``` de08116d14db785431f3efb651dcf2af15bbb682 is the first bad commit commit de08116d14db785431f3efb651dcf2af15bbb682 Date: Mon Aug 22 09:40:05 2022 +0200 Improve 'custom' codec in benchmark. Add options to prepare input of custom codec in arbitrary file format and colorspace. Add option to suppress custom codec stdin/stdout. Fix endianness of pfm headers and check correct endianness of ppf when encoding into ppm/pgm. ```
2022-10-05 07:10:39
<@794205442175402004> just sent you a fix
_wb_
2022-10-05 07:13:59
2022-10-05 07:14:58
Thanks <@245794734788837387> for noticing this and <@604964375924834314> for fixing it!
ziemek.z
_wb_ I noticed but have no clue
2022-10-06 05:31:32
Maybe <@228116142185512960>?
BlueSwordM
2022-10-08 03:10:41
<@179701849576833024> Also is there a tool in the libjxl repo or anywhere that can just output raw XYB data either by converting YUV or RGB to it or by decoding a jxl file? There doesn't seem to be one at first glance.
_wb_
2022-10-08 06:14:42
There probably is a magic colorspace string for that
veluca
2022-10-08 07:24:49
Yeah I think <@604964375924834314> might know how
2022-10-08 07:25:31
Ah, see https://discord.com/channels/794206087879852103/803663417881395200/1028203576981463091
surma
ziemek.z Maybe <@228116142185512960>?
2022-10-08 10:18:08
Sorry, I donโ€™t have the setup to run it right now. What are the errors?
WoofinaS
2022-10-12 12:28:25
What matrix does libjxl use to do linear rgb to lms?
_wb_
2022-10-12 12:30:13
this one by default
2022-10-12 12:31:23
those are the defaults that you get if you don't signal a custom matrix; currently we only use defaults but we left the possibility open to change things (there's an optional header field for custom XYB)
WoofinaS
2022-10-12 12:31:52
Thanks!
Traneptora
2022-10-13 02:49:39
how does libjxl read/write 16-bit floats?
2022-10-13 02:50:24
I was under the impression that float16 was deprecated
_wb_
2022-10-13 03:22:05
https://github.com/libjxl/libjxl/blob/main/lib/jxl/dec_external_image.cc#L65
Traneptora
2022-10-13 03:23:42
is there any real advantage to doing so other than reading/writing 32-bit floats?
_wb_
2022-10-13 03:23:56
sure, it only uses half the memory ๐Ÿ™‚
Traneptora
2022-10-13 03:24:24
well, if I'm using floating-point values I probably don't quite care about RAM
_wb_
2022-10-13 03:24:30
also it is what GPUs can natively work with, iirc
Traneptora
2022-10-13 03:24:44
but from what you linked it appears there's a 32-bit-to-16-bit conversion there
_wb_
2022-10-13 03:25:17
yeah internally jxl uses 32-bit only
Traneptora
2022-10-13 03:25:31
wait what
2022-10-13 03:25:35
I thought internally it used 16-bit
_wb_
2022-10-13 03:25:52
no all buffers are 32-bit float
2022-10-13 03:26:45
well except some auxiliary uint8/uint16 things, but all sample values and dct coeffs are internally done in 32-bit float
Traneptora
2022-10-13 03:26:50
so from a client's perspective it's probably better to just interact with libjxl in 32-bit floats, assuming there's already 32/16 float conversions in the client
2022-10-13 03:27:11
which FFmpeg has, for example
_wb_
2022-10-13 03:27:35
yes, unless you're like chrome and you want to keep the memory size of decoded images low
2022-10-13 03:27:54
chrome uses 8-bit int buffers for SDR and 16-bit half-float for HDR, iirc
Traneptora
2022-10-13 03:27:57
I'm thinking of FFmpeg where the user would probably prefer to select how to dither 32-bit float to 16-bit
_wb_
2022-10-13 03:29:12
yeah just using float32 is probably best, the half-float thing is mostly for things like OpenEXR and GPUs
Traneptora
2022-10-13 03:30:44
oh, speaking of which, do we have samples of JXL files tagged as 32-bit float, both as grayscale, gray-alpha, RGB, and RGBA?
_wb_
2022-10-13 03:43:54
there's this one https://github.com/libjxl/conformance/tree/master/testcases/lossless_pfm
2022-10-13 03:45:15
for grayscale and alpha it's currently somewhat annoying to make a bitstream since afaik we don't have an input format for that โ€” PFM only does RGB
BlueSwordM
_wb_ chrome uses 8-bit int buffers for SDR and 16-bit half-float for HDR, iirc
2022-10-13 03:58:47
Isn't speed also a good reason?
2022-10-13 03:59:01
Dealing with 16b ints for 8-12b content is better and faster for CPUs.
_wb_
2022-10-13 04:00:39
yes, I suppose โ€” reducing memory kind of always is good for speed, memory bandwidth is often the bottleneck
Traneptora
_wb_ for grayscale and alpha it's currently somewhat annoying to make a bitstream since afaik we don't have an input format for that โ€” PFM only does RGB
2022-10-14 03:10:21
FFmpeg supports Gray32f, you can make it with that
2022-10-14 03:14:54
e.g.
2022-10-14 03:17:29
Deleted User
2022-10-15 08:57:41
`--bits_per_sample` doesn't work anymore in djxl. I get `Encode failed` when trying to get 16bpc png/ppm/pfm from VarDCT or 8 bit modular. I get <#805007255061790730> when going from 16 to 8.
2022-10-15 08:58:41
(tried 0.7, 0.8 behaves a bit different)
Moritz Firsching
`--bits_per_sample` doesn't work anymore in djxl. I get `Encode failed` when trying to get 16bpc png/ppm/pfm from VarDCT or 8 bit modular. I get <#805007255061790730> when going from 16 to 8.
2022-10-17 06:11:02
I can repo the "Encode failed", but couldn't get the glitch-art.. Consider opening an issue about that; it shouldn't happen
_wb_
2022-10-17 06:55:22
is it fixed already in the git version, maybe?
novomesk
2022-10-18 10:07:20
I need a clarification regarding JxlAnimationHeader.num_loops ( https://github.com/libjxl/libjxl/blob/main/lib/include/jxl/codestream_header.h#L95 ) When num_loops == 1 it means that whole animation should play exactly once? Or does it mean the animation rewinds once after first run and then plays again (so totally 2 times)?
_wb_
2022-10-18 10:32:26
0 = infinitely, 1 = once, 2 = twice, etc
novomesk
_wb_ 0 = infinitely, 1 = once, 2 = twice, etc
2022-10-18 10:38:19
Thx for confirmation!
w
2022-10-19 03:28:36
is this normal? im sure i used to be able to do 16 before ``` djxl 2_jxl/001.jpg.jxl --bits_per_sample 16 test.png JPEG XL decoder v0.8.0 [AVX2,SSE4,SSSE3,Unknown] Read 1643105 compressed bytes. JxlDecoderSetImageOutBitDepth failed DecompressJxlToPackedPixelFile failed```
_wb_
2022-10-19 05:07:34
Is that on current git version? There were bugs indeed
w
2022-10-19 05:08:32
yeah current git
_wb_
2022-10-19 05:21:12
That's not good, could you open an issue?
WoofinaS
2022-10-20 05:57:34
Is the butteraugli API in libjxl thread safe? It might just be written down in the read the docs and I'm dumb.
2022-10-20 06:05:28
Is there also docs for clarification on what HFasymmetry is?
Traneptora
WoofinaS Is the butteraugli API in libjxl thread safe? It might just be written down in the read the docs and I'm dumb.
2022-10-21 01:44:51
when you say thread-safe, how do you mean?
2022-10-21 01:45:53
all instances of the butteraugli api take a context struct
2022-10-21 01:46:04
so you could have multiple threads running on different context structs and there should be no thread-safety issues
2022-10-21 01:47:45
if you want to compute butteraugli in parallel for multiple images, this works
2022-10-21 01:48:20
if you want to compute butteraugli in series, or butteraugli for one image, I'd recommend using libjxl's setparallelrunner thing and just let it parallelize the computtation
WoofinaS
2022-10-21 02:14:24
Okay thanks
2022-10-21 02:28:15
Ah no wait, I meant if you could share the API pointer returned between multiple threads. I'd assume settings things like target intensity isn't but once it's properly configured it should be fine as long as all threads share the "same" settings.
Traneptora
2022-10-21 02:58:41
consider the scenario where I want to get the Exif or similar metadata from a compressed brob box in the libjxl container
2022-10-21 02:59:40
I subscribe to the `JXL_DEC_BOX` event
2022-10-21 02:59:45
then that event is fired
2022-10-21 03:00:02
I check the box type with decompress=true, it's `Exif`
2022-10-21 03:00:19
do I then call `JxlDecoderSetBoxBuffer` and then *immediately* call `JxlDecoderReleaseBoxBuffer`?
2022-10-21 03:00:29
or does there have to be a call to `JxlDecoderProcessInput` in between somewhere?
WoofinaS Ah no wait, I meant if you could share the API pointer returned between multiple threads. I'd assume settings things like target intensity isn't but once it's properly configured it should be fine as long as all threads share the "same" settings.
2022-10-21 03:07:39
I don't believe there's anything that says you can do that. That being said if you have a result computed you can probably share the result struct between threads, as it's *const*
WoofinaS
2022-10-21 03:08:36
Damn, thanks.
Traneptora
_wb_ That's not good, could you open an issue?
2022-10-21 04:51:48
https://github.com/libjxl/libjxl/pull/1842
2022-10-21 04:51:55
not sure if this fix is ideal
2022-10-21 04:53:03
the problem is that we don't update the JxlPixelFormat based on the requested JxlBitDepth
2022-10-21 04:53:19
I modified the file so it does, but there might be some better way to shuffle the pipeline here
2022-10-21 04:53:24
so this fix isn't required
_wb_
2022-10-21 04:54:15
Yeah in particular it would be nice if you can decode to 10-bit ppm etc too
Traneptora
2022-10-21 04:56:23
well `libjxl` itself doesn't support that
2022-10-21 04:56:42
but this fix just allows djxl to work with what libjxl currently supports
2022-10-21 04:56:56
since `--bits_per_sample=16` is currently broken on git master
2022-10-21 04:57:04
(and in release 0.7)
2022-10-21 04:58:08
I gotta get to class though so I'll look at your comments later if you have any
novomesk
Traneptora or does there have to be a call to `JxlDecoderProcessInput` in between somewhere?
2022-10-21 05:53:46
You have to call JxlDecoderProcessInput and handle JXL_DEC_BOX_NEED_MORE_OUTPUT if triggered. When another JXL_DEC_BOX or JXL_DEC_SUCCESS is triggered, you can call JxlDecoderReleaseBoxBuffer.
Traneptora
2022-10-21 06:08:24
I see, thanks. Can anything other than those two events (or error) be fired?
novomesk
2022-10-21 06:19:04
JXL_DEC_NEED_MORE_INPUT
Traneptora
2022-10-21 06:31:47
ic
Arcane
2022-10-21 09:16:40
WoofinaS
2022-10-21 10:24:59
~~Sorry for so many questions but~~ the fucntion `JxlButteraugliCompute` expects linear RGB as a input right?
Traneptora
2022-10-22 02:38:46
docs don't say. probably should, tbh.
MaskRay
2022-10-23 04:16:00
Does `cjxl a.jpg a.jxl` preserve exif? exiftool (the `exiftool` from the latest https://github.com/exiftool/exiftool) says there is no GPS location as in the original jpeg file. My libjxl copy has this commit https://github.com/libjxl/libjxl/pull/1834
2022-10-23 04:47:43
Sigh, exiv2 just doesn't display GPS location information for either jpeg or jxl. `exiftool -v3` says the original jpeg file has GPS location information under`[IFD0 directory with 13 entries]` Latest exiv2 prints some information but none is related to GPS ``` % /tmp/p/exiv2/out/release/bin/exiv2 PXL.jpg File name : PXL.jpg File size : 5028864 Bytes MIME type : image/jpeg Image size : 4080 x 3072 Thumbnail : image/jpeg, 37159 Bytes Camera make : Google Camera model : Pixel 6 Pro Image timestamp : 2022:08:28 16:03:57 File number : Exposure time : 0.001299 s Aperture : F1.9 Exposure bias : 0 EV Flash : No, compulsory Flash bias : Focal length : 6.8 mm Subject distance: 1.99 m ISO speed : 34 Exposure mode : Auto Metering mode : Center weighted average Macro mode : Image quality : White balance : Auto Copyright : Exif comment : % exiftool PXL.jpg | grep 'GPS Position' GPS Position : 37 deg 26' 56.84" N, 122 deg 9' 32.40" W ```
The_Decryptor
2022-10-23 05:29:29
As a stopgap `--compress_boxes 0` will (as the name implies) disable compression of the metadata boxes so exiftool/exiv can read them again
MaskRay
The_Decryptor As a stopgap `--compress_boxes 0` will (as the name implies) disable compression of the metadata boxes so exiftool/exiv can read them again
2022-10-23 05:47:17
Nice! ``` % /tmp/p/libjxl/out/release/tools/cjxl --compress_boxes=0 PXL.jpg PXL.jxl JPEG XL encoder v0.8.0 99b07212 [AVX3,AVX2,SSE4,SSSE3,Unknown] Note: Implicit-default for JPEG is lossless-transcoding. To silence this message, set --lossless_jpeg=(1|0). Read JPEG image with 5028864 bytes. Encoding [Container | JPEG, lossless transcode, effort: 7 | JPEG reconstruction data], Compressed to 4123834 bytes including container % exiftool PXL.jxl | grep 'GPS Position' GPS Position : 37 deg 26' 56.84" N, 122 deg 9' 32.40" W ```
Traneptora
MaskRay Does `cjxl a.jpg a.jxl` preserve exif? exiftool (the `exiftool` from the latest https://github.com/exiftool/exiftool) says there is no GPS location as in the original jpeg file. My libjxl copy has this commit https://github.com/libjxl/libjxl/pull/1834
2022-10-23 11:00:52
it definitely preserves it as that allows bitexact reconstruction of the data
2022-10-23 11:01:03
you can check if there's a `brob` box as well by using `jxlinfo -v a.jxl`
2022-10-24 09:48:52
It looks like libjxl is not whining if `ZeroPadToByte` return a nonzero value.
2022-10-24 09:49:31
Is this ideal?
2022-10-24 09:51:42
Here's a sample:
2022-10-24 09:51:51
2022-10-24 09:52:07
This is the `bench_oriented_brg` conformance sample, with the container stripped off
2022-10-24 09:54:24
the ICC profile ends mid-byte
improver
2022-10-24 10:08:48
according to spec these bits should be checked to be zeros iirc
2022-10-24 10:09:43
unsure if this applies in all the places padding happens though
Traneptora
2022-10-24 10:14:58
that's what I was wondering, I'm not sure if libjxl should be rejecting them
2022-10-24 10:15:07
this *is* from a conformance sample, after all.
_wb_
2022-10-25 05:01:48
Good catch, this is not supposed to happen
2022-10-25 05:04:59
It's not super critical, but we wanted to define all padding bits to be mandatory zeroes so it doesn't become a potential source of entropy if something ever needs to do jxl bitstream recompression (the way jxl can do that with jpeg)
Traneptora
_wb_ It's not super critical, but we wanted to define all padding bits to be mandatory zeroes so it doesn't become a potential source of entropy if something ever needs to do jxl bitstream recompression (the way jxl can do that with jpeg)
2022-10-25 12:27:27
does this mean that alignment padding is like `jxlp` 4-byte sequence numbers? for compliant files they can be ignored safely
_wb_
2022-10-25 12:28:13
yes
Traneptora
2022-10-25 12:28:38
speaking of which, here's a container-based jxl file produce with `cjxl` and it contains two jxlp boxes
2022-10-25 12:28:58
2022-10-25 12:29:17
the second one contains a sequence number of `0x80 00 00 01`
2022-10-25 12:29:21
which notably is not equal to one
2022-10-25 12:29:26
why is this?
2022-10-25 12:30:50
you can inspect it with `hexdump -C ants.jxl | less` and search for `jxlp`
2022-10-25 12:31:31
I produced this by taking `cjxl ants.jpg ants.jxl`
2022-10-25 12:31:43
2022-10-25 12:31:44
here's the source
_wb_
2022-10-25 12:31:44
the highest bit indicates it's the final one
Traneptora
2022-10-25 12:31:52
ah, so that's intentional
2022-10-25 12:32:07
I thought it was supposed to be increasing in order, but if `0x80 00 00 00` is set, it means it's final?
_wb_
2022-10-25 12:32:18
yes
2022-10-25 12:32:41
Traneptora
2022-10-25 12:32:55
good, so that's not a bug then. I just wanted to double check.
JendaLinda
2022-10-27 07:49:04
I've noticed that cjxl always encodes GIF as RGB+Alpha even if transparency is not used.
_wb_
2022-10-27 07:58:28
it does? Are you sure the gif does not use transparency? multi-frame gifs typically do use it
2022-10-27 07:59:17
(even if no rendered pixel is actually transparent, it uses transparency as an inter frame coding tool)
JendaLinda
2022-10-27 09:21:58
It does for static images as well.
2022-10-27 09:40:28
The original GIF images are not transparent. Resulting JXLs are RGBA.
2022-10-28 06:13:55
I suppose this might be a bug.
_wb_
2022-10-28 06:37:17
Yes, it likely is a bug in the gif reader
2022-10-28 06:38:05
In general, we should probably by default strip trivial alpha since there are quite a few applications that produce RGBA pngs even when alpha is all-255...
2022-10-28 06:39:33
The only complication is that in case of multiframe, the encoder gets frames one by one and cannot strip alpha from the first one if it doesn't know that the next ones will also not need it
2022-10-28 06:41:01
(the presence of alpha is an image-wide property, not a per-frame one)
JendaLinda
2022-10-28 01:05:27
It seems to be working correctly for PNG animations. I'm going to open the issue for GIF.
2022-10-28 01:13:30
Automatic conversions like removal of unused alpha or converting to grayscale if R=G=B would be useful. I'm not sure if it's always desirable to do automatic conversions during lossless compression. There should be an option to enable that. For lossy compression, I think those conversions could be enabled by default.
vtorri
2022-10-29 04:48:57
hello
2022-10-29 04:49:01
https://chromium-review.googlesource.com/c/chromium/src/+/3988999
2022-10-29 04:49:09
do you know why ?
_wb_
2022-10-29 04:55:50
See <#803574970180829194> and <#822105409312653333>
vtorri
2022-10-29 05:58:33
<@794205442175402004> thank you, so no real answer why, yet
Jim
2022-11-01 06:36:39
In the Docker image I am getting these 2 build errors, anyone else see this? `tools/flicker_test/flicker_test_autogen/include/tools/flicker_test/ui_setup.h:315:26:` `error: no member named 'setStepType' in 'QSpinBox'` `error: no member named 'AdaptiveDecimalStepType' in 'QAbstractSpinBox'` `intensityTarget->setStepType(QAbstractSpinBox::AdaptiveDecimalStepType);` `~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~ ^`
Traneptora
2022-11-01 06:41:46
those were added in QT5.12
2022-11-01 06:41:52
looks like the docker image is using an incorrect QT version
Jim
2022-11-01 06:42:35
That's what I thought <:SadOrange:806131742636507177>
Traneptora
2022-11-01 06:43:33
at least that's what another project ran into with that exact error via a google search
2022-11-01 06:43:38
so I'm guessing, but it makes sense
Jim
2022-11-01 06:46:56
Hm... it's acting like QT doesn't exist...
2022-11-01 06:49:16
`qmake: could not find a Qt installation of ''` ๐Ÿค”
2022-11-01 07:11:09
I ran apt update and installed qt, looks like the latest version for Bionic is 5.9.5.
2022-11-01 07:11:35
I think the Docker image needs updated.
Traneptora
2022-11-04 02:10:32
bionic is a 2018 image, which predates JPEG XL by a lot
2022-11-04 02:10:41
might as well upgrade to 22.04 LTS
2022-11-04 02:10:45
Jammy
Jim
2022-11-04 02:12:19
Did that yesterday. There is 1 package that is 0.1 behind what was needed.
2022-11-04 02:13:23
I believe Kinetic is the only one that can be used without installing packages outside the package manager.
Traneptora
2022-11-04 02:19:20
Huh
2022-11-04 02:19:45
I find all versions of ubuntu to be relatively stable
2022-11-04 02:19:51
since they're not rolling. it's not archlinux
BlueSwordM
2022-11-04 04:11:12
<@532010383041363969> Is there any function in libjxl that can convert a linear grayscale input into its pure Lightness component(HSL)? I'd like to attempt the low "luma" adaptive quantization mode after all since I feel a lot more confident doing so now ๐Ÿ™‚
Traneptora
BlueSwordM <@532010383041363969> Is there any function in libjxl that can convert a linear grayscale input into its pure Lightness component(HSL)? I'd like to attempt the low "luma" adaptive quantization mode after all since I feel a lot more confident doing so now ๐Ÿ™‚
2022-11-04 04:47:09
HSL is just a matrix transform on RGB btw, just like YUV
2022-11-04 04:48:13
note that grayscale with XYB is just X=B=0
BlueSwordM
Traneptora HSL is just a matrix transform on RGB btw, just like YUV
2022-11-04 04:48:31
Yes, I know.
2022-11-04 04:48:43
I'd just like to know if there was a function directly available already.
Traneptora
2022-11-04 04:48:50
then I'm not sure what you're asking, since HSL lightness goes from black (0) to white (1)
2022-11-04 04:48:55
so isn't this just requesting the output in float?
BlueSwordM
Traneptora so isn't this just requesting the output in float?
2022-11-04 04:49:03
Yes.
Traneptora
BlueSwordM Yes.
2022-11-04 04:50:18
when you request an image out buffer via `JxlDecoderSetImageOutBuffer` set the corresponding JxlPixelFormat appropriately
2022-11-04 04:50:32
JxlPixelFormat has a field `data_type` which is of type `JxlDataType`
2022-11-04 04:50:47
which is a typedefed enum, one of which is `JXL_TYPE_FLOAT`
2022-11-04 04:50:52
this means that you're requesting 32-bit float
2022-11-04 04:51:08
see: https://libjxl.readthedocs.io/en/latest/api_common.html#_CPPv411JxlDataType
2022-11-04 04:51:42
also: https://libjxl.readthedocs.io/en/latest/api_common.html#_CPPv414JxlPixelFormat
BlueSwordM
Traneptora also: https://libjxl.readthedocs.io/en/latest/api_common.html#_CPPv414JxlPixelFormat
2022-11-04 04:52:00
Oh thank you, I didn't even notice that.
2022-11-04 04:52:20
I should probably bookmark the documentation website.
Traneptora
2022-11-04 04:52:37
JxlEndianness is useful to set to native in this case since it lets you reinterpret cast the `uint8_t *` as `float *` and it will work