10#include <spdlog/spdlog.h>
14template<
typename InputType>
16 const InputType& input,
17 const Halide::Param<float>& param_highlights,
22 Halide::Func highlights_func(
"highlights_op");
25 Halide::Expr L = input(x, y, 0);
29 Halide::Expr t = clamp((L - 0.7f) / (1.0f - 0.7f), 0.0f, 1.0f);
33 Halide::Expr mask = t * t * (3.0f - 2.0f * t);
36 Halide::Expr safe_val = clamp(
43 highlights_func(x, y, c) = select(
49 return highlights_func;
57 const Halide::Func& input_func,
61 const Halide::Param<float>& param
64const Halide::Param<float>& param_highlights = param;
67 spdlog::trace(
"OperationHighlights::appendToFusedPipeline: Fusing with Halide Param (In-Graph Clamped)");
static constexpr float MAX_HIGHLIGHTS_VALUE
Maximum allowed highlights value. Defined by OperationRanges::getHighlightsMaxValue().
static constexpr float MIN_HIGHLIGHTS_VALUE
Minimum allowed highlights value. Defined by OperationRanges::getHighlightsMinValue().
Halide::Func appendToFusedPipeline(const Halide::Func &input_func, const Halide::Var &x, const Halide::Var &y, const Halide::Var &c, const Halide::Param< float > ¶m) const override
Appends this operation's logic to a fused Halide pipeline. This method is used by the PipelineBuilder...
Halide::Func applyHighlightsAdjustment(const InputType &input, const Halide::Param< float > ¶m_highlights, const Halide::Var &x, const Halide::Var &y, const Halide::Var &c)
Concrete implementation of Highlights adjustment.