10#include <spdlog/spdlog.h>
14template<
typename InputType>
16 const InputType& input,
17 const Halide::Param<float>& param_shadows,
22 Halide::Func shadows_func(
"shadows_op");
25 Halide::Expr L = input(x, y, 0);
30 constexpr float shadow_cutoff = 0.5f;
32 Halide::Expr t = clamp((shadow_cutoff - L) / shadow_cutoff, 0.0f, 1.0f);
35 Halide::Expr mask = t * t * (3.0f - 2.0f * t);
38 Halide::Expr safe_val = clamp(
46 shadows_func(x, y, c) = select(
60 const Halide::Func& input_func,
64 const Halide::Param<float>& param
68 spdlog::trace(
"OperationShadows::appendToFusedPipeline: Fusing with Halide Param (In-Graph Clamped)");
static constexpr float MAX_SHADOWS_VALUE
Maximum allowed shadows value. Defined by OperationRanges::getShadowsMaxValue().
static constexpr float MIN_SHADOWS_VALUE
Minimum allowed shadows value. Defined by OperationRanges::getShadowsMinValue().
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 applyShadowsAdjustment(const InputType &input, const Halide::Param< float > ¶m_shadows, const Halide::Var &x, const Halide::Var &y, const Halide::Var &c)
Concrete implementation of Shadows adjustment.