I am new to Halide and was given a image processing Pipeline. I am trying to understand this pipe line by printing values. Following the tutorial from https://halide-lang.org/tutorials/tutorial_lesson_04_debugging_2.html, I tried to print the values. It is giving me 2 types of errors.
1.Buffer argument in_patch is NULL for transform.realize(512,256,3).
2.'Halide::Internal::GeneratorBase::Input > {aka class Halide::GeneratorInput >}' has no member named 'realize' for TsTw_tran_h.realize(3,3);
I am assuming that for the second error, it has something to do with not using the variables x and y.
Is there a way to work around the first error?
Any Help wil be highly Appreciated.
Thanks in advance
#include "Halide.h"
namespace {
using namespace Halide;
///////////////////////// We will define a generator to auto-schedule.
class AutoScheduled : public Halide::Generator<AutoScheduled> {
public:
Input<Buffer<uint8_t>> in_patch {"in_patch" , 3};
Input<Buffer<float>> ctrl_pts_h {"ctrl_pts_h" , 2};
Input<Buffer<float>> weights_h {"weights_h" , 2};
Input<Buffer<float>> rev_tone_h {"rev_tone_h" , 2};
Input<Buffer<float>> TsTw_tran_h{"TsTw_tran_h", 2};
Input<Buffer<float>> coefs_h {"coefs_h" , 2};
Output<Buffer<uint8_t>> processed {"processed" , 3};
void generate() {
Var x("x"), y("y"), c("c");
Func scale("scale");
scale(x,y,c) = cast<float>(in_patch(x,y,c))/256;
// Color map and white balance transform
Func transform("transform");
transform(x,y,c) = select(
// Perform matrix multiplication, set min of 0
c == 0, scale(x,y,0) * TsTw_tran_h(0,0)
+ scale(x,y,1) * TsTw_tran_h(1,0)
+ scale(x,y,2) * TsTw_tran_h(2,0),
c == 1, scale(x,y,0) * TsTw_tran_h(0,1)
+ scale(x,y,1) * TsTw_tran_h(1,1)
+ scale(x,y,2) * TsTw_tran_h(2,1),
scale(x,y,0) * TsTw_tran_h(0,2)
+ scale(x,y,1) * TsTw_tran_h(1,2)
+ scale(x,y,2) * TsTw_tran_h(2,2) );
scale.compute_root();
transform.trace_stores();
scale.trace_stores();
TsTw_tran_h.realize(3,3);
transform.realize(512,256,3);
processed(x, y, c) = cast<uint8_t>( min( max( transform(x,y,c) * 255, 0), 255 ) );
}