How PNG Works: Compromising Speed for Quality

How PNG Works: Compromising Speed for Quality

Reducible

2 года назад

625,999 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Michael Yehorov
Michael Yehorov - 18.09.2023 22:19

One obvious idea for QOI is to use different parameters for images of different sizes (for example the index array length) and store this information in a small header

Ответить
eyal hamtsany
eyal hamtsany - 20.07.2023 08:56

Great video! I really learned a lot from it! Thank you for that.
One correction, if I may: in the QOI description you have the same 2-bits TAG (of '1 0') for both QOI_DIFF_SMALL and QOI_DIFF_MED. I think this is incorrect.

Ответить
Nitesh Tyagi
Nitesh Tyagi - 10.07.2023 12:22

kindly explain in detail which software do you use to create such awesome videos. thanks .

Ответить
Alex C
Alex C - 07.07.2023 05:03

This could have been a lot simpler if you'd just written negative numbers as negative numbers instead of wrapping them

Ответить
j7ndominica0
j7ndominica0 - 15.05.2023 01:18

Most software I have seen uses a delta filter always on TrueColor input. On screenshots or hi-color 555 computer graphics manually selecting None in FastStone Viewer yields a smaller file size. PNG is also beaten by deflated TIFF if the filter can't be deselected. You can see what the delta filter outputs by selecting compression:None. The edges of artificial shapes bleed with a delta filter, and filtering a low bit depth source fills the bottom bits. There is no 6-bit depth in PNG; pixels get padded out ot 8 bits.

PNG lacks a channel decorrelation transform like YCoCg for near-gray parts.

PNG is indeed a bit slow to encode. It's annoying when games only offer this format with high compression selected for temporary screenshots. Even with no compression it is a bit slow which I think comes down to calculating checksums for the data chunks.

I don't see a use case for QOI. Do we need to capture huge amounts of simple screenshots with repeating pixels? Perhaps to illustrate a software manual? As other simple algorythms, it can't compress photgraphic data at all.

Wait until the end of the universe to save a damn image. JXL and AVIF have entered the chat.

Ответить
Hongyuan Li
Hongyuan Li - 18.04.2023 05:13

Did the inventor of QOI test recording the difference of point (x,y) with the average of three neighboring points: Round((x-1,y-1)+(x-1,y)+(x,y-1)/3)?

Ответить
Tathar
Tathar - 10.04.2023 00:02

Realistically, how often would the QOI_DIFF_SMALL tag meet its conditions? Could something else use that tag ID for better purposes?

Also, for extremely large images that can't fully be stored in memory, is there any form of compression that doesn't require decompressing the entire image (extremely slow) and throwing away the excess you don't want to display? This one doesn't seem to ever reach a state that doesn't rely on previous states.

Ответить
XH39Z9
XH39Z9 - 29.03.2023 19:55

so inspiring and all but still not knowing why we cant take pictures on png or tif, or raw or what ever losless picture format, but yeah, android still trash.

Ответить
Tim Seguine
Tim Seguine - 13.03.2023 21:23

The QOI algorithm gives me an idea for another algorithm that might also be fairly fast but also decent, since the fact that this algorithm works has some implications about the way pixels tend to be organized in images. Will have to see if I can ever find time between my other ideas.

Ответить
nablablaFPV
nablablaFPV - 01.03.2023 03:33

the part 'heuristic for filtering ' is weird, why would you try every combination? if you can try it row by row? I don't see a heuristic here. it's just a local optimum

Ответить
Notebook
Notebook - 17.02.2023 13:17

filter AVG is lossy. 3/2 =1

Ответить
mseeks
mseeks - 15.02.2023 23:35

Thanks!

Ответить
Be Free
Be Free - 02.12.2022 13:37

The QOI format is quite interesting. However, it can be made even smaller, by using Huffman coding for the QOI instructions, which will only marginally increase the runtime, but will quite drastically decrease the file size, in some cases compressing even better than PNG.

Ответить
Alan Decowski
Alan Decowski - 11.11.2022 12:28

Wrote a PNG decoder for a class.
This is an excellent overview video... but damn, when you go deeper it's just so complicated...

Also, try to write one in Java. It sucks.
Can't believe that Java does not have unsigned ints.

Ответить
Stephen Akuamoah
Stephen Akuamoah - 02.11.2022 21:35

Thanks!

Ответить
just something
just something - 24.10.2022 23:02

Interesting

Ответить
TheOPtimal
TheOPtimal - 07.10.2022 21:06

Honestly, this video made me appreciate PNG more than anything.

Ответить
MIDAS redblade
MIDAS redblade - 14.09.2022 21:55

so QOI was invented by accident

Ответить
RaaynML
RaaynML - 23.08.2022 15:55

It seems like QOI + lz4/lzo would be the theoretical ideal image compression method, for speed and size, since PNG + lz4 provides no benefit for size but QOI by itself loses in average compression ratio

Ответить
__
__ - 18.08.2022 00:53

I mean, if you really need to save images faster than png, there's always bmp lmao

Ответить
RedStoneMatt
RedStoneMatt - 08.08.2022 06:17

Absolutely fantastic, very interesting and easy to understand

Ответить
agxryt
agxryt - 07.08.2022 19:56

This video needs a new title. No one who isn't already knowledgeable with how PNG/compression works is going to understand this. Just look at the comments, and the discussion people are having

Ответить
Caros
Caros - 02.08.2022 09:27

I have to say, this is a really fantastic video. I'm studying on image signals, ur video helps me understand too much! thanks.

Ответить
Steve Desamos
Steve Desamos - 01.08.2022 17:57

I’d love to see a video that talks about how some PDFs can actually increase in filesize when zipped

Ответить
Eyevou
Eyevou - 31.07.2022 06:17

Super interesting and very informative!

Ответить
Stutav Agrippa
Stutav Agrippa - 28.07.2022 20:37

They missed the opportunity to call UP "SUP" in PNGs.

Ответить
No_name
No_name - 12.07.2022 19:19

so QOI is basically the "trow an hasp table to every problem" kind of soluton

Ответить
MrVipitis
MrVipitis - 12.07.2022 13:12

As a computational linguistics student. I come across by pair encoding for generating vocabs used for tokenizers. I have only worked with convolutional neural networks that work with images once.

Image space is vast, the 64pixel example with 3x8 bit has more potential images than atoms in the universe. But the vast majority of those images are horrible noise. Only a tiny subset are actual images.

That's why you can compress in the first place.


.PNG is horrible for high frequency photos or renders. It shouldn't be used as an intermediate for frame sequences. .exr does it better.

Ответить
Desam1000
Desam1000 - 30.06.2022 22:49

Very nice.
Of course there should be easy to construct counter-examples where QOI is really bad at compression.
I am just thinking about a pixel chess-pattern with a slight gradient but ensured high differences in green values.

Ответить
吉井雄太朗
吉井雄太朗 - 29.06.2022 07:54

Quick suggestion about the QOI image format, since I can't think of any other place for discussion.
Since color indexing of consecutive values is technically possible, why not start the run-length encoding from n=3 instead of the current n=2 as in the spec? We just need to change the run length bias from -1 to -2. Am I missing something or is there an intention behind this feature?

Ответить
andi
andi - 23.06.2022 14:33

Png is more better than jpeg xl. Just got 45% more smaller but sacrifice 150x more slower...

Ответить
antipoti
antipoti - 16.06.2022 04:50

Im genuenly surprised that png doesnt use color transformation like jpeg. Even lossless id image that hsv color space would be inherently more redundant in common human images than rgb.

Ответить
Freedom Phoenix Goat
Freedom Phoenix Goat - 09.06.2022 16:03

Those dam Russians, first Tetris, now this XD great video!

Ответить
Kunai
Kunai - 09.06.2022 00:43

your video is linked on the wikipedia page of the QOI format :D

Ответить
S3Kglitches
S3Kglitches - 07.06.2022 19:36

Very inspirating, thank you.
How is it with parallelization of PNG/QOI? It seems that the processing must be done sequentially and because of that no parallel processing (especially encoding) is possible, am I right?

Ответить
TwoOneEight
TwoOneEight - 06.06.2022 19:39

Can you make a video about chroma subsampling? I'm trying to understand the different values 4:4:4, 4:2:0 etc.

Ответить
HarryBallsOnYa
HarryBallsOnYa - 06.06.2022 18:43

Classic case of "Keep It Simple, Stupid"

Ответить
Canes Venatici
Canes Venatici - 06.06.2022 14:36

After filtering, how does the PNG decoder knows the difference between say positif 255 and negative 1?

Ответить
Earl Dominic
Earl Dominic - 06.06.2022 13:28

set the speed to 1.25x, to watch a 3blue1 brown video

Ответить
MrTridac
MrTridac - 05.06.2022 10:34

That's a good example of the difference between computer science and software engineering. PNG is an academics solution. QOI is an engineers solution.

Ответить
H1 le woxy-foxy roux
H1 le woxy-foxy roux - 05.06.2022 05:26

QOI's creator is my hero for fitting the specification onto a single page.

Ответить
Clark Kent
Clark Kent - 02.06.2022 01:42

png is hella smart

Ответить