CaptureMoment
0.1.0
Free and open-source non-destructive photo editor
Loading...
Searching...
No Matches
halide_operation_worker.cpp
Go to the documentation of this file.
1
8
#include "
workers/halide/halide_operation_worker.h
"
9
#include "
strategies/pipeline/pipeline_halide_operation_manager.h
"
10
11
#include <spdlog/spdlog.h>
12
#include <future>
13
14
namespace
CaptureMoment::Core
{
15
namespace
Workers {
16
17
std::future<bool>
HalideOperationWorker::execute
(
18
Pipeline::PipelineContext
& context,
19
ImageProcessing::IWorkingImageHardware
& working_image)
20
{
21
spdlog::trace(
"[HalideOperationWorker] Executing Halide pipeline."
);
22
23
// 1. Retrieve the specific manager from the context
24
// We use the context to avoid passing the manager directly as a parameter.
25
auto
& halide_manager { context.
getHalideManager
() };
26
27
// 2. Wrap the execution in a future
28
// Since the manager's execute() is synchronous (blocks until done),
29
// we use std::async to create a future that runs this logic.
30
// This satisfies the IWorkerRequest interface requirement.
31
return
std::async(std::launch::deferred, [&halide_manager, &working_image]() {
32
bool
success { halide_manager.execute(working_image) };
33
34
if
(!success) {
35
spdlog::error(
"[HalideOperationWorker] Execution failed."
);
36
}
37
38
return
success;
39
});
40
}
41
42
}
// namespace Workers
43
}
// namespace CaptureMoment::Core
CaptureMoment::Core::ImageProcessing::IWorkingImageHardware
Abstract interface representing an image used as a working buffer.
Definition
i_working_image_hardware.h:44
CaptureMoment::Core::Pipeline::PipelineContext
Central container for pipeline infrastructure.
Definition
pipeline_context.h:43
CaptureMoment::Core::Pipeline::PipelineContext::getHalideManager
Strategies::PipelineHalideOperationManager & getHalideManager() noexcept
Gets a reference to the Halide Operation Manager.
Definition
pipeline_context.h:75
CaptureMoment::Core::Workers::HalideOperationWorker::execute
std::future< bool > execute(Pipeline::PipelineContext &context, ImageProcessing::IWorkingImageHardware &working_image) override
Executes the Halide pipeline asynchronously.
Definition
halide_operation_worker.cpp:17
halide_operation_worker.h
Concrete worker for Halide-based adjustment operations.
CaptureMoment::Core
Manages the lifecycle of a single IWorkingImage instance.
Definition
app_config.cpp:11
pipeline_halide_operation_manager.h
Concrete manager for Halide-based adjustment operations.
CaptureMoment — footer