chore: removed OpenCV dependency

Signed-off-by: k4yt3x <i@k4yt3x.com>
This commit is contained in:
k4yt3x 2024-11-13 00:00:00 +00:00
parent 980b44bc05
commit b520d51c6c
No known key found for this signature in database
8 changed files with 5 additions and 86 deletions

View File

@ -38,7 +38,6 @@ jobs:
libvulkan-dev \ libvulkan-dev \
glslang-tools \ glslang-tools \
libomp-dev \ libomp-dev \
libopencv-dev \
libboost-program-options-dev libboost-program-options-dev
- name: Build Video2X - name: Build Video2X
run: | run: |
@ -73,7 +72,6 @@ jobs:
run: | run: |
$ffmpegVersion = "7.1" $ffmpegVersion = "7.1"
$ncnnVersion = "20240820" $ncnnVersion = "20240820"
$opencvVersion = "4.10.0"
git submodule update --init --recursive git submodule update --init --recursive
@ -84,15 +82,11 @@ jobs:
curl -Lo ncnn-shared.zip "https://github.com/Tencent/ncnn/releases/download/$ncnnVersion/ncnn-$ncnnVersion-windows-vs2022-shared.zip" curl -Lo ncnn-shared.zip "https://github.com/Tencent/ncnn/releases/download/$ncnnVersion/ncnn-$ncnnVersion-windows-vs2022-shared.zip"
Expand-Archive -Path ncnn-shared.zip -DestinationPath third_party Expand-Archive -Path ncnn-shared.zip -DestinationPath third_party
Rename-Item -Path "third_party/ncnn-$ncnnVersion-windows-vs2022-shared" -NewName ncnn-shared Rename-Item -Path "third_party/ncnn-$ncnnVersion-windows-vs2022-shared" -NewName ncnn-shared
curl -Lo opencv-shared.exe "https://github.com/opencv/opencv/releases/download/$opencvVersion/opencv-$opencvVersion-windows.exe"
7z x opencv-shared.exe -y
Move-Item -Path opencv -Destination third_party\opencv-shared
- name: Build Video2X - name: Build Video2X
shell: pwsh shell: pwsh
run: | run: |
cmake -S . -B build ` cmake -S . -B build `
-DUSE_SYSTEM_NCNN=OFF -DUSE_SYSTEM_SPDLOG=OFF -DUSE_SYSTEM_OPENCV=OFF -DUSE_SYSTEM_BOOST=OFF ` -DUSE_SYSTEM_NCNN=OFF -DUSE_SYSTEM_SPDLOG=OFF -DUSE_SYSTEM_BOOST=OFF `
-DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=build/video2x_install -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=build/video2x_install
cmake --build build --config Debug --parallel --target install cmake --build build --config Debug --parallel --target install
- name: Upload artifacts - name: Upload artifacts

View File

@ -47,7 +47,6 @@ jobs:
libvulkan-dev \ libvulkan-dev \
glslang-tools \ glslang-tools \
libomp-dev \ libomp-dev \
libopencv-dev \
libboost-program-options-dev libboost-program-options-dev
- name: Build Video2X - name: Build Video2X
run: | run: |
@ -85,7 +84,6 @@ jobs:
run: | run: |
$ffmpegVersion = "7.1" $ffmpegVersion = "7.1"
$ncnnVersion = "20240820" $ncnnVersion = "20240820"
$opencvVersion = "4.10.0"
git submodule update --init --recursive git submodule update --init --recursive
@ -96,15 +94,11 @@ jobs:
curl -Lo ncnn-shared.zip "https://github.com/Tencent/ncnn/releases/download/$ncnnVersion/ncnn-$ncnnVersion-windows-vs2022-shared.zip" curl -Lo ncnn-shared.zip "https://github.com/Tencent/ncnn/releases/download/$ncnnVersion/ncnn-$ncnnVersion-windows-vs2022-shared.zip"
Expand-Archive -Path ncnn-shared.zip -DestinationPath third_party Expand-Archive -Path ncnn-shared.zip -DestinationPath third_party
Rename-Item -Path "third_party/ncnn-$ncnnVersion-windows-vs2022-shared" -NewName ncnn-shared Rename-Item -Path "third_party/ncnn-$ncnnVersion-windows-vs2022-shared" -NewName ncnn-shared
curl -Lo opencv-shared.exe "https://github.com/opencv/opencv/releases/download/$opencvVersion/opencv-$opencvVersion-windows.exe"
7z x opencv-shared.exe -y
Move-Item -Path opencv -Destination third_party\opencv-shared
- name: Build Video2X - name: Build Video2X
shell: pwsh shell: pwsh
run: | run: |
cmake -S . -B build ` cmake -S . -B build `
-DUSE_SYSTEM_NCNN=OFF -DUSE_SYSTEM_SPDLOG=OFF -DUSE_SYSTEM_OPENCV=OFF -DUSE_SYSTEM_BOOST=OFF ` -DUSE_SYSTEM_NCNN=OFF -DUSE_SYSTEM_SPDLOG=OFF -DUSE_SYSTEM_BOOST=OFF `
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=build/video2x_install -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=build/video2x_install
cmake --build build --config Release --parallel --target install cmake --build build --config Release --parallel --target install
- name: Compress artifacts - name: Compress artifacts

3
.gitmodules vendored
View File

@ -7,9 +7,6 @@
[submodule "third_party/spdlog"] [submodule "third_party/spdlog"]
path = third_party/spdlog path = third_party/spdlog
url = https://github.com/gabime/spdlog.git url = https://github.com/gabime/spdlog.git
[submodule "third_party/opencv"]
path = third_party/opencv
url = https://github.com/opencv/opencv.git
[submodule "third_party/boost"] [submodule "third_party/boost"]
path = third_party/boost path = third_party/boost
url = https://github.com/boostorg/boost.git url = https://github.com/boostorg/boost.git

View File

@ -32,7 +32,6 @@ endif()
# Build options # Build options
option(BUILD_SHARED_LIBS "Build libvideo2x as a shared library" ON) option(BUILD_SHARED_LIBS "Build libvideo2x as a shared library" ON)
option(BUILD_VIDEO2X_CLI "Build the video2x executable" ON) option(BUILD_VIDEO2X_CLI "Build the video2x executable" ON)
option(USE_SYSTEM_OPENCV "Use system OpenCV library" ON)
option(USE_SYSTEM_NCNN "Use system ncnn library" ON) option(USE_SYSTEM_NCNN "Use system ncnn library" ON)
option(USE_SYSTEM_SPDLOG "Use system spdlog library" ON) option(USE_SYSTEM_SPDLOG "Use system spdlog library" ON)
option(USE_SYSTEM_BOOST "Use system Boost library" ON) option(USE_SYSTEM_BOOST "Use system Boost library" ON)
@ -53,7 +52,6 @@ if(WIN32)
# Define base paths for FFmpeg and ncnn # Define base paths for FFmpeg and ncnn
set(FFMPEG_BASE_PATH ${PROJECT_SOURCE_DIR}/third_party/ffmpeg-shared) set(FFMPEG_BASE_PATH ${PROJECT_SOURCE_DIR}/third_party/ffmpeg-shared)
set(NCNN_BASE_PATH ${PROJECT_SOURCE_DIR}/third_party/ncnn-shared/x64) set(NCNN_BASE_PATH ${PROJECT_SOURCE_DIR}/third_party/ncnn-shared/x64)
set(OPENCV_BASE_PATH ${PROJECT_SOURCE_DIR}/third_party/opencv-shared)
# FFmpeg # FFmpeg
set(FFMPEG_LIB set(FFMPEG_LIB
@ -83,10 +81,6 @@ if(WIN32)
${SPIRV_LIB} ${SPIRV_LIB}
) )
list(APPEND ALL_INCLUDE_DIRS ${NCNN_BASE_PATH}/include/ncnn) list(APPEND ALL_INCLUDE_DIRS ${NCNN_BASE_PATH}/include/ncnn)
# OpenCV
# list(APPEND ALL_LIBRARIES ${OPENCV_BASE_PATH}/build/x64/vc16/lib/opencv_world4100.lib)
list(APPEND ALL_INCLUDE_DIRS ${OPENCV_BASE_PATH}/build/include)
else() else()
# FFmpeg # FFmpeg
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
@ -107,54 +101,6 @@ else()
list(APPEND FFMPEG_LIB ${${PKG}_LIBRARIES}) list(APPEND FFMPEG_LIB ${${PKG}_LIBRARIES})
endforeach() endforeach()
list(APPEND ALL_LIBRARIES ${FFMPEG_LIB}) list(APPEND ALL_LIBRARIES ${FFMPEG_LIB})
# OpenCV
if (USE_SYSTEM_OPENCV)
find_package(OpenCV REQUIRED)
list(APPEND ALL_INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS}/opencv2)
# list(APPEND ALL_LIBRARIES opencv_core opencv_videoio)
else()
option(BUILD_opencv_calib3d "" OFF)
option(BUILD_opencv_core "" ON)
option(BUILD_opencv_dnn "" OFF)
option(BUILD_opencv_features2d "" OFF)
option(BUILD_opencv_flann "" OFF)
option(BUILD_opencv_gapi "" OFF)
option(BUILD_opencv_highgui "" OFF)
option(BUILD_opencv_imgcodecs "" OFF)
option(BUILD_opencv_imgproc "" OFF)
option(BUILD_opencv_java "" OFF)
option(BUILD_opencv_js "" OFF)
option(BUILD_opencv_ml "" OFF)
option(BUILD_opencv_objc "" OFF)
option(BUILD_opencv_objdetect "" OFF)
option(BUILD_opencv_photo "" OFF)
option(BUILD_opencv_python "" OFF)
option(BUILD_opencv_python2 "" OFF)
option(BUILD_opencv_python3 "" OFF)
option(BUILD_opencv_stitching "" OFF)
option(BUILD_opencv_ts "" OFF)
option(BUILD_opencv_video "" OFF)
option(BUILD_opencv_videoio "" ON)
option(BUILD_opencv_world "" OFF)
option(WITH_PNG "" OFF)
option(WITH_JPEG "" OFF)
option(WITH_TIFF "" OFF)
option(WITH_WEBP "" OFF)
option(WITH_OPENJPEG "" OFF)
option(WITH_JASPER "" OFF)
option(WITH_OPENEXR "" OFF)
option(WITH_IMGCODEC "" OFF)
add_subdirectory(third_party/opencv)
list(APPEND ALL_INCLUDE_DIRS
${PROJECT_SOURCE_DIR}/third_party/opencv/include
${PROJECT_SOURCE_DIR}/third_party/opencv/modules/core/include
${PROJECT_SOURCE_DIR}/third_party/opencv/modules/videoio/include
)
# list(APPEND ALL_LIBRARIES opencv_core opencv_videoio)
endif() # USE_SYSTEM_OPENCV
endif() # WIN32 endif() # WIN32
# Find ncnn package # Find ncnn package
@ -397,10 +343,6 @@ else()
set(MODEL_DESTINATION_DEFAULT "share/video2x") set(MODEL_DESTINATION_DEFAULT "share/video2x")
endif() endif()
# Explicitly set the output paths since OpenCV changes these variables
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
# Set the installation directories # Set the installation directories
set(INSTALL_BIN_DESTINATION ${BIN_DESTINATION_DEFAULT} CACHE STRING "") set(INSTALL_BIN_DESTINATION ${BIN_DESTINATION_DEFAULT} CACHE STRING "")
set(INSTALL_INCLUDE_DESTINATION ${INCLUDE_DESTINATION_DEFAULT} CACHE STRING "") set(INSTALL_INCLUDE_DESTINATION ${INCLUDE_DESTINATION_DEFAULT} CACHE STRING "")
@ -447,8 +389,6 @@ if(WIN32)
install(FILES install(FILES
${CMAKE_BINARY_DIR}/realesrgan_install/bin/librealesrgan-ncnn-vulkan.dll ${CMAKE_BINARY_DIR}/realesrgan_install/bin/librealesrgan-ncnn-vulkan.dll
${FFMPEG_DLLS} ${FFMPEG_DLLS}
# ${OPENCV_BASE_PATH}/build/x64/vc16/bin/opencv_world4100.dll
# ${OPENCV_BASE_PATH}/build/x64/vc16/bin/opencv_videoio_msmf4100_64.dll
${NCNN_BASE_PATH}/bin/ncnn.dll ${NCNN_BASE_PATH}/bin/ncnn.dll
${BOOST_DLL_PATH} ${BOOST_DLL_PATH}
DESTINATION ${INSTALL_BIN_DESTINATION} DESTINATION ${INSTALL_BIN_DESTINATION}

View File

@ -41,7 +41,6 @@ debug:
windows: windows:
cmake -S . -B $(BINDIR) \ cmake -S . -B $(BINDIR) \
-DUSE_SYSTEM_NCNN=OFF \ -DUSE_SYSTEM_NCNN=OFF \
-DUSE_SYSTEM_OPENCV=OFF \
-DUSE_SYSTEM_SPDLOG=OFF \ -DUSE_SYSTEM_SPDLOG=OFF \
-DUSE_SYSTEM_BOOST=OFF \ -DUSE_SYSTEM_BOOST=OFF \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
@ -51,7 +50,6 @@ windows:
windows-debug: windows-debug:
cmake -S . -B $(BINDIR) \ cmake -S . -B $(BINDIR) \
-DUSE_SYSTEM_NCNN=OFF \ -DUSE_SYSTEM_NCNN=OFF \
-DUSE_SYSTEM_OPENCV=OFF \
-DUSE_SYSTEM_SPDLOG=OFF \ -DUSE_SYSTEM_SPDLOG=OFF \
-DUSE_SYSTEM_BOOST=OFF \ -DUSE_SYSTEM_BOOST=OFF \
-DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_BUILD_TYPE=Debug \
@ -72,7 +70,6 @@ debian:
glslang-tools \ glslang-tools \
libomp-dev \ libomp-dev \
libspdlog-dev \ libspdlog-dev \
libopencv-dev \
libboost-program-options-dev libboost-program-options-dev
cmake -B /tmp/build -S . -DUSE_SYSTEM_NCNN=OFF \ cmake -B /tmp/build -S . -DUSE_SYSTEM_NCNN=OFF \
-DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX) \ -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX) \
@ -94,7 +91,6 @@ ubuntu2404:
libvulkan-dev \ libvulkan-dev \
glslang-tools \ glslang-tools \
libomp-dev \ libomp-dev \
libopencv-dev \
libboost-program-options-dev libboost-program-options-dev
cmake -B build -S . -DUSE_SYSTEM_NCNN=OFF -DUSE_SYSTEM_SPDLOG=OFF -DSPDLOG_NO_EXCEPTIONS=ON \ cmake -B build -S . -DUSE_SYSTEM_NCNN=OFF -DUSE_SYSTEM_SPDLOG=OFF -DSPDLOG_NO_EXCEPTIONS=ON \
-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ \ -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ \
@ -120,7 +116,6 @@ ubuntu2204:
libvulkan-dev \ libvulkan-dev \
glslang-tools \ glslang-tools \
libomp-dev \ libomp-dev \
libopencv-dev \
libboost-program-options-dev libboost-program-options-dev
cmake -B build -S . -DUSE_SYSTEM_NCNN=OFF -DUSE_SYSTEM_SPDLOG=OFF -DSPDLOG_NO_EXCEPTIONS=ON \ cmake -B build -S . -DUSE_SYSTEM_NCNN=OFF -DUSE_SYSTEM_SPDLOG=OFF -DSPDLOG_NO_EXCEPTIONS=ON \
-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ \ -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ \

View File

@ -5,7 +5,7 @@ pkgdesc="A machine learning-based lossless video super resolution framework"
arch=('x86_64') arch=('x86_64')
url="https://github.com/k4yt3x/video2x" url="https://github.com/k4yt3x/video2x"
license=('AGPL3') license=('AGPL3')
depends=('ffmpeg' 'ncnn' 'vulkan-driver' 'opencv' 'spdlog' 'boost-libs') depends=('ffmpeg' 'ncnn' 'vulkan-driver' 'spdlog' 'boost-libs')
makedepends=('git' 'cmake' 'make' 'clang' 'pkgconf' 'vulkan-headers' 'openmp' 'boost') makedepends=('git' 'cmake' 'make' 'clang' 'pkgconf' 'vulkan-headers' 'openmp' 'boost')
pkgver() { pkgver() {

View File

@ -9,7 +9,7 @@ FROM docker.io/archlinux:latest AS builder
# Install dependencies and create a non-root user # Install dependencies and create a non-root user
RUN pacman -Syy --noconfirm \ RUN pacman -Syy --noconfirm \
base-devel git cmake make clang pkgconf sudo \ base-devel git cmake make clang pkgconf sudo \
ffmpeg ncnn vulkan-headers openmp spdlog opencv boost \ ffmpeg ncnn vulkan-headers openmp spdlog boost \
nvidia-utils vulkan-radeon vulkan-intel vulkan-swrast \ nvidia-utils vulkan-radeon vulkan-intel vulkan-swrast \
&& useradd -m builder \ && useradd -m builder \
&& echo 'builder ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/builder && echo 'builder ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/builder
@ -38,7 +38,7 @@ ENV VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json\
COPY --from=builder /tmp/video2x.pkg.tar.zst /video2x.pkg.tar.zst COPY --from=builder /tmp/video2x.pkg.tar.zst /video2x.pkg.tar.zst
RUN pacman -Sy --noconfirm nvidia-utils vulkan-radeon vulkan-intel vulkan-swrast \ RUN pacman -Sy --noconfirm nvidia-utils vulkan-radeon vulkan-intel vulkan-swrast \
ffmpeg ncnn spdlog opencv boost-libs \ ffmpeg ncnn spdlog boost-libs \
&& pacman -U --noconfirm /video2x.pkg.tar.zst \ && pacman -U --noconfirm /video2x.pkg.tar.zst \
&& rm -rf /video2x.pkg.tar.zst /var/cache/pacman/pkg/* && rm -rf /video2x.pkg.tar.zst /var/cache/pacman/pkg/*

1
third_party/opencv vendored

@ -1 +0,0 @@
Subproject commit 71d3237a093b60a27601c20e9ee6c3e52154e8b1