#include #include using namespace Halide; template void interleave_input(T &input, Expr n, Var x, Var y, Var c) { input.dim(0).set_stride(n).dim(2).set_stride(1); input.dim(2).set_bounds(0, n); } template void interleave_output(T &output, Expr n, Var x, Var y, Var c) { output.dim(0).set_stride(n).dim(2).set_stride(1); output.dim(2).set_bounds(0, n); output.reorder(c, x, y).unroll(c); } class Brighter : public Generator { public: Input> input{"input", 3}; Output> brighter{"brighter", 3}; Var x, y, c; void generate() { brighter(x, y, c) = input(x, y, c) + 10; interleave_input(input, 3, x, y, c); interleave_output(brighter, 3, x, y, c); } }; HALIDE_REGISTER_GENERATOR(Brighter, brighter);