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

w
2021-10-04 07:14:19
how do i do that
veluca
2021-10-04 07:18:54
you pass `-fsanitize=address`
2021-10-04 07:19:03
in your CFLAGS/CXXFLAGS/LDFLAGS
2021-10-04 07:19:19
(address for address sanitizer, memory for memory sanitizer, ...)
w
2021-10-04 08:03:20
hmm i didnt do anything and it just works now
2021-10-04 08:06:18
even though i was consistently getting those errors
2021-10-04 08:06:51
ohhhh it may be because now im storing the input data
2021-10-04 08:07:03
and it was being GC'd before when it stepped out a first time
veluca
2021-10-04 08:39:19
ah yeah that could indeed give you issues
Jim
2021-10-04 10:53:14
Congrats on releasing 0.6! πŸ₯³
chafey
2021-10-05 11:04:29
I would like to try out the lossy progressive/responsive capabilities of jpeg-xl. I looked through the API docs and can’t find anything in the Encoder section about this. I also looked at the source for cjxl but am unable to figure out how it connects the -p option to the API. Can someone point me in the right direction?
2021-10-05 11:05:46
Correction - i want to try out the lossless progressive/responsive capabilities
_wb_
2021-10-05 11:42:41
not sure how much of that is exposed in the api yet
2021-10-05 11:42:50
we're still in the progress of migrating cjxl/djxl to the api
2021-10-05 11:43:13
currently they just call the encoder directly without using the api, so they can set params that aren't exposed in the api yet
2021-10-05 11:44:20
(historically, cjxl/djxl are a lot older than the api)
chafey
2021-10-05 11:44:57
Ahh ok that explains a lot of things thank you
2021-10-05 11:45:27
Is it possible to do partial bit stream decoding right now via the API?
2021-10-05 11:45:44
E.g. load 50% of the bytes and decode as much of the image as it can
_wb_
2021-10-05 11:47:47
yes, that is possible
2021-10-05 11:48:33
you just give it a partial buffer and call Flush when it is requesting more bytes
2021-10-05 11:48:53
https://github.com/libjxl/libjxl/pull/606 example code here
chafey
2021-10-05 11:48:57
Thank you
2021-10-05 12:05:44
FYI - I am creating my own WASM build and using it to test performance of lossless medical image compression. You can try out the test harness here: https://chafey.github.io/libjxl-js/test/browser
_wb_
2021-10-05 12:16:02
cool - are you involved in DICOM by any chance?
chafey
2021-10-05 12:18:08
Yes, WG-04
2021-10-05 12:19:09
Sent you an email this morning
_wb_
2021-10-05 12:44:33
ah lol hadn't catched up with my mail yet
2021-10-05 12:47:35
regarding encode time for lossless: I suspect that for most medical images, e3 (falcon) should perform quite well
2021-10-05 12:50:41
e3 doesn't do a good job at synthetic images, but for sensor data it is quite good and very fast compared to e > 3
2021-10-05 12:52:05
regarding progressive: yes, for lossless it is likely not the best idea compared to j2k
2021-10-05 12:55:19
for diagnostically lossless, it might be worthwhile to try something like `cjxl -m -C 1 -Q 95` (or some other Q setting) - that will automatically be progressive as a side effect, and since it's not DCT based, the loss can be done with relatively strong guarantees on the max pixel error
chafey
2021-10-05 01:52:31
Wait - you mean diagnostically lossy?
2021-10-05 01:54:42
Where are you seeing that?
2021-10-05 01:55:07
This test harness is based on the jpeg-ls test harness so some ratification may still be in there
_wb_
chafey Wait - you mean diagnostically lossy?
2021-10-05 01:55:17
lossy in terms of pixels, but without impacting diagnosis so diagnostically lossless πŸ™‚
chafey
2021-10-05 01:55:37
Good catch ill fix that thanks
_wb_
2021-10-05 01:56:08
I mean just very high quality lossy, possibly with some mathematical guarantees of max per-pixel delta
chafey
2021-10-05 01:56:27
Got it thanks
2021-10-05 01:57:09
E3 is much faster without much increase in file size. It is still quite a bit slower than JPEG-LS and HTJ2K by about 4x though
2021-10-05 01:57:19
How much room is there for optimizing then decoder?>
_wb_
2021-10-05 01:59:40
how are you measuring speed?
chafey
2021-10-05 02:00:27
Wasm builds of openjpeg, openjph running in a browser
_wb_
2021-10-05 02:00:28
because wasm != native, and for native things do depend a bit on your platform
chafey
2021-10-05 02:00:51
Sure - my main interest is wasm in the browser. So no threads and SIMD is a maybe
_wb_
2021-10-05 02:01:56
for accurate speed measurements, try `djxl input.jxl --num_reps=100 --num_threads=0` (if you want to try single-threaded speed)
Traneptora
2021-10-05 07:33:49
How am I supposed to use parallel runners from the C API?
2021-10-05 07:34:38
like this
2021-10-05 07:34:55
https://libjxl.readthedocs.io/en/latest/api_threads.html#_CPPv429JxlThreadParallelRunnerCreatePK16JxlMemoryManager6size_t
2021-10-05 07:35:06
It just says "use as the opaque runner"
2021-10-05 07:35:08
which is ???
2021-10-05 07:35:53
`JxlDecoderSetParallelRunner` requires both a `JxlParallelRunner` *and* an opaque `void *`
2021-10-05 07:35:58
why?
w
2021-10-05 07:36:48
i think oneshot_decode has an example of it
2021-10-05 07:37:00
otherwise you can check the the many of my implementations
2021-10-05 07:37:07
like the firefox one
Traneptora
2021-10-05 07:37:10
`JxlThreadParallelRunnerMake` also says "See `JxlThreadParallelRunnerCreate` for details on the instance creation."
2021-10-05 07:37:17
which itself is not documented
2021-10-05 07:37:27
there are no details
w
2021-10-05 07:37:36
but you would do `JxlDecoderSetParallelRunner(dec.get(), JxlThreadParallelRunner, runner.get());`
Traneptora
2021-10-05 07:37:47
this is C
w
2021-10-05 07:37:54
oh...
Traneptora
2021-10-05 07:37:54
I'm using the C API
2021-10-05 07:38:09
there's no `runner.get()`
2021-10-05 07:38:20
how am I supposed to use them from the C api?
w
2021-10-05 07:38:26
i mean, .get() was just for the smart pointer
Traneptora
2021-10-05 07:38:40
but it returns a C++ class
2021-10-05 07:38:44
which is not helpful in the C API
w
2021-10-05 07:40:11
so for the pointer all you need is JxlThreadParallelRunnerCreate
Traneptora
2021-10-05 07:40:21
sure, but what do I *do* with that?
2021-10-05 07:40:46
https://libjxl.readthedocs.io/en/latest/api_decoder.html#_CPPv427JxlDecoderSetParallelRunnerP10JxlDecoder17JxlParallelRunnerPv requires two arguments
2021-10-05 07:40:53
`JXL_EXPORT JxlDecoderStatus JxlDecoderSetParallelRunner(JxlDecoder *dec, JxlParallelRunner parallel_runner, void *parallel_runner_opaque)`
w
2021-10-05 07:41:39
the second arg is a function pointer
2021-10-05 07:41:50
you would do JxlDecoderSetParallelRunner(dec, JxlParallelRunner, runner)
Traneptora
2021-10-05 07:42:09
is JxlParallelRunner provided by libjxl
2021-10-05 07:42:12
or do I have to define one
w
2021-10-05 07:42:19
you can use JxlThreadParallelRunner
Traneptora
2021-10-05 07:42:37
so basically
w
2021-10-05 07:43:05
i think just this ```void* dec; void* runner; JxlDecoderSetParallelRunner(dec, JxlThreadParallelRunner, runner)```
Traneptora
2021-10-05 07:44:00
```c runner = JxlThreadParallelRunnerCreate(manager, 4); JxlDecoderSetParallelRunner(decoder, JxlThreadParallelRunner, runner); ```
2021-10-05 07:44:08
so something like this?
w
2021-10-05 07:44:17
yeah, well it's the same as in cpp
Traneptora
2021-10-05 07:44:36
none of this is well documented
2021-10-05 07:44:38
which is very frustrating
w
2021-10-05 07:44:42
just stare at the code
2021-10-05 07:44:45
for a couple of hours
2021-10-05 07:44:48
that's what i did
Traneptora
2021-10-05 07:44:51
^ that's not well documented
w
2021-10-05 07:44:55
:)
2021-10-05 07:45:13
but who's gonna document it amirite
Traneptora
2021-10-05 07:55:42
well if the goal is adoption then someone should
veluca
Traneptora well if the goal is adoption then someone should
2021-10-06 08:08:39
Very true, can you file an issue?
2021-10-06 08:09:07
(as a side note, using the ResizableParallelRunner can be more effective on lower-end devices)
Lastrosade
2021-10-09 02:11:17
Hey, I'm running cjxl 0.7.0 on windows and even at -e 1 it takes ages for compress one 306x299 image
fab
Lastrosade Hey, I'm running cjxl 0.7.0 on windows and even at -e 1 it takes ages for compress one 306x299 image
2021-10-09 02:12:38
lossless?
Lastrosade
2021-10-09 02:12:43
No
fab
2021-10-09 02:12:57
why? is an animation?
Lastrosade
2021-10-09 02:13:11
No
Scope
2021-10-09 02:18:21
`--patches=0` doesn't help?
Lastrosade
2021-10-09 02:19:14
oh wow it does
2021-10-09 02:19:38
what does this do ?
_wb_
2021-10-09 02:21:16
At -e 6 or lower, --patches=0 is default
2021-10-09 02:22:10
Can you create an issue for this slow encoding image?
veluca
2021-10-09 02:22:31
why would --patches=0 change anything at -e 1??
_wb_
2021-10-09 02:22:41
It shouldn't change anything
veluca
2021-10-09 02:22:43
I already see fun in my future...
2021-10-09 02:23:11
I really hope this is not windows-only...
Lastrosade
2021-10-09 02:31:05
Before posting an issue I'll reboot, god knows this sometimes fixes things on windows
_wb_
2021-10-09 02:33:36
Also check if you're maybe not using a debug msan build or something
Lastrosade
Lastrosade Before posting an issue I'll reboot, god knows this sometimes fixes things on windows
2021-10-09 02:38:29
It helped <:kekw:758892021191934033>
2021-10-09 02:41:21
I hate windows so much
Hello71
2021-10-09 02:49:29
why does libjxl use cpuid asm instead of querying the os for non-mac, non-haiku systems? is the idea that asm is portable cross-os (more or less) and not portable cross-arch, whereas os queries are portable cross-arch and not cross-os?
_wb_
2021-10-09 02:52:44
I assume it's because it needs to know the exact simd instruction set, not whatever abstraction the OS provides?
190n
2021-10-09 02:53:36
> is the idea that asm is portable cross-os (more or less) and not portable cross-arch this is correct, unless the asm needs to make a syscall (which it'd probably do just by delegating to a function written in c) it's entirely portable cross-os
Hello71
2021-10-09 02:53:46
er, i dropped this: "for topology detection"
2021-10-09 02:54:35
<@!794205442175402004> i don't think libjxl uses any asm other than that though? it's all through highway, or at least that would be the proper implementation (layering violation etc)
_wb_
2021-10-09 02:57:24
Topology detection, probably that shouldn't really be part of libjxl either, since I guess it is only used to pick some default number of threads
Hello71
2021-10-09 03:02:49
actually, on that train of thought, why does libjxl try to ignore hyperthreading anyways
_wb_
2021-10-09 03:04:23
I know very little about those lowlevel perf things
2021-10-09 03:05:31
<@806098177983643658> knows all about that
2021-10-09 03:07:01
Also <@179701849576833024> and <@456226577798135808> know more about it than me
veluca
2021-10-09 03:08:40
first - it's not libjxl, but the tools, which makes it make slightly more sense
2021-10-09 03:09:15
tbh I don't really think we should be doing anything else but `std::hardware_concurrency` for # of threads
Hello71
2021-10-09 03:09:51
ah, yes, i wasn't so clear there. i meant it is in the libjxl repository :p
veluca
2021-10-09 03:09:55
but HT doesn't always help (in particular it was actively reducing performance on our workstations, and in other systems the improvement was marginal) so we went with that
Hello71
2021-10-09 03:11:24
hm, i'm surprised that it would reduce performance. in theory i guess it's supposed to be at worst neutral (if you ignore synchronization?)
veluca
2021-10-09 03:11:51
ehhhh it's complicated
2021-10-09 03:12:06
interactions with memory bandwidth are hard
Hello71
2021-10-09 03:12:26
and synchronization, and licenses, and thermals, and cache, and...
veluca
2021-10-09 03:12:30
but I really think we just ought to default to whatever std::hardware_concurrency says
2021-10-09 03:13:11
if you feel like measuring performance on your system and opening a bug it might help...
_wb_
2021-10-09 03:13:15
Probably things will even not necessarily be the same between vardct decode and modular decode in terms of where the bottlenecks are
veluca
2021-10-09 03:13:34
(I mean with `--num_threads=` with/without HT cores)
Hello71
2021-10-09 03:14:06
i think for linux it would be nice to do sched_getaffinity, since it's quite common to run docker/lxc with limited cpus
2021-10-09 03:15:26
i guess there is also a question of numa, but hopefully anyone with a real numa system knows how to handle it themselves
2021-10-09 03:16:50
what kind of workstation did you experience performance reduction on?
Lastrosade
2021-10-09 03:17:35
Hey, Is there any ways to speed up the encoding at the cost of compression without hurting quality ?
2021-10-09 03:17:53
I'm running a generation loss test
veluca
2021-10-09 03:18:30
eh not really
2021-10-09 03:18:51
not at the current state of things at least, and unless you're willing to poke at the code
2021-10-09 03:19:06
(also the non-quality-affecting part is a small fraction of the runtime, so...)
BlueSwordM
Lastrosade Hey, Is there any ways to speed up the encoding at the cost of compression without hurting quality ?
2021-10-09 03:22:31
1. Enable `-march=native -O3` at build time. It provides an almost negligent, but consistent speed boost. I've never tried LTO with CJXL, so 🀷 2. If you have many images, you can dedicate 1 thread per image to reduce CPU-time as much as possible.
Lastrosade
BlueSwordM 1. Enable `-march=native -O3` at build time. It provides an almost negligent, but consistent speed boost. I've never tried LTO with CJXL, so 🀷 2. If you have many images, you can dedicate 1 thread per image to reduce CPU-time as much as possible.
2021-10-09 03:24:31
already doing this, also when testing generation loss I can't really do things in parallel
Hello71
2021-10-09 03:28:39
shouldn't you test multiple sample images and not just one?
Lastrosade
2021-10-09 03:28:52
I could
2021-10-09 03:29:10
But then I'm just running different scripts
Hello71
2021-10-09 03:29:43
also, since you said you are using windows, a program linking against libjxl will probably be much faster than a batch script
Lastrosade
2021-10-09 03:30:38
I'm running this on linux, the windows issue is unrelated
_wb_
2021-10-09 03:31:00
Generation loss is likely going to be somewhat different at different encoder speed settings too
Hello71
2021-10-09 03:31:26
ah. could still be worth it to try, but linux process creation is pretty fast for small programs
_wb_
2021-10-09 03:31:51
At e3, vardct jxl is basically just jpeg in XYB
Lastrosade
Hello71 also, since you said you are using windows, a program linking against libjxl will probably be much faster than a batch script
2021-10-09 03:34:10
True, I have no idea if I can even do this in powershell or whatever scripting environment I know how to use
_wb_ At e3, vardct jxl is basically just jpeg in XYB
2021-10-09 03:36:18
Ah, so should I run -e 4 to get a more "jpeg xl"y result ?
2021-10-09 03:37:31
wait what the hell
2021-10-09 03:37:37
-e 4 is faster than -e 1
_wb_
2021-10-09 03:48:33
For lossy, it could be that e<3 is broken
fab
2021-10-09 04:54:18
Does jxl can encode an animation with flac audio
diskorduser
2021-10-09 05:05:29
I don't think so
2021-10-09 05:05:55
If something includes audio, then it's a video.
Fox Wizard
2021-10-09 05:05:56
~~Cursed~~
Fraetor
2021-10-09 05:15:58
There might be some way to put jxl as the visual stream inside of a container like MKV, but at that point you have a video.
veluca
Lastrosade I'm running this on linux, the windows issue is unrelated
2021-10-09 07:31:15
it would still be faster on Linux too - there is some nontrivial initialization going on in the first encode in a process
Lastrosade
veluca it would still be faster on Linux too - there is some nontrivial initialization going on in the first encode in a process
2021-10-09 07:32:40
Well its not too slow, I'm at 44,000 out of 100,000 iterations right now
2021-10-09 07:33:04
This is so dumb the original image is already super compressed
veluca
2021-10-09 07:33:07
that's a big number πŸ˜›
Lastrosade
2021-10-09 07:33:14
its for a meme
2021-10-09 07:33:18
not even a good one
_wb_
2021-10-09 07:39:51
What kind of iterations?
2021-10-09 07:40:09
How are you varying encode parameters?
Lastrosade
2021-10-09 07:41:33
The lazy way `$q = Get-Random -Maximum 97 -Minimum 93`
2021-10-09 07:43:34
you can read it but please close your eyes ```powershell $framerate = 60 $refreshrate = 10 "WEBVTT`n`n" > loss.vtt ffmpeg -y -i image0-24.png "imgs/1.png" $q = Get-Random -Maximum 97 -Minimum 93 for ($i = 2; $i -le 100000; $i++) { $j = $i-1 # ffmpeg -hide_banner -v error -y -i "H:\loss\$j.webp" -metadata q=$q -q:v $q "H:\loss\$i.webp" cjxl "imgs/$j.png" -q $q -e 4 "imgs/$j.jxl" djxl "imgs/$j.jxl" "imgs/$i.png" $g = "$i".PadLeft(6, '_') if ($i%$refreshrate -eq 0) { $t = [timespan]::fromseconds($i/$framerate) $nt = $t.Add([timespan]::fromseconds($refreshrate/$framerate)) $h = "$($t.hours)".PadLeft(2, '0') $m = "$($t.minutes)".PadLeft(2, '0') $s = "$($t.seconds)".PadLeft(2, '0') $ms = "$($t.Milliseconds)".PadLeft(3, '0') $nh = "$($nt.hours)".PadLeft(2, '0') $nm = "$($nt.minutes)".PadLeft(2, '0') $ns = "$($nt.seconds)".PadLeft(2, '0') $nms = "$($nt.Milliseconds)".PadLeft(3, '0') "$h`:$m`:$s.$ms --> $nh`:$nm`:$ns.$nms`nGeneration : $g`nQ : $q`n" >> loss.vtt Write-Output "$g $q | $h`:$m`:$s.$ms --> $nh`:$nm`:$ns.$nms" $q = Get-Random -Maximum 97 -Minimum 93 } else { Write-Output "$g $q" } } ffmpeg -y -r $framerate -i "imgs/%d.png" -vf "subtitles=loss.vtt:force_style='Fontname=Sydnie,Fontsize=10,Alignment=5'" -crf 32 -r $framerate loss_captions.webm ```
_wb_
2021-10-09 07:46:14
Random is fine, if you compare multiple codecs just make sure the range is similar (bpp of a fresh encode at min and at max is similar in all codecs), and the number of effectively different settings is also not too different (e.g. some codecs take integer q settings and others float; if there are only 3 effectively different params in the range then it's "easier" to resist generation loss than if there are 3000)
2021-10-09 07:47:45
Also, decoding to 16-bit png is a bit more representative of what would happen if you e.g. do a transcode with a default imagemagick (which would have 16-bit internal precision)
Lastrosade
2021-10-09 07:48:02
Ahh, yeah
2021-10-09 07:50:36
I guess I could select a random float between 0 and 1 and then multiply it to whatever max Q value an encoder accepts
2021-10-09 07:51:04
What I mean is percentages kekw
2021-10-09 07:57:10
Huh, after the first few thousand iterations it sort of settles and doesn't get much more deteriorated
_wb_
2021-10-09 08:21:59
That's nice, if it reaches a somewhat idempotent state
Hello71
2021-10-10 07:45:41
i did a quick benchmark of cjxl -e 1..9 --num_threads=0,1,nproc/2,nproc with both jpeg reconstruction and jpeg to pixels on my intel somethingsomething laptop and ryzen 1600 desktop, and it looks like HT is 5-10% faster but uses twice the cpu. is it really that heavy on memory bandwidth?
2021-10-10 07:47:34
i guess i should check perf stat, i only looked at perf report so far (about the same %s for both, more HT spends a little more time in malloc)
2021-10-10 07:49:04
"50.31% backend cycles idle" well i'm not a cpu optimization pro but that sounds bad
_wb_
2021-10-10 07:49:35
I think things might be a bit different if we would use more 16-bit buffers and less 32-bit ones
Hello71
2021-10-10 07:51:32
that was for 6/12, 12/12 is 37.35% backend cycles idle. so for my machine too, it's all waiting on ram
2021-10-10 07:53:33
hm, does that mean that running 12 threads on one image will actually be faster than 12 images at once, because the cache will be hotter? idk anything about libjxl internals or really that much about modern image compression in general beyond "something something DCT blocks delete high frequency components something"
2021-10-10 07:55:10
and also, is it possible to speed this up with some scheduler tricks, like putting threads processing the same parts of the image on HT siblings?
_wb_
2021-10-10 07:56:58
A typical worker thread will be working on a 256x256 pixel region
2021-10-10 07:57:45
Likely scheduling horizontally adjacent groups on the same HT siblings would be a good idea for cache reasons
2021-10-10 07:57:47
I think
2021-10-10 07:59:35
Though it probably depends on whether you do decode to full float buffer or do an optimized case to decode to uint8 or to pixel callback
2021-10-10 07:59:45
djxl uses full float buffer
2021-10-10 07:59:56
Firefox uses uint8 buffer iirc
2021-10-10 08:00:03
Chrome uses pixel callback
2021-10-10 08:00:25
These will all behave a bit differently, I expect
veluca
Hello71 "50.31% backend cycles idle" well i'm not a cpu optimization pro but that sounds bad
2021-10-11 09:02:55
I think that's because we filled up the execution units of the CPU, but not certain - anyway HT likely improves the total # of backend cycles that get executed
Hello71 i did a quick benchmark of cjxl -e 1..9 --num_threads=0,1,nproc/2,nproc with both jpeg reconstruction and jpeg to pixels on my intel somethingsomething laptop and ryzen 1600 desktop, and it looks like HT is 5-10% faster but uses twice the cpu. is it really that heavy on memory bandwidth?
2021-10-11 09:04:30
our measurements come from (a) older versions (b) decoding and (c) 28-core CPUs, so the results may be different there... if I run decoding on my 32-core threadripper, I see speed stops to increase even before 32 cores IIRC, lets' not even mention 64, but on my laptop HT definitely helps
2021-10-11 09:04:39
would you be willing to file a bug with your findings?
Hello71
2021-10-11 01:49:45
sure. i
2021-10-11 01:49:54
'll take a look at decoding first
veluca
2021-10-11 01:57:27
thanks πŸ˜„
Hello71
2021-10-11 02:44:52
i think even if HT is faster, it might still be better to skip it because then the user can run some other programs at the same time
veluca
2021-10-11 03:27:05
that's an argument for not doing MT at all by default πŸ™‚
novomesk
2021-10-11 04:46:33
HT makes JXL decoding aprox. 10% faster on my laptop. Not using HT cores won't allow other process to use it. HT works only inside one process, isn't it?
veluca
2021-10-11 04:51:04
no no
2021-10-11 04:51:31
to the OS HT is not different at all from just another core
Hello71
2021-10-11 04:56:13
although linux 5.15 will have core scheduling for doing it as you describe. it will be optional due to resulting significant performance drop for some workloads
veluca that's an argument for not doing MT at all by default πŸ™‚
2021-10-11 05:00:29
well i think it depends on how much the speedup is? e.g. if HT can double encoding speed, then maybe i want to prioritize that, but if it is only a 10% increase then maybe i want to prioritize other programs. or maybe i really want jxl to be fast and the 10% is worth it even if it slows everything else down. unfortunately i don't think there is a programmatic way to determine this preference
2021-10-11 05:06:55
if there's a system() function for calling the system, why isn't there a user() function for calling the user
_wb_
2021-10-11 05:08:26
that's what argv[] is for, no?
novomesk
2021-10-11 05:28:22
JXL with Parallel Runner has similar decoding speed as single frame 10bit AVIF YUV444. That's good. Unfortunately, I will probably avoid the runner for stability reasons, performance of my plug-in will drop significantly. JXL in Google Chrome is also slow, they use single thread JXL for the same reason?
_wb_
2021-10-11 05:34:04
I don't know why chrome uses single thread, maybe it's convenient in their architecture to do it like that?
Hello71
2021-10-11 05:34:53
could be seccomp
veluca
2021-10-11 08:12:58
I think it's more that we never got to implementing multithreading πŸ˜›
eddie.zato
2021-10-12 04:42:21
> performance of my plug-in will drop significantly <@!886264098298413078> How bad is it in numbers?
novomesk
2021-10-12 04:51:46
20% to 100% increase in decoding time, it depends on image. In some apps you will not notice because of various parallel procedures and/or pre-loading.
eddie.zato
2021-10-12 05:03:36
I have a bunch of 150 MP images, so that could be hurtful, I guess. Maybe I should stick with v0.3.0 for now.
veluca
novomesk JXL with Parallel Runner has similar decoding speed as single frame 10bit AVIF YUV444. That's good. Unfortunately, I will probably avoid the runner for stability reasons, performance of my plug-in will drop significantly. JXL in Google Chrome is also slow, they use single thread JXL for the same reason?
2021-10-12 08:36:10
I think we are looking into the issues you might have found - and please file bugs for any new ones πŸ˜›
testerrrrr
2021-10-14 10:53:07
if i wanted to deconstruct a jxl file (lets say it's just 1 frame) into all pieces required to reconstitute it, would it be sufficient to read the toc & partition the bytestream according to those offsets?
2021-10-14 10:53:39
or is it more involved than that to split it up?
_wb_
2021-10-15 05:12:02
Not sure if I understand what you want to do
2021-10-15 05:13:17
Those are indeed the 'chunks' that can be decoded in parallel (they each start their own ANS stream etc)
2021-10-15 05:15:56
The decoder still needs to know which one it is (it knows that from its position in the toc), and there are dependencies, e.g. the AcGlobal group has info that all the AC groups need, and AC groups can come in multiple passes, and they also need the decoded data from the DC group they are part of.
testerrrrr
2021-10-15 06:30:28
ah, was just curious if my understanding was correct: if i have offsets + size of: -the header -the toc -all sections -whatever is left after the last section if i could implement a paused + serializable + restartable decoder
_wb_
2021-10-15 06:35:03
I suppose so, maybe depending on what exactly you mean by those things
2021-10-15 06:36:03
Maybe as a proof of concept we should make a simple chunked encoder that can encode gigapixel images without needing huge memory
2021-10-15 06:36:38
And then also a cropped decoder that can decode regions of interest without having to decode the full image
2021-10-15 06:37:34
As well as a chunked decoder that decodes the full image but does so one tile at a time and uses bounded memory regardless of the image dimensions
testerrrrr
_wb_ Maybe as a proof of concept we should make a simple chunked encoder that can encode gigapixel images without needing huge memory
2021-10-15 06:46:20
that would be awesomee!!
monad
2021-10-15 06:48:55
I need that.
Luigi311
2021-10-16 09:04:59
does cjxl do its own processing with the sensor information in png images? When i convert a png image to jxl with sensor imformation the output i get is completely different brightness and saturation wise.
_wb_
2021-10-16 09:06:16
cjxl uses the color profile of the input
2021-10-16 09:06:23
Or assumes sRGB if there is none
2021-10-16 09:07:31
Likely your png viewer does something different (ignores the color profile, or assumes pixels are in display space if there is no profile)
Luigi311
2021-10-16 09:08:10
im viewing both via the same viewer in this case imageglass on windows
2021-10-16 09:08:19
2021-10-16 09:08:21
2021-10-16 09:09:04
discord embeded looks to be somewhere in between lol
monad
2021-10-16 09:12:27
They look the same to me in Chrome.
The_Decryptor
2021-10-16 09:13:07
Same for me in Edge, but I see a difference in explorer or the windows photos app depending on if I decode to PNG or JPG
Luigi311
2021-10-16 09:14:48
ahh so it does vary viewer to viewer. So i guess it would be better for me to no include the senseor information or atleast not the color profile that way its consistent? I guess the question is does it look super dark for you <@!263300458888691714> or is it bright and noisy
2021-10-16 09:15:43
The_Decryptor
2021-10-16 09:16:02
I see the output on the right
monad
2021-10-16 09:16:32
I see closer to right as well
Luigi311
2021-10-16 10:08:52
yeah im a skip the sensor information copy in my post processing just so the results are consistent across all viewers
2021-10-16 10:19:49
2021-10-16 10:19:50
2021-10-16 10:19:54
Not too shabby
2021-10-16 10:25:22
without the super resolution
VcSaJen
2021-10-20 12:57:08
Is compiling for x86 different from x64? Used vcpkg+VS2019 instructions, and replaced x64 with x86. It complains about `libjxl\lib\profiler\tsc_timer.h(107,17): error : use of undeclared identifier 'CLOCK_MONOTONIC'`
Nova Aurora
VcSaJen Is compiling for x86 different from x64? Used vcpkg+VS2019 instructions, and replaced x64 with x86. It complains about `libjxl\lib\profiler\tsc_timer.h(107,17): error : use of undeclared identifier 'CLOCK_MONOTONIC'`
2021-10-20 02:19:25
On a technical level, yes, but I don't know enough about C compilation to know if that's related
Traneptora
2021-10-20 06:14:02
Thanks to who put more work into the docs
2021-10-20 06:14:32
but you removed the reference in the docs to `#include <jxl/thread_parallel_runner.h>`
2021-10-20 06:14:36
so I had to hunt for it
2021-10-20 06:14:45
I figured it wasn't needed anymore cause it was gone, but it still is
2021-10-20 06:22:27
also I appear to have a hard time linking it now
diskorduser
Luigi311 without the super resolution
2021-10-20 07:58:29
What is super resolution? Is it a upscaling algorithm?
_wb_
2021-10-20 08:27:31
superresolution is just a fancy name for fancy upscaling, yes
2021-10-20 08:28:22
(I suppose it kind of implies that it's doing more than just a simple upsampling filter but there is something more advanced being done, like AI)
fab
2021-10-20 08:30:11
who tried this? luigi311?
Luigi311
_wb_ (I suppose it kind of implies that it's doing more than just a simple upsampling filter but there is something more advanced being done, like AI)
2021-10-20 02:24:46
Yup upscaling using AI with the algorithm ESPCN
fab who tried this? luigi311?
2021-10-20 02:24:57
Yes sir
improver
2021-10-20 02:56:24
``` 898/898 Testing: conformance_tooling_test 898/898 Test: conformance_tooling_test Command: "/usr/bin/bash" "/home/anon/.cache/yay/libjxl-git/src/libjxl/tools/conformance/tooling_test.sh" "/home/anon/.cache/yay/libjxl-git/src/build" Directory: /home/anon/.cache/yay/libjxl-git/src/build/tools/conformance "conformance_tooling_test" start time: Oct 20 17:54 EEST Output: ---------------------------------------------------------- + CLEANUP_FILES=() + trap 'retcode=$?; { set +x; } 2>/dev/null; cleanup' INT TERM EXIT + main /home/anon/.cache/yay/libjxl-git/src/build ++ mktemp -d + local tmpdir=/tmp/tmp.KzdrmODgd3 + CLEANUP_FILES+=("${tmpdir}") + python3 -c 'import numpy' + local build_dir=/home/anon/.cache/yay/libjxl-git/src/build + [[ -z /home/anon/.cache/yay/libjxl-git/src/build ]] + local decoder=/home/anon/.cache/yay/libjxl-git/src/build/tools/conformance/djxl_conformance + /home/anon/.cache/yay/libjxl-git/src/libjxl/tools/conformance/generator.py --decoder=/home/anon/.cache/yay/libjxl-git/src/build/tools/conformance/djxl_conformance --output=/tmp/tmp.KzdrmODgd3 /home/anon/.cache/yay/libjxl-git/src/libjxl/tools/conformance/../../third_party/testdata/jxl/blending/cropped_traffic_light.jxl usage: generator.py [-h] --decoder DECODER --output DIR --peak_error PEAK_ERROR --rmse RMSE JXL [JXL ...] generator.py: error: the following arguments are required: --peak_error, --rmse + retcode=2 <end of output> Test time = 0.31 sec ---------------------------------------------------------- Test Failed. "conformance_tooling_test" end time: Oct 20 17:54 EEST "conformance_tooling_test" time elapsed: 00:00:00 ---------------------------------------------------------- End testing: Oct 20 17:54 EEST ```
2021-10-20 02:56:34
test failin
2021-10-20 06:42:11
<https://github.com/libjxl/libjxl/issues/758> plz fex
eddie.zato
2021-10-22 04:06:18
``` cjxl 0.jpg -j JPEG XL encoder v0.7.0 0c3c093 [SSE4] ./lib/extras/packed_image_convert.cc:125: JXL_ASSERT: io->metadata.m.color_encoding.IsGray() == (frame.color.format.num_channels <= 2) ```
2021-10-22 04:06:31
2021-10-22 04:07:40
Can't encode these images
Jim
2021-10-22 04:15:07
Works fine in 0.6.
eddie.zato
2021-10-22 04:21:40
So, I assume that something was broken after
diskorduser
2021-10-22 04:24:15
Works fine on 0.7.0
eddie.zato
2021-10-22 04:27:10
What commit?
veluca
2021-10-22 04:30:54
can you open a bug?
eddie.zato
2021-10-22 04:31:35
Sure
diskorduser
eddie.zato What commit?
2021-10-22 04:51:22
I have old one. cdd3ae6
eddie.zato
2021-10-22 04:52:49
I think I found the commit ``` cjxl 0.jpg -j JPEG XL encoder v0.7.0 c2266c4 [SSE4,Scalar] No output file specified. Encoding will be performed, but the result will be discarded. Encoding [Container | VarDCT, d1.000, squirrel | 14-byte Exif], 4 threads. Compressed to 1842485 bytes (2.368 bpp). cjxl2 0.jpg -j JPEG XL encoder v0.7.0 86eed13 [SSE4,Scalar] D:\a\libjxl\libjxl\lib\extras\packed_image_convert.cc:125: JXL_ASSERT: io->metadata.m.color_encoding.IsGray() == (frame.color.format.num_channels <= 2) ```
2021-10-22 04:56:57
It's all here https://github.com/libjxl/libjxl/issues/764
veluca
2021-10-22 05:01:45
ah
2021-10-22 05:01:48
that one
2021-10-22 05:01:51
yay...
Eugene Vert
eddie.zato It's all here https://github.com/libjxl/libjxl/issues/764
2021-10-22 07:22:19
Seems like any colorful jpeg after `jpegtran -grayscale` will produce this error
Traneptora
2021-10-22 10:23:35
> >>also probe still fails > >>Failure of jpegxl_pipe probing code with score=51 type=0 p=6B0 size=32 > >What file causes it to fail? > Look at tools/probetest.c its just 3 pages of code. > A feature to dump the failing data to a file would likely be usefull > to others too, if you have time to add that. Thanks, michaelni
2021-10-22 10:23:42
<:Thonk:805904896879493180>
eddie.zato
Eugene Vert Seems like any colorful jpeg after `jpegtran -grayscale` will produce this error
2021-10-23 02:39:27
Added this to the issue
novomesk
2021-10-28 07:51:45
New commits in v0.6.x branch mean that 0.6.1 is coming?
veluca
2021-10-28 07:53:00
likely πŸ™‚
testerrrrr
2021-10-28 06:38:34
would you ever consider adding a jpeg xl format description to kaitai struct? https://kaitai.io
veluca
2021-10-28 07:03:58
that's... huh... probably a significant undertaking
Deleted User
testerrrrr would you ever consider adding a jpeg xl format description to kaitai struct? https://kaitai.io
2021-10-29 09:47:00
That's an interesting thing...
haaaaah
novomesk New commits in v0.6.x branch mean that 0.6.1 is coming?
2021-10-30 12:55:47
Released!
Deleted User
2021-11-09 02:30:21
Is there a reason JPEGXL_MAJOR_VERSION JPEGXL_MINOR_VERSION and JPEGXL_PATCH_VERSION are not exposed in an installed jxl_version.h file (or is there another way for code depending on libjxl to cope with the current frequent API changes) ?
_wb_
2021-11-09 04:26:59
you're supposed to call JxlDecoderVersion / JxlEncoderVersion
Deleted User
2021-11-09 04:27:35
That's not accessible at compile time
_wb_
2021-11-09 04:27:52
getting it from the .h would only work at compile time, which doesn't help if people upgrade/downgrade their libjxl version
2021-11-09 04:29:34
I suppose for the major version we should have something in the .h file, in case you want code to compile for different APIs
Deleted User
2021-11-09 04:29:59
For example JxlEncoderOptionsSetInteger was recently added, however at compile time I don't know if I can actually use it as I have no way to now if the installed libjxl is 0.7+ or not
_wb_
2021-11-09 04:30:23
yes, in 0.x the API is still unstable so that's kind of annoying
Deleted User
2021-11-09 04:31:53
What's worse is I can't even print out a warning message saying you need to install v0.7+
_wb_
2021-11-09 04:32:41
could you maybe open an issue about this and ping deymo and lode in it?
2021-11-09 04:33:14
it's probably something that should be discussed and we need to find a good approach
novomesk
2021-11-09 04:35:48
It would be good to have version number in .h so preprocessor can use #if conditional compilation libavif has it and I can make code which builds across multiple versions.
Deleted User
2021-11-09 04:36:15
I understand once 1.0 is out this theoretically becomes a non issue. But in practice incompatible API signatures are pushed, or new functions are added and that needs to be known at compile time
2021-11-09 04:37:15
I'll open an issue/pr on github with a proposal to generate a jxl_version.h from a jxl_version.h.in
_wb_
2021-11-09 04:37:35
I suppose even after 1.0 we might still want to add new functions and do other non ABI-breaking stuff
2021-11-09 04:40:05
but we need to think about what things should be tested at compile time and what things at runtime, and how to avoid the problem that application devs might test everything at compile time and then there might be unnecessarily strict library version dependencies for packagers
Deleted User
2021-11-09 04:40:51
thanks for the insights, I'll submit to github tomorrow as it's now kid's pickup time
Traneptora
2021-11-10 02:35:40
I noticed libjxl always tries to clone submodules
2021-11-10 02:35:57
is there any way to make it just use system brotli, for example, and skip cloning it?
sebseb
2021-11-10 09:37:39
Hello, where can i find a very simple exemple in c to compresse a image (a char RGB) in jpeg XL?
_wb_
2021-11-10 09:39:23
https://github.com/libjxl/libjxl/blob/main/examples/encode_oneshot.cc
2021-11-10 09:39:48
That one is for float RGB, but uint8 is pretty similar
sebseb
2021-11-10 09:42:57
thanks
Traneptora
_wb_ https://github.com/libjxl/libjxl/blob/main/examples/encode_oneshot.cc
2021-11-10 10:23:22
this is a C++ example
Pigophone
_wb_ https://docs.google.com/document/d/12Gmy2s4Nmkw6VDv2B6b5K1DLYhPrTUqSntrlmYzJpNw/edit?usp=drivesdk
2021-11-12 12:28:35
someone posted this to HN and it is getting some comments https://news.ycombinator.com/item?id=29197083 btw: the document has public suggestions turned on... so maybe turn that off for now... getting defaced...
_wb_
2021-11-12 12:49:01
Turning off public suggestions also makes it impossible for ppl to sign - I wish there was an option to only allow non-anonymous comments...
Deleted User
Pigophone someone posted this to HN and it is getting some comments https://news.ycombinator.com/item?id=29197083 btw: the document has public suggestions turned on... so maybe turn that off for now... getting defaced...
2021-11-12 05:13:15
IMHO <#794206087879852106> channel would be more suitable for such things in the future (since it's not directly related to libjxl and its technical issues), but thanks! And thankfully no one has defaced this letter... yet.
2021-11-12 05:14:45
Another GitLab issue that can be closed, I've just verified it that it's fixed by a recent PR! πŸ˜ƒ https://gitlab.com/wg1/jpeg-xl/-/issues/212
2021-11-12 05:17:15
By the way is there any tag in <:JXL:805850130203934781> to mark a file as 360Β° (since it's render-impacting data) or do we have to resort to Exif (like in good old JPEG)?
_wb_
2021-11-12 06:41:54
360 is signaled in JUMBF I think, and yes it is not quite following our philosophy that it is not codestream-signalled, but we don't want to force all viewers to be able to handle that...
2021-11-12 06:42:35
(since it is not something like orientation that the decoder can hide, but it requires extra user interaction options)
Deleted User
2021-11-12 07:33:55
Yeah, it'd be a bit problematic for a decoder to be able to support decoding e.g. user-selected crops, because that'd require implementing actual 3D sphere β†’ 2D plane converter. Like if there wasn't enough math and logic there already. You've got a point...
_wb_
2021-11-12 07:48:38
JUMBF is how 360 jpegs are signalled afaiu, and adding JUMBF to a jxl is just a matter of adding a `jumb` box to the container
Traneptora
2021-11-12 08:47:52
re: this message
2021-11-12 08:48:01
https://discord.com/channels/794206087879852103/848189884614705192/908649772771078154
2021-11-12 08:48:15
I also get about 3M "possibly lost" when I encode a JXL
2021-11-12 08:49:15
`possibly lost: 3,158,336 bytes in 1 blocks`
2021-11-12 08:49:55
I get the *exact* same amount lost when I `djxl`
2021-11-12 08:49:58
`possibly lost: 3,158,336 bytes in 1 blocks`
2021-11-12 08:52:29
`lenna.png` is 512x512 3-byte RGB
2021-11-12 08:54:01
`512 * 512 * 3 * 4 = 3145728`, which is only 12608, difference, or `64*197`
2021-11-12 08:54:12
which leads me to believe that some buffer is being leaked here
2021-11-12 09:02:25
``` ==92833== 3,158,336 bytes in 1 blocks are possibly lost in loss record 4 of 4 ==92833== at 0x483E7C5: malloc (vg_replace_malloc.c:380) ==92833== by 0x459607: hwy::AllocateAlignedBytes(unsigned long, void* (*)(void*, unsigned long), void*) (third_party/highway/hwy/aligned_allocator.cc:77) ==92833== by 0x1F0D01: MakeUniqueAligned<DefaultMatrices> (third_party/highway/hwy/aligned_allocator.h:108) ==92833== by 0x1F0D01: jxl::DequantMatrices::Compute() (lib/jxl/quant_weights.cc:1146) ==92833== by 0x124CDD: jxl::DequantMatrices::DequantMatrices() (lib/jxl/quant_weights.h:384) ==92833== by 0x124259: jxl::PassesSharedState::PassesSharedState() (lib/jxl/passes_state.h:37) ==92833== by 0x122FF4: PassesDecoderState (lib/jxl/dec_cache.h:31) ==92833== by 0x122FF4: jxl::DecodeFile(jxl::DecompressParams const&, jxl::Span<unsigned char const>, jxl::CodecInOut*, jxl::ThreadPool*) (lib/jxl/dec_file.cc:137) ==92833== by 0x119251: jpegxl::tools::DecompressJxlToPixels(jxl::Span<unsigned char const>, jxl::DecompressParams const&, jxl::ThreadPool*, jxl::CodecInOut*, jpegxl::tools::SpeedStats*) (tools/djxl.cc:178) ==92833== by 0x116C1E: DecompressMain (tools/djxl_main.cc:164) ==92833== by 0x116C1E: main (tools/djxl_main.cc:197) ```
2021-11-12 09:02:28
this is what valgrind reports
2021-11-12 09:21:57
is this just a bug in highway?
_wb_
2021-11-12 09:29:03
I think it's the default quant matrices which get computed when initializing the library and they never get freed
2021-11-12 09:31:10
Dequant matrices get kind of big for big transforms: dct256x256 has 64k coeffs, so that's 256 kb worth of dequant constants already
2021-11-12 09:31:37
And I suppose we have 3 such tables per transform (for x, y and b)
2021-11-12 09:32:50
We probably shouldn't precompute the ones for bigger than 64x64, just compute those only when needed (which currently is never, since the encoder does not use those)
Deleted User
_wb_ JUMBF is how 360 jpegs are signalled afaiu, and adding JUMBF to a jxl is just a matter of adding a `jumb` box to the container
2021-11-12 10:07:52
I guess I've just found a *de facto* standard for that sort of thing... https://developers.google.com/streetview/spherical-metadata
2021-11-12 10:14:30
...which turns out to be the standard used by a bunch of manufacturers, like Google (GCam panorama and 360Β°), Samsung (panorama) and Nikon KeyMission 360Β°. I know because I've just checked them all in ExifToolGUI.
2021-11-12 10:15:18
Is there anyone that actually uses official JPEG 360 (ISO/IEC 19566-6)?
_wb_
2021-11-12 10:30:17
No idea
Pigophone someone posted this to HN and it is getting some comments https://news.ycombinator.com/item?id=29197083 btw: the document has public suggestions turned on... so maybe turn that off for now... getting defaced...
2021-11-13 09:08:13
I shouldn't have gone to sleep keeping suggestions open, lol
2021-11-13 09:32:26
The document had become similar to the '90s website rotten.com
Fraetor
2021-11-13 10:38:42
Might be best to close suggestions for a while.
_wb_
2021-11-13 03:21:44
That's what I did.
XAMPPRocky (she/her)
_wb_ Turning off public suggestions also makes it impossible for ppl to sign - I wish there was an option to only allow non-anonymous comments...
2021-11-14 08:27:07
FWIW, the couple of times I've made an open letter, I've had good success with creating a GitHub repo with just a README. Then people add their names as a pull request. That's enough of a barrier to dissuade vandals.
_wb_
2021-11-14 08:32:15
Ah, that would work. Now they have to request access to the doc, that also works
Vincent Torri
2021-11-16 03:57:42
hello
2021-11-16 03:58:09
i would like to add libjxl to our toolkit, so I play a bit with the API, and more preciselt with jxlinfo.c example that is in the git repo
2021-11-16 03:58:31
i've looked at the jxlinfo.c example and i have a question about the infinite loop afaiu, the infinite loop is to load more image data to get basic info (because fread() is used)
2021-11-16 03:58:49
but if i have the whole file which is already mmap'ed in memory, there is no infinite loop to do, right ?
_wb_
2021-11-16 04:38:38
the infinite loop is also because there might be more than one frame, and jxlinfo gives info on all frames
Vincent Torri
2021-11-16 04:50:24
hooo, ok
2021-11-16 04:50:54
like for animated file, i guess
2021-11-16 04:51:02
thank you
Deleted User
Vincent Torri like for animated file, i guess
2021-11-16 08:21:23
Yes, like for animated file, but also a non-animated one with multiple layers.
_wb_
2021-11-16 08:33:11
For those, the current decode api only returns one frame atm - though I am trying to add a non-coalesced decode option
Vincent Torri
2021-11-17 04:04:37
if the jxl image is in grayscale, can libjxl render the image in RGBA, or must I do it ?
w
2021-11-17 04:05:57
i think that's the only supported conversion
_wb_
2021-11-17 06:12:36
The decoder will turn gray into RGB and add a trivial A channel if needed
Vincent Torri
2021-11-17 12:36:40
and how canI add this A channel ? The toolkit manages only BGRA colorspace
_wb_
2021-11-17 01:21:39
you mean when encoding?
Hello71
2021-11-17 01:35:36
i noticed that converting a jpeg with --strip -d 0 (not -j) then decoding it to ppm produces a slightly different result from libjpeg-turbo djpeg. is the jbrd actually storing some image data, or is the difference due to different IDCT implementations?
diskorduser
2021-11-17 01:39:08
Isn't -d 0 just jxl lossless mode?
improver
2021-11-17 01:40:12
i think thats default on jpeg without -j
fab
Hello71 i noticed that converting a jpeg with --strip -d 0 (not -j) then decoding it to ppm produces a slightly different result from libjpeg-turbo djpeg. is the jbrd actually storing some image data, or is the difference due to different IDCT implementations?
2021-11-17 01:40:23
is different way of quantization jxl uses float32 when you see an image on you pc
improver
2021-11-17 01:40:34
anyways yes different (more precise) idct impl
Hello71
2021-11-17 01:40:51
and along those lines, why does libjxl need the jbrd to reconstruct a jpeg? why can't it make a jpeg using the image data (but obviously with different segments)
fab
2021-11-17 01:40:53
but on smatphone they use idct fast
2021-11-17 01:41:16
but is not implemented this at momenet
2021-11-17 01:41:19
is fo arm achitectue
Hello71
2021-11-17 01:41:26
is jbrd actually required or is this feature just not implemented yet
fab
2021-11-17 01:41:39
i think not required
2021-11-17 01:41:54
idct is only if you do decoding on djxl arm
2021-11-17 01:42:09
and not sure for lossless jpg transcode
improver
2021-11-17 01:42:09
``` --jpeg_transcode_disable_cfl Disable CFL for lossless JPEG recompression ``` i think this is this
2021-11-17 01:42:22
also dont listen to anything fab says
fab
2021-11-17 01:42:39
for lossless jpg transocde on x 86 the only thing that exists is lossless vardct tanscode
2021-11-17 01:42:55
so based on eight pe eight
2021-11-17 01:42:58
8x8
improver
2021-11-17 01:43:59
ah. no. actually `--strip` already excludes reconstruction data
2021-11-17 01:44:11
``` --strip Do not encode using container format (strips Exif/XMP/JPEG bitstream reconstruction data) ```
fab
2021-11-17 01:46:35
https://github.com/libjxl/libjxl/pull/836
improver
2021-11-17 01:48:26
irrelevant.
fab
2021-11-17 01:49:58
yes because he had a lossless error with a comparison
diskorduser
Hello71 and along those lines, why does libjxl need the jbrd to reconstruct a jpeg? why can't it make a jpeg using the image data (but obviously with different segments)
2021-11-17 01:53:21
What about exif and other meta data?
fab
2021-11-17 02:00:13
honestly i have not exif in my jxls images maybe i encoded too ealy i lost all metadata
2021-11-17 02:00:24
o maybe the viewe don't ead them
2021-11-17 02:00:57
i heard nomacs is capable to read them but not sure
2021-11-17 02:03:44
but i don't advice nomacs to watch jxl
Hello71
2021-11-17 02:16:20
i wonder, who actually prefers the exponent notation for max bytes in use?
_wb_
Hello71 is jbrd actually required or is this feature just not implemented yet
2021-11-17 02:25:05
jbrd is required if you want to get the exact same jpeg file. If you only want to have _some_ jpeg file that has the same image data, we could do that without jbrd, but we haven't implemented that (yet). All the actual image data (including the icc profile and exif orientation) is in the jxl codestream, the jbrd only contains things like the scan script, the huffman tables, restart markers, app markers without render impact, padding bits, etc.
Hello71 i wonder, who actually prefers the exponent notation for max bytes in use?
2021-11-17 02:28:39
I would prefer a pretty printed 1853 KB, 45.87 MB, 1.23 GB etc, but I don't care enough about it to implement that
Hello71
2021-11-17 03:46:05
mm. thanks
Vincent Torri
2021-11-17 05:37:10
as highway is out, will we see a new libjxl release soon ?
2021-11-18 06:05:53
what are the pro and cons of skcms and LCMS2 regarding libjxl ?
_wb_
2021-11-18 06:11:55
Afaik, skcms is faster and lcms2 tends to be system-installed
2021-11-18 06:12:29
Maybe there are other pros and cons, <@604964375924834314> do you know?
Vincent Torri
2021-11-18 06:15:24
also, i have seen in decode_oneshot.cc, or in the gdk pixbuf plugin, that the FLOAT pixel format is used. Why not using an integer format ?
_wb_
2021-11-18 06:19:36
Float is more useful for hdr and wide gamut
2021-11-18 06:22:30
Int means you have to use a transfer curve, and you cannot have out-of-range values so gamut clipping is happening implicitly
Vincent Torri
2021-11-18 06:41:37
also useful for a toolkit ?
_wb_
2021-11-18 07:26:50
If you're going to display the image (i.e. still have to convert it to display space), having things in float linear rgb is slightly more efficient and more accurate than having it in e.g. 8-bit ints
Vincent Torri
2021-11-18 07:28:03
ok, thanks
2021-11-18 07:28:14
sorry, i have other questions...
2021-11-18 07:28:17
in decode_oneshot.cc, why isn't the decoding done in JXL_DEC_FULL_IMAGE ?
2021-11-18 07:29:08
the doc says that in JXL_DEC_FULL_IMAGE indicates that the full frame is decoded
_wb_
2021-11-18 07:43:21
yes, if you want the first frame, you could stop at that point
2021-11-18 07:44:03
decode_oneshot decodes all frames and shows the last frame
Vincent Torri
2021-11-18 07:44:54
and for an animated jxl, where should I decode the frame ?
2021-11-18 07:45:21
note that there is a jxl file in github repo which seems to be animated, but there is only 1 frame...
_wb_
2021-11-18 08:04:30
which one?
2021-11-18 08:05:50
anyway, JXL_DEC_FULL_IMAGE happens for every animation frame
Hello71
2021-11-18 02:35:20
https://github.com/libjxl/libjxl/blob/ec30ce72cdb7e4d05e204ff20ed824b00bc9fda1/doc/color_management.md#cms-library says that "The other popular open-source CMS is LittleCMS. It is also used by color-managed editors (Krita/darktable), which increases the chances of interoperability. However, LCMS has race conditions and overflow issues that prevent fuzzing. We will later switch to the newer skcms. Note that this library does not intend to support multiProcessElements, so HDR transfer functions cannot be represented accurately. Thus in the long term, we will probably migrate away from ICC profiles entirely."
Traneptora
Hello71 i noticed that converting a jpeg with --strip -d 0 (not -j) then decoding it to ppm produces a slightly different result from libjpeg-turbo djpeg. is the jbrd actually storing some image data, or is the difference due to different IDCT implementations?
2021-11-18 02:57:16
what if you decode to 24bit packed rgb
2021-11-18 02:57:23
not ppm
2021-11-18 02:57:39
then sha1sum it
2021-11-18 02:57:54
that's what I do
2021-11-18 02:59:59
I run `convert imagefile RGBA:- | sha384sum - | xxd -r -p | base64`
_wb_
2021-11-18 03:45:41
you'll get different results with different jpeg decoders
2021-11-18 03:46:55
`djpeg -dct int` and `djpeg -dct fast` and `djpeg -dct float` all produce different results and they're likely all conforming decoders
2021-11-18 03:51:52
libjxl produces slightly different results compared to default libjpeg-turbo, mostly because 1) it has a different DCT implementation (float, and different from libjpeg-turbo's) 2) in 4:4:4 jpegs, chroma from luma can be used, which leads to somewhat different dequantization 3) DC dequantization is fancier in jxl than in libjpeg-turbo 4) upsampling and YCbCr to RGB is done with floats (instead of doing everything with 8-bit ints like in libjpeg-turbo, which creates more rounding error), conversion to int is only done at the very end
Vincent Torri
2021-11-18 06:30:40
<@!794205442175402004> cropped_traffic_light.jxl <-- info.have_animation is true
_wb_
2021-11-18 06:48:28
And isn't that an actual animation?
Vincent Torri
2021-11-18 06:55:12
<@!794205442175402004> tps: 100/1
2021-11-18 06:55:21
num loops: 0
2021-11-18 06:55:32
time codes: 0
2021-11-18 06:55:41
that's what my program detects
2021-11-18 06:56:11
<@!794205442175402004> it does not seem to be an animated files if num loops is 0
_wb_
2021-11-18 06:57:00
Num loops 0 means infinite looping
Vincent Torri
2021-11-18 06:58:03
but how many frames are they ?
2021-11-18 07:03:33
imho, there should be both the number of frames and a bool to say if it's infinite
2021-11-18 07:03:47
<@!794205442175402004> what do you think of this ?
2021-11-18 07:21:51
i've openedan issue for this
_wb_
2021-11-18 07:46:48
The number of frames is not signaled
2021-11-18 07:47:36
The number of loops is for feature parity with gif/apng/awebp
Deleted User
2021-11-19 11:29:17
Can non-core-devs review PRs like this? https://github.com/libjxl/libjxl/pull/866
2021-11-19 11:33:49
(it's just been merged, but I'm asking for the future)
2021-11-19 11:36:29
Woooooow, that's **a handful** of merged PRs, thanks <@!532010383041363969>! πŸ˜ƒ
_wb_
2021-11-19 12:38:58
Anyone can review pull requests and input from anyone is welcome
2021-11-19 12:39:22
But it needs approval from someone who has write access and other than the one who opened it
2021-11-19 05:25:16
tried to get some issues and pull requests closed today since we had over 100 open issues and over 40 open pull requests
2021-11-19 05:29:51
still quite a lot to go
diskorduser
2021-11-19 06:20:42
Legend
Jyrki Alakuijala
Can non-core-devs review PRs like this? https://github.com/libjxl/libjxl/pull/866
2021-11-19 06:33:20
Such changes are most welcome!
improver
2021-11-19 07:38:33
wondering whether https://gitlab.com/wg1/jpeg-xl/-/issues/215 and https://gitlab.com/wg1/jpeg-xl/-/issues/216 have been fixed
2021-11-19 07:38:41
could test but lazy
_wb_
2021-11-19 07:42:37
If someone can test, that would be good (if it's gone, we can close the gitlab issue, if it's still a problem, best to open a github issue for it too, so we don't forget about it)
Vincent Torri
2021-11-20 05:04:26
in decode_oneshot.cc, in JXL_DEC_NEED_IMAGE_OUT_BUFFER event, I can see : if (buffer_size != *xsize * *ysize * 16). Why *16 and not *4 ?
2021-11-20 05:20:45
nvm, it's because of float in format
2021-11-20 05:38:07
i'm still trying to understand the api and other feature. In gdkpixbuf plugin, it seems that they use a float pixel format, then set a callback, and in that callback, uses skcms to convert float pixel format to bgra, using skcms_Transform
2021-11-20 05:39:19
what is the difference between doing so, and using JXL_TYPE_UINT8 in pixel format ?
2021-11-20 05:39:54
is there a difference in quality ?
2021-11-20 05:40:01
or in speed ?
_wb_
2021-11-20 07:04:58
The difference is that you can do color management and have wide gamut
2021-11-20 07:07:04
If you immediately get uint8 from libjxl (which is an option and could be good enough), then if the image colorspace and display colorspace don't match, you lose precision
2021-11-20 07:09:26
In terms of speed, it depends on the platform: on ARM we have fast paths to produce uint8 output so that will be faster; on x64 probably the float callback is fastest
Vincent Torri
2021-11-20 07:39:50
<@!794205442175402004> so i should follow what the gdk pixbuf code does ?
2021-11-20 07:39:59
(for the toolkit)
_wb_
2021-11-20 07:40:58
That's certainly an option
Vincent Torri
2021-11-20 07:41:41
actually, gdk is more or less like our toolkit
2021-11-20 07:41:53
actually, i want the best option
2021-11-20 07:41:59
πŸ™‚
2021-11-20 07:42:18
our colorspace is BGRA
2021-11-20 08:12:17
<@!794205442175402004> so, is there a better option ?
_wb_
2021-11-20 08:19:22
Not really, afaik. What are the main use cases for your toolkit?
Vincent Torri
2021-11-20 08:29:18
<@!794205442175402004> it's the EFL, similar to QT or GTK
2021-11-20 08:30:41
i want my pet project ( simple image viewer written with the EFL) to support jxl files
_wb_
2021-11-20 08:33:43
Then it's probably a good idea to follow the gdk-pixbuf example, yes
Vincent Torri
2021-11-20 08:40:35
<@!794205442175402004> thank you
2021-11-20 08:43:35
<@!794205442175402004> do you know if there will be a release of libjxl soon ?
_wb_
2021-11-20 08:48:26
I think it might take a while, it could be that the next release will be immediately a 0.99 or 1.0rc1, but we're not there yet
Vincent Torri
2021-11-20 09:14:00
ok
2021-11-20 09:23:15
<@!794205442175402004> there is still this problem of lcms2/skcms
2021-11-20 09:23:39
<@!794205442175402004> is it possible to know, at runtime, if lcms2 or skcms is used ?
_wb_
2021-11-20 09:29:34
By whom?
2021-11-20 09:29:49
Libjxl itself uses neither
Vincent Torri
2021-11-20 09:29:49
with a libjxl API
_wb_
2021-11-20 09:30:01
Cjxl/djxl can be compiled with either
2021-11-20 09:30:22
You can just pick one and use it
Vincent Torri
2021-11-20 09:30:55
ho, the cms libraries are not linked against libjxl ?
_wb_
2021-11-20 09:32:25
No, libjxl does not use cms, it has its own limited cms to synthesize icc profiles and do conversions between enum colorspaces, but it does not do arbitrary icc conversions itself
2021-11-20 09:32:55
(we try to keep dependencies minimal in libjxl)
2021-11-20 09:34:46
We may at some point add a highlevel layer around libjxl that does link to a cms so you get an api where you can pass arbitrary colorspace input to the encoder and get arbitrary output from the decoder (i.e. not just "preferred" colorspace but just a guarantee that you get what you ask for)
2021-11-20 09:35:30
But atm we only have the lowlevel api where the application gets pixels and an icc profile and has to do its own conversion
Vincent Torri
2021-11-20 11:27:01
<@!794205442175402004> and having the less dep for such a library is good, imho
_wb_
2021-11-20 11:28:37
it's the most flexible approach, e.g. in chrome they are already using skcms so it would be bad if libjxl would introduce a dependency on lcms2, while in many linux distros lcms2 is already system-available so it makes sense to depend on that there for cjxl/djxl.
Vincent Torri
2021-11-20 12:24:38
it'snormal, skia is now a google thing
2021-11-20 02:50:51
is it possible to split jave wrapper outside libjxl tree ?
2021-11-20 02:51:53
I know some people, especially archlinux ones, that are reluctant to install libjxl because it installs java stuff
_wb_
2021-11-20 03:04:57
That's optional, no?
2021-11-20 03:05:49
If there's no compile flag to disable that, then such a flag should be added
Vincent Torri
2021-11-20 03:08:40
but archlinux packagers always install everything
2021-11-20 03:09:20
https://github.com/archlinux/svntogit-community/blob/packages/libjxl/trunk/PKGBUILD#L13
_wb_
2021-11-20 03:14:57
I think from a packaging pov, the stuff in the libjxl repo has to be split in multiple packages, e.g. libjxl, libjxl-debug, libjxl-dev, jxl-tools (cjxl, djxl), jxl-extra-tools (benchmark_xl, jxl_from_tree, etc), one for each plugin, etc.
Vincent Torri
2021-11-20 03:16:30
unfortunately, it's not the way the packagers in archlinux are following
2021-11-20 03:23:46
it would be nice if highway dependency could be dropped
2021-11-20 03:24:00
doing like libjpeg-turbo
2021-11-20 04:23:35
i'm still wondering what I have to do in the JXL_DEC_FULL_IMAGE event
2021-11-20 04:24:13
if i'm not mistaken, i should call JxlDecoderSetImageOutBuffer in the JXL_DEC_NEED_IMAGE_OUT_BUFFER event
2021-11-20 04:26:13
but in the JXL_DEC_FULL_IMAGE event, I don't know, especially for animated jxl files