Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How does this compare to PNG? I believe the latter is lossless, so presumably it's just the plain pixels with Huffman or something similar. But I'd be curious to know more details.


It's a totally different approach, a bit too much to explain in a HN comment; but generally it involves rearranging the data with a set of filters, and then compressing with what is essentially gzip.


PNG filters basically difference each byte of each line of image data with a choice of [1] nothing, [2] the pixel preceding the current one, [3] the pixel immediately above on the previous line, [4] an average of the latter two, or [5] "Paeth" (a dynamic choice between the left, up, and upper-left pixels), the goal being to increase redundancy for areas of smooth gradients. Each line has its own choice of filter indicated by a prefix byte. Then it compresses the differenced data using gzip/flate/zlib (a general-purpose LZ+Huffman algorithm).


Yup. PNG is 1, if JPEG were a 10 on the complexity scale (which it isn't, it is pretty simple on the absolute scale). You can understand PNG if you know a bit about algorithms, but you need a tiny bit more than high-school math to really grok JPEG.

Lossless encoding can be far simpler to understand (in some cases it's not, see FLAC).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: