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

JendaLinda
2024-05-09 11:38:53
If you care about the camera, good for you. I don't πŸ˜‰
2024-05-09 11:43:25
Anyway. does jxl have equivalent to JPEG comments? It seems it just gets buried inside jbrd.
2024-05-09 11:49:17
Comments in PNG are simply discarded by cjxl.
TheBigBadBoy - π™Έπš›
2024-05-09 12:26:12
why I don't why so many formats added comments to their specs like, why the fuck would anyone want a comment in a GZIP file ? And even more useless because there's no support at all for stuffs like that
JendaLinda
2024-05-09 01:03:53
It's certainly useful being able to store text information inside media files. Unfortunately different formats use different methods, so it's difficult to manage.
jonnyawsom3
2024-05-09 01:05:27
At least in PNG having just a text box is useful as stated above, since it can store any range of data, but the different formats of text in different image formats means they're rarely compatible apart from default EXIF and maybe XMP
JendaLinda
2024-05-09 01:08:49
I think a format like XMP could be used to store all kinds of metadata, keeping it tidy and human readable, and optionally compressed inside the file.
jonnyawsom3
2024-05-09 03:42:35
That's what I tried to tell the owner of a Github repository, but they pointed out that Discord removes the chunk even on a PNG so they're sticking to a custom text type
JendaLinda
2024-05-09 04:24:04
Everything could be translated to XMP during conversion to JXL.
jonnyawsom3
2024-05-09 04:36:37
https://github.com/libjxl/libjxl/issues/2641
JendaLinda
2024-05-09 05:04:41
For JPEG there's at least jbrd, where cjxl can dump everything that doesn't fit elsewhere.
_wb_
2024-05-09 05:31:45
Maybe it would be good to have a tool that takes all the metadata stuff from a PNG, which can be in specific chunks or encoded in various ways in text chunks, normalizes it, and turns it into one single XMP blob.
jonnyawsom3
2024-05-09 06:54:18
Maybe reversible with the same tool, PNG input and XMP compatible output (JXL), or formatted XMP (JXL) input to PNG for text chunk output. Then it's all fully lossless still
Demiurge
2024-05-09 07:29:04
There should be a way to reconstruct a JPEG from a JXL that's missing JBRD but otherwise compatible
_wb_
2024-05-09 07:43:01
Yes, in principle that should be easy, but there's no code path in libjxl atm to do that
jonnyawsom3
2024-05-09 07:49:51
Actually yeah, all png text chunks already need to have a type assigned, be it custom or predefined, so that could be directly converted to an XMP entry, with others for any more unrecognised/unhandled chunks
JendaLinda
2024-05-10 04:44:29
This metadata conversion tool should be able to transcribe most ancillary chunks to XMP, although some of them couldn't be converted back. For example the original palette. We were already discussing it would be useful to have an option to keep information about the original palette and XMP could be the right place for it.
TheBigBadBoy - π™Έπš›
2024-05-10 11:51:51
is it normal that adding `--brotli_effort=11` to `cjxl -e 11 -d 0` gives me a smaller output ?
2024-05-10 11:52:20
It would have make sense (to me) for -e 11 to try it [β €](https://cdn.discordapp.com/emojis/654081052108652544.webp?size=48&quality=lossless&name=av1_Hmmm)
jonnyawsom3
2024-05-10 11:59:00
Actually, why isn't brotli effort connected to JXL effort at all?
afed
2024-05-10 12:04:34
i dont think a correlation is needed for all efforts, but maybe yeah, it would be useful to enable `--brotli_effort=11` for like `-e 10-11`
_wb_
2024-05-10 12:18:01
could make sense to make the default for brotli effort depend on the jxl effort β€” it only makes a difference if there is metadata or jbrd stuff to compress, but still...
afed
2024-05-10 12:34:44
it wouldn't make much sense for all efforts, most metadata is not that big and there is no noticeable difference in speed but maybe something like brotli 6 for `-e 1-2`, brotli 9 for`-e 3-8`, brotli 11 for `-e 8-11`
jonnyawsom3
2024-05-10 12:43:40
Yeah, especially for e1 a lower brotli effort might be useful, and for jpeg transcoding going from brotli 10 to 11 might make a fair amount of difference
afed
2024-05-10 01:07:39
interesting <:FeelsReadingMan:808827102278451241> https://github.com/libjxl/libjxl/pull/3569
TheBigBadBoy - π™Έπš›
2024-05-10 01:44:06
The file I was talking about is the one from the issue where they can't encodeit with cjpegli (100x100 pure black)
2024-05-10 01:44:31
it has **no** metadata
2024-05-10 01:44:45
JXL e11 size is 19 bytes with brotli_effort=11, 17 bytes
2024-05-10 01:47:33
```17 black.jxl 30 black.webp 76 black.png 193 black.jpg```
afed
2024-05-10 02:12:27
<:Thonk:805904896879493180> https://www.w3.org/TR/png-3/#11IHDR
Meow
afed <:Thonk:805904896879493180> https://www.w3.org/TR/png-3/#11IHDR
2024-05-10 02:23:51
Yes HDR is a significant part added to the spec
spider-mario
2024-05-10 02:24:20
afaik, this is unrelated, it’s just β€œihdr” as in β€œimage header”
2024-05-10 02:25:00
those actually relevant to HDR are https://www.w3.org/TR/png-3/#cICP-chunk and https://www.w3.org/TR/png-3/#mDCv-chunk
Traneptora
2024-05-10 02:28:09
IHDR is indeed image header
2024-05-10 02:28:33
`cICP`, `mDVc` and `cLLi` are the relevant chunks for HDR content
afed
2024-05-10 02:28:38
yeah, in general, it seems like a pretty standard png <:FeelsReadingMan:808827102278451241> ``` chunk IHDR at offset 0x0000c, length 13 100 x 100 image, 1-bit grayscale, non-interlaced chunk IDAT at offset 0x00025, length 19 zlib: deflated, 32K window, maximum compression row filters (0 none, 1 sub, 2 up, 3 avg, 4 paeth): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (100 out of 100) chunk IEND at offset 0x00044, length 0 No errors detected in black.its_a_png (3 chunks, 94.2% compression).```
Meow
2024-05-10 02:29:58
Oh I was thinking of HDR as it was mentioned frequently today
jonnyawsom3
2024-05-10 02:35:10
How's jpegli handle greyscale PNG input? Might be that
Traneptora
2024-05-10 02:35:37
it's greyscale, yea
2024-05-10 02:35:38
1bit
monad
TheBigBadBoy - π™Έπš› JXL e11 size is 19 bytes with brotli_effort=11, 17 bytes
2024-05-10 02:41:31
your e11 is broken
2024-05-10 02:43:33
I'm just refering to the sizes
TheBigBadBoy - π™Έπš›
2024-05-10 02:43:56
I still don't undertsand what you mean
2024-05-10 02:44:47
oh wait
2024-05-10 02:49:33
ahhhhhh I found out it is when recompressing that JXL https://cdn.discordapp.com/attachments/673202643916816384/1238391325942878208/black.jxl (24bytes) that I get 19 bytes while if take the same command with PNG input, it goes down to 17 bytes
2024-05-10 02:51:06
19B: ```$ jxlinfo black\ \(1\).jxl JPEG XL image, 100x100, (possibly) lossless, 1-bit RGB Color space: RGB, D65, sRGB primaries, sRGB transfer function, rendering intent: Perceptual```17B:```$ jxlinfo out.jxl JPEG XL image, 100x100, (possibly) lossless, 1-bit Grayscale Color space: Grayscale, D65, sRGB transfer function, rendering intent: Relative```
monad
2024-05-10 02:55:15
now stop touching e11. just use d0e10P0I100g3 directly
TheBigBadBoy - π™Έπš›
monad now stop touching e11. just use d0e10P0I100g3 directly
2024-05-10 02:56:38
```$ cjxl -d 0 -e 10 -P 0 -I 100 -g 3 --brotli_effort=11 black\ \(1\).jxl out.jxl JPEG XL encoder v0.10.2 e1489592 [AVX2,SSE4,SSE2] Encoding [Modular, lossless, effort: 10] Compressed to 21 bytes (0.017 bpp). 100 x 100, 1.265 MP/s [1.27, 1.27], , 1 reps, 16 threads.```<:KekDog:805390049033191445>```JPEG XL image, 100x100, (possibly) lossless, 1-bit RGB Color space: RGB, D65, sRGB primaries, sRGB transfer function, rendering intent: Perceptual```
monad
2024-05-10 02:57:15
that's the jxl input
2024-05-10 02:57:18
jxl is bad
TheBigBadBoy - π™Έπš›
2024-05-10 02:58:36
with PNG input, still 17B
monad
2024-05-10 02:58:55
yes, that's what e11 would use
TheBigBadBoy - π™Έπš›
2024-05-10 02:59:20
note to myself: never use JXL as input [β €](https://cdn.discordapp.com/emojis/867794291652558888.webp?size=48&quality=lossless&name=av1_dogelol)
jonnyawsom3
2024-05-10 03:18:20
It was added for convenience, don't think JXL input has actually been tested much
Traneptora
2024-05-10 03:27:34
why is JXL input bad?
afed
2024-05-10 03:30:37
probably some quick checks and optimizations are not implemented as it works for png
2024-05-10 03:34:06
like it was with fjxl for png, but not for ppm (before some changes)
jonnyawsom3
2024-05-10 04:02:27
Well it just seems like it's using RGB instead of Greyscale
Traneptora
2024-05-10 08:14:15
that's just a bug, not a fundamental flaw
qdwang
2024-05-12 06:48:40
Has someone compared 10bit+ quality/size for jpegli and JXL?
JendaLinda
2024-05-12 07:45:38
How do you tell cjpegli to encode in 10 bit? I don't see the option.
lonjil
2024-05-12 08:12:59
use high bit depth input
_wb_
2024-05-12 11:00:25
It always encodes in high precision, but writes nominally 8-bit jpeg files.
spider-mario
2024-05-12 01:19:03
decoding to a high-bit-depth PNG, however, requires `djpegli --bitdepth=16`
JendaLinda
2024-05-12 02:47:25
I've tried to encode a 16 bit PNG but the resulting jpeg looks and behaves just like an ordinary jpeg.
qdwang
_wb_ It always encodes in high precision, but writes nominally 8-bit jpeg files.
2024-05-12 02:47:26
So there's no method to output 10bits+ jpeg with jpegli, right? I've checked that it uses `jpeg_compress_struct` for parameters setting like libjpeg, there's no output bit per sample in it.
_wb_
2024-05-12 02:48:28
8-bit jpeg is internally using 12-bit DCT coefficients, which in smooth regions is enough for 11 bit sample precision
qdwang
_wb_ 8-bit jpeg is internally using 12-bit DCT coefficients, which in smooth regions is enough for 11 bit sample precision
2024-05-12 02:49:53
Thanks for you answer.
JendaLinda
2024-05-12 02:51:18
Ah that makes sesns. I've noticed, that ordinary jpegs may decode to values between the original 8 bit.
2024-05-12 02:52:41
So there could be more than 256 values in the decoded output.
qdwang
2024-05-12 02:55:41
I don't know if jpeg92 standard has this inside it? Does jpeg92 use 8bit DCT coefficients?
JendaLinda
2024-05-12 03:26:10
It seems that jpeg always used 12 bit DCT. I'm trying some ancient jpeg viewers, that don't even support progressive yet. Non-progressive jpeg encoded using cjpegli from 16 bit PNG works just fine.
jonnyawsom3
2024-05-12 03:34:29
Yeah, it's completely within spec, which a lot of people don't belive and think it's like gain maps or an entire new format
JendaLinda
2024-05-12 03:39:59
So traditional decoders just truncate the values to 8 bits.
jonnyawsom3
2024-05-12 03:44:01
Jpegli uses floats internally, other decoders use 8bit int so decimal precision is lost
JendaLinda
2024-05-12 03:58:45
Old jxl files transcoded from jpeg have container structure jbrd-jxlc. Newer files have structure jxlp-jbrd-jxlp. Is something wrong with the older structure?
jonnyawsom3
2024-05-12 04:12:28
Might be making them progressive by default now? > The codestream can optionally be split into multiple `jxlp` boxes; > conceptually, this is equivalent to a single `jxlc` box that contains the > concatenation of all partial codestream boxes. > This makes it possible to create a file that starts with > the data needed for a progressive preview of the image, followed by > metadata, followed by the remaining image data.
JendaLinda
2024-05-12 04:22:10
The first jxlp is very small, the second jxlp contains the rest of the jxl data.
2024-05-12 04:41:14
It seems the reason was just to have the jxl header and jbrd box close to the beginning of the file. The question is, is there any disadvantage of the older arrangement or should I convert everything to the new arrangement?
qdwang
2024-05-13 07:53:55
But how to feed 16bit data to jpegli? The `jpegli_write_scanlines` only works for 8bit input.
afed
2024-05-13 09:13:16
<@532010383041363969> is this prs ready to merge? or still need some changes i want to test something but with all lossy improvements <https://github.com/libjxl/libjxl/pull/3563> <https://github.com/libjxl/libjxl/pull/3536>
Jyrki Alakuijala
2024-05-13 09:30:34
yes, I'm working towards it right now
2024-05-13 09:30:48
I will change other heuristics later this week, possibly by tomorrow
2024-05-13 09:32:02
the current generation loss is pretty bad -- it looks like I have broken it in a complex way in several 'improvements' for difficult images
2024-05-13 09:32:36
I don't yet know what is the best way to fix -- it looks like I don't understand the issue yet as what happens right now shouldn't happen by pure logic
2024-05-13 09:33:04
but if I remove the heuristics that I added, then everything is fine (except the difficult images get quite a bit worse)
afed <@532010383041363969> is this prs ready to merge? or still need some changes i want to test something but with all lossy improvements <https://github.com/libjxl/libjxl/pull/3563> <https://github.com/libjxl/libjxl/pull/3536>
2024-05-13 09:56:25
both 3536 and 3563 are on they way in now (approved, possibly merged in a few hours)
afed
2024-05-13 09:58:36
thanks πŸ‘
_wb_
2024-05-13 10:10:54
Meanwhile I've been tweaking lossy modular a bit, also made some small improvements to its generation loss: https://github.com/libjxl/libjxl/pull/3575
Jyrki Alakuijala
2024-05-13 12:23:11
do you want to remove the out-commented printf statements before a review?
_wb_
2024-05-13 12:56:20
right
Demiurge
2024-05-14 08:39:58
I notice lossy modular (with squeeze disabled) preserves edges of line art perfectly but changes the colors radically
afed
2024-05-14 09:08:39
it will improve memory management? https://github.com/libjxl/libjxl/pull/3582
_wb_
2024-05-14 01:20:58
lossy modular without squeeze has not been tweaked yet at all β€” it just does precision reduction in XYB, and probably does it too much for X/B then
afed
_wb_ lossy modular without squeeze has not been tweaked yet at all β€” it just does precision reduction in XYB, and probably does it too much for X/B then
2024-05-15 01:03:35
maybe at least do some auto bruteforce tuning based on metrics, not the best, but at least something and anyway lossy modular has only some specific use
_wb_
2024-05-15 01:04:38
default lossy modular is with squeeze, that's the only way to get it somewhat competitive with vardct
2024-05-15 01:05:58
but yes, makes sense to get the non-squeezed lossy modular a bit better β€” it's used when doing patches so there's that...
Jyrki Alakuijala
2024-05-15 05:45:09
now I have merged all quality changing PRs that I was planning to
lonjil
2024-05-15 05:50:18
hooray
yoochan
2024-05-15 06:08:45
To Be Tested πŸ™‚
afed
2024-05-15 06:12:10
still not merged <https://github.com/libjxl/libjxl/pull/3575> <https://github.com/libjxl/libjxl/pull/3563>
jonnyawsom3
2024-05-15 06:14:43
Those are Jon's PRs ;P
afed
2024-05-16 08:21:08
<@794205442175402004> but maybe it needs retuning for the new quality changes? <https://github.com/libjxl/libjxl/pull/3563>
_wb_
2024-05-16 11:26:31
The changes in that PR are orthogonal to the changes Jyrki made β€” my PR is turning off Gaborish by default at d <= 0.5, Jyrki's change makes Gaborish behave better than before at all distances. The best cutoff point of switching from Gaborish enabled to disabled might change, but is a bit arbitrary anyway. In any case Gaborish (like any filter) will introduce some additional generation loss, and in any case it is less useful/needed at very low distances, so I think my PR can stay the way it is.
afed
2024-05-16 11:31:33
yeah, I meant after these quality changes the gaborish cutoff point can be shifted to higher quality
_wb_
2024-05-16 11:42:48
Maybe, but to me it's more about the use case β€” for the final encode for e.g. web delivery, generation loss is not as important as if you would want to use jxl in an authoring workflow (and lossless is not an option due to speed / disk io / limited storage). I think it's safe to assume that for web delivery, you'll typically want d >= 1 (probably usually d2 up to d3), while for authoring workflows you'll want to use a (much) higher quality. Distance 0.5 seems a reasonable cutoff point in that sense: that's about the lowest quality that can still be used in an authoring workflow.
2024-05-16 11:43:18
In any case this is just the default for gaborish, of course applications are free to enable or disable gaborish at any quality setting.
afed
_wb_ Maybe, but to me it's more about the use case β€” for the final encode for e.g. web delivery, generation loss is not as important as if you would want to use jxl in an authoring workflow (and lossless is not an option due to speed / disk io / limited storage). I think it's safe to assume that for web delivery, you'll typically want d >= 1 (probably usually d2 up to d3), while for authoring workflows you'll want to use a (much) higher quality. Distance 0.5 seems a reasonable cutoff point in that sense: that's about the lowest quality that can still be used in an authoring workflow.
2024-05-16 12:46:52
also for such high qualities it would be interesting to compare different efforts, maybe some introduce more distortion or maybe faster ones would be better, even if gaborish is disabled
_wb_
2024-05-16 01:22:12
it seems quite likely that lower effort encodes will be better to avoid generation loss β€” using fewer coding tools generally means less different ways to accumulate artifacts πŸ™‚
afed
2024-05-16 01:35:01
then maybe tuning some other parameters also makes sense for very high quality, some will probably not be somehow worse for a single generation or maybe even give some improvements
jonnyawsom3
afed yeah, I meant after these quality changes the gaborish cutoff point can be shifted to higher quality
2024-05-16 02:28:32
I did think about having the gaborish strength tied to distance, so as the distance increases so does the strength, probably with the cutoff similar to Jon's PR but then starting gradually instead of a hard on/off
_wb_
2024-05-16 03:32:40
yes, that makes sense, though if the strength is close to zero, it's probably best to skip it and save the encode/decode time of doing those convolutions
Jyrki Alakuijala
_wb_ The changes in that PR are orthogonal to the changes Jyrki made β€” my PR is turning off Gaborish by default at d <= 0.5, Jyrki's change makes Gaborish behave better than before at all distances. The best cutoff point of switching from Gaborish enabled to disabled might change, but is a bit arbitrary anyway. In any case Gaborish (like any filter) will introduce some additional generation loss, and in any case it is less useful/needed at very low distances, so I think my PR can stay the way it is.
2024-05-16 03:34:15
probably slightly worse at very large distances
_wb_
2024-05-16 03:43:06
at very large distances, gaborish can make the difference between having a very minor headache AND cholera, and only having cholera without the minor headache
Jyrki Alakuijala
2024-05-16 04:24:17
those who use large distances are mostly looking for a way for a video codec to win -- not to have utility for image compression
_wb_
2024-05-16 08:38:54
We don't have good metrics to assess very low quality images. The usual metrics start to break down at some point. Banding is one of the main problems at very low quality, but most metrics are not so great at estimating the visual impact of banding in slow gradients.
eddie.zato
2024-05-17 08:09:27
Since I can't yet build the latest nightly tools with skcms, this raised a question: how much difference is there in the resulting images between building with skcms and without it, just with lcms2? Or are there any differences at all?
spider-mario
2024-05-17 09:52:58
lcms2 is more feature-complete (e.g. can convert to LUT-based profiles), skcms is faster
2024-05-17 09:53:15
within their feature overlap, there shouldn’t be significant differences in the results
2024-05-17 09:54:01
(if there are, I would tend to trust lcms2’s results more, as the difference might then stem from something skcms doesn’t support)
2024-05-17 09:54:36
basically, you’re not missing out, if that’s what you were worried about
eddie.zato
2024-05-17 10:20:15
Ok, thanks, that's exactly what I'm worried about.
Traneptora
_wb_ Perhaps we should change our PNG reading/writing and get rid of the dependency to libpng. We could use lodepng for decoding and fpnge for encoding instead. As a side effect, cjxl and particularly djxl would get faster from the end-user point of view (especially djxl is currently often spending most of its wall time on png encoding of the decoded image, not on the decoding itself). WDYT, <@&803357352664891472> ? (also we should stop using libjpeg-turbo/sjpeg for reading/writing jpegs and use jpegli instead)
2024-05-19 05:43:18
you could possibly use spng
2024-05-19 05:43:24
instead of lodepng
excatron
2024-05-20 05:56:08
well I just hope noob questions are allowed... lol I was converting some Images just to save storage space and discovered that some images throw an error. It seems that all of those who do are coming from WhatsApp. So I tested it with one photo someone sent me, when I save it to my Photos App and then AirDrop it, it converts just fine, but when airdrop it from the share sheet within WhatsApp it throws the error. "Error while decoding the JPEG image. It may be corrupt (e.g. truncated) or of an unsupported type (e.g. CMYK). EncodeImageJXL() failed." I don't get it. What is WhatsApp doing to those poor images?
Quackdoc
2024-05-20 06:01:52
are there any samples you can provide?
excatron
2024-05-20 06:10:44
ofc
Quackdoc
2024-05-20 06:23:32
hmm, i'm not seeing anything super strange about magick, and disabling lossless_jpeg seems to encode the image fine. This is probably an issue with libjxl itself and is probably worth reporting on the git
excatron
2024-05-20 06:24:20
I didn't try lossy tbh.
Quackdoc
2024-05-20 06:25:01
here is the diff between the two that magick reports, nothing too major, but i've not looked at libjxl's code base so Im not sure if there is an aha here or not
excatron
2024-05-20 06:47:58
Thanks for checking it. btw sorry you had to witness these pics, but rather weird food pics than weird feet pics πŸ€·β€β™‚οΈπŸ˜… Alright I just checked further. (All sent over WhatsApp, all standard settings -> lossless) From iOS to iOS I have no problem whatsoever. From Android to iOS the Problem persists. (my initial photo I shared was taken on Android as well and sent to iOS) I can not check Android to Android / iOS to Android. Somehow WhatsApp is crippling these imags but how come it works for iOS to iOS?
monad
2024-05-20 09:46:36
where it's complaining: ```lib/jxl/jpeg/enc_jpeg_data_reader.cc:229: JXL_FAILURE: DHT marker: no Huffman table found lib/jxl/jpeg/enc_jpeg_data.cc:388: JXL_FAILURE: Error reading JPEG lib/jxl/encode.cc:2034: Error during decode of input JPEG```
spider-mario
2024-05-20 10:12:32
might they use arithmetic encoding?
2024-05-20 10:12:42
ah, there’s the zip, I can check
2024-05-20 10:14:26
(actually, I don’t know how to check)
TheBigBadBoy - π™Έπš›
spider-mario (actually, I don’t know how to check)
2024-05-20 10:19:15
if you can't open it with `ffplay` then it's arithmetic <:KekDog:805390049033191445>
2024-05-20 10:19:49
so no, in this case it's not arithmetic
2024-05-20 10:21:27
even `ffmpeg-full-git` with 6+ GB of deps doesn't support JPG arithmetic but even Discord does for some werid reasons
username
2024-05-20 10:30:28
I just use [ExifTool](https://exiftool.org/) to check
jonnyawsom3
monad where it's complaining: ```lib/jxl/jpeg/enc_jpeg_data_reader.cc:229: JXL_FAILURE: DHT marker: no Huffman table found lib/jxl/jpeg/enc_jpeg_data.cc:388: JXL_FAILURE: Error reading JPEG lib/jxl/encode.cc:2034: Error during decode of input JPEG```
2024-05-20 11:38:27
Might be fixed by this, like a few other issues https://github.com/libjxl/libjxl/pull/3503
eddie.zato
2024-05-21 03:21:08
After jpegtran it transcodes just fine: ``` > exiftool -encodingprocess PHOTO-2024-05-18-19-30-05.jpg Encoding Process : Progressive DCT, Huffman coding > cjxl PHOTO-2024-05-18-19-30-05.jpg PHOTO-2024-05-18-19-30-05.jxl JPEG XL encoder v0.10.2 e148959 [AVX2] Note: Implicit-default for JPEG is lossless-transcoding. To silence this message, set --lossless_jpeg=(1|0). Encoding [JPEG, lossless transcode, effort: 7] Error while decoding the JPEG image. It may be corrupt (e.g. truncated) or of an unsupported type (e.g. CMYK). EncodeImageJXL() failed. > jpegtran -optimize -outfile PHOTO-2024-05-18-19-30-05_tran.jpg PHOTO-2024-05-18-19-30-05.jpg > cjxl PHOTO-2024-05-18-19-30-05_tran.jpg PHOTO-2024-05-18-19-30-05.jxl JPEG XL encoder v0.10.2 e148959 [AVX2] Note: Implicit-default for JPEG is lossless-transcoding. To silence this message, set --lossless_jpeg=(1|0). Encoding [JPEG, lossless transcode, effort: 7] Compressed to 97600 bytes including container ```
JendaLinda
2024-05-21 06:50:14
I've also came across a jpeg which cjxl refuses to losslessly compress. No arithmetic coding, no metadata. no trailing data, everything looks just fine. I don't have information about the origin of the file unfortunately. jpegtran fixes the issue though.
Oleksii Matiash
2024-05-21 06:52:49
I also have an issue with jpgs of one kind - panoramas produced by samsung phone πŸ€¦β€β™‚οΈ
2024-05-21 06:53:37
They are opened ok with all viewing software, but cjxl refuses to consume them
JendaLinda
2024-05-21 06:57:00
Perhaps we could create a forum thread "jpegs that won't transcode" Anyway, here's `djpeg -d -v` output for my file.
eddie.zato
2024-05-21 07:41:02
> Perhaps we could create a forum thread "jpegs that won't transcode" Probably this should be a bug report on github with examples of such jpegs.
JendaLinda
2024-05-21 07:56:02
There's a similar forum thread for images, where Modular lossless encoding is inefficient.
monad
Might be fixed by this, like a few other issues https://github.com/libjxl/libjxl/pull/3503
2024-05-21 08:42:39
Different code, but jpegli decodes it fine
Oleksii Matiash
Oleksii Matiash I also have an issue with jpgs of one kind - panoramas produced by samsung phone πŸ€¦β€β™‚οΈ
2024-05-21 08:44:09
eddie.zato
2024-05-21 08:49:27
Great picture. But even jpegtran couldn't fix it. <:SadCat:805389277247701002>
Oleksii Matiash
eddie.zato Great picture. But even jpegtran couldn't fix it. <:SadCat:805389277247701002>
2024-05-21 09:02:03
It's version from normal camera πŸ˜…
monad
Oleksii Matiash
2024-05-21 09:04:09
Well, cjxl communicates clearly the issue with this one
JendaLinda
2024-05-21 09:04:51
I did more tests on my file. `cjxl --allow_jpeg_reconstruction=0` failed `cjxl --lossless_jpeg=0` wokrs, but it's not lossless anymore. `djpegli` failed to decode the file, but can decode it after running it through `jpegtran`.
Oleksii Matiash
2024-05-21 09:12:07
This file has a differnt issue. It contains lot of non-jpeg data at the end of the file, `jpettran` refuses to touch the file.
Oleksii Matiash
JendaLinda This file has a differnt issue. It contains lot of non-jpeg data at the end of the file, `jpettran` refuses to touch the file.
2024-05-21 09:36:58
Yes, I know, that's why these jpegs are still jpegs, not jxls. But all viewers and PS open these files ok
JendaLinda
2024-05-21 09:48:58
Image viewers and editors just look at the jpeg data and ignore the rest of the file. The problem begins if a program is trying to process the entire file.
2024-05-21 10:29:04
I see, your jpeg file has a video file appended to it. After splitting the file to two, the jpeg part still couldn't be losslessly transcoded to jxl. It's apparently missing the "end of image marker" but this can be fixed using jpegtran. So after moving the video to a separate file, the jpeg image can be transcoded to jxl. I don't know how one is supposed to watch the video while it's attached to jpeg. The separate video file can be watched using any video player.
monad
monad Different code, but jpegli decodes it fine
2024-05-21 10:47:03
So, it turns out cjpegli actually uses libjpeg-turbo for decode. jpegli doesn't like DHT length 2, same as libjxl.
2024-05-21 10:47:21
why are there so many different jpeg decoders
2024-05-21 10:56:49
(by 'doesn't like' it just refuses to decode. if you disable that check, both libjxl and jpegli decode fine)
JendaLinda
2024-05-21 10:58:07
Perhaps jpegli is not yet considered to be a reliable decoder. After all, djpegli can't decode my test file as is, but it can be decoded by libjepg without problems.
2024-05-21 10:59:24
And my file doesn't have any funny marker ordering.
monad
2024-05-21 11:01:38
but you should integrate it into your own production software <:Thonk:805904896879493180> https://discord.com/channels/794206087879852103/794206170445119489/1240359173083107470
JendaLinda
2024-05-21 11:03:53
djpegli just fail here... `djpegli 1704206981.arralipskedsy_sandra_jpeg.jpg out.png Read 282576 compressed bytes. jpegli decoding failed`
monad
2024-05-21 11:23:26
so a question for the experts is why is that check there. because libjpeg-turbo doesn't care, nor does libjxl/jpegli really (at least on these concerned files)
Oleksii Matiash
JendaLinda I see, your jpeg file has a video file appended to it. After splitting the file to two, the jpeg part still couldn't be losslessly transcoded to jxl. It's apparently missing the "end of image marker" but this can be fixed using jpegtran. So after moving the video to a separate file, the jpeg image can be transcoded to jxl. I don't know how one is supposed to watch the video while it's attached to jpeg. The separate video file can be watched using any video player.
2024-05-21 11:31:22
Just curious, how did you find start of the video? Exiftools says Surround Shot Video : (Binary data 9492301 bytes, use -b option to extract), but file is a bit too large to scroll it and look for video start by eyes
JendaLinda
Oleksii Matiash Just curious, how did you find start of the video? Exiftools says Surround Shot Video : (Binary data 9492301 bytes, use -b option to extract), but file is a bit too large to scroll it and look for video start by eyes
2024-05-21 11:33:35
djpeg complained about invalid marker, so I searched for it. Good to know Exiftool can extract the video, so it should be able to remove it from the jpeg file as well.
2024-05-21 11:35:21
And perhaps put i back if desired.
Oleksii Matiash
JendaLinda djpeg complained about invalid marker, so I searched for it. Good to know Exiftool can extract the video, so it should be able to remove it from the jpeg file as well.
2024-05-21 11:47:01
Thank you
JendaLinda djpeg complained about invalid marker, so I searched for it. Good to know Exiftool can extract the video, so it should be able to remove it from the jpeg file as well.
2024-05-21 11:54:36
It says this tag is not writable, but maybe it can be done writable
JendaLinda
Oleksii Matiash It says this tag is not writable, but maybe it can be done writable
2024-05-21 12:01:30
This file arrangement is definitely application specific so these files are intended to be viewed using special software. Maybe it's difficult to recreate the arrangement so the special software accepts the file.
jonnyawsom3
2024-05-21 12:21:45
Exiftool refuses to read or write any custom tags/data, only telling you that it exists. You need to manually create a configuration file and then tell it a discription of the tag before it will let you do anything with it, even just copying
Oleksii Matiash
JendaLinda This file arrangement is definitely application specific so these files are intended to be viewed using special software. Maybe it's difficult to recreate the arrangement so the special software accepts the file.
2024-05-21 12:46:07
I'm not aware of such software, and I definitely do not need it. So I'll learn how to create config for exiftool to remove it, and then there will be no .jpg in my \photos πŸ™‚ So thank you very much for this finding about embedded video
JendaLinda I see, your jpeg file has a video file appended to it. After splitting the file to two, the jpeg part still couldn't be losslessly transcoded to jxl. It's apparently missing the "end of image marker" but this can be fixed using jpegtran. So after moving the video to a separate file, the jpeg image can be transcoded to jxl. I don't know how one is supposed to watch the video while it's attached to jpeg. The separate video file can be watched using any video player.
2024-05-22 08:48:30
Could you please explain how exactly did you achieved this? Removing trailing data with exiftool removes this video part from file, but cjxl and jpegtran still refuse to read it
JendaLinda
2024-05-22 08:57:04
I simply sliced the file at the beginning of the video file. I will take a look what Exiftool does.
Oleksii Matiash
JendaLinda I simply sliced the file at the beginning of the video file. I will take a look what Exiftool does.
2024-05-22 08:58:25
I used -trailer:all=
JendaLinda
Oleksii Matiash I used -trailer:all=
2024-05-22 09:09:45
Exiftool seems to leave the video header inside the jpeg. jpegtran complains about `Invalid SOS parameters for sequential JPEG` but produces a fixed file.
Oleksii Matiash
JendaLinda I simply sliced the file at the beginning of the video file. I will take a look what Exiftool does.
2024-05-22 09:10:47
Hmm, that is strange, my jpegtran just shows this error and writes nothing
JendaLinda
2024-05-22 09:11:21
What version of jpegtran are you using?
2024-05-22 09:12:13
My command line is `jpegtran -copy all -optimize in.jpg out.jpg`
2024-05-22 09:15:55
IrfanView can fix the file after Exiftool. Irfanview has lossless JPEG transformations based on jpegtran.
2024-05-22 09:16:32
Efficient-Compression-Tool works as well.
Oleksii Matiash
JendaLinda My command line is `jpegtran -copy all -optimize in.jpg out.jpg`
2024-05-22 09:16:59
I tried two: version 9f 14-Jan-2024 and version 9a 19-Jan-2014
JendaLinda IrfanView can fix the file after Exiftool. Irfanview has lossless JPEG transformations based on jpegtran.
2024-05-22 09:17:26
No 😦
JendaLinda
2024-05-22 09:19:09
I t works after Exiftool removes the trailer.
Oleksii Matiash
2024-05-22 09:19:45
Yes, I mean the same. This file is after exiftool -trailer:all=
JendaLinda
2024-05-22 09:20:54
Interesting, it worked for me.
2024-05-22 09:21:20
Try ECT, it uses jpegtran from Mozilla.
Oleksii Matiash
2024-05-22 09:21:29
JendaLinda
2024-05-22 09:23:30
Ah so this one doesn't work.
Oleksii Matiash
JendaLinda Ah so this one doesn't work.
2024-05-22 09:25:19
F:\temp\photo>ect 20180313_090517-t.jpg 20180313_090517-t.jpg: Invalid SOS parameters for sequential JPEG 20180313_090517-t.jpg: Unsupported marker type 0x76
JendaLinda
2024-05-22 09:27:48
Exiftool doesn't remove everything, so there are some data left that sometimes upset jpegtran. I think this is something to bugreport at Exiftool.
Oleksii Matiash
2024-05-22 09:29:23
I'm not familiar with jpeg internals, so I'd be happy if someone who is explained a bit more what is that SOS parameter, and is it possible to fix it at all
JendaLinda
2024-05-22 09:31:51
SOS parameter is not the problem, jpegtran will fix that. The problem is the unsupported marker. jpegtran is trying to interpret random data as jpeg data.
2024-05-22 09:36:21
If you can use hex editor, you can manually delete the rest. Search for Motion_Panorama text and delete it and everything that follows.
Oleksii Matiash
JendaLinda If you can use hex editor, you can manually delete the rest. Search for Motion_Panorama text and delete it and everything that follows.
2024-05-22 09:43:56
Finally it worked! Thank you!
2024-05-22 10:14:56
Small python script, and all these panos are jxls now <:Hypers:808826266060193874>
vtorri
2024-05-23 05:59:21
hello
2024-05-23 06:00:56
is the 1.0 version of libjxl planned ?
_wb_
2024-05-23 07:50:24
planned as in: we know what we still want to get done before releasing it (basically https://github.com/libjxl/libjxl/labels/v1.0) not planned in the sense of having a deadline date for the 1.0 release
spider-mario
2024-05-23 08:06:59
before Christmas (but we don’t know which year)
yoochan
2024-05-23 08:43:55
like perl6
Demiurge
2024-05-23 12:09:11
You know what would be a killer feature? If lossy transcoding of jpeg input never bloated the file size by decoding to pixels.
2024-05-23 12:10:16
Like jpegdropscan
2024-05-23 12:10:49
So by default it should never increase the filesize when doing lossy. That would be a killer feature and great behavior
2024-05-23 12:11:29
https://github.com/MegaByte/jpegultrascan
2024-05-23 12:16:37
I see it was Jyrki's suggestion to create a recompressor that uses butteraugli to determine what to drop
2024-05-23 12:16:51
https://encode.su/threads/2489-jpegultrascan-an-exhaustive-JPEG-scan-optimizer?s=5eab706bdd6e826364ce7c0769b6952a&p=47959&viewfull=1#post47959
vtorri
2024-05-23 01:59:35
<@794205442175402004> thank you
Demiurge
2024-05-25 11:42:29
Speaking of bloating the filesize, it would be cool if the tools printed a warning or confirmation when producing a file larger than the input size. As well as a way for the library to detect when an image would be smaller in lossless mode instead of vardct
2024-05-25 07:45:13
https://github.com/libjxl/libjxl/issues/3512 I would just like to confirm, I just ran a test on my iphone, which renders xyb jpegs incorrectly, but after writing the app14 marker, my iphone renders the image correctly no problem in all apps
2024-05-25 07:46:44
According to libjpeg documentation, app0 marker should be written for grayscale and ycbcr images only, and app14 for other color spaces.
2024-05-25 07:49:57
So current jpegli behavior is writing the wrong header file, and that's the main reason behind the rendering issues. Otherwise they would be supported perfectly fine.
afed
2024-05-25 07:59:31
it's not wrong, quite the opposite, it's fully compliant with the open standard, and app14 is some proprietary metadata from adobe, just for some reason app14 has better compatibility (because older? or because images edited in adobe sw are pretty common?)
2024-05-25 08:05:29
but at least having an option for a different marker would be nice, because it's already supported in libjpeg* and other libs
Demiurge
2024-05-25 08:17:33
According to libjpeg documentation: ``` boolean write_JFIF_header If TRUE, a JFIF APP0 marker is emitted. jpeg_set_defaults() and jpeg_set_colorspace() set this TRUE if a JFIF-legal JPEG color space (ie, YCbCr or grayscale) is selected, otherwise FALSE. ```
2024-05-25 08:18:34
``` boolean write_Adobe_marker If TRUE, an Adobe APP14 marker is emitted. jpeg_set_defaults() and jpeg_set_colorspace() set this TRUE if JPEG color space RGB, CMYK, or YCCK is selected, otherwise FALSE. It is generally a bad idea to set both write_JFIF_header and write_Adobe_marker. In fact, you probably shouldn't change the default settings at all --- the default behavior ensures that the JPEG file's color space can be recognized by the decoder. ```
2024-05-25 08:19:56
So, it looks like jpegli is not fully compliant since XYB JPEG is an RGB JPEG, which is not a JFIF-legal color space and therefore, according to libjpeg's own documentation should be handled with an app14 marker instead
2024-05-25 08:23:20
I'm not familiar with the data structure but the libjpeg api automatically writes the app14 marker by default for RGB JPEGs so it can't be that obscure or proprietary, any more than RGB JPEG is at least.
afed
2024-05-25 08:33:22
seems like jpegli requires colour management through iccv4 for xyb, but if it works with app14 then that's also another possible solution though I'm not sure how correct it would be and how properly displaying colors
Demiurge
2024-05-25 08:33:46
More relevant quotes: ``` By default, the IJG compression library will write a JFIF APP0 marker if the selected JPEG colorspace is grayscale or YCbCr, or an Adobe APP14 marker if the selected colorspace is RGB, CMYK, or YCCK. You can disable this, but we don't recommend it. The decompression library will recognize JFIF and Adobe markers and will set the JPEG colorspace properly when one is found. ... If you override the default APP0 or APP14 processors, it is up to you to recognize JFIF and Adobe markers if you want colorspace recognition to occur properly. We recommend copying and extending the default processors if you want to do that. (A better idea is to save these marker types for later examination by calling jpeg_save_markers(); that method doesn't interfere with the library's own processing of these markers.) ```
afed seems like jpegli requires colour management through iccv4 for xyb, but if it works with app14 then that's also another possible solution though I'm not sure how correct it would be and how properly displaying colors
2024-05-25 08:34:16
Well, that's a separate issue
2024-05-25 08:34:44
It's an RGB JPEG with a color profile.
2024-05-25 08:34:52
That's a pretty normal and common thing
2024-05-25 08:34:59
That's all that it is
2024-05-25 08:35:14
But RGB JPEGs need to have an APP14 marker
2024-05-25 08:36:14
Then the color profile will be properly interpreted by a lot more software, such as my iphone for example.
2024-05-25 08:38:15
Right now I just did a test with my iphone. The colors are totally whacky when displaying the output of cjpegli. But, after fixing it with jpegultrascan, which adds the missing app14 marker, my iphone is able to display it perfectly fine
2024-05-25 08:39:56
https://cdn.discordapp.com/attachments/794206087879852106/1235735007377490051/image0.jpg
2024-05-25 08:40:23
This is how the iphone reacts to the missing app14 marker
afed
2024-05-25 08:42:53
hmm, yeah, I checked and without iccv4 it still doesn't work, so it only fixes apps who basically don't follow the standard and use some custom adobe marker
2024-05-25 08:48:35
so it's basically breaking the standard and keep writing the wrong non-standard marker for apps that don't have the proper support
Demiurge
2024-05-25 09:02:11
Hmm, really... Because what I'm reading from the libjpeg sources, an RGB JPEG is not JFIF and should not have an app0 JFIF marker, only an app14 adobe marker.
2024-05-25 09:03:50
For maximum compatibility there should be no app0 marker
2024-05-25 09:04:18
jpegultrascan only adds an app14 marker but doesn't remove the app0 marker, unfortunately.
2024-05-25 09:04:46
But even that is enough to fix the rendering problems with Apple software.
2024-05-25 09:05:17
Also the exact data structure of the app0 and app14 markers are in the libjpeg source code
2024-05-25 09:05:25
https://github.com/libjpeg-turbo/libjpeg-turbo/blob/main/jcmarker.c
2024-05-25 09:06:04
They're both only a few bytes and very simple.
2024-05-25 10:25:17
Hmm, minor correction. There is no app0 JFIF marker in cjpegli output. But there is app1 exif marker
2024-05-25 10:25:35
So there is no need to remove the app0 marker since it's not there
afed hmm, yeah, I checked and without iccv4 it still doesn't work, so it only fixes apps who basically don't follow the standard and use some custom adobe marker
2024-05-26 12:19:37
https://www.itu.int/rec/T-REC-T.872-201206-I/en Section 6.1: > Images encoded with three components are assumed to be RGB data encoded as YCbCr unless the image > contains an APP 14 marker segment as specified in 6.5.3, in which case the colour encoding is considered > either RGB or YCbCr according to the application data of the APP14 marker segment. The relationship > between RGB and YCbCr is defined as specified in Rec. ITU-T T.871 | ISO/IEC 10918-5.
2024-05-26 12:20:24
In other words, Apple is in compliance by assuming that 3-channel JPEG without an APP14 segment is YCbCr
2024-05-26 12:22:25
the app14 segment is required, according to this. In order to specify that there was no color transform applied.
afed
2024-05-26 12:34:32
<:Thonk:805904896879493180> https://exiftool.org/TagNames/JPEG.html
Demiurge
2024-05-26 12:42:30
https://exiftool.org/TagNames/JPEG.html#Adobe
2024-05-26 12:45:30
So basically... You're supposed to assume all 3-channel JPEG, contains RGB data with a YCbCr color transform applied... unless there's an APP14 marker.
2024-05-26 12:47:37
So Apple mangling the colors is the correct behavior from Apple correctly assuming an unmarked 3-channel JPEG is YCbCr-encoded
2024-05-26 08:46:45
Come to think of it, how do some apps know not to apply the ycbcr transform? Something in the app1 or app2 markers?
TheBigBadBoy - π™Έπš›
Demiurge https://github.com/libjxl/libjxl/issues/3512 I would just like to confirm, I just ran a test on my iphone, which renders xyb jpegs incorrectly, but after writing the app14 marker, my iphone renders the image correctly no problem in all apps
2024-05-26 08:51:53
could your sample with and without APP14 pls ?
Demiurge
2024-05-26 09:06:49
Do you want me to upload an example image before and after adding the app14 marker?
username
2024-05-26 09:32:57
hey uh there's an issue with jpegli (actually multiple).. the default for jpegli is to output YUV as 4:4:4 and for XYB to output as 4:2:0 at all quality levels all the time always unless a chroma subsampling value is manually defined and this is a problem because JPEG XL can only transcode XYB JPEGs that are 4:4:4
2024-05-26 09:33:47
another issue is for XYB JPEGs the colors are way different between the default 4:2:0 and the manually defined 4:2:0
2024-05-26 09:34:22
pretty strange behavior overall that doesn't really make much sense
2024-05-26 09:35:31
if I where to file an issue on GitHub should these be separate or in the same issue post?
TheBigBadBoy - π™Έπš›
Demiurge Do you want me to upload an example image before and after adding the app14 marker?
2024-05-26 09:43:58
yep please
2024-05-26 09:44:40
oh wait
Demiurge
2024-05-26 09:44:43
Unfortunately I don't know of any software that can reliably embed the app14 marker. jpegultrascan only does it if it can make the image smaller :(
TheBigBadBoy - π™Έπš›
2024-05-26 09:44:56
Demiurge Unfortunately I don't know of any software that can reliably embed the app14 marker. jpegultrascan only does it if it can make the image smaller :(
2024-05-26 09:45:18
yeah that's what I was going to say lol
2024-05-26 09:46:02
so you tested with another image in jpegultrascan and it did add an APP14 ? Nice <:FeelsReadingMan:808827102278451241>
Demiurge
2024-05-26 09:53:59
Yes, when it manages to shrink the image
2024-05-26 10:00:00
ok, I managed to shrink the image lol. It took a long time of optimizing
2024-05-26 10:00:17
Behold, the difference.
2024-05-26 10:01:05
On my iphone, one of them is a normal image... the other is blue.
username another issue is for XYB JPEGs the colors are way different between the default 4:2:0 and the manually defined 4:2:0
2024-05-26 10:03:02
Which one looks better?
Oleksii Matiash
Demiurge On my iphone, one of them is a normal image... the other is blue.
2024-05-26 10:07:00
Looks identical, Windows, FF. Also identical in IrfanView and FastStone
Demiurge
2024-05-26 10:11:25
A lot of software displays them identical despite the missing app14 marker. But then, I wonder how it knows not to use ycbcr...
2024-05-26 10:21:11
It's definitely not identical on iOS
2024-05-26 10:23:05
According to the bug report it's also broken on macOS safari and Finder as well as Photoshop
2024-05-26 10:23:11
https://github.com/libjxl/libjxl/issues/3512
Oleksii Matiash
Demiurge Behold, the difference.
2024-05-26 10:25:00
Telegram desktop generates wrong preview from these links, but Telegram Android works correct. Also FF Android works correct. Photoshop opens both files correct
Demiurge
Oleksii Matiash Telegram desktop generates wrong preview from these links, but Telegram Android works correct. Also FF Android works correct. Photoshop opens both files correct
2024-05-26 10:25:48
Is there any difference between the two?
Oleksii Matiash
2024-05-26 10:25:52
No
Demiurge
2024-05-26 10:26:41
Most software seems to behave the same with or without app14 then
2024-05-26 10:26:53
Unless you're on Apple
Oleksii Matiash
2024-05-26 10:28:13
Telegram desktop shows them like without color management (keep in mind that it is "AdobeRGB as sRGB", in reality it is much more 'acid')
A homosapien
username if I where to file an issue on GitHub should these be separate or in the same issue post?
2024-05-26 10:12:29
https://github.com/libjxl/libjxl/issues/3605
username
A homosapien https://github.com/libjxl/libjxl/issues/3605
2024-05-26 10:19:04
it seems like the piece of code causing the default to be 4:2:0 is here: https://github.com/libjxl/libjxl/blob/45e688cb6df41203a29e9f9d8fa946f34ba171cd/lib/extras/enc/jpegli.cc#L457
2024-05-26 10:34:36
yeah this should really be changed, especially since the current behavior causes JXL transcoding to fail
Demiurge
2024-05-26 11:02:11
Yeah, pretty weird how the default for ycbcr is 4:4:4 but for xyb it's 4:2:0
2024-05-26 11:16:25
Literally all anyone has to do is remove the exclamation mark in front of the check for XYB. Or replace it with something like `jpeg_settings.xyb || jpeg_settings.quality > 75` for example
2024-05-26 11:19:11
Actually, it might be a good idea to move the `jpeg_settings.xyb` check, and override the chroma subsampling settings regardless of what the user chooses.
2024-05-26 11:19:43
to prevent xyb from being used with chroma ss
Traneptora
TheBigBadBoy - π™Έπš› even `ffmpeg-full-git` with 6+ GB of deps doesn't support JPG arithmetic but even Discord does for some werid reasons
2024-05-27 02:32:29
nothing to do with dependencies. there's one jpeg decoder in ffmpeg and it's the builtin one
qdwang
2024-05-27 12:41:01
It's a little bit weird, I tried to get `jpegli-static.a` with the flag `-D JPEGXL_ENABLE_JPEGLI=ON`, but it didn't work. Only turning `JPEGXL_ENABLE_TOOLS` to `ON` can produce the jpegli static lib. Is it normal? (Building with 0.10.2)
TheBigBadBoy - π™Έπš›
Demiurge Behold, the difference.
2024-05-27 04:16:44
thanks <3 perhaps we should add it to the github issue so other people can see the difference ?
Demiurge
2024-05-27 04:56:25
https://github.com/libjxl/libjxl/issues/3512
TheBigBadBoy - π™Έπš›
Demiurge https://github.com/libjxl/libjxl/issues/3512
2024-05-27 06:51:51
should I add the above pics ?
JendaLinda
2024-05-27 08:10:31
Programs can identify RGB encoded jpegs without Adobe marker by looking at the tags of the channels. YcbCr has channels tagged as 1, 2 and 3, RGB has channels tagged as ASCII R, G and B.
2024-05-27 08:15:59
But apparently inclusion of the Adobe tag improves reliability.
Demiurge
JendaLinda Programs can identify RGB encoded jpegs without Adobe marker by looking at the tags of the channels. YcbCr has channels tagged as 1, 2 and 3, RGB has channels tagged as ASCII R, G and B.
2024-05-27 09:22:35
I couldn't find this convention documented anywhere, but it would have been nice to know.
TheBigBadBoy - π™Έπš› should I add the above pics ?
2024-05-27 09:24:02
Hmm... Up to you, if you think it would help. Best thing would be a patch or pull request...
TheBigBadBoy - π™Έπš›
2024-05-27 09:27:27
If I was more used to edit other's code why not, but unfortunately it's not my case
Waterpicker
2024-05-27 09:43:41
So I'm seeing that libjxl has jni wrappers. I'm however having an issue. I'm not sure how to add libjxl into gradle.build to actually use the library in java via that JNI wrapper
JendaLinda
Demiurge I couldn't find this convention documented anywhere, but it would have been nice to know.
2024-05-27 09:50:51
The only description I could find is this from Java documentation. https://docs.oracle.com/javase/8/docs/api/javax/imageio/metadata/doc-files/jpeg_metadata.html
Demiurge
2024-05-27 10:04:17
Thanks, that's cool. Looks like it only uses the channel ID if no app0 or app14 markers are present. And it also assumes that non-subsampled 3-channel imagea are RGB.
2024-05-27 10:05:19
Even though app14 is a vendor specific "Adobe" tag, it has become a standardized part of RGB JPEG
2024-05-27 10:05:37
Since JFIF didn't support RGB
2024-05-27 10:06:44
And it looks like nearly all jpeg decoders look for the app14 tag
2024-05-27 10:07:05
And use it to determine how to display the resulting image
It's a little bit weird, I tried to get `jpegli-static.a` with the flag `-D JPEGXL_ENABLE_JPEGLI=ON`, but it didn't work. Only turning `JPEGXL_ENABLE_TOOLS` to `ON` can produce the jpegli static lib. Is it normal? (Building with 0.10.2)
2024-05-27 10:08:15
Doesn't sound intentional
Waterpicker So I'm seeing that libjxl has jni wrappers. I'm however having an issue. I'm not sure how to add libjxl into gradle.build to actually use the library in java via that JNI wrapper
2024-05-27 10:08:57
I am not familiar with gradle but first place I would look is other software that implements jxl decoding in Java on android.
2024-05-27 10:10:23
https://github.com/awxkee/jxl-coder
Waterpicker
2024-05-27 10:14:56
RGBA_8888, RGBA_F16, RGBA_1010102, RGB_565 Question what exactly do these translate in opengl usable terms?
2024-05-27 10:15:32
nvm. What I need is RGBA_8888 just was confusing to parse.
2024-05-27 10:19:07
Incase you want context. I'm a mod developer working on a mod where we are using jxl as a way to store the massive amount of textures we have into a smaller footprint so the mod in question can fit into the size limit of modrinth one of the two main options for posting minecraft mods onlien.
2024-05-27 10:19:22
online
2024-05-27 10:19:51
Already use jxlatte but is a bit sluggish so native option. Hence my question here.
JendaLinda
Demiurge Thanks, that's cool. Looks like it only uses the channel ID if no app0 or app14 markers are present. And it also assumes that non-subsampled 3-channel imagea are RGB.
2024-05-27 10:22:17
I suppose the assumption is the last resort if neither of number or ASCII IDs match.
username
Waterpicker Already use jxlatte but is a bit sluggish so native option. Hence my question here.
2024-05-28 12:06:36
I'm not sure of the size requirements on Modrinth nor what the size of all your textures are however wouldn't doing a native option mean the jar/mod would have to contain multiple different compiles of libjxl causing the mod's size to bloat a bit? each compile would be around 4 or 2 MB which times the number of different platforms and architectures would assumedly add up and also make the mod less portable. I know there are some mods that get away with including native binaries like the Physics mod and older versions of that one mod that allows Lua programming (forgot it's name) so maybe from the portability angle it doesn't matter much for your use cases.
2024-05-28 12:08:57
I do wanna note that the dev of Jxlatte is in this server however they have stated they don't have much free time to work on it
Waterpicker
2024-05-28 12:09:54
I need to sleep right now but I can give more detail on my situation once I wake up.
username I do wanna note that the dev of Jxlatte is in this server however they have stated they don't have much free time to work on it
2024-05-28 01:55:46
So I had various issues that made me wake up so Here I go. I'm one of the developers of the mod Generations which is a addon for the mod Cobblemon. Our biggest feature is is an instance rendering based renderer. The model loading process from what my boss and I can tell is texture loading.
2024-05-28 01:57:58
https://github.com/GenerationsMod/RareCandy/blob/legacy/src/main/java/gg/generations/rarecandy/renderer/loading/Texture.java#L74
2024-05-28 02:00:02
So there is a another issue with purely jxlatte. Opengl is is RGBA while bufferImages are stored as a RGB.
2024-05-28 02:10:08
And yes what looks like an extra step of preprocessing is needed.
2024-05-28 02:10:37
In the current method I posted the link to. I just double checked.
2024-05-28 02:33:46
I should add context that Cobblemon is newer of the minecraft mod's the adds pokemon to minecraft. By itself, it uses blocky models. There are API hooks to add additional rendering options. One of Generations features is adding the ability to load fully meshed models. We package alot models with the mod and it gets alot very quickly. One of the solutions to keep things small was the adoption of jxl. ALso a bit of a implmentation detail when it comes to minecraft itself. Minecraft uses stbimage to load pngs. I'm effectively looking for what jxl's equivlent is. Hence the looking for JNI of libjxl or equivlent.
2024-05-28 02:35:56
Preloading all thsoe models and textures can get a wee bit taxing...I also had to learn computer graphics better after the tax of getting system fully operational got tossed soley on me. ><
Demiurge
2024-05-28 09:23:39
jxlatte looks pretty well written. It also supports all features except animation.
2024-05-28 09:25:14
theoretically Java should be able to achieve the same speed as C
2024-05-28 09:26:51
Just requires profiling and optimizing
Waterpicker
2024-05-28 10:35:37
O
Demiurge jxlatte looks pretty well written. It also supports all features except animation.
2024-05-28 10:36:15
I'm fearing that I'm just reaching the limit of speed for how we are doing things.
2024-05-28 10:36:49
A more optimized version would be a direct RGBA.
2024-05-28 10:38:25
well direct ByteBuffer. I agree thought jxlatte is quite nice. Just have an exact use case where its output is a tinge indirect.
2024-05-28 10:39:07
Actually now that I'm thinking about it. Are there any other java programs that are trying to directly upload the image data of a jxl into the gpu?
Demiurge
2024-05-28 11:04:14
Sounds like a novel use case
2024-05-28 11:04:43
Can't your problem be solved by using RGBA jpegxl?
2024-05-28 11:36:32
Encode the images as 4 channel rgba so they can be decoded as rgba
2024-05-28 11:36:43
Encode them in the same format you want them decoded in
Waterpicker
Demiurge Encode them in the same format you want them decoded in
2024-05-28 11:51:54
BufferedImages are ARGB? And last I checked jxlatte doesn't out direclty into raw byte buffer.
Demiurge
2024-05-28 11:57:58
Sorry, I might have misunderstood the problem
2024-05-28 11:59:36
Java recently got some SIMD features though, which would be crucial to optimize the conversion between pixel formats
Waterpicker
2024-05-29 12:34:58
Java 21 right?
2024-05-29 12:35:33
Vector api
Demiurge Java recently got some SIMD features though, which would be crucial to optimize the conversion between pixel formats
2024-05-29 01:31:21
Or even the decoding process itself?
Demiurge
2024-05-29 01:36:05
It can accelerate most data processing pipelines
2024-05-29 02:34:28
Idk if jxlatte uses the simd api
2024-05-29 02:34:59
But it could definitely accelerate jxl. The c++ library uses libhwy
Waterpicker
2024-05-30 12:08:20
<@1028567873007927297> I have begun to understand teh vector api. Its actually a bit fun.
jonnyawsom3
Demiurge Speaking of bloating the filesize, it would be cool if the tools printed a warning or confirmation when producing a file larger than the input size. As well as a way for the library to detect when an image would be smaller in lossless mode instead of vardct
2024-05-30 02:04:35
https://github.com/libjxl/libjxl/pull/1395
Waterpicker Incase you want context. I'm a mod developer working on a mod where we are using jxl as a way to store the massive amount of textures we have into a smaller footprint so the mod in question can fit into the size limit of modrinth one of the two main options for posting minecraft mods onlien.
2024-05-30 02:35:05
I was hoping someone would eventually do this, I look forward to seeing your progress
Waterpicker
I was hoping someone would eventually do this, I look forward to seeing your progress
2024-05-30 02:41:09
Ah modded minecraft implemetnation?
2024-05-30 02:41:46
usage
jonnyawsom3
2024-05-30 02:42:12
Yeah, JXL in a mod to lower sizes
Waterpicker
2024-05-30 02:43:58
I'm considering asking for Generations to be added to adoption page after we properly release since it seems its for any project implmenting jxl!
username
2024-05-30 02:45:26
hey btw your issue on the jxlatte repo got a response if you haven't seen yet https://github.com/Traneptora/jxlatte/issues/31#issuecomment-2138440178
Demiurge
https://github.com/libjxl/libjxl/pull/1395
2024-05-30 03:11:59
I wonder how this would compare, performance and compression wise, to some form of spline detection, or layer separation.
2024-05-30 03:15:09
Ideally the encoder should be able to detect when vardct would inflate the file size and only use vardct when and where it performs well
2024-05-30 03:16:13
I think a good start would be to make lossless mode the default unless specified otherwise, for all file types and not just gif and jpeg
Traneptora
Demiurge Idk if jxlatte uses the simd api
2024-05-30 03:39:00
it's pure Java, so no
2024-05-30 03:39:27
you can use `Math.fma` for some things but if the system doesn't have fma instructions it runs horribly slowly
2024-05-30 03:39:35
and there's no easy way to query that
2024-05-30 03:40:15
unless you mean some super recent stuff
Demiurge
2024-05-30 03:41:52
java.util.vector
2024-05-30 03:42:03
Java 17
Traneptora
Demiurge java.util.vector
2024-05-30 03:42:53
? `java.util.Vector` was in jdk 1.0
2024-05-30 03:42:55
and it's a list element
Demiurge
2024-05-30 03:46:27
I must have gotten wrong information then. I'm not a java developer but I know that they recently added a simd api to java
Traneptora
2024-05-30 03:46:51
looks like it's jdk.incubator.vector
2024-05-30 03:46:56
which will be removed
2024-05-30 03:46:59
as it's a preview feature
2024-05-30 03:47:05
possibly ported to main java
jonnyawsom3
Demiurge I wonder how this would compare, performance and compression wise, to some form of spline detection, or layer separation.
2024-05-30 03:49:08
Technically the patches *are* layer separation
Demiurge
2024-05-30 03:50:49
Yes, patches are technically layers... but I mean separating and detecting different types of signals rather than repeated signals
2024-05-30 03:52:07
https://openjdk.org/jeps/417
2024-05-30 03:54:24
https://docs.oracle.com/en/java/javase/17/docs/api/jdk.incubator.vector/jdk/incubator/vector/Vector.html
2024-05-30 03:58:25
I guess this is the latest version of it? https://openjdk.org/jeps/460
2024-05-31 12:32:46
https://github.com/hyvanmielenpelit/GnollHack/wiki/Starting-Guide-for-NetHack-Veterans The PNG image here is larger when using e=9 d=0 compared to using e=8
2024-05-31 12:33:15
Specifically, the image of the gnoll holding the book.
2024-05-31 12:33:27
2024-05-31 12:34:40
e=2 is also larger than e=1 but idk if that's really a big deal compared to 8 and 9
2024-05-31 12:35:39
e=4 is also bigger than e=3
2024-05-31 12:37:30
I thought I would do some tests on this image since it's small cute and silly :)
2024-05-31 12:46:09
Also in lossy mode, d=2 for example, the color of the book radically changes.
2024-05-31 12:46:25
To a lesser extent so does her eyes.
2024-05-31 12:46:44
But the change in the color of the book is easy to notice from a distance.
Waterpicker
Traneptora as it's a preview feature
2024-05-31 12:51:28
I just got the vector api to fully behave. Gonna plug it into the renderer I'm doing this for and try benchmarks. The inititial tests I did before look promising.
Demiurge
2024-05-31 01:04:49
Pretty sure this is the same bug that's causing the factory leaves to lose their color.
Waterpicker I just got the vector api to fully behave. Gonna plug it into the renderer I'm doing this for and try benchmarks. The inititial tests I did before look promising.
2024-05-31 01:05:23
Yeah, I didn't realize it's still in incubation after being added in 16 or 17 and we're already on Java 22
Waterpicker
2024-05-31 01:06:33
From what I read, it's waiting on project valhalla.
Demiurge
2024-05-31 01:07:13
2024-05-31 01:07:32
Look how dull that book became
Waterpicker
2024-05-31 01:07:43
I assume the ability to define SIMD operations for value types.
Demiurge
2024-05-31 01:08:39
It changed color, from a golden amber to a washed out sepia parchment color
2024-05-31 01:08:57
The whole entire book
2024-05-31 01:09:10
Not just a few small pixels
2024-05-31 04:22:09
`--container=0` does not force not using the container format?
2024-05-31 04:22:31
Is there a way to throw away all extraneous data that isn't necessary for decoding the image data?
yoochan
Demiurge It changed color, from a golden amber to a washed out sepia parchment color
2024-05-31 07:10:58
I see many issues with this image but none concerning the colors ... you are an amazing yellow issue spotter
Demiurge
2024-05-31 07:11:33
Maybe it's my special talent of having defective M cones
username
2024-05-31 08:22:39
I mean, I see it as well
2024-05-31 08:24:41
the parts where it's especially noticeable are the eyes, rimlighting/light-highlights on hair and nose, and the title/text on the book
Demiurge
2024-05-31 08:38:51
When you have defective M cones, there is a lot of overlap between the L and M cones, which corresponds to yellow.
2024-05-31 08:40:00
So maybe that's why
2024-05-31 08:40:15
I can see it in the eyes too, but I think the book is bigger and more obvious
_wb_
2024-05-31 09:03:41
There are plenty of artifacts I can see in the d2 image, in particular the fur and the shiny metal looks blurry. To me, these artifacts are worse than the color changes. If we would change the luma/chroma balance to improve the colors, it would make the blur worse...
2024-05-31 09:05:57
It could possibly be a good idea though to have some encoder option to adjust the luma/chroma balance manually (and maybe also the DC/AC balance).
Demiurge
2024-05-31 09:15:17
I think large objects becoming a different color is easier to spot from a distance than some pixels getting blurry. Although, again, I would prefer hf noise over blur
2024-05-31 09:17:02
Obvious smears look more upsetting to human eyes, compared to "natural" looking noise
A homosapien
2024-05-31 10:58:59
That's why I prefer the look of 0.8 for Tf2 screenshots, even at the expense of accurate colors. The sharper image was just more pleasing to the eyes
2024-05-31 11:01:49
I mean, I have a soft spot for jpeg-like compression. I love the sharpness it retains despite the horrible mosquito noise.
Oleksii Matiash
2024-05-31 12:09:03
That's why I just ended up with storing game screenshots as lossless
Demiurge
2024-05-31 05:37:22
I really like the speed of lossless mode at e=3 and below
2024-05-31 05:37:28
It's near instant
2024-05-31 05:37:33
And decent compression too
2024-05-31 05:37:51
I really think e=7 is too slow in lossless mode
2024-05-31 05:38:14
Especially if you have a large image
2024-05-31 05:38:37
Having near-instant compression that still beats other lossless formats, is awesome.
2024-05-31 05:39:26
PNG is way too slow by comparison, when e=3 JXL is close to instant
_wb_
2024-05-31 07:45:30
Probably we should make an e4 that just tries e2 and e3 for every group and picks the best of the two.
spider-mario
2024-05-31 08:35:47
does e2 sometimes do significantly better?
2024-05-31 08:37:15
depending on e4’s, e3’s and e2’s current speeds, there might be an argument to be made that a new e3 should be that combination and never just β€œcurrent e3”
_wb_
2024-06-01 05:03:01
Yes, it does happen that e3 is worse than e2 and that is something we should probably avoid.
monad
2024-06-01 06:02:11
Waterpicker
2024-06-01 07:46:12
<@853026420792360980> I need your help. I ultimately took your advice and did float directly. It works but everything seems dark and transparency outright isn't working. https://github.com/GenerationsMod/RareCandy/blob/f27daa6bc3ad1255a08ed28defae9926680b0724/src/main/java/gg/generations/rarecandy/renderer/loading/Texture.java#L112 This is how I'm parsing the raw float buffer like what you suggest in the issue I posted awhile ago. I'm not sure what I'm doing wrong.
Traneptora
Waterpicker <@853026420792360980> I need your help. I ultimately took your advice and did float directly. It works but everything seems dark and transparency outright isn't working. https://github.com/GenerationsMod/RareCandy/blob/f27daa6bc3ad1255a08ed28defae9926680b0724/src/main/java/gg/generations/rarecandy/renderer/loading/Texture.java#L112 This is how I'm parsing the raw float buffer like what you suggest in the issue I posted awhile ago. I'm not sure what I'm doing wrong.
2024-06-01 01:43:55
Probably you're not turning it into sRGB first
2024-06-01 01:44:11
jxlatte decodes an XYB image into linear
jonnyawsom3
2024-06-01 01:51:02
I think that could be fixed encoder side rather than decode, right? Assuming they want to keep it as light as possible
Waterpicker
Traneptora Probably you're not turning it into sRGB first
2024-06-01 02:09:45
So how would I do that?
Traneptora
Waterpicker So how would I do that?
2024-06-01 02:14:07
two ways, one is to call JXLInage.transform, the other is to draw the buffed image on an sRGB image
Waterpicker
Traneptora two ways, one is to call JXLInage.transform, the other is to draw the buffed image on an sRGB image
2024-06-01 02:19:36
For the former what's recommended?
Traneptora
Waterpicker For the former what's recommended?
2024-06-01 02:27:11
wdym?
Waterpicker
2024-06-01 02:27:49
Both. JXLImage.transform have parameters
Traneptora
Waterpicker Both. JXLImage.transform have parameters
2024-06-01 02:30:59
it takes the colorspace as an argument. the int constants are in ColorFlags
2024-06-01 02:33:28
for sRGB, you want BT709 primaries, D65 white point, and SRGB transfer
Waterpicker
2024-06-02 02:00:20
Hey <@853026420792360980> It took me a while to get back to this but I have a question. Does this way of doing things merge the channels together?
2024-06-02 02:01:29
Eh I don't think I described it well. There is a rendering techinque involved layered masks that gamefreak uses in legends arceus, and the scarlet and violet game including its dlc that we replicate in Rare Candy.
2024-06-02 02:02:23
Each channel of a certain texture being a channel used to color certain areas of a base texture.
2024-06-02 02:03:47
For whatever reason when when I try the code I showed earlier today It goes pure white and when even I test the textures by themselves... Eh let me take screen shots. I rigged a frankenstein setup to see all four channels at once
2024-06-02 02:04:54
First one. I ignore the texture quality. ALot of textures got corrupted durign the mass conversion to jxl my boss did a bit ago.
2024-06-02 02:07:07
That's the original method involving copying the JXLatte derived BufferedImage data to a normal BufferedImage
Traneptora
2024-06-02 02:07:45
I can't possibly help you debug without seeing your code, but let's move to <#1042307875898408960>
Waterpicker
2024-06-02 02:08:09
Alrighty.
JendaLinda
2024-06-02 06:29:20
It seems cjxl is going to be supporting PAM images with multiple extra channels. I wonder if it will be possible to encode CMYK images this way.
Demiurge
2024-06-02 08:28:33
You can always encode cmyk images with jxl. Just not jpegs in lossless mode
JendaLinda
2024-06-02 08:53:16
And how do you serve pixels in CMYK format to cjxl?
_wb_
2024-06-03 09:00:26
In jxl, CMY is encoded in the RGB channels. So for CMYK you can make a PAM file with a header ``` TUPLTYPE RGB TUPLTYPE Black ``` and then you also need to add `-x icc_pathname=SOME_CMYK_PROFILE.ICC` since PAM cannot store ICC profiles and in jxl, an ICC profile is obligatory for CMYK images.
2024-06-03 09:02:32
The sample values follow the (Adobe) convention that 0=full ink, maxval=no ink, which makes it make more sense to encode CMY as RGB (all-zeroes is still black, all-maxvals is still white).
Kleis Auke
Kleis Auke So, only `AVX2` and `SSE2` are attainable when building with MSVC.
2024-06-03 12:57:29
This will be fixed via PR https://github.com/google/highway/pull/2231.
jonnyawsom3
2024-06-05 05:19:52
Huh, I didn't realise there was an even earlier attempt at the mixed encoding https://github.com/libjxl/libjxl/pull/466
Waterpicker
2024-06-11 05:06:31
is there a simple .so version libjxl for linux?
2024-06-11 05:07:14
Looking into the jni for libjxl for my issues but I found a 2mb files for windows and then what looks like a bloated obtused solution fo rlinux...
yoochan
2024-06-11 08:28:08
Look on the github, download le latest release for Linux? Or compile it yourself
2024-06-11 08:28:43
What does "simple" means?
Waterpicker
2024-06-12 07:44:39
like just an .so file.
w
2024-06-12 07:52:18
you can make your own
2024-06-12 07:52:28
the issue with distributing that is linking to the exact version of the other libraries in use
2024-06-12 07:53:13
it's the same problem in windows
Demiurge
2024-06-12 09:31:17
Yeah it's called the linux-static download on github releases
2024-06-12 09:31:34
Wait no
2024-06-12 09:31:49
That's not an .so I don't think
2024-06-12 09:31:59
Since shared objects are not static
2024-06-12 09:33:41
It's not THAT hard to compile... but it's still a lot more complicated to compile compared to any other codec library I have ever seen in my life
2024-06-12 09:35:36
Most other codecs try to keep things as simple as possible for maximum uptake and adoption
jjrv
2024-06-12 05:52:49
I'm using Zig to compile (just telling cmake to use that instead of Clang) and with a ~50-line shell script I can now compile libjxl targeting Linux, OS X and Wasm.
2024-06-12 05:53:47
I'm compiling everything static for my own tools, for easier deploy and with Wasm shared isn't really an option anyway.
2024-06-12 05:56:05
Don't need Emscripten, just Zig
yoochan
2024-06-13 07:31:10
and zag
2024-06-13 07:31:36
(don't know how zig can do wasm without LLVM and at this point I'm too afraid to ask)
Demiurge
2024-06-13 08:40:02
Captain: Take off every 'zig'!!
Oleksii Matiash
Demiurge Captain: Take off every 'zig'!!
2024-06-13 09:12:26
Captain: You know what you doing.
jjrv
2024-06-13 11:08:31
It uses llvm but just packages it nicely, so I can compile C and C++ libraries and call them without much pain. My laptop is OS X and desktop is Linux, trying to keep projects working on both to easily switch when at home vs elsewhere.
2024-06-13 11:18:29
Then I've got 50 lines of bindings written in Zig, and through those calling libjxl from TypeScript. The same interface works for Wasm (browsers) and native (under Node). Just doing everything the simplest laziest way possible while prototyping various things. It's a pretty nice tech stack, since the browser provides GPU access as well. Lots of options to try things.
gb82
jjrv It uses llvm but just packages it nicely, so I can compile C and C++ libraries and call them without much pain. My laptop is OS X and desktop is Linux, trying to keep projects working on both to easily switch when at home vs elsewhere.
2024-06-13 07:15:30
I don't actually think it uses llvm
jjrv
2024-06-13 07:54:27
It does. Especially since I'm talking about compiling libjxl, written in C++, to Wasm. But that's kind of painful to figure out how to do with just cmake and clang, or at least I have no idea how to get it working.
190n
gb82 I don't actually think it uses llvm
2024-06-13 08:40:56
zig cc/zig c++ always uses llvm (via clang) compiling zig code right now usually uses llvm, but they're working on making the non-llvm backends more viable
gb82
2024-06-16 12:36:28
Oh, gotcha. I remember hearing something about them abandoning llvm
qdwang
2024-06-17 12:35:07
Is it possible to access the current encoding progress though C API?
_wb_
2024-06-18 11:13:02
I don't think so. I guess you could do chunked encoding and use that as a crude way to show progress. In general we're aiming at being fast enough to not require a progress bar. Though I guess for huge images and/or high-effort lossless encoding, it could make sense.
jonnyawsom3
2024-06-18 12:04:14
Signalling when a group has finished encoding (Bar full-frame heuristics) could be one way
_wb_
2024-06-18 02:30:07
yes, I suppose we could make some API for a callback that does something like that β€” not a priority though, imo. We can do that after 1.0 without breaking things...
jonnyawsom3
2024-06-19 04:55:03
Got reminded of this yet again, I'm very much assuming it's not as simple as removing the `=` so that 32 bit is valid https://github.com/libjxl/libjxl/issues/3511
qdwang
_wb_ I don't think so. I guess you could do chunked encoding and use that as a crude way to show progress. In general we're aiming at being fast enough to not require a progress bar. Though I guess for huge images and/or high-effort lossless encoding, it could make sense.
2024-06-20 08:44:38
Thanks for the reply. I'll try the chunk encoding method.
yoochan
2024-07-08 08:19:39
I miss the procedure or flag to compile the gdk pixbuf loader... could someone give me a clue? The readme found here (https://github.com/libjxl/libjxl/tree/main/plugins/gdk-pixbuf) contains information on how to install it, but not how to compile it
_wb_
2024-07-08 09:38:25
Not sure but I think it should automatically get compiled if the gdk-pixbuf headers are found, you probably have to install some -dev package for that...
yoochan
2024-07-08 09:38:52
ha ! this is a nice clue... I'll have a look
2024-07-08 09:43:17
(found a `libgdk-pixbuf-2.0-dev`)
2024-07-08 09:54:25
(didn't worked, try again with `libgdk-pixbuf2.0-dev`)
2024-07-08 10:40:26
(didn't work either.... I'll have a look at the cmakelists)
spider-mario
yoochan I miss the procedure or flag to compile the gdk pixbuf loader... could someone give me a clue? The readme found here (https://github.com/libjxl/libjxl/tree/main/plugins/gdk-pixbuf) contains information on how to install it, but not how to compile it
2024-07-08 11:00:03
``` cmake -DJPEGXL_ENABLE_PLUGINS=ON ```
yoochan
2024-07-08 11:00:42
oui ! I just found it πŸ˜„ `-DJPEGXL_ENABLE_PLUGINS=ON -DJPEGXL_ENABLE_PLUGIN_GDKPIXBUF=ON`
2024-07-08 11:01:05
the `-DJPEGXL_ENABLE_PLUGIN_GDKPIXBUF` is not required ?
spider-mario
2024-07-08 11:01:14
oh, I didn’t remember that we had separate options for individual plugins
2024-07-08 11:01:26
it seems the individual options default to yes
yoochan
2024-07-08 11:01:26
didn't test without to be honest
2024-07-08 11:02:32
perhaps I should have used the ./ci.sh script...
spider-mario ``` cmake -DJPEGXL_ENABLE_PLUGINS=ON ```
2024-07-08 11:14:05
I confirm this is enough, I'll submit a modification of the documentation to help others
Demiurge
2024-07-18 07:30:33
Congrats on the libjxl work to avoid assert. Lots of thanks and gratitude to all involved in giving the world such a cool codec. Maybe now it can be added to certain projects like paint.net without fear of it aborting and losing unsaved work...?
jonnyawsom3
2024-07-18 08:49:19
<@1028567873007927297> there's a special decode path for e1 along with the fast encode, I'd guess e2 is using some of that too depending on the image hence why e3 is a sudden slowdown for you
Demiurge
2024-07-18 10:15:50
e3 compression is much faster than decompression funny enough
_wb_
2024-07-18 10:48:05
It should be about the same, no?
2024-07-18 10:48:18
E1 compression is faster than decompression
2024-07-18 10:49:54
Inherently, compression can be made faster than decompression because the encoder already knows the image so it can do things in parallel that the decoder inherently has to do sequentially.
jonnyawsom3
2024-07-18 11:28:13
That gives me the idea of a lookup table in the TOC so the decoder is aware, but naturally that would be a spec change and probably only on faster decoding settings due to size overhead
Demiurge
2024-07-19 12:13:25
Hmm, doing another test, on a different computer, with only 1 thread, it is about the same speed
2024-07-19 12:13:46
But I think when multiple threads are used, e3 compression is significantly faster than decompression
2024-07-19 12:15:12
By the way, I see that jpegli was moved into a separate google/jpegli repo? This seems strange, since it would make sense for jpegli to be more integrated as part of libjxl, not less. Not only that, but it would also encourage adoption of libjxl.