video thumbnail 32:00
How PNG Works: Compromising Speed for Quality

2022-03-28

[public] 14.1K views, 19.9K likes, dislikes audio only

channel thumbReducible
4K

Visit https://brilliant.org/Reducible/ to get started learning STEM for free, and the first 200 people will get 20% off their annual premium subscription.

Chapters:

0:00 Introduction

1:35 Exploiting redundancy

2:09 Huffman Codes

4:22 Run Length Encoding

5:23 Lempel-Ziv Schemes (LZSS)

13:50 Transforming the problem

14:36 Filtering

17:46 How PNG Picks Filters

18:58 Heuristics for Filtering

21:06 PNG Encoding/Decoding

23:04 The Compromise: PNG Is Slow

23:31 Quite OK Image (QOI) Format

28:26 Benchmark Results

29:27 Final Thoughts

30:36 Brilliant Sponsorship

Developed in the mid 1990's, the PNG encoding standard for images is now the most used image format on the web. One aspect that makes PNG quite attractive for users is image quality is perfectly preserved as a result of lossless compression. In this video, we dive into how exactly PNG is able to compress images so well, while also retaining all the information in the image.

One thing we discover during this journey is how slow PNG is in practice. Towards the end, we discuss a relatively new image format called QOI that is somewhat comparable to PNG, but 20-50x faster. But what's perhaps the most remarkable aspect of QOI is how a simple set of rules lead to surprisingly good compression on a variety of images.

Animations created jointly by Nipun Ramakrishnan and Jesús Rascón.

*Minor error in QOI section: QOI_DIFF_SMALL should have a tag of 01 not 10 (QOI_DIFF_MED has the tag 10.*

References:

PNG Specification: https://www.w3.org/TR/PNG/#9Filters and http://www.libpng.org/pub/png/spec/1.2/png-1.2.pdf

A nice interactive guide to LZSS: https://go-compression.github.io/algorithms/lzss/

A definitive guide to all the details we didn't have time to talk about with respect to PNG: http://www.libpng.org/pub/png/book/chapter08.html

A deep dive into all the details of DEFLATE: https://www.youtube.com/watch?v=oi2lMBBjQ8s&ab_channel=BillBird

Initial blog post introducing QOI: https://phoboslab.org/log/2021/11/qoi-fast-lossless-image-compression

Data on Image File Format Usage across Websites: https://w3techs.com/technologies/overview/image_format

QOI Specification: https://qoiformat.org/qoi-specification.pdf

QOI Source Code/Benchmark Results https://qoiformat.org/:

This video wouldn't be possible without the open source library manim created by 3blue1brown and maintained by Manim Community.

The Manim Community Developers. (2022). Manim – Mathematical Animation Framework (Version v0.11.0) [Computer software]. https://www.manim.community/

Here is link to the repository that contains the code used to generate the animations in this video: https://github.com/nipunramk/Reducible

Music in this video comes from Jesús Rascón, Aaskash Gandhi, and Myuu.

Socials:

Patreon: https://www.patreon.com/reducible

Twitter: https://twitter.com/Reducible20

Big thanks to the community of Patreons that support this channel. Special thanks to the following Patreons:

Andreas

Adam Dřínek

Burt Humburg

Matt Q

Winston Durand

Andjela Arsic

Mutual Information

Richard Wells

Sebastian Gamboa

Zac Landis


The Unreasonable Effectiveness of JPEG: A Signal Processing Approach by Reducible
/youtube/video/0me3guauqOU
Huffman Codes: An Information Theory Perspective by Reducible
/youtube/video/B3y0RsVCyrw
Introduction
/youtube/video/EFUYNoFRHQI?t=0
Exploiting redundancy
/youtube/video/EFUYNoFRHQI?t=95
Huffman Codes
/youtube/video/EFUYNoFRHQI?t=129
Run Length Encoding
/youtube/video/EFUYNoFRHQI?t=262
Lempel-Ziv Schemes (LZSS)
/youtube/video/EFUYNoFRHQI?t=323
Transforming the problem
/youtube/video/EFUYNoFRHQI?t=830
Filtering
/youtube/video/EFUYNoFRHQI?t=876
How PNG Picks Filters
/youtube/video/EFUYNoFRHQI?t=1066
Heuristics for Filtering
/youtube/video/EFUYNoFRHQI?t=1138
PNG Encoding/Decoding
/youtube/video/EFUYNoFRHQI?t=1266
The Compromise: PNG Is Slow
/youtube/video/EFUYNoFRHQI?t=1384
Quite OK Image (QOI) Format
/youtube/video/EFUYNoFRHQI?t=1411
Benchmark Results
/youtube/video/EFUYNoFRHQI?t=1706
Final Thoughts
/youtube/video/EFUYNoFRHQI?t=1767
Brilliant Sponsorship
/youtube/video/EFUYNoFRHQI?t=1836
Patreon patreon.com
https://www.patreon.com/reducible
The Discrete Fourier Transform: Most Important Algorithm Ever? 24,458 views
/youtube/video/yYEMxqreA10
Reducible This channel is all about animating computer science concepts in a fun, interactive, and intuitive manner.
/youtube/channel/UCK8XIGR5kRidIw2fWqwyHRA