How to Generate Halide Function with float argument
Clash Royale CLAN TAG #URR8PPP How to Generate Halide Function with float argument I'm trying to create a (C++) helper function that transforms a lookup table that's computed in my C++ code into a Halide Func which takes a float as an argument and lerps between samples in the LUT. The use-case here is that the user has generated a tone curve using a spline with a bunch of control points that we want to apply with Halide. So I sample this spline at a bunch of points, and I want to write a Halide function that lets me linearly interpolate between these samples. Here's my current attempt at this: #include <Halide.h> using namespace Halide; using namespace std; static Func LutFunc(const vector<float> &lut) { Func result; Var val; // Copy the LUT into a Halide Buffer. int lutSize = (int) lut.size(); Buffer<float> lutbuf(lutSize); for(int i = 0; i < lut.size(); i++) { lutbuf(i) = lut[i]; } // Compute the offset into...