How facebookresearch/spdl works
Main Components
a. Core Library Components (src/libspdl/core):
• Demuxing System
• Decoding System
• Encoding System
• Buffer Management
• Storage Management (CPU/CUDA)
• Frame/Packet Handling
b. Python Interface Layer (src/spdl):
• IO Module
• DataLoader Module
• Pipeline Module
• Utils Module
c. Hardware Acceleration Components:
• NVIDIA Components (NVDEC, NVJPEG, NPP)
• CPU Processing Pipeline
• CUDA Integration
Architectural Layers (from bottom to top)
Layer 1 - Hardware Interface:
• Memory management systems
• CUDA runtime integration
Layer 2 - Core Native Library:
• FFmpeg integration
• NVIDIA codec implementations
• Buffer management system
• Frame/packet processing
Layer 3 - C++/Python Binding Layer:
• Nanobind interface
• Type conversion systems
• Memory management bridges
Layer 4 - Python API:
• DataLoader implementation
• Pipeline management
• I/O operations
• Utility functions
Key Relationships to Highlight
• Data Flow:
• Parallel processing paths
• Memory transfer between CPU and GPU
• Control Flow:
• Thread management paths
• Scheduling and synchronization points
• Pipeline stage connections
Additional Elements
• Version compatibility information
• Optional components (CUDA vs CPU-only)
• Scaling capabilities
Implementation Notes
• Numbered annotations for complex interactions
• Thread-based parallelism
• Hardware acceleration capabilities
• Efficient memory management
• Scalable pipeline architecture