Skip to content

anasm87/multi-threaded-vision

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multi-Threaded Vision Pipeline

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.

Overview

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.

Key Engineering Features

  • 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_variable and std::mutex, completely avoiding the overhead of thread creation/destruction per frame.

Performance Metrics

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

Documentation

For more in-depth information, please refer to the comprehensive documentation provided in the docs/ directory:

Build Instructions

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors