MayaFlux 0.5.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 325 of file DataUtils.hpp.

329{
330 output_buffer.clear();
331 output_buffer.reserve(channel_spans.size());
332
333 for (const auto& channel_span : channel_spans) {
334 if (frame_index < channel_span.size()) {
335 output_buffer.push_back(channel_span[frame_index]);
336 } else {
337 output_buffer.push_back(T { 0 });
338 }
339 }
340
341 return std::span<T>(output_buffer.data(), output_buffer.size());
342}