Revision 0aa3766355c7a108578ab45d1f752a91ce8f0f6e authored by Steven Johnson on 19 August 2019, 21:36:33 UTC, committed by Steven Johnson on 19 August 2019, 21:36:33 UTC
1 parent e110b79
embed_image_generator.cpp
#include "Halide.h"
namespace {
class EmbedImage : public Halide::Generator<EmbedImage> {
public:
Input<Buffer<float>> input{"input", 3};
Output<Buffer<float>> output{"output", 3};
void generate() {
Buffer<float> matrix(3, 3);
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
matrix(i, j) = 0.0f;
}
}
// Make the matrix a flip-channels-and-multiply-by-0.5 so that this is easy to test
matrix(2, 0) = matrix(1, 1) = matrix(0, 2) = 0.5f;
Var x, y, c;
RDom j(0, 3);
output(x, y, c) = sum(matrix(j, c) * input(x, y, j));
}
};
} // namespace
HALIDE_REGISTER_GENERATOR(EmbedImage, embed_image)
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...