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

◆ extract_frame() [1/2]

template<ProcessableData T>
std::span< T > MayaFlux::Kakshya::extract_frame ( const std::vector< std::span< T > > &  channel_spans,
uint64_t  frame_index,
std::vector< T > &  output_buffer 
)
noexcept

Extract a single frame from planar data (returns interleaved).

Template Parameters
TData type.
Parameters
channel_spansVector of spans, one per channel.
frame_indexIndex of the frame to extract.
output_bufferBuffer to store interleaved frame data.
Returns
Span containing the interleaved frame data.

Definition at line 309 of file DataUtils.hpp.

313{
314 output_buffer.clear();
315 output_buffer.reserve(channel_spans.size());
316
317 for (const auto& channel_span : channel_spans) {
318 if (frame_index < channel_span.size()) {
319 output_buffer.push_back(channel_span[frame_index]);
320 } else {
321 output_buffer.push_back(T { 0 });
322 }
323 }
324
325 return std::span<T>(output_buffer.data(), output_buffer.size());
326}