26 container->mark_ready_for_processing(
true);
32 "FrameAccessProcessor attached: {}×{}×{} frames={}, frame_bytes={}, batch={}",
36 }
catch (
const std::exception& e) {
39 std::source_location::current(),
40 "Failed to attach FrameAccessProcessor: {}",
71 if (
auto vc = std::dynamic_pointer_cast<VideoStreamContainer>(container)) {
77 const auto& stream_positions = vc->get_read_position();
78 if (!stream_positions.empty())
80 }
else if (
auto stream = std::dynamic_pointer_cast<StreamContainer>(container)) {
84 const auto& stream_positions =
stream->get_read_position();
85 if (!stream_positions.empty())
89 if (
auto vc = std::dynamic_pointer_cast<VideoStreamContainer>(container))
100 std::source_location::current(),
101 "FrameAccessProcessor requires a frame-structured modality "
102 "(VIDEO_COLOR, IMAGE_COLOR, VIDEO_DEPTH, DEPTH_MAP), got {}",
108 std::source_location::current(),
109 "Frame dimensions cannot be zero ({}×{})",
115 std::source_location::current(),
116 "Channel count cannot be zero");
121 "FrameAccessProcessor: container has zero frames");
126 "FrameAccessProcessor: batch size {} exceeds total frames {}, clamping",
132 "FrameAccessProcessor validated: {}×{}×{}, {} total frames, batch {}",
144 "FrameAccessProcessor not prepared for processing");
149 if (!source_container || source_container.get() != container.get()) {
151 "FrameAccessProcessor: source container mismatch or expired");
170 if (frames_to_extract == 0) {
175 auto video_container = std::dynamic_pointer_cast<VideoStreamContainer>(source_container);
176 if (!video_container) {
178 "FrameAccessProcessor: container is not a VideoStreamContainer");
185 auto& processed_data_vector = container->get_processed_data();
186 processed_data_vector.resize(1);
188 auto* dest = std::get_if<std::vector<uint8_t>>(&processed_data_vector[0]);
190 processed_data_vector[0] = std::vector<uint8_t>();
191 dest = std::get_if<std::vector<uint8_t>>(&processed_data_vector[0]);
193 dest->resize(byte_count);
195 uint8_t* write_ptr = dest->data();
198 for (uint64_t i = 0; i < frames_to_extract; ++i) {
211 "FrameAccessProcessor: one or more frames unavailable at frame {}",
218 "FrameAccessProcessor: auto-advance enabled but frame data was incomplete. Waiting for next process call without advancing frame.");
223 if (frames_to_advance > 0) {
232 }
catch (
const std::exception& e) {
234 "FrameAccessProcessor::process failed: {}", e.what());
248 "FrameAccessProcessor: batch size cannot be zero, clamping to 1");
264 uint64_t loop_start = 0;
274 if (loop_end > loop_start) {
275 uint64_t loop_length = loop_end - loop_start + 1;
277 new_frame = loop_start + (overflow % loop_length);
279 new_frame = loop_start;
#define MF_INFO(comp, ctx,...)
#define MF_RT_ERROR(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
Core::GlobalStreamInfo stream
const std::vector< float > * pixels
void set_frames_per_batch(uint64_t count)
Set the number of frames extracted per process() call.
void process(const std::shared_ptr< SignalSourceContainer > &container) override
Extract the current frame(s) into the container's processed_data.
std::chrono::steady_clock::time_point m_last_process_time
void on_detach(const std::shared_ptr< SignalSourceContainer > &container) override
Detach the processor from its container.
void advance_frame(uint64_t frames_to_advance)
Advance the frame cursor, respecting loop boundaries.
uint64_t m_frame_byte_size
std::weak_ptr< SignalSourceContainer > m_source_container_weak
void on_attach(const std::shared_ptr< SignalSourceContainer > &container) override
Attach the processor to a video container.
ContainerDataStructure m_structure
uint64_t m_frames_per_batch
void validate()
Validate that the container is suitable for frame-based processing.
double m_frame_accumulator
Sub-frame accumulator for wall-clock-driven advancement.
double m_frame_rate
Cached video frame rate in frames per second.
std::atomic< bool > m_is_processing
void store_metadata(const std::shared_ptr< SignalSourceContainer > &container)
Cache dimension metadata and frame geometry from the container.
@ ContainerProcessing
Container operations (Kakshya - file/stream/region processing)
@ Kakshya
Containers[Signalsource, Stream, File], Regions, DataProcessors.
@ DEPTH_MAP
[height, width, components] - range/disparity image
@ VIDEO_DEPTH
[frames, height, width, components] - streaming range data
@ VIDEO_COLOR
4D video (time + 2D + color)
@ IMAGE_COLOR
2D RGB/RGBA image
std::vector< DataDimension > dimensions
uint64_t get_channel_count() const
uint64_t get_height() const
uint64_t get_width() const
size_t get_frame_count() const
std::vector< uint64_t > end_coordinates
Ending frame index (inclusive)
std::vector< uint64_t > start_coordinates
Starting frame index (inclusive)