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

Restart markers aren't necessarily much more configurable than this proposal. Segmentation type 1 is basically identical to this proposal, except that the fixed number of scanlines in each segment is computed slightly differently. Segmentation type 0 just adds an offset array on top of that, but I can't tell if it's just to enable seeking, or if it's to allow multiple IDAT chunks within a single segment. If the latter is the case, I guess that would make it somewhat more complicated, though the author has suggested limiting the proposal to one type or the other.

Meanwhile, the error-recovery part isn't about a broken DEFLATE stream, it's about avoiding specially-crafted files that would produce one image if decoded using the restart markers, but another image if decoded without them. To prevent the usual issues with different tools yielding different results, this is made an error. But the PNG spec suggests that errors in ancillary chunks shouldn't ever be fatal:

> However, it is recommended that unexpected field values be treated as fatal errors only in critical chunks. An unexpected value in an ancillary chunk can be handled by ignoring the whole chunk as though it were an unknown chunk type. [0]

Therefore, the extension tells decoders to restart with sequential decoding in that case, instead of bailing out entirely.

[0] https://www.w3.org/TR/2003/REC-PNG-20031110/#13Error-checkin..., unchanged in https://www.w3.org/TR/2024/CRD-png-3-20240718/#13Error-check...



Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: