CaptureMoment 0.1.0
Free and open-source non-destructive photo editor
Loading...
Searching...
No Matches
operation_pipeline_executor.h
Go to the documentation of this file.
1
19#pragma once
20
26
27#include <vector>
28#include <unordered_map>
29
30namespace CaptureMoment::Core {
31
32namespace Pipeline {
33
43public:
52
56 virtual ~OperationPipelineExecutor() = default;
57
63 void updatePipeline(std::vector<Operations::OperationDescriptor> operations);
64
77 void init(
78 std::vector<Operations::OperationDescriptor>&& operations,
79 const Operations::OperationFactory& factory
80 );
81
94 void updateRuntimeParams(std::vector<Operations::OperationDescriptor>&& operations);
95
96protected:
105 virtual void applyScheduling(Halide::Func& pipeline, Halide::Var& x, Halide::Var& y, Halide::Var& c) const = 0;
106
107 [[nodiscard]] bool executeOnHalideBuffer(Halide::Buffer<float>& input_buffer, Halide::Buffer<float>& output_buffer) override;
108
118 [[nodiscard]] Halide::Func applyOperations(const Halide::Func& input, const Halide::Var& x, const Halide::Var& y, const Halide::Var& c);
119
126 virtual void buildOperationChain() = 0;
127
133 Halide::Pipeline m_pipeline;
134
138 bool m_chain_built{false};
139
140private:
144 std::vector<Operations::OperationDescriptor> m_operations;
145
152 const Operations::OperationFactory* m_factory;
153
160 std::unordered_map<uint64_t, Halide::Param<float>> m_pipeline_params;
161};
162} // namespace Pipeline
163} // namespace CaptureMoment::Core
Factory Pattern - creates operations from OperationDescriptor.
Base class for Halide executors providing shared 4-channel input parameter.
Abstract interface for executing a pre-compiled Halide pipeline.
Concrete executor for fused Halide adjustment pipelines.
virtual void buildOperationChain()=0
Builds the Halide function graph based on m_operations.
bool m_chain_built
Flag indicating if the pipeline has been successfully built and compiled.
Halide::Func applyOperations(const Halide::Func &input, const Halide::Var &x, const Halide::Var &y, const Halide::Var &c)
Applies all operations to the input function.
void init(std::vector< Operations::OperationDescriptor > &&operations, const Operations::OperationFactory &factory)
Initializes the executor with a moved list of operations (Optimized).
virtual void applyScheduling(Halide::Func &pipeline, Halide::Var &x, Halide::Var &y, Halide::Var &c) const =0
Applies scheduling directives (Vectorization/Parallelism/GPU tiling).
bool executeOnHalideBuffer(Halide::Buffer< float > &input_buffer, Halide::Buffer< float > &output_buffer) override
Executes the compiled pipeline directly on a Halide buffer.
void updateRuntimeParams(std::vector< Operations::OperationDescriptor > &&operations)
Updates the runtime values of the cached parameters WITHOUT recompiling.
Halide::Pipeline m_pipeline
The compiled Halide pipeline object.
void updatePipeline(std::vector< Operations::OperationDescriptor > operations)
Updates the list of operations and rebuilds the graph.
Abstract base class for Halide-optimized pipeline executors.
Abstract interface for executing a compiled image processing pipeline.
Enum representing the memory type where image data is stored (CPU or GPU).
Manages the lifecycle of a single IWorkingImage instance.
Descriptor of an operation with its parameters and unique identifier.
Factory for creating operations (Dependency Injection)
CaptureMoment — footer