Skip to content

Instantly share code, notes, and snippets.

@mebjas
Created July 11, 2022 07:57
Show Gist options
  • Save mebjas/3568b0ba117aadb367f523f689af0222 to your computer and use it in GitHub Desktop.
Save mebjas/3568b0ba117aadb367f523f689af0222 to your computer and use it in GitHub Desktop.
Multiplication vs division in Halide
# 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