#include "Halide.h"
#include <stdio.h>
public:
Input<uint8_t> offset{"offset"};
Input<Buffer<uint8_t, 2>> input{"input"};
Output<Buffer<uint8_t, 2>> brighter{"brighter"};
void generate() {
brighter(x, y) = input(x, y) + offset;
brighter.vectorize(x, 16).parallel(y);
}
};
public:
1.0f ,
0.0f ,
100.0f };
enum class Rotation {
None,
Clockwise,
CounterClockwise };
Rotation::None,
{{"none", Rotation::None},
{"cw", Rotation::Clockwise},
{"ccw", Rotation::CounterClockwise}}};
Input<uint8_t> offset{"offset"};
Input<Buffer<uint8_t, 2>> input{"input"};
Output<Buffer<void, 2>> output{"output"};
void generate() {
brighter(x, y) = scale * (input(x, y) + offset);
switch ((Rotation)rotation) {
case Rotation::None:
rotated(x, y) = brighter(x, y);
break;
case Rotation::Clockwise:
rotated(x, y) = brighter(y, 100 - x);
break;
case Rotation::CounterClockwise:
rotated(x, y) = brighter(100 - y, x);
break;
}
output(x, y) =
cast(output.type(), rotated(x, y));
if (parallel) {
output.parallel(y);
}
if (rotation != Rotation::None) {
rotated
.compute_at(output, y)
}
}
};
#define HALIDE_REGISTER_GENERATOR(...)
GeneratorParam is a templated class that can be used to modify the behavior of the Generator at code-...
int natural_vector_size() const
Given a data type, return an estimate of the "natural" vector size for that data type when compiling ...
A Halide variable, to be used when defining functions.
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
Internal::ConstantInterval cast(Type t, const Internal::ConstantInterval &a)
Cast operators for ConstantIntervals.