How electronicarts/iris works
Project type and purpose
• IRIS is an open-source C++ library (with an optional example console application) whose purpose is to analyze video content and detect photosensitive epilepsy risks (luminance flashes, red saturation flashes, spatial patterns). It’s built with CMake, uses vcpkg for dependencies, and comes with unit tests.
File structure
• Top-level components:
• cmake, CMakeLists.txt, CMakePresets.json: build system
• /iris & src/: core IRIS library (public headers + implementation)
• utils/: supporting utility library (logging, JSON wrapper, frame conversion)
• example/: console application exercising the IRIS library
• config/: appsettings.json (configurable thresholds, toggles)
• test/: unit tests project with test data (videos, images)
• vcpkg.json: external dependency manifest
• The core library follows a pipeline/pipeline-of-responsibility style: FrameManagers → Converters → Detection modules → Result aggregation.
README for additional insights
• Describes detection criteria, CSV/JSON output format, example app command-line flags, build instructions (CMake presets, vcpkg integration), and configuration options.
Components
a. Main components
1. External Inputs & Configuration
• Video files (e.g. .mp4)
• config/appsettings.json
2. IRIS Core Library
• VideoAnalyser (orchestrator)
• FrameManagers (FpsFrameManager, TimeFrameManager via IFrameManager)
• FrameRgbConverter
• Detection modules:
• FlashDetection (Luminance & Red via RelativeLuminance, RedSaturation)
• PatternDetection
• TransitionTracker (tracks per-second counts)
• ScopeProfiler (performance measurement)
• Log (logging abstraction)
3. Utils Library
• BaseLog, JsonWrapper, FrameConverter
4. Output Writers
• CSVWriter (built into IRIS)
• JsonWriter (optional via –j flag)
5. Example App
• CLI parser (–v, –p, –j flags)
• Invokes IRIS Core, points at input/output directories
6. Tests
• Unit tests (gtest) calling core library APIs, using test videos/images
b. Relationships & interactions
• Example App reads CLI args → loads config JSON → feeds video file paths → calls VideoAnalyser API
• VideoAnalyser: for each frame, uses IFrameManager to fetch frames → FrameRgbConverter → passes frame to detection modules → collects partial FrameData → TransitionTracker computes per-second/extended counts → modules update Result objects
• At end of video, VideoAnalyser writes results via CSVWriter/JsonWriter
• ScopeProfiler wraps critical sections → records timings → Log outputs profiling results
• Utils library is linked by both core and example code (logging, JSON)
• Tests exercise each detection module independently and end-to-end on sample videos
c. Architectural patterns & design principles
• Pipeline pattern: frame processing is a sequence of pluggable steps
• Dependency inversion: IFrameManager interface → concrete implementations for FPS/time-based iteration
• Separation of concerns: distinct modules for configuration, logging, conversion, detection, aggregation, profiling
• Configurable thresholds loaded at runtime from JSON
d. Relevant technologies/frameworks/libraries
• CMake (build) + Ninja (default build tool)
• vcpkg (dependency manager)
• Google Test (unit testing)
• JSON library (via utils/JsonWrapper)
• Standard C++17 (or later), cross-platform
Detailed coverage
• Public interfaces (include/iris/*.h) as API boundary
• Test harness invoking specific modules (optional overlay)
• Config parameters (flash threshold, pattern enable flag) near the config component
• Build process with a side note: CMake → vcpkg → library & example app