CaptureMoment 0.1.0
Free and open-source non-destructive photo editor
Loading...
Searching...
No Matches
working_image_cpu_halide.cpp
Go to the documentation of this file.
1
9
10#include <spdlog/spdlog.h>
11
13
15{
16 // 1. Bind the view to the CPU base class (stores spans and geometry)
17 if (!WorkingImageCPU::bindView(view)) {
18 return false;
19 }
20
21 // 2. Check the view data pointer before initializing Halide
22 if (m_view_data_image.working_data.data() == nullptr) {
23 spdlog::error("[WorkingImageCPU_Halide::bindView]: View data pointer is null.");
24 return false;
25 }
26
27 // 3. Initialize the Halide buffer to reference the CPU data (zero-copy)
29
30 if (!m_halide_buffer.defined()) {
31 spdlog::error("[WorkingImageCPU_Halide::bindView]: Failed to initialize Halide buffer.");
32 return false;
33 }
34
35 m_halide_original_buffer = Halide::Buffer<float>::make_interleaved(
36 const_cast<float*>(m_view_data_image.original_data.data()),
38 );
39
40 spdlog::debug("[WorkingImageCPU_Halide::bindView]: Bound and initialized Halide ({}x{}, {} ch).",
42 return true;
43}
44
45} // namespace CaptureMoment::Core::ImageProcessing
virtual bool bindView(const ImageView &view)
Binds a view of the image data to this hardware worker.
ImageView m_view_data_image
The image view bound to this hardware worker.
bool bindView(const ImageView &view) override
Binds the view and initializes the zero-copy Halide buffer.
void initializeHalide(std::span< float > data, Common::ImageDim width, Common::ImageDim height, Common::ImageChan channels)
Creates a Halide buffer view over existing pixel data.
Halide::Buffer< float > m_halide_buffer
Internal Halide buffer holding the image data. Managed directly by this object. Halide::Buffer handle...
Represents a zero-copy window over contiguous image memory.
Definition image_view.h:26
std::span< float > working_data
Mutable span for processing.
Definition image_view.h:27
std::span< const float > original_data
Const span for non-destructive reset.
Definition image_view.h:28
implementation of of image working buffer on CPU using Halide for processing.
CaptureMoment — footer