Use yuv and fix FR to use batch 4
This commit is contained in:
@@ -107,19 +107,27 @@ endif()
|
||||
# Default: OFF. Enable with `-DANSCORE_USE_LIBYUV=ON` only after switching
|
||||
# the project's compiler to clang-cl / clang / gcc.
|
||||
option(ANSCORE_USE_LIBYUV "Use libyuv for YUV→BGR conversion (only effective on Clang/GCC, NOT MSVC)" OFF)
|
||||
if(ANSCORE_USE_LIBYUV AND EXISTS "${CMAKE_SOURCE_DIR}/3rdparty/libyuv/CMakeLists.txt")
|
||||
if(MSVC AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
message(WARNING "ANSCORE_USE_LIBYUV=ON but compiler is MSVC cl.exe — "
|
||||
"libyuv's SIMD paths (row_gcc.cc) won't compile. "
|
||||
"Expect ~10× slowdown vs cv::cvtColor. "
|
||||
"Use clang-cl (LLVM) instead, or keep ANSCORE_USE_LIBYUV=OFF.")
|
||||
endif()
|
||||
# Prevent libyuv from finding a system libjpeg and enabling HAVE_JPEG
|
||||
# (we don't use libyuv's MJPEG codepaths; avoids an unnecessary runtime dep).
|
||||
set(CMAKE_DISABLE_FIND_PACKAGE_JPEG TRUE)
|
||||
add_subdirectory(3rdparty/libyuv EXCLUDE_FROM_ALL)
|
||||
# Prebuilt libyuv path — built separately with clang-cl so its SIMD rows compile,
|
||||
# then linked into the MSVC main build (clang-cl output is MSVC-ABI-compatible).
|
||||
# Override with -DANSCORE_LIBYUV_LIB=<path> if the .lib lives elsewhere.
|
||||
set(ANSCORE_LIBYUV_LIB "${CMAKE_SOURCE_DIR}/3rdparty/libyuv/build-clangcl/Release/yuv.lib"
|
||||
CACHE FILEPATH "Path to the prebuilt libyuv static library (built with clang-cl)")
|
||||
|
||||
if(ANSCORE_USE_LIBYUV AND EXISTS "${ANSCORE_LIBYUV_LIB}")
|
||||
add_library(yuv STATIC IMPORTED GLOBAL)
|
||||
set_target_properties(yuv PROPERTIES
|
||||
IMPORTED_LOCATION "${ANSCORE_LIBYUV_LIB}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/3rdparty/libyuv/include")
|
||||
set(ANSCORE_HAS_LIBYUV ON)
|
||||
message(STATUS "libyuv: ENABLED (vendored from 3rdparty/libyuv, static target 'yuv')")
|
||||
message(STATUS "libyuv: ENABLED (prebuilt static lib at ${ANSCORE_LIBYUV_LIB})")
|
||||
elseif(ANSCORE_USE_LIBYUV)
|
||||
set(ANSCORE_HAS_LIBYUV OFF)
|
||||
message(WARNING "ANSCORE_USE_LIBYUV=ON but prebuilt libyuv not found at "
|
||||
"${ANSCORE_LIBYUV_LIB}. Build it first with clang-cl:\n"
|
||||
" cmake -S 3rdparty/libyuv -B 3rdparty/libyuv/build-clangcl "
|
||||
"-G \"Visual Studio 17 2022\" -T ClangCL -A x64\n"
|
||||
" cmake --build 3rdparty/libyuv/build-clangcl --config Release\n"
|
||||
"Falling back to cv::cvtColor path.")
|
||||
else()
|
||||
set(ANSCORE_HAS_LIBYUV OFF)
|
||||
message(STATUS "libyuv: DISABLED — using cv::cvtColor+IPP path (fast on MSVC)")
|
||||
|
||||
Reference in New Issue
Block a user