MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ process_to_buffer() [1/2]

std::shared_ptr< Buffers::TextureBuffer > MayaFlux::Yantra::Vision::VisionWorkflow::process_to_buffer ( const std::shared_ptr< VisionMatrix > &  matrix,
const std::shared_ptr< Kakshya::VideoStreamContainer > &  source,
const Portal::Graphics::RenderConfig &  render,
const std::optional< LiveConfig > &  live = {} 
)

process_to_buffer() with a matrix the caller made and configured, such as its extractor's sizes, focus or limits.

The matrix must have an extractor whose mode produces an image.

Returns
The output buffer, or null when matrix is null or as process_to_buffer() fails.

Definition at line 423 of file VisionWorkflow.cpp.

428{
429 if (!matrix) {
431 "VisionWorkflow::process_to_buffer: no matrix");
432 return nullptr;
433 }
434
435 const auto frames = source_frames(source, "process_to_buffer");
436 const auto buffers = m_buffer_manager.lock();
437 if (!frames || !buffers)
438 return nullptr;
439
440 const auto live = live_config.value_or(LiveConfig {});
441 const auto& apply_to = live.apply_to;
442 const uint32_t width = apply_to ? apply_to->get_width() : source->get_width();
443 const uint32_t height = apply_to ? apply_to->get_height() : source->get_height();
444
445 auto output = buffers->create_graphics_buffer<Buffers::TextureBuffer>(
446 Buffers::ProcessingToken::GRAPHICS_BACKEND, width, height, Portal::Graphics::ImageFormat::RGBA8);
447 output->setup_rendering(render);
448
449 start(source, frames, live, matrix, run_name("buffer"), deliver_to(matrix, output));
450 return output;
451}
#define MF_WARN(comp, ctx,...)
uint32_t width
uint32_t height
std::shared_ptr< Buffers::TextureBuffer > source_frames(const std::shared_ptr< Kakshya::VideoStreamContainer > &source, std::string_view caller) const
void start(const std::shared_ptr< Kakshya::VideoStreamContainer > &source, const std::shared_ptr< Buffers::TextureBuffer > &frames, const LiveConfig &live, const std::shared_ptr< VisionMatrix > &matrix, const std::string &name, std::function< void(const VisionIO &)> consumer, std::function< bool()> stop_when={})
Subscribe consumer and start the producer named name, which stops the run at source's end,...
std::weak_ptr< Buffers::BufferManager > m_buffer_manager
@ GRAPHICS_BACKEND
Standard graphics processing backend configuration.
@ ComputeMatrix
Compute operations (Yantra - algorithms, matrices, DSP)
@ Yantra
DSP algorithms, computational units, matrix operations, Grammar.
Source source()
Begin a Source chain.
Definition Plot.hpp:127

References MayaFlux::Journal::ComputeMatrix, MayaFlux::Buffers::GRAPHICS_BACKEND, height, m_buffer_manager, MF_WARN, MayaFlux::Buffers::TextureBuffer::setup_rendering(), source_frames(), start(), width, and MayaFlux::Journal::Yantra.

+ Here is the call graph for this function: