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

Change rolling average window to all frames #46

Merged

Conversation

superyu1337
Copy link
Contributor

This changes the average window to all frames, instead of the last 10 frames.
I believe this to be better than before, because the average wont be impacted as much. It should give the user a more meaningful insight on overall quality during computation.

The value is also essentially the mean, so I have renamed it.

Copy link
Contributor

@FreezyLemon FreezyLemon left a comment

Choose a reason for hiding this comment

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

LGTM. No real reason to have this limited to the last 10 frames.

src/video.rs Outdated
avg = avg + (score.1 - avg) / (min(results.len(), 10) as f64);
progress.set_message(format!(", avg: {:.1$}", avg, 2));
rolling_mean = rolling_mean + (score.1 - rolling_mean) / (results.len() as f64);
progress.set_message(format!(", mean: {:.1$}", rolling_mean, 2));
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a bit confusing to use a parameter for the width here (i.e. :.1$) when we can just use a constant :.2:

Suggested change
progress.set_message(format!(", mean: {:.1$}", rolling_mean, 2));
progress.set_message(format!(", mean: {rolling_mean:.2}"));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't even know it was possible this way, I should really read the rust docs on formatting strings...

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you want to include this change in the PR? It might look a bit weird with me already approving, but I think this is an improvement.

@FreezyLemon FreezyLemon merged commit b25d9fe into rust-av:main Dec 8, 2024
2 checks passed
@FreezyLemon
Copy link
Contributor

Thanks!

@superyu1337 superyu1337 deleted the feature/average-algorithm-change branch December 9, 2024 09:29
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.

2 participants