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

Recalculate weights only on block boundaries #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mjethani
Copy link

Hi, this is an optimization.

bmvbhash() recalculates y_mod, y_frac, y_int, weight_top, and weight_bottom and x_mod, x_frac, x_int, weight_left, and weight_right on every iteration of the outer and inner loops respectively. These variables need to be updated only when the loops cross block boundaries.

In this patch we keep track of block boundaries using two new variables y_mult and x_mult.

This reduces the number of times the weights must be recalculated from width * height to bits ** 2.

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.

1 participant