A C++17 study of image processing, Bayer ISP, and fixed-point arithmetic for algorithm-to-hardware handoff. The project implements the kernels independently. Python supplies OpenCV codecs and reference comparisons, an independent integer oracle, experiment orchestration, and reporting.
| Verified result | Evidence |
|---|---|
| 111,952 matching integer output codes and matching diagnostics across 192 precision and 80 worst-case configurations | Independent oracle sweep |
| 26,419,200 matching codes across benchmarked fixed-point variants | Variant timings and exact agreement |
| 77,559 of 102,400 tap additions clamped in the narrow-accumulator experiment | Range analysis |
| 19,814,400 exact grayscale streaming versus full-frame comparisons | Streaming evidence |
flowchart LR
A[Python CLI and fixtures] --> B[C++17 runner]
B --> C[Spatial filters and Bayer ISP]
B --> D[Golden and optimized fixed-point]
B --> E[Line-buffer correlation]
B --> F[Comparison and reporting]
G[Python integer oracle and OpenCV references] --> F
The spatial kernels implement 2D cross-correlation, box and median filters, direct and separable Gaussian, Sobel, Laplacian, and unsharp masking. The simulated ISP uses Bayer sampling, black-level correction, nearest or bilinear demosaicing, Gray World or White Patch, optional color matrix, denoising, gamma LUT and sharpening. OpenCV supports image I/O and comparison. Architecture · Source walkthrough
Inputs are unsigned image codes and coefficients are signed with an explicit fractional width. The study quantizes coefficients, applies the modeled product and accumulator limits in order, rescales, and clips the output. An independent Python oracle checks output codes and enabled diagnostics. Positive and negative coefficient sums bound each prefix, including signed kernels with zero DC gain.
For the evaluated 5×5 Gaussian and normalized RMSE ≤ 0.002, the selected configuration uses an 11-bit coefficient with 8 fractional bits and a 24-bit accumulator for the tested 8-, 10- and 12-bit input formats. The evaluated 7×7 benchmark configuration missed the same tolerance at F=8. Numerical verification
Single-threaded Release medians for a 1280×720, 7×7 Gaussian on the measured Ryzen 7 5700X3D. The fixed paths use the F=12 format documented in the benchmark report.
| Path | Median |
|---|---|
| Baseline fixed-point | 138.793 ms |
| Counted proof-based | 94.293 ms |
| Optimized silent | 51.492 ms |
| Float64 | 37.404 ms |
The silent path disables diagnostic counters and extrema tracking. Its 2.70× speedup over Baseline fixed is a derived ratio. The counted proof path retains diagnostics. Float64 remained faster than the optimized fixed path on this CPU. Benchmark report
On the NASA image, the original comparison reported 24.57 → 21.81 dB from black-corrected demosaic to final render. Matching both estimates to the same sRGB transfer gave 24.57 → 22.17 dB. Gray World produced the largest cumulative-stage drop on this color-dominant image. PSNR alone does not characterize edge enhancement or display rendering. Metric audit · Stage ablation
The grayscale float64 streaming model pulls row-major pixels through a line ring and a sliding window. At 1920×1080 with a 7×7 kernel, it models 107,912 bytes of line and window samples versus 16,588,800 bytes for the full-frame input. These are theoretical sample-storage quantities. The CLI still allocates full input and output buffers. Integer streaming is deferred. Streaming architecture
Linux or macOS with a C++17 compiler and Python 3.12:
python3 -m venv .venv
. .venv/bin/activate
python -m pip install -r requirements.txt
cmake -S . -B build-publication -DCMAKE_BUILD_TYPE=Release -DPython3_EXECUTABLE="$(command -v python)"
cmake --build build-publication --parallel
ctest --test-dir build-publication --output-on-failureWindows PowerShell with a local Zig toolchain:
python -m venv .venv
.venv/Scripts/python -m pip install -r requirements.txt cmake ninja ziglang==0.17.1
$env:Path = "$PWD\.venv\Scripts;$env:Path"
$zig = (Resolve-Path .venv/Lib/site-packages/ziglang/zig.exe).Path
cmake -S . -B build-publication -G Ninja -DCMAKE_BUILD_TYPE=Release "-DCMAKE_CXX_COMPILER=$zig;c++" "-DPython3_EXECUTABLE=$PWD/.venv/Scripts/python.exe"
cmake --build build-publication --parallel 1
ctest --test-dir build-publication --output-on-failureRun the demo and experiments from the repository root. On Linux or macOS, use the activated environment's python and omit the executable's .exe suffix.
$kernel = 'build-publication/ipl_kernel.exe'
.venv/Scripts/python tools/generate_test_images.py work/publication/demo
.venv/Scripts/python tools/lab.py --kernel $kernel isp work/publication/demo/scene.png work/publication/demo/isp.png --config configs/isp.json
.venv/Scripts/python tools/run_experiments.py --kernel $kernel --output work/reproduction/isp --reuse-benchmarks results/benchmarks.json
.venv/Scripts/python tools/run_phase2.py --kernel $kernel --output work/reproduction/numerical-studies
.venv/Scripts/python tools/phase2_stream.py --kernel $kernel --output work/reproduction/numerical-studiesRemove --reuse-benchmarks results/benchmarks.json to collect new baseline timings. Keep new results in work/ to preserve the archives.
All six CTest suites passed in Windows Release and Debug. Windows UBSan coverage was verified with a failing canary. Windows ASan remains unverified. Both hosted Ubuntu jobs passed for the equivalent source tree at 754ba39. Hosted verification
The ISP uses simulated sensor data and simple scene-dependent white balance. The repository contains software models and theoretical storage calculations. It has no RTL, FPGA, physical throughput, power, or area measurements. Final test report · Known limitations
- Measurement provenance and revision mapping
- Representative figure inventory
- Spatial filtering and ISP results
- Fixed-point, ISP ablation and streaming results
- MIT license and attribution. The Eileen Collins photograph is courtesy of NASA via scikit-image.






