#include "Halide.h"
#include <stdio.h>
#include "halide_image_io.h"
using namespace Halide::Tools;
int main(int argc, char **argv) {
Var x(
"x"), y(
"y"), c(
"c");
{
Func input_16(
"input_16");
blur_x(x, y, c) = (input_16(x - 1, y, c) +
2 * input_16(x, y, c) +
input_16(x + 1, y, c)) / 4;
blur_y(x, y, c) = (blur_x(x, y - 1, c) +
2 * blur_x(x, y, c) +
blur_x(x, y + 1, c)) / 4;
result.set_min(1, 1);
save_image(result, "blurry_parrot_1.png");
}
{
Expr clamped_x =
clamp(x, 0, input.width() - 1);
Expr clamped_y =
clamp(y, 0, input.height() - 1);
clamped(x, y, c) = input(clamped_x, clamped_y, c);
Func input_16(
"input_16");
blur_x(x, y, c) = (input_16(x - 1, y, c) +
2 * input_16(x, y, c) +
input_16(x + 1, y, c)) / 4;
blur_y(x, y, c) = (blur_x(x, y - 1, c) +
2 * blur_x(x, y, c) +
blur_x(x, y + 1, c)) / 4;
save_image(result, "blurry_parrot_2.png");
}
printf("Success!\n");
return 0;
}
A Halide::Buffer is a named shared reference to a Halide::Runtime::Buffer.
Realization realize(std::vector< int32_t > sizes={}, const Target &target=Target())
Evaluate this function over some rectangular domain and return the resulting buffer or buffers.
A Halide variable, to be used when defining functions.
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
Expr clamp(Expr a, const Expr &min_val, const Expr &max_val)
Clamps an expression to lie within the given bounds.
Internal::ConstantInterval cast(Type t, const Internal::ConstantInterval &a)
Cast operators for ConstantIntervals.
A fragment of Halide syntax.