Skip to content

Conversation

@meowtec
Copy link

@meowtec meowtec commented Nov 4, 2023

If we encode a WebP animation with many frames, caching all frames into a Vec and then adding them all to the encoder at once is not a good approach. This could potentially lead to excessive memory usage.

It is better to consume each frames after they are added.

API BREAKING CHANGE

AnimEncoder::add_frame() should return a Result.
(AnimEncoder::encode maybe should rename to AnimEncoder::finish, I'm not sure.)

In addition I update the example code to create a more complex and beautiful animation.

BTW, the animation decoder should return a iterator instead of a vector for the same reason.

@langyo

This comment was marked as outdated.

@meowtec meowtec force-pushed the feat/memory-reduce branch from 10a3a12 to 8ad7c9d Compare March 28, 2024 16:00
Copy link
Owner

@jaredforth jaredforth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for submitting!

There are a couple merge conflicts that need to be addressed

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

Successfully merging this pull request may close these issues.

3 participants