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

Defer initialization of FrameInvariants FrameMEStats #2827

Merged
merged 1 commit into from
Oct 8, 2021

Conversation

shssoichiro
Copy link
Collaborator

The FrameMEStats arrays are very expensive to create.
We do not always need them in FrameInvariants,
so defering can speed up certain areas of the code
such as scenecut detection.

This reduces the creation time for a FrameInvariants
object by 95%. Scenecut detection time for the standard
method is reduced by 15%.

The FrameMEStats arrays are very expensive to create.
We do not always need them in FrameInvariants,
so defering can speed up certain areas of the code
such as scenecut detection.

This reduces the creation time for a FrameInvariants
object by 95%. Scenecut detection time for the standard
method is reduced by 15%.
@shssoichiro
Copy link
Collaborator Author

As it turns out, this also benefits the FrameInvariants created during the encode pass as well. The lookahead_me_stats field is never written to or read from until it is overwritten on https://github.com/xiph/rav1e/blob/master/src/api/internal.rs#L667. So the expensive initialization in FrameInvariants::new is never used.

Hyperfine showed a 2% total speedup for the encode at --speed 9.

@shssoichiro shssoichiro merged commit dc2599e into xiph:master Oct 8, 2021
@shssoichiro shssoichiro deleted the fi-defer-lookahead-mestats branch October 8, 2021 07:17
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