51 trail(write_head, Kinesis::constant<double, double>(lag_frames));
64 double seconds =
static_cast<double>(tick) /
fps;
82 auto video = std::dynamic_pointer_cast<VideoStreamContainer>(source);
95 "FrameSeekProcessor not prepared for processing");
99 if (!video || source.get() != container.get()) {
101 "FrameSeekProcessor: source container mismatch, expired or not a VideoStreamContainer");
127 auto& processed = container->get_processed_data();
130 auto* dest = std::get_if<std::vector<uint8_t>>(&processed[0]);
132 processed[0] = std::vector<uint8_t>();
133 dest = std::get_if<std::vector<uint8_t>>(&processed[0]);
137 uint8_t*
out = dest->data();
138 uint64_t last_frame = 0;
144 ? Kinesis::wrap<double>(
position, lo, hi)
145 : std::clamp(
position, lo, hi - 1.0);
146 const double whole = std::floor(s);
147 const double weight = s - whole;
148 const auto first =
static_cast<uint64_t
>(whole);
151 const auto a = video->get_frame_pixels(first);
159 auto next = first + 1;
160 if (
static_cast<double>(next) >= hi) {
164 const auto b = video->get_frame_pixels(next);
175 "FrameSeekProcessor: one or more frames unavailable near frame {}", last_frame);
180 video->update_read_position_for_channel(0, last_frame);
#define MF_RT_ERROR(comp, ctx,...)
std::optional< glm::vec3 > position
Factories for TimeMap: seconds since a voice started in, position in recorded material out (frames fo...
std::vector< float > * out
void process(const std::shared_ptr< SignalSourceContainer > &container) override
Extract the current frame(s) into the container's processed_data.
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.
uint64_t m_frames_per_batch
std::atomic< bool > m_is_processing
std::shared_ptr< const Kinesis::TimeMap > m_time_map
void reset()
Restart the clock and the repeat.
void set_repeat(const std::shared_ptr< const Kinesis::TimeMap > &length)
Restart the time map over and over, with a length that can change.
double position_at(uint64_t tick)
void trail(double write_head, Kinesis::TimeMap lag)
Trail a stream that is being written, by a lag that can change.
void set_time_map(const std::shared_ptr< const Kinesis::TimeMap > &map)
Drive the read position from a function of time.
void on_attach(const std::shared_ptr< SignalSourceContainer > &container) override
Attach the processor to a video container.
void process(const std::shared_ptr< SignalSourceContainer > &container) override
Extract the current frame(s) into the container's processed_data.
std::shared_ptr< const Kinesis::TimeMap > m_repeat
@ ContainerProcessing
Container operations (Kakshya - file/stream/region processing)
@ Kakshya
Containers[Signalsource, Stream, File], Regions, DataProcessors.
bool blend_frames(ImageFormat format, std::span< const uint8_t > a, std::span< const uint8_t > b, uint8_t *out, double weight)
Linearly blend two frames of the same size and format.
TimeMap lagged(double origin, double rate, TimeMap lag)
Position of a moving reference minus a lag that can itself change.
std::vector< uint64_t > end_coordinates
Ending frame index (inclusive)
std::vector< uint64_t > start_coordinates
Starting frame index (inclusive)
Typed, composable, stateless callable from domain D to range R.