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

lithium
_wb_ https://github.com/libjxl/libjxl/pull/2012 <@853026420792360980> <@461421345302118401> I think there is some confusion here. Using xyb or not should be unrelated to being able to get the icc profile or not...
2023-01-03 05:09:43
I hope I can use jxl format like this order, for some legacy platform. > `png RGB24`(adobe icc profile) [encode]-> `jxl XYB,varDCT` [decode]-> `png RGB24`(adobe icc profile) > (decode png preserve original adobe icc profile)
_wb_
2023-01-03 05:16:55
Isn't adobe rgb 1998 representable as an enum space? Maybe we just need to improve our enum detection, then libjxl can produce pixels in the right space without cms.
2023-01-03 05:18:21
But also: https://github.com/libjxl/libjxl/pull/2002
lithium
_wb_ Isn't adobe rgb 1998 representable as an enum space? Maybe we just need to improve our enum detection, then libjxl can produce pixels in the right space without cms.
2023-01-03 05:25:36
Probably can add a flag to preserve original icc profile?, even pixel already apply XYB transform, preserve original icc profile file in jxl file, but don't affect jxl render. > --use_original_profile or --preserve_original_profile
2023-01-03 05:27:40
For some special use case, I still hope can preserve original icc profile.
_wb_
2023-01-03 05:51:22
The original icc profile is always recorded, either bit-exactly or by using an equivalent enum representation of the same colorspace.
Fraetor
2023-01-03 06:40:27
What is enum?
_wb_
2023-01-03 06:51:43
There are two ways to signal the colorspace of an image: either a (compressed) icc profile, or using the enum. The latter means setting primaries, white point and transfer curve based on header fields. It is very compact (common spaces can often be done in less than one byte) but less expressive than full icc profiles.
Fraetor
2023-01-03 07:01:45
Is there a limit to how complicated the transfer function can be before you have to use an ICC profile?
2023-01-03 07:02:14
And is it limited the three primaries?
_wb_
2023-01-03 07:07:49
The primaries can be anything not too imaginary, the transfer function is either any gamma (exponential) function, or one of the specific ones: sRGB, rec709, HLG, PQ
Fraetor
2023-01-03 07:08:17
Ah, so not an arbitrary function.
_wb_
2023-01-03 07:08:34
Common primaries like the sRGB or bt2000 ones have a short code
Fraetor
2023-01-03 07:08:56
Makes sense, given they can't be represented with gamma.
_wb_
2023-01-03 07:09:16
sRGB primaries + tf is represented as just one bit
Fraetor
2023-01-03 07:11:32
Nice.
Traneptora
_wb_ Isn't adobe rgb 1998 representable as an enum space? Maybe we just need to improve our enum detection, then libjxl can produce pixels in the right space without cms.
2023-01-03 08:43:50
yea, it's D65 white point, RGB would require custom primaries, and I believe it's got a gamma transfer of 563/256, which is almost 2.2 but not quite
2023-01-03 09:14:08
here's the Adobe RGB spec:
2023-01-03 09:14:09
https://www.adobe.com/digitalimag/pdfs/AdobeRGB1998.pdf
2023-01-03 09:15:26
2023-01-03 09:15:28
in particular, this ^
2023-01-04 01:21:41
animated PNG has a "base image" that may or may not be the first frame of the animation
2023-01-04 01:21:49
what does libjxl do when decoding animated JXL to animated PNG?
2023-01-04 01:22:02
with regard to the base image
2023-01-04 01:22:10
I can see a transparent canvas or a first-frame canvas as both being viable options
_wb_
2023-01-04 01:34:45
That's not really a libjxl question but rather how the apng encoder in djxl works. Should be first frame as base image.
Traneptora
2023-01-04 01:42:02
ah good point, but thanks 👍
Demiurge
2023-01-04 07:47:37
It would be nice if I could install libjxl as system libjpeg in arch linux
2023-01-04 07:47:50
Is this a possibility?
2023-01-04 07:48:34
Also is libjxl libjpeg really better than mozjpeg?
Traneptora
2023-01-04 09:36:16
that's what jpegli is (iirc), and once someone makes an AUR package you probably could
afed
2023-01-05 01:08:31
it's jpeg decoding in libjxl via jpegli? https://github.com/libjxl/libjxl/pull/2026
Demiurge
2023-01-05 01:27:44
Maybe this question is controversial or something but... Any particular reason why this is written in C++ and not C? It always kinda stood out to me from the beginning.
2023-01-05 01:29:01
Maybe because Google likes writing stuff in trendy C++ like the PIK codebase that libjxl is based on?
zamfofex
2023-01-05 01:29:21
I feel like some people (i.e. not me) just prefer C++ over C because of its features. If you want an implementation (albeit incomplete) written in C, see: <https://github.com/lifthrasiir/j40>
Demiurge
2023-01-05 01:30:11
That's the problem with C++ though. Too many features.
2023-01-05 01:30:25
That's the whole reason to avoid it.
zamfofex
2023-01-05 01:30:52
I don’t disagree.
Demiurge
2023-01-05 01:30:57
I feel like C projects are always more readable.
2023-01-05 01:31:26
I don't find Rust very readable no.
2023-01-05 01:31:46
Personally
zamfofex
2023-01-05 01:32:58
I feel like we’re quickly getting into “not a subject for this channel”, but I feel like readability comes (among other things) from familiariy. And I’m not the kind of person who is into Rust at all.
Demiurge
2023-01-05 01:34:37
Same question when looking at the Stockfish codebase. The code is beautifully organized for a C++ program and well written with the expressed intent of being inviting to new contributors but I feel like it would still make more sense and be more inviting or readable to newcomers if it was written in a simpler language than C++
veluca
I feel like we’re quickly getting into “not a subject for this channel”, but I feel like readability comes (among other things) from familiariy. And I’m not the kind of person who is into Rust at all.
2023-01-05 01:34:46
that's what <#806898911091753051> is for 😉
Demiurge
2023-01-05 01:35:29
There is a fork called Cfish which if you compare the code to Stockfish looks way more approachable despite the effort put into making the Stockfish code look so nice and neat
2023-01-05 01:36:25
Well the question is specifically related to libjxl in particular but if you don't think this is the right subject to talk about in this channel I will say no more lol.
2023-01-05 01:36:51
By the way thank you veluca for your encoder wizardry
2023-01-05 01:37:10
You're an excellent engineer
zamfofex
Demiurge Well the question is specifically related to libjxl in particular but if you don't think this is the right subject to talk about in this channel I will say no more lol.
2023-01-05 01:37:50
I don’t know, I’m not the one who should decide that! At any rate, it is possible that there are dependencies of libjxl written in C++, so that might have helped make the choice.
Demiurge
2023-01-05 01:39:35
I think it's just a Google thing.
I feel like we’re quickly getting into “not a subject for this channel”, but I feel like readability comes (among other things) from familiariy. And I’m not the kind of person who is into Rust at all.
2023-01-05 01:40:40
There are far less features in C so far less likely to come across something unfamiliar or unexpected.
zamfofex
2023-01-05 01:41:18
I don’t disagree!
Demiurge
2023-01-05 02:08:55
The libjxl codebase was clearly adapted from the PIK codebase used as a template. That's why it has a lot of dependencies and is written in C++.
2023-01-05 02:10:07
Also I am looking at the FUIF list of features and I have to wonder what does JPEGXL add to FUIF? FUIF seems to have all the same capabilities.
2023-01-05 02:12:19
in particular the lossless reorganizing of existing JPEG data and the emphasis on progressive loading
2023-01-05 02:33:33
Hmm, also, I just tried the HEIC encoder used in Gwenview and I am absolutely blown away by the quality of the lossy compression and the preservation of small detail and subtle variation in color.
diskorduser
2023-01-05 02:34:09
Which codec?
Demiurge
2023-01-05 02:35:40
I assume Gwenview is using kimageformats which is using libheif which is using x265 for the encoding. It's completely mind-bogglingly amazing how good it looks.
2023-01-05 02:36:13
It makes AVIF look ridiculously ugly
2023-01-05 02:39:04
I don't know what settings or what encoder Gwenview is using thru kimageformats -> libavif
2023-01-05 02:40:01
But the chroma looks completely awful and everything looks like absolute perfection with x265
2023-01-05 02:41:20
x265 looks as good as JXL or maybe even a little better at the same filesize needed to achieve flicker-test transparency.
2023-01-05 02:42:13
I'm really impressed it looks that good
_wb_
Demiurge Also I am looking at the FUIF list of features and I have to wonder what does JPEGXL add to FUIF? FUIF seems to have all the same capabilities.
2023-01-05 02:57:27
XYB, ANS, lz77, several predictors (weighed, select, ...), having a predictor per context node, more RCTs (fuif had only YCoCg), variable dct (and everything that comes with it), groups (so parallel/cropped decode), layers, icc compression, ...
2023-01-05 02:58:41
Several of those things weren't in pik either btw, and were added during the collaborative phase of the standardization process
BlueSwordM
Demiurge I don't know what settings or what encoder Gwenview is using thru kimageformats -> libavif
2023-01-05 04:45:40
Well, default settings, which are certainly suboptimal.
Demiurge
_wb_ XYB, ANS, lz77, several predictors (weighed, select, ...), having a predictor per context node, more RCTs (fuif had only YCoCg), variable dct (and everything that comes with it), groups (so parallel/cropped decode), layers, icc compression, ...
2023-01-05 04:47:51
Good answer, thanks. I thought FUIF also has DCT too
veluca
2023-01-05 04:50:33
I think it did but only 8x8? (but <@794205442175402004> ought to know)
_wb_
2023-01-05 04:56:31
Yes, it had dct8x8, just for jpeg recompression
2023-01-05 04:56:44
And it did it in a very funny way
2023-01-05 04:57:35
Turning every channel into 64 channels with 1:8 subsampling, one per coefficient 🙂
2023-01-05 04:59:07
It didn't recompress jpegs as densely as current jxl, but it still did get like 15% improvement over jpeg
Demiurge
BlueSwordM Well, default settings, which are certainly suboptimal.
2023-01-05 05:09:10
I am not familiar with libavif but why would the default settings be so awfully poor and unfit for human eyes?
2023-01-05 06:01:14
I'm sure AVIF has the theoretical potential to look as good as x265 maybe. But no one would be able to discern that from using it in its current state :)
2023-01-05 06:02:41
It's hard for me to find good comparisons but I was under the impression AV1 is supposed to have more potential.
Traneptora
2023-01-05 06:03:20
tbf libjxl also has significantly more potential as a JXL encoder
2023-01-05 06:03:40
if I recall Jyrki said that there were a number of things they were going to try, but they wanted to prioritize stability first
2023-01-05 06:03:52
and a 1.0 release first
Demiurge
2023-01-05 06:04:21
I'm aware of that and I'm also aware of how x265 and x264 are optimized to the extreme.
Traneptora
2023-01-05 06:05:10
x265 is not as good at encoding HEVC as x264 is at encoding H.264
Demiurge
2023-01-05 06:05:23
x264 is legendary
Traneptora
2023-01-05 06:05:31
x265 still has room for improvement (more so than x264) but it's sort of stalled at this point since HEVC is sort of intermediate
Demiurge
2023-01-05 06:07:33
h.265 never had a lot of widespread interest. The patent situation resulted in widespread unattractiveness that nobody outside of Apple were interested in
2023-01-05 06:08:09
So it's no surprise that x265 was not as successful
spider-mario
Traneptora yea, it's D65 white point, RGB would require custom primaries, and I believe it's got a gamma transfer of 563/256, which is almost 2.2 but not quite
2023-01-05 06:08:23
we don’t currently try to fit a gamma to the transfer function, but we could hardcode a few predefined gamma values to try including the aRGB one
2023-01-05 06:08:32
(or actually implement gamma fitting)
Demiurge
2023-01-05 06:09:37
But still, x265 produces stunningly good output, at the very least as good as libjxl 0.7
2023-01-05 06:10:43
And libavif, whatever encoder or settings its using, looks like a trainwreck
Traneptora
spider-mario we don’t currently try to fit a gamma to the transfer function, but we could hardcode a few predefined gamma values to try including the aRGB one
2023-01-05 06:11:16
if the gamma transfer function is a pure gamma curve, would you have to "fit" to it? I'm unfamiliar with how ICC profiles implement pure gamma
spider-mario
2023-01-05 06:11:44
ah, right, it’s probably encoded as a parametric curve in some cases
2023-01-05 06:12:00
but I don’t know if our current code is structured in a way that lets us easily access it as such
Traneptora
2023-01-05 06:12:45
notably it doesn't have a linear segment, so it can be represented by the GAMMA enum value
2023-01-05 06:12:46
in theory
spider-mario
2023-01-05 06:13:06
at some level, we have lcms2 and skcms abstracted away, and the abstraction might be before we verify whether an enum is a suitable approximation
Traneptora
2023-01-05 06:13:06
probably a post-1.0 goal though
2023-01-05 06:14:07
according to Jon, the DCI transfer is pure gamma 2.6 so I wonder if that one can be auto-detected as well
BlueSwordM
Demiurge I am not familiar with libavif but why would the default settings be so awfully poor and unfit for human eyes?
2023-01-05 06:21:00
Because aomenc is a video encoder first, image encoder second. When building avifenc, they didn't think of setting better defaults for it. Also, what aomenc version do you have on your system? That matters a decent bit as well, especially for speed.
2023-01-05 06:23:46
Also, an interesting thing about x264 and x265 is that when dealing with 4:4:4 images, they increase the chroma quant by 6.
Demiurge
2023-01-06 09:47:18
aom 3.5.0
2023-01-06 09:52:24
You would not be crazy to assume that libavif should have sensible defaults for images.
2023-01-06 09:53:33
It's pretty shockingly ugly considering how far along AVIF adoption has been pushed already
Kampidh
2023-01-06 08:24:57
There is a bug report on Krita about failed to open a certain JXL art: https://bugs.kde.org/show_bug.cgi?id=463914 After further self investigating, apparently it fails to decode as well even on recent libjxl main.
2023-01-06 08:26:11
Here's a log from Krita callstack: ```./lib/jxl/splines.cc:637: JXL_FAILURE: Too many pixels covered with splines .\lib\jxl\dec_frame.cc:290: JXL_RETURN_IF_ERROR code=1: shared.image_features.splines.InitializeDrawCache( frame_dim_.xsize_upsampled, frame_dim_.ysize_upsampled, dec_state_->shared->cmap) .\lib\jxl\decode.cc:1182: frame processing failed```
Fox Wizard
2023-01-06 08:29:23
Hm, works in old decoders, but doesn't seem to work in new ones
Kampidh
2023-01-06 08:30:42
Yep, I found out that as well, can be opened with GIMP 2.10 but failed at 2.99.14
Fox Wizard
2023-01-06 08:40:14
v0.7.0 198d5f3 (2021-12-20) doesn't work, but v0.7.0 d503419 (17-12-2021) works
veluca
2023-01-06 08:44:30
At some point we reduced the limit on spline pixels
2023-01-06 08:44:37
We might need to bump it up again
Fox Wizard
2023-01-06 08:45:34
``` Deal with over/underflows in spline coordinate calculations. Outrageous spline coordinates / deltas hint that stream is corrupted -> stop decoding. Drive-by: limit total spline area to avoid memory / CPU bomb Drive-by: replace spline_on_first_frame test sample with one that fits new limits Drive-by: fix spline_test: JXL_ASSERT is no-op in Coverage build... ```
2023-01-06 08:45:56
``66f363b0a77dc428bb56234825352f3378ed909d`` guess that one broke it
_wb_
2023-01-06 08:58:19
We need to define limits for the total spline area for level 5 and for level 10 in a way that balances expressivity and decode resources.
2023-01-06 09:00:22
I would propose something like max 2 spline pixels per frame pixel, with a large additive constant to allow some more for small images.
Kampidh
2023-01-06 09:08:05
Seems to be a long regression or saved for a future plans~ Anyway, shall I open a issue tracker on github as well so that I can pass this to Krita's core devs?
Traneptora
Kampidh There is a bug report on Krita about failed to open a certain JXL art: https://bugs.kde.org/show_bug.cgi?id=463914 After further self investigating, apparently it fails to decode as well even on recent libjxl main.
2023-01-07 03:53:05
can you link the sample?
Kampidh
2023-01-07 03:54:14
https://jpegxl.info/art/2021-08_totocaca.jxl
zamfofex
2023-01-07 04:51:36
Seems like the same issue I was running into in <https://discord.com/channels/794206087879852103/803574970180829194/1060953757174747327>
JendaLinda
2023-01-07 07:49:30
I've noticed the effort level 10 was added in cjxl. What does it do in addition to effort 9? Does it include the proposed options -E 3 -I 100 -g 3 ?
zamfofex
2023-01-07 07:53:41
From what I have seen (and it’s not like I know much), it tries various different settings and picks the best one. See: <https://discord.com/channels/794206087879852103/803645746661425173/1060222052067450920>
JendaLinda
2023-01-07 08:36:33
I'll give it a try. Anyway, I couldn't find any overview what settings are different effort levels using. It seems the individual steps are checking the effort level directly.
zamfofex
2023-01-07 08:42:46
Yes, they are all just entirely different algorithms being chosen. The number’s value isn’t actually used by a unified algorithm or anything, it’s just meant as a general “this is slower or faster” indication.
2023-01-07 08:43:23
But note that `-e 10` is much slower than `-e 9`.
JendaLinda
2023-01-07 08:47:27
I see, in other software the speed preset is acting like a shortcut for bunch of different options. This is just a different approach.
veluca
JendaLinda I've noticed the effort level 10 was added in cjxl. What does it do in addition to effort 9? Does it include the proposed options -E 3 -I 100 -g 3 ?
2023-01-07 09:38:37
it does include that
JendaLinda
2023-01-07 11:23:44
How slow is slow? If I do trials using all filter types in PNGOUT, that's pretty slow.
veluca
2023-01-07 11:33:24
haven't tried pngout, but I can almost guarantee e10 is slower
2023-01-07 11:34:11
e10 is ~3h per megapixel on a single core I believe
JendaLinda
2023-01-07 11:36:22
So that's really slow.
veluca
2023-01-07 11:38:21
yep
2023-01-07 11:39:47
it's more meant for either that one image you really need to optimize as much as possible, or for benchmarks of theoretical compression performance
_wb_
2023-01-07 11:39:47
it could probably be made faster by being a bit more clever than just brute-force trying a bunch of e9 settings
2023-01-07 11:40:49
but making e4-e7 faster and better is imo a bigger priority — this is where the pareto front battle is going on 🙂
JendaLinda
2023-01-07 11:50:31
Agreed, waiting several minutes or even hours to encode a single picture is not something most users would appreciate.
veluca haven't tried pngout, but I can almost guarantee e10 is slower
2023-01-07 12:02:45
Pngout with trials is more like 5 minutes per megapixel although the speed is very dependent on the image contents and pixel format.
Demiurge
2023-01-07 01:08:32
To be fair the image in question is a very contrived example
Kampidh Here's a log from Krita callstack: ```./lib/jxl/splines.cc:637: JXL_FAILURE: Too many pixels covered with splines .\lib\jxl\dec_frame.cc:290: JXL_RETURN_IF_ERROR code=1: shared.image_features.splines.InitializeDrawCache( frame_dim_.xsize_upsampled, frame_dim_.ysize_upsampled, dec_state_->shared->cmap) .\lib\jxl\decode.cc:1182: frame processing failed```
2023-01-07 01:09:03
I mean in response to this
2023-01-07 01:10:11
You cannot get a JXL file like that by normal means right now
Kampidh
2023-01-07 02:30:04
I think so.. I mean it can be safely dismissed because it's not a normal usage, right?
Demiurge
2023-01-07 05:41:21
I mean I'm dismissing it right now and I feel pretty safe.
2023-01-07 05:41:25
:)
2023-01-07 05:42:16
But sounds like there are plans to tweak the limits anyways to allow that file to be decoded again in the future
2023-01-07 05:43:45
Basically the decoder was given tighter limits recently to reduce the impact of a JXL file that is intentionally crafted to take a long time to decode and lock up the decoder as a sort of DOS attack
2023-01-07 05:45:24
That's why this handcrafted JXL file that has an unusual usage of splines now has problems decoding on recent versions of libjxl
2023-01-07 05:46:38
Since it's getting attention here and the devs are noticing, it's **likely** that soon there will be another patch that alters the limits again and once again allows the unusual image to be decoded in the future.
Traneptora
2023-01-07 06:25:52
if you really need the image data from that image, then jxlatte doesn't have a spline restriction in place
2023-01-07 06:26:17
although it's not suitable for use as a krita plugin as krita doesn't target the jvm
_wb_
2023-01-07 06:47:57
Probably we should make some limits dynamic and add something to the decode api to set limits. Not sure if those limits should coincide exactly with profiles/levels or be just something implementation specific...
Traneptora
2023-01-07 06:58:01
I like this idea. so highly security-sensitive applications (e.g. browsers) would set the settings to be very strict
2023-01-07 06:58:09
but an image editor that takes images from a hard drive could be more permissive
_wb_
2023-01-07 07:24:18
Exactly. I'm thinking you might want to have an option to set stricter limits than even level 5, e.g. to set max image dimensions that will fit in limited memory.
JendaLinda
2023-01-07 08:53:05
Sane limits make sense, you could enforce allocating a buffer of several gigabytes just by loading an empty file with huge dimensions.
Demiurge
2023-01-07 09:26:53
I just want firefox to merge the patches already and fix their broken bugs that have already been fixed. And enable it by default without having to use nightly.
2023-01-07 09:27:06
But they don't have enough manpower to click the merge button ;(
2023-01-07 09:27:37
All the work is already done but they don't have that last little tidbit of manpower required to click "merge"
2023-01-07 09:31:59
libjxl is far from perfect and it's getting improved all the time since there's plenty of room for improvement in all areas including speed, lossy quality, api features and exposed settings, etc... But as it stands in its current condition it's ALREADY better than the rest in all of those areas and it's time to start using it now, in my opinion! It's cool to be able to save space, especially on existing JPEGs.
2023-01-07 09:32:40
(One feature I personally would really like is a lossless transformation api and tool a la jpegtran.)
2023-01-07 09:34:18
I think that jpegli is a very interesting idea. I think jpegli has a lot of potential for getting libjxl deployed
2023-01-07 09:35:12
Because it's an improvement and drop in replacement for something that is already widely used and depended upon.
2023-01-07 09:38:19
It's a way to introduce libjxl into already existing and common workflows
2023-01-07 09:44:46
A very clever and interesting way to pave the path towards increased adoption
2023-01-08 01:40:03
Is there a `man 3 libjxl` somewhere online?
lithium
_wb_ The original icc profile is always recorded, either bit-exactly or by using an equivalent enum representation of the same colorspace.
2023-01-08 09:05:17
Hello wb, Sorry to bother you, I still can't get correct icc profile on djxl output png. expect djxl decode png icc profile is `Adobe RGB (1998)`, but output png icc profile is `RGB_D65_SRG_Rel_Lin`. > png rgb24(Adobe RGB (1998)) > [cjxl encode]-> jxl XYB,varDCT > [djxl decode]-> png rgb24(RGB_D65_SRG_Rel_Lin) > // expect djxl decode png icc profile is Adobe RGB (1998).
2023-01-08 09:05:37
2023-01-08 09:06:37
original png rgb24 icc profile(Adobe RGB (1998))
_wb_
2023-01-08 10:01:59
Is there a github issue for this? Looks like a bug if the output looks different.
Kampidh
2023-01-08 10:06:19
Gamma/TRC wise, that looks like a viewer issue like I've reported before~ something to do with the viewer cannot display linear correctly
2023-01-08 10:08:27
But gamut wise, it got clipped into sRGB if it's integer
2023-01-08 10:37:01
And actually, it's one of the issues I got when trying to get XYB profile working correctly on Krita's export~ on ICC profiles that's not specified by libjxl, we had to pass parsed parameters from ICC (color primaries, white balance, and TRC/gamma) as custom parameters.
2023-01-08 10:43:33
Eg. for parsed Adobe RGB, the profile looks like this after jxl decoding: `RGB_D65_0.639997;0.329997;0.210006;0.710004;0.149998;0.060004_Per_g0.454707`
sklwmp
2023-01-08 11:30:34
What's the status of the libjxl GitLab? https://gitlab.com/wg1/jpeg-xl The latest commit is from 3 months ago, but nothing on the page states that the repository has been moved or anything.
2023-01-08 11:31:30
Also, from the AV1 Discord (https://discord.com/channels/587033243702788123/673202643916816384/1061578319209975858): https://github.com/google/skia/blob/main/DEPS ``` "third_party/externals/libjxl" : "https://chromium.googlesource.com/external/gitlab.com/wg1/jpeg-xl.git@a205468bc5d3a353fb15dae2398a101dff52f2d3", ``` Skia seems to be using the wg1 libjxl as source
_wb_
2023-01-08 11:55:14
Oh, is the gitlab mirroring broken? That's not good...
Demiurge
2023-01-09 03:05:02
Can libjxl be given YUV image data? What happens? Does it handle it well if the chroma channels are at a smaller scale than the luma?
_wb_
2023-01-09 03:07:42
currently we don't have an api for anything other than RGB. It could be done in principle, and at some point (before it used the api) cjxl could take y4m input, but it's currently not implemented and tbh I don't think it's a very big use case
Demiurge
2023-01-09 03:14:44
Of course it is? Lots of images are in YUV formats. Like for instance ALL lossy webp sources.
2023-01-09 03:16:30
Is there a theoretically ideal way to translate those color formats into XYB?
2023-01-09 03:17:29
YUV is probably even more common than RGB data... Of course it's a very big use case...
_wb_
2023-01-09 03:18:16
Lossy webp uses tv range yuv, while jxl/jpeg use full range yuv.
2023-01-09 03:18:40
But in any case the only thing you can really do with a lossy webp is keep it as is
Demiurge
2023-01-09 03:18:42
If you can avoid needless lossy conversion to RGB, that could result in better quality transcodes
2023-01-09 03:20:24
Well, we could be talking about very high quality lossy webp, or other high quality YUV sources like for example taking JXL screenshots from MPV is apparently becoming a popular use case now
_wb_
2023-01-09 03:20:28
If you're going to do lossy transcode, I suppose you could decode to yuv and then to 32-bit float rgb and use that as input, but I doubt this will make much of a difference compared to just using the decoded 8-bit rgb
2023-01-09 03:21:42
'high quality yuv' is a bit of a contradiction in terms, imo. In the best case (full-range 444), it is basically rgb 787
2023-01-09 03:22:11
In the worst case, it is basically rgb 676 with r and b at half resolution
Demiurge
2023-01-09 03:27:27
Is there, theoretically, an "elegant" way, for that kind of YUV data to be translated into the XYB color space without some sort of resampling?
2023-01-09 03:28:06
Can it be quantized without actually resampling it I mean
2023-01-09 03:30:18
I'm just wondering how efficiently can lossy JXL be used on that sort of data, with minimum unnecessary degradation of quality (since YUV data is already such bad quality already)
_wb_
2023-01-09 03:38:58
converting yuv to rgb (especially high-bitdepth rgb) is not introducing any degradation, really
2023-01-09 03:39:23
it's the other way around that is lossy
Demiurge
2023-01-09 03:44:01
There isn't something more efficient or ideal that could be done, compared to converting it to RGB (and resampling the chroma channels)?
2023-01-09 03:45:38
It seems kind of wasteful to needlessly transform the data like that, before the data even gets seen by libjxl
2023-01-09 03:46:31
There isn't a more fitting, more 1:1 transformation that could be done?
_wb_
2023-01-09 03:59:06
Well if it's a jpeg, then it can be recompressed losslessly. Also if it's lossless yuv data (has to be full-range and with the jpeg sample alignment though), that can be compressed losslessly in principle. But if you're going to do lossy transcoding of already-lossy data, preserving the colorspace is not going to make a significant difference and you're kind of screwed anyway imo: if you want to improve density, you'll have to use a quality setting that is sufficiently worse than the quality setting in the original format or otherwise you'll end up wasting bits on preserving compression artifacts; if you want to preserve quality, you'll likely have to use a quality setting that is quite high and that will quite likely result in a larger file than what you started from.
afed
2023-01-09 04:05:35
at least for lossless screenshots it would be useful (and probably a little faster), as already discussed https://discord.com/channels/794206087879852103/794206170445119489/1060617474128748554
_wb_
2023-01-09 04:07:56
provided the screenshotting application can somehow access the yuv data — i.e. it would have to be integrated into a video player or something like that
2023-01-09 04:10:42
one issue is the sample positioning (cosited vs interstitial)
2023-01-09 04:11:19
in JPEG and JPEG XL, subsampled samples are sited interstitially (midway between the luma samples)
2023-01-09 04:13:27
while in MPEG-2 and h264 and I suppose many other video codecs, they do something weird where vertically the samples are interstitial, but horizontally they are cosited
Demiurge
_wb_ provided the screenshotting application can somehow access the yuv data — i.e. it would have to be integrated into a video player or something like that
2023-01-09 04:15:50
Yes, mpv recently added JXL screenshot ability and it's a hot new feature.
BlueSwordM
Demiurge Is there a theoretically ideal way to translate those color formats into XYB?
2023-01-09 04:16:57
Yes, that is what a library like yuvxyb does.
2023-01-09 04:17:20
https://github.com/rust-av/yuvxyb
Demiurge
2023-01-09 04:17:39
oh wow, that's exactly what I was wondering about
_wb_
2023-01-09 04:18:15
another issue is full-range vs tv-range: in JPEG and JPEG XL, the range for YCbCr is 0..255 for all components, while in BT.601 the range for Y is 16..235 and that for CbCr is 16..240
BlueSwordM
2023-01-09 04:18:22
Anyway, in the case of ffmpeg, that conversion would be done by the libjxl integration.
_wb_ another issue is full-range vs tv-range: in JPEG and JPEG XL, the range for YCbCr is 0..255 for all components, while in BT.601 the range for Y is 16..235 and that for CbCr is 16..240
2023-01-09 04:19:21
Yes, which is why integrating proper color metadata information is sooo important. Otherwise, you get garbage. An example of this is when SD DVD sources are converted to HD without including the proper metadata(BT601).
_wb_
2023-01-09 04:22:31
the only yuv we have in jxl is full-range YCbCr with the same conversion matrix as in JPEG, with only 1:1 or 1:2 subsampling in either direction for any component (so you can do 4:4:4, 4:2:2, 4:4:0 and 4:2:0 but not 4:1:1)
2023-01-09 04:23:17
yuv of the above kind can be represented losslessly in jxl (and will be rendered correctly)
2023-01-09 04:24:50
other kinds of yuv (like tv-range, different matrix, or different sample positions) can possibly still be represented losslessly in terms of preserving the samples, but not at the metadata level so it will not be rendered correctly when decoded
Demiurge
2023-01-09 04:27:14
Rust code is not easy for me to read...
_wb_
2023-01-09 04:27:39
basically we only did the minimum needed to do lossless jpeg recompression (covering what is actually encountered in the wild; jpeg in principle allows some more exotic subsamplings but they are not used in practice and often won't work either)
Demiurge
2023-01-09 04:30:08
Can subsampled chroma be represented in XYB JXL? Or do you have to use YUV?
_wb_
2023-01-09 04:30:42
you have to use yuv
2023-01-09 04:30:46
xyb is always 444
2023-01-09 04:32:38
even if jxl would support xyb 420 (which it doesn't), it wouldn't help at all since you can't just map yuv420 to xyb with subsampled x and b
Demiurge
2023-01-09 04:32:45
In terms of compression density does it make more sense to keep it YUV with downsampled chroma, do you think? Or would it still be better to store it as XYB?
2023-01-09 04:33:39
Even though you would be increasing the size by resampling without actually adding any more detail
_wb_ even if jxl would support xyb 420 (which it doesn't), it wouldn't help at all since you can't just map yuv420 to xyb with subsampled x and b
2023-01-09 04:34:17
Sounds like there's no nice way to map it...
_wb_
2023-01-09 04:34:50
a lot of the chroma blur introduced by yuv420 will translate to blurry X and B which should compress better because there's not a lot of high frequency signal left
2023-01-09 04:36:11
some of the Y from YCbCr will still end up in X and B though
2023-01-09 04:38:01
so I suppose it depends on the quality: at high enough quality where the 'bleeding' of Y (from YCbCr) into X and B ends up getting costly, it might be better to stay in YUV — just like when doing lossless, it will be better to store it as lossless yuv420 than converting to rgb and storing that losslessly.
2023-01-09 04:39:36
at a lower quality though (say recompressing libjpeg-turbo -quality 95 to jxl d2.5), using XYB will be better
Demiurge
2023-01-09 06:05:37
Interesting... Naive question but why would there be bleeding?
2023-01-09 06:13:34
Hmm, thinking about how these two things map to one another makes my brain hurt. :)
2023-01-09 06:17:22
One has a blue channel and a red-green channel, the other has a blue-projection and a red-projection channel...
2023-01-09 06:18:50
I guess there would have to be bleeding since in YUV chroma is more dependent on luma?
2023-01-09 06:25:03
I wonder if there are any transformations that can be applied to chroma-downsampled YUV content to help make it more efficient to compress...
_wb_
2023-01-09 06:40:26
Chroma subsampling is basically exactly the same thing as zeroing 3/4th of the dct coefficients (the ones not in the top-left quadrant).
2023-01-09 06:41:17
In any codec with decent entropy coding, subsampling doesn't give you any compression benefit
2023-01-09 06:44:19
In the original JPEG it helps for compression because DC entropy coding is quite bad (fixed West predictor, simple huffman coding, no context modeling), and also AC entropy coding is not that great (no prediction or ctx modeling at all, while for low-freq coeffs, even just simple ctx modeling like one ctx per coeff position does help quite a bit).
Demiurge
_wb_ In any codec with decent entropy coding, subsampling doesn't give you any compression benefit
2023-01-09 06:53:14
Yeah, that makes perfect sense to me, I'm just having trouble thinking about how that maps into XYB coordinates...
_wb_ Chroma subsampling is basically exactly the same thing as zeroing 3/4th of the dct coefficients (the ones not in the top-left quadrant).
2023-01-09 06:53:57
I meant to reply to this here or both but ah well
2023-01-09 06:55:57
Also if you are encoding a JXL with noise generation, is the encoder smart enough not to waste bits on anything below the noise floor?
2023-01-09 06:56:16
That's another question that's been floating through my mind about JXL
_wb_
2023-01-09 07:05:29
Currently not, it just encodes the image like it always does and signals that the decoder has to add noise
2023-01-09 07:06:54
It would be better to estimate the noise in the image and carefully denoise it before encoding, but that's a tricky thing to get right.
Demiurge
2023-01-09 07:35:02
Well it should just be able to estimate what the "noise floor" is based on the amount of generated noise and then... I dunno, maybe truncate the least significant bits or something?
2023-01-09 07:35:30
Or make some sort of informed decisions based on the perceptual "noise floor" of the image.
2023-01-09 07:36:30
since that noise will mask some subtle details in the image, it would be prudent for the encoder to not attempt to waste any bits on information that will get masked underneath the added noise
2023-01-09 07:36:56
It would be very similar to quantization and dithering.
Traneptora
Demiurge If you can avoid needless lossy conversion to RGB, that could result in better quality transcodes
2023-01-09 08:06:27
YUV -> RGB is not a lossy operation
_wb_
2023-01-09 08:20:52
Well 8-bit yuv to 8-bit rgb may be slightly lossy due to rounding, but it's kind of like converting a 7-bit image to an 8-bit one... You cannot do it exactly (e.g. 63/127 is not exactly the same as 127/255), but it's not a big loss either
Demiurge
2023-01-09 08:20:59
Well, it is if there is resampling involved...
2023-01-09 08:22:04
Upscaling is not a straightforward operation
2023-01-09 08:23:05
But I don't know that much about how chroma upscaling is done in practice.
2023-01-09 08:23:14
other than the fact it usually looks really ugly
2023-01-09 08:23:25
really really ugly
2023-01-09 08:32:38
is RGB and LMS any different?
_wb_
2023-01-09 08:33:04
The 'simple' upscaling is just sample duplication which is very bad: A B C -> A A B B C C. The 'correct' upscaling for interstitial subsampling like in JPEG is triangular: A B C -> A (0.75A + 0.25B) (0.75B + 0.25C) (0.75C + 0.25B) C
2023-01-09 08:34:07
LMS models cone cell responses, RGB models light emittors.
Demiurge
2023-01-09 08:41:23
Well light only matters after our photoreceptors (rod and cone cells) sense them.
Fox Wizard
2023-01-10 10:32:10
Hm, tried ``benchmark_xl --input="D:\Pictures\AI foxes\000007.43688240.png" --codec=jpeg:libjxl:d1.0 --save_compressed --output_dir=./out`` on another device and it doesn't seem to give an output either :/
2023-01-10 10:34:04
It only creates an "out" folder
afed
2023-01-10 02:15:20
`--output_dir=out`
Fox Wizard
2023-01-10 02:19:59
That gives the same result :p
afed
2023-01-10 02:25:22
works for me or `--output_dir=.` same folder
Fox Wizard
2023-01-10 02:31:05
None work for me for some reason
2023-01-10 02:31:09
On both W10 and W11
2023-01-10 02:31:19
It only creates an empty folder
afed
2023-01-10 02:36:04
maybe try a different input file/name? I also use the old Command promt, maybe Terminal or PowerShell works differently
_wb_
2023-01-10 02:36:59
could be that it is confused by the backslashes or spaces in that input file name
2023-01-10 02:38:17
try using an input filename that doesn't include the full path
Fox Wizard
_wb_ could be that it is confused by the backslashes or spaces in that input file name
2023-01-10 02:46:34
This seems to have been the problem
2023-01-10 02:46:52
``benchmark_xl --input=1.png --codec=jpeg:libjxl:d1.0 --save_compressed --output_dir=./out`` worked
_wb_
2023-01-10 02:49:19
Windows using backslashes as a dir separator is very confusing when C uses it as an escape character
Demiurge
2023-01-10 02:54:02
Windows just sucks... Always has.
spider-mario
2023-01-10 05:11:40
I find it tolerable nowadays
2023-01-10 05:11:46
mostly thanks to msys2
Demiurge
2023-01-10 05:17:28
WSL is kinda nice but you need a linux filesystem image.
2023-01-10 05:19:03
and most distros don't distribute those, you have to make one yourself, they just distribute install/live ISOs
2023-01-10 06:06:29
Does libjxl still need to depend on sjpeg if it's going to provide its own libjpeg api?
Traneptora
Demiurge WSL is kinda nice but you need a linux filesystem image.
2023-01-10 06:28:00
you could grab an image used for vms
2023-01-10 06:28:14
or containers
2023-01-10 06:30:02
https://us.lxd.images.canonical.com/
Demiurge
2023-01-10 06:34:19
Well it's pretty easy to find one for debian...
2023-01-10 06:34:42
But debian sucks.
2023-01-10 06:47:01
It's convenient to have (simply because so many people use it for some reason) but that's not what I primarily want to use.
_wb_
Demiurge Does libjxl still need to depend on sjpeg if it's going to provide its own libjpeg api?
2023-01-10 08:15:05
I don't think libjxl depends on sjpeg at all, does it?
Demiurge
2023-01-10 08:15:22
It's in the 3rd party folder
_wb_
2023-01-10 08:15:51
Isn't that only for djxl to have jpeg as an output format?
2023-01-10 08:16:04
(for non-reconstructed jpegs)
2023-01-10 08:17:49
I think libjxl only depends on brotli and optionally on lcms2, and libjxl-dec doesn't have any real dependencies (unless I am missing something)
Demiurge
2023-01-10 09:29:47
Well it should not need it even for that, should it?
2023-01-10 09:32:13
Also, it would be nice if there was an option to skip encoding/decoding JBRD and losslessly reconstruct JPEG without being too pedantic.
2023-01-10 09:33:11
Most of the time it's more important for the image data and metadata to be lossless, not care about the exact huffman tables or whatever are used
_wb_
2023-01-11 06:10:24
Yes, recompressing and reconstructing jpeg without jbrd would be nice - it's possible in principle, though a bit tricky since we also kind of use jbrd as a marker to indicate that the data does come from a jpeg...
JendaLinda
2023-01-11 08:37:13
Perhaps djxl could try to reconstruct jpeg by default and offer lossy recompression only if the reconstruction is not possible.
_wb_
2023-01-11 08:38:37
we'd need to change libjxl to have an option to try jpeg reconstruction without jbrd — which would then of course only be image-lossless, not file-lossless reconstruction.
JendaLinda
2023-01-11 08:40:17
After all, djxl is decoder, not image converter. In PNG, the transcoding is also only image lossless.
Fox Wizard
2023-01-11 08:52:55
Did ``e 10`` get removed?
_wb_
2023-01-11 09:32:33
No, just hidden behind a flag
2023-01-11 10:20:52
Exif and xmp are separate, and icc is part of the codestream
2023-01-11 10:23:27
The jbrd only contains the remaining stuff needed to reconstruct the actual jpeg file: the Huffman tables, the progressive scan script, the values of padding bits, any other app markers besides icc/exif/xmp/jumbf, any trailing bytes after the end of the jpeg image, etc.
2023-01-11 10:26:11
The only cases where there might be something 'important' in the jbrd, is when the tail bytes actually contain something substantial. E.g. I think sometimes the tail bytes contain another jpeg which is the actual image before blur filters were applied, and the first jpeg is one where fake bokeh was done on the background pixels, based on depth data the camera had.
veluca
Fox Wizard Did ``e 10`` get removed?
2023-01-11 10:27:37
pass --allow_expert_options 🙂
_wb_
2023-01-11 10:28:11
Generally speaking, all the actual image data is in the codestream (including colorspace and orientation), and all the 'real' metadata (exif/xmp/jumbf) is put in separate boxes, so jbrd is some rather small amount of data that can be stripped without losing anything except the option to reconstruct the exact same jpeg file again.
2023-01-11 10:30:24
It's probably generally not really worth it to strip it though, considering that it's typically only 100-200 bytes or so, and if it is larger, that could be a sign that it actually does contain something substantial like tail bytes that actually have something you may want to preserve.
JendaLinda
2023-01-11 10:33:53
Huffman tables and stuff are not set in stone, those can be regenerated any time by common tools. I always optimize Huffmnan tables, it makes the jbrd smaller.
_wb_
2023-01-11 10:44:29
Well they are 'set in stone' if you want to reconstruct the exact same jpeg file. If that's not a requirement, then indeed you can just use default tables or generate some based on the data - but it won't produce the exact same file. We could replicate the behavior of default libjpeg-turbo or libjpeg-turbo with huffman optimization (which is default in imagemagick iirc), and do something that will often still lead to the same file, but we can only mimick one jpeg encoder when there is no jbrd.
JendaLinda
2023-01-11 10:52:40
JPEG files are really flexible, they can be also converted between progressive and non-progressive.
_wb_
2023-01-11 10:59:40
Same with jxl btw.
JendaLinda
2023-01-11 12:31:23
Hmmm, even -e 10 can still fail to reduce 1 bit gray PNG.
veluca
2023-01-11 12:33:40
not entirely surprising, 1 bit images usually require very special tricks
2023-01-11 12:33:55
png and webp do well because they do bitpacking
JendaLinda
2023-01-11 12:37:39
To be fair, the PNG was also brute-force optimized.
_wb_
2023-01-11 12:39:01
I think we technically could do bitpacking too in jxl, but it would have to be in a rather contrived way: doing horizontal squeeze steps until you have 8 channels at horizontally 1:8 resolution, then doing an 8-channel palette on that.
2023-01-11 12:40:59
Maybe more interestingly, this could also e.g. be done on 2x2 input pixels, which may be a better way to pack multiple pixels
2023-01-11 12:44:05
I wonder how important 1-bit images still are today. Generally even when you want to represent something like a mask, it's better to do it in full grayscale so you get nice anti-aliased edges.
2023-01-11 12:45:01
I mean, they exist, so obviously it would be nice to be able to compress them well. But I wonder if many 1-bit images are still being produced, and why.
JendaLinda
2023-01-11 12:46:15
I can still use PNG for that manner. PNG is excellent for low color images. In complex truecolor images PNG fails miserably.
_wb_
2023-01-11 12:50:08
PNG is good for 2, 4, 16 and 256 color images, specifically. For any other number of colors, it's less good since you still need to use a (palette index) bitdepth that is one of those four.
veluca
2023-01-11 12:52:52
I guess QR codes may be one such thing?
_wb_
2023-01-11 12:53:04
As long as you don't use filters, you can still do e.g. 50 colors effectively in png since you just won't have huffman codes for byte values that don't exist. But with filtering, you end up getting all kinds of values.
veluca
2023-01-11 12:53:34
what happens when you squeeze a 1-bit image?
_wb_
2023-01-11 12:54:04
QR codes are probably best compressed by using general-purpose compression on their payload and regenerating the QR code 🙂
veluca
veluca what happens when you squeeze a 1-bit image?
2023-01-11 12:54:52
1, 1 and 0, 0 clearly go in 1, 0 and 0, 0 (I think), but I am unsure about 1, 0 and 0, 1
2023-01-11 12:56:43
and also about what happens at image borders, for that matter
_wb_
2023-01-11 12:57:41
Yeah it's a bit messy and it might end up creating slightly more combinations than just 2^n for n input pixels, but that may not be a problematic thing compared to the gain you get by having macropixels to entropy code...
JendaLinda
_wb_ As long as you don't use filters, you can still do e.g. 50 colors effectively in png since you just won't have huffman codes for byte values that don't exist. But with filtering, you end up getting all kinds of values.
2023-01-11 12:58:00
So that's why filtering is usually not used for indexed color. Also the palette can be shortened if not all color indices are used.
_wb_
2023-01-11 12:58:48
The palette can be shortened but you still feed full bytes to deflate even when there are only 17 colors.
JendaLinda
2023-01-11 12:59:54
That's true. Anyway, mostly flat colored truecolor images also better compress without filtering.
_wb_
2023-01-11 01:00:37
Prediction can in principle be quite useful for palette images so it's a bit of a pity that in png prediction doesn't mix well with palette.
2023-01-11 01:02:03
At least png still has lz77 so when prediction from W or N has a run of zero residuals, lz77 comes to the rescue
JendaLinda
2023-01-11 01:05:48
In PNG, it's sometimes hit and miss. Some images can compress better in 8bit palette even if using less than 16 colors.
_wb_
2023-01-11 01:09:58
I suppose bitpacking is not always a good idea - it does reduce lz77 matching options, though it does shorten the distances.
JendaLinda
2023-01-11 01:17:21
1bit gray can be used for scanned graphs, lineart and similar documents, although I'm not fan of 1 bit scans because readability is often pretty poor.
Demiurge
2023-01-11 06:19:41
I'm getting lots of "maybe uninitialized" warnings for a variable named `__Y` when compiling latest libjxl-git on Arch.
2023-01-11 06:28:27
Is there a way to have `make test` use all of my CPU cores? It seems to only be running 1 test at a time even though `make build` is multi core.
2023-01-11 06:30:12
``` The following tests FAILED: 3069 - JxlTest.RoundtripLossless8LightningGradient (Subprocess aborted) 3094 - JxlTest.LosslessPNMRoundtrip (Subprocess aborted) ```
2023-01-11 06:39:05
Huh, weird, I never heard of "high bit depth JPEG" before
veluca
Demiurge Is there a way to have `make test` use all of my CPU cores? It seems to only be running 1 test at a time even though `make build` is multi core.
2023-01-11 06:46:22
use ninja 😛
Demiurge ``` The following tests FAILED: 3069 - JxlTest.RoundtripLossless8LightningGradient (Subprocess aborted) 3094 - JxlTest.LosslessPNMRoundtrip (Subprocess aborted) ```
2023-01-11 06:46:51
can you open an issue about those? ideally with the stack trace
Demiurge
2023-01-11 06:50:31
Ah damn, didn't realize the AUR pkgbuild is using cmake when ninja is available...
2023-01-11 06:50:55
One of the things I hate about linux in general and especially arch is that packagers are idiots...
2023-01-11 06:52:49
Do I have to create a github account to open an issue?
veluca
2023-01-11 06:53:00
probably
2023-01-11 06:58:42
if that's not an option you can also copypaste the stack traces here and/or DM me but it will be easier for me to lose track of it 😛
Demiurge
2023-01-11 07:00:43
Hmm, I don't see any information about using ninja as the build system for libjxl.
veluca
2023-01-11 07:00:56
cmake -G Ninja [...]
Demiurge
2023-01-11 07:01:44
Oh. Truthfully I'm not that familiar with cmake or ninja or anything more over-engineered than standard makefiles tbf
2023-01-11 07:02:07
So thanks for telling me about that
2023-01-11 07:03:22
I heard that ninja is faster than most of these other fragile and over-engineered build systems
2023-01-11 07:04:07
Also this is weird: Why is a CLA required for contributing to a BSD-licensed work?
2023-01-11 07:04:25
Doesn't the BSD license make a CLA completely pointless?
2023-01-11 07:04:51
Seems like an unnecessary barrier to submitting patches that doesn't actually achieve anything
veluca
2023-01-11 07:34:30
I am not a lawyer and I don't even want to begin to think about what the answer to that question might be 😛
Demiurge
2023-01-11 09:16:04
Well all I know is the BSD license basically says "do whatever you want, so long as you give credit" (oversimplified but that's the gist of it, there is a specific way to give credit to be in compliance with the license.)
2023-01-11 09:19:42
It's a very simple and short, very permissive license that essentially lets anyone do whatever they want.
2023-01-11 09:20:09
With very little stipulations
2023-01-11 09:22:01
Including, ANYONE can make derivatives that are re-licensed under different license terms. So there doesn't seem to be any point in having a CLA, since a CLA is used in case someone wants to relicense it under a different license, and the BSD license ALREADY allows for this.
2023-01-11 09:23:11
So the BSD license makes a CLA seemingly redundant and unnecessary.
2023-01-11 09:24:01
And yet it's required to sign one in order to participate in libjxl development. So it looks to me like an unnecessary hurdle.
2023-01-11 09:27:35
I guess the proper thing to do would be to create an issue on the issue tracker.
2023-01-11 09:28:41
There would possibly be more contributors to libjxl if needless barriers were removed from participating in development.
2023-01-11 09:29:30
Like signing a contract with Google :P
Traneptora
Demiurge Hmm, I don't see any information about using ninja as the build system for libjxl.
2023-01-11 09:41:25
yea just call cmake with `-GNinja` and it will generate build.ninja files instead of Makefiles
2023-01-11 09:41:34
it's really that simple
Demiurge
2023-01-11 10:49:25
I take back everything I said earlier about HEIC being really impressive and good looking
2023-01-11 10:49:32
rav1e looks way better
2023-01-11 10:49:51
But it also takes an extremely long time to encode anything
2023-01-11 10:51:01
So yeah rav1e looks way better than x265 I guess. If you're okay with taking about literally 20 times longer to encode
2023-01-11 10:51:29
Also it's still tuned for low-fidelity
Traneptora it's really that simple
2023-01-11 10:52:50
I still to this day never understood why people are unhappy with makefiles and why people are incapable of writing very simple and straightforward BSD-style makefiles without a whole bunch of unneccesary logic in them.
2023-01-11 10:54:01
`make` perfectly supports parallel builds too.
Traneptora
Demiurge I still to this day never understood why people are unhappy with makefiles and why people are incapable of writing very simple and straightforward BSD-style makefiles without a whole bunch of unneccesary logic in them.
2023-01-11 10:55:43
because Make is very slow
2023-01-11 10:55:55
and ninja is much faster
2023-01-11 10:56:58
Makefile syntax is designed to be written by hand and not auto-generated so even if it's auto-generated it has to have a complex robust parser that can handle all the syntactic sugar that Makefiles can have even if they are not used
Demiurge
2023-01-11 10:57:10
makefiles are supposed to contain absolutely the minimum information necessary to describe dependencies and how to update the files that are made from those dependencies.
improver
Demiurge Including, ANYONE can make derivatives that are re-licensed under different license terms. So there doesn't seem to be any point in having a CLA, since a CLA is used in case someone wants to relicense it under a different license, and the BSD license ALREADY allows for this.
2023-01-11 10:57:19
this isn't true
2023-01-11 10:57:58
you can't re-license derivatives. the way code is licensed, will remain
Traneptora
2023-01-11 10:58:22
The CLA as far as I'm aware prevents contributers who contribute code from blocking the project based on the license of the code they write
2023-01-11 10:58:32
that's basically all it does
2023-01-11 10:58:36
it prevents you from being "that guy"
improver
2023-01-11 10:58:53
you can slap whatever license on the new code, but no you can't just change up license without owner's permission of existing code
Demiurge
2023-01-11 10:59:27
If you make a derivative, you can license your derivative any way you like, so long as you retain the copyright notice (which essentially amounts to giving attribution).
Traneptora
2023-01-11 10:59:39
only the code you add, not the original code
Demiurge
2023-01-11 10:59:55
Yes, but that's how copyright works anyways.
Traneptora
2023-01-11 11:00:02
and you don't own the copyright to the original
2023-01-11 11:00:12
otherwise you could essentially just add some dummy pointless stub code and then relicense a library however you wanted
Demiurge
2023-01-11 11:00:15
Once you waive your rights you can never undo.
improver
2023-01-11 11:00:35
you don't waive these rights unless it's 0-clause BSD
Traneptora
2023-01-11 11:00:59
or some other public-domain-type license, but yea
Demiurge
2023-01-11 11:01:08
Once you license something under BSD license, you can never retroactively "take back" the rights you waived.
improver
2023-01-11 11:01:37
with CLA you do waive these rights
2023-01-11 11:01:47
depending on CLA conditions
Traneptora
2023-01-11 11:02:00
in order to copyright something in most jurisdictions you have to actually have created it. You cannot take shakespeare's plays and copyright it, since you didn't write it.
2023-01-11 11:02:22
just because you use them in something you *did* write doesn't change the license or copyright status of the original
2023-01-11 11:03:15
likewise, you can't incorporate GPLed code in your library, add to that GPLed code, and then relicense that GPLed code as somethign else. The code you didn't write has its original copyright owner preserved and the original license preserved.
Demiurge
2023-01-11 11:04:19
The CLA accomplishes nothing that isn't already accomplished by the BSD license. Since libjxl is already released under BSD license terms, that version will ALWAYS be available under BSD license. ANYONE can create a new derivative work of libjxl or new version and release the new version under a different license. All of the code that was already released under BSD licence will always and forever be BSD licensed (unless even more rights are waived later).
Traneptora
2023-01-11 11:04:36
> ANYONE can create a new derivative work of libjxl or new version and release the new version under a different license.
2023-01-11 11:04:40
No, you can't do this.
2023-01-11 11:04:49
You cannot relicense code you did not write.
Demiurge
2023-01-11 11:05:08
I guess the one thing that the CLA accomplishes is that it gives Google the ability to waive even more rights to relicense it under an even more permissive license like CC0
2023-01-11 11:05:25
Now that I think about it
improver
2023-01-11 11:06:19
yeah, that, and also legalese blabbery about how you are sure you aren't putting out stolen code and it's your responsibility if you get caught doing that, not google's
2023-01-11 11:06:54
they have already done license change, btw, from apache2
Demiurge
Traneptora You cannot relicense code you did not write.
2023-01-11 11:07:08
Like I said, I can't do that. All of the code that the derivative is based on will still retain the same license obviously. Only the derivative work would be re-licensed. NO ONE can re-claim the rights over released code after those rights have already been waived
Traneptora
2023-01-11 11:07:35
You can't relicense the derivative work, only the *new code* in the derivative work that isn't in the old work.
2023-01-11 11:08:15
You keep using "derivative work" as though it only counts the delta, this isn't what that term means. A derivative work is the entire derived work. Blink is a derivative work of Webkit, not just the code that's in blink that isn't in webkit. The whole thing.
Demiurge
2023-01-11 11:09:22
Where's the distinction?
Traneptora
2023-01-11 11:09:33
the distinction is that a derivative work includes code you did not write
2023-01-11 11:10:21
If it only contained brand new code, it wouldn't be a derivative work, it would just be a brand new work.
Demiurge
2023-01-11 11:10:54
I am obviously not saying that anyone has the power to alter the license of something they don't own the rights to.
Traneptora
2023-01-11 11:11:10
You are saying that when you misuse the term "derivative work"
Demiurge
2023-01-11 11:12:15
Just because I make a derivative work of libjxl doesn't mean I can alter the license of the libjxl itself, but yes I can make 1 tiny change and release the whole thing under a different license so long as I abide by my license terms I received.
Traneptora
2023-01-11 11:12:25
No, you can't.
2023-01-11 11:13:00
You can't just relicense code you didn't write, otherwise you'd see "GPL-free" versions of GPLed libraries which are forks that changed one line of code.
Demiurge
2023-01-11 11:13:16
That's what the license terms allow me to do. That's why corporations that are super protective of their "proprietary licensed secret source code" love the BSD license.
Traneptora
2023-01-11 11:13:27
No they don't
2023-01-11 11:13:34
You cannot release the whole thing under a different license. Only the code you personally wrote.
Demiurge
2023-01-11 11:13:46
Because they can incorporate BSD licensed code into their super-special proprietary product
improver
2023-01-11 11:14:00
and they will STILL need to abide to its terms
Traneptora
2023-01-11 11:14:06
Except those proprietary products have open source licenses available to view.
improver
2023-01-11 11:14:09
and indicate license in readme or manual or somethiong
Traneptora
2023-01-11 11:14:17
Take your phone and view open source licenses in the settings
Demiurge
2023-01-11 11:14:43
You can view the license because that's required as part of the terms they licensed the BSD-licensed code under
2023-01-11 11:15:02
But they are not required to do anything else other than show you the license terms they received.
2023-01-11 11:15:13
They don't have to show you what changes they made.
improver
2023-01-11 11:15:35
in case of BSD, yeah. in case of GPL, no
Demiurge
2023-01-11 11:15:43
And they can forbid you from redistributing their super special version under a new separate license
improver
2023-01-11 11:15:51
but, like, that's not the same as "the code is licensed different now"
Demiurge
2023-01-11 11:16:11
They don't need to make substantial changes to do this either.
improver
2023-01-11 11:16:50
your point being?
Demiurge
2023-01-11 11:17:25
I can literally just compile libjxl and release my binary under the "up-yours" license, which says you're forbidden from distributing it to anyone unless you pay me 50 dollars.
improver
2023-01-11 11:17:42
that BSD is not that effective at pushing opensource-ness? yeah.....?
Demiurge
2023-01-11 11:17:45
And say I used special secret compiler flags or something
Traneptora
2023-01-11 11:17:47
You can't do that legally
improver
2023-01-11 11:18:11
nah you actually can produce app incorporating libjxl
2023-01-11 11:18:18
question is who gonna buy it lol
2023-01-11 11:18:32
and yes you can sell it
Traneptora
2023-01-11 11:18:38
does the BSD license allow for that? huh, interesting.
improver
2023-01-11 11:18:43
you can actually sell libjxl code too in floppies or something
Traneptora
2023-01-11 11:18:44
But that's not a new license
improver
2023-01-11 11:18:45
or paid downloads
Demiurge
2023-01-11 11:18:46
That's an example of how anyone indeed can take libjxl and release it under a different license, because that's what the BSD license allows anyone to do
improver
2023-01-11 11:18:50
nothing in license forbids that
Traneptora
2023-01-11 11:19:03
the BSD license doesn't allow anyone to just relicense it, as far as I'm aware
2023-01-11 11:19:15
but it doesn't have a clause against selling it
improver
2023-01-11 11:19:17
you just gotta note that u took code from libjxl by these authors blahblah in readme
Traneptora
2023-01-11 11:19:25
the GPL doesn't actually have any clause that prevents selling GPLed code either
improver
2023-01-11 11:19:32
yep
Traneptora
2023-01-11 11:19:40
but it doesn't let you just *change the license*
2023-01-11 11:19:53
that's not the same thing as just *changing the license*
Demiurge
2023-01-11 11:20:29
The BSD license allows anyone to do anything as long as they retain a copyright notice that essentially says something like "using work obtained under BSD license from libjxl project website"
Traneptora
2023-01-11 11:20:38
That's not changing the license
improver
2023-01-11 11:20:57
it explicitly notes things you are allowed to do, not "anything"
Demiurge
2023-01-11 11:21:05
Including releasing it under a more restrictive license
improver
2023-01-11 11:21:46
can you just read damn license with sober non-tired mind and let it sink in
Traneptora
2023-01-11 11:21:46
it doesn't list that in the list of the things you may do
2023-01-11 11:22:18
BSD 2-clause is literally just this:
2023-01-11 11:22:47
> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: > > 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. > 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. followed by a generic waiver of implied warranty law
2023-01-11 11:22:59
It permits redistribution, and use, in source and binary forms
improver
2023-01-11 11:23:05
"redistribution and use"
Traneptora
2023-01-11 11:23:06
it doesn't permit relicensing
improver
2023-01-11 11:23:08
not "relicense"
Traneptora
2023-01-11 11:23:53
please just read these licenses before you make claims about what they say
Demiurge
2023-01-11 11:24:28
I am reading it again at https://github.com/libjxl/libjxl/blob/main/LICENSE
Traneptora
2023-01-11 11:24:46
3-clause is almost the same as 2-clause
Demiurge
2023-01-11 11:24:47
But this is not the first time I have read about this commonly-used license
Traneptora
2023-01-11 11:25:04
In particular: > Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
improver
2023-01-11 11:25:06
there are 4 variants of it
Traneptora
2023-01-11 11:25:11
It permits redistribution and use
2023-01-11 11:25:14
it doesn't permit relicensing
Demiurge
2023-01-11 11:27:43
When you make a derivative work of a BSD licensed product, you still have to comply with the original license (which is easy, it's BSD) but on top of that you can put any copyright you want on your derivative.
Traneptora
2023-01-11 11:27:52
no, you can't.
2023-01-11 11:28:03
Only on the code that you *wrote*
2023-01-11 11:28:08
Again, you're misusing the term "derivative"
2023-01-11 11:28:20
a derivative work includes *all of the code* including the code that you did not write.
Demiurge
2023-01-11 11:28:32
Yes, you can, and yes, that's why it's used so often by corporations.
Traneptora
2023-01-11 11:28:53
You can't relicense the code that is part of your derivative that you didn't write.
2023-01-11 11:29:05
Because the BSD license doesn't permit that.
improver
2023-01-11 11:29:34
you can license new code you wrote in your "derivative" work but honestly this term is too loaded to talk with clearly
Demiurge
2023-01-11 11:30:09
If you used a BSD licensed work in your software, your entire software does not become BSD.
2023-01-11 11:30:23
It is not a "viral" license like that.
improver
2023-01-11 11:30:50
your work virally must now carry notice about the code you used and the whole copyright license
2023-01-11 11:31:32
if you incorporated gpl then yeah that's kinda more cursed though i wouldn't think that's grounds for relicensing your own code either
Demiurge
2023-01-11 11:31:33
Yes, to comply with the terms I received the work under, I must have that notice but I don't have to do anything else
improver
2023-01-11 11:31:40
maybe only integration with gpl code parts
2023-01-11 11:31:59
i may be quite wrong here though
Demiurge
2023-01-11 11:33:32
Basically what I'm saying is that when I think about it a little more, the CLA could theoretically allow Google to waive even more rights in the future, for any code that gets contributed.
improver
2023-01-11 11:34:19
waiving the rights isn't the sole reason of CLA, but yes this is correct
Demiurge
2023-01-11 11:34:25
The BSD license is already pretty liberal and widely accepted by corporations so I doubt there would ever be a need to make it even more allowing
improver
2023-01-11 11:35:16
when you want to understand why someone does something one way or another, you gotta look from their point of view, not yours
Demiurge
2023-01-11 11:35:47
The whole reason I brought it up is because signing a CLA is another hurdle to jump through before anyone can contribute and if the CLA is not there for a really important reason maybe it should be removed
2023-01-11 11:36:54
It seems odd to me for a BSD-licensed work to require a CLA to contribute, since the BSD license is already such a carefree license
improver
2023-01-11 11:37:17
the people you are talking to are not the ones who handed it down the way it is. iirc all google's open-source projects are like that, and i doubt this is easy to change, kinda swimming against the current
2023-01-11 11:37:32
& i think they have enough of stuff to worry about already
Demiurge
2023-01-11 11:37:44
It would seem to me on the surface that there is very little a CLA brings for a BSD-licensed work.
improver
2023-01-11 11:38:00
from your point of view and values, yes
Demiurge
2023-01-12 05:11:44
I haven't revealed to anyone yet what my values are.
Moritz Firsching
2023-01-12 11:28:34
Good news: we are planning to make a v0.8.0 release soon! I'm on my way to the ISO meeting in Sydney
Deleted User
2023-01-12 11:35:09
Good news, any chance for stable 1.0 this year? I see https://github.com/libjxl/libjxl/milestone/1 is nearly frozen
_wb_
2023-01-12 01:35:50
As far as I understand (but IANAL), the CLA serves two main purposes: - copyright: your contribution is not just BSD-3 licensed, we also can relicense it under another (even more permissive) license should the need arise. We already did that once when relicensing from Apache 2.0 to BSD-3. Relicensing without CLAs means we need to track all contributors and get their permission, which tends to be problematic when some contributors are no longer reachable. Since BSD-3 is already about as permissive as it gets (and seems to be acceptable to e.g. Adobe and Serif), I don't think there will be a need to relicense, but you never know. - patents: by signing the CLA, you also grant a patent license under the same conditions as Google and Cloudinary granted their patents (royalty-free, with a defensive clause). Should your contribution contain anything you don't just have copyright on but also patents, this is important, since the BSD-3 license is only a copyright license that does not say anything about patents. We need to ensure that no contribution accidentally or intentionally injects patent-encumbered things into libjxl. The CLA helps prevent that. I agree that the CLA is a bit of an annoying obstacle for new contributors, but I think it's there for good reasons.
spider-mario
Traneptora it doesn't permit relicensing
2023-01-12 01:48:50
it does
2023-01-12 01:48:57
https://en.wikipedia.org/wiki/Permissive_software_license
2023-01-12 01:49:05
“Grants use rights, including right to relicense (allows proprietization, license compatibility)”
2023-01-12 01:49:19
it allows placing further restrictions in future distributions as long as the original ones are respected
2023-01-12 01:49:45
the way that the GPL prevents this is essentially by saying “these restrictions shall be preserved”
Traneptora
spider-mario it allows placing further restrictions in future distributions as long as the original ones are respected
2023-01-12 01:50:22
> as long as the original ones are respected this is not relicensing though
spider-mario
2023-01-12 01:50:59
arguably, the copy is effectively under a new license for all intents and purposes
2023-01-12 01:51:22
of course, if it’s unmodified, it’s rather pointless since the original is still available under just the BSD license’s restrictions (i.e. not much)
veluca
2023-01-12 02:05:17
as far as I am concerned, the CLA does something very useful: it reduces the number of conversations we need to have with our opensource lawyers 😛