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

◆ calculate_output_region() [2/2]

Region MayaFlux::Kakshya::calculate_output_region ( uint64_t  current_frame,
uint64_t  frames_to_process,
const std::shared_ptr< SignalSourceContainer > &  container 
)

Calculate output region for frame-based processing.

Parameters
current_frameCurrent frame index.
frames_to_processNumber of frames to process.
containerContainer providing layout information.
Returns
Region representing the output bounds for the specified frames.

Definition at line 217 of file RegionUtils.cpp.

220{
221 const auto& structure = container->get_structure();
222 uint64_t total_frames = structure.get_samples_count_per_channel();
223 uint64_t num_channels = structure.get_channel_count();
224
225 if (current_frame >= total_frames) {
226 error<std::out_of_range>(
227 Journal::Component::Kakshya, Journal::Context::Runtime,
228 std::source_location::current(),
229 "Current frame exceeds container bounds: current_frame = "
230 + std::to_string(current_frame) + ", total_frames = "
231 + std::to_string(total_frames));
232 }
233
234 uint64_t available_frames = total_frames - current_frame;
235 uint64_t actual_frames = std::min(frames_to_process, available_frames);
236
237 Region output_shape;
238 output_shape.start_coordinates = { current_frame, 0 };
239 output_shape.end_coordinates = { current_frame + actual_frames - 1, num_channels - 1 };
240
241 return output_shape;
242}

References MayaFlux::Kakshya::Region::end_coordinates, MayaFlux::Journal::Kakshya, MayaFlux::Journal::Runtime, and MayaFlux::Kakshya::Region::start_coordinates.