#pragma once #include #include #include #include #include #include namespace engine::models::controlfoley::video { struct DecodedFrame { double time = 0.0; std::vector rgb; }; struct SourceVideo { int64_t width = 0; int64_t height = 0; std::vector frames; }; SourceVideo load_video_frames( const std::filesystem::path & path, double max_duration_sec = 0.0); class ResizedFrameCache { public: ResizedFrameCache( const SourceVideo & video, int64_t size, bool center_crop); std::vector extract( float duration_sec, int64_t fps, const std::array & mean, const std::array & std, std::string_view trace_name = {}); private: const SourceVideo * video_; int64_t size_; bool center_crop_; std::unordered_map> cache_; }; std::vector extract_video_frames( const SourceVideo & video, float duration_sec, int64_t fps, int64_t size, bool center_crop, const std::array & mean, const std::array & std); } // namespace engine::models::controlfoley::video