MayaFlux 0.3.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 319 of file DataUtils.hpp.

323{
324 output_buffer.clear();
325 output_buffer.reserve(channel_spans.size());
326
327 for (const auto& channel_span : channel_spans) {
328 if (frame_index < channel_span.size()) {
329 output_buffer.push_back(channel_span[frame_index]);
330 } else {
331 output_buffer.push_back(T { 0 });
332 }
333 }
334
335 return std::span<T>(output_buffer.data(), output_buffer.size());
336}