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

Feature-complete APNG optimization #551

Open
ctrlcctrlv opened this issue Aug 21, 2023 · 7 comments
Open

Feature-complete APNG optimization #551

ctrlcctrlv opened this issue Aug 21, 2023 · 7 comments
Labels
T-Compression Relates to improving the compression ratio of images T-Feature Requests for a new feature to be added

Comments

@ctrlcctrlv
Copy link

[fred@デブ.狸.agency ~/.config/OpenToonz/stuff/sandbox/outputs]$ oxipng pcr.apng 
Processing: pcr.apng
APNG files are not (yet) supported
@ctrlcctrlv ctrlcctrlv changed the title does not support APNG does not support APNG reduction Aug 21, 2023
@ctrlcctrlv
Copy link
Author

renamed in light of #551; now supports APNG but the support is nearly useless :( [thanks for it anywy tho]

@TPS
Copy link

TPS commented Aug 21, 2023

@ctrlcctrlv I think you meant #79#511

@TPS TPS mentioned this issue Aug 21, 2023
@AlexTMjugador
Copy link
Collaborator

AlexTMjugador commented Aug 21, 2023

Groundwork has been done to support APNGs (see #511), but the changes were not yet published in a release, so you have to build OxiPNG from source to use them.

Do those changes satisfy your needs, @ctrlcctrlv? If not, why do you find that support "nearly useless"?

@ctrlcctrlv
Copy link
Author

ctrlcctrlv commented Aug 21, 2023

fdAT is likewise compressible via the same way* IDAT is compressed so no, probably why @andrews05 wrote they were “not sure if it's something that should actually be added” :-)

* sort of.

@TPS
Copy link

TPS commented Aug 21, 2023

@AlexTMjugador Even in #511, @andrews05 says average savings is <1%, so much room for improvement.

I think the idea here is to meet/best apngopt (last release 2015) in a modern fashion like, for static PNG, the original goal was against optipng.

@AlexTMjugador AlexTMjugador changed the title does not support APNG reduction Feature-complete APNG optimization Aug 21, 2023
@AlexTMjugador
Copy link
Collaborator

Alright, that's fair. I'm renaming this issue to more clearly state what it asks for 😄

@ctrlcctrlv
Copy link
Author

ctrlcctrlv commented Aug 21, 2023

exactly. i started thinking about how to do it as well. in theory—

Subsequent frames are encoded in fdAT chunks, which have the same structure as IDAT chunks, except preceded by a sequence number. Information for each frame about placement and rendering is stored in fcTL chunks. The full layout of fdAT and fcTL chunks is described below.

in order to make a well-supported APNG, it's quite important to alternate fcTL and fdAT, as earlier versions of the spec said no chunk may come between an fcTL and its fdAT.

what i think this means is we can use the same code as does the main loop just with &fdat[4:].

likely PngData::from_slice is the primary function that needs changes

@andrews05 andrews05 added T-Feature Requests for a new feature to be added T-Compression Relates to improving the compression ratio of images labels Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Compression Relates to improving the compression ratio of images T-Feature Requests for a new feature to be added
Projects
None yet
Development

No branches or pull requests

4 participants