3 ms·
Looks like there isn't an encoder for PNG: https://github.com/google/wuffs/tree/main/std/png https://github.com/google/wuffs/tree/main/std/png Given the projec
by dividuum 6y ago
Looks like there isn't an encoder for PNG: https://github.com/google/wuffs/tree/main/std/png https://github.com/google/wuffs/tree/main/std/png
Given the project goals, I guess most encoders don't make a lot of sense: For image encoding you basically provide an "x * y * bytes_per_pixel" memory area and an encoder does its magic on that. There isn't really any complicated untrusted input in that case.
- 1-6 6y agoDarn, I had a handful of NumPy arrays which could use a fast encoder.
- xyzzy_plugh 6y agoBut I'm sure there are plenty of fast encoders? Wuffs isn't the path to a fast encoder. It's a path to something safe that is also pretty fast. If you're encoding PNGs from NumPY arrays you don't care at all about safety. If, for some reason I can't quite comprehend, whatever encoder you have on hand isn't fast enough, you can just disable compression optimizations -- but at that point you may as well be writing out a bitmap.
- commandlinefan 6y agoThe performance tradeoff isn't as justifiable, either: most images are decompressed orders of magnitude more times than they're compressed (generally just once).
- mjevans 6y agooptipng and pngcrush come to mind, but in the spirit of big O notation a run through those might be considered one macro-encoding process.
- robocat 6y agoI presume there are companies that do a lot of image compression which have the financial incentive to employ people to improve the compression efficiency. Either because of the CPU costs where the company will get a return on engineering hours to improve the speed of the algorithm; or because of reduced bandwidth costs where the company has an incentive to reduce the size of the compressed image even if the CPU usage might be higher. However it isn’t obvious whether such companies have any incentive to share their code, even just because the code is too specific to their hardware?
- Someone 6y agoI’m not sure I would take that bet. How much security camera footage is compressed, recorded, never looked at, and discarded after x days? Certainly in number of images (as opposed to number of bytes), those might tilt things the other way.
- nigeltao 6y ago> Looks like there isn't an encoder for PNG There isn't one yet, but I'd like to have one at some point. https://github.com/google/wuffs/blob/main/doc/roadmap.md https://github.com/google/wuffs/blob/main/doc/roadmap.md