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

other-codecs

_wb_
2021-12-11 08:40:21
Looks like they use Akamai's image service
2021-12-11 08:40:31
So could very well be that they did just that
2021-12-11 08:41:58
I dunno what Akamai uses as avif encoder and settings but likely they did some basic testing to pick some settings that produced somewhat lower bpp than what they produced for webp, and called it a day
Scope
2021-12-15 04:20:05
https://twitter.com/richgel999/status/1470696769470271493
2021-12-15 04:51:02
🤔 Even the WebP team <https://github.com/phoboslab/qoi/issues/48>
improver
2021-12-16 01:04:41
>The width and height should be clamped to reasonable values. Currently a QOI image could be 2^33 pixels: is it supported by the current implementation? We would advise storing each dimension on 14 bits with an offset of 1, making the width and height within [1..16384] each, avoiding the useless values ‘0’. The maximum number of pixels would be 268 435 456, which still fits in a plain int when multiplied by 4 channels. This is safer. lol at this point im kinda sick of webp-ish ways of limiting things tbh
2021-12-16 01:05:38
also downvoted :v)
Fraetor
2021-12-16 01:54:04
The webp way makes sense from the perspective of a short term content delivery format, much less so for a longer term storage format.
2021-12-16 02:07:20
I think the security implications are around denial of service. For example if you decode user supplied images, and someone provides an image that compresses really well, but decompresses to multiple gigapixels (such as a single solid colour), it is very likely your program would run out of memory and crash.
2021-12-16 02:07:55
IIRC it was intended as a proof of concept format, but a lot of people are running with it.
BlueSwordM
2021-12-16 02:08:18
It's because they don't know about formats like JXL <:kekw:808717074305122316>
2021-12-16 02:08:26
Also, they want super simple formats to implement.
Fraetor
2021-12-16 02:08:58
It is perfect as a hobbyist project, as it is simple enough to writer a decoder in a weekend.
2021-12-16 02:10:35
Their uploads are really limited.
2021-12-16 02:11:08
I know I've submitted jxl images as jxl.txt before to get them to upload.
BlueSwordM
2021-12-16 02:11:40
People just love single header libraries.
2021-12-16 02:11:58
Anyyyway, <@!853026420792360980> how is the ffmpeg libjxl stuff going?
2021-12-16 02:12:07
Has anyone reviewed your patches or whatnot?
2021-12-16 02:19:24
Well, let me ping an ffmpeg developer that I can directly talk to 😄
Traneptora
BlueSwordM Anyyyway, <@!853026420792360980> how is the ffmpeg libjxl stuff going?
2021-12-16 02:44:07
it's going, I've been quite busy
2021-12-16 02:44:23
it works but there's two main issues
2021-12-16 02:44:42
in particular, it's not able to read from a pipe, which is a problem, and I believe it's due to a lack of a parser
2021-12-16 02:45:39
so I'm writing an internal parser for the codec, although the decoder will be libjxl-dependent
2021-12-16 02:46:04
the parser will be lavc only, and the parser code in lavc will be called from the prober in lavf
2021-12-16 02:46:26
that's dated 2020
2021-12-16 02:46:57
but yea, in other news I discovered two bugs in libjxl when writing the wrapper so that was fun
2021-12-16 02:47:36
(both have been fixed)
2021-12-16 02:58:46
Either way, I have tomorrow off so the plan is to get to it tomorrow
BlueSwordM
Traneptora Either way, I have tomorrow off so the plan is to get to it tomorrow
2021-12-16 02:59:40
Well, in that case, is it ok if I talk to the ffmpeg dev about it?
2021-12-16 02:59:57
She's quite the special one, so I'm sure she'd be glad to help/review the patch if she has time 😄
Traneptora
2021-12-16 03:00:21
sure, also keep in mind the patch v6 that's in the mail list did get some discussion on IRC
2021-12-16 03:00:27
and it's not going to be the final version
190n
2021-12-16 04:30:19
https://www.da.vidbuchanan.co.uk/widgets/pngdiff/
_wb_
2021-12-16 06:13:24
That's a neat one
improver >The width and height should be clamped to reasonable values. Currently a QOI image could be 2^33 pixels: is it supported by the current implementation? We would advise storing each dimension on 14 bits with an offset of 1, making the width and height within [1..16384] each, avoiding the useless values ‘0’. The maximum number of pixels would be 268 435 456, which still fits in a plain int when multiplied by 4 channels. This is safer. lol at this point im kinda sick of webp-ish ways of limiting things tbh
2021-12-16 06:44:54
The insisting on 14-bit dimensions is silly. We do encounter plenty of real images in the wild on the web that are larger than that - obviously typically the other dimensions is small. For those images, we cannot use webp but have to fallback to jpeg or png...
2021-12-16 06:47:47
> We recommend the following order: header, ICC if any, pixels, XMP if any, EXIF if any. That's a bad idea: exif can have orientation and intrinsic dimensions, so it's better to have it early
190n
_wb_ The insisting on 14-bit dimensions is silly. We do encounter plenty of real images in the wild on the web that are larger than that - obviously typically the other dimensions is small. For those images, we cannot use webp but have to fallback to jpeg or png...
2021-12-16 06:53:18
sounds like the goal is to fit the number of pixels (or even subpixels) in 32 bits... but why? you can use 64 bits
_wb_
2021-12-16 07:02:20
Why would you even need to compute the number of pixels?
2021-12-16 07:05:00
Anyway, it seems like a bad idea to design a format in such a way that it is simply impossible that an image will be too large to fit in memory
2021-12-16 07:12:09
I have to say I still don't really understand the use case for QOI
2021-12-16 07:13:23
It seems to be a combination of a GPU texture format and a regular image format, combining the disadvantages of both.
2021-12-16 07:13:30
Am I missing something?
190n
_wb_ Why would you even need to compute the number of pixels?
2021-12-16 07:50:04
```c uint8_t *framebuffer = (uint8_t *) malloc(width * height * channels * sizeof(uint8_t)); ```
_wb_ I have to say I still don't really understand the use case for QOI
2021-12-16 07:50:55
i don't think it was really meant to be practical, more just to play around with image compression. that it's not very far off png's efficiency is an accident.
_wb_
2021-12-16 07:51:34
for playing around it's of course nice - low amount of code, fun to play with
2021-12-16 07:52:47
but it looks like some people are taking it more seriously than a toy example, talking about final specifications etc
190n
2021-12-16 07:53:25
i could see utility if you want to really thoroughly audit all your dependencies
2021-12-16 07:55:17
also it's very easy to integrate, although so is stb_image
_wb_
2021-12-16 07:57:00
I don't think there's a lot of stuff you can do if you want to thoroughly audit all your dependencies
2021-12-16 07:58:11
100 lines of new code might be more dangerous than depending on a bulky and bloated but old and widely used library like libpng
190n
2021-12-16 08:00:13
well, sure. even qoi depends on libc and a kernel.
2021-12-16 08:01:30
my point was that it's possible for an experienced C programmer to pretty much hold all of qoi in their head at once. i'm not sure that that's possible with any other modern format.
Traneptora
2021-12-16 09:00:28
It didn't make it onto patchwork, for some reason
2021-12-16 09:02:01
Here are the patches, tho
2021-12-16 09:04:16
This patch doesn't properly handle ICC even though FFmpeg's PNG does
2021-12-16 09:04:19
so I need to make tha work as well
2021-12-16 09:04:29
or at least, properly tag the colorspaces
Scope
2021-12-16 09:09:18
QOI is more about efficiency which is somehow better than uncompressed images while maintaining high encoding/decoding speed with maximum simplicity But, yes, in my opinion, the priority of format simplicity alone is not worth the sacrifice of efficiency and speed that can be achieved Considering that people already want to add this format to browsers, TIFF, for the new PNG specification, game and texture formats, etc.
BlueSwordM It's because they don't know about formats like JXL <:kekw:808717074305122316>
2021-12-16 09:23:38
Also, there are comparisons with JXL as well, although a bit odd (with `-e 9`), given that QOI was not intended as a format for superior compression <https://github.com/nigeltao/qoi2-bikeshed/issues/25#issuecomment-992923430>
2021-12-16 09:31:51
I also did comparisons with QOI and additional fast PNG modes on my test set, including QOI+Zstd, QOI+LZ4, QOI+Brotli, theoretically such options could be used with file system compression or on the Web and sometimes compression could be better than PNG, but still this use is quite niche
Traneptora
Scope I also did comparisons with QOI and additional fast PNG modes on my test set, including QOI+Zstd, QOI+LZ4, QOI+Brotli, theoretically such options could be used with file system compression or on the Web and sometimes compression could be better than PNG, but still this use is quite niche
2021-12-16 09:54:36
If you want to compare `.ppm.xz` or any image format `.xz` I wrote a GDK-Pixbuf loader for that
2021-12-16 09:54:53
https://github.com/thebombzen/xz-pixbuf-loader
Scope
2021-12-16 09:58:14
I chose formats with very fast decompression, LZMA btw was worse than Brotli with maximum compression (for QOI in general) Decoding speed is usually more important, although LZMA is faster at encoding than Zstd/Brotli
Traneptora
2021-12-16 10:02:44
sure, and my code is MIT licensed so if you want to change it to work with any zlib-like API then feel free
2021-12-16 10:03:04
it makes previewing images easier, cause then it'll work with GIMP, eye of gnome/eye of mate, etc.
2021-12-16 10:03:09
like "did it work?"
Scope
2021-12-16 10:07:30
There is also ZPNG, as far as I understood it is something like PNG with Zstd and more efficient and faster predictors
Traneptora
2021-12-16 10:10:39
At this point though you might as well just use .ppm.lz4 or something
2021-12-16 10:10:56
if your goal is fast lossless
Scope
2021-12-16 10:15:45
Yes, that's exactly what I did, comparing different formats with good compression ratio and high decompression speed, Lizard/LZ5 is also good in its category (but, it's not widely used) Or there are some other formats: <https://github.com/inikep/lzbench/blob/master/lzbench18_sorted.md>
2021-12-16 10:23:04
But, the point of LZ4/Zstd is that they can be used transparently in file systems (except Windows), and Brotli is supported in all modern browsers, without any additional plugins/apps so options how to use such additional compression are wider
_wb_
Scope Also, there are comparisons with JXL as well, although a bit odd (with `-e 9`), given that QOI was not intended as a format for superior compression <https://github.com/nigeltao/qoi2-bikeshed/issues/25#issuecomment-992923430>
2021-12-16 10:37:07
A comparison with -e 1 would be more interesting
Scope
2021-12-16 10:42:57
Yep, but at the moment JXL decoding speed is not very good compared to other formats, even lossless WebP, it would be better to compare after the upcoming optimizations
_wb_
2021-12-16 11:10:40
Decode speed of -e 1 encoded images should be better than the general case
Traneptora
Scope Yep, but at the moment JXL decoding speed is not very good compared to other formats, even lossless WebP, it would be better to compare after the upcoming optimizations
2021-12-16 11:35:44
modular mode is far slower than VarDCT I've found
2021-12-16 11:35:48
I'm not entirely sure why
fab
2021-12-16 11:39:51
Because modular does rewrite the quantizer it loads every time
2021-12-16 11:40:48
Vardct is simpler like 28 mpxs only lossless jpg transcode no modular tools right
2021-12-16 11:41:32
But with modular tools you add those they are slow
2021-12-16 11:42:06
Like 1.8 mpxs at speed 7
Scope
Traneptora I'm not entirely sure why
2021-12-16 11:42:50
Yes, it should be, because different methods are used, it is basically lossy-lossless, and effective lossless methods are usually much more complex
fab
2021-12-16 11:43:03
Or max 3,6 mpxs
improver
2021-12-16 11:43:25
also lack if optmizations for cases that COULD be optimized
fab
2021-12-16 11:43:26
Don't expect more than this on i3 330m
improver also lack if optmizations for cases that COULD be optimized
2021-12-16 11:43:57
No arm i think should be even x3 times better
2021-12-16 11:44:14
Because there is more artificial intelligente Better ram
improver
2021-12-16 11:44:34
but in higher compression modes itll probably always be slower than vardct
fab
2021-12-16 11:44:42
But it depends on the speed you do
Scope
2021-12-16 11:44:46
Yep
fab
2021-12-16 11:45:02
Also jon sneyers has explained this on latest jxl message
2021-12-16 11:45:16
There is patches that is slow
2021-12-16 11:45:26
And is a modular tool
2021-12-16 11:45:35
One of the slower
Traneptora
2021-12-16 11:45:41
I'm aware that modular is slower because it's basically lossless mode, but I was wondering if there was something else, like if it was much less well-optimized or something
2021-12-16 11:45:55
the algorithm itself is slower, sure, but has there also been a higher effort placed into VarDCT?
improver
2021-12-16 11:46:08
yes there has been
Traneptora
2021-12-16 11:46:21
Cause I'm usually at the point where I consider true lossless not even worth it when VarDCT d=0.2 is good enough for my purposes and *far* faster
Scope
2021-12-16 11:46:34
It is less optimized at the moment, but lossless modes are always more complex and slower
Traneptora
2021-12-16 11:48:03
sure, but that means more room for improvement is what I'm thinking of
Scope
2021-12-16 11:49:33
Also https://discord.com/channels/794206087879852103/794206170445119489/916646398139703297
veluca
2021-12-16 12:55:48
so lossless mode uses a decision tree to context model each pixel - it's definitely not meant to be fast 😆 (pretty similar to FLIF in that regard) in the future we might implement a few more specialized codepath that emulate say what web-ll does, but not there yet
Scope
2021-12-16 01:08:42
Btw, using the LZ77 algorithm is still the most optimal for their tasks, since there are many other LZ variations?
Traneptora
2021-12-16 02:12:20
LZ77 is mathematically the same as LZ78 for the most part, but it's better to implement in software since the dictionary is fixed-size
_wb_
2021-12-16 03:15:11
it's also true that VarDCT was designed for speed from the start, while Modular comes from FUIF which was initially designed for code simplicity
Scope
2021-12-18 04:37:56
https://twitter.com/richgel999/status/1471645249156046856
2021-12-18 04:38:10
https://twitter.com/richgel999/status/1471646274906726402
BlueSwordM
Scope https://twitter.com/richgel999/status/1471646274906726402
2021-12-18 04:48:19
Is he ignoring the fact that you can make the formats encode faster while not losing much compression efficiency, if at all?
yurume
2021-12-18 04:48:47
One benefit of QOI is that it literally has zero encoder options, which makes the Pareto analysis very easy
Scope
Scope https://twitter.com/richgel999/status/1471646274906726402
2021-12-18 04:49:16
Yep On the one hand yes, but on the other hand, when I started making this comparison, the goal was to evaluate compression efficiency of various image formats which can be used specifically as image formats, not just storage formats, besides most of them have not yet had good optimization of encoding/decoding speed or even format finalization (so the speed comparison was almost useless) But, speed/efficiency comparisons are also needed, which can be added later
BlueSwordM
2021-12-18 04:49:44
I see 🙂
Scope
2021-12-18 04:56:22
However, to say that this comparison is not valuable anymore is also incorrect, basically it is to say that QOI and other fast formats are not valuable because most other formats have better compression, it is just different needs from these formats For Web use, for example, the goals are different, since hardware performance increases over time, it makes much less sense to use faster and simpler formats with worse compression than formats with higher compression, using more complex and slower methods, but with enough speed for practical use
2021-12-18 05:02:11
Especially the concept of complexity, like very simple formats is good for faster understanding and creating different implementations, but is this simplicity is worth the loss of efficiency and speed if they are beaten by a more complex format?
_wb_
2021-12-18 07:08:56
Also encode speed and decode speed are rarely symmetric, and encode-once decode-many-times is the common thing for web images
2021-12-18 07:12:11
(as opposed to general-purpose web compression like gzip/brotli, where a common case is encode-once decode-once: the html often gets generated per request and compressed on the fly)
Scope
2021-12-18 08:01:56
https://twitter.com/richgel999/status/1472100826730663944
w
2021-12-18 08:13:24
yeah they never mentioned valuable to who
2021-12-18 08:13:32
high encode speed is not valuable to me
_wb_
2021-12-18 08:19:10
High encode speed is useful for local workflows - saving an image when you're still editing it, or temporary image files that will not be in storage for a long time
2021-12-18 08:21:12
So yes, there's a trade-off between speed and density, and different use cases justify different trade-offs
2021-12-18 08:23:47
I've been improving the faster speeds for lossless jxl: https://github.com/libjxl/libjxl/pull/1028
2021-12-18 08:25:10
The slower speeds are still very slow to encode, the gap between -e 3 and -e 4 is quite big now
2021-12-18 08:26:50
I think -e 1 can still be made ~10% faster after that PR
2021-12-18 08:27:47
And then we could try to make an -e 0 that sacrifices some more density and is about twice as fast as -e 1
Scope
2021-12-19 01:30:47
<:Thonk:805904896879493180> https://twitter.com/richgel999/status/1472509304557158401
2021-12-19 01:45:41
https://twitter.com/MaxGraey/status/1472524345935335431
2021-12-19 01:45:53
Hm, I think if a lot of people have such a need for simple and fast encoders, then in the future it might even make sense to make something like a separate lightweight JXL lossless encoder with only a very fast mode like in QOI or RLE + arithmetic encoding or something like that
_wb_
2021-12-19 03:15:46
You are reading my and <@179701849576833024>'s mind 😅
Scope
2021-12-20 02:14:31
<:Poggers:805392625934663710> https://github.com/libjxl/libjxl/pull/1032
Deleted User
2021-12-20 02:25:42
early christmas present by <@!179701849576833024> ^^
veluca
2021-12-20 02:25:52
<@!794205442175402004> feel free to share some numbers 😉
2021-12-20 02:26:05
(I was bored this weekend :P)
Scope
2021-12-20 02:29:03
A comparison with QOI and fpng would also be interesting <https://github.com/richgel999/fpng>
veluca
2021-12-20 02:29:05
I did some very simple testing and I think it's 1.5x faster than QOI and 1.2x denser or so
2021-12-20 02:29:21
well, Jon did some of those
2021-12-20 02:29:49
(without multithreading, to be clear...)
2021-12-20 02:30:24
not sure about fpng but it should be a similar picture
2021-12-20 02:31:04
I mean on Jon's data this is in the same ballpark of compression as *optipng*
2021-12-20 02:31:33
just, huh, *a bit* faster?
2021-12-20 02:31:45
you do need AVX2 though
2021-12-20 02:32:35
(I mean NEON would work too, just didn't write it - and I'm sure one can make sse(3|4?) work also)
Scope
2021-12-20 02:32:37
Also QOI Test Suite: https://phoboslab.org/files/qoibench/qoi_benchmark_suite.tar
Deleted User
2021-12-20 02:46:06
What's the command to activate this fast-lossless mode, `--velucity`?
_wb_
2021-12-20 02:52:36
haha
2021-12-20 02:52:54
2021-12-20 02:53:05
so here are some initial results
veluca
What's the command to activate this fast-lossless mode, `--velucity`?
2021-12-20 02:53:17
😆 it's just a separate file, you don't need libjxl even 😄
_wb_
2021-12-20 02:53:40
left is density (smaller is better), right is speed (more is better)
2021-12-20 02:54:49
basically we eat QOI for breakfast and have room left for fpng as a dessert
2021-12-20 02:55:16
if I can summarize those results 🙂
Scope
2021-12-20 02:56:15
There is also fpng_rle (but perhaps without sources yet) https://twitter.com/richgel999/status/1472505757547515909
veluca
2021-12-20 02:58:08
to be fair, neither fpng nor qoi have nearly as much fun with AVX2 as my code does 😄 (compilers do part of the job, but still a 2-3x speedup comes from some manually vectorized code)
2021-12-20 02:58:37
I believe qoi is pretty SIMD-hostile, but fpng could be SIMDfied without too much pain
Scope
2021-12-20 03:08:26
Also many people might want a similar encoder but without almost any dependencies such as highway or openmp (although I understand that this will make the code much more complicated and I personally do not think that this is a good thing)
Deleted User
veluca 😆 it's just a separate file, you don't need libjxl even 😄
2021-12-20 03:11:28
Where's the download button!? <:BlobYay:806132268186861619>
veluca
2021-12-20 03:11:33
this is a single .cc file with no dependencies 😉
2021-12-20 03:12:06
(well, except lodepng for reading input and the _main.cc)
Where's the download button!? <:BlobYay:806132268186861619>
2021-12-20 03:13:37
https://github.com/libjxl/libjxl/tree/e9fa951ff5e20aa964eac7bbbe56631b92227266/experimental/fast_lossless just download the files one at a time?
2021-12-20 03:13:54
(I realized there's a bug if the image is <= 256x256, I'll fix that...)
diskorduser
2021-12-20 03:16:24
Does 10/12/16 bit images work?
_wb_
2021-12-20 03:18:06
it's hardcoded for 8-bit atm, like QOI and fpng
2021-12-20 03:18:35
theoretically I think the approach could also work for 10-bit at similar speed
2021-12-20 03:19:05
for higher bit depth there would probably be some speed penalty, no idea how much it would be
Scope
2021-12-20 03:29:41
https://twitter.com/richgel999/status/1472924320397676544
_wb_
Scope Also QOI Test Suite: https://phoboslab.org/files/qoibench/qoi_benchmark_suite.tar
2021-12-20 03:31:41
tried it on this (well, only on the images larger than 256x256, due to the bug in fast lossless jxl encoding for single-group images)
2021-12-20 03:32:55
QOI compressed the images to 8.00 bpp at 77.81 MP/s fpng compresses them to 7.84 bpp at 71.35 MP/s
2021-12-20 03:33:15
fast lossless jxl encoding got them down to 6.80 bpp at 162.62 MP/s
Cool Doggo
2021-12-20 03:33:57
<:JXL:805850130203934781> <:chad:768911266919088128>
Scope
2021-12-20 03:36:36
There is also qoi-demo22 (seems to be faster and better) https://github.com/nigeltao/qoi2-bikeshed/issues/28
Deleted User
_wb_ fast lossless jxl encoding got them down to 6.80 bpp at 162.62 MP/s
2021-12-20 03:37:13
Is fast-lossless JXL encoding now faster than decoding?
_wb_
2021-12-20 03:39:18
yes, probably hard to make even a specialized decoder as fast as that encoder
veluca
2021-12-20 03:42:29
I had quite a bit of fun 😉
_wb_
2021-12-20 03:48:18
well I don't feel like running 22 different QOI variants, I suppose some of them will be somewhat better
Scope
2021-12-20 03:50:34
It's more like QOI version 2.2
_wb_
2021-12-20 03:57:26
https://twitter.com/jonsneyers/status/1472959101416226823?s=20
Scope
_wb_
2021-12-20 04:15:24
`cwebp -z 0` is also not bad for this compression
_wb_
2021-12-20 04:35:41
Yes, lossless webp hits nice trade-offs.
Scope
2021-12-20 05:15:47
https://phoboslab.org/log/2021/12/qoi-specification
_wb_
2021-12-20 05:20:37
I'm not sure if QOI is actually much simpler than the subset of jxl that is used by luca's fast encoder (RLE-only, fixed prefix codes, fixed YCoCg)
Scope
2021-12-20 05:38:52
Perhaps this is simpler for someone to understand
2021-12-20 05:39:04
And yep, without a fast decoder, just a fast encoder may be less useful for some cases
2021-12-20 05:46:43
Also, did this implementation for the fast encoder was the most logical and optimal, or other methods have not yet been tried?
veluca
2021-12-20 05:55:30
I literally tried this in a weekend, there wasn't extensive study in it :P
2021-12-20 05:56:15
One could do some amount of context modeling for example, and it likely wouldn't impact encoding speed much
Scope
2021-12-20 07:05:32
https://news.ycombinator.com/item?id=29625084
Fraetor
2021-12-20 08:29:49
How fast is the jxl decoder currently?
fab
2021-12-20 08:32:10
same
_wb_
2021-12-20 08:36:55
It depends quite a bit on what it has to decode
fab
2021-12-20 08:40:01
2021-12-20 08:40:56
i'm downloading a torrent
_wb_
2021-12-20 08:41:03
Is that an image with lots of patches or something?
fab
2021-12-20 08:41:12
2021-12-20 08:41:21
2021-12-20 08:41:22
it utilizes my font suduwe
2021-12-20 08:41:32
so essentially is lot a text like
2021-12-20 08:42:03
but keep in mind that i'm downloading a toeent
2021-12-20 08:42:13
so could be same speed
2021-12-20 08:42:28
afte i finish downloading the toeent iwill ty again
_wb_ Is that an image with lots of patches or something?
2021-12-20 08:42:58
how many patches the image has
_wb_
2021-12-20 09:06:15
There's no easy way to check, but you can decode with -s 8 to get an idea, or encode with --patches 0 to see how it affects speed and size
veluca
2021-12-21 01:25:05
Admittedly it is more complicated ;)
2021-12-21 01:25:42
Although the ARM version I just uploaded is 10x more readable than the Intel one ;)
Scope
2021-12-21 06:19:48
I think fast-lossless JXL encoder is also worth a mention in this thread https://www.reddit.com/r/programming/comments/rkt6y5/losslessly_compresses_rgb_and_rgba_images_to_a/
_wb_ https://twitter.com/jonsneyers/status/1472959101416226823?s=20
2021-12-21 06:44:02
Also, this is a speed comparison without PNG decoding time and since maximum speed is very important, maybe use the fastest PNG decoder and also add PPM support? Though also this fast standalone encoder should be minimalistic and without unnecessary stuff, but I think many people may compare total time including decoding
2021-12-21 06:49:14
Wuffs seems to be the fastest decoder currently available (mango is proprietary), although I'm not sure how convenient it is to use
2021-12-21 06:52:17
<https://github.com/nigeltao/qoi/commit/05cdef77eb472e17a3ef6e6d4e820de755af0d61>
Scope <:Poggers:805392625934663710> https://github.com/libjxl/libjxl/pull/1032
2021-12-21 08:49:04
<@!179701849576833024> There are also problems with compiling in Msys2 for Windows by default `../fast_lossless.cc:9:10: fatal error: 'endian.h' file not found` maybe add some minimal cross-platform build system like for libjxl?
2021-12-21 09:23:15
I understand that there is no time or priority for this kind of encoder yet, but I have some thoughts for the future, like: - creating a separate repository for this fast implementation like for jxl-rs (for further discussion and integrations into different apps, like QOI does) - adding an API so it can be used and linked in as a library - adding another denser but still relative fast mode, like `-e 3` or more optimal for different kinds of content - adding a similarly fast decoder for these modes - adding 16-bit support for full PNG compatibility This is nice to have in libjxl, but narrower tasks can always be done better and a such implementation would be much simpler and lighter
veluca
Scope I think fast-lossless JXL encoder is also worth a mention in this thread https://www.reddit.com/r/programming/comments/rkt6y5/losslessly_compresses_rgb_and_rgba_images_to_a/
2021-12-21 09:24:43
Feel free to mention it! I don't think I should self-advertise :)
Scope <@!179701849576833024> There are also problems with compiling in Msys2 for Windows by default `../fast_lossless.cc:9:10: fatal error: 'endian.h' file not found` maybe add some minimal cross-platform build system like for libjxl?
2021-12-21 09:25:49
Yeah, I know... Tbh I only need that for endianness, to give an error if you are on a big endian machine, so probably there's a better way xD
Scope I understand that there is no time or priority for this kind of encoder yet, but I have some thoughts for the future, like: - creating a separate repository for this fast implementation like for jxl-rs (for further discussion and integrations into different apps, like QOI does) - adding an API so it can be used and linked in as a library - adding another denser but still relative fast mode, like `-e 3` or more optimal for different kinds of content - adding a similarly fast decoder for these modes - adding 16-bit support for full PNG compatibility This is nice to have in libjxl, but narrower tasks can always be done better and a such implementation would be much simpler and lighter
2021-12-21 09:26:28
Some of those might be tried in the future, but this is really very much a fun weekend project for now
Scope Also, this is a speed comparison without PNG decoding time and since maximum speed is very important, maybe use the fastest PNG decoder and also add PPM support? Though also this fast standalone encoder should be minimalistic and without unnecessary stuff, but I think many people may compare total time including decoding
2021-12-21 09:27:32
I think you can use the .h directly if you want max speed :P
Scope
veluca Some of those might be tried in the future, but this is really very much a fun weekend project for now
2021-12-21 09:28:48
Yeah, I understand, I'm just looking at how popular QOI is, this format has been added almost everywhere in just a couple of days
veluca Feel free to mention it! I don't think I should self-advertise :)
2021-12-21 09:33:05
Yes, Jon already mentioned, I'm just not very good at expressing thoughts in English and can't explain the details of this implementation
veluca
2021-12-21 09:34:33
I'm ok with explaining the details afterwards if I get tagged or something :)
2021-12-21 09:35:15
Or asked to, I guess
spider-mario
2021-12-21 09:36:15
https://www.reddit.com/r/programming/comments/rkw5wz/a_challenger_to_the_throne_of_vector_graphics_svg/hpd6c0b/ interesting comment on SVG’s history
Scope
2021-12-21 09:40:55
> But then Dominic Szablewski published the The Quite OK Image Format and showed me that there was interest in simpler formats. It inspired and motivated me to push for TinyVG completion and I got back to the project So the war for simple formats has begun
veluca
2021-12-21 09:44:33
tbh I doubt it's going to go anywhere xD
The_Decryptor
2021-12-21 09:44:38
I'd love a simple SVG competitor, SVG has enough features in it to near replace HTML
2021-12-21 09:46:32
SVG2 adds a bunch of modes to disable things like resource loading and javascript, and there's a "native" variant that removes all of that as well
190n
2021-12-21 09:57:52
tinyvg looks promising
2021-12-21 09:58:02
i really really really really want a vector format better than svg <:kekw:808717074305122316>
2021-12-21 09:58:30
svg is _far_ beyond the kind of complexity that qoi was trying to avoid, well into bullshit territory
2021-12-21 10:01:28
google/flutter was also working on an svg replacement: https://flutter.dev/go/vector-graphics
2021-12-21 10:01:55
> SVG is really an application SDK that happens to include vector graphics (e.g. fully supporting SVG involves supporting XML, JS, DOM, SMIL, HTML, audio playback, keyboard, mouse, and touch input, form controls, HTTP submission, video conferencing, etc). Additionally, there is no clearly defined subset of SVG to target if one only wants "vector graphics": the modern version of SVG Tiny involves supporting JavaScript and video playback, while the original version of SVG Tiny requires an unusual subset of features, for example it does not support gradients, but does support custom fonts.
_wb_
2021-12-21 10:06:16
something just slightly more expressive than jxl splines would be nice as a vector format
2021-12-21 10:06:53
say jxl splines + closed shapes with solid or simple gradient fill
2021-12-21 10:09:01
I think that would be expressive enough to represent everything you need, while being simple enough to write a simple renderer in few lines of code
2021-12-21 10:09:45
and more importantly: avoid the security headaches of having to implement (and sandbox) various turing-complete languages just to show an image
Scope
Scope <@!179701849576833024> There are also problems with compiling in Msys2 for Windows by default `../fast_lossless.cc:9:10: fatal error: 'endian.h' file not found` maybe add some minimal cross-platform build system like for libjxl?
2021-12-21 10:54:15
Hmm, I compiled the Windows version, but it seems that the encoded jxl images are incorrect 🤔
2021-12-21 10:58:53
Like this
2021-12-21 10:59:31
However, if at least the sizes are correct, it will be enough for me for some tests
veluca
2021-12-21 11:22:18
I just pushed a fix for that 😄
2021-12-21 11:22:25
(I mean for endian.h)
2021-12-21 11:22:35
let me try that PNG...
2021-12-21 11:23:29
mhhh works on Linux
2021-12-21 11:23:34
what's your compiler?
Scope
2021-12-21 11:23:43
msys2 clang
2021-12-21 11:25:03
I will try to recompile with the fixes
veluca
2021-12-21 11:25:56
I doubt it will change anything
2021-12-21 11:26:06
what happens if you disable the -D flag?
Scope
2021-12-21 11:28:42
2021-12-21 11:29:25
Hmm, without -D and with fixes it's still the same And my CPU has AVX2 support
veluca
2021-12-21 11:30:08
ok so the problem is somewhere else
2021-12-21 11:32:08
oh
2021-12-21 11:32:13
I'm silly xD
Scope
2021-12-21 11:32:57
``` diff --git a/experimental/fast_lossless/fast_lossless_main.cc b/experimental/fast_lossless/fast_lossless_main.cc index 08b2af06..18bb459a 100644 --- a/experimental/fast_lossless/fast_lossless_main.cc +++ b/experimental/fast_lossless/fast_lossless_main.cc @@ -56,7 +56,7 @@ int main(int argc, char** argv) { encoded_size = FastLosslessEncode(png, width, width * 4, height, &encoded); } - FILE* o = fopen(out, "w"); + FILE* o = fopen(out, "wb"); if (!o) { fprintf(stderr, "error opening %s: %s\n", out, strerror(errno)); return 1; ```
2021-12-21 11:33:00
try that?
2021-12-21 11:33:07
(stupid Windows...)
Scope
2021-12-21 11:35:45
Yep, it works
veluca
2021-12-21 11:36:33
great
2021-12-21 11:36:50
fwrite was replacing all the 0x0a with 0x0d 0x0a...
Cool Doggo
2021-12-21 11:46:45
it is cool to see that even a really fast jxl encoder can still have decent compression
Deleted User
Scope Yep, it works
2021-12-21 11:49:24
Can you share your build? 🥺 <:Windows:806135372298977342>
Scope
2021-12-21 11:50:10
Deleted User
2021-12-21 11:51:39
Do you also have `libgcc_s_seh-1.dll`? ^^
2021-12-21 11:52:37
And also `libstdc++-6.dll`? x)
2021-12-21 11:53:00
`libomp.dll`...
w
2021-12-21 11:53:14
might want to make a static build
Deleted User
2021-12-21 11:57:23
`libwinpthread-1.dll` ... please?
Scope
2021-12-21 11:58:29
Cool Doggo
Scope I think fast-lossless JXL encoder is also worth a mention in this thread https://www.reddit.com/r/programming/comments/rkt6y5/losslessly_compresses_rgb_and_rgba_images_to_a/
2021-12-21 11:59:12
> Would be nice if that would become a new default standard. Considering how widely used PNG is am not sure this is realistic I'm not sure why people want to completely replace PNG with qoi, considering (fom my understanding) it has worse compression
Scope
2021-12-21 11:59:27
Yep
2021-12-21 12:03:10
Like JXL, AVIF and other modern formats (while having much bigger benefits) did not have as much hype and desire for people to implement everywhere as possible, as with QOI
w
2021-12-21 12:07:10
woke image formats are popular
Cool Doggo
2021-12-21 12:07:51
the fact it is easily understandable is likely a big part of it's popularity
w
2021-12-21 12:08:06
is it that much easier than png
Cool Doggo
2021-12-21 12:08:47
yes
2021-12-21 12:09:04
easier enough for basically anyone to be able to understand how it works
2021-12-21 12:10:21
qoi is good for its own usage but it should not be used by everyone 👍
veluca
2021-12-21 12:16:06
tbh png is not that complex
2021-12-21 12:16:36
deflate is simple enough, and PNG on top of that just adds chunks and simple prediction
2021-12-21 12:17:00
sure maybe the details of the bitstream are not entirely trivial, and then you have things like palette etc
2021-12-21 12:17:27
but the chunks exist for a reason...
w
2021-12-21 12:18:00
i think it's even easier to understand the chunks as each row
2021-12-21 12:18:13
so all you really need to know is png is just deflate
2021-12-21 12:18:45
and each row being a chunk means it can be progressively decoded
2021-12-21 12:20:58
definitely way easier to implement if all you need to do is run deflate on data
veluca
2021-12-21 12:42:24
oh I meant things like sRGB chunk etc
2021-12-21 12:42:28
i.e. metadata
spider-mario
2021-12-21 12:44:19
yes, the HN thread showed that some people don’t seem to realize what color management is even for
2021-12-21 12:44:47
which is okay in the general population but unfortunate if pushing for a format that lacks it
yurume
2021-12-21 02:09:35
historically there was also an implementation quality issue that _discouraged_ proper color management for at least a decade
veluca
2021-12-21 05:49:06
spent some time tweaking things and made it 5-10% faster and ~1% denser on screenshots
Scope
2021-12-21 06:36:52
Experimenting with different group sizes for this kind of fast encoding mode can give any improvements or is the default already the most efficient?
_wb_
2021-12-21 07:20:32
Larger groups are just better for compression here, but not by much
2021-12-21 07:20:45
And it hurts potential for multithreading
Scope
2021-12-21 08:45:23
Yes, but I also meant a smaller group size, for QOI, as far as I remember, someone experimented with 64x64 tiles or something like that For JXL lossless the smallest is 128x128 and maybe with simpler encoding methods, efficiency losses will be lower than for slow and complex modes, but there will be advantages in higher threading or theoretically possibility to use less memory
2021-12-21 08:48:56
<:Thonk:805904896879493180>
Cool Doggo
2021-12-21 08:50:01
> decades of optimization
Scope
2021-12-21 08:51:49
One day of optimizations from veluca counts as one decade
fab
Scope <:Thonk:805904896879493180>
2021-12-21 08:55:09
could you link this reddit
Scope
2021-12-21 08:55:40
https://discord.com/channels/794206087879852103/805176455658733570/922735088150654988
_wb_
2021-12-21 09:47:56
2021-12-21 09:48:16
2021-12-21 09:48:47
sometimes I do get jealous
190n
2021-12-21 09:49:57
<:FeelsSadMan:808221433243107338><:FrogSupport:805394101528035328>
_wb_
2021-12-21 09:51:18
oh well, I guess that's how github stars work
2021-12-21 09:52:11
2021-12-21 09:53:31
2021-12-21 09:54:50
2021-12-21 09:55:14
I wish there was a button to transfer some of those FLIF stars to libjxl 🙂
2021-12-21 09:55:43
doesn't feel right that flif has more stars than libpng and libjpeg-turbo combined, wtf
veluca
Scope One day of optimizations from veluca counts as one decade
2021-12-21 10:02:24
haha
cucumber
2021-12-22 04:31:06
new paper just dropped. haven't looked at it yet and I don't pay much to the DL compression people, but it's Qualcomm so I'm tempted to read it
2021-12-22 04:31:08
https://arxiv.org/abs/2112.11312
2021-12-22 04:52:37
2021-12-22 04:54:48
so it's definitely nothing groundbreaking (at least for images) 🤷
Scope
2021-12-22 09:48:32
Strange point of view, considering that the Wuffs author is also one of the most active participants in the development and has created many of their QOI implementations, as well as the fact that QOI does not bring any new revolutionary solutions that would surpass the other already known and are behind only because not enough optimized
2021-12-22 09:51:33
And also the problem with QOI is that any faster or more efficient solutions are rejected for adoption in the format if they look even slightly more complicated, because the main priority in QOI is the maximum simplicity
190n
2021-12-22 10:24:10
at the end are they suggesting QOI _encoders_ could get better, or the QOI _spec_? there's a massive difference
2021-12-22 10:24:24
as in, i think writing an optimal encoder given the current spec is trivial
Cool Doggo
2021-12-22 11:14:43
they just said in theory it could encode at 500 MB/s (I assume they meant MP/s)
yurume
Scope Strange point of view, considering that the Wuffs author is also one of the most active participants in the development and has created many of their QOI implementations, as well as the fact that QOI does not bring any new revolutionary solutions that would surpass the other already known and are behind only because not enough optimized
2021-12-22 11:28:16
probably just nerd-sniped? I've also seen Nigel Tao in the IconVG discussion, so...
Scope
2021-12-22 11:33:15
Yep, he seems to be interested in such things
2021-12-22 11:52:41
https://twitter.com/richgel999/status/1473589374914805770
2021-12-22 12:18:03
Btw, these precomputed dynamic Huffman tables can be also useful for fast-lossless JXL encoder?
veluca
2021-12-22 12:25:58
working on it 😉
2021-12-22 12:26:28
well, mod the train and the bug
Deleted User
2021-12-22 12:26:45
try beeing as quick as possibly or the hype might have ended x)
veluca
2021-12-22 12:27:10
it's my plan for today xD
_wb_
Cool Doggo they just said in theory it could encode at 500 MB/s (I assume they meant MP/s)
2021-12-22 02:59:24
1 MP is 4 MB in 8-bit RGBA, sometimes people express it in MB instead of MP
Cool Doggo
2021-12-22 03:03:40
well they were referring to the tweet which iirc was showing MP/s ¯\\_(ツ)\_/¯
190n
2021-12-23 12:58:14
tfw the qoi spec is vague
2021-12-23 12:59:07
i mean it's cool that it's short i guess but i don't feel confident implementing an encoder and decoder using only the spec, specifically because of edge cases
BlueSwordM
2021-12-23 01:31:12
<@456226577798135808> Honestly, these results don't really make sense: https://discord.com/channels/794206087879852103/848189884614705192/923362379151073351
Scope
2021-12-23 10:30:28
https://twitter.com/richgel999/status/1473905677273866242
2021-12-23 10:31:06
<:FeelsReadingMan:808827102278451241>
The_Decryptor
2021-12-23 11:10:10
Looks like the history of my repos
Scope
2021-12-23 12:27:49
https://twitter.com/richgel999/status/1473922895911034880
2021-12-23 12:28:10
So a good set of images to generate is also important or at least the most useful and usable for such fast implementations 🤔
2021-12-23 12:35:35
Although, it also depends on what amount of time takes Huffman coding, for example, in the latest Zstd release it also significantly speeded up and this improvement is noticeable on the overall performance <https://github.com/facebook/zstd/releases/tag/v1.5.1>
Scope I understand that there is no time or priority for this kind of encoder yet, but I have some thoughts for the future, like: - creating a separate repository for this fast implementation like for jxl-rs (for further discussion and integrations into different apps, like QOI does) - adding an API so it can be used and linked in as a library - adding another denser but still relative fast mode, like `-e 3` or more optimal for different kinds of content - adding a similarly fast decoder for these modes - adding 16-bit support for full PNG compatibility This is nice to have in libjxl, but narrower tasks can always be done better and a such implementation would be much simpler and lighter
2021-12-23 02:18:47
Also, it would be interesting and useful to use something like only maximum asymmetric methods for a slower and more efficient mode, not as slow as the current cjxl, but for example something between PIK/`-e 3` and `-e 7` in efficiency, but faster and with very fast possible theoretical decoding This is a very popular thing for cases where very fast loading of very large amount of data is needed or for some game engines (with decoding speed even faster than PNG or at least the same speed per core) Maybe also a script that would merge fastjxl into a single header file like stb_image, as this is often liked by many devs And have own benchmark tool in the future, for example with functionality like qoibench or based on benchmark_xl but with external encoders/formats (depending on which one is more accurate and convenient)
2021-12-23 02:25:42
Something like lossless PIK with fixed things would be good, but with more efficiency for non-photographic content (like to have efficiency always be overall better than well optimized PNGs on different images)
veluca
2021-12-23 03:06:18
isn't fjxl pretty close to a single header already? 😄
2021-12-23 03:06:30
(except decoding, ofc)
Scope
2021-12-23 03:10:06
Yep, but I meant for the possible future or maybe encoding and decoding in different files, just like stb
veluca
2021-12-23 04:01:06
I'm going to stick with single file for the encoder anyway
_wb_
2021-12-23 04:10:19
a single-file jxl decoder is not something that's going to happen, I think
2021-12-23 04:11:30
but you can statically link with libjxl_dec
Scope
2021-12-23 04:17:08
But, I meant about only fast_jxl and if there was the same fast decoder purely for fast_jxl images, but if there is a code which can be reused and there is no particular benefit from a separate encoder and decoder, then I think the files split makes not much sense
_wb_
2021-12-23 05:12:14
I want to avoid getting decoders out there that can only decode a subset of jxl. That's an interoperability timebomb, and risks reducing jxl to a de facto subset of what it is
2021-12-23 05:12:49
(this notoriously happened with jpeg)
spider-mario
2021-12-23 05:13:19
not to SVG, however
2021-12-23 05:13:30
so maybe it’s ok as long as a complete decoder establishes itself first
2021-12-23 05:14:19
to make sure that the cases where people resort to incomplete implementations truly are niche use cases
2021-12-23 05:14:46
and not just “that’s all we have”
_wb_
2021-12-23 05:15:21
Yes. In particular if the subset is faster to decode and easier to integrate, I think there's a substantial risk it gets more adoption than the actual full decoder, and that is an issue then.
2021-12-23 05:16:36
I think it's better to just make libjxl as fast as possible using specialized code paths
2021-12-23 05:18:30
The use cases where you cannot afford the binary size of a full jxl decoder are probably very limited
2021-12-23 05:20:30
We could add compile flags to make custom libjxl_dec builds with reduced functionality, but I think it should be easier to integrate the full decoder than to integrate such a subset-only decoder, so it's more likely that the latter is only done by people who know what they're doing
Scope
2021-12-23 05:21:40
Hmm, yes, that might be a best solution, except that the complexity, code size and binaries will be bigger Btw, the speed of decoding fast_jxl images could theoretically be the same as their encoding speed?
veluca
2021-12-23 05:22:52
likely not
Scope
2021-12-23 05:23:37
These encoding methods are faster than decoding?
veluca
2021-12-23 05:24:56
it's harder to SIMDfy huffman decoding unfortunately 😦
Scope
2021-12-23 05:29:19
Is ANS better for SIMD and is it much slower in terms of decoding speed?
2021-12-23 05:35:01
Because as I said before, something with very fast decoding and good compression is also quite useful thing
Fraetor
2021-12-23 05:36:25
Would Zstd compressed raw RGBA data be any good for that?
Scope
2021-12-23 05:42:01
Image format encoders will usually always be better than compressors for general data, since this is a narrower and better known task, at least if not using special data pre-filtering for better compression
Fraetor
2021-12-23 05:43:42
Fair.
veluca
Scope Image format encoders will usually always be better than compressors for general data, since this is a narrower and better known task, at least if not using special data pre-filtering for better compression
2021-12-23 05:49:49
png is pretty much a preprocessor + lz77 😄
_wb_
2021-12-23 06:50:32
If you push things for speed, encoding is faster than decoding because the encoder knows all pixel values from the start while the decoder first needs to decode them
2021-12-23 06:52:36
So the encoder can do prediction with simd but the decoder cannot
2021-12-23 06:53:44
With huffman, the encoder can encode 16 symbols at a time and concatenate them, but the decoder cannot take the concatenated bitstream and decode 16 symbols at a time
2021-12-23 07:02:45
Faster decoding could be possible by decoding multiple groups in the same thread so you can process multiple huffman streams with simd, but that gets very tricky to implement and in terms of memory locality it doesn't sound very appealing to work on 16 groups at the same time
Scope
2021-12-23 07:04:36
And ANS is much slower in theoretical decoding speed?
_wb_
2021-12-23 07:10:07
Not much
2021-12-23 07:10:30
It's probably similar enough to huffman in decode speed
2021-12-23 07:10:40
Mostly slower / more annoying to encode
2021-12-23 07:11:44
And you cannot do different parts of the bitstream in parallel and then concatenate them like you can with huffman
Scope
2021-12-23 09:55:34
<:PepeGlasses:878298516965982308> https://news.ycombinator.com/item?id=29661498
BlueSwordM
Scope <:PepeGlasses:878298516965982308> https://news.ycombinator.com/item?id=29661498
2021-12-23 09:59:47
I find it interesting that nobody is looking at JXL or WebP as very fast formats <:kekw:808717074305122316>
190n
2021-12-23 09:59:55
someone's suggesting zstd for lossless audio <:Thonk:805904896879493180>
2021-12-23 09:59:59
> ZStandard is a very good compressor, with an especially fast decompressor. Maybe someone should try using this instead of zlib in an audio format (FLAC, WavPack, ...)
Scope
2021-12-23 10:00:07
190n
2021-12-23 10:00:16
flac and wavpack don't actually use zlib do they?
Scope
2021-12-23 10:00:27
now say that about jpeg xl 🤭
BlueSwordM
190n flac and wavpack don't actually use zlib do they?
2021-12-23 10:00:29
No, they use their own entropy coders.
190n
2021-12-23 10:00:45
lol zstd compresses one audio file i had lying around far, far worse than flac
2021-12-23 10:00:47
surprising no one
2021-12-23 10:01:10
anyone with a hacker news account feel like replying? https://news.ycombinator.com/item?id=29666336
BlueSwordM
190n anyone with a hacker news account feel like replying? https://news.ycombinator.com/item?id=29666336
2021-12-23 10:04:02
Yes.
spider-mario
2021-12-23 10:09:19
> _Who_ cares that it's not set up for simd? > Seriously, who? > This project is interesting because of how well it does compared to other systems of much higher complexity and without optimizing the implementation to high heaven. We can all learn something from that.
2021-12-23 10:09:20
can we?
veluca
2021-12-23 10:42:48
> QOI is designed with a very specific purpose in mind, which is fast decoding for games. This kind of image will be very unlikely be large enough to benefit from multi threading, and if you have a lot of them you can simply decode in parallel. It’s not meant to the the “best” image format. but it sure would benefit from SIMD...
BlueSwordM
veluca > QOI is designed with a very specific purpose in mind, which is fast decoding for games. This kind of image will be very unlikely be large enough to benefit from multi threading, and if you have a lot of them you can simply decode in parallel. It’s not meant to the the “best” image format. but it sure would benefit from SIMD...
2021-12-23 11:40:24
Indeed <:kekw:808717074305122316>
2021-12-23 11:40:34
GPUs are just SIMD units 😛
2021-12-23 11:41:09
Rather, SIMT.
Fraetor
2021-12-24 12:17:36
Also, I'm pretty sure that the main purpose in mind for QOI is just simplicity.
_wb_
2021-12-24 06:07:19
I think speed and simplicity were the main selling points of qoi.
spider-mario
2021-12-24 08:11:40
which reminds me of an old post about LightDM I believe
2021-12-24 08:11:54
which was similarly touted as being much less code than GDM
2021-12-24 08:12:09
the article pointed out that it achieved that by leaving out a whole bunch of features (for example relating to accessibility)
2021-12-24 08:12:23
and that if it added them back, it would likely end up with a similar amount of code as GDM
2021-12-24 08:12:42
not sure if that prediction ever came true but I guess we could check
2021-12-24 08:13:46
the conclusion was basically “sure, it’s easy to have a lightweight codebase if you remove most features”
2021-12-24 08:13:58
so not a very new lesson from QOI, it would seem
Scope
2021-12-24 08:49:31
BlueSwordM
Scope
2021-12-24 03:36:58
Damn it, why not just work on a standard that already exists?
2021-12-24 03:37:21
We already have enough formats with YUV, multi-threading, multiple bit depths, etc.
_wb_
2021-12-24 07:25:23
https://www.reddit.com/r/AV1/comments/rkcx0o/we_need_to_rethink_avif_lossless_mode/
Cool Doggo
2021-12-24 07:31:39
> Avif is coming now already and for companies there's just no reason to switch to JXL 🤔
Scope
2021-12-24 07:53:43
https://www.mdpi.com/2079-9292/10/3/360/htm
190n
_wb_ https://www.reddit.com/r/AV1/comments/rkcx0o/we_need_to_rethink_avif_lossless_mode/
2021-12-24 08:07:54
> avif is much faster than jxl on the slowest speed do people not realize how dumb a comparison this is? like, i could make libjxl win by deleting all the presets except lightning, but that would make the encoder objectively worse <:kekw:808717074305122316>
_wb_
2021-12-24 08:28:47
Try the 'slowest setting' of fjxl 😛 (it has only one setting)
190n
2021-12-25 09:33:25
anyone know where, in practice, JPEG is actually decoded in hardware?
_wb_
2021-12-25 09:59:25
I assume in cameras
190n
2021-12-25 10:03:25
lol https://stackoverflow.com/questions/46497948/is-it-possible-to-use-hardware-jpeg-decoding-on-android-and-if-so-how
Fraetor
2021-12-25 10:03:27
Intel CPUs since ivy bridge have had hardware for decoding JPEG in quicksync video
190n
2021-12-25 10:03:42
yeah but i'm not aware of anything that actually uses that hardware
Fraetor
2021-12-25 10:03:53
But I don't know how widely used it in by software.
190n
190n yeah but i'm not aware of anything that actually uses that hardware
2021-12-25 10:04:00
except maaaaybe if you have a webcam/capture card using MJPEG
Fraetor
2021-12-25 10:04:26
Yeah. I think most things just use software decoding.
190n
2021-12-25 10:04:52
trying to argue against "no jpeg xl hardware decoding"
2021-12-25 10:05:09
hell, even AVIF isn't decoded in hardware afaict, although it would probably benefit more than any other codec <:kekw:808717074305122316>
Fraetor
2021-12-25 10:07:01
The thing with images is that they much more often exceed the limitations of hardware acceleration, as compared to video.
2021-12-25 10:07:32
Is webp hardware accelerated anywhere. vp8 has acceleration hardware right?
190n
2021-12-25 10:08:20
vp8 depending on the device
2021-12-25 10:09:33
nvidia has hardware vp8 decode since maxwell except certain pascal cards didn't have it <:Thonk:805904896879493180> https://developer.nvidia.com/video-encode-and-decode-gpu-support-matrix-new
2021-12-25 10:11:09
according to wikipedia, intel dropped vp8 support in RKL and ADL https://en.wikipedia.org/wiki/Intel_Quick_Sync_Video#Hardware_decoding_and_encoding
2021-12-25 10:11:12
idk about AMD
2021-12-25 10:11:39
vp8 never really took off the way vp9 did so it wouldn't surprise me if we saw more lineups dropping it
Fraetor
2021-12-25 10:12:15
Fair. I think that the only two major users that I know of are YouTube and webp.
190n
2021-12-25 10:12:40
youtube may have previously, but i don't think they serve vp8 anymore
2021-12-25 10:12:53
just h.264, vp9, av1, and maybe 3gpp or some other old thing for feature phones
Fraetor
2021-12-25 10:12:57
I think you can still get it on older videos.
2021-12-25 10:13:12
I don't think they encode to it anymore though.
190n
2021-12-25 10:13:27
i remember seeing vp8 previously but i haven't seen any videos with it lately, including old videos
2021-12-27 05:59:19
https://github.com/190n/yaqoi
2021-12-27 06:00:10
docs coming soon TM but: ``` make ./enqoi -i foo.png -o foo.qoi ``` i'm pretty sure that encoding does actually work <:kekw:808717074305122316>
2021-12-27 06:02:38
if i have time and motivation i wanna make it multithreaded
_wb_
2021-12-27 07:04:45
Isn't the original qoi also written in C?
190n
2021-12-27 07:08:35
yeah that's why it's "yet another"
2021-12-27 07:08:48
i might make it multithreaded
_wb_
2021-12-27 07:30:21
MT encode seems easy enough - is MT decode possible at all?
190n
2021-12-27 07:31:29
i don't think so
2021-12-27 07:31:52
well maybe with cooperation from the encoder, but there isn't really a way to indicate that
2021-12-27 07:32:29
i did plan to write a decoder too but honestly that seems less interesting now
2021-12-27 07:33:02
except maybe as some kind of "qoi inspector" that shows how different parts of the image were encoded
2021-12-27 07:33:22
oh i just realized that my encoder is broken oops
2021-12-27 08:31:24
oh the problems were deeper than i had thought
_wb_
2021-12-27 08:36:32
It's a bit silly that runs of 1 are allowed
2021-12-27 08:36:35
In qoi
2021-12-27 08:36:54
While you can already do a diff of zero also in 1 byte
190n
2021-12-27 08:37:13
could also do an op_index using whatever the last pixel hashed to
_wb_
2021-12-27 08:37:44
Yes, that too
190n
190n oh the problems were deeper than i had thought
2021-12-27 08:38:42
ok i think i fixed this problem, but my output is still a little larger than the reference encoder <:Thonk:805904896879493180>
2021-12-27 08:38:51
optimal encoding must not be as trivial as i thought
_wb_
2021-12-27 08:39:57
Well if it's not a run, then either a pixel is 1, 2, 4 or 5 bytes
190n
2021-12-27 08:43:52
ok seems like i missed an opportunity to use OP_LUMA
190n oh the problems were deeper than i had thought
2021-12-27 08:44:18
i definitely use it sometimes, because the reason for this result was writing that opcode incorrectly
_wb_
2021-12-27 08:45:19
Ah
2021-12-27 08:45:32
You're not adding all pixels to the hash table
2021-12-27 08:45:53
Or are you?
190n
2021-12-27 08:46:26
the only cases i don't are for run and index in which case the hash table should already contain the current pixel
_wb_
2021-12-27 08:46:56
Maybe you are
190n
2021-12-27 08:48:19
oh for luma i think i'm calculating `(cur_px.r - last_px.r) - (cur_px.g - last_px.g)` instead of `(last_px.r - cur_px.r) - (last_px.g - cur_px.g)`
2021-12-27 08:48:32
but in that case it's weird that my output decodes correctly <:Thonk:805904896879493180>
_wb_
2021-12-27 08:49:43
Is it actually using that option?
190n
2021-12-27 08:52:18
you mean OP_LUMA? yes, 34,396 times on that image
2021-12-27 08:52:30
ohhhhh
2021-12-27 08:52:49
my `op_luma_compatible` function doesn't account for wraparound
2021-12-27 08:53:57
the current pixel goes from `#ffffff` to `#0f0f0f`, so the difference is `-240`, but you can actually make that work by encoding a difference of `+16` because of overflow
2021-12-27 08:54:57
ok i'll fix that later today
_wb_
2021-12-27 08:55:48
I just noticed too
2021-12-27 08:55:59
You shouldn't use int16 for the differences
2021-12-27 08:56:09
Just use uint8 for everything
190n
2021-12-27 08:56:09
just uint8?
2021-12-27 08:56:13
yeah that makes sense
_wb_
2021-12-27 08:56:29
Then you get the wraparound automatically
2021-12-27 08:57:40
(can reinterpret it as int8 if you want, or just change the conditions)
190n
190n ok i'll fix that later today
2021-12-27 08:59:44
sike i fixed it now
2021-12-27 09:00:09
i now have identical output to reference on at least that random screenshot, i'll test more later
2021-12-27 09:00:22
thanks for the help!
_wb_
2021-12-27 09:46:16
If I would do a QOI, I would do it like this: 111: run of 2 to 31 pixels, special cases for direct RGB or RGBA pixels like in qoi 100xxsaa: all channels unchanged except channel xx which gets a value -4..+4 (s is sign, aa is amplitude-1, zero diff cannot be expressed) 000xxddd: same but don't write the pixel yet (read next code first and apply it as if the previous pixel was what you have after doing the diff) 101xxxxx: 5-bit hash 001xxxxx: 5-bit hash but don't write the pixel yet 011ddddd xxxxxxxx yyyyyyyy: copy 2 to 33 pixels (given by d+2) starting 0 to 255 (y) rows above this pixel, at x position -128..127 (signed x) from the current positin.
nathanielcwm
190n well maybe with cooperation from the encoder, but there isn't really a way to indicate that
2021-12-28 05:32:09
time to make ur own qoi extension™️
Scope
2021-12-28 01:27:17
<:Thonk:805904896879493180> https://twitter.com/richgel999/status/1475789363183239174
improver
2021-12-28 02:38:20
im already tired of this QOI meme
_wb_
2021-12-28 02:44:19
https://c.tenor.com/pu_reybkdMYAAAAM/quoi-what.gif
2021-12-28 02:44:42
https://c.tenor.com/xXSj3e2-zcQAAAAM/jdg-quoi.gif
Scope
2021-12-28 02:50:51
I mean, QOI is good as an experiment, but why add it to real working apps, it's a simple format, easy to integrate, but, for everything else, the advantages are very questionable
_wb_
2021-12-28 02:53:59
Well it's not worse than, say, BMP
2021-12-28 02:58:32
It has little value as an interchange format though - it does nothing that PNG cannot already do
Scope
2021-12-28 02:58:33
BMP mostly exists because it's a very old, proven and well-known format, from a time when maybe there wasn't anything better and BMP support is not that common nowadays, especially in modern apps, usually PPM is more common for a lightweight format And for Basis Universal, I think using FPNG from the same author would be a better solution (especially since it's just a replacement for the encoder/decoder, not adding a completely new format)
_wb_
2021-12-28 03:01:15
What I think would be useful is something like PPM/PAM/PFM/farbfeld that works for any number of channels, with multiframe support, and bit depths up to 32-bit float.
2021-12-28 03:01:38
As an uncompressed format to pass things between applications like imagemagick and ffmpeg
2021-12-28 03:02:44
Ah and with a way to store an icc profile too
2021-12-28 03:28:13
Something like this: 8 bytes: magic (0x1337DA7A "img\0") 1 byte: planar or interleaved (0=planar, 1=interleaved) 1 byte: bitdepth (valid options are 1..16 and 32, bytes per sample is 1, 2 or 4, samples are stored as uint8, LE uint16 or LE binary32 float, padding zeroes in the msb, so e.g. 10-bit is done as uint16 with range 0..1023) 2 bytes: LE uint16 nb_channels 4 bytes: LE uint32 width 4 bytes: LE uint32 height 4 bytes: LE uint32 nb_frames 4 bytes: LE uint32 icc_length (if zero: implicitly sRGB) icc_length bytes: icc profile blob Image data itself: If planar: samples[frame][channel][height][width] If interleaved: samples[frame][height][width][channel]
Scope
2021-12-29 07:34:49
https://twitter.com/phoboslab/status/1475936085737938945
190n
2021-12-29 09:24:11
data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAABBsAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAPAAAACgAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAABAA0ABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAABCNtZGF0EgAKChgd++f7ICGg0IAyighE+QAoFChZ+PAga+9CwCrDFRkyzczpUZpkWDrAIpVqUUkzDZRC010BI4K+3EY0rOItBrtbnIkgt7WsvzwzPh4RgI53oD93YlXhc9zwKgE60SwxTw3S3qsQpa+3GCNGi+OuXHvlM0B8hvKiEKpdzWgWt8wt2Y5yD+SDr3j9DtXwHKC9+d0lFeFUWSrNqDBp4SwnzjcdIaugDnEs2NV+Kqu7Zo+e/5spzyqOfBFsdskRDl5QmeRIE3mzwe3NqsGZk7S7Cc6NXI4jQfflXkulWQbkoHDkihpR1QMMdbDB9EG16gomABYEOuQLhUrrQW6xEpYZUuHIMy90w7jDnIkFfUptoLdwdO8slz4za8PV3RqlWajXu/yNC2IPhpPQoF7bjL2pVgx1ImAwPfgMa3/rSjmNOv9iAyU+EEyXBePQjWNDTmqecIPTmoF9K3n/0/r+VnUqwUYm+dSc25GBpngseIUD7OPKjWsZeAa/OtMVlYwkoyLgLkPbm7OjC3IoRxcDK7pCjLYGbyV4KxXSEO0vnVZWsXKvVEQtsXZ80CnmG3yMFma+8cutQUgnxEw0qJx+K5QR0Dif21i5GOvETUTHHgFfnHF35QRdBgway96bL4EUJLxjvftEppQ8gB8GIfOF3a8FsuTfSdnO302cqwVsK5yKLxWPxu8dDv6EnRY7X06a5dqcoJeny5nC4J0DjX9tskKCySLoREnAcSKvwYCux4LJpYDqnbm1uYsi7fk1nkiwsVmyo/ZP0KuKq2nblcfAwQ1sRHCwxELfltZZG9kaKTntRkb5S6N/VZUa3CP0YWAqT5c7oPadP2i526brpX2yKyDT+IQIuYbXXZZFN2m+duyhBFuY/H6lxUkXhdPEtNoyNf4+JWIFt3sYig9r83zBaG6eULQhr/zOXc8h0Fiybvn8Zz1MNmXh64k/IvRACC0kTsfFzY2oTiywaOlbMvLOvOVAejyjFpZl7evYme63r4mBfYZVxptdPcY1mAWQ0DOOa+/4Bk2PHOuYdXMSOwe+0X9zqogjEBr00lPifvZMf+vcFgsB/tiM+W+B2/FchVcDJWDrHbcQpn27gKs3j5+wiIOCI9/qSyw0VsCeyEMgRGUhWqNRHwBsZmrhGFijUnuytEDTD4FC3A0PEzVQKl+1/PTJKScFVSCyl6eOfOWrsJh8ZgnP6nKg3eeEtIULZVgSomS7ElBDNrI/o3QWV7vRHeWRsx2ENi3zLYtOk7w6JkrkmuDDjh4EvwcWjlVwrNbITjUZat5l9IQfOx8vwfbq77TPRiQ1CVR0Fd+ZmqquBQ0yCiswp0whDG0qwwhENGPOFH/rPTOEWdXsgR2lw/0sIviJhHUqAnwg6xqhb3qyikHRzGl3/HNZVeqWzg==
_wb_
2021-12-29 10:07:27
https://c.tenor.com/oQBk2zzwYBgAAAAM/aaaa-cat.gif
2021-12-29 10:07:46
(the avif header in base64)
2021-12-29 12:17:59
A jxl starts with `/w` in base64 and from there on it can basically be anything
2021-12-29 12:19:24
When the optional container is used, it will also have some AAA (zero bytes)
nathanielcwm
2021-12-29 01:26:41
https://youtu.be/59jHEoNSlA0
_wb_
2021-12-29 02:41:47
2 bytes of 'overhead' for naked jxl, 42 bytes for containered jxl, ~250 bytes for avif iirc
2021-12-29 02:42:31
Where 'overhead' is defined as signatures or redundant header fields
nathanielcwm
2021-12-30 07:46:55
https://cdn.discordapp.com/attachments/677266163994198020/925852791908499556/matrix-trailer-ssa.mkv
haaaaah
2021-12-30 10:34:15
nathanielcwm https://cdn.discordapp.com/attachments/677266163994198020/925852791908499556/matrix-trailer-ssa.mkv
2021-12-30 10:34:24
So it's a subtitle (Substation Alpha) encoded video