Skip to content

Recalculate weights only on block boundaries#23

Open
mjethani wants to merge 1 commit intocommonsmachinery:masterfrom
mjethani:avoid-weight-recalc
Open

Recalculate weights only on block boundaries#23
mjethani wants to merge 1 commit intocommonsmachinery:masterfrom
mjethani:avoid-weight-recalc

Conversation

@mjethani
Copy link
Copy Markdown

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