How johnponggit/easydk works
Main components
• Core EasyDK Modules:
• Platform: Initialization routines, hardware information retrieval (see “include/cnedk_platform.h” and “src/cnedk_platform.cpp”).
• Buffer Management (BufSurface): Buffer description and management functions (found in “include/cnedk_buf_surface.h” and related source files in “src/”).
• Decode/Encode: Modules dedicated to hardware-accelerated video & image decode (e.g., “src/cnedk_decode.cpp”, “src/ce3226/cnedk_decode_impl_ce3226.cpp”, etc.) and encode operations.
• Transform & OSD: Image transformation utilities and on-screen display drawing (modules in “include/cnedk_transform.h”, “src/cnedk_transform.cpp”, “include/cnedk_osd.h”, “src/cnedk_osd.cpp”).
• VIN/VOUT: Components for capturing camera input and rendering output (refer to “include/cnedk_vin_capture.h”, “include/cnedk_vout_display.h”, and corresponding source files).
• InferServer:
• Model Management: Modules for model loading and management (located in “src/infer_server/model”).
• Processing Pipeline: The processor component, which handles backend pre- and post-processing (in “src/infer_server/processor”).
• Core Inference Engine: Components to handle task scheduling, session management, and inference execution (found in “src/infer_server/core”).
• Hardware Specific Implementations:
• Implementation variations are organized per hardware series (subdirectories “ce3226”, “mlu370”, “mlu590” in “src/”). These show how the same API may be supported with different hardware-specific optimizations or adaptations.
• Python Wrappers:
• The “python” directory contains C++ source files for wrapping core APIs (using pybind11), making the library accessible in a Python environment.
• Supporting Build and Test Infrastructure:
• 3rd party libraries: GoogleTest for testing (“3rdparty/googletest” and “unitest” folders), libyuv for image manipulation, and pybind11 for Python interfacing.
• Extensive sample directories (e.g., “samples” and “python/samples”) that demonstrate usage of the toolkit, including an “easy_pipeline” which likely shows a complete pipeline integration (from decode/encode to inference).
Relationships and interactions
• Inside the InferServer container, further split the responsibilities into Model Management, Processor (handling pre/post processing), and the core InferServer functionality (session, engine, scheduling).
• For video/image processing: Data flows from VIN (capture) → Buffer Management → Decode → Transform → OSD/VOUT, or through encode after processing.
• For inference: Input (decoded/processed frames) flows into the InferServer engine, which utilizes the Model and Processor modules, and then feeds results back into the pipeline.
• Also, indicate that the Python wrappers interact with these native modules, providing a separate layer that calls into the core functions.
Architectural patterns and design principles
• Modularity: Each feature (e.g., decode, encode, transform) is encapsulated into separate modules, which helps in maintaining clear interfaces.
• Hardware Abstraction: The use of different subdirectories (ce3226, mlu370, mlu590) shows a plug-in like strategy to support multiple Cambricon hardware platforms.
• Testability: The presence of unit tests (using GoogleTest) and integration tests emphasizes a robust, test-driven approach.
• Extensibility: The InferServer API design, with separate modules for model, processor, and inference, supports customization of the AI pipeline.
Relevant technologies and frameworks
• C/C++ as the primary language for high-performance modules.
• GoogleTest for unit testing.
• CMake for building the system (evident from multiple CMakeLists.txt files).
• pybind11 for building the Python wrappers.
• 3rd party libraries like libyuv for image and video processing tasks.
Elements
• A distinct container for the InferServer showing Model, Processor, and Core Inference Engine.