3 ms·
I'm pretty skeptical of using bzip2 as the entropy coder compared to DEFLATE as used in PNG. bzip2 is really slow. Also I would hope that an image format design
by pcwalton 11y ago
I'm pretty skeptical of using bzip2 as the entropy coder compared to DEFLATE as used in PNG. bzip2 is really slow. Also I would hope that an image format designed in 2016 would admit some degree of parallel decoding, but by leaning so heavily on a slow entropy coder they also killed all parallelism opportunities.
Browsers routinely spend as much time in image decoding as they do in layout, so this matters.
If you want a purely entropy coded format with a trivial, easily memorizable file format, just use PNG with all scanlines set to the None filter, one IDAT chunk, and one IEND chunk. Totally trivial, and probably simpler because DEFLATE is a relatively simple format.
- JoshTriplett 11y ago> I'm pretty skeptical of using bzip2 as the entropy coder compared to DEFLATE as used in PNG. Or compared to xz. bzip2 seems completely obsolete: gzip provides much faster compression and decompression, and xz provides better compression ratios with faster decompression. Not to mention new algorithms like brotli.
- jacobolus 11y agoBrotli is a text/markup compression codec with a big dictionary of English words and chunks of html. Why would you use it for binary data?
- legulere 11y agoEven though it's optimized for text, doesn't mean it's not also better for binary. For instance it's also used for binary font files in WOFF2 and seems to perform very well.
- zenojevski 11y agoThe simplicity of the approach means that, given that the compressor is not baked into the format, it is readily exchangeable without having to change Farbfeld. In addition, nothing stops someone from creating an optimized compression format and bring it in with the same ease.
- pcwalton 11y agoWhy not just have that compression format be PNG filtering + DEFLATE? PNG filtering is extremely simple and is probably implementable in two dozen lines of code. It's nothing compared to the complexity of the entropy coder. At that point you might as well just be a subset of PNG, which is nice for interoperability anyway.
- zenojevski 11y agoI'm not really an expert on the matter, but couldn't PNG filtering be implemented in the same way, i.e. as a filter just like Farbfeld? This way it would keep the same composability, and be used with other formats too. Considering there are no stand-alone implementation of these, I guess the author simply went with what achieved the highest compression ratio, regardless of speed. But it would be interesting to see if a complete ecosystem can pop up around it sooner or later, especially given the renewed interest in arguments between "the unix way" and other philosophies.
- pcwalton 11y agoYou could use PNG filtering in other formats, sure. I don't know why you wouldn't just use PNG at that point, though. The only difference between this and PNG is the chunk format to encode IHDR, IDAT, and IEND (which is really easy) and a handful of extra bytes in the IHDR chunk to specify truecolor mode and so forth. The truecolor-with-no-extra-chunks subset of PNG is incredibly simple.