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

AVIF encoder changes. #1838

Merged
merged 3 commits into from
Jan 7, 2023
Merged

AVIF encoder changes. #1838

merged 3 commits into from
Jan 7, 2023

Conversation

anarchodin
Copy link
Contributor

As noted in #1760, AVIF encoding is very slow. In looking at why, I noticed that the default encoder settings are very different from what the cavif CLI provided by upstream uses - in particular, upstream documentation suggests that a quality setting of 100 is not a useful configuration.

The majority of the changes here are to upgrade the ravif dependency. The images I was using for testing appear to compress significantly better using the new version.

The project requests this statement to be made:

I license past and future contributions under the dual MIT/Apache-2.0 license,
allowing licensees to choose either at their option.

I would like to add that I do not believe the changes in question to be significant enough to warrant copyright.

@anarchodin
Copy link
Contributor Author

If I understand things correctly, the failure(s) here are due to an external issue, namely cross-rs/cross#1177. I hadn't bothered with figuring that out until now, because we're still in a part of the year where fairly little happens. :)

src/codecs/avif/encoder.rs Outdated Show resolved Hide resolved
This moves a buffer used for temporary storage off of the struct and
into the function where it's used. No change to public APIs.
Copy link
Contributor

@fintelia fintelia left a comment

Choose a reason for hiding this comment

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

Looks good to me. I added a few comments suggesting style changes

src/codecs/avif/encoder.rs Show resolved Hide resolved
src/codecs/avif/encoder.rs Outdated Show resolved Hide resolved
src/codecs/avif/encoder.rs Outdated Show resolved Hide resolved
@anarchodin
Copy link
Contributor Author

I made an additional change, which is that the encoder now declares that it implements the ImageEncoder trait ... for some reason, that wasn't there before. I figure it's better to add it here than to make a different pull request, seeing as it's literally just the declaration.


impl<W: Write> ImageEncoder for AvifEncoder<W> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, good catch!

For some reason, AvifEncoder previously did not declare an
implementation of the ImageEncoder trait. This commit also includes a
couple of style suggestions.
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.

None yet

2 participants