Created
July 11, 2022 07:57
-
-
Save mebjas/3568b0ba117aadb367f523f689af0222 to your computer and use it in GitHub Desktop.
Multiplication vs division in Halide
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Approach 1 - division | |
output_(x, y) = u8(f32(input(x, y)) / factor); | |
# Approach 2 - multiplication | |
Expr multiplier = 1.0f / factor; | |
output_(x, y) = u8(f32(input(x, y) * multiplier); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment