I trying to write simple image computing program using Halide. So I start with brightness function.
I got this
Halide::ImageParam img(Halide::type_of<float>(), 3);
img.set_stride(0, 4);
img.set_stride(2, 1);
Halide::Func f;
Halide::Var x, y, c;
Halide::Param<float> brightnesMod;
f(x, y, c) = img(x,y,c) * brightnesMod;
f.vectorize(x, 16).parallel(y);
auto & obuff = f.output_buffer();
obuff.set_stride(0, 4);
obuff.set_stride(2, 1);
std::vector<Halide::Argument> arguments = { img, brightnesMod };
f.compile_to_file("function", arguments);
return 0;
but then I have a problem. My image is RGBA image so I compute algorithm with alpha. How can I skip it, and change f(x,y,c) to make c only 0-2?