--- name: Project architecture patterns description: Key architectural decisions, module locations, and integration patterns discovered during implementation type: project --- ## First full implementation completed 2026-03-14. **Why:** Bring the scaffold to a fully compilable, runnable state. **How to apply:** Future work extends from this baseline. ### Module locations - `src/config/AppConfig.h/.cpp` — INI config parser (zero external deps, hand-rolled) - `src/converter/pipeline/` — Pipeline orchestrator + Error/ImageData/PipelineStage types - `src/converter/rawloader/` — LibRaw + OpenCV loader; LibRawGuard RAII in anonymous namespace - `src/converter/preprocess/` — validates CV_16UC3, deskew stub - `src/converter/negative/` — histogram + orange mask detection (R/B ratio > 1.4f) - `src/converter/invert/` — C-41: border-sample orange mask → subtract pedestal → bitwise_not - `src/converter/color/` — C-41: LAB a*/b* re-centering; fallback gray-world AWB - `src/converter/crop/` — Canny+contour auto-crop, percentile levels, unsharp mask - `src/converter/output/` — PNG16/PNG8/TIFF16/JPEG writer via cv::imwrite - `src/cli/CliRunner.h/.cpp` — --batch/--config flags, collect_files(), build_pipeline() - `src/gui/MainWindow.h/.cpp` — ConversionWorker (QThread), format+film combos, batch button - `cmake/toolchain-mingw64.cmake` — MinGW-w64 cross-compilation - `scripts/build-windows.sh` — Cross-compile + DLL collection script - `config.ini` — Example config with all documented keys ### Integration pattern Pipeline takes ImageData by value (moved). Loader is called outside the Pipeline and feeds it. OutputWriter is added as the last stage. ### CMakeLists quirks - LibRaw found via pkg-config on Linux/macOS, find_library fallback for MinGW. - AppConfig.cpp must be in converter_core sources (it uses OutputWriter types). - OpenCV version guard lowered to 4.6 (CLAUDE.md says 4.10+ for production).