|
_wb_
|
2021-12-15 06:35:37
|
Or does that confuse more than clarify?
|
|
|
improver
|
2021-12-15 06:35:42
|
that would prevent accidental reassignment but would also prevent manual user assignment to nullptr after destroy which can be useful in some situations
|
|
2021-12-15 06:36:28
|
and i think u can just pass it to free anyway
|
|
2021-12-15 06:37:15
|
just document in big letters that jxldestroy is intended to free it and no extra free is needed
|
|
2021-12-15 06:37:54
|
would prob be good idea to mention jxldestroy on constructor's doc too
|
|
|
_wb_
|
2021-12-15 06:43:37
|
Yes, makes sense. This is good feedback btw, we need to improve the API documentation (including example apps)
|
|
|
|
veluca
|
2021-12-15 08:16:06
|
you can pass a `const int* const` to `free()` without any problem whatsoever 🙂
|
|
|
_wb_
|
2021-12-15 08:26:51
|
Yes but you might be less inclined to do it ;)
|
|
|
improver
|
2021-12-15 08:34:23
|
returning `* const` from func makes no sense as it's attribute for function return destination variable, function declaration itself i think can't enforce that, and no, it'd be confusing and pretty poor form of documentation, something what should be just clearly written down
|
|
|
_wb_
|
2021-12-15 08:36:03
|
Agreed, I was talking about using a *const variable in the example apps
|
|
|
|
Hello71
|
|
_wb_
I would expect malloc_usable_size to only work if the pointer points to something allocated by malloc
|
|
2021-12-15 11:58:15
|
ah, yes, for some reason i thought it would work with a pointer to anywhere inside a malloc allocation, but that can't be right
|
|
|
Traneptora
|
2021-12-16 11:36:54
|
as far as I'm aware, JxlDestroy uses the memory manager that was assigned via JxlCreate, right?
|
|
2021-12-16 11:37:01
|
or `free` if there was none
|
|
|
|
Vincent Torri
|
2021-12-17 07:56:25
|
is someone working on https://github.com/libjxl/libjxl/issues/993 ?
|
|
|
_wb_
|
2021-12-17 08:20:56
|
Not afaik
|
|
|
|
Vincent Torri
|
2021-12-18 06:38:56
|
i loose at least 1e-3 s on "big image" because of rgba -> bgra conversion.
|
|
2021-12-18 06:39:02
|
on my computer
|
|
2021-12-18 07:17:50
|
and i have to allocate the image to do the conversion, so it consume more memory than needed
|
|
2021-12-18 07:18:30
|
except opengl or png, BGRA is commonly used
|
|
|
_wb_
|
2021-12-18 07:22:20
|
You can convert in-place, no need to copy
|
|
|
|
Vincent Torri
|
2021-12-18 08:24:45
|
for the saver, i have to
|
|
|
_wb_
|
2021-12-18 08:29:15
|
Ah, I see
|
|
|
|
Vincent Torri
|
2021-12-18 08:59:29
|
well, honestly, for our purposes, time for the saver is not so important
|
|
2021-12-18 08:59:50
|
but loading time is very important
|
|
2021-12-18 09:00:16
|
we use jpeg to create and compress our themes
|
|
2021-12-18 09:00:49
|
so if libjxl is as fast as jpeg, we might consider using it, to have smaller theme files
|
|
2021-12-18 09:02:13
|
we also use jpeg to decompress theme files, so decodeing speed is very importnat
|
|
2021-12-20 01:48:18
|
why not using meson instead of cmake ? you already use a python module (sphinx) so you could also use meson
|
|
2021-12-20 01:48:34
|
also the syntax is so much nicer than cmake
|
|
|
_wb_
|
2021-12-20 03:20:14
|
pros and cons to everything, I guess — feel free to make a pull request to add other kinds of build scripts, I don't have strong opinions on it
|
|
|
|
veluca
|
2021-12-20 03:43:20
|
I do and I think 2 build systems are enough many 😉 (cmake and whatever it is Chrome uses)
|
|
|
spider-mario
|
2021-12-20 04:23:14
|
there is likely a cost to using CMake over Meson, but our impression is that by this stage, much of that cost is sunk
|
|
2021-12-20 04:24:41
|
switching to Meson _might_ take less effort than it took us to get here, but it would still be more than not doing it
|
|
2021-12-20 04:25:10
|
so what it would save us in future cost would have to be greater than that
|
|
|
|
Vincent Torri
|
2021-12-20 05:53:37
|
<@!179701849576833024> 2 build systels is too much, my suggestion is : replacing cmake with meson
|
|
2021-12-20 05:54:48
|
when build system is too complicated, maintaining cmake build system is difficult and requires tricks
|
|
|
BlueSwordM
|
2021-12-20 05:55:03
|
I mean, CMake as it is being used in libjxl is currently fine I believe.
|
|
|
|
Vincent Torri
|
2021-12-20 05:55:33
|
example : https://github.com/libjxl/libjxl/issues/715
|
|
2021-12-20 05:55:39
|
with meson, it just works
|
|
2021-12-20 05:55:46
|
no special code to add
|
|
2021-12-20 05:57:19
|
actually, i think that, anyway, the current build system should be simplified
|
|
2021-12-20 05:57:40
|
there are too many dependencies
|
|
2021-12-20 05:58:13
|
some are bundled and could be used as system too
|
|
2021-12-20 05:58:16
|
some are not
|
|
2021-12-20 05:58:23
|
it's just crazy
|
|
2021-12-20 05:58:40
|
99% of the usage will be on linux
|
|
2021-12-20 05:59:14
|
that is, a package manager will be used
|
|
2021-12-20 05:59:30
|
that is, the system libraries will anyway be used
|
|
|
gnat
|
2021-12-20 05:59:30
|
it just werkz
|
|
|
|
Vincent Torri
|
2021-12-20 05:59:52
|
so my opinion is : forget about bundle dep libs, use system libs
|
|
2021-12-20 06:00:18
|
that's anyway a sane choice
|
|
2021-12-20 06:01:26
|
and the build system will be simplified a lot
|
|
2021-12-20 06:08:22
|
<@!794205442175402004> different topic : about animated jxl file, iirc, you told me that with just JXL_DEC_FULL_IMAGE as subscribed event, the frames will be decoded one after the other. But either my code is wrong (which is most likely the cas, or it is not the case
|
|
2021-12-20 06:08:44
|
I have to use JxlDecoderSkipFrames
|
|
|
|
veluca
|
2021-12-20 06:34:16
|
except you cannot just use system libs, or things like running with memory sanitizer will not work 😉
|
|
|
|
Vincent Torri
|
2021-12-20 06:42:11
|
do you really think that package maintainers will compile with sanitizers support ?
|
|
2021-12-20 06:42:45
|
and sanitizers should be only for libjxl
|
|
2021-12-20 06:42:48
|
so...
|
|
|
|
veluca
|
2021-12-20 06:59:10
|
but we do
|
|
|
|
Deleted User
|
2021-12-20 07:50:30
|
What does the noise stage do?
|
|
|
|
veluca
|
2021-12-20 08:49:11
|
it applies noise 😄
|
|
2021-12-20 08:49:23
|
it doesn't change much, it's a refactor
|
|
|
|
Vincent Torri
|
2021-12-22 08:40:38
|
<@!794205442175402004> hello, did you see my question above ?
|
|
|
_wb_
|
2021-12-22 08:42:23
|
can you share your code?
|
|
|
|
Vincent Torri
|
2021-12-23 06:31:49
|
<@!794205442175402004> https://phab.enlightenment.org/D12311
|
|
2021-12-23 06:33:07
|
<@!794205442175402004> look at the added file evas_image_load_jxl.c, and its line 193
|
|
2021-12-23 06:33:36
|
this function is called each time a new frame should be displayed
|
|
2021-12-23 06:34:16
|
to make it work, i had to add line 274 ( JxlDecoderSkipFrames(decoder, animated->cur_frame);)
|
|
2021-12-23 06:34:40
|
if not, no animation
|
|
|
_wb_
|
2021-12-23 06:36:08
|
Unrelated, but why are you doing `JxlDecoderSetKeepOrientation(decoder, JXL_TRUE);` ?
|
|
2021-12-23 06:38:08
|
Ah, you are starting a new decoder object for each frame?
|
|
2021-12-23 06:38:20
|
That seems not very efficient
|
|
2021-12-23 06:38:32
|
Are you sure there is no way that can be avoided?
|
|
2021-12-23 06:39:34
|
Nevermind, you are avoiding that
|
|
2021-12-23 06:46:39
|
Or aren't you?
|
|
2021-12-23 06:47:17
|
Can you check you're not just re-initializing the jxl decoder for every frame?
|
|
|
|
Vincent Torri
|
2021-12-23 07:59:16
|
<@!794205442175402004> no, i do not start a new decoder for each frame, only if it has not been created (hence the test on the decoder at the beginning
|
|
2021-12-23 07:59:54
|
<@!794205442175402004> about JxlDecoderSetKeepOrientation(), it is said in the doc that it is faster for libjxl
|
|
|
_wb_
|
2021-12-23 08:00:41
|
well it is faster but you don't get a correctly oriented image
|
|
|
|
Vincent Torri
|
|
_wb_
|
2021-12-23 08:01:46
|
I see you have that test, but are you sure these functions end up getting called without destroying the decoder after each frame?
|
|
|
|
Vincent Torri
|
2021-12-23 08:01:50
|
the argument Evas_Loader_Internal *loader is allocated when the module is loaded in mem
|
|
2021-12-23 08:02:01
|
then it is passed to that function
|
|
2021-12-23 08:02:14
|
hmm
|
|
2021-12-23 08:02:16
|
checking
|
|
2021-12-23 08:02:53
|
decoder is detroyed line 417, when module is closed
|
|
2021-12-23 08:02:58
|
at the end
|
|
2021-12-23 08:03:29
|
<@!794205442175402004> btw, can I use the same decoder to display several jxl images ?
|
|
2021-12-23 08:03:54
|
or should I avoid this and use a different decoder for each jxl file ?
|
|
|
_wb_
|
2021-12-23 08:04:13
|
you can use the same decoder for different images
|
|
2021-12-23 08:04:25
|
as long as you reset it between images, of course
|
|
|
|
Vincent Torri
|
2021-12-23 08:04:32
|
ok, so what i'm doing is correct
|
|
2021-12-23 08:04:56
|
ha, reset, ok
|
|
|
_wb_
|
2021-12-23 08:06:15
|
i'm wondering why you need the skipframes, that implies that the decoder is going back to the start each time
|
|
|
|
Vincent Torri
|
2021-12-23 08:07:06
|
if I don't ad it, there is no animation
|
|
2021-12-23 08:07:09
|
add*
|
|
2021-12-23 08:07:42
|
i can remove it again and try again
|
|
2021-12-23 08:15:33
|
compilation takes a lot of time
|
|
|
_wb_
|
2021-12-23 08:25:43
|
maybe instrument the code to do a printf each time you initialize the decoder with the input
|
|
2021-12-23 08:26:11
|
I suspect you might be accidentally giving it the input at each frame
|
|
|
|
Vincent Torri
|
2021-12-23 08:29:46
|
ok
|
|
2021-12-23 08:34:07
|
indeed
|
|
2021-12-23 08:34:19
|
called several times
|
|
2021-12-23 08:34:35
|
there is something wrong in the module behavior
|
|
2021-12-23 08:34:39
|
tanks
|
|
2021-12-23 08:34:41
|
thanks
|
|
2021-12-23 08:34:49
|
i'll have to dig a bit
|
|
2021-12-23 09:06:34
|
arg ! i forgot to set the loader values
|
|
2021-12-23 09:36:35
|
<@!794205442175402004> ok, working, but when i get the last frame, i rewind, right ?
|
|
|
_wb_
|
2021-12-23 09:42:49
|
yes, if you want to decode from the start after last frame
|
|
2021-12-23 09:44:01
|
you rewind and have to set the input again iirc (everything except initializing the decoder object itself)
|
|
|
|
Vincent Torri
|
2021-12-23 09:51:36
|
ok, i will try
|
|
2021-12-23 11:03:36
|
<@!794205442175402004> i have these error messages from libjxl :
|
|
2021-12-23 11:03:50
|
```./lib/jxl/dec_ans.cc:239: JXL_FAILURE: Alphabet size is too long: 130
./lib/jxl/dec_ans.cc:361: JXL_RETURN_IF_ERROR code=1: DecodeANSCodes(num_histograms, max_alphabet_size, br, code)
./lib/jxl/dec_context_map.cc:81: JXL_RETURN_IF_ERROR code=1: DecodeHistograms(input, 1, &code, &dummy_ctx_map, context_map->size() <= 2)
./lib/jxl/dec_ans.cc:348: JXL_RETURN_IF_ERROR code=1: DecodeContextMap(context_map, &num_histograms, br)
./lib/jxl/coeff_order.cc:78: JXL_RETURN_IF_ERROR code=1: DecodeHistograms(br, kPermutationContexts, &code, &context_map)
./lib/jxl/toc.cc:60: JXL_RETURN_IF_ERROR code=1: DecodePermutation( 0, toc_entries, permutation.data(), reader)
./lib/jxl/decode.cc:1139: invalid toc entries
```
|
|
2021-12-23 11:04:02
|
<@!794205442175402004> any idea what i have missed ?
|
|
2021-12-23 11:04:23
|
these msg are for each frame of the animation
|
|
|
_wb_
|
2021-12-23 11:05:54
|
no idea, looks like you are feeding it a corrupted bitstream
|
|
2021-12-23 11:06:18
|
are you sure the input bitstream buffer you give it remains alive long enough?
|
|
|
|
Vincent Torri
|
2021-12-23 11:58:45
|
beside these msg, the animation runs fine
|
|
2021-12-23 11:59:11
|
i'll check
|
|
2021-12-23 03:46:28
|
what is the cjxl PR ? an attempt to have C code and not C++ ?
|
|
2021-12-23 03:47:53
|
or compression part of jxl, actually
|
|
|
_wb_
|
2021-12-23 04:09:27
|
we're eventually going to migrate cjxl and djxl to use the api instead of directly calling stuff
|
|
|
|
Deleted User
|
2021-12-24 03:03:13
|
Is there currently a use case for --resampling in combination with lossless images or you would agree that it is the worst idea for "near" lossless compression?
|
|
|
|
veluca
|
2021-12-24 03:19:19
|
probably not the *worst* one
|
|
|
|
Deleted User
|
2021-12-24 03:22:55
|
But is it useful or would you say that nobody would mind if that feature for (this particular case) would not exist?
|
|
|
|
veluca
|
2021-12-24 03:23:44
|
I wouldn't say it's very useful 😛
|
|
2021-12-24 03:23:57
|
XYB + "lossless" is prob better
|
|
|
|
Deleted User
|
2021-12-24 03:29:35
|
It would be great if --resampling in combination with lossless (RGB) could be repurposed to use integer scaling for decoding so that it is suitable for upscaled pixel art.
|
|
2021-12-24 03:34:40
|
With this behavior, the encoder could reach better compression for such image cases with a simple check.
|
|
2021-12-24 03:40:58
|
Good idea or not?
|
|
|
Fraetor
|
2021-12-24 04:27:45
|
Its not too bad currently. <:JXL:805850130203934781> currently gives a ratio in total corpus size of 1.43 for the size of the compressed 32px images (2.17MiB) vs integer upscaled 256px images (3.12MiB).
Based on a corpus of ~2000 images (John Smith Legacy Minecraft resource pack), and just naively running `cjxl -d0`.
|
|
2021-12-24 04:28:40
|
So it definitely could be improved, but large area's in pixel art don't take up proportionally more bytes.
|
|
|
_wb_
|
2021-12-24 04:35:34
|
A custom upsampling filter can be signaled that does NN, costs some bytes to signal it though
|
|
|
|
Vincent Torri
|
2021-12-25 07:54:31
|
<@!794205442175402004> i have added JXL_DEC_FRAME event to JXL_DEC_FULL_IMAGE and i have no error messages anymore
|
|
2021-12-25 07:54:59
|
so JXL_DEC_FULL_IMAGE alone is not sufficient
|
|
|
_wb_
|
2021-12-25 07:55:42
|
Ah, interesting, I don't know if that's an api bug
|
|
|
|
Vincent Torri
|
2021-12-25 07:56:08
|
at leastit is working
|
|
2021-12-25 07:57:13
|
<@!794205442175402004> do you want my code ?
|
|
2021-12-25 07:58:22
|
i need to factorise it a bit, but otherwise it is good afaics
|
|
|
_wb_
|
2021-12-25 08:03:10
|
Not needed, but maybe you could open an issue on github to ask about dec_full_image not being enough
|
|
2021-12-25 08:04:04
|
I think it's either a documentation bug or an actual bug
|
|
|
|
Vincent Torri
|
2021-12-25 08:09:41
|
ok
|
|
2021-12-25 08:19:45
|
btw, jpeg has quality value as a value bteween 0 and 100
|
|
2021-12-25 08:19:58
|
libjxl has effort between 0 and 7
|
|
2021-12-25 08:20:26
|
but is effort the only way to set quality in libjxl ?
|
|
2021-12-25 08:23:20
|
between 0 and 9, sorry
|
|
|
_wb_
|
2021-12-25 08:25:19
|
Effort is not the way to set quality
|
|
2021-12-25 08:25:31
|
Distance is the way to set quality
|
|
2021-12-25 08:26:25
|
Effort determines how much time you want to give the encoder to hit the target distance as accurately as possible with a file that is as small as possible
|
|
2021-12-25 08:26:49
|
But the target distance is what mainly influences quality (and size)
|
|
|
|
Vincent Torri
|
2021-12-25 08:59:05
|
ok
|
|
2021-12-25 08:59:38
|
'distance' is not very meaningful
|
|
2021-12-25 09:02:48
|
so, if i don't care about encoding speed, are these values correct :
|
|
2021-12-25 09:03:48
|
JXL_ENC_FRAME_SETTING_EFFORT to 1
|
|
2021-12-25 09:04:44
|
JXL_ENC_FRAME_SETTING_DECODING_SPEED to 4 (i care about decoding speed)
|
|
2021-12-25 09:05:04
|
and the quality based on what we pass for quality
|
|
2021-12-25 09:05:11
|
is it ok ?
|
|
2021-12-25 09:13:44
|
also :
|
|
2021-12-25 09:14:27
|
JxlEncoderSetFrameDistance() should be called before or after JxlEncoderFrameSettingsSetOption() ?
|
|
2021-12-25 09:14:42
|
or is the order not important ?
|
|
|
_wb_
|
2021-12-25 09:51:02
|
If you don't care about encode speed, better set effort to 9, more effort produces better files
|
|
2021-12-25 09:51:32
|
Order should not matter for setting distance and other encode options
|
|
2021-12-25 09:52:32
|
Default decode speed of lossy jxl should be good enough, if you explicitly set decoding_speed to max then it will decode even faster but at a cost in both density and quality
|
|
2021-12-25 09:53:41
|
I recommend leaving effort and decode speed at their default values unless you really want to get a different trade-off than the one we think is reasonable
|
|
|
Vincent Torri
'distance' is not very meaningful
|
|
2021-12-25 09:56:38
|
Distance is more meaninful than 'quality'. Zero means no distance, 1 means one unit of just-noticeable-difference, higher distance means more distortion.
'Quality' on a scale from 0 to 100 is misleading since 1) there is no bound on how much distortion you can allow, so the 0 point is very arbitrary, and 2) it makes people think it's some kind of percentage, which it is not.
|
|
|
|
Vincent Torri
|
2021-12-25 10:39:48
|
does effort influence quality ?
|
|
|
_wb_
|
2021-12-25 10:46:16
|
It does in the sense that higher effort makes it more likely that you actually get the distance you requested
|
|
2021-12-25 10:46:51
|
While lower effort has more error margin, you may get something that is better or worse than what you asked for
|
|
|
|
Vincent Torri
|
2021-12-25 11:20:19
|
ok
|
|
2021-12-25 11:20:46
|
there should be precise doc somewhere like this in doc
|
|
|
|
Deleted User
|
2021-12-25 11:52:03
|
you can always just buy the spec 🤑
|
|
|
|
Vincent Torri
|
2021-12-25 12:46:44
|
as a library, there should be doc about how to use it
|
|
2021-12-25 12:47:08
|
otherwise, just throw the lib to trash, as it would just be useless
|
|
2021-12-25 12:58:02
|
<@!794205442175402004> when I say that 'distance' is not meaninful, I mean that the word 'distance' is not meaningful. distance between what and what ?
|
|
|
w
|
2021-12-25 01:15:38
|
i assume distance from the source
|
|
2021-12-25 01:16:32
|
beats quality
|
|
|
Scope
|
2021-12-25 01:18:28
|
https://discord.com/channels/794206087879852103/794206170445119489/882003885521248346
|
|
|
w
|
2021-12-25 01:19:07
|
🤔 what's a viewing distance of 1000 pixels?
|
|
|
Scope
|
2021-12-25 01:20:07
|
From the eye to the display, I guess
|
|
|
w
|
2021-12-25 01:20:11
|
pixels?
|
|
2021-12-25 01:20:31
|
oh that must be including dpi i guess
|
|
|
Scope
|
2021-12-25 01:22:54
|
Yep, because pixels can be different
|
|
|
w
|
2021-12-25 01:23:24
|
as a human i dont normally measure in pixels
|
|
|
spider-mario
|
2021-12-25 01:24:33
|
right, but this comes into play only for setting the d1 point anyway
|
|
|
w
i assume distance from the source
|
|
2021-12-25 01:24:41
|
this is correct
|
|
2021-12-25 01:25:21
|
so d2 ± means that the quality is twice as far away from the original as d1 is, **not** that it’s the same quality if viewed from twice the physical distance
|
|
|
|
Vincent Torri
|
2021-12-25 02:46:57
|
what does these messages could mean ? :
|
|
2021-12-25 02:47:00
|
./lib/jxl/splines.cc:594: JXL_FAILURE: Too many pixels covered with splines
./lib/jxl/dec_frame.cc:425: JXL_RETURN_IF_ERROR code=1: shared.image_features.splines.InitializeDrawCache( frame_dim_.xsize_upsampled_padded, frame_dim_.ysize_upsampled_padded, dec_state_->shared->cmap)
./lib/jxl/decode.cc:1495: decoding frame failed
|
|
2021-12-25 02:52:26
|
i'm wondering if there are not problems with threads
|
|
2021-12-25 02:52:42
|
i add a printf and hop, different messages
|
|
|
_wb_
|
2021-12-25 04:17:01
|
What image are you decoding?
|
|
|
|
Vincent Torri
|
2021-12-25 04:21:08
|
spline in conformance tests
|
|
|
|
veluca
|
2021-12-25 05:44:24
|
ah, that could be a problem
|
|
2021-12-25 05:44:36
|
probably we need to bump up that limit...
|
|
|
|
Vincent Torri
|
2021-12-25 06:21:26
|
maybe my code is wrong
|
|
2021-12-25 06:21:38
|
i don't know what the problem is
|
|
2021-12-25 06:22:03
|
there also could be an interaction somewhere with our toolkit
|
|
|
|
veluca
|
2021-12-25 06:22:15
|
it's probably our fault xD
|
|
|
|
Vincent Torri
|
2021-12-25 06:22:19
|
i test the animation in a simple viewer i wrote
|
|
2021-12-25 06:23:00
|
and when there are some GUI events that are executed, error messages are displayed
|
|
2021-12-25 06:23:27
|
i must be sure that libjxl is thread safe and re-entrant
|
|
2021-12-25 06:24:11
|
other solution is calling SkipFrames as i did initially. It seems to work but is overkill according to <@!794205442175402004>
|
|
2021-12-25 06:52:07
|
btw, do you plan to remove deprecated API when you will release 1.0 ?
|
|
|
_wb_
|
2021-12-25 07:47:39
|
Not sure if it will be removed at 1.0 or later
|
|
|
|
Vincent Torri
|
|
doncanjas
|
2021-12-30 11:58:06
|
I'm encoding a 12899x8611 png using `cjxl input.png output.jxl -q 100 -e 8 -I 1.0 -E 3 --num_threads=12` and doesn't seem to use much cpu, tho it's using aroud 7GB of RAM
|
|
2021-12-30 11:58:14
|
is it worth it to use that many threads per file?
|
|
|
|
veluca
|
2021-12-31 12:16:02
|
yeah it can help
|
|
2021-12-31 12:16:23
|
but tree learning is not parallelized atm
|
|
2021-12-31 12:16:45
|
and it's the slowest part
|
|
|
Traneptora
|
2022-01-01 04:42:36
|
Is there any way to request planar RGB output instead of packed RGB output?
|
|
2022-01-01 04:43:22
|
internally, jpeg xl operates on planes, but libjxl packs it before returning the pixels
|
|
2022-01-01 04:44:23
|
I'm wondering if you could request planar output, i.e. rather than provide one buffer to lay pixels into, you provide an array of buffers, one for each channel in the original Jpeg XL image
|
|
2022-01-01 04:45:06
|
or even better, it would be great if you could ask it for a specific plane
|
|
2022-01-01 04:45:13
|
something like
|
|
|
|
veluca
|
2022-01-01 04:47:10
|
at worst, you can use the "pixel callback" thing
|
|
2022-01-01 04:47:17
|
but AFAIU we don't have a specific planar option
|
|
|
Traneptora
|
2022-01-01 04:51:20
|
```c
uint8_t *red, *green, *blue;
JxlDecoderRequestChannel(decoder, JXL_CHANNEL_RED);
JxlDecoderSetImageOutBuffer(decoder, &format, bar, red);
// decode function calls
JxlDecoderRequestChannel(decoder, JXL_CHANNEL_GREEN);
JxlDecoderSetImageOutBuffer(decoder, &format, bar, green);
// etc.
```
|
|
|
veluca
at worst, you can use the "pixel callback" thing
|
|
2022-01-01 04:51:34
|
that still lays the pixels one scanline at a time packed
|
|
2022-01-01 04:52:04
|
it would make sense since some applications require planar input
|
|
2022-01-01 04:52:17
|
for example, if you're planning on converting to or from YUV after the fact, you usually want planar RGB
|
|
2022-01-01 04:52:33
|
since YUV is almost always planar
|
|
|
|
veluca
|
2022-01-01 04:53:48
|
can you open a feature request issue?
|
|
|
Traneptora
|
2022-01-01 04:54:00
|
I can open an issue for that after lunch, sure
|
|
2022-01-04 01:17:23
|
.. and I forgot to open an issue
|
|
2022-01-05 01:21:10
|
I have a more important issue to open though
|
|
2022-01-05 01:21:18
|
something that bothers me is that libjxl will eat all data you give it
|
|
2022-01-05 01:21:47
|
JXL codestreams can legally have anything appended at the end of them and they are still legal by spec
|
|
2022-01-05 01:24:32
|
If you feed data to libjxl via a `uint8_t *` buffer, it tells you how much it read and how much needs to be fed again
|
|
2022-01-05 01:25:16
|
is there any particular reason libjxl cannot refuse to consume data at the end of the codestream?
|
|
2022-01-05 01:25:31
|
like it will happily just take it all and do nothing with it
|
|
2022-01-05 01:25:51
|
it should report `JXL_DEC_SUCCESS` without consuming all of it
|
|
|
_wb_
|
2022-01-05 03:28:51
|
Maybe open an issue? I agree that there's no reason for it to eat past the end, and I bet it just does that because it probably always just eats all you give it before it even starts processing
|
|
|
190n
|
2022-01-09 08:01:11
|
what's the calculation that cjxl uses to map `-q` to `-d` (or better yet, where in the code is that done)?
|
|
|
_wb_
|
2022-01-09 08:15:59
|
https://github.com/libjxl/libjxl/blob/main/tools/cjxl.cc#L602
|
|
|
190n
|
2022-01-09 06:43:51
|
thanks!
|
|
|
improver
|
2022-01-09 09:53:50
|
```
[100%] Generating C API documentation
/home/anon/Downloads/libjxl-git/src/libjxl/lib/include/jxl/encode.h:813: error: documented empty return type of JxlEncoderInitExtraChannelInfo (warning treated as error, aborting now)
```
....
meanwhile in CMakeLists.txt:
```
set(DOXYGEN_WARN_AS_ERROR "YES")
```
who though it was good idea and why
|
|
2022-01-09 10:09:23
|
anyway made https://github.com/libjxl/libjxl/issues/1080
|
|
2022-01-09 10:09:41
|
in addition to https://github.com/google/highway/issues/497
|
|
|
190n
|
|
_wb_
https://github.com/libjxl/libjxl/blob/main/tools/cjxl.cc#L602
|
|
2022-01-09 10:41:16
|
did i type it in wrong or is that discontinuous at q=30? https://www.desmos.com/calculator/pdjlj3cf2q
|
|
|
_wb_
|
2022-01-09 10:54:25
|
Not intentionally, if it is
|
|
|
spider-mario
|
2022-01-09 10:56:09
|
it seems to be off by 1/6.25 because 2.5⁰ = 1
|
|
2022-01-09 10:56:28
|
subtracting 1/6.25 from the x≤30 case seems to fix it
|
|
2022-01-09 10:57:24
|
so 6.24 instead of 6.4
|
|
|
190n
|
2022-01-09 11:16:15
|
now my calculus brain wants to make it smooth as well
|
|
|
monad
|
2022-01-10 06:21:37
|
this was pointed out before <https://discord.com/channels/794206087879852103/794206170445119489/905841407900651580> <https://discord.com/channels/794206087879852103/794206170445119489/907668255454421023>
|
|
|
190n
|
2022-01-10 07:50:37
|
ah interesting
|
|
|
|
Deleted User
|
|
_wb_
A custom upsampling filter can be signaled that does NN, costs some bytes to signal it though
|
|
2022-01-10 10:35:30
|
Wait, custom upsampling filters?
|
|
|
_wb_
|
2022-01-10 10:36:28
|
the weights used to do 2x, 4x and 8x upsampling can be signaled — atm we always use the defaults
|
|
|
Traneptora
|
|
190n
now my calculus brain wants to make it smooth as well
|
|
2022-01-13 11:45:54
|
I changed what I use for the formula
|
|
2022-01-13 11:46:29
|
```c
/**
* Map a quality setting for -qscale roughly from libjpeg
* quality numbers to libjxl's butteraugli distance for
* photographic content.
*
* Setting distance explicitly is preferred, but this will
* allow qscale to be used as a fallback.
*
* This function is continuous and injective on [0, 100] which
* makes it monotonic.
*
* @param quality 0.0 to 100.0 quality setting, libjpeg quality
* @return Butteraugli distance between 0.0 and 15.0
*/
static float quality_to_distance(float quality){
if (quality >= 100.0) {
return 0.0;
} else if (quality >= 90.0) {
return (100.0 - quality) * 0.10;
} else if (quality >= 30.0) {
return 0.1 + (100.0 - quality) * 0.09;
} else if (quality > 0.0) {
return 15.0 - (59.0 * quality - 4350.0) * quality / 9000.0;
} else {
return 15.0;
}
}
```
|
|
2022-01-13 11:46:54
|
I had the exact same thought, so this is what I am using, which is differentiable at Q=30
|
|
|
190n
|
2022-01-13 06:00:45
|
shouldn't it be 15.0 **+** (59.0 * quality - 4350.0) * quality / 9000.0?
|
|
|
Traneptora
|
2022-01-15 04:38:30
|
yes, it appears so
|
|
|
BlueSwordM
|
2022-01-17 11:43:40
|
Oh, it looks like gflags is now needed <:thonk:855837053862150204>
|
|
2022-01-17 11:44:59
|
This poses a small problem when building libjxl.
|
|
|
|
veluca
|
2022-01-17 11:53:45
|
it's not, it's just needed for tools/
|
|
|
BlueSwordM
|
|
veluca
it's not, it's just needed for tools/
|
|
2022-01-18 12:08:28
|
I know, but it's on by default, so I had to look into the cmakelist to see what to disable <:lul:853492073301540894>
|
|
|
CanadianBacon
|
2022-01-19 02:48:12
|
Anyone else completely unable to build libjxl for wasm32 in the jpegxl-builder docker container?
|
|
2022-01-19 02:48:50
|
```
[128/470] Building CXX object lib/CMakeFiles/jxl_extras-static.dir/extras/enc/jpg.cc.o
FAILED: lib/CMakeFiles/jxl_extras-static.dir/extras/enc/jpg.cc.o
/opt/emsdk/upstream/emscripten/em++ -DJPEGXL_ENABLE_APNG=1 -DJPEGXL_ENABLE_GIF=1 -DJPEGXL_ENABLE_JPEG=1 -DJPEGXL_ENABLE_SJPEG=1 -DJXL_EXPORT="" -D__DATE__=\"redacted\" -D__TIMESTAMP__=\"redacted\" -D__TIME__=\"redacted\" -I../ -I../lib -I../third_party/libpng -I../lib/include -Ilib/include -I../third_party/brotli/c/include -I../third_party/highway -I../third_party/sjpeg/src -fno-rtti -funwind-tables -Xclang -mrelax-all -Xclang -mconstructor-aliases -fno-omit-frame-pointer -O3 -DNDEBUG -O2 -fPIC -fmacro-prefix-map=/jpeg-xl/libjxl=. -Wno-builtin-macro-redefined -Wall -Werror -fmerge-all-constants -fno-builtin-fwrite -fno-builtin-fread -Wextra -Wc++11-compat -Warray-bounds -Wformat-security -Wimplicit-fallthrough -Wno-register -Wno-unused-function -Wno-unused-parameter -Wnon-virtual-dtor -Woverloaded-virtual -Wvla -Wdeprecated-increment-bool -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wfor-loop-analysis -Wgnu-redeclared-enum -Winfinite-recursion -Wliteral-conversion -Wno-c++98-compat -Wno-unused-command-line-argument -Wprivate-header -Wself-assign -Wstring-conversion -Wtautological-overlap-compare -Wthread-safety-analysis -Wundefined-func-template -Wunreachable-code -Wunused-comparison -fsized-deallocation -fno-exceptions -fmath-errno -fnew-alignment=8 -fno-cxx-exceptions -fno-slp-vectorize -fno-vectorize -disable-free -disable-llvm-verifier -DJPEGXL_ENABLE_SKCMS=1 -DJPEGXL_BUNDLE_SKCMS=1 -std=c++11 -MD -MT lib/CMakeFiles/jxl_extras-static.dir/extras/enc/jpg.cc.o -MF lib/CMakeFiles/jxl_extras-static.dir/extras/enc/jpg.cc.o.d -o lib/CMakeFiles/jxl_extras-static.dir/extras/enc/jpg.cc.o -c ../lib/extras/enc/jpg.cc
../lib/extras/enc/jpg.cc:8:10: fatal error: 'jpeglib.h' file not found
#include <jpeglib.h>
^~~~~~~~~~~
```
|
|
|
190n
|
2022-01-19 02:49:55
|
seems like you're missing the libjpeg headers
|
|
|
CanadianBacon
|
2022-01-19 02:50:07
|
I am using the official jpegxl-builder docker
|
|
2022-01-19 02:50:18
|
and /usr/include/jpeglib.h exists
|
|
2022-01-19 02:51:03
|
|
|
|
190n
|
2022-01-19 02:53:09
|
guessing you need `-I/usr/wasm32/include` then
|
|
|
CanadianBacon
|
2022-01-19 02:53:18
|
I'll try that
|
|
|
190n
|
2022-01-19 02:53:31
|
how do you make it cross-compile for wasm32 anyway? i only see instructions for windows and arm
|
|
|
CanadianBacon
|
2022-01-19 02:53:53
|
that would be ```CXX_FLAGS=-isystem\ /usr/wasm32/include``` for the build_and_test task right?
|
|
2022-01-19 02:54:24
|
Here is the doc page for wasm https://github.com/libjxl/libjxl/blob/main/doc/building_wasm.md
|
|
|
Koromaru Korüko
|
2022-01-19 02:55:07
|
<@!164917458182864897> we're trying to follow this, but it doesn't link gif_lib.h jpeglib.h
|
|
2022-01-19 02:55:09
|
https://github.com/libjxl/libjxl/blob/main/doc/building_wasm.md
|
|
2022-01-19 02:55:56
|
both files exist in `/usr/include`
|
|
|
190n
|
|
CanadianBacon
that would be ```CXX_FLAGS=-isystem\ /usr/wasm32/include``` for the build_and_test task right?
|
|
2022-01-19 03:00:59
|
idk what `-i` does but `-I/usr/wasm32/include` would typically be the way to add that to the include path
|
|
|
CanadianBacon
|
|
190n
idk what `-i` does but `-I/usr/wasm32/include` would typically be the way to add that to the include path
|
|
2022-01-19 03:11:43
|
That seems to have fixed it, thank you
|
|
2022-01-19 03:38:22
|
submitted a pull request to document this behaviour
|
|
|
|
Deleted User
|
2022-01-19 11:56:39
|
I also had problems to build libjxl for Squoosh (which also uses Docker), I'll probably try building it once again now, maybe something fixed itself...?
https://github.com/GoogleChromeLabs/squoosh/pull/1136#issuecomment-974329630
|
|
|
Koromaru Korüko
|
2022-01-19 12:58:50
|
<@456226577798135808> https://github.com/libjxl/libjxl/pull/1104
|
|
2022-01-19 12:59:44
|
here, this will probably help, we figured out that you need to explicitly add the `/usr/wasm32/include` directory, for clang++ to actually use it
|
|
|
|
Deleted User
|
|
Koromaru Korüko
here, this will probably help, we figured out that you need to explicitly add the `/usr/wasm32/include` directory, for clang++ to actually use it
|
|
2022-01-19 04:55:45
|
Unfortunately it didn't help. Exactly the same error as here: https://discord.com/channels/794206087879852103/803663417881395200/911330790187597864
|
|
|
Koromaru Korüko
|
2022-01-19 04:55:55
|
hmm
|
|
2022-01-19 04:56:03
|
are you pushing that to the ci.sh file?
|
|
2022-01-19 04:56:40
|
as an enviroment var
|
|
|
|
Deleted User
|
2022-01-19 04:59:27
|
To reproduce:
1. `git clone https://github.com/ziemek99/squoosh.git`
2. `cd codecs/jxl/`
3. Edit `Makefile` to get the latest git version of libjxl:
```diff
diff --git a/codecs/jxl/Makefile b/codecs/jxl/Makefile
index 809a972..274bf65 100644
--- a/codecs/jxl/Makefile
+++ b/codecs/jxl/Makefile
@@ -1,5 +1,5 @@
CODEC_URL = https://github.com/libjxl/libjxl.git
-CODEC_VERSION = v0.5
+CODEC_VERSION = 9f544641ec83f6abd9da598bdd08178ee8a003e0
CODEC_DIR = node_modules/jxl
CODEC_BUILD_ROOT := $(CODEC_DIR)/build
CODEC_MT_BUILD_DIR := $(CODEC_BUILD_ROOT)/mt
```
4. Start Docker (I can give you my command if you have problems).
5. `npm run build`
|
|
|
Koromaru Korüko
|
2022-01-19 05:00:42
|
`CMAKE_FLAGS=-I/usr/wasm32/include BUILD_TARGET=wasm32 emconfigure ./ci.sh release`
this is how we got our compiles
|
|
2022-01-19 05:00:51
|
using the ci.sh interface
|
|
2022-01-19 05:00:56
|
from the docker
|
|
|
|
Deleted User
|
2022-01-19 05:01:35
|
I'm not using `./ci.sh` at all, it's all abstracted away by `npm run build` from Squoosh project.
|
|
|
Koromaru Korüko
|
2022-01-19 05:01:47
|
hmm
|
|
2022-01-19 05:02:15
|
idk how <@!281115117884801025> got the squoosh build, idk if we just copied it from the squoosh lib repo, or if we managed to compile it
|
|
|
|
Deleted User
|
2022-01-19 05:04:02
|
As you can see in a diff above, it's probably because you've got an older version. In Squoosh libjxl is stuck at v0.5.
|
|
2022-01-19 05:05:08
|
v0.6.1 works, too, but it doesn't have a bugfix my PR is reliant on, so I have to use the latest git, which fails.
https://github.com/GoogleChromeLabs/squoosh/pull/1136#issuecomment-974329630
|
|
|
Koromaru Korüko
|
2022-01-19 05:11:34
|
1 question, do you know if squoosh uses the default wasm build of jxl?
|
|
2022-01-19 05:11:43
|
just with a custom module wrapper?
|
|
2022-01-19 05:12:06
|
because if thats so, you can just use the docker to get your build, and drop in replace the .wasm
|
|
|
|
Deleted User
|
2022-01-19 05:13:43
|
The thing is I don't know a shit about their building systems. I only wanted to make a simple PR involving just a few lines of code, not deal with the whole Docker and Makefile BS... ;_;
|
|
|
Koromaru Korüko
|
2022-01-19 05:14:02
|
yea...
|
|
2022-01-19 05:14:08
|
i'll try doing some tests
|
|
2022-01-19 05:14:25
|
*when <@!281115117884801025> gets up
|
|
2022-01-19 05:14:34
|
and see if the docker build can be used
|
|
|
|
Deleted User
|
2022-01-19 05:26:07
|
Would you like to try doing the same thing as I did and see if you get the same error?
|
|
|
Koromaru Korüko
|
2022-01-19 05:26:20
|
nope, because for that i would need to install node
|
|
2022-01-19 05:26:25
|
and i dont really want to DX
|
|
2022-01-19 06:07:22
|
in short no, squoosh adds a some extra code to the wasm
|
|
2022-01-19 06:07:35
|
so you'll just have to try and get the node build to work
|
|
|
CanadianBacon
|
2022-01-19 06:59:18
|
<@456226577798135808>
|
|
2022-01-19 06:59:24
|
skcms can be found at https://skia.googlesource.com/skcms/
|
|
2022-01-19 07:09:06
|
Koromaru said it could be helpful
|
|
2022-01-19 07:23:05
|
I believe I've gotten it to build with version 0.6.1 of libjxl
|
|
2022-01-19 07:23:14
|
I'm going to test it out
|
|
2022-01-19 07:52:55
|
and more debugging
|
|
2022-01-19 09:55:43
|
I believe I've finally found a solution
|
|
2022-01-19 09:55:44
|
one more build
|
|
2022-01-19 10:02:15
|
HOLY FRIG IT BUILT
|
|
2022-01-19 10:02:34
|
<@456226577798135808> I got libjxl v0.6.1 under squoosh to finally build
|
|
2022-01-19 10:11:40
|
This took an embarrassing amount of time, but here it is https://github.com/CanadianBaconBoi/squoosh/blob/dev/codecs/jxl/Makefile
|
|
2022-01-19 10:21:46
|
Another issue, going to push a fix
|
|
2022-01-19 11:03:12
|
<@456226577798135808> It built, both the encoder and decoder wasm/js files are there with version 0.6.1
|
|
2022-01-19 11:03:27
|
you should be able to change the revision in the Makefile to whatever version of libjxl you need
|
|
|
|
Deleted User
|
2022-01-20 06:09:35
|
Now it also errors out on the latest git, but later...
|
|
2022-01-20 06:11:06
|
|
|
2022-01-20 06:12:35
|
So it kinda... helped? At least we're closer, I think...
|
|
|
CanadianBacon
|
2022-01-20 06:28:46
|
the parameters taken in by EncodeFile seem to have changed
|
|
2022-01-20 06:28:57
|
I would try to retrofit the existing data for the new function
|
|
2022-01-20 06:30:17
|
The main issue with building anything past 0.5.0 was the missing libskcms
|
|
2022-01-20 06:30:36
|
and i had already fixed a similar issue with the upgrade to 0.6.1
|
|
2022-01-20 06:32:10
|
https://github.com/CanadianBaconBoi/squoosh/blob/fd6b17b9fe52fb45a976079f890c1ea21f6df089/codecs/jxl/enc/jxl_enc.cpp#L101
|
|
2022-01-20 06:32:14
|
issue is at this line
|
|
2022-01-20 06:32:51
|
are you trying to use revision `9f544641ec83f6abd9da598bdd08178ee8a003e0`? <@456226577798135808>
|
|
2022-01-20 06:34:30
|
The new method signature is
```cxx
Status EncodeFile(const CompressParams& cparams_orig, const CodecInOut* io,
PassesEncoderState* passes_enc_state, PaddedBytes* compressed,
const JxlCmsInterface& cms, AuxOut* aux_out,
ThreadPool* pool)
```
|
|
2022-01-20 06:35:03
|
so calling
```cxx
EncodeFile(cparams, &io, &passes_enc_state, &bytes, /*aux=*/nullptr, pool_ptr)
```
inside of jxl_enc.cpp is now invalid
|
|
2022-01-20 06:37:59
|
```cxx
EncodeFile(cparams, &io, &passes_enc_state, &bytes, /*[[CMS]]=*/nullptr, /*aux=*/nullptr, pool_ptr)
```
Would be the new way to call it, of course assuming you have `cms` of type `JxlCmsInterface&`
|
|
2022-01-20 06:38:25
|
because nullptr cannot be cast to JxlCmsInterface&
|
|
2022-01-20 06:53:30
|
This snippet here is the type definition and is what needs to be passed to EncodeFile
https://github.com/libjxl/libjxl/blob/a52d5784c673b1954e19bd1516e72aaba71a799a/lib/include/jxl/cms_interface.h#L133-L224
|
|
2022-01-20 06:55:45
|
Oh
|
|
2022-01-20 06:55:51
|
I found out how to do heh
|
|
2022-01-20 06:56:02
|
One second, I'm going to try to build
|
|
2022-01-20 07:09:25
|
turns out there is a default cms at `jxl::GetJxlCms()` inside of "lib/jxl/enc_color_management.h", so I'm just going to change the use of EncodeFile from
```EncodeFile(cparams, &io, &passes_enc_state, &bytes, /*aux=*/nullptr, pool_ptr)```
to
```
#include "lib/jxl/enc_color_management.h"
...
EncodeFile(cparams, &io, &passes_enc_state, &bytes, /*cms=*/nullptr, /*aux=*/jxl::GetJxlCms(), pool_ptr)
```
|
|
2022-01-20 07:14:05
|
It now builds
|
|
2022-01-20 07:22:01
|
You may find these changes at https://github.com/CanadianBaconBoi/squoosh/ on the dev branch
|
|
2022-01-20 07:26:24
|
Version supported is libjxl rev.9f544641ec83f6abd9da598bdd08178ee8a003e0 (aka current latest)
|
|
2022-01-20 07:29:32
|
<:Smile:428375414847700993>
|
|
2022-01-20 08:57:29
|
Tested, builds and works
|
|
|
|
Deleted User
|
|
CanadianBacon
Tested, builds and works
|
|
2022-01-20 04:44:15
|
HOOOOLYYYY SHIIIIIIT IT FUCKING WORKS NOW
|
|
2022-01-20 04:44:24
|
AFTER MONTHS OF DESPAIR
|
|
2022-01-20 04:44:38
|
https://github.com/GoogleChromeLabs/squoosh/pull/1136
|
|
2022-01-20 04:46:07
|
I cherry-picked some of your commits to this PR's branch (as you can see in the link above) and did some Git magic in order to avoid unnecessary compiled version being stored and obscuring the history.
|
|
2022-01-20 04:47:56
|
Don't worry, you still get the credit. GitHub shows "**CanadianBaconBoi** authored and **ziemek99** committed" because of those intermediate compiles being stripped, same in Git.
|
|
2022-01-20 04:49:51
|
You can test the (hopefully final) version here. Check out "Alternative lossy mode" checkbox (which enables lossy Modular) and "Noise synthesis" slider (WHICH FINALLY WORKS IN BOTH MODES!)
https://deploy-preview-1136--squoosh.netlify.app/
|
|
|
CanadianBacon
|
2022-01-20 05:01:15
|
Alright, glad I could help out 😸
|
|
|
|
Deleted User
|
2022-01-20 05:01:58
|
Wait, are you on Keybase?
|
|
|
CanadianBacon
|
2022-01-20 05:02:02
|
Yes I am
|
|
|
|
Deleted User
|
2022-01-20 05:02:21
|
So am I 😉
|
|
|
Koromaru Korüko
|
|
CanadianBacon
|
2022-01-20 05:20:16
|
le followed
|
|
|
Scope
|
2022-01-20 08:39:35
|
Hmm, when compiling the c(d)jxl_ng version (for Windows), not all the required libs are statically linked by default, like brotli (even in dev-auto builds) and Gflags
|
|
|
_wb_
|
2022-01-20 08:48:32
|
probably need to change the default for windows to do static linking then, dynamic linking is inconvenient in windows afaiu
|
|
|
Scope
|
2022-01-20 09:07:33
|
And, as I already said, there is something wrong with the encoding speed in the official Windows builds
|
|
|
Fraetor
|
2022-01-21 04:15:34
|
I've been abusing :jxl: today and have been testing out creating images with ludicrous dimensions.
I noticed two things that may be issues, but I just want to check that they are in spec before I open any issues on GitHub.
The first thing was that attempting to encode a one by one billion (10^9) pixel tall ppm image with cjxl immediately fails with the error ILLEGAL INSTRUCTION, pointing to line 94 of /lib/jxl/image.cc. This is different from the the case of a hundred million tall image, which try to encode it, and then gets killed after a while when it runs out of memory.
I actually managed to get that image to encode with an effort of 1 and creating a 100GiB swapfile, but then it wouldn't decode, instead saying that it "Failed to decode to pixels." I managed to get a million pixel tall image to decode fine. I've attached the 100,000,000 pixel tall image below, so you can have a go at decoding it yourself.
|
|
2022-01-21 04:16:03
|
|
|
2022-01-21 04:16:51
|
All the images were created from ppm files that I handmade with dd.
|
|
|
_wb_
|
2022-01-21 05:56:30
|
interesting exercise, i'm sure you'll hit all kinds of implementation limitations
|
|
|
Fraetor
|
2022-01-21 06:54:32
|
Its quite interesting watching how the memory usage varies throughout the encode process. This image was encoded with the default, so VarDCT. I'll have a go later with modular and see how that effects it.
|
|
|
_wb_
|
2022-01-21 06:58:53
|
probably atm fjxl can get the largest images encoded
|
|
|
Fraetor
|
|
_wb_
probably atm fjxl can get the largest images encoded
|
|
2022-01-21 07:29:03
|
Does fjxl support the container then, given that is required to go above level 5 of the specification?
|
|
|
_wb_
|
2022-01-21 07:29:50
|
it doesn't, it will just write a codestream that is technically not compliant until you put it in a container with a level 10 jxll box
|
|
2022-01-21 07:30:18
|
but the libjxl decoder doesn't check the level anyway so it doesn't really matter atm
|
|
|
Fraetor
|
2022-01-21 07:34:12
|
I'll give it a go then.
|
|
|
_wb_
|
2022-01-21 07:39:47
|
to get a large image decoded, it's probably best to use your own version of decode_oneshot, one that doesn't decode to float but to uint8, or even better, avoids the decode buffer and uses the pixel callback
|
|
|
Fraetor
|
2022-01-21 07:40:58
|
I'll have a go at hacking that together. Also I'm going to need a bigger swapfile for cjxl modular e 1. ~130GiB is not enough memory, lol.
|
|
|
_wb_
|
2022-01-21 07:41:08
|
then if you do things in a single thread, if groups aren't permuted (which fjxl doesn't do), you should be able to decode strips of width x 256 and write them to disk without having it all in memory
|
|
2022-01-21 07:41:24
|
cjxl modular is a mess
|
|
2022-01-21 07:42:34
|
it converts the input first to 32-bit float, then to 32-bit int, then collects 64-bit tokens, so minimal memory must be something like 96 bits * number of channels * number of pixels
|
|
2022-01-21 07:43:03
|
which is pretty clearly not the optimal thing to do, lol
|
|
|
Fraetor
|
2022-01-21 07:43:23
|
I thought your estimate of only 12x raw size (on github) was a bit far from what I was seeing.
|
|
2022-01-21 07:43:46
|
Ah well, something to optimise later.
|
|
2022-01-21 07:46:14
|
In theory, I'd like to be able to get libjxl decoding an image of the full 2^40 pixels, just to prove it can be done. I'll need a lot more swap for that though, as its about 3 TB of data (assuming 3 channel 8 bit).
|
|
2022-01-21 07:46:46
|
But decoding in in strips is definitely the way to go with that.
|
|
|
_wb_
|
2022-01-21 08:02:46
|
well 96 bits is 12x 8 bits — but that's just a lower bound, probably it uses memory for other stuff too
|
|
|
|
Deleted User
|
|
Fraetor
In theory, I'd like to be able to get libjxl decoding an image of the full 2^40 pixels, just to prove it can be done. I'll need a lot more swap for that though, as its about 3 TB of data (assuming 3 channel 8 bit).
|
|
2022-01-22 07:00:31
|
||*~~just buy 4 TB of RAM~~*|| <:HaDog:805390049033191445>
|
|
|
Koromaru Korüko
|
2022-01-22 11:16:32
|
<@!794205442175402004> how do you feel about me implementing a wasm_extras directly into libjxl?
currently there is no easy way of using libjxl without building ontop of it.
it would only be built when using emscripten.
my plan is to export a few common use case functions, such as decode and encode
then slowly expanding it from there exposing more of the library.
|
|
2022-01-22 11:18:09
|
I ask because I'm going to make it anyway and making all the extra files just to properly incorporate the library is annoying, and I could skip that step.
also since libjxl currently doesn't export via emscripten anything on its own, building it as a standalone for the web is currently useless.
|
|
|
|
veluca
|
2022-01-22 11:23:01
|
if you know how to do it, more than welcome I'd say
|
|
|
_wb_
|
2022-01-22 11:23:39
|
Agreed
|
|
|
Koromaru Korüko
|
2022-01-22 11:23:42
|
excellent
|
|
2022-01-22 11:24:43
|
for now im just going to export a quick and dirty solution, so i can test, and then as i go ill refine and make try to gear the build system to build only what's necessary
|
|
|
_wb_
|
2022-01-22 11:27:15
|
Not sure what the use cases for the wasm build really are tbh, besides squoosh... I guess polyfill? But I doubt it makes sense to do polyfill instead of using fallback jpg/png...
|
|
|
Koromaru Korüko
|
2022-01-22 11:29:57
|
well currently me and <@!281115117884801025> are using it to convert jxl to png on the client
|
|
2022-01-22 11:30:03
|
using a modified version of libsquoosh
|
|
2022-01-22 11:30:17
|
that way we can serve only jxl and have all clients support it
|
|
2022-01-22 11:31:08
|
so far the preformance isn't that bad for our application, roughly
400ms on desktop and 800-1000ms on a mid-ranged phone
|
|
2022-01-22 11:31:32
|
which is fine, since we're serving only 1 jxl image per page, at most
|
|
|
|
veluca
|
2022-01-22 11:31:41
|
do you know if that's with wasm-simd?
|
|
|
Koromaru Korüko
|
2022-01-22 11:32:11
|
its without
|
|
2022-01-22 11:32:41
|
my main issue with this method is, iv'e seen that jxl has a JXLToJPEGDecoder
|
|
2022-01-22 11:32:49
|
libsquoosh doesn't do that
|
|
2022-01-22 11:32:59
|
and ontop of that, it decodes directly into a float based buffer
|
|
2022-01-22 11:33:10
|
so we can easily hit memory issues
|
|
|
|
veluca
|
2022-01-22 11:33:12
|
mhhh I see - have to say we never tried to optimize for that in any way, so I wonder how much we could gain there
|
|
2022-01-22 11:33:23
|
ah, right, I wrote that code before we had the pixel callback
|
|
|
Koromaru Korüko
|
2022-01-22 11:33:37
|
im thinking of making the default decoder use just uint8 or uint16 buffers
|
|
2022-01-22 11:33:57
|
and later on, making it dynamic to image size, if possible
|
|
|
|
veluca
|
2022-01-22 11:33:59
|
the best thing would be using the pixel callback and writing to a uint8 buffer after calling skcms, I think
|
|
|
Koromaru Korüko
|
2022-01-22 11:34:12
|
because after any given size a loss of quality isn't that dramatic
|
|
2022-01-22 11:34:30
|
im hoping to avoid skcms
|
|
2022-01-22 11:34:38
|
and returning the result as a text blob
|
|
|
|
veluca
|
2022-01-22 11:34:48
|
ah you're encoding to PNG right?
|
|
|
Koromaru Korüko
|
2022-01-22 11:35:08
|
probably, i have to dig around a bit more too see
|
|
2022-01-22 11:35:24
|
but from what i know, browsers support blobs of png, jpeg and gif
|
|
2022-01-22 11:35:33
|
with partial support for webp
|
|
|
|
veluca
|
2022-01-22 11:35:40
|
then yes, 8bit uint buffers are probably good enough -- don't forget to pass the ICC to the (png/jpeg/...) encoder though!
|
|
|
Koromaru Korüko
|
|
_wb_
|
2022-01-22 11:43:48
|
What are you using for png encode? If it's just to show the image, you could consider doing (almost) uncompressed png
|
|
2022-01-22 11:44:23
|
Otherwise the png encode can be more expensive than jxl decode
|
|
|
CanadianBacon
|
2022-01-22 11:45:31
|
uncompressed png
|
|
|
Koromaru Korüko
|
2022-01-22 11:47:35
|
libsquoosh converts from RGBA_ffff to RGBA\_8888
|
|
2022-01-22 11:47:42
|
before returning it
|
|
|
_wb_
|
2022-01-22 11:50:35
|
What is RGBA_ffff? 16-bit?
|
|
|
Koromaru Korüko
|
|
_wb_
|
2022-01-22 11:51:45
|
Ah it's an skcms format enum value, ok
|
|
2022-01-22 11:52:12
|
0xf is 15 so that's confusing to me
|
|
|
Koromaru Korüko
|
2022-01-22 11:53:04
|
no, currently libsquoosh converts using float buffers, then converts it 8-bit
|
|
2022-01-22 11:54:02
|
then it just pushes the 8-bit data to the underlying ImageData class and returns that.
|
|
|
_wb_
|
2022-01-22 11:54:04
|
Ah the f is for float
|
|
|
Koromaru Korüko
|
2022-01-22 11:54:08
|
yup
|
|
2022-01-22 11:54:17
|
i would like to avoid this
|
|
|
_wb_
|
2022-01-22 11:54:29
|
Full float buffer is a bit large, yes
|
|
|
|
veluca
|
2022-01-22 11:54:34
|
if you are transcoding to png that's easy yes
|
|
2022-01-22 11:54:50
|
if you aren't, you need to use the pixel callback, but since you are... 😛
|
|
|
Koromaru Korüko
|
2022-01-22 11:54:50
|
because not iterating over all the data, and clamping it would add a little bit of speed, and ontop of that ram is a big issue on mobile devices
|
|
2022-01-22 11:55:18
|
i still don't know if i will decode to png or jpeg
|
|
2022-01-22 11:55:26
|
as it stands i will try and take jpeg over png
|
|
2022-01-22 11:55:36
|
because transcoding should be faster, then flat decoding
|
|
|
|
veluca
|
2022-01-22 11:55:45
|
I mean also if you're transcoding to jpeg 😛
|
|
|
_wb_
|
2022-01-22 11:55:52
|
Pixel callback does it in smaller chunks, so you can get float precision to pass to color management and convert to display 8-bit yourself - but I dunno if you can tell what the displau space is
|
|
|
Koromaru Korüko
|
2022-01-22 11:56:17
|
ill add that as a note, and look into it later
|
|
|
|
veluca
|
2022-01-22 11:56:19
|
IIRC there's no colorspace support in canvas either way
|
|
|
Koromaru Korüko
|
2022-01-22 11:56:34
|
for now I just want to get the build system set up, and the files included correctly
|
|
|
|
veluca
|
2022-01-22 11:56:43
|
so "transcode to PNG and copy the ICC" is likely the safest bet
|
|
|
_wb_
|
|
Koromaru Korüko
|
2022-01-22 11:56:59
|
and then a basic decode func and encode func for the time being
|
|
|
_wb_
|
2022-01-22 11:57:32
|
We should get dithering in libjxl though, when decoding to 8-bit. Cannot do it at the application level when decoding to 8-bit...
|
|
|
|
veluca
|
2022-01-22 11:58:02
|
pixel callback and dither there?
|
|
|
_wb_
|
2022-01-22 11:58:28
|
Yes, it can be done, but it's less convenient
|
|
2022-01-22 11:59:30
|
Also: do we actually return wide gamut in the right colorspace when decoding to 8-bit? Or is it always returning sRGB in the 8-bit case?
|
|
|
|
veluca
|
2022-01-22 12:00:33
|
no idea... I think right colorspace but not certain
|
|
|
Koromaru Korüko
|
2022-01-22 04:28:46
|
i belive i have the fist working compile
|
|
2022-01-22 04:29:40
|
however I had to do what i would call a hack to get emscriptons linker to work.
if we update to cmake 3.13+ i could revert this however.
|
|
2022-01-22 04:30:54
|
|
|
2022-01-22 04:31:20
|
yep got the first part done, the build system can now export emscripton bindings
|
|
2022-01-22 04:32:09
|
<@!794205442175402004>
could this cause problems with any other builds
|
|
2022-01-22 04:32:46
|
its only ran in an include file, which is then only included when JPEGXL_EMSCRIPTEN is true
|
|
2022-01-22 04:33:13
|
also i had to disable -fno-rtti when building for wasm now, because emscripton wont allow bindings with it enabled
|
|
|
_wb_
|
2022-01-22 04:36:28
|
I have no clue, pinging <@811568887577444363> and <@179701849576833024> who know better than me
|
|
|
|
veluca
|
2022-01-22 04:51:13
|
I think it should be fine
|
|
2022-01-22 04:51:15
|
but not sure
|
|
|
Koromaru Korüko
|
2022-01-22 07:25:19
|
|
|
2022-01-22 07:25:21
|
got it working
|
|
2022-01-22 07:26:01
|
took around 100ms on a 620x472 to png 8-bit rgba
|
|
2022-01-22 07:40:26
|
having the thread fight over the decoder, seems to make 1 image decode roughly 400ms after the first
|
|
2022-01-22 07:43:22
|
testimage2 is a 117 byte files, 1000x1000 generated during decode
testimage1 is the original 620x472 that's just being decoded
|
|
2022-01-22 07:43:56
|
so first time warm up is around 30-40ms
|
|
2022-01-22 07:44:14
|
with the understanding that the webassembly is properly compiled after its first use
|
|
2022-01-22 07:44:36
|
i'd say thats viable for realtime non-native decoding
|
|
2022-01-22 08:24:19
|
I've made a fork, and will continue working on this tomorrow I'm a little burnt out.
https://github.com/KoromaruKoruko/libjxl/commit/4b7d5955eb5baccca024f09450ba3af9302a10e4
|
|
2022-01-22 08:25:02
|
mind some of the old comments, that seem meaningless to pointless.
|
|
|
eustas
|
|
_wb_
I have no clue, pinging <@811568887577444363> and <@179701849576833024> who know better than me
|
|
2022-01-23 03:12:50
|
will take a look on Tuesday
|
|
|
perk
|
2022-01-23 12:30:09
|
When I try to encode lossy modular with `-e9 -m -q 90` I get `[Modular, Q93.01, tortoise]` , and when I change -q to -Q I get `[Modular, Q90.00, tortoise]` . In varDCT mode both -q 90 and -Q 90 give me d1. Can someone explain the difference between the q's ? The help docs were unclear.
|
|
|
|
veluca
|
2022-01-23 12:34:07
|
I suspect in vardct mode -Q anything will give you -d 1 (i.e. it's unused)
|
|
2022-01-23 12:34:52
|
-Q applies only to modular, -q applies to both and tries to roughly match the equivalent libjpeg quality IIRC
|
|
|
perk
|
2022-01-23 12:40:21
|
You're right about -Q and vardct. I still don't understand why modular q is defined differently? does that mean modular Q93.01 matches vardct Q90 (which matches d1 and/or libjpeg q90)?
|
|
|
|
veluca
|
2022-01-23 12:49:31
|
modular-Q is pretty unrelated to libjpeg-q
|
|
2022-01-23 12:49:53
|
-q doesn't actually *do* anything, it just sets either -d or -Q
|
|
|
perk
|
2022-01-23 12:54:55
|
okay I think I get it, vardct doesn't have Q and Modular doesn't have d, so q tries to map the same quality to whichever method you use? Is there a reason modular doesn't have -d?
|
|
|
|
Deleted User
|
|
perk
okay I think I get it, vardct doesn't have Q and Modular doesn't have d, so q tries to map the same quality to whichever method you use? Is there a reason modular doesn't have -d?
|
|
2022-01-23 01:24:36
|
> Is there a reason modular doesn't have -d?
Because Butteraugli isn't as much baked into Modular as it is into VarDCT (which literally revolves around it).
|
|
|
w
|
2022-01-23 01:26:53
|
why isnt butteraugli baked into modular as it is into vardct
|
|
|
|
Deleted User
|
2022-01-23 01:36:32
|
Because XYB, the color space Butteraugli operates in, is VarDCT's native color space.
|
|
|
_wb_
|
|
w
why isnt butteraugli baked into modular as it is into vardct
|
|
2022-01-23 02:05:26
|
Mostly because of historical reasons: vardct originates from pik, made by the same team that made butteraugli; modular originates from fuif/flif, which was originally made for just lossless (and that's still its main strength), so perceptual optimization was never really done with it
|
|
2022-01-23 02:06:55
|
Modular's Q is just a quantization setting, no attempt is made to be visually consistent like in VarDCT's d
|
|
2022-01-23 02:07:50
|
Though lossy modular does by default use XYB too now, so it might be somewhat perceptually optimized just by virtue of using that colorspace
|
|
|
Koromaru Korüko
|
2022-01-28 04:54:41
|
much progress
|
|
2022-01-28 04:54:56
|
much more to go though
|
|
2022-01-30 01:48:29
|
<@!794205442175402004> do you have anything aginst me adding Getter Setter functions to most of the Structs,
as emscripten doesn't seem to allow me to substitute the getter and setter, with any function outside of the actual struct itself.
it likly depends on a thiscall.
|
|
2022-01-30 01:57:13
|
its either, that, or I wrap almost all structs inside another struct.
which shouldn't be that bad, but it isn't exactly the best.
in short, it would slow down all calls from the js frontend.
by effectively making each call
```js
let val = MyClass.member
```
into
```c++
struct WasmMyClass : MyClass
{
decaltype(MyClass::member) member_Getter() { return this->member; }
void member_Setter(decaltype(MyClass::member) value) { this->member = value; }
}
```
|
|
2022-01-30 01:58:07
|
which on that side, isn't bad, but pushing from c++ to js
would require me to constantly cast from MyClass to WasmMyClass
|
|
2022-01-30 01:58:47
|
which would make maintainability and creating of new structs extremely annoying.
|
|
|
Traneptora
|
2022-01-30 01:59:43
|
can you use dynamic JS for this?
|
|
2022-01-30 01:59:51
|
JS being a dynamic language could allow you to make that work
|
|
2022-01-30 02:00:45
|
it's called ECMA6 Proxies
|
|
2022-01-30 02:00:51
|
I don't know how that translates to WASM
|
|
|
Koromaru Korüko
|
2022-01-30 02:02:03
|
yes, but then i would have to constantly translate between strict and soft typing
|
|
2022-01-30 02:03:07
|
as in i consume emscripten::val on all inputs and push it on all outputs
but then have to:
manually ensure type safety.
manually create constructors, and pesudo class representations.
implement further error checking.
|
|
2022-01-30 02:03:57
|
where as, I could delegate all of that to Embind.
which would allow me to consume strictly typed values.
and wouldn't have to provide pseudo representations.
|
|
2022-01-30 02:04:24
|
it also means that embind would handle the type checks, and argument validity
|
|
|
Traneptora
|
2022-01-30 02:04:31
|
Ah, that sounds like it's thoroughly in "not worth it" territory
|
|
2022-01-30 02:04:36
|
even if you could let TS handle that
|
|
|
Koromaru Korüko
|
2022-01-30 02:04:36
|
as well as conversions.
|
|
2022-01-30 02:05:05
|
I don't mind, I can write up a few macros and quickly hammer it out in 1-3hours but it means future maintainability is botched
|
|
|
Traneptora
|
2022-01-30 02:05:21
|
yea, that by itself makes it not worth it
|
|
|
Koromaru Korüko
|
2022-01-30 02:05:27
|
and it would mean editing definitions in multiply files.
|
|