vendor: OpenCV 5.0.0 snapshot at 40738fb16ceddb5fb3fea747585f7ce6abb0605b

This commit is contained in:
Gitea Mirror Bot
2026-08-22 00:10:33 +08:00
commit f7f077da11
6933 changed files with 2335208 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
// Shim for ORT's core/common/common.h. Provides the small subset of
// macros that MLAS's q4_dq.cpp / q4common.h use: ORT_ENFORCE and ORT_THROW.
// Upstream's common.h pulls in logging, status, exceptions, and lots more
// — none of which MLAS itself needs. We map both macros to throwing
// std::runtime_error since MLAS is built without exception-disable in
// our CMake (see mlasi.h's MLAS_NO_EXCEPTION guard).
#pragma once
#include <sstream>
#include <stdexcept>
#include <string>
namespace onnxruntime {
// Concatenate stream-like arguments into a single string. Supports the
// same `operator<<` chain that ORT_ENFORCE uses for its diagnostic.
template <typename... Args>
inline std::string MlasShimMakeMessage(const Args&... args) {
std::ostringstream oss;
using expand = int[];
(void)expand{0, ((void)(oss << args), 0)...};
return oss.str();
}
} // namespace onnxruntime
#define ORT_THROW(...) \
do { \
throw std::runtime_error( \
::onnxruntime::MlasShimMakeMessage(__VA_ARGS__)); \
} while (0)
#define ORT_ENFORCE(cond, ...) \
do { \
if (!(cond)) { \
throw std::runtime_error( \
::onnxruntime::MlasShimMakeMessage( \
"ORT_ENFORCE(" #cond ") failed: ", ##__VA_ARGS__)); \
} \
} while (0)
#define ORT_NOT_IMPLEMENTED(...) ORT_THROW("not implemented: ", ##__VA_ARGS__)
+30
View File
@@ -0,0 +1,30 @@
// Shim for ORT's core/common/narrow.h — used by the vendored MLAS (cast.cpp).
// Upstream provides a checked narrowing cast a la gsl::narrow. The MLAS
// translation units here only #include the header; they do not actually
// invoke narrow<T>(...). We provide a minimal definition anyway so the file
// compiles cleanly and any future MLAS update that does call narrow keeps
// working.
//
// This file is intentionally tiny so OpenCV can keep a stable shim while
// upstream MLAS evolves.
#pragma once
#include <stdexcept>
#include <type_traits>
namespace onnxruntime {
template <typename T, typename U>
constexpr T narrow(U u) {
static_assert(std::is_arithmetic<T>::value && std::is_arithmetic<U>::value,
"narrow<T>(U): T and U must be arithmetic types");
const T t = static_cast<T>(u);
if (static_cast<U>(t) != u ||
((t < T{}) != (u < U{}))) {
throw std::runtime_error("onnxruntime::narrow: narrowing failed");
}
return t;
}
} // namespace onnxruntime