From 5d5a64423fee58797bf611527e26566afe8596c6 Mon Sep 17 00:00:00 2001 From: sunrisepeak Date: Sat, 18 Jul 2026 12:47:31 +0800 Subject: [PATCH] =?UTF-8?q?feat(pkg):=20compat.opencv5=205.0.0=20=E2=80=94?= =?UTF-8?q?=20=E5=85=A8=E6=BA=90=E7=A0=81=E7=9B=B4=E7=BC=96=20+=20build.mc?= =?UTF-8?q?pp=20=E6=B6=88=E8=B4=B9=E7=AB=AF=E5=90=88=E6=88=90(=E6=96=B0?= =?UTF-8?q?=E5=BD=A2=E6=80=81)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OpenCV 5.0.0 (core/imgproc/imgcodecs/highgui/videoio + flann/geometry 闭包), mcpp 直编 457 TU(含 27 NASM .asm),SIMD runtime dispatch 保留(per-ISA glob flags)。小 config 快照(59KB/171 文件)内联;大生成物(字体 hex 头、OpenCL kernel 内嵌、转发 TU 层)由包内嵌 build.mcpp 在消费端合成 —— CMake 逻辑逐字节 忠实移植(与参考构建 diff 8/8 IDENTICAL)。官方 tarball + CN 镜像 (mcpp-res/opencv@5.0.0,sha256 双端核验)。 转发 TU 层同时解决 mcpp#233(对象路径折叠冲突)、libjpeg-turbo BITS_IN_JSAMPLE 同源三编、mcpp#234(defines 含空格)。端到端验证(mcpp 0.0.96):零 override 消费工程冷构建 33s 全绿;workspace 成员 tests/examples/opencv5 (cfg(linux))。 工具链:tools/compat-opencv5/{fetch_upstream.sh,gen_config.sh,gen_descriptor.py, build_mcpp_template.cpp};gen_descriptor 对全部参考编译命令做精确重构断言。 --- .../2026-07-18-add-compat-opencv5-plan.md | 75 + README.md | 1 + mcpp.toml | 1 + pkgs/c/compat.opencv5.lua | 3105 +++++++++++++++++ tests/examples/opencv5/mcpp.toml | 17 + tests/examples/opencv5/tests/opencv5.cpp | 35 + tools/compat-opencv5/build_mcpp_template.cpp | 281 ++ tools/compat-opencv5/fetch_upstream.sh | 23 + tools/compat-opencv5/gen_config.sh | 58 + tools/compat-opencv5/gen_descriptor.py | 315 ++ 10 files changed, 3911 insertions(+) create mode 100644 .agents/docs/2026-07-18-add-compat-opencv5-plan.md create mode 100644 pkgs/c/compat.opencv5.lua create mode 100644 tests/examples/opencv5/mcpp.toml create mode 100644 tests/examples/opencv5/tests/opencv5.cpp create mode 100644 tools/compat-opencv5/build_mcpp_template.cpp create mode 100755 tools/compat-opencv5/fetch_upstream.sh create mode 100755 tools/compat-opencv5/gen_config.sh create mode 100755 tools/compat-opencv5/gen_descriptor.py diff --git a/.agents/docs/2026-07-18-add-compat-opencv5-plan.md b/.agents/docs/2026-07-18-add-compat-opencv5-plan.md new file mode 100644 index 0000000..8259abf --- /dev/null +++ b/.agents/docs/2026-07-18-add-compat-opencv5-plan.md @@ -0,0 +1,75 @@ +# add `compat.opencv5` 5.0.0 — 全源码直编 + build.mcpp 消费端合成(新形态) + +日期:2026-07-18 · 关联:pkgs/c/compat.opencv5.lua、tools/compat-opencv5/、tests/examples/opencv5/ +背景:opencv-m 项目(OpenCV 5 模块化封装)的 compat 底座;compat.ffmpeg(#74)形态的演进。 + +## 形态判定:为什么不是既有三形态 + +- 不是 install()/CMake 形态(compat.opencv 4.13 那种):项目目标是**构建期零 CMake**、 + mcpp 直编(用户硬约束)。 +- 不是纯 config-快照形态(compat.ffmpeg 那种):OpenCV 构建期生成物达 17MB + (字体 hex 头 13MB+1.7MB、OpenCL kernel 内嵌 0.6MB、逐 TU 转发 stub),无法内联。 +- **新形态**:小体量 config 快照(59KB,171 文件)内联 + 包内嵌 `build.mcpp` + 在消费端合成大生成物(mcpp 0.0.95 依赖包 build.mcpp 执行 + `mcpp:generated=` + + OUT_DIR 契约)。合成器为 CMake 逻辑的逐字节忠实移植 + (blob2hdr / cl2cpp+MD5,已 diff 参考构建产物 8/8 IDENTICAL)。 + +## 范围与 profile(v0.1,linux-x86_64) + +`BUILD_LIST=core,imgproc,imgcodecs,highgui,videoio`(闭包拉入 flann、geometry); +hermetic:外部探测全 OFF,vendored zlib/libpng/libjpeg-turbo(含 27 NASM `.asm`); +headless highgui;V4L2 videoio;`WITH_UNIFONT=OFF`(13MB CJK 字体是 configure 期 +**额外下载**,破坏单源 sha256 封闭;将来做 feature);**SIMD runtime dispatch 保留** +(per-ISA glob flags:`**/*.{sse4_1,sse4_2,avx,avx2,avx512_skx}.cpp`)。 + +## 转发 TU 层(gen/tu/) + +每个 C/C++ TU 经唯一名 stub 进构建,一石三鸟: +1. mcpp#233(对象路径按「父目录名+文件名」折叠,`modules/*/src/` 同名源必撞); +2. libjpeg-turbo 同源三编(BITS_IN_JSAMPLE=8/12/16); +3. mcpp#234(含空格 define 命令行被拆散)→ 改注入 stub 顶部 `#define`。 +`tu_manifest.txt`(内联 generated_files)驱动;#233/#234 修复后此层可退役。 + +## flag 面分解与校验 + +flags(TU) = 基础(-msse3) ∪ 目录组(9 组) ∪ ISA 后缀组 ∪ 逐文件特例(3 个); +gen_descriptor.py 对全部 457 条参考编译命令做**精确重构断言**,不闭合即失败。 +语言标准:上游 c++17,index 楼层 c++23 —— 457 TU 已在 gcc16 `-std=c++23` 下 +全绿验证(O0 spike),声明 `language = "c++23"`。 + +## CN 镜像 + +gitcode `mcpp-res/opencv` release `5.0.0`,资产 = GitHub tag tarball 逐字节 +(sha256 `b0528f5a…3095` 双端核验)。 + +## 验证 + +- lint(语法/必填/无前导 v/镜像表)+ `mcpp xpkg parse`(0.0.95、0.0.96)✓ +- 合成忠实性:blob2hdr×2 + cl2cpp×6 与 CMake 参考 **逐字节一致** ✓ +- 端到端(mcpp 0.0.96):零 override 消费工程 → 官方 tarball 下载 → + generated_files → dep build.mcpp 合成 → 457 TU 直编(冷 33s/32 核)→ + 运行断言(版本/resize/cvtColor/PNG+JPEG roundtrip/videoio registry/AVX2)✓ +- workspace 成员 tests/examples/opencv5(cfg(linux) 门控)`mcpp test` ✓ + +## 踩坑记录(过程中新发现并已提 issue) + +- mcpp#233 对象路径折叠冲突(2 文件最小复现)。 +- mcpp#234 defines 含空格未转义。 +- build.mcpp 诊断输出**不要写 stderr**:会与缓冲中的 stdout 指令流交错, + 污染 `mcpp:generated=` 行(表现为"declared generated source ... does not + exist",路径里混入诊断文本)。诊断走 stdout 非指令行 + 末尾 fflush。 +- `ninja -n` 在已构建目录只列过期目标 → 源列表推导必须用 `ninja -t commands`。 +- 参考构建需真跑一次 ninja(-k 容错宿主 gcc13 对 2 个 AVX2 bfloat TU 的 ICE), + 否则 cl2cpp/blob2hdr 产物不落盘、无从对照。 + +## 升级 SOP + +改 `tools/compat-opencv5/fetch_upstream.sh` 版本/sha256 pin → +`sh tools/compat-opencv5/gen_config.sh` (需宿主 cmake+ninja+nasm;CC=/usr/bin/gcc +防 xlings subos 交叉 shim)→ 描述符重生成 + review diff → gtc 上传新 tarball 到 +CN 镜像 → PR。 + +## 后续(opencv-m 侧) + +O2:opencv-m 模块层仓库(`import opencv.cv;`,hdr_parser.py 驱动导出面)→ +O3:发布 + `pkgs/o/opencv.lua` Form A 登记(imgui/ffmpeg 先例)。 diff --git a/README.md b/README.md index 9187f92..d39eba8 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ mcpp self config --mirror CN # 切换至国内镜像,默认使用 GLOBAL 上 | header-only(含 `features`) | [`compat.eigen`](pkgs/c/compat.eigen.lua) | | 外部构建系统(`install()` 从源码构建) | [`compat.openblas`](pkgs/c/compat.openblas.lua)(Make) · [`compat.opencv`](pkgs/c/compat.opencv.lua)(CMake) | | 全源码直编(config 快照 + 源列表,零外部构建系统) | [`compat.ffmpeg`](pkgs/c/compat.ffmpeg.lua)(2281 TU 含 NASM 汇编) | +| 全源码直编 + `build.mcpp` 消费端合成 | [`compat.opencv5`](pkgs/c/compat.opencv5.lua)(457 TU,SIMD dispatch 保留,字体/内核/转发 TU 由包内 build.mcpp 生成) | | C++23 module wrapper | [`nlohmann.json`](pkgs/n/nlohmann.json.lua) · [`marzer.tomlplusplus`](pkgs/m/marzer.tomlplusplus.lua) | ### 新增一个包 diff --git a/mcpp.toml b/mcpp.toml index 88f0f47..6d5a599 100644 --- a/mcpp.toml +++ b/mcpp.toml @@ -23,6 +23,7 @@ members = [ "tests/examples/nlohmann.json", "tests/examples/openblas", "tests/examples/opencv", + "tests/examples/opencv5", "tests/examples/spdlog", "tests/examples/spdlog-compiled", ] diff --git a/pkgs/c/compat.opencv5.lua b/pkgs/c/compat.opencv5.lua new file mode 100644 index 0000000..46e95d5 --- /dev/null +++ b/pkgs/c/compat.opencv5.lua @@ -0,0 +1,3105 @@ +-- Auto-generated by tools/compat-opencv5/gen_descriptor.py — do not edit by hand. +-- Recipe: OpenCV 5.0.0 built FROM SOURCE by mcpp (no CMake at build +-- time). v0.1 scope: core imgproc imgcodecs highgui videoio (+ flann, +-- geometry dependency closure); hermetic profile (all external probes OFF, +-- vendored zlib/libpng/libjpeg-turbo incl. 27 NASM SIMD units, headless +-- highgui, V4L2 videoio, WITH_UNIFONT=OFF); SIMD runtime dispatch KEPT +-- (per-ISA glob flags). Small config snapshot inlined below; the large +-- build-time products (font hex headers, OpenCL kernel embeddings, the +-- forwarding-TU layer) are synthesized on the consumer by the embedded +-- build.mcpp — byte-faithful ports verified against the reference CMake +-- build. Regenerate: sh tools/compat-opencv5/gen_config.sh (this repo). +package = { + spec = "1", + namespace = "compat", + name = "compat.opencv5", + description = "OpenCV 5.0.0 (core/imgproc/imgcodecs/highgui/videoio), full source build with SIMD dispatch", + licenses = {"Apache-2.0"}, + repo = "https://github.com/opencv/opencv", + type = "package", + + xpm = { + -- linux-x86_64 only for now: the config snapshot is target-specific. + linux = { + ["5.0.0"] = { + url = { + GLOBAL = "https://github.com/opencv/opencv/archive/refs/tags/5.0.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/opencv/releases/download/5.0.0/opencv-5.0.0.tar.gz", + }, + sha256 = "b0528f5a1d379d59d4701cb28c36e22214cc51cf64594e5b56f2d3e6c0233095", + }, + }, + }, + + mcpp = { + language = "c++23", -- upstream min c++17; c++23 spike-validated (457 TU green) + include_dirs = { + "mcpp_generated", + "*", + "*/3rdparty/dlpack/include", + "mcpp_generated/3rdparty/libjpeg-turbo", + "*/3rdparty/libjpeg-turbo/src", + "*/3rdparty/libjpeg-turbo/simd/nasm", + "*/3rdparty/libjpeg-turbo/simd/x86_64", + "mcpp_generated/3rdparty/zlib", + "*/3rdparty/zlib", + "*/modules/core/include", + "mcpp_generated/modules/core", + "*/modules/flann/include", + "mcpp_generated/modules/flann", + "*/modules/geometry/include", + "mcpp_generated/modules/geometry", + "*/modules/imgproc/include", + "mcpp_generated/modules/imgproc", + "*/3rdparty/libpng", + "*/modules/imgcodecs/include", + "mcpp_generated/modules/imgcodecs", + "*/modules/videoio/include", + "mcpp_generated/modules/videoio", + "*/modules/highgui/include", + "mcpp_generated/modules/highgui", + }, + cxxflags = { "-msse3", "-w" }, + cflags = { "-msse3", "-w" }, + flags = { + { glob = "**/tu/core/**", defines = { "HAVE_STDARG_H=1", "HAVE_UNISTD_H=1", "NDEBUG", "_USE_MATH_DEFINES", "__OPENCV_BUILD=1", "__STDC_CONSTANT_MACROS", "__STDC_FORMAT_MACROS", "__STDC_LIMIT_MACROS" } }, + { glob = "**/tu/flann/**", defines = { "NDEBUG", "_USE_MATH_DEFINES", "__OPENCV_BUILD=1", "__STDC_CONSTANT_MACROS", "__STDC_FORMAT_MACROS", "__STDC_LIMIT_MACROS" } }, + { glob = "**/tu/geometry/**", defines = { "NDEBUG", "_USE_MATH_DEFINES", "__OPENCV_BUILD=1", "__STDC_CONSTANT_MACROS", "__STDC_FORMAT_MACROS", "__STDC_LIMIT_MACROS" } }, + { glob = "**/tu/highgui/**", defines = { "ENABLE_PLUGINS", "NDEBUG", "_USE_MATH_DEFINES", "__OPENCV_BUILD=1", "__STDC_CONSTANT_MACROS", "__STDC_FORMAT_MACROS", "__STDC_LIMIT_MACROS" } }, + { glob = "**/tu/imgcodecs/**", defines = { "HAVE_IMGCODEC_HDR", "HAVE_IMGCODEC_PFM", "HAVE_IMGCODEC_PXM", "HAVE_IMGCODEC_SUNRASTER", "HAVE_STDARG_H=1", "HAVE_UNISTD_H=1", "NDEBUG", "_USE_MATH_DEFINES", "__OPENCV_BUILD=1", "__STDC_CONSTANT_MACROS", "__STDC_FORMAT_MACROS", "__STDC_LIMIT_MACROS" } }, + { glob = "**/tu/imgproc/**", defines = { "HAVE_STDARG_H=1", "HAVE_UNISTD_H=1", "NDEBUG", "_USE_MATH_DEFINES", "__OPENCV_BUILD=1", "__STDC_CONSTANT_MACROS", "__STDC_FORMAT_MACROS", "__STDC_LIMIT_MACROS" } }, + { glob = "**/tu/jpeg/**", defines = { "NDEBUG", "NO_GETENV", "NO_PUTENV" } }, + { glob = "**/tu/jpeg12/**", defines = { "BITS_IN_JSAMPLE=12", "NDEBUG", "NO_GETENV", "NO_PUTENV" } }, + { glob = "**/tu/jpeg16/**", defines = { "BITS_IN_JSAMPLE=16", "NDEBUG", "NO_GETENV", "NO_PUTENV" } }, + { glob = "**/tu/png/**", defines = { "HAVE_STDARG_H=1", "HAVE_UNISTD_H=1", "NDEBUG", "PNG_INTEL_SSE_OPT=1" } }, + { glob = "**/tu/videoio/**", defines = { "ENABLE_PLUGINS", "HAVE_CAMV4L2", "NDEBUG", "_USE_MATH_DEFINES", "__OPENCV_BUILD=1", "__STDC_CONSTANT_MACROS", "__STDC_FORMAT_MACROS", "__STDC_LIMIT_MACROS" } }, + { glob = "**/tu/zlib/**", defines = { "HAVE_STDARG_H=1", "HAVE_UNISTD_H=1", "NDEBUG" } }, + { glob = "**/*.asm", defines = { "ELF", "NO_GETENV", "NO_PUTENV", "PIC", "__CET__", "__x86_64__" } }, + { glob = "**/*.avx.cpp", defines = { "CV_CPU_COMPILE_AVX=1", "CV_CPU_COMPILE_POPCNT=1", "CV_CPU_COMPILE_SSE4_1=1", "CV_CPU_COMPILE_SSE4_2=1", "CV_CPU_COMPILE_SSSE3=1", "CV_CPU_DISPATCH_MODE=AVX" }, cxxflags = { "-mssse3", "-msse4.1", "-mpopcnt", "-msse4.2", "-mavx" } }, + { glob = "**/*.avx2.cpp", defines = { "CV_CPU_COMPILE_AVX2=1", "CV_CPU_COMPILE_AVX=1", "CV_CPU_COMPILE_FMA3=1", "CV_CPU_COMPILE_FP16=1", "CV_CPU_COMPILE_POPCNT=1", "CV_CPU_COMPILE_SSE4_1=1", "CV_CPU_COMPILE_SSE4_2=1", "CV_CPU_COMPILE_SSSE3=1", "CV_CPU_DISPATCH_MODE=AVX2" }, cxxflags = { "-mssse3", "-msse4.1", "-mpopcnt", "-msse4.2", "-mavx", "-mf16c", "-mavx2", "-mfma" } }, + { glob = "**/*.avx512_skx.cpp", defines = { "CV_CPU_COMPILE_AVX2=1", "CV_CPU_COMPILE_AVX512_COMMON=1", "CV_CPU_COMPILE_AVX512_SKX=1", "CV_CPU_COMPILE_AVX=1", "CV_CPU_COMPILE_AVX_512F=1", "CV_CPU_COMPILE_FMA3=1", "CV_CPU_COMPILE_FP16=1", "CV_CPU_COMPILE_POPCNT=1", "CV_CPU_COMPILE_SSE4_1=1", "CV_CPU_COMPILE_SSE4_2=1", "CV_CPU_COMPILE_SSSE3=1", "CV_CPU_DISPATCH_MODE=AVX512_SKX" }, cxxflags = { "-mssse3", "-msse4.1", "-mpopcnt", "-msse4.2", "-mavx", "-mf16c", "-mavx2", "-mfma", "-mavx512f", "-mavx512f", "-mavx512cd", "-mavx512f", "-mavx512cd", "-mavx512vl", "-mavx512bw", "-mavx512dq" } }, + { glob = "**/*.sse4_1.cpp", defines = { "CV_CPU_COMPILE_SSE4_1=1", "CV_CPU_COMPILE_SSSE3=1", "CV_CPU_DISPATCH_MODE=SSE4_1" }, cxxflags = { "-mssse3", "-msse4.1" } }, + { glob = "**/*.sse4_2.cpp", defines = { "CV_CPU_COMPILE_POPCNT=1", "CV_CPU_COMPILE_SSE4_1=1", "CV_CPU_COMPILE_SSE4_2=1", "CV_CPU_COMPILE_SSSE3=1", "CV_CPU_DISPATCH_MODE=SSE4_2" }, cxxflags = { "-mssse3", "-msse4.1", "-mpopcnt", "-msse4.2" } }, + { glob = "**/tu/core/modules_core_src_alloc.cpp", defines = { "HAVE_MALLOC_H=1", "HAVE_MEMALIGN=1", "HAVE_POSIX_MEMALIGN=1" } }, + { glob = "**/tu/core/modules_core_src_parallel_parallel.cpp", defines = { "PARALLEL_ENABLE_PLUGINS=1" } }, + { glob = "**/tu/core/modules_core_src_system.cpp", defines = { "HAVE_GETAUXVAL=1" } }, + }, + targets = { + opencv5 = { kind = "lib" }, + }, + linux = { + ldflags = { "-lpthread", "-ldl" }, + }, + sources = { + "*/3rdparty/libjpeg-turbo/simd/x86_64/jsimdcpu.asm", + "*/3rdparty/libjpeg-turbo/simd/x86_64/jfdctflt-sse.asm", + "*/3rdparty/libjpeg-turbo/simd/x86_64/jccolor-sse2.asm", + "*/3rdparty/libjpeg-turbo/simd/x86_64/jcgray-sse2.asm", + "*/3rdparty/libjpeg-turbo/simd/x86_64/jchuff-sse2.asm", + "*/3rdparty/libjpeg-turbo/simd/x86_64/jcphuff-sse2.asm", + "*/3rdparty/libjpeg-turbo/simd/x86_64/jcsample-sse2.asm", + "*/3rdparty/libjpeg-turbo/simd/x86_64/jdcolor-sse2.asm", + "*/3rdparty/libjpeg-turbo/simd/x86_64/jdmerge-sse2.asm", + "*/3rdparty/libjpeg-turbo/simd/x86_64/jdsample-sse2.asm", + "*/3rdparty/libjpeg-turbo/simd/x86_64/jfdctfst-sse2.asm", + "*/3rdparty/libjpeg-turbo/simd/x86_64/jfdctint-sse2.asm", + "*/3rdparty/libjpeg-turbo/simd/x86_64/jidctflt-sse2.asm", + "*/3rdparty/libjpeg-turbo/simd/x86_64/jidctfst-sse2.asm", + "*/3rdparty/libjpeg-turbo/simd/x86_64/jidctint-sse2.asm", + "*/3rdparty/libjpeg-turbo/simd/x86_64/jidctred-sse2.asm", + "*/3rdparty/libjpeg-turbo/simd/x86_64/jquantf-sse2.asm", + "*/3rdparty/libjpeg-turbo/simd/x86_64/jquanti-sse2.asm", + "*/3rdparty/libjpeg-turbo/simd/x86_64/jccolor-avx2.asm", + "*/3rdparty/libjpeg-turbo/simd/x86_64/jcgray-avx2.asm", + "*/3rdparty/libjpeg-turbo/simd/x86_64/jcsample-avx2.asm", + "*/3rdparty/libjpeg-turbo/simd/x86_64/jdcolor-avx2.asm", + "*/3rdparty/libjpeg-turbo/simd/x86_64/jdmerge-avx2.asm", + "*/3rdparty/libjpeg-turbo/simd/x86_64/jdsample-avx2.asm", + "*/3rdparty/libjpeg-turbo/simd/x86_64/jfdctint-avx2.asm", + "*/3rdparty/libjpeg-turbo/simd/x86_64/jidctint-avx2.asm", + "*/3rdparty/libjpeg-turbo/simd/x86_64/jquanti-avx2.asm", + }, + generated_files = { + ["build.mcpp"] = [==[ +// build.mcpp for compat.opencv5 — consumer-side synthesis of OpenCV's +// build-time generated files from the frozen config snapshot. Embedded into +// pkgs/c/compat.opencv5.lua by tools/compat-opencv5/gen_descriptor.py. +// +// What it does (all pure transforms of files already in the pinned tarball — +// nothing is downloaded, nothing depends on the host): +// 1. blob2hdr — modules/imgproc/fonts/*.ttf.gz → builtin_font_{sans,italic}.h +// (hex byte arrays; faithful port of cmake ocv_blob2hdr) +// 2. cl2cpp — modules//src/opencl/*.cl → opencl_kernels_.{cpp,hpp} +// (comment-strip + string-escape + md5; faithful port of +// cmake/cl2cpp.cmake; content is #ifdef HAVE_OPENCL-guarded +// and inert in this profile, kept byte-faithful anyway) +// 3. tu stubs — one uniquely-named forwarding TU per source, driven by +// mcpp_generated/tu_manifest.txt. Works around mcpp#233 +// (object paths fold to / — OpenCV's +// modules/*/src/ layout collides), absorbs the +// libjpeg-turbo BITS_IN_JSAMPLE=12/16 same-source +// re-compiles, and carries defines whose values contain +// spaces (mcpp#234) as #define preludes. +// The raw `mcpp:` stdout protocol is used (no `import mcpp;`) so this file +// has zero non-standard dependencies. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace fs = std::filesystem; + +// ── tiny MD5 (RFC 1321, public-domain style condensed implementation) ──── +namespace md5impl { +struct MD5 { + uint32_t a0 = 0x67452301, b0 = 0xefcdab89, c0 = 0x98badcfe, d0 = 0x10325476; + static const uint32_t K[64]; + static const uint32_t R[64]; + void block(const uint8_t* p) { + uint32_t M[16]; + for (int i = 0; i < 16; i++) + M[i] = (uint32_t)p[i*4] | ((uint32_t)p[i*4+1] << 8) | ((uint32_t)p[i*4+2] << 16) | ((uint32_t)p[i*4+3] << 24); + uint32_t A = a0, B = b0, C = c0, D = d0; + for (int i = 0; i < 64; i++) { + uint32_t F; int g; + if (i < 16) { F = (B & C) | (~B & D); g = i; } + else if (i < 32) { F = (D & B) | (~D & C); g = (5*i + 1) % 16; } + else if (i < 48) { F = B ^ C ^ D; g = (3*i + 5) % 16; } + else { F = C ^ (B | ~D); g = (7*i) % 16; } + F = F + A + K[i] + M[g]; + A = D; D = C; C = B; + B = B + ((F << R[i]) | (F >> (32 - R[i]))); + } + a0 += A; b0 += B; c0 += C; d0 += D; + } + static std::string hex(const std::string& data) { + MD5 m; + uint64_t bits = (uint64_t)data.size() * 8; + std::string buf = data; + buf.push_back((char)0x80); + while (buf.size() % 64 != 56) buf.push_back('\0'); + for (int i = 0; i < 8; i++) buf.push_back((char)((bits >> (8*i)) & 0xff)); + for (size_t o = 0; o < buf.size(); o += 64) m.block((const uint8_t*)buf.data() + o); + char out[33]; + uint32_t w[4] = { m.a0, m.b0, m.c0, m.d0 }; + for (int i = 0; i < 16; i++) + std::snprintf(out + 2*i, 3, "%02x", (w[i/4] >> (8*(i%4))) & 0xff); + return std::string(out, 32); + } +}; +const uint32_t MD5::K[64] = { + 0xd76aa478,0xe8c7b756,0x242070db,0xc1bdceee,0xf57c0faf,0x4787c62a,0xa8304613,0xfd469501, + 0x698098d8,0x8b44f7af,0xffff5bb1,0x895cd7be,0x6b901122,0xfd987193,0xa679438e,0x49b40821, + 0xf61e2562,0xc040b340,0x265e5a51,0xe9b6c7aa,0xd62f105d,0x02441453,0xd8a1e681,0xe7d3fbc8, + 0x21e1cde6,0xc33707d6,0xf4d50d87,0x455a14ed,0xa9e3e905,0xfcefa3f8,0x676f02d9,0x8d2a4c8a, + 0xfffa3942,0x8771f681,0x6d9d6122,0xfde5380c,0xa4beea44,0x4bdecfa9,0xf6bb4b60,0xbebfbc70, + 0x289b7ec6,0xeaa127fa,0xd4ef3085,0x04881d05,0xd9d4d039,0xe6db99e5,0x1fa27cf8,0xc4ac5665, + 0xf4292244,0x432aff97,0xab9423a7,0xfc93a039,0x655b59c3,0x8f0ccc92,0xffeff47d,0x85845dd1, + 0x6fa87e4f,0xfe2ce6e0,0xa3014314,0x4e0811a1,0xf7537e82,0xbd3af235,0x2ad7d2bb,0xeb86d391 }; +const uint32_t MD5::R[64] = { + 7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22, 5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20, + 4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23, 6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21 }; +} // namespace md5impl + +static std::string slurp(const fs::path& p) { + std::ifstream f(p, std::ios::binary); + if (!f) { std::fprintf(stderr, "compat.opencv5 build.mcpp: cannot read %s\n", p.string().c_str()); std::exit(1); } + std::ostringstream ss; ss << f.rdbuf(); return ss.str(); +} +static void spew(const fs::path& p, const std::string& content) { + fs::create_directories(p.parent_path()); + // only rewrite when changed: keeps ninja restat-friendly timestamps + if (fs::exists(p)) { + std::ifstream f(p, std::ios::binary); std::ostringstream ss; ss << f.rdbuf(); + if (ss.str() == content) return; + } + std::ofstream f(p, std::ios::binary); + f << content; + if (!f) { std::fprintf(stderr, "compat.opencv5 build.mcpp: cannot write %s\n", p.string().c_str()); std::exit(1); } +} + +// ── gunzip (raw inflate over the vendored zlib? not available here) ───── +// The .ttf.gz blobs are embedded AS-IS: cmake's ocv_blob2hdr hex-dumps the +// *compressed* file bytes (OpenCV decompresses at runtime via its zlib), so +// no inflate is needed here — just a hex dump. +static void blob2hdr(const fs::path& blob, const fs::path& hdr, const std::string& var) { + // byte-faithful port of cmake ocv_blob2hdr: 16 bytes per line, ", " + // separators, the very last ", " trimmed. + std::string data = slurp(blob); + std::ostringstream out; + out << "// Auto generated file.\nstatic const unsigned char " << var << "[] =\n{\n"; + char buf[8]; + for (size_t i = 0; i < data.size(); i++) { + std::snprintf(buf, sizeof buf, "0x%02x", (unsigned char)data[i]); + out << buf; + if (i + 1 != data.size()) out << ", "; + if (i % 16 == 15 && i + 1 != data.size()) out << "\n"; + } + out << "\n};\n"; + spew(hdr, out.str()); +} + +// ── cl2cpp (faithful port of cmake/cl2cpp.cmake) ──────────────────────── +static std::string cl_escape(std::string lines) { + std::string t; + // \r removal + trailing \n + tabs→2 spaces + for (char c : lines) if (c != '\r') t.push_back(c); + t.push_back('\n'); + std::string u; + for (char c : t) { if (c == '\t') u += " "; else u.push_back(c); } + // strip /* */ comments (non-greedy scan) + std::string v; v.reserve(u.size()); + for (size_t i = 0; i < u.size();) { + if (i + 1 < u.size() && u[i] == '/' && u[i+1] == '*') { + size_t e = u.find("*/", i + 2); + i = (e == std::string::npos) ? u.size() : e + 2; + } else v.push_back(u[i++]); + } + // strip // comments (with leading spaces) + std::string w; w.reserve(v.size()); + for (size_t i = 0; i < v.size();) { + if (i + 1 < v.size() && v[i] == '/' && v[i+1] == '/') { + while (!w.empty() && w.back() == ' ') w.pop_back(); + size_t e = v.find('\n', i); + i = (e == std::string::npos) ? v.size() : e; // keep the newline + } else w.push_back(v[i++]); + } + // collapse empty lines + leading whitespace per line + std::string x; x.reserve(w.size()); + for (size_t i = 0; i < w.size();) { + if (w[i] == '\n') { + x.push_back('\n'); + size_t j = i + 1; + while (j < w.size() && (w[j] == ' ' || w[j] == '\n')) { + if (w[j] == '\n') { i = j; } + j++; + } + // re-scan: skip spaces directly after newline, and fold newline runs + size_t k = i + 1; + while (k < w.size() && w[k] == ' ') k++; + while (k < w.size() && w[k] == '\n') { k++; i = k - 1; + while (k < w.size() && w[k] == ' ') k++; } + i = k; + } else x.push_back(w[i++]); + } + if (!x.empty() && x.front() == '\n') x.erase(0, 1); + // escape backslash, quote; newline → \n" " + std::string y; + for (char c : x) { + if (c == '\\') y += "\\\\"; + else if (c == '"') y += "\\\""; + else if (c == '\n') y += "\\n\"\n\""; + else y.push_back(c); + } + // drop unneeded trailing quote opener + if (y.size() >= 1 && y.back() == '"') y.pop_back(); + return y; +} + +static void cl2cpp(const fs::path& cl_dir, const fs::path& out_cpp, const fs::path& out_hpp, + const std::string& module_name) { + std::vector cls; + for (auto& e : fs::directory_iterator(cl_dir)) + if (e.path().extension() == ".cl") cls.push_back(e.path()); + std::sort(cls.begin(), cls.end()); + std::string ns = module_name; + if (!ns.empty() && ns[0] >= '0' && ns[0] <= '9') ns = "_" + ns; + std::ostringstream cpp, hpp; + cpp << "// This file is auto-generated. Do not edit!\n\n#include \"opencv2/core.hpp\"\n" + << "#include \"cvconfig.h\"\n#include \"" << out_hpp.filename().string() << "\"\n\n" + << "#ifdef HAVE_OPENCL\n\nnamespace cv\n{\nnamespace ocl\n{\nnamespace " << ns + << "\n{\n\nstatic const char* const moduleName = \"" << module_name << "\";\n\n"; + hpp << "// This file is auto-generated. Do not edit!\n\n#include \"opencv2/core/ocl.hpp\"\n" + << "#include \"opencv2/core/ocl_genbase.hpp\"\n#include \"opencv2/core/opencl/ocl_defs.hpp\"\n\n" + << "#ifdef HAVE_OPENCL\n\nnamespace cv\n{\nnamespace ocl\n{\nnamespace " << ns << "\n{\n\n"; + for (auto& cl : cls) { + std::string name = cl.stem().string(); + std::string body = cl_escape(slurp(cl)); + std::string hash = md5impl::MD5::hex(body); + cpp << "struct cv::ocl::internal::ProgramEntry " << name << "_oclsrc={moduleName, \"" << name + << "\",\n\"" << body << ", \"" << hash << "\", NULL};\n"; + hpp << "extern struct cv::ocl::internal::ProgramEntry " << name << "_oclsrc;\n"; + } + cpp << "\n}}}\n#endif\n"; + hpp << "\n}}}\n#endif\n"; + spew(out_cpp, cpp.str()); + spew(out_hpp, hpp.str()); +} + +int main() { + const char* man_env = std::getenv("MCPP_MANIFEST_DIR"); + const char* out_env = std::getenv("MCPP_OUT_DIR"); + fs::path man = man_env ? man_env : "."; + if (!out_env) { std::fprintf(stderr, "compat.opencv5 build.mcpp: MCPP_OUT_DIR unset (mcpp >= 0.0.95 required)\n"); return 1; } + fs::path out = out_env; + fs::path gen = man / "mcpp_generated"; + + // the extracted official tarball wrap dir (opencv-/) + fs::path wrap; + for (auto& e : fs::directory_iterator(man)) { + if (e.is_directory() && e.path().filename().string().rfind("opencv-", 0) == 0 + && fs::exists(e.path() / "modules")) { wrap = e.path(); break; } + } + if (wrap.empty()) { std::fprintf(stderr, "compat.opencv5 build.mcpp: opencv-* source dir not found under %s\n", man.string().c_str()); return 1; } + + // 1. fonts + blob2hdr(wrap / "modules/imgproc/fonts/Rubik.ttf.gz", out / "builtin_font_sans.h", "OcvBuiltinFontSans"); + blob2hdr(wrap / "modules/imgproc/fonts/Rubik-Italic.ttf.gz", out / "builtin_font_italic.h", "OcvBuiltinFontItalic"); + + // 2. OpenCL kernel embeddings (inert under this profile, byte-faithful) + for (std::string m : { "core", "imgproc", "geometry" }) { + fs::path cl_dir = wrap / "modules" / m / "src" / "opencl"; + if (fs::exists(cl_dir)) + cl2cpp(cl_dir, out / ("clsrc/opencl_kernels_" + m + ".cpp"), + out / ("opencl_kernels_" + m + ".hpp"), m); + } + + // 3. forwarding TU stubs from the manifest + // line grammar: !prelude (collect) + // (emit stub) + std::map preludes; + std::ifstream mf(gen / "tu_manifest.txt"); + if (!mf) { std::fprintf(stderr, "compat.opencv5 build.mcpp: mcpp_generated/tu_manifest.txt missing\n"); return 1; } + std::string line; + int stubs = 0; + while (std::getline(mf, line)) { + if (line.empty() || line[0] == '#') continue; + std::vector f; + size_t pos = 0; + while (true) { + size_t t = line.find('\t', pos); + if (t == std::string::npos) { f.push_back(line.substr(pos)); break; } + f.push_back(line.substr(pos, t - pos)); pos = t + 1; + } + if (f[0] == "!prelude" && f.size() == 3) { preludes[f[1]] += f[2] + "\n"; continue; } + if (f.size() != 2) continue; + const std::string& grp = f[0]; + const std::string& target = f[1]; + std::string mangled = target; + for (char& c : mangled) if (c == '/') c = '_'; + fs::path stub = out / "tu" / grp / mangled; + std::string content = "/* compat.opencv5 forwarding TU (" + grp + ") */\n" + + preludes[grp] + "#include \"" + target + "\"\n"; + spew(stub, content); + std::printf("mcpp:generated=%s\n", stub.string().c_str()); + stubs++; + } + + // out/ carries builtin_font_*.h, opencl_kernels_*.hpp, clsrc/ includes + std::printf("mcpp:cxxflag=-I%s\n", out.string().c_str()); + std::printf("mcpp:cflag=-I%s\n", out.string().c_str()); + std::printf("mcpp:rerun-if-changed=%s\n", (gen / "tu_manifest.txt").string().c_str()); + // diagnostics as a non-directive stdout line: stderr writes can interleave + // into the (buffered) stdout directive stream and corrupt a directive. + std::printf("compat.opencv5 build.mcpp: %d stubs, fonts + CL kernels synthesized\n", stubs); + std::fflush(stdout); + return 0; +} +]==], + ["mcpp_generated/tu_manifest.txt"] = [==[ +!prelude core #define OPENCV_ALLOCATOR_STATS_COUNTER_TYPE long long +jpeg12 3rdparty/libjpeg-turbo/src/jcapistd.c +jpeg12 3rdparty/libjpeg-turbo/src/jccolor.c +jpeg12 3rdparty/libjpeg-turbo/src/jcdiffct.c +jpeg12 3rdparty/libjpeg-turbo/src/jclossls.c +jpeg12 3rdparty/libjpeg-turbo/src/jcmainct.c +jpeg12 3rdparty/libjpeg-turbo/src/jcprepct.c +jpeg12 3rdparty/libjpeg-turbo/src/jcsample.c +jpeg12 3rdparty/libjpeg-turbo/src/jdapistd.c +jpeg12 3rdparty/libjpeg-turbo/src/jdcolor.c +jpeg12 3rdparty/libjpeg-turbo/src/jddiffct.c +jpeg12 3rdparty/libjpeg-turbo/src/jdlossls.c +jpeg12 3rdparty/libjpeg-turbo/src/jdmainct.c +jpeg12 3rdparty/libjpeg-turbo/src/jdpostct.c +jpeg12 3rdparty/libjpeg-turbo/src/jdsample.c +jpeg12 3rdparty/libjpeg-turbo/src/jutils.c +jpeg12 3rdparty/libjpeg-turbo/src/jccoefct.c +jpeg12 3rdparty/libjpeg-turbo/src/jcdctmgr.c +jpeg12 3rdparty/libjpeg-turbo/src/jdcoefct.c +jpeg12 3rdparty/libjpeg-turbo/src/jddctmgr.c +jpeg12 3rdparty/libjpeg-turbo/src/jdmerge.c +jpeg12 3rdparty/libjpeg-turbo/src/jfdctfst.c +jpeg12 3rdparty/libjpeg-turbo/src/jfdctint.c +jpeg12 3rdparty/libjpeg-turbo/src/jidctflt.c +jpeg12 3rdparty/libjpeg-turbo/src/jidctfst.c +jpeg12 3rdparty/libjpeg-turbo/src/jidctint.c +jpeg12 3rdparty/libjpeg-turbo/src/jidctred.c +jpeg12 3rdparty/libjpeg-turbo/src/jquant1.c +jpeg12 3rdparty/libjpeg-turbo/src/jquant2.c +jpeg16 3rdparty/libjpeg-turbo/src/jcapistd.c +jpeg16 3rdparty/libjpeg-turbo/src/jccolor.c +jpeg16 3rdparty/libjpeg-turbo/src/jcdiffct.c +jpeg16 3rdparty/libjpeg-turbo/src/jclossls.c +jpeg16 3rdparty/libjpeg-turbo/src/jcmainct.c +jpeg16 3rdparty/libjpeg-turbo/src/jcprepct.c +jpeg16 3rdparty/libjpeg-turbo/src/jcsample.c +jpeg16 3rdparty/libjpeg-turbo/src/jdapistd.c +jpeg16 3rdparty/libjpeg-turbo/src/jdcolor.c +jpeg16 3rdparty/libjpeg-turbo/src/jddiffct.c +jpeg16 3rdparty/libjpeg-turbo/src/jdlossls.c +jpeg16 3rdparty/libjpeg-turbo/src/jdmainct.c +jpeg16 3rdparty/libjpeg-turbo/src/jdpostct.c +jpeg16 3rdparty/libjpeg-turbo/src/jdsample.c +jpeg16 3rdparty/libjpeg-turbo/src/jutils.c +jpeg 3rdparty/libjpeg-turbo/simd/x86_64/jsimd.c +jpeg 3rdparty/libjpeg-turbo/src/jcapistd.c +jpeg 3rdparty/libjpeg-turbo/src/jccolor.c +jpeg 3rdparty/libjpeg-turbo/src/jcdiffct.c +jpeg 3rdparty/libjpeg-turbo/src/jclossls.c +jpeg 3rdparty/libjpeg-turbo/src/jcmainct.c +jpeg 3rdparty/libjpeg-turbo/src/jcprepct.c +jpeg 3rdparty/libjpeg-turbo/src/jcsample.c +jpeg 3rdparty/libjpeg-turbo/src/jdapistd.c +jpeg 3rdparty/libjpeg-turbo/src/jdcolor.c +jpeg 3rdparty/libjpeg-turbo/src/jddiffct.c +jpeg 3rdparty/libjpeg-turbo/src/jdlossls.c +jpeg 3rdparty/libjpeg-turbo/src/jdmainct.c +jpeg 3rdparty/libjpeg-turbo/src/jdpostct.c +jpeg 3rdparty/libjpeg-turbo/src/jdsample.c +jpeg 3rdparty/libjpeg-turbo/src/jutils.c +jpeg 3rdparty/libjpeg-turbo/src/jccoefct.c +jpeg 3rdparty/libjpeg-turbo/src/jcdctmgr.c +jpeg 3rdparty/libjpeg-turbo/src/jdcoefct.c +jpeg 3rdparty/libjpeg-turbo/src/jddctmgr.c +jpeg 3rdparty/libjpeg-turbo/src/jdmerge.c +jpeg 3rdparty/libjpeg-turbo/src/jfdctfst.c +jpeg 3rdparty/libjpeg-turbo/src/jfdctint.c +jpeg 3rdparty/libjpeg-turbo/src/jidctflt.c +jpeg 3rdparty/libjpeg-turbo/src/jidctfst.c +jpeg 3rdparty/libjpeg-turbo/src/jidctint.c +jpeg 3rdparty/libjpeg-turbo/src/jidctred.c +jpeg 3rdparty/libjpeg-turbo/src/jquant1.c +jpeg 3rdparty/libjpeg-turbo/src/jquant2.c +jpeg 3rdparty/libjpeg-turbo/src/jcapimin.c +jpeg 3rdparty/libjpeg-turbo/src/jchuff.c +jpeg 3rdparty/libjpeg-turbo/src/jcicc.c +jpeg 3rdparty/libjpeg-turbo/src/jcinit.c +jpeg 3rdparty/libjpeg-turbo/src/jclhuff.c +jpeg 3rdparty/libjpeg-turbo/src/jcmarker.c +jpeg 3rdparty/libjpeg-turbo/src/jcmaster.c +jpeg 3rdparty/libjpeg-turbo/src/jcomapi.c +jpeg 3rdparty/libjpeg-turbo/src/jcparam.c +jpeg 3rdparty/libjpeg-turbo/src/jcphuff.c +jpeg 3rdparty/libjpeg-turbo/src/jctrans.c +jpeg 3rdparty/libjpeg-turbo/src/jdapimin.c +jpeg 3rdparty/libjpeg-turbo/src/jdatadst.c +jpeg 3rdparty/libjpeg-turbo/src/jdatasrc.c +jpeg 3rdparty/libjpeg-turbo/src/jdhuff.c +jpeg 3rdparty/libjpeg-turbo/src/jdicc.c +jpeg 3rdparty/libjpeg-turbo/src/jdinput.c +jpeg 3rdparty/libjpeg-turbo/src/jdlhuff.c +jpeg 3rdparty/libjpeg-turbo/src/jdmarker.c +jpeg 3rdparty/libjpeg-turbo/src/jdmaster.c +jpeg 3rdparty/libjpeg-turbo/src/jdphuff.c +jpeg 3rdparty/libjpeg-turbo/src/jdtrans.c +jpeg 3rdparty/libjpeg-turbo/src/jerror.c +jpeg 3rdparty/libjpeg-turbo/src/jfdctflt.c +jpeg 3rdparty/libjpeg-turbo/src/jmemmgr.c +jpeg 3rdparty/libjpeg-turbo/src/jmemnobs.c +jpeg 3rdparty/libjpeg-turbo/src/jpeg_nbits.c +jpeg 3rdparty/libjpeg-turbo/src/jaricom.c +jpeg 3rdparty/libjpeg-turbo/src/jcarith.c +jpeg 3rdparty/libjpeg-turbo/src/jdarith.c +zlib 3rdparty/zlib/adler32.c +zlib 3rdparty/zlib/compress.c +zlib 3rdparty/zlib/crc32.c +zlib 3rdparty/zlib/deflate.c +zlib 3rdparty/zlib/gzclose.c +zlib 3rdparty/zlib/gzlib.c +zlib 3rdparty/zlib/gzread.c +zlib 3rdparty/zlib/gzwrite.c +zlib 3rdparty/zlib/inflate.c +zlib 3rdparty/zlib/infback.c +zlib 3rdparty/zlib/inftrees.c +zlib 3rdparty/zlib/inffast.c +zlib 3rdparty/zlib/trees.c +zlib 3rdparty/zlib/uncompr.c +zlib 3rdparty/zlib/zutil.c +core modules/core/src/algorithm.cpp +core modules/core/src/alloc.cpp +core modules/core/src/arithm.cpp +core modules/core/src/arithm.dispatch.cpp +core modules/core/src/async.cpp +core modules/core/src/batch_distance.cpp +core modules/core/src/bindings_utils.cpp +core modules/core/src/buffer_area.cpp +core modules/core/src/channels.cpp +core modules/core/src/check.cpp +core modules/core/src/command_line_parser.cpp +core modules/core/src/conjugate_gradient.cpp +core modules/core/src/convert.dispatch.cpp +core modules/core/src/convert_scale.dispatch.cpp +core modules/core/src/copy.cpp +core modules/core/src/count_non_zero.dispatch.cpp +core modules/core/src/cuda_gpu_mat.cpp +core modules/core/src/cuda_gpu_mat_nd.cpp +core modules/core/src/cuda_host_mem.cpp +core modules/core/src/cuda_info.cpp +core modules/core/src/cuda_stream.cpp +core modules/core/src/directx.cpp +core modules/core/src/downhill_simplex.cpp +core modules/core/src/dxt.cpp +core modules/core/src/gl_core_3_1.cpp +core modules/core/src/glob.cpp +core modules/core/src/hal_internal.cpp +core modules/core/src/has_non_zero.dispatch.cpp +core modules/core/src/kmeans.cpp +core modules/core/src/lapack.cpp +core modules/core/src/lda.cpp +core modules/core/src/logger.cpp +core modules/core/src/lpsolver.cpp +core modules/core/src/lut.cpp +core modules/core/src/mathfuncs.cpp +core modules/core/src/mathfuncs_core.dispatch.cpp +core modules/core/src/matmul.dispatch.cpp +core modules/core/src/matrix.cpp +core modules/core/src/matrix_decomp.cpp +core modules/core/src/matrix_expressions.cpp +core modules/core/src/matrix_iterator.cpp +core modules/core/src/matrix_operations.cpp +core modules/core/src/matrix_sparse.cpp +core modules/core/src/matrix_transform.cpp +core modules/core/src/matrix_wrap.cpp +core modules/core/src/mean.dispatch.cpp +core modules/core/src/merge.dispatch.cpp +core modules/core/src/minmax.dispatch.cpp +core modules/core/src/nan_mask.dispatch.cpp +core modules/core/src/norm.dispatch.cpp +core modules/core/src/ocl.cpp +core modules/core/src/opencl/runtime/opencl_clblas.cpp +core modules/core/src/opencl/runtime/opencl_clfft.cpp +core modules/core/src/opencl/runtime/opencl_core.cpp +core modules/core/src/opengl.cpp +core modules/core/src/out.cpp +core modules/core/src/parallel.cpp +core modules/core/src/parallel/parallel.cpp +core modules/core/src/parallel/parallel_openmp.cpp +core modules/core/src/parallel/parallel_tbb.cpp +core modules/core/src/parallel_impl.cpp +core modules/core/src/pca.cpp +core modules/core/src/persistence.cpp +core modules/core/src/persistence_base64_encoding.cpp +core modules/core/src/persistence_json.cpp +core modules/core/src/persistence_types.cpp +core modules/core/src/persistence_xml.cpp +core modules/core/src/persistence_yml.cpp +core modules/core/src/rand.cpp +core modules/core/src/reduce.dispatch.cpp +core modules/core/src/softfloat.cpp +core modules/core/src/split.dispatch.cpp +core modules/core/src/stat.dispatch.cpp +core modules/core/src/stl.cpp +core modules/core/src/sum.dispatch.cpp +core modules/core/src/system.cpp +core modules/core/src/tables.cpp +core modules/core/src/trace.cpp +core modules/core/src/types.cpp +core modules/core/src/umatrix.cpp +core modules/core/src/utils/datafile.cpp +core modules/core/src/utils/filesystem.cpp +core modules/core/src/utils/logtagconfigparser.cpp +core modules/core/src/utils/logtagmanager.cpp +core modules/core/src/utils/samples.cpp +core modules/core/src/va_intel.cpp +core modules/core/arithm.sse4_1.cpp +core modules/core/matmul.sse4_1.cpp +core modules/core/minmax.sse4_1.cpp +core modules/core/norm.sse4_1.cpp +core modules/core/stat.sse4_2.cpp +core modules/core/mathfuncs_core.avx.cpp +core modules/core/norm.avx.cpp +core modules/core/transpose.avx.cpp +core modules/core/mathfuncs_core.avx2.cpp +core modules/core/stat.avx2.cpp +core modules/core/arithm.avx2.cpp +core modules/core/convert.avx2.cpp +core modules/core/convert_scale.avx2.cpp +core modules/core/count_non_zero.avx2.cpp +core modules/core/has_non_zero.avx2.cpp +core modules/core/matmul.avx2.cpp +core modules/core/mean.avx2.cpp +core modules/core/merge.avx2.cpp +core modules/core/minmax.avx2.cpp +core modules/core/nan_mask.avx2.cpp +core modules/core/split.avx2.cpp +core modules/core/sum.avx2.cpp +core modules/core/reduce.avx2.cpp +core modules/core/norm.avx2.cpp +core modules/core/transpose.avx2.cpp +core modules/core/matmul.avx512_skx.cpp +flann modules/flann/src/flann.cpp +flann modules/flann/src/miniflann.cpp +geometry modules/geometry/src/ap3p.cpp +geometry modules/geometry/src/approx.cpp +geometry modules/geometry/src/calibration_base.cpp +geometry modules/geometry/src/convhull.cpp +geometry modules/geometry/src/epnp.cpp +geometry modules/geometry/src/fisheye.cpp +geometry modules/geometry/src/five-point.cpp +geometry modules/geometry/src/fundam.cpp +geometry modules/geometry/src/geometry.cpp +geometry modules/geometry/src/homography_decomp.cpp +geometry modules/geometry/src/intersection.cpp +geometry modules/geometry/src/ippe.cpp +geometry modules/geometry/src/levmarq.cpp +geometry modules/geometry/src/linefit.cpp +geometry modules/geometry/src/main.cpp +geometry modules/geometry/src/matchcontours.cpp +geometry modules/geometry/src/min_enclosing_convex_polygon.cpp +geometry modules/geometry/src/min_enclosing_triangle.cpp +geometry modules/geometry/src/moments.cpp +geometry modules/geometry/src/mst.cpp +geometry modules/geometry/src/p3p.cpp +geometry modules/geometry/src/pinhole.cpp +geometry modules/geometry/src/polynom_solver.cpp +geometry modules/geometry/src/ptcloud/normal_estimation.cpp +geometry modules/geometry/src/ptcloud/ptcloud_utils.cpp +geometry modules/geometry/src/ptcloud/region_growing_3d.cpp +geometry modules/geometry/src/ptcloud/sac_segmentation.cpp +geometry modules/geometry/src/ptcloud/sampling.cpp +geometry modules/geometry/src/ptsetreg.cpp +geometry modules/geometry/src/rho.cpp +geometry modules/geometry/src/rotcalipers.cpp +geometry modules/geometry/src/shapedescr.cpp +geometry modules/geometry/src/solvepnp.cpp +geometry modules/geometry/src/sqpnp.cpp +geometry modules/geometry/src/subdivision2d.cpp +geometry modules/geometry/src/triangulate.cpp +geometry modules/geometry/src/usac/bundle.cpp +geometry modules/geometry/src/usac/degeneracy.cpp +geometry modules/geometry/src/usac/dls_solver.cpp +geometry modules/geometry/src/usac/essential_solver.cpp +geometry modules/geometry/src/usac/estimator.cpp +geometry modules/geometry/src/usac/fundamental_solver.cpp +geometry modules/geometry/src/usac/gamma_values.cpp +geometry modules/geometry/src/usac/homography_solver.cpp +geometry modules/geometry/src/usac/local_optimization.cpp +geometry modules/geometry/src/usac/plane_solver.cpp +geometry modules/geometry/src/usac/pnp_solver.cpp +geometry modules/geometry/src/usac/quality.cpp +geometry modules/geometry/src/usac/ransac_solvers.cpp +geometry modules/geometry/src/usac/sampler.cpp +geometry modules/geometry/src/usac/sphere_solver.cpp +geometry modules/geometry/src/usac/termination.cpp +geometry modules/geometry/src/usac/utils.cpp +imgproc modules/imgproc/src/accum.cpp +imgproc modules/imgproc/src/accum.dispatch.cpp +imgproc modules/imgproc/src/bilateral_filter.dispatch.cpp +imgproc modules/imgproc/src/blend.cpp +imgproc modules/imgproc/src/box_filter.dispatch.cpp +imgproc modules/imgproc/src/canny.cpp +imgproc modules/imgproc/src/clahe.cpp +imgproc modules/imgproc/src/color.cpp +imgproc modules/imgproc/src/color_hsv.dispatch.cpp +imgproc modules/imgproc/src/color_lab.cpp +imgproc modules/imgproc/src/color_rgb.dispatch.cpp +imgproc modules/imgproc/src/color_yuv.dispatch.cpp +imgproc modules/imgproc/src/colormap.cpp +imgproc modules/imgproc/src/connectedcomponents.cpp +imgproc modules/imgproc/src/contours_approx.cpp +imgproc modules/imgproc/src/contours_common.cpp +imgproc modules/imgproc/src/contours_link.cpp +imgproc modules/imgproc/src/contours_new.cpp +imgproc modules/imgproc/src/contours_truco.cpp +imgproc modules/imgproc/src/corner.cpp +imgproc modules/imgproc/src/cornersubpix.cpp +imgproc modules/imgproc/src/demosaicing.cpp +imgproc modules/imgproc/src/deriv.cpp +imgproc modules/imgproc/src/distransform.cpp +imgproc modules/imgproc/src/drawing.cpp +imgproc modules/imgproc/src/drawing_text.cpp +imgproc modules/imgproc/src/emd_new.cpp +imgproc modules/imgproc/src/filter.dispatch.cpp +imgproc modules/imgproc/src/fisheye.cpp +imgproc modules/imgproc/src/floodfill.cpp +imgproc modules/imgproc/src/gabor.cpp +imgproc modules/imgproc/src/generalized_hough.cpp +imgproc modules/imgproc/src/grabcut.cpp +imgproc modules/imgproc/src/histogram.cpp +imgproc modules/imgproc/src/hough.cpp +imgproc modules/imgproc/src/imgwarp.cpp +imgproc modules/imgproc/src/lsd.cpp +imgproc modules/imgproc/src/main.cpp +imgproc modules/imgproc/src/median_blur.dispatch.cpp +imgproc modules/imgproc/src/morph.dispatch.cpp +imgproc modules/imgproc/src/phasecorr.cpp +imgproc modules/imgproc/src/phasecorr_iterative.cpp +imgproc modules/imgproc/src/pyramids.cpp +imgproc modules/imgproc/src/resize.cpp +imgproc modules/imgproc/src/samplers.cpp +imgproc modules/imgproc/src/segmentation.cpp +imgproc modules/imgproc/src/smooth.dispatch.cpp +imgproc modules/imgproc/src/spatialgradient.cpp +imgproc modules/imgproc/src/stackblur.cpp +imgproc modules/imgproc/src/stb_truetype.cpp +imgproc modules/imgproc/src/sumpixels.dispatch.cpp +imgproc modules/imgproc/src/tables.cpp +imgproc modules/imgproc/src/templmatch.cpp +imgproc modules/imgproc/src/thresh.cpp +imgproc modules/imgproc/src/undistort.dispatch.cpp +imgproc modules/imgproc/src/utils.cpp +imgproc modules/imgproc/src/imgwarp.sse4_1.cpp +imgproc modules/imgproc/src/resize.sse4_1.cpp +imgproc modules/imgproc/accum.sse4_1.cpp +imgproc modules/imgproc/box_filter.sse4_1.cpp +imgproc modules/imgproc/filter.sse4_1.cpp +imgproc modules/imgproc/color_hsv.sse4_1.cpp +imgproc modules/imgproc/color_rgb.sse4_1.cpp +imgproc modules/imgproc/color_yuv.sse4_1.cpp +imgproc modules/imgproc/median_blur.sse4_1.cpp +imgproc modules/imgproc/morph.sse4_1.cpp +imgproc modules/imgproc/smooth.sse4_1.cpp +imgproc modules/imgproc/warp_kernels.sse4_1.cpp +imgproc modules/imgproc/src/corner.avx.cpp +imgproc modules/imgproc/accum.avx.cpp +imgproc modules/imgproc/src/imgwarp.avx2.cpp +imgproc modules/imgproc/src/resize.avx2.cpp +imgproc modules/imgproc/accum.avx2.cpp +imgproc modules/imgproc/bilateral_filter.avx2.cpp +imgproc modules/imgproc/box_filter.avx2.cpp +imgproc modules/imgproc/filter.avx2.cpp +imgproc modules/imgproc/color_hsv.avx2.cpp +imgproc modules/imgproc/color_rgb.avx2.cpp +imgproc modules/imgproc/color_yuv.avx2.cpp +imgproc modules/imgproc/median_blur.avx2.cpp +imgproc modules/imgproc/morph.avx2.cpp +imgproc modules/imgproc/smooth.avx2.cpp +imgproc modules/imgproc/sumpixels.avx2.cpp +imgproc modules/imgproc/warp_kernels.avx2.cpp +imgproc modules/imgproc/undistort.avx2.cpp +imgproc modules/imgproc/bilateral_filter.avx512_skx.cpp +imgproc modules/imgproc/box_filter.avx512_skx.cpp +imgproc modules/imgproc/median_blur.avx512_skx.cpp +imgproc modules/imgproc/sumpixels.avx512_skx.cpp +imgcodecs modules/imgcodecs/src/loadsave.cpp +imgcodecs modules/imgcodecs/src/utils.cpp +imgcodecs modules/imgcodecs/src/grfmt_avif.cpp +imgcodecs modules/imgcodecs/src/grfmt_base.cpp +imgcodecs modules/imgcodecs/src/grfmt_bmp.cpp +imgcodecs modules/imgcodecs/src/grfmt_exr.cpp +imgcodecs modules/imgcodecs/src/grfmt_gdal.cpp +imgcodecs modules/imgcodecs/src/grfmt_gdcm.cpp +imgcodecs modules/imgcodecs/src/grfmt_gif.cpp +imgcodecs modules/imgcodecs/src/grfmt_hdr.cpp +imgcodecs modules/imgcodecs/src/grfmt_jpeg.cpp +imgcodecs modules/imgcodecs/src/grfmt_jpeg2000.cpp +imgcodecs modules/imgcodecs/src/grfmt_jpeg2000_openjpeg.cpp +imgcodecs modules/imgcodecs/src/grfmt_jpegxl.cpp +imgcodecs modules/imgcodecs/src/grfmt_pam.cpp +imgcodecs modules/imgcodecs/src/grfmt_pfm.cpp +imgcodecs modules/imgcodecs/src/grfmt_png.cpp +imgcodecs modules/imgcodecs/src/grfmt_pxm.cpp +imgcodecs modules/imgcodecs/src/grfmt_spng.cpp +imgcodecs modules/imgcodecs/src/grfmt_sunras.cpp +imgcodecs modules/imgcodecs/src/grfmt_tiff.cpp +imgcodecs modules/imgcodecs/src/grfmt_webp.cpp +imgcodecs modules/imgcodecs/src/bitstrm.cpp +imgcodecs modules/imgcodecs/src/rgbe.cpp +imgcodecs modules/imgcodecs/src/exif.cpp +png 3rdparty/libpng/png.c +png 3rdparty/libpng/pngerror.c +png 3rdparty/libpng/pngget.c +png 3rdparty/libpng/pngmem.c +png 3rdparty/libpng/pngpread.c +png 3rdparty/libpng/pngread.c +png 3rdparty/libpng/pngrio.c +png 3rdparty/libpng/pngrtran.c +png 3rdparty/libpng/pngrutil.c +png 3rdparty/libpng/pngset.c +png 3rdparty/libpng/pngtrans.c +png 3rdparty/libpng/pngwio.c +png 3rdparty/libpng/pngwrite.c +png 3rdparty/libpng/pngwtran.c +png 3rdparty/libpng/pngwutil.c +png 3rdparty/libpng/intel/intel_init.c +png 3rdparty/libpng/intel/filter_sse2_intrinsics.c +videoio modules/videoio/src/videoio_registry.cpp +videoio modules/videoio/src/cap.cpp +videoio modules/videoio/src/cap_images.cpp +videoio modules/videoio/src/cap_mjpeg_encoder.cpp +videoio modules/videoio/src/cap_mjpeg_decoder.cpp +videoio modules/videoio/src/backend_plugin.cpp +videoio modules/videoio/src/backend_static.cpp +videoio modules/videoio/src/container_avi.cpp +videoio modules/videoio/src/cap_v4l.cpp +highgui modules/highgui/src/backend.cpp +highgui modules/highgui/src/window.cpp +highgui modules/highgui/src/roiSelector.cpp +core clsrc/opencl_kernels_core.cpp +imgproc clsrc/opencl_kernels_imgproc.cpp +geometry clsrc/opencl_kernels_geometry.cpp +]==], + ["mcpp_generated/3rdparty/libjpeg-turbo/jconfig.h"] = [==[ +/* Version ID for the JPEG library. + * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60". + */ +#define JPEG_LIB_VERSION 70 + +/* libjpeg-turbo version */ +#define LIBJPEG_TURBO_VERSION 3.1.2 + +/* libjpeg-turbo version in integer form */ +#define LIBJPEG_TURBO_VERSION_NUMBER 3001002 + +/* Support arithmetic encoding when using 8-bit samples */ +#define C_ARITH_CODING_SUPPORTED 1 + +/* Support arithmetic decoding when using 8-bit samples */ +#define D_ARITH_CODING_SUPPORTED 1 + +/* Support in-memory source/destination managers */ +#define MEM_SRCDST_SUPPORTED 1 + +/* Use accelerated SIMD routines when using 8-bit samples */ +#define WITH_SIMD 1 + +/* This version of libjpeg-turbo supports run-time selection of data precision, + * so BITS_IN_JSAMPLE is no longer used to specify the data precision at build + * time. However, some downstream software expects the macro to be defined. + * Since 12-bit data precision is an opt-in feature that requires explicitly + * calling 12-bit-specific libjpeg API functions and using 12-bit-specific data + * types, the unmodified portion of the libjpeg API still behaves as if it were + * built for 8-bit precision, and JSAMPLE is still literally an 8-bit data + * type. Thus, it is correct to define BITS_IN_JSAMPLE to 8 here. + */ +#ifndef BITS_IN_JSAMPLE +#define BITS_IN_JSAMPLE 8 +#endif + +#ifdef _WIN32 + +#undef RIGHT_SHIFT_IS_UNSIGNED + +/* Define "boolean" as unsigned char, not int, per Windows custom */ +#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ +typedef unsigned char boolean; +#endif +#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ + +/* Define "INT32" as int, not long, per Windows custom */ +#if !(defined(_BASETSD_H_) || defined(_BASETSD_H)) /* don't conflict if basetsd.h already read */ +typedef short INT16; +typedef signed int INT32; +#endif +#define XMD_H /* prevent jmorecfg.h from redefining it */ + +#else + +/* Define if your (broken) compiler shifts signed values as if they were + unsigned. */ +/* #undef RIGHT_SHIFT_IS_UNSIGNED */ + +#endif +]==], + ["mcpp_generated/3rdparty/libjpeg-turbo/jconfigint.h"] = [==[ +/* libjpeg-turbo build number */ +#define BUILD "opencv-5.0.0-libjpeg-turbo" + +/* How to hide global symbols. */ +#define HIDDEN + +/* Compiler's inline keyword */ +#undef inline + +/* How to obtain function inlining. */ +#define INLINE + +/* How to obtain thread-local storage */ +#define THREAD_LOCAL + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "OpenCV" + +/* Version number of package */ +#define VERSION "3.1.2" + +/* The size of `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 8 + +/* Define if your compiler has __builtin_ctzl() and sizeof(unsigned long) == sizeof(size_t). */ +/* #undef HAVE_BUILTIN_CTZL */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_INTRIN_H */ + +#if defined(_MSC_VER) && defined(HAVE_INTRIN_H) +#if (SIZEOF_SIZE_T == 8) +#define HAVE_BITSCANFORWARD64 +#elif (SIZEOF_SIZE_T == 4) +#define HAVE_BITSCANFORWARD +#endif +#endif + +#if defined(__has_attribute) +#if __has_attribute(fallthrough) +#define FALLTHROUGH __attribute__((fallthrough)); +#else +#define FALLTHROUGH +#endif +#else +#define FALLTHROUGH +#endif + +/* + * Define BITS_IN_JSAMPLE as either + * 8 for 8-bit sample values (the usual setting) + * 12 for 12-bit sample values + * Only 8 and 12 are legal data precisions for lossy JPEG according to the + * JPEG standard, and the IJG code does not support anything else! + */ + +#ifndef BITS_IN_JSAMPLE +#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */ +#endif + +#undef C_ARITH_CODING_SUPPORTED +#undef D_ARITH_CODING_SUPPORTED +#undef WITH_SIMD + +#if BITS_IN_JSAMPLE == 8 + +/* Support arithmetic encoding */ +#define C_ARITH_CODING_SUPPORTED 1 + +/* Support arithmetic decoding */ +#define D_ARITH_CODING_SUPPORTED 1 + +/* Use accelerated SIMD routines. */ +#define WITH_SIMD 1 + +#endif +]==], + ["mcpp_generated/3rdparty/libjpeg-turbo/jversion.h"] = [==[ +/* + * jversion.h + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1991-2020, Thomas G. Lane, Guido Vollbeding. + * libjpeg-turbo Modifications: + * Copyright (C) 2010, 2012-2024, D. R. Commander. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + * + * This file contains software version identification. + */ + + +#if JPEG_LIB_VERSION >= 80 + +#define JVERSION "8d 15-Jan-2012" + +#elif JPEG_LIB_VERSION >= 70 + +#define JVERSION "7 27-Jun-2009" + +#else + +#define JVERSION "6b 27-Mar-1998" + +#endif + +/* + * NOTE: It is our convention to place the authors in the following order: + * - libjpeg-turbo authors (2009-) in descending order of the date of their + * most recent contribution to the project, then in ascending order of the + * date of their first contribution to the project, then in alphabetical + * order + * - Upstream authors in descending order of the date of the first inclusion of + * their code + */ + +#define JCOPYRIGHT1 \ + "Copyright (C) 2009-2024 D. R. Commander\n" \ + "Copyright (C) 2015, 2020 Google, Inc.\n" \ + "Copyright (C) 2019-2020 Arm Limited\n" \ + "Copyright (C) 2015-2016, 2018 Matthieu Darbois\n" \ + "Copyright (C) 2011-2016 Siarhei Siamashka\n" \ + "Copyright (C) 2015 Intel Corporation\n" +#define JCOPYRIGHT2 \ + "Copyright (C) 2013-2014 Linaro Limited\n" \ + "Copyright (C) 2013-2014 MIPS Technologies, Inc.\n" \ + "Copyright (C) 2009, 2012 Pierre Ossman for Cendio AB\n" \ + "Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)\n" \ + "Copyright (C) 1999-2006 MIYASAKA Masaru\n" \ + "Copyright (C) 1999 Ken Murchison\n" \ + "Copyright (C) 1991-2020 Thomas G. Lane, Guido Vollbeding\n" + +#define JCOPYRIGHT_SHORT \ + "Copyright (C) 1991-2025 The libjpeg-turbo Project and many others" +]==], + ["mcpp_generated/3rdparty/zlib/zconf.h"] = [==[ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2026 Jean-loup Gailly, Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#ifndef ZCONF_H +#define ZCONF_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + * Even better than compiling with -DZ_PREFIX would be to use configure to set + * this permanently in zconf.h using "./configure --zprefix". + */ +#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ +# define Z_PREFIX_SET + +/* all linked symbols and init macros */ +# define _dist_code z__dist_code +# define _length_code z__length_code +# define _tr_align z__tr_align +# define _tr_flush_bits z__tr_flush_bits +# define _tr_flush_block z__tr_flush_block +# define _tr_init z__tr_init +# define _tr_stored_block z__tr_stored_block +# define _tr_tally z__tr_tally +# define adler32 z_adler32 +# define adler32_combine z_adler32_combine +# define adler32_combine64 z_adler32_combine64 +# define adler32_z z_adler32_z +# ifndef Z_SOLO +# define compress z_compress +# define compress2 z_compress2 +# define compress_z z_compress_z +# define compress2_z z_compress2_z +# define compressBound z_compressBound +# define compressBound_z z_compressBound_z +# endif +# define crc32 z_crc32 +# define crc32_combine z_crc32_combine +# define crc32_combine64 z_crc32_combine64 +# define crc32_combine_gen z_crc32_combine_gen +# define crc32_combine_gen64 z_crc32_combine_gen64 +# define crc32_combine_op z_crc32_combine_op +# define crc32_z z_crc32_z +# define deflate z_deflate +# define deflateBound z_deflateBound +# define deflateBound_z z_deflateBound_z +# define deflateCopy z_deflateCopy +# define deflateEnd z_deflateEnd +# define deflateGetDictionary z_deflateGetDictionary +# define deflateInit z_deflateInit +# define deflateInit2 z_deflateInit2 +# define deflateInit2_ z_deflateInit2_ +# define deflateInit_ z_deflateInit_ +# define deflateParams z_deflateParams +# define deflatePending z_deflatePending +# define deflatePrime z_deflatePrime +# define deflateReset z_deflateReset +# define deflateResetKeep z_deflateResetKeep +# define deflateSetDictionary z_deflateSetDictionary +# define deflateSetHeader z_deflateSetHeader +# define deflateTune z_deflateTune +# define deflateUsed z_deflateUsed +# define deflate_copyright z_deflate_copyright +# define get_crc_table z_get_crc_table +# ifndef Z_SOLO +# define gz_error z_gz_error +# define gz_intmax z_gz_intmax +# define gz_strwinerror z_gz_strwinerror +# define gzbuffer z_gzbuffer +# define gzclearerr z_gzclearerr +# define gzclose z_gzclose +# define gzclose_r z_gzclose_r +# define gzclose_w z_gzclose_w +# define gzdirect z_gzdirect +# define gzdopen z_gzdopen +# define gzeof z_gzeof +# define gzerror z_gzerror +# define gzflush z_gzflush +# define gzfread z_gzfread +# define gzfwrite z_gzfwrite +# define gzgetc z_gzgetc +# define gzgetc_ z_gzgetc_ +# define gzgets z_gzgets +# define gzoffset z_gzoffset +# define gzoffset64 z_gzoffset64 +# define gzopen z_gzopen +# define gzopen64 z_gzopen64 +# ifdef _WIN32 +# define gzopen_w z_gzopen_w +# endif +# define gzprintf z_gzprintf +# define gzputc z_gzputc +# define gzputs z_gzputs +# define gzread z_gzread +# define gzrewind z_gzrewind +# define gzseek z_gzseek +# define gzseek64 z_gzseek64 +# define gzsetparams z_gzsetparams +# define gztell z_gztell +# define gztell64 z_gztell64 +# define gzungetc z_gzungetc +# define gzvprintf z_gzvprintf +# define gzwrite z_gzwrite +# endif +# define inflate z_inflate +# define inflateBack z_inflateBack +# define inflateBackEnd z_inflateBackEnd +# define inflateBackInit z_inflateBackInit +# define inflateBackInit_ z_inflateBackInit_ +# define inflateCodesUsed z_inflateCodesUsed +# define inflateCopy z_inflateCopy +# define inflateEnd z_inflateEnd +# define inflateGetDictionary z_inflateGetDictionary +# define inflateGetHeader z_inflateGetHeader +# define inflateInit z_inflateInit +# define inflateInit2 z_inflateInit2 +# define inflateInit2_ z_inflateInit2_ +# define inflateInit_ z_inflateInit_ +# define inflateMark z_inflateMark +# define inflatePrime z_inflatePrime +# define inflateReset z_inflateReset +# define inflateReset2 z_inflateReset2 +# define inflateResetKeep z_inflateResetKeep +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateUndermine z_inflateUndermine +# define inflateValidate z_inflateValidate +# define inflate_copyright z_inflate_copyright +# define inflate_fast z_inflate_fast +# define inflate_table z_inflate_table +# define inflate_fixed z_inflate_fixed +# ifndef Z_SOLO +# define uncompress z_uncompress +# define uncompress2 z_uncompress2 +# define uncompress_z z_uncompress_z +# define uncompress2_z z_uncompress2_z +# endif +# define zError z_zError +# ifndef Z_SOLO +# define zcalloc z_zcalloc +# define zcfree z_zcfree +# endif +# define zlibCompileFlags z_zlibCompileFlags +# define zlibVersion z_zlibVersion + +/* all zlib typedefs in zlib.h and zconf.h */ +# define Byte z_Byte +# define Bytef z_Bytef +# define alloc_func z_alloc_func +# define charf z_charf +# define free_func z_free_func +# ifndef Z_SOLO +# define gzFile z_gzFile +# endif +# define gz_header z_gz_header +# define gz_headerp z_gz_headerp +# define in_func z_in_func +# define intf z_intf +# define out_func z_out_func +# define uInt z_uInt +# define uIntf z_uIntf +# define uLong z_uLong +# define uLongf z_uLongf +# define voidp z_voidp +# define voidpc z_voidpc +# define voidpf z_voidpf + +/* all zlib structs in zlib.h and zconf.h */ +# define gz_header_s z_gz_header_s +# define internal_state z_internal_state + +#endif + +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +# define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) +# ifndef WIN32 +# define WIN32 +# endif +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +# ifndef SYS16BIT +# define SYS16BIT +# endif +# endif +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#ifdef SYS16BIT +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +# define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +# define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +# define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +# define STDC +#endif + +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const /* note: need a more gentle solution here */ +# endif +#endif + +#ifndef z_const +# ifdef ZLIB_CONST +# define z_const const +# else +# define z_const +# endif +#endif + +#ifdef Z_SOLO +# ifdef _WIN64 + typedef unsigned long long z_size_t; +# else + typedef unsigned long z_size_t; +# endif +#else +# define z_longlong long long +# if defined(NO_SIZE_T) + typedef unsigned NO_SIZE_T z_size_t; +# elif defined(STDC) +# include + typedef size_t z_size_t; +# else + typedef unsigned long z_size_t; +# endif +# undef z_longlong +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus about 7 kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#ifdef SYS16BIT +# if defined(M_I86SM) || defined(M_I86MM) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +# endif +# if (defined(__SMALL__) || defined(__MEDIUM__)) + /* Turbo C small or medium model */ +# define SMALL_MEDIUM +# ifdef __BORLANDC__ +# define FAR _far +# else +# define FAR far +# endif +# endif +#endif + +#if defined(WINDOWS) || defined(WIN32) + /* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +# ifdef ZLIB_DLL +# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +# ifdef ZLIB_INTERNAL +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +# endif +# endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +# ifdef ZLIB_WINAPI +# ifdef FAR +# undef FAR +# endif +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include + /* No need for _export, use ZLIB.DEF instead. */ + /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR CDECL +# endif +# endif +#endif + +#if defined (__BEOS__) +# ifdef ZLIB_DLL +# ifdef ZLIB_INTERNAL +# define ZEXPORT __declspec(dllexport) +# define ZEXPORTVA __declspec(dllexport) +# else +# define ZEXPORT __declspec(dllimport) +# define ZEXPORTVA __declspec(dllimport) +# endif +# endif +#endif + +#ifndef ZEXTERN +# define ZEXTERN extern +#endif +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void const *voidpc; + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte const *voidpc; + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) +# include +# if (UINT_MAX == 0xffffffffUL) +# define Z_U4 unsigned +# elif (ULONG_MAX == 0xffffffffUL) +# define Z_U4 unsigned long +# elif (USHRT_MAX == 0xffffffffUL) +# define Z_U4 unsigned short +# endif +#endif + +#ifdef Z_U4 + typedef Z_U4 z_crc_t; +#else + typedef unsigned long z_crc_t; +#endif + +#if HAVE_UNISTD_H-0 /* may be set to #if 1 by ./configure */ +# define Z_HAVE_UNISTD_H +#endif + +#if HAVE_STDARG_H-0 /* may be set to #if 1 by ./configure */ +# define Z_HAVE_STDARG_H +#endif + +#ifdef STDC +# ifndef Z_SOLO +# include /* for off_t */ +# endif +#endif + +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +# ifndef Z_SOLO +# include /* for va_list */ +# endif +#endif + +#ifdef _WIN32 +# ifndef Z_SOLO +# include /* for wchar_t */ +# endif +#endif + +/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and + * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even + * though the former does not conform to the LFS document), but considering + * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as + * equivalently requesting no 64-bit operations + */ +#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 +# undef _LARGEFILE64_SOURCE +#endif + +#ifndef Z_HAVE_UNISTD_H +# if defined(__WATCOMC__) || defined(__GO32__) || \ + (defined(_LARGEFILE64_SOURCE) && !defined(_WIN32)) +# define Z_HAVE_UNISTD_H +# endif +#endif +#ifndef Z_SOLO +# if defined(Z_HAVE_UNISTD_H) +# include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ +# ifdef VMS +# include /* for off_t */ +# endif +# ifndef z_off_t +# define z_off_t off_t +# endif +# endif +#endif + +#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 +# define Z_LFS64 +#endif + +#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) +# define Z_LARGE64 +#endif + +#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) +# define Z_WANT64 +#endif + +#if !defined(SEEK_SET) && !defined(Z_SOLO) +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif + +#ifndef z_off_t +# define z_off_t long long +#endif + +#if !defined(_WIN32) && defined(Z_LARGE64) +# define z_off64_t off64_t +#elif defined(__MINGW32__) +# define z_off64_t long long +#elif defined(_WIN32) && !defined(__GNUC__) +# define z_off64_t __int64 +#elif defined(__GO32__) +# define z_off64_t offset_t +#else +# define z_off64_t z_off_t +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) + #pragma map(deflateInit_,"DEIN") + #pragma map(deflateInit2_,"DEIN2") + #pragma map(deflateEnd,"DEEND") + #pragma map(deflateBound,"DEBND") + #pragma map(inflateInit_,"ININ") + #pragma map(inflateInit2_,"ININ2") + #pragma map(inflateEnd,"INEND") + #pragma map(inflateSync,"INSY") + #pragma map(inflateSetDictionary,"INSEDI") + #pragma map(compressBound,"CMBND") + #pragma map(inflate_table,"INTABL") + #pragma map(inflate_fast,"INFA") + #pragma map(inflate_copyright,"INCOPY") +#endif + +#endif /* ZCONF_H */ +]==], + ["mcpp_generated/custom_hal.hpp"] = [==[ +#ifndef _CUSTOM_HAL_INCLUDED_ +#define _CUSTOM_HAL_INCLUDED_ + + + +#endif +]==], + ["mcpp_generated/cv_cpu_config.h"] = [==[ +// OpenCV CPU baseline features + +#define CV_CPU_COMPILE_SSE 1 +#define CV_CPU_BASELINE_COMPILE_SSE 1 + +#define CV_CPU_COMPILE_SSE2 1 +#define CV_CPU_BASELINE_COMPILE_SSE2 1 + +#define CV_CPU_COMPILE_SSE3 1 +#define CV_CPU_BASELINE_COMPILE_SSE3 1 + +#define CV_CPU_BASELINE_FEATURES 0 \ + , CV_CPU_SSE \ + , CV_CPU_SSE2 \ + , CV_CPU_SSE3 \ + + +// OpenCV supported CPU dispatched features + +#define CV_CPU_DISPATCH_COMPILE_SSE4_1 1 +#define CV_CPU_DISPATCH_COMPILE_SSE4_2 1 +#define CV_CPU_DISPATCH_COMPILE_AVX 1 +#define CV_CPU_DISPATCH_COMPILE_FP16 1 +#define CV_CPU_DISPATCH_COMPILE_AVX2 1 +#define CV_CPU_DISPATCH_COMPILE_AVX512_SKX 1 + + +#define CV_CPU_DISPATCH_FEATURES 0 \ + , CV_CPU_SSE4_1 \ + , CV_CPU_SSE4_2 \ + , CV_CPU_AVX \ + , CV_CPU_FP16 \ + , CV_CPU_AVX2 \ + , CV_CPU_AVX512_SKX \ + +]==], + ["mcpp_generated/cvconfig.h"] = [==[ +#ifndef OPENCV_CVCONFIG_H_INCLUDED +#define OPENCV_CVCONFIG_H_INCLUDED + +/* OpenCV compiled as static or dynamic libs */ +/* #undef BUILD_SHARED_LIBS */ + +/* OpenCV intrinsics optimized code */ +#define CV_ENABLE_INTRINSICS + +/* OpenCV additional optimized code */ +/* #undef CV_DISABLE_OPTIMIZATION */ + +/* Compile for 'real' NVIDIA GPU architectures */ +#define CUDA_ARCH_BIN "" + +/* NVIDIA GPU features are used */ +#define CUDA_ARCH_FEATURES "" + +/* Compile for 'virtual' NVIDIA PTX architectures */ +#define CUDA_ARCH_PTX "" + +/* AMD's Basic Linear Algebra Subprograms Library*/ +/* #undef HAVE_CLAMDBLAS */ + +/* AMD's OpenCL Fast Fourier Transform Library*/ +/* #undef HAVE_CLAMDFFT */ + +/* Clp support */ +/* #undef HAVE_CLP */ + +/* NVIDIA CUDA Runtime API*/ +/* #undef HAVE_CUDA */ + +/* NVIDIA CUDA Basic Linear Algebra Subprograms (BLAS) API*/ +/* #undef HAVE_CUBLAS */ + +/* NVIDIA CUDA Deep Neural Network (cuDNN) API*/ +/* #undef HAVE_CUDNN */ + +/* NVIDIA CUDA Fast Fourier Transform (FFT) API*/ +/* #undef HAVE_CUFFT */ + +/* DirectX */ +/* #undef HAVE_DIRECTX */ +/* #undef HAVE_DIRECTX_NV12 */ +/* #undef HAVE_D3D11 */ +/* #undef HAVE_D3D10 */ +/* #undef HAVE_D3D9 */ + +/* Eigen Matrix & Linear Algebra Library */ +/* #undef HAVE_EIGEN */ + +/* Geospatial Data Abstraction Library */ +/* #undef HAVE_GDAL */ + +/* Vulkan support */ +/* #undef HAVE_VULKAN */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_INTTYPES_H */ + +/* Intel Integrated Performance Primitives */ +/* #undef HAVE_IPP */ +/* #undef HAVE_IPP_ICV */ +/* #undef HAVE_IPP_IW */ +/* #undef HAVE_IPP_IW_LL */ + +/* JPEG-2000 codec */ +/* #undef HAVE_OPENJPEG */ +/* #undef HAVE_JASPER */ + +/* AVIF codec */ +/* #undef HAVE_AVIF */ + +/* IJG JPEG codec */ +#define HAVE_JPEG + +/* JPEG XL codec */ +/* #undef HAVE_JPEGXL */ + +/* GDCM DICOM codec */ +/* #undef HAVE_GDCM */ + +/* NVIDIA Video Decoding API*/ +/* #undef HAVE_NVCUVID */ +/* #undef HAVE_NVCUVID_HEADER */ +/* #undef HAVE_DYNLINK_NVCUVID_HEADER */ + +/* NVIDIA Video Encoding API*/ +/* #undef HAVE_NVCUVENC */ + +/* OpenCL Support */ +/* #undef HAVE_OPENCL */ +/* #undef HAVE_OPENCL_STATIC */ +/* #undef HAVE_OPENCL_SVM */ + +/* NVIDIA OpenCL D3D Extensions support */ +/* #undef HAVE_OPENCL_D3D11_NV */ + +/* OpenEXR codec */ +/* #undef HAVE_OPENEXR */ + +/* OpenGL support*/ +/* #undef HAVE_OPENGL */ + +/* PNG codec */ +#define HAVE_PNG + +/* PNG codec */ +/* #undef HAVE_SPNG */ + +/* Posix threads (pthreads) */ +#define HAVE_PTHREAD + +/* parallel_for with pthreads */ +#define HAVE_PTHREADS_PF + +/* Intel Threading Building Blocks */ +/* #undef HAVE_TBB */ + +/* Ste||ar Group High Performance ParallelX */ +/* #undef HAVE_HPX */ + +/* TIFF codec */ +/* #undef HAVE_TIFF */ + +/* Define if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +/* #undef WORDS_BIGENDIAN */ + +/* VA library (libva) */ +/* #undef HAVE_VA */ + +/* Intel VA-API/OpenCL */ +/* #undef HAVE_VA_INTEL */ + +/* Lapack */ +/* #undef HAVE_LAPACK */ + +/* Library was compiled with functions instrumentation */ +/* #undef ENABLE_INSTRUMENTATION */ + +/* OpenCV trace utilities */ +#define OPENCV_TRACE + +/* The font "uni" (WQY MicroHei) is available */ +/* #undef HAVE_UNIFONT */ + +#endif // OPENCV_CVCONFIG_H_INCLUDED +]==], + ["mcpp_generated/modules/core/arithm.avx2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/arithm.simd.hpp" +]==], + ["mcpp_generated/modules/core/arithm.lasx.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/arithm.simd.hpp" +]==], + ["mcpp_generated/modules/core/arithm.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/core/src/arithm.simd.hpp" +#define CV_CPU_DISPATCH_MODE SSE4_1 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX2, SSE4_1, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/core/arithm.sse2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/arithm.simd.hpp" +]==], + ["mcpp_generated/modules/core/arithm.sse4_1.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/arithm.simd.hpp" +]==], + ["mcpp_generated/modules/core/arithm.vsx3.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/arithm.simd.hpp" +]==], + ["mcpp_generated/modules/core/convert.avx2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/convert.simd.hpp" +]==], + ["mcpp_generated/modules/core/convert.lasx.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/convert.simd.hpp" +]==], + ["mcpp_generated/modules/core/convert.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/core/src/convert.simd.hpp" +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX2, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/core/convert.sse2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/convert.simd.hpp" +]==], + ["mcpp_generated/modules/core/convert.vsx3.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/convert.simd.hpp" +]==], + ["mcpp_generated/modules/core/convert_scale.avx2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/convert_scale.simd.hpp" +]==], + ["mcpp_generated/modules/core/convert_scale.lasx.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/convert_scale.simd.hpp" +]==], + ["mcpp_generated/modules/core/convert_scale.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/core/src/convert_scale.simd.hpp" +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX2, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/core/convert_scale.sse2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/convert_scale.simd.hpp" +]==], + ["mcpp_generated/modules/core/count_non_zero.avx2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/count_non_zero.simd.hpp" +]==], + ["mcpp_generated/modules/core/count_non_zero.lasx.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/count_non_zero.simd.hpp" +]==], + ["mcpp_generated/modules/core/count_non_zero.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/core/src/count_non_zero.simd.hpp" +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX2, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/core/count_non_zero.sse2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/count_non_zero.simd.hpp" +]==], + ["mcpp_generated/modules/core/has_non_zero.avx2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/has_non_zero.simd.hpp" +]==], + ["mcpp_generated/modules/core/has_non_zero.lasx.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/has_non_zero.simd.hpp" +]==], + ["mcpp_generated/modules/core/has_non_zero.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/core/src/has_non_zero.simd.hpp" +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX2, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/core/has_non_zero.sse2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/has_non_zero.simd.hpp" +]==], + ["mcpp_generated/modules/core/mathfuncs_core.avx.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/mathfuncs_core.simd.hpp" +]==], + ["mcpp_generated/modules/core/mathfuncs_core.avx2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/mathfuncs_core.simd.hpp" +]==], + ["mcpp_generated/modules/core/mathfuncs_core.lasx.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/mathfuncs_core.simd.hpp" +]==], + ["mcpp_generated/modules/core/mathfuncs_core.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/core/src/mathfuncs_core.simd.hpp" +#define CV_CPU_DISPATCH_MODE AVX +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX2, AVX, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/core/mathfuncs_core.sse2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/mathfuncs_core.simd.hpp" +]==], + ["mcpp_generated/modules/core/matmul.avx2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/matmul.simd.hpp" +]==], + ["mcpp_generated/modules/core/matmul.avx512_skx.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/matmul.simd.hpp" +]==], + ["mcpp_generated/modules/core/matmul.lasx.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/matmul.simd.hpp" +]==], + ["mcpp_generated/modules/core/matmul.neon_dotprod.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/matmul.simd.hpp" +]==], + ["mcpp_generated/modules/core/matmul.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/core/src/matmul.simd.hpp" +#define CV_CPU_DISPATCH_MODE SSE4_1 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX512_SKX +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX512_SKX, AVX2, SSE4_1, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/core/matmul.sse2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/matmul.simd.hpp" +]==], + ["mcpp_generated/modules/core/matmul.sse4_1.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/matmul.simd.hpp" +]==], + ["mcpp_generated/modules/core/mean.avx2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/mean.simd.hpp" +]==], + ["mcpp_generated/modules/core/mean.lasx.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/mean.simd.hpp" +]==], + ["mcpp_generated/modules/core/mean.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/core/src/mean.simd.hpp" +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX2, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/core/mean.sse2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/mean.simd.hpp" +]==], + ["mcpp_generated/modules/core/merge.avx2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/merge.simd.hpp" +]==], + ["mcpp_generated/modules/core/merge.lasx.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/merge.simd.hpp" +]==], + ["mcpp_generated/modules/core/merge.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/core/src/merge.simd.hpp" +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX2, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/core/merge.sse2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/merge.simd.hpp" +]==], + ["mcpp_generated/modules/core/minmax.avx2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/minmax.simd.hpp" +]==], + ["mcpp_generated/modules/core/minmax.lasx.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/minmax.simd.hpp" +]==], + ["mcpp_generated/modules/core/minmax.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/core/src/minmax.simd.hpp" +#define CV_CPU_DISPATCH_MODE SSE4_1 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX2, SSE4_1, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/core/minmax.sse2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/minmax.simd.hpp" +]==], + ["mcpp_generated/modules/core/minmax.sse4_1.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/minmax.simd.hpp" +]==], + ["mcpp_generated/modules/core/minmax.vsx3.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/minmax.simd.hpp" +]==], + ["mcpp_generated/modules/core/nan_mask.avx2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/nan_mask.simd.hpp" +]==], + ["mcpp_generated/modules/core/nan_mask.lasx.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/nan_mask.simd.hpp" +]==], + ["mcpp_generated/modules/core/nan_mask.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/core/src/nan_mask.simd.hpp" +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX2, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/core/nan_mask.sse2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/nan_mask.simd.hpp" +]==], + ["mcpp_generated/modules/core/norm.avx.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/norm.simd.hpp" +]==], + ["mcpp_generated/modules/core/norm.avx2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/norm.simd.hpp" +]==], + ["mcpp_generated/modules/core/norm.lasx.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/norm.simd.hpp" +]==], + ["mcpp_generated/modules/core/norm.neon_dotprod.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/norm.simd.hpp" +]==], + ["mcpp_generated/modules/core/norm.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/core/src/norm.simd.hpp" +#define CV_CPU_DISPATCH_MODE SSE4_1 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX2, AVX, SSE4_1, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/core/norm.sse2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/norm.simd.hpp" +]==], + ["mcpp_generated/modules/core/norm.sse4_1.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/norm.simd.hpp" +]==], + ["mcpp_generated/modules/core/reduce.avx2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/reduce.simd.hpp" +]==], + ["mcpp_generated/modules/core/reduce.neon_dotprod.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/reduce.simd.hpp" +]==], + ["mcpp_generated/modules/core/reduce.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/core/src/reduce.simd.hpp" +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX2, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/core/reduce.sse2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/reduce.simd.hpp" +]==], + ["mcpp_generated/modules/core/reduce.ssse3.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/reduce.simd.hpp" +]==], + ["mcpp_generated/modules/core/split.avx2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/split.simd.hpp" +]==], + ["mcpp_generated/modules/core/split.lasx.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/split.simd.hpp" +]==], + ["mcpp_generated/modules/core/split.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/core/src/split.simd.hpp" +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX2, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/core/split.sse2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/split.simd.hpp" +]==], + ["mcpp_generated/modules/core/stat.avx2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/stat.simd.hpp" +]==], + ["mcpp_generated/modules/core/stat.lasx.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/stat.simd.hpp" +]==], + ["mcpp_generated/modules/core/stat.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/core/src/stat.simd.hpp" +#define CV_CPU_DISPATCH_MODE SSE4_2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX2, SSE4_2, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/core/stat.sse4_2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/stat.simd.hpp" +]==], + ["mcpp_generated/modules/core/sum.avx2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/sum.simd.hpp" +]==], + ["mcpp_generated/modules/core/sum.lasx.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/sum.simd.hpp" +]==], + ["mcpp_generated/modules/core/sum.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/core/src/sum.simd.hpp" +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX2, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/core/sum.sse2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/sum.simd.hpp" +]==], + ["mcpp_generated/modules/core/test/test_intrin128.avx.cpp"] = [==[ + +#include "modules/core/test/test_precomp.hpp" +#include "modules/core/test/test_intrin128.simd.hpp" +]==], + ["mcpp_generated/modules/core/test/test_intrin128.avx2.cpp"] = [==[ + +#include "modules/core/test/test_precomp.hpp" +#include "modules/core/test/test_intrin128.simd.hpp" +]==], + ["mcpp_generated/modules/core/test/test_intrin128.avx512_skx.cpp"] = [==[ + +#include "modules/core/test/test_precomp.hpp" +#include "modules/core/test/test_intrin128.simd.hpp" +]==], + ["mcpp_generated/modules/core/test/test_intrin128.fp16.cpp"] = [==[ + +#include "modules/core/test/test_precomp.hpp" +#include "modules/core/test/test_intrin128.simd.hpp" +]==], + ["mcpp_generated/modules/core/test/test_intrin128.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/core/test/test_intrin128.simd.hpp" +#define CV_CPU_DISPATCH_MODE SSE2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE SSE3 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE SSSE3 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE SSE4_1 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE SSE4_2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE FP16 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX512_SKX +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX512_SKX, AVX2, FP16, AVX, SSE4_2, SSE4_1, SSSE3, SSE3, SSE2, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/core/test/test_intrin128.sse2.cpp"] = [==[ + +#include "modules/core/test/test_precomp.hpp" +#include "modules/core/test/test_intrin128.simd.hpp" +]==], + ["mcpp_generated/modules/core/test/test_intrin128.sse3.cpp"] = [==[ + +#include "modules/core/test/test_precomp.hpp" +#include "modules/core/test/test_intrin128.simd.hpp" +]==], + ["mcpp_generated/modules/core/test/test_intrin128.sse4_1.cpp"] = [==[ + +#include "modules/core/test/test_precomp.hpp" +#include "modules/core/test/test_intrin128.simd.hpp" +]==], + ["mcpp_generated/modules/core/test/test_intrin128.sse4_2.cpp"] = [==[ + +#include "modules/core/test/test_precomp.hpp" +#include "modules/core/test/test_intrin128.simd.hpp" +]==], + ["mcpp_generated/modules/core/test/test_intrin128.ssse3.cpp"] = [==[ + +#include "modules/core/test/test_precomp.hpp" +#include "modules/core/test/test_intrin128.simd.hpp" +]==], + ["mcpp_generated/modules/core/test/test_intrin256.avx2.cpp"] = [==[ + +#include "modules/core/test/test_precomp.hpp" +#include "modules/core/test/test_intrin256.simd.hpp" +]==], + ["mcpp_generated/modules/core/test/test_intrin256.avx512_skx.cpp"] = [==[ + +#include "modules/core/test/test_precomp.hpp" +#include "modules/core/test/test_intrin256.simd.hpp" +]==], + ["mcpp_generated/modules/core/test/test_intrin256.lasx.cpp"] = [==[ + +#include "modules/core/test/test_precomp.hpp" +#include "modules/core/test/test_intrin256.simd.hpp" +]==], + ["mcpp_generated/modules/core/test/test_intrin256.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/core/test/test_intrin256.simd.hpp" +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX512_SKX +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE LASX +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL LASX, AVX512_SKX, AVX2, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/core/test/test_intrin512.avx512_skx.cpp"] = [==[ + +#include "modules/core/test/test_precomp.hpp" +#include "modules/core/test/test_intrin512.simd.hpp" +]==], + ["mcpp_generated/modules/core/test/test_intrin512.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/core/test/test_intrin512.simd.hpp" +#define CV_CPU_DISPATCH_MODE AVX512_SKX +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX512_SKX, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/core/transpose.avx.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/transpose.simd.hpp" +]==], + ["mcpp_generated/modules/core/transpose.avx2.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/transpose.simd.hpp" +]==], + ["mcpp_generated/modules/core/transpose.lasx.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/transpose.simd.hpp" +]==], + ["mcpp_generated/modules/core/transpose.neon.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/transpose.simd.hpp" +]==], + ["mcpp_generated/modules/core/transpose.rvv.cpp"] = [==[ + +#include "modules/core/src/precomp.hpp" +#include "modules/core/src/transpose.simd.hpp" +]==], + ["mcpp_generated/modules/core/transpose.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/core/src/transpose.simd.hpp" +#define CV_CPU_DISPATCH_MODE AVX +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX2, AVX, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/core/version_string.inc"] = [==[ +"\n" +"General configuration for OpenCV 5.0.0 =====================================\n" +" Version control: 5.0.0\n" +"\n" +" Platform:\n" +" Timestamp: 2026-07-18T04:06:44Z\n" +" Host: Linux 6.8.0-134-generic x86_64\n" +" CMake: 4.0.2\n" +" CMake generator: Ninja\n" +" CMake build tool: /home/speak/.xlings/subos/default/bin/ninja\n" +" Configuration: Release\n" +" Algorithm Hint: ALGO_HINT_ACCURATE\n" +"\n" +" CPU/HW features:\n" +" Baseline: SSE SSE2 SSE3\n" +" requested: SSE3\n" +" Dispatched code generation: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX\n" +" SSE4_1 (16 files): + SSSE3 SSE4_1\n" +" SSE4_2 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2\n" +" AVX (5 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX\n" +" FP16 (0 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX FP16\n" +" AVX2 (32 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX FP16 AVX2 FMA3\n" +" AVX512_SKX (5 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX FP16 AVX2 FMA3 AVX_512F AVX512_COMMON AVX512_SKX\n" +"\n" +" C/C++:\n" +" Built as dynamic libs?: NO\n" +" C++ standard: 17\n" +" C++ Compiler: /usr/bin/g++ (ver 13.3.0)\n" +" C++ flags (Release): -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG\n" +" C++ flags (Debug): -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG\n" +" C Compiler: /usr/bin/gcc\n" +" C flags (Release): -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG\n" +" C flags (Debug): -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG\n" +" Linker flags (Release): -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined \n" +" Linker flags (Debug): -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined \n" +" ccache: NO\n" +" Precompiled headers: NO\n" +" Extra dependencies: /usr/lib/x86_64-linux-gnu/libGL.so /usr/lib/x86_64-linux-gnu/libGLU.so dl m pthread rt\n" +" 3rdparty dependencies: libjpeg-turbo libpng zlib\n" +"\n" +" OpenCV modules:\n" +" To be built: core flann geometry highgui imgcodecs imgproc videoio\n" +" Disabled: world\n" +" Disabled by dependency: calib dnn features java java_bindings_generator js_bindings_generator objc_bindings_generator objdetect photo ptcloud python_bindings_generator python_tests stereo stitching video\n" +" Unavailable: python3 ts\n" +" Applications: -\n" +" Documentation: NO\n" +" Non-free algorithms: NO\n" +"\n" +" GUI: NONE\n" +" VTK support: YES (ver 9.1.0)\n" +"\n" +" Media I/O: \n" +" ZLib: zlib (ver 1.3.2)\n" +" JPEG: build-libjpeg-turbo (ver 3.1.2-70)\n" +" SIMD Support Request: YES\n" +" SIMD Support: YES\n" +" PNG: build (ver 1.6.57)\n" +" SIMD Support Request: YES\n" +" SIMD Support: YES (Intel SSE)\n" +" Metadata Support: EXIF XMP ICC cICP\n" +" GIF: NO\n" +" HDR: YES\n" +" SUNRASTER: YES\n" +" PXM: YES\n" +" PFM: YES\n" +"\n" +" Video I/O:\n" +" v4l/v4l2: YES (linux/videodev2.h)\n" +" Orbbec: NO\n" +"\n" +" Parallel framework: pthreads\n" +"\n" +" Trace: YES (built-in)\n" +"\n" +" Other third-party libraries:\n" +" VA: NO\n" +" Custom HAL: NO\n" +"\n" +" ONNX Runtime: NO\n" +"\n" +" Python (for build): /home/speak/.xlings/subos/default/bin/python3\n" +"\n" +" Java: \n" +" ant: NO\n" +" Java: YES (ver 21.0.11)\n" +" JNI: /usr/lib/jvm/default-java/include /usr/lib/jvm/default-java/include/linux /usr/lib/jvm/default-java/include\n" +" Java wrappers: NO\n" +" Java tests: NO\n" +"\n" +" Install to: /usr/local\n" +"-----------------------------------------------------------------\n" +"\n" +]==], + ["mcpp_generated/modules/highgui/opencv_highgui_config.hpp"] = [==[ +// Auto-generated file +#define OPENCV_HIGHGUI_BUILTIN_BACKEND_STR "NONE" + +#define OPENCV_HIGHGUI_WITHOUT_BUILTIN_BACKEND 1 +]==], + ["mcpp_generated/modules/imgproc/accum.avx.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/accum.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/accum.avx2.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/accum.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/accum.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/imgproc/src/accum.simd.hpp" +#define CV_CPU_DISPATCH_MODE SSE4_1 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX2, AVX, SSE4_1, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/imgproc/accum.sse4_1.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/accum.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/bilateral_filter.avx2.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/bilateral_filter.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/bilateral_filter.avx512_icl.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/bilateral_filter.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/bilateral_filter.avx512_skx.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/bilateral_filter.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/bilateral_filter.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/imgproc/src/bilateral_filter.simd.hpp" +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX512_SKX +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX512_SKX, AVX2, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/imgproc/bilateral_filter.sse2.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/bilateral_filter.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/box_filter.avx2.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/box_filter.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/box_filter.avx512_skx.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/box_filter.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/box_filter.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/imgproc/src/box_filter.simd.hpp" +#define CV_CPU_DISPATCH_MODE SSE4_1 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX512_SKX +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX512_SKX, AVX2, SSE4_1, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/imgproc/box_filter.sse2.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/box_filter.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/box_filter.sse4_1.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/box_filter.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/color_hsv.avx2.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/color_hsv.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/color_hsv.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/imgproc/src/color_hsv.simd.hpp" +#define CV_CPU_DISPATCH_MODE SSE4_1 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX2, SSE4_1, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/imgproc/color_hsv.sse2.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/color_hsv.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/color_hsv.sse4_1.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/color_hsv.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/color_rgb.avx2.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/color_rgb.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/color_rgb.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/imgproc/src/color_rgb.simd.hpp" +#define CV_CPU_DISPATCH_MODE SSE4_1 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX2, SSE4_1, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/imgproc/color_rgb.sse2.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/color_rgb.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/color_rgb.sse4_1.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/color_rgb.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/color_yuv.avx2.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/color_yuv.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/color_yuv.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/imgproc/src/color_yuv.simd.hpp" +#define CV_CPU_DISPATCH_MODE SSE4_1 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX2, SSE4_1, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/imgproc/color_yuv.sse2.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/color_yuv.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/color_yuv.sse4_1.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/color_yuv.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/filter.avx2.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/filter.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/filter.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/imgproc/src/filter.simd.hpp" +#define CV_CPU_DISPATCH_MODE SSE4_1 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX2, SSE4_1, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/imgproc/filter.sse2.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/filter.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/filter.sse4_1.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/filter.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/median_blur.avx2.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/median_blur.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/median_blur.avx512_icl.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/median_blur.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/median_blur.avx512_skx.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/median_blur.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/median_blur.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/imgproc/src/median_blur.simd.hpp" +#define CV_CPU_DISPATCH_MODE SSE4_1 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX512_SKX +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX512_SKX, AVX2, SSE4_1, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/imgproc/median_blur.sse2.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/median_blur.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/median_blur.sse4_1.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/median_blur.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/morph.avx2.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/morph.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/morph.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/imgproc/src/morph.simd.hpp" +#define CV_CPU_DISPATCH_MODE SSE4_1 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX2, SSE4_1, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/imgproc/morph.sse2.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/morph.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/morph.sse4_1.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/morph.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/smooth.avx2.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/smooth.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/smooth.avx512_icl.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/smooth.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/smooth.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/imgproc/src/smooth.simd.hpp" +#define CV_CPU_DISPATCH_MODE SSE4_1 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX2, SSE4_1, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/imgproc/smooth.sse2.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/smooth.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/smooth.sse4_1.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/smooth.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/sumpixels.avx2.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/sumpixels.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/sumpixels.avx512_skx.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/sumpixels.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/sumpixels.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/imgproc/src/sumpixels.simd.hpp" +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX512_SKX +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX512_SKX, AVX2, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/imgproc/sumpixels.sse2.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/sumpixels.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/undistort.avx2.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/undistort.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/undistort.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/imgproc/src/undistort.simd.hpp" +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX2, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/imgproc/undistort.sse2.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/undistort.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/warp_kernels.avx2.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/warp_kernels.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/warp_kernels.lasx.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/warp_kernels.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/warp_kernels.neon.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/warp_kernels.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/warp_kernels.neon_fp16.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/warp_kernels.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/warp_kernels.rvv.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/warp_kernels.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/warp_kernels.simd_declarations.hpp"] = [==[ +#define CV_CPU_SIMD_FILENAME "modules/imgproc/src/warp_kernels.simd.hpp" +#define CV_CPU_DISPATCH_MODE SSE4_1 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODE AVX2 +#include "opencv2/core/private/cv_cpu_include_simd_declarations.hpp" + +#define CV_CPU_DISPATCH_MODES_ALL AVX2, SSE4_1, BASELINE + +#undef CV_CPU_SIMD_FILENAME +]==], + ["mcpp_generated/modules/imgproc/warp_kernels.sse2.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/warp_kernels.simd.hpp" +]==], + ["mcpp_generated/modules/imgproc/warp_kernels.sse4_1.cpp"] = [==[ + +#include "modules/imgproc/src/precomp.hpp" +#include "modules/imgproc/src/warp_kernels.simd.hpp" +]==], + ["mcpp_generated/opencv2/cvconfig.h"] = [==[ +#ifndef OPENCV_CVCONFIG_H_INCLUDED +#define OPENCV_CVCONFIG_H_INCLUDED + +/* OpenCV compiled as static or dynamic libs */ +/* #undef BUILD_SHARED_LIBS */ + +/* OpenCV intrinsics optimized code */ +#define CV_ENABLE_INTRINSICS + +/* OpenCV additional optimized code */ +/* #undef CV_DISABLE_OPTIMIZATION */ + +/* Compile for 'real' NVIDIA GPU architectures */ +#define CUDA_ARCH_BIN "" + +/* NVIDIA GPU features are used */ +#define CUDA_ARCH_FEATURES "" + +/* Compile for 'virtual' NVIDIA PTX architectures */ +#define CUDA_ARCH_PTX "" + +/* AMD's Basic Linear Algebra Subprograms Library*/ +/* #undef HAVE_CLAMDBLAS */ + +/* AMD's OpenCL Fast Fourier Transform Library*/ +/* #undef HAVE_CLAMDFFT */ + +/* Clp support */ +/* #undef HAVE_CLP */ + +/* NVIDIA CUDA Runtime API*/ +/* #undef HAVE_CUDA */ + +/* NVIDIA CUDA Basic Linear Algebra Subprograms (BLAS) API*/ +/* #undef HAVE_CUBLAS */ + +/* NVIDIA CUDA Deep Neural Network (cuDNN) API*/ +/* #undef HAVE_CUDNN */ + +/* NVIDIA CUDA Fast Fourier Transform (FFT) API*/ +/* #undef HAVE_CUFFT */ + +/* DirectX */ +/* #undef HAVE_DIRECTX */ +/* #undef HAVE_DIRECTX_NV12 */ +/* #undef HAVE_D3D11 */ +/* #undef HAVE_D3D10 */ +/* #undef HAVE_D3D9 */ + +/* Eigen Matrix & Linear Algebra Library */ +/* #undef HAVE_EIGEN */ + +/* Geospatial Data Abstraction Library */ +/* #undef HAVE_GDAL */ + +/* Vulkan support */ +/* #undef HAVE_VULKAN */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_INTTYPES_H */ + +/* Intel Integrated Performance Primitives */ +/* #undef HAVE_IPP */ +/* #undef HAVE_IPP_ICV */ +/* #undef HAVE_IPP_IW */ +/* #undef HAVE_IPP_IW_LL */ + +/* JPEG-2000 codec */ +/* #undef HAVE_OPENJPEG */ +/* #undef HAVE_JASPER */ + +/* AVIF codec */ +/* #undef HAVE_AVIF */ + +/* IJG JPEG codec */ +#define HAVE_JPEG + +/* JPEG XL codec */ +/* #undef HAVE_JPEGXL */ + +/* GDCM DICOM codec */ +/* #undef HAVE_GDCM */ + +/* NVIDIA Video Decoding API*/ +/* #undef HAVE_NVCUVID */ +/* #undef HAVE_NVCUVID_HEADER */ +/* #undef HAVE_DYNLINK_NVCUVID_HEADER */ + +/* NVIDIA Video Encoding API*/ +/* #undef HAVE_NVCUVENC */ + +/* OpenCL Support */ +/* #undef HAVE_OPENCL */ +/* #undef HAVE_OPENCL_STATIC */ +/* #undef HAVE_OPENCL_SVM */ + +/* NVIDIA OpenCL D3D Extensions support */ +/* #undef HAVE_OPENCL_D3D11_NV */ + +/* OpenEXR codec */ +/* #undef HAVE_OPENEXR */ + +/* OpenGL support*/ +/* #undef HAVE_OPENGL */ + +/* PNG codec */ +#define HAVE_PNG + +/* PNG codec */ +/* #undef HAVE_SPNG */ + +/* Posix threads (pthreads) */ +#define HAVE_PTHREAD + +/* parallel_for with pthreads */ +#define HAVE_PTHREADS_PF + +/* Intel Threading Building Blocks */ +/* #undef HAVE_TBB */ + +/* Ste||ar Group High Performance ParallelX */ +/* #undef HAVE_HPX */ + +/* TIFF codec */ +/* #undef HAVE_TIFF */ + +/* Define if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +/* #undef WORDS_BIGENDIAN */ + +/* VA library (libva) */ +/* #undef HAVE_VA */ + +/* Intel VA-API/OpenCL */ +/* #undef HAVE_VA_INTEL */ + +/* Lapack */ +/* #undef HAVE_LAPACK */ + +/* Library was compiled with functions instrumentation */ +/* #undef ENABLE_INSTRUMENTATION */ + +/* OpenCV trace utilities */ +#define OPENCV_TRACE + +/* The font "uni" (WQY MicroHei) is available */ +/* #undef HAVE_UNIFONT */ + +#endif // OPENCV_CVCONFIG_H_INCLUDED +]==], + ["mcpp_generated/opencv2/opencv_modules.hpp"] = [==[ +/* + * ** File generated automatically, do not modify ** + * + * This file defines the list of modules available in current build configuration + * + * +*/ + +// This definition means that OpenCV is built with enabled non-free code. +// For example, patented algorithms for non-profit/non-commercial use only. +/* #undef OPENCV_ENABLE_NONFREE */ + +#define HAVE_OPENCV_CORE +#define HAVE_OPENCV_FLANN +#define HAVE_OPENCV_GEOMETRY +#define HAVE_OPENCV_HIGHGUI +#define HAVE_OPENCV_IMGCODECS +#define HAVE_OPENCV_IMGPROC +#define HAVE_OPENCV_VIDEOIO + + +]==], + ["mcpp_generated/opencv_data_config.hpp"] = [==[ + +#define OPENCV_INSTALL_PREFIX "/usr/local" + +#define OPENCV_DATA_INSTALL_PATH "share/opencv5" + +#define OPENCV_BUILD_DIR "/tmp/claude-1000/-home-speak-workspace-github-opencv-m/2910760b-c3dd-4b63-ad0e-3bb43f8fbadc/scratchpad/ocv5-cfg" + +#define OPENCV_DATA_BUILD_DIR_SEARCH_PATHS \ + "../opencv-5.0.0/" + +#define OPENCV_INSTALL_DATA_DIR_RELATIVE "../share/opencv5" +]==], + }, + }, +} diff --git a/tests/examples/opencv5/mcpp.toml b/tests/examples/opencv5/mcpp.toml new file mode 100644 index 0000000..11a7d72 --- /dev/null +++ b/tests/examples/opencv5/mcpp.toml @@ -0,0 +1,17 @@ +# OpenCV 5 test project. compat.opencv5 compiles OpenCV 5.0.0 from source with +# mcpp itself (457 TUs incl. 27 libjpeg-turbo NASM .asm, SIMD runtime dispatch +# kept; no CMake at build time — small config snapshot ships as +# generated_files, the large build-time products are synthesized on the +# consumer by the package's embedded build.mcpp). Linux-only for now: under +# cfg(linux) the dep is pulled and the test exercises core+imgproc+imgcodecs+ +# videoio; off-Linux the test compiles to a no-op main() so +# `mcpp test --workspace` is a clean no-op on macOS/Windows. +[package] +name = "opencv5-tests" +version = "0.1.0" + +[indices] +compat = { path = "../../.." } + +[target.'cfg(linux)'.dependencies.compat] +opencv5 = "5.0.0" diff --git a/tests/examples/opencv5/tests/opencv5.cpp b/tests/examples/opencv5/tests/opencv5.cpp new file mode 100644 index 0000000..21ce60e --- /dev/null +++ b/tests/examples/opencv5/tests/opencv5.cpp @@ -0,0 +1,35 @@ +// compat.opencv5 end-to-end assertion: the source build must expose the +// five-module surface — Mat/imgproc ops, PNG+JPEG codec roundtrips, the +// videoio registry — and report the pinned version. Linux-only (see +// mcpp.toml). +#ifdef __linux__ +#include +#include +#include +#include +#include +#include + +int main() { + if (cv::getVersionString() != "5.0.0") return 1; + + cv::Mat img(64, 64, CV_8UC3, cv::Scalar(30, 60, 90)); + cv::circle(img, {32, 32}, 20, {255, 255, 255}, -1); + cv::Mat big, gray; + cv::resize(img, big, {128, 128}, 0, 0, cv::INTER_CUBIC); + cv::cvtColor(big, gray, cv::COLOR_BGR2GRAY); + if (gray.size() != cv::Size(128, 128)) return 2; + + for (const char* ext : { ".png", ".jpg" }) { + std::vector buf; + if (!cv::imencode(ext, big, buf)) return 3; + cv::Mat back = cv::imdecode(buf, cv::IMREAD_COLOR); + if (back.empty() || back.size() != big.size()) return 4; + } + + if (cv::videoio_registry::getBackends().empty()) return 5; + return 0; +} +#else +int main() { return 0; } // package is linux-only for now +#endif diff --git a/tools/compat-opencv5/build_mcpp_template.cpp b/tools/compat-opencv5/build_mcpp_template.cpp new file mode 100644 index 0000000..34a4642 --- /dev/null +++ b/tools/compat-opencv5/build_mcpp_template.cpp @@ -0,0 +1,281 @@ +// build.mcpp for compat.opencv5 — consumer-side synthesis of OpenCV's +// build-time generated files from the frozen config snapshot. Embedded into +// pkgs/c/compat.opencv5.lua by tools/compat-opencv5/gen_descriptor.py. +// +// What it does (all pure transforms of files already in the pinned tarball — +// nothing is downloaded, nothing depends on the host): +// 1. blob2hdr — modules/imgproc/fonts/*.ttf.gz → builtin_font_{sans,italic}.h +// (hex byte arrays; faithful port of cmake ocv_blob2hdr) +// 2. cl2cpp — modules//src/opencl/*.cl → opencl_kernels_.{cpp,hpp} +// (comment-strip + string-escape + md5; faithful port of +// cmake/cl2cpp.cmake; content is #ifdef HAVE_OPENCL-guarded +// and inert in this profile, kept byte-faithful anyway) +// 3. tu stubs — one uniquely-named forwarding TU per source, driven by +// mcpp_generated/tu_manifest.txt. Works around mcpp#233 +// (object paths fold to / — OpenCV's +// modules/*/src/ layout collides), absorbs the +// libjpeg-turbo BITS_IN_JSAMPLE=12/16 same-source +// re-compiles, and carries defines whose values contain +// spaces (mcpp#234) as #define preludes. +// The raw `mcpp:` stdout protocol is used (no `import mcpp;`) so this file +// has zero non-standard dependencies. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace fs = std::filesystem; + +// ── tiny MD5 (RFC 1321, public-domain style condensed implementation) ──── +namespace md5impl { +struct MD5 { + uint32_t a0 = 0x67452301, b0 = 0xefcdab89, c0 = 0x98badcfe, d0 = 0x10325476; + static const uint32_t K[64]; + static const uint32_t R[64]; + void block(const uint8_t* p) { + uint32_t M[16]; + for (int i = 0; i < 16; i++) + M[i] = (uint32_t)p[i*4] | ((uint32_t)p[i*4+1] << 8) | ((uint32_t)p[i*4+2] << 16) | ((uint32_t)p[i*4+3] << 24); + uint32_t A = a0, B = b0, C = c0, D = d0; + for (int i = 0; i < 64; i++) { + uint32_t F; int g; + if (i < 16) { F = (B & C) | (~B & D); g = i; } + else if (i < 32) { F = (D & B) | (~D & C); g = (5*i + 1) % 16; } + else if (i < 48) { F = B ^ C ^ D; g = (3*i + 5) % 16; } + else { F = C ^ (B | ~D); g = (7*i) % 16; } + F = F + A + K[i] + M[g]; + A = D; D = C; C = B; + B = B + ((F << R[i]) | (F >> (32 - R[i]))); + } + a0 += A; b0 += B; c0 += C; d0 += D; + } + static std::string hex(const std::string& data) { + MD5 m; + uint64_t bits = (uint64_t)data.size() * 8; + std::string buf = data; + buf.push_back((char)0x80); + while (buf.size() % 64 != 56) buf.push_back('\0'); + for (int i = 0; i < 8; i++) buf.push_back((char)((bits >> (8*i)) & 0xff)); + for (size_t o = 0; o < buf.size(); o += 64) m.block((const uint8_t*)buf.data() + o); + char out[33]; + uint32_t w[4] = { m.a0, m.b0, m.c0, m.d0 }; + for (int i = 0; i < 16; i++) + std::snprintf(out + 2*i, 3, "%02x", (w[i/4] >> (8*(i%4))) & 0xff); + return std::string(out, 32); + } +}; +const uint32_t MD5::K[64] = { + 0xd76aa478,0xe8c7b756,0x242070db,0xc1bdceee,0xf57c0faf,0x4787c62a,0xa8304613,0xfd469501, + 0x698098d8,0x8b44f7af,0xffff5bb1,0x895cd7be,0x6b901122,0xfd987193,0xa679438e,0x49b40821, + 0xf61e2562,0xc040b340,0x265e5a51,0xe9b6c7aa,0xd62f105d,0x02441453,0xd8a1e681,0xe7d3fbc8, + 0x21e1cde6,0xc33707d6,0xf4d50d87,0x455a14ed,0xa9e3e905,0xfcefa3f8,0x676f02d9,0x8d2a4c8a, + 0xfffa3942,0x8771f681,0x6d9d6122,0xfde5380c,0xa4beea44,0x4bdecfa9,0xf6bb4b60,0xbebfbc70, + 0x289b7ec6,0xeaa127fa,0xd4ef3085,0x04881d05,0xd9d4d039,0xe6db99e5,0x1fa27cf8,0xc4ac5665, + 0xf4292244,0x432aff97,0xab9423a7,0xfc93a039,0x655b59c3,0x8f0ccc92,0xffeff47d,0x85845dd1, + 0x6fa87e4f,0xfe2ce6e0,0xa3014314,0x4e0811a1,0xf7537e82,0xbd3af235,0x2ad7d2bb,0xeb86d391 }; +const uint32_t MD5::R[64] = { + 7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22, 5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20, + 4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23, 6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21 }; +} // namespace md5impl + +static std::string slurp(const fs::path& p) { + std::ifstream f(p, std::ios::binary); + if (!f) { std::fprintf(stderr, "compat.opencv5 build.mcpp: cannot read %s\n", p.string().c_str()); std::exit(1); } + std::ostringstream ss; ss << f.rdbuf(); return ss.str(); +} +static void spew(const fs::path& p, const std::string& content) { + fs::create_directories(p.parent_path()); + // only rewrite when changed: keeps ninja restat-friendly timestamps + if (fs::exists(p)) { + std::ifstream f(p, std::ios::binary); std::ostringstream ss; ss << f.rdbuf(); + if (ss.str() == content) return; + } + std::ofstream f(p, std::ios::binary); + f << content; + if (!f) { std::fprintf(stderr, "compat.opencv5 build.mcpp: cannot write %s\n", p.string().c_str()); std::exit(1); } +} + +// ── gunzip (raw inflate over the vendored zlib? not available here) ───── +// The .ttf.gz blobs are embedded AS-IS: cmake's ocv_blob2hdr hex-dumps the +// *compressed* file bytes (OpenCV decompresses at runtime via its zlib), so +// no inflate is needed here — just a hex dump. +static void blob2hdr(const fs::path& blob, const fs::path& hdr, const std::string& var) { + // byte-faithful port of cmake ocv_blob2hdr: 16 bytes per line, ", " + // separators, the very last ", " trimmed. + std::string data = slurp(blob); + std::ostringstream out; + out << "// Auto generated file.\nstatic const unsigned char " << var << "[] =\n{\n"; + char buf[8]; + for (size_t i = 0; i < data.size(); i++) { + std::snprintf(buf, sizeof buf, "0x%02x", (unsigned char)data[i]); + out << buf; + if (i + 1 != data.size()) out << ", "; + if (i % 16 == 15 && i + 1 != data.size()) out << "\n"; + } + out << "\n};\n"; + spew(hdr, out.str()); +} + +// ── cl2cpp (faithful port of cmake/cl2cpp.cmake) ──────────────────────── +static std::string cl_escape(std::string lines) { + std::string t; + // \r removal + trailing \n + tabs→2 spaces + for (char c : lines) if (c != '\r') t.push_back(c); + t.push_back('\n'); + std::string u; + for (char c : t) { if (c == '\t') u += " "; else u.push_back(c); } + // strip /* */ comments (non-greedy scan) + std::string v; v.reserve(u.size()); + for (size_t i = 0; i < u.size();) { + if (i + 1 < u.size() && u[i] == '/' && u[i+1] == '*') { + size_t e = u.find("*/", i + 2); + i = (e == std::string::npos) ? u.size() : e + 2; + } else v.push_back(u[i++]); + } + // strip // comments (with leading spaces) + std::string w; w.reserve(v.size()); + for (size_t i = 0; i < v.size();) { + if (i + 1 < v.size() && v[i] == '/' && v[i+1] == '/') { + while (!w.empty() && w.back() == ' ') w.pop_back(); + size_t e = v.find('\n', i); + i = (e == std::string::npos) ? v.size() : e; // keep the newline + } else w.push_back(v[i++]); + } + // collapse empty lines + leading whitespace per line + std::string x; x.reserve(w.size()); + for (size_t i = 0; i < w.size();) { + if (w[i] == '\n') { + x.push_back('\n'); + size_t j = i + 1; + while (j < w.size() && (w[j] == ' ' || w[j] == '\n')) { + if (w[j] == '\n') { i = j; } + j++; + } + // re-scan: skip spaces directly after newline, and fold newline runs + size_t k = i + 1; + while (k < w.size() && w[k] == ' ') k++; + while (k < w.size() && w[k] == '\n') { k++; i = k - 1; + while (k < w.size() && w[k] == ' ') k++; } + i = k; + } else x.push_back(w[i++]); + } + if (!x.empty() && x.front() == '\n') x.erase(0, 1); + // escape backslash, quote; newline → \n" " + std::string y; + for (char c : x) { + if (c == '\\') y += "\\\\"; + else if (c == '"') y += "\\\""; + else if (c == '\n') y += "\\n\"\n\""; + else y.push_back(c); + } + // drop unneeded trailing quote opener + if (y.size() >= 1 && y.back() == '"') y.pop_back(); + return y; +} + +static void cl2cpp(const fs::path& cl_dir, const fs::path& out_cpp, const fs::path& out_hpp, + const std::string& module_name) { + std::vector cls; + for (auto& e : fs::directory_iterator(cl_dir)) + if (e.path().extension() == ".cl") cls.push_back(e.path()); + std::sort(cls.begin(), cls.end()); + std::string ns = module_name; + if (!ns.empty() && ns[0] >= '0' && ns[0] <= '9') ns = "_" + ns; + std::ostringstream cpp, hpp; + cpp << "// This file is auto-generated. Do not edit!\n\n#include \"opencv2/core.hpp\"\n" + << "#include \"cvconfig.h\"\n#include \"" << out_hpp.filename().string() << "\"\n\n" + << "#ifdef HAVE_OPENCL\n\nnamespace cv\n{\nnamespace ocl\n{\nnamespace " << ns + << "\n{\n\nstatic const char* const moduleName = \"" << module_name << "\";\n\n"; + hpp << "// This file is auto-generated. Do not edit!\n\n#include \"opencv2/core/ocl.hpp\"\n" + << "#include \"opencv2/core/ocl_genbase.hpp\"\n#include \"opencv2/core/opencl/ocl_defs.hpp\"\n\n" + << "#ifdef HAVE_OPENCL\n\nnamespace cv\n{\nnamespace ocl\n{\nnamespace " << ns << "\n{\n\n"; + for (auto& cl : cls) { + std::string name = cl.stem().string(); + std::string body = cl_escape(slurp(cl)); + std::string hash = md5impl::MD5::hex(body); + cpp << "struct cv::ocl::internal::ProgramEntry " << name << "_oclsrc={moduleName, \"" << name + << "\",\n\"" << body << ", \"" << hash << "\", NULL};\n"; + hpp << "extern struct cv::ocl::internal::ProgramEntry " << name << "_oclsrc;\n"; + } + cpp << "\n}}}\n#endif\n"; + hpp << "\n}}}\n#endif\n"; + spew(out_cpp, cpp.str()); + spew(out_hpp, hpp.str()); +} + +int main() { + const char* man_env = std::getenv("MCPP_MANIFEST_DIR"); + const char* out_env = std::getenv("MCPP_OUT_DIR"); + fs::path man = man_env ? man_env : "."; + if (!out_env) { std::fprintf(stderr, "compat.opencv5 build.mcpp: MCPP_OUT_DIR unset (mcpp >= 0.0.95 required)\n"); return 1; } + fs::path out = out_env; + fs::path gen = man / "mcpp_generated"; + + // the extracted official tarball wrap dir (opencv-/) + fs::path wrap; + for (auto& e : fs::directory_iterator(man)) { + if (e.is_directory() && e.path().filename().string().rfind("opencv-", 0) == 0 + && fs::exists(e.path() / "modules")) { wrap = e.path(); break; } + } + if (wrap.empty()) { std::fprintf(stderr, "compat.opencv5 build.mcpp: opencv-* source dir not found under %s\n", man.string().c_str()); return 1; } + + // 1. fonts + blob2hdr(wrap / "modules/imgproc/fonts/Rubik.ttf.gz", out / "builtin_font_sans.h", "OcvBuiltinFontSans"); + blob2hdr(wrap / "modules/imgproc/fonts/Rubik-Italic.ttf.gz", out / "builtin_font_italic.h", "OcvBuiltinFontItalic"); + + // 2. OpenCL kernel embeddings (inert under this profile, byte-faithful) + for (std::string m : { "core", "imgproc", "geometry" }) { + fs::path cl_dir = wrap / "modules" / m / "src" / "opencl"; + if (fs::exists(cl_dir)) + cl2cpp(cl_dir, out / ("clsrc/opencl_kernels_" + m + ".cpp"), + out / ("opencl_kernels_" + m + ".hpp"), m); + } + + // 3. forwarding TU stubs from the manifest + // line grammar: !prelude (collect) + // (emit stub) + std::map preludes; + std::ifstream mf(gen / "tu_manifest.txt"); + if (!mf) { std::fprintf(stderr, "compat.opencv5 build.mcpp: mcpp_generated/tu_manifest.txt missing\n"); return 1; } + std::string line; + int stubs = 0; + while (std::getline(mf, line)) { + if (line.empty() || line[0] == '#') continue; + std::vector f; + size_t pos = 0; + while (true) { + size_t t = line.find('\t', pos); + if (t == std::string::npos) { f.push_back(line.substr(pos)); break; } + f.push_back(line.substr(pos, t - pos)); pos = t + 1; + } + if (f[0] == "!prelude" && f.size() == 3) { preludes[f[1]] += f[2] + "\n"; continue; } + if (f.size() != 2) continue; + const std::string& grp = f[0]; + const std::string& target = f[1]; + std::string mangled = target; + for (char& c : mangled) if (c == '/') c = '_'; + fs::path stub = out / "tu" / grp / mangled; + std::string content = "/* compat.opencv5 forwarding TU (" + grp + ") */\n" + + preludes[grp] + "#include \"" + target + "\"\n"; + spew(stub, content); + std::printf("mcpp:generated=%s\n", stub.string().c_str()); + stubs++; + } + + // out/ carries builtin_font_*.h, opencl_kernels_*.hpp, clsrc/ includes + std::printf("mcpp:cxxflag=-I%s\n", out.string().c_str()); + std::printf("mcpp:cflag=-I%s\n", out.string().c_str()); + std::printf("mcpp:rerun-if-changed=%s\n", (gen / "tu_manifest.txt").string().c_str()); + // diagnostics as a non-directive stdout line: stderr writes can interleave + // into the (buffered) stdout directive stream and corrupt a directive. + std::printf("compat.opencv5 build.mcpp: %d stubs, fonts + CL kernels synthesized\n", stubs); + std::fflush(stdout); + return 0; +} diff --git a/tools/compat-opencv5/fetch_upstream.sh b/tools/compat-opencv5/fetch_upstream.sh new file mode 100755 index 0000000..b075c50 --- /dev/null +++ b/tools/compat-opencv5/fetch_upstream.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# fetch_upstream.sh — download + extract the pinned official OpenCV tarball +# for maintainer-time regeneration of the compat.opencv5 descriptor. +# Consumers never need this: they get OpenCV via the compat.opencv5 package. +# +# Prints the extracted source root on stdout. +set -eu + +version="${OPENCV_VERSION:-5.0.0}" +sha256="${OPENCV_SHA256:-b0528f5a1d379d59d4701cb28c36e22214cc51cf64594e5b56f2d3e6c0233095}" +cache="${XDG_CACHE_HOME:-$HOME/.cache}/opencv-m" +tarball="$cache/opencv-$version.tar.gz" +srcdir="$cache/opencv-$version" + +mkdir -p "$cache" +if [ ! -f "$tarball" ]; then + curl -L -fsS -o "$tarball" "https://github.com/opencv/opencv/archive/refs/tags/$version.tar.gz" >&2 +fi +echo "$sha256 $tarball" | sha256sum -c - >&2 +if [ ! -d "$srcdir" ]; then + tar -xzf "$tarball" -C "$cache" +fi +echo "$srcdir" diff --git a/tools/compat-opencv5/gen_config.sh b/tools/compat-opencv5/gen_config.sh new file mode 100755 index 0000000..b4598c9 --- /dev/null +++ b/tools/compat-opencv5/gen_config.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# gen_config.sh — maintainer-time descriptor pipeline for compat.opencv5. +# +# Fetches the pinned OFFICIAL OpenCV tarball (fetch_upstream.sh alongside), +# runs CMake ONCE with the frozen hermetic profile, runs the reference ninja +# build so the build-time generators (cl2cpp, blob2hdr, dispatch stubs) +# materialize, dumps the full compile-command list (`ninja -t commands` — +# state-independent, unlike `ninja -n`), and emits the mcpp-index descriptor +# via gen_descriptor.py alongside. Consumers never run this: OpenCV reaches +# them as the compat.opencv5 package (frozen config + build.mcpp synthesis). +# +# Usage: tools/compat-opencv5/gen_config.sh [target] [out.lua] +# target default: autodetected - (only linux-x86_64 supported yet) +# out.lua default: /pkgs/c/compat.opencv5.lua +# +# NOTE: use a real host gcc via CC/CXX if the default `cc` is shimmed to a +# cross toolchain (xlings subos). Host gcc 13 ICEs on two AVX2 bfloat TUs — +# harmless here (ninja -k skips them; only the generators' outputs matter). +set -eu + +target="${1:-$(uname -s | tr 'A-Z' 'a-z' | sed s/darwin/macos/)-$(uname -m | sed s/arm64/aarch64/)}" +here="$(cd "$(dirname "$0")" && pwd)" +index_root="$(cd "$here/../.." && pwd)" +version="${OPENCV_VERSION:-5.0.0}" +sha256="${OPENCV_SHA256:-b0528f5a1d379d59d4701cb28c36e22214cc51cf64594e5b56f2d3e6c0233095}" +out="${2:-$index_root/pkgs/c/compat.opencv5.lua}" + +src="$(sh "$here/fetch_upstream.sh")" +bld="${OPENCV_CFG_DIR:-$(mktemp -d /tmp/opencv5-cfg.XXXXXX)}" + +# Frozen hermetic profile (v0.1 scope): five requested modules (flann and +# geometry join as dependency closure), every external probe OFF, all needed +# 3rdparty built from the vendored tree (zlib, libpng, libjpeg-turbo incl. +# NASM SIMD), headless highgui, V4L2 videoio. WITH_UNIFONT stays OFF: it is +# a configure-time EXTRA download (13 MB CJK font) which would break the +# single-pinned-source model — future `unifont` feature. +cmake -G Ninja -S "$src" -B "$bld" \ + -DCMAKE_BUILD_TYPE=Release \ + ${CC:+-DCMAKE_C_COMPILER=$CC} ${CXX:+-DCMAKE_CXX_COMPILER=$CXX} \ + -DBUILD_LIST=core,imgproc,imgcodecs,highgui,videoio \ + -DBUILD_SHARED_LIBS=OFF \ + -DBUILD_ZLIB=ON -DBUILD_PNG=ON -DBUILD_JPEG=ON \ + -DWITH_TIFF=OFF -DWITH_WEBP=OFF -DWITH_OPENJPEG=OFF -DWITH_JASPER=OFF \ + -DWITH_OPENEXR=OFF -DWITH_AVIF=OFF -DWITH_JPEGXL=OFF -DWITH_IMGCODEC_GIF=OFF \ + -DWITH_OPENCL=OFF -DWITH_IPP=OFF -DWITH_LAPACK=OFF -DWITH_EIGEN=OFF -DWITH_ITT=OFF \ + -DWITH_GTK=OFF -DWITH_QT=OFF -DWITH_WAYLAND=OFF -DWITH_OPENGL=OFF \ + -DWITH_FFMPEG=OFF -DWITH_GSTREAMER=OFF -DWITH_V4L=ON -DWITH_OBSENSOR=OFF \ + -DWITH_PROTOBUF=OFF -DWITH_CAROTENE=OFF -DWITH_FLATBUFFERS=OFF \ + -DWITH_UNIFONT=OFF \ + -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_opencv_apps=OFF + +# Reference build: -k because two AVX2 bfloat TUs ICE on host gcc 13 — the +# object files are irrelevant, only generator outputs are harvested. +ninja -C "$bld" -k 9999 || true +ninja -C "$bld" -t commands > "$bld/ninja-cmds.log" + +python3 "$here/gen_descriptor.py" "$src" "$bld" "$version" "$sha256" "$out" +echo "descriptor written: $out (configured on: $target)" diff --git a/tools/compat-opencv5/gen_descriptor.py b/tools/compat-opencv5/gen_descriptor.py new file mode 100755 index 0000000..aef53db --- /dev/null +++ b/tools/compat-opencv5/gen_descriptor.py @@ -0,0 +1,315 @@ +#!/usr/bin/env python3 +"""gen_descriptor.py — emit pkgs/c/compat.opencv5.lua from the reference build. + +Inputs: +The build dir must contain ninja-cmds.log (`ninja -t commands`) and the +completed generator outputs (see gen_config.sh). + +Descriptor anatomy (the "full source-build + build.mcpp synthesis" shape): +- xpm: official GitHub tag tarball + gitcode CN mirror, sha256-pinned. +- generated_files: the small frozen config snapshot (cvconfig.h, + cv_cpu_config.h, dispatch stubs, simd_declarations, 3rdparty configs … + ~60 KB), plus build.mcpp (consumer-side synthesizer) and tu_manifest.txt + (drives the forwarding-TU layer). +- sources: only the NASM .asm units — every C/C++ TU enters the build as a + build.mcpp `mcpp:generated=` forwarding stub (unique basenames, see + mcpp#233; BITS_IN_JSAMPLE re-compiles; spacey defines via prelude, + mcpp#234). +- flags: layered per-glob entries — per-group dirs (**/tu//**), + per-ISA suffixes (**/*.avx2.cpp …), per-file extras; verified by exact + reconstruction against every reference compile command. +""" +import re, shlex, sys +from collections import defaultdict +from pathlib import Path + +SRC = Path(sys.argv[1]).resolve() +BLD = Path(sys.argv[2]).resolve() +VERSION = sys.argv[3] +SHA256 = sys.argv[4] +OUT = Path(sys.argv[5]) +HERE = Path(__file__).resolve().parent + +# ── parse `ninja -t commands` ─────────────────────────────────────────── +compiles = [] +for line in (BLD / "ninja-cmds.log").read_text().splitlines(): + line = line.strip() + if not line: + continue + try: + toks = shlex.split(line) + except ValueError: + continue + if not toks: + continue + tool = Path(toks[0]).name + if tool not in ("g++", "gcc", "cc", "c++", "clang", "clang++", "nasm"): + continue + tool = "nasm" if tool == "nasm" else ("g++" if tool in ("g++", "c++", "clang++") else "gcc") + src = None; defs = set(); mflags = []; incs = []; std = None + skip = False + for i in range(1, len(toks)): + t = toks[i] + if skip: skip = False; continue + if t in ("-o", "-MF", "-MT", "-MQ"): skip = True; continue + if t == "-MD": + if tool == "nasm": skip = True + continue + if t == "-c" or t == "-isystem": continue + if t.startswith("-std="): std = t; continue + if t.startswith("-D"): defs.add(t); continue + if t.startswith("-I"): incs.append(t[2:].strip('"')); continue + if t.startswith("-m") or t in ("-O3", "-O2"): mflags.append(t); continue + if re.search(r"\.(c|cc|cpp|cxx|asm)$", t) and not t.startswith("-"): + src = t + if src is None: + continue + src_abs = src if src.startswith("/") else str(BLD / src) + compiles.append((tool, src_abs, frozenset(defs), tuple(mflags), incs, std)) +assert compiles, "no compile commands parsed" +print(f"parsed {len(compiles)} compiles") + +ISA_RE = re.compile(r"\.(sse4_1|sse4_2|avx512_skx|avx2|avx|fp16)\.cpp$") +MODS = ("core", "imgproc", "imgcodecs", "highgui", "videoio", "flann", "geometry") + +def dir_key(src_abs, defs): + s = src_abs + if "3rdparty/libjpeg-turbo" in s: + if s.endswith(".asm"): return "jpeg-asm" + if "-DBITS_IN_JSAMPLE=12" in defs: return "jpeg12" + if "-DBITS_IN_JSAMPLE=16" in defs: return "jpeg16" + return "jpeg" + if "3rdparty/libpng" in s: return "png" + if "3rdparty/zlib" in s: return "zlib" + for mod in MODS: + if f"modules/{mod}/" in s: return mod + raise SystemExit(f"unclassified source: {s}") + +groups = defaultdict(list) +for c in compiles: + isa = ISA_RE.search(c[1]) + groups[(dir_key(c[1], c[2]), isa.group(1) if isa else None)].append(c) + +dir_defs, dir_m, file_extras = {}, {}, {} +for (dk, isa), cs in groups.items(): + if isa: continue + common = frozenset.intersection(*[c[2] for c in cs]) + dir_defs[dk], dir_m[dk] = common, cs[0][3] + for c in cs: + if c[2] - common: + file_extras[c[1]] = c[2] - common + +isa_defs, isa_m = {}, {} +for (dk, isa), cs in sorted(groups.items(), key=lambda kv: (kv[0][0], kv[0][1] or "")): + if not isa: continue + for c in cs: + extra = c[2] - dir_defs[dk] + extram = tuple(f for f in c[3] if f not in dir_m[dk]) + if isa not in isa_defs: + isa_defs[isa], isa_m[isa] = extra, extram + else: + assert isa_defs[isa] == extra and isa_m[isa] == extram, \ + f"ISA overlay mismatch for {isa}: {c[1]}" + +# exact reconstruction check +for tool, src_abs, defs, mflags, incs, std in compiles: + dk = dir_key(src_abs, defs) + isa = ISA_RE.search(src_abs) + want = set(dir_defs[dk]) | (set(isa_defs[isa.group(1)]) if isa else set()) \ + | set(file_extras.get(src_abs, ())) + assert want == set(defs), f"reconstruction failed for {src_abs}: {want ^ set(defs)}" +print("exact flag reconstruction: OK") + +# common -m flags across every non-asm group must agree (baseline) +baselines = {dir_m[dk] for dk in dir_defs if dk != "jpeg-asm"} +assert len(baselines) == 1, f"baseline -m flags differ between groups: {baselines}" +baseline_m = [f for f in next(iter(baselines)) if f.startswith("-m")] + +# spacey defines → stub preludes (mcpp#234) +preludes = defaultdict(list) +for dk in sorted(dir_defs): + keep = set() + for f in dir_defs[dk]: + body = f[2:] + if " " in body: + name, _, val = body.partition("=") + preludes[dk].append(f"#define {name} {val}") + else: + keep.add(f) + dir_defs[dk] = frozenset(keep) +for k in list(file_extras): + assert all(" " not in f[2:] for f in file_extras[k]), f"spacey per-file define: {k}" + +# ── tu manifest + per-file extra globs ────────────────────────────────── +def target_of(src_abs): + """include-target: wrap-relative (via -I *) or snapshot-relative (via -I mcpp_generated)""" + if src_abs.startswith(str(SRC)): + return str(Path(src_abs).relative_to(SRC)) + return str(Path(src_abs).relative_to(BLD)) + +manifest, sources_asm, extra_glob_entries, seen = [], [], [], set() +for dk in sorted(preludes): + for l in sorted(preludes[dk]): + manifest.append(f"!prelude\t{dk}\t{l}") +for tool, src_abs, defs, mflags, incs, std in compiles: + dk = dir_key(src_abs, defs) + if tool == "nasm": + rel = Path(src_abs).relative_to(SRC) + e = f"*/{rel}" + if e not in seen: + seen.add(e); sources_asm.append(e) + continue + tgt = target_of(src_abs) + key = (dk, tgt) + if key in seen: continue + seen.add(key) + manifest.append(f"{dk}\t{tgt}") + if src_abs in file_extras: + mangled = tgt.replace("/", "_") + extra_glob_entries.append((f"**/tu/{dk}/{mangled}", file_extras[src_abs])) +# kernel TUs are synthesized by build.mcpp (clsrc/…) — route them through +# the manifest too, replacing their reference-build originals +manifest = [l for l in manifest if "opencl_kernels_" not in l or l.startswith("!")] +for m in ("core", "imgproc", "geometry"): + if (SRC / "modules" / m / "src" / "opencl").exists(): + manifest.append(f"{m}\tclsrc/opencl_kernels_{m}.cpp") +n_tus = sum(1 for l in manifest if not l.startswith('!')) +print(f"manifest: {n_tus} TUs; asm sources: {len(sources_asm)}") + +# ── snapshot files (exclude synthesized classes) ──────────────────────── +def rewrite(text): + return (text.replace(f'"{SRC}/', '"').replace(f'{SRC}/', '') + .replace(f'"{BLD}/', '"').replace(f'{BLD}/', '')) + +snapshot = {} +for p in sorted(BLD.rglob("*")): + if p.is_dir() or "CMakeFiles" in p.parts: + continue + if p.name.startswith(("CMake", "cmake_", "CPack", ".ninja", "ninja")): + continue + if p.suffix not in (".h", ".hpp", ".inc", ".cpp", ".c", ".asm"): + continue + if "builtin_font" in p.name or "opencl_kernels" in p.name: + continue # build.mcpp synthesizes these + rel = p.relative_to(BLD) + content = rewrite(p.read_text(errors="replace")) + assert "]==]" not in content, f"lua long-bracket collision in {rel}" + assert len(content) < 200_000, f"unexpectedly large snapshot file {rel}" + snapshot[f"mcpp_generated/{rel}"] = content +print(f"snapshot: {len(snapshot)} files, {sum(len(v) for v in snapshot.values())//1024} KiB inline") + +build_mcpp_src = (HERE / "build_mcpp_template.cpp").read_text() +assert "]==]" not in build_mcpp_src + +# ── include dirs ──────────────────────────────────────────────────────── +incdirs, iseen = ["mcpp_generated", "*"], {"mcpp_generated", "*"} +for c in compiles: + for i in c[4]: + if i.startswith(str(SRC)): + r = "*/" + str(Path(i).relative_to(SRC)) if i != str(SRC) else "*" + elif i.startswith(str(BLD)): + r = "mcpp_generated/" + str(Path(i).relative_to(BLD)) if i != str(BLD) else "mcpp_generated" + else: + continue + if r not in iseen: + iseen.add(r); incdirs.append(r) + +# ── emit lua ──────────────────────────────────────────────────────────── +def D(x): return x[2:] +def lua_list(items, ind): + return ("\n" + ind).join(f'"{i}",' for i in items) + +flags_entries = [] +for dk in sorted(dir_defs): + if dk == "jpeg-asm": continue + key = "cflags" if dk in ("zlib", "png", "jpeg", "jpeg12", "jpeg16") else "cxxflags" + parts = [f'glob = "**/tu/{dk}/**"'] + ds = sorted(D(f) for f in dir_defs[dk]) + if ds: parts.append("defines = { " + ", ".join(f'"{d}"' for d in ds) + " }") + flags_entries.append("{ " + ", ".join(parts) + " },") +if ("jpeg-asm", None) in groups: + cs = groups[("jpeg-asm", None)] + ds = sorted(D(f) for f in frozenset.intersection(*[c[2] for c in cs])) + flags_entries.append('{ glob = "**/*.asm", defines = { ' + ", ".join(f'"{d}"' for d in ds) + " } },") +for isa in sorted(isa_defs): + ds = sorted(D(f) for f in isa_defs[isa]) + ms = list(isa_m[isa]) + flags_entries.append( + f'{{ glob = "**/*.{isa}.cpp", defines = {{ ' + ", ".join(f'"{d}"' for d in ds) + + ' }, cxxflags = { ' + ", ".join(f'"{m}"' for m in ms) + " } },") +for g, extra in sorted(extra_glob_entries): + ds = sorted(D(f) for f in extra) + flags_entries.append(f'{{ glob = "{g}", defines = {{ ' + ", ".join(f'"{d}"' for d in ds) + " } },") + +# upstream reference uses -std=c++17; the index floor is c++23 and the whole +# TU set builds green under gcc16 -std=c++23 (validated by the O0 spike). +cxx_std = {c[5] for c in compiles if c[0] == "g++" and c[5]} +assert cxx_std == {"-std=c++17"}, f"unexpected upstream C++ std set: {cxx_std}" + +L = [] +L.append(f"""-- Auto-generated by tools/compat-opencv5/gen_descriptor.py — do not edit by hand. +-- Recipe: OpenCV {VERSION} built FROM SOURCE by mcpp (no CMake at build +-- time). v0.1 scope: core imgproc imgcodecs highgui videoio (+ flann, +-- geometry dependency closure); hermetic profile (all external probes OFF, +-- vendored zlib/libpng/libjpeg-turbo incl. 27 NASM SIMD units, headless +-- highgui, V4L2 videoio, WITH_UNIFONT=OFF); SIMD runtime dispatch KEPT +-- (per-ISA glob flags). Small config snapshot inlined below; the large +-- build-time products (font hex headers, OpenCL kernel embeddings, the +-- forwarding-TU layer) are synthesized on the consumer by the embedded +-- build.mcpp — byte-faithful ports verified against the reference CMake +-- build. Regenerate: sh tools/compat-opencv5/gen_config.sh (this repo). +package = {{ + spec = "1", + namespace = "compat", + name = "compat.opencv5", + description = "OpenCV {VERSION} (core/imgproc/imgcodecs/highgui/videoio), full source build with SIMD dispatch", + licenses = {{"Apache-2.0"}}, + repo = "https://github.com/opencv/opencv", + type = "package", + + xpm = {{ + -- linux-x86_64 only for now: the config snapshot is target-specific. + linux = {{ + ["{VERSION}"] = {{ + url = {{ + GLOBAL = "https://github.com/opencv/opencv/archive/refs/tags/{VERSION}.tar.gz", + CN = "https://gitcode.com/mcpp-res/opencv/releases/download/{VERSION}/opencv-{VERSION}.tar.gz", + }}, + sha256 = "{SHA256}", + }}, + }}, + }}, + + mcpp = {{ + language = "c++23", -- upstream min c++17; c++23 spike-validated (457 TU green) + include_dirs = {{ + {lua_list(incdirs, " " * 12)} + }}, + cxxflags = {{ {", ".join(f'"{m}"' for m in baseline_m)}, "-w" }}, + cflags = {{ {", ".join(f'"{m}"' for m in baseline_m)}, "-w" }}, + flags = {{ + {("\n" + " " * 12).join(flags_entries)} + }}, + targets = {{ + opencv5 = {{ kind = "lib" }}, + }}, + linux = {{ + ldflags = {{ "-lpthread", "-ldl" }}, + }}, + sources = {{ + {lua_list(sources_asm, " " * 12)} + }}, + generated_files = {{ +""") +L.append(f' ["build.mcpp"] = [==[\n{build_mcpp_src}]==],\n') +L.append(' ["mcpp_generated/tu_manifest.txt"] = [==[\n' + "\n".join(manifest) + "\n]==],\n") +for rel in sorted(snapshot): + L.append(f' ["{rel}"] = [==[\n{snapshot[rel]}]==],\n') +L.append(""" }, + }, +} +""") +OUT.write_text("".join(L)) +kb = OUT.stat().st_size // 1024 +print(f"gen_descriptor: {OUT} written — {n_tus} TUs via build.mcpp, " + f"{len(sources_asm)} asm sources, {len(snapshot)} inline snapshot files, {kb} KiB")