Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metadata to allow parallel decoding #20

Open
DavidBuchanan314 opened this issue Jun 24, 2021 · 2 comments
Open

Add metadata to allow parallel decoding #20

DavidBuchanan314 opened this issue Jun 24, 2021 · 2 comments

Comments

@DavidBuchanan314
Copy link

DavidBuchanan314 commented Jun 24, 2021

PNG is an extensible format - you can add custom Ancillary chunks to a file, and decoders will ignore any such chunk that they don't recognize.

If an Ancillary chunk was added, to store the offsets of the zlib sub-streams, then a decoder could take advantage of this information to parallelize decoding.

Optionally, to allow parallel defiltering, the pixel values of the last row in each block could be included, compressed (this comes with an obvious file-size penalty, however) (thinking about this some more, it'd make more sense to just never use filtering on the first row of each block)

Thinking even more about this, a sufficiently intelligent client requesting PNGs over the network could use this metadata to request each chunk over a parallel connection (e.g. using HTTP range requests)

@bvibber
Copy link
Owner

bvibber commented Dec 16, 2021

Came across a note that Apple devices use a system like this, using an iDOT ancillary chunk to store metadata - https://www.hackerfactor.com/blog/index.php?/archives/895-Connecting-the-iDOTs.html

Might be worth looking into to support that (not standardized, naturally).

@randy408
Copy link

randy408 commented Dec 16, 2021

Seeing how everyone decided to tackle this issue now I cleaned up my specification for the occasion: https://github.com/libspng/png-restart-marker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants