A high-performance, concurrent image processing pipeline written in modern C++17. This repository demonstrates hardware-aware parallel computing, specifically optimized for real-time Advanced Driver Assistance Systems (ADAS) where strict millisecond latency budgets are enforced.
This project implements a Thread Pool architecture to perform parallel Sobel edge detection. It is designed to maximize CPU throughput while minimizing lock contention and avoiding false sharing at thread boundaries.
-
Zero-Copy Memory Management: Image buffers are managed via
std::shared_ptr<std::vector<uint8_t>>. Data is passed to worker threads by reference, eliminating expensive memory allocations during frame handoffs. -
Spatial Partitioning & Halo Regions: Workloads are horizontally partitioned based on
std::thread::hardware_concurrency(). The architecture implements$+1/-1$ pixel "Halo Regions" (ghost zones) to allow threads to read overlapping boundary pixels without crossing strict memory bounds, preserving L1/L2 Cache locality and preventing cache thrashing. -
Custom Thread Pool: Utilizes a fixed-size pool of worker threads synchronized via
std::condition_variableandstd::mutex, completely avoiding the overhead of thread creation/destruction per frame.
Benchmarking against a single-threaded baseline (100 iterations on standard multicore hardware) demonstrates near-linear scaling:
- Single-Threaded Baseline: ~837 ms
- Multi-Threaded Pipeline: ~218 ms
- Measured Speedup: ~3.83x
For more in-depth information, please refer to the comprehensive documentation provided in the docs/ directory:
- Architecture (docs/ARCHITECTURE.md): Details on the thread pool, memory management, and spatial partitioning.
- API Reference (docs/API_REFERENCE.md): Overview of exposed classes and functions.
- Usage Guide (docs/USAGE.md): Code examples and integration guide.
This project relies on a hermetic CMake build system and uses FetchContent to manage lightweight dependencies (Google Test and stb_image) without polluting the host environment.
# 1. Generate build files
cmake -B build -S .
# 2. Compile in Release mode for optimization
cmake --build build --config Release
# 3. Run benchmarks and verification tests
cd build
ctest -C Release --output-on-failure