From b520d51c6c2f6a542fb7748f198cf670870b1c0c Mon Sep 17 00:00:00 2001 From: k4yt3x Date: Wed, 13 Nov 2024 00:00:00 +0000 Subject: [PATCH] chore: removed OpenCV dependency Signed-off-by: k4yt3x --- .github/workflows/build.yml | 8 +---- .github/workflows/release.yml | 8 +---- .gitmodules | 3 -- CMakeLists.txt | 60 ----------------------------------- Makefile | 5 --- packaging/arch/PKGBUILD | 2 +- packaging/docker/Dockerfile | 4 +-- third_party/opencv | 1 - 8 files changed, 5 insertions(+), 86 deletions(-) delete mode 160000 third_party/opencv diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7a9dcfd..d385719 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,7 +38,6 @@ jobs: libvulkan-dev \ glslang-tools \ libomp-dev \ - libopencv-dev \ libboost-program-options-dev - name: Build Video2X run: | @@ -73,7 +72,6 @@ jobs: run: | $ffmpegVersion = "7.1" $ncnnVersion = "20240820" - $opencvVersion = "4.10.0" 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" Expand-Archive -Path ncnn-shared.zip -DestinationPath third_party 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 shell: pwsh run: | 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 cmake --build build --config Debug --parallel --target install - name: Upload artifacts diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c151a73..25673a0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,7 +47,6 @@ jobs: libvulkan-dev \ glslang-tools \ libomp-dev \ - libopencv-dev \ libboost-program-options-dev - name: Build Video2X run: | @@ -85,7 +84,6 @@ jobs: run: | $ffmpegVersion = "7.1" $ncnnVersion = "20240820" - $opencvVersion = "4.10.0" 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" Expand-Archive -Path ncnn-shared.zip -DestinationPath third_party 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 shell: pwsh run: | 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 cmake --build build --config Release --parallel --target install - name: Compress artifacts diff --git a/.gitmodules b/.gitmodules index 857e1f1..8f5e9a1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,9 +7,6 @@ [submodule "third_party/spdlog"] path = third_party/spdlog 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"] path = third_party/boost url = https://github.com/boostorg/boost.git diff --git a/CMakeLists.txt b/CMakeLists.txt index c29d728..ef450f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +32,6 @@ endif() # Build options option(BUILD_SHARED_LIBS "Build libvideo2x as a shared library" 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_SPDLOG "Use system spdlog library" ON) option(USE_SYSTEM_BOOST "Use system Boost library" ON) @@ -53,7 +52,6 @@ if(WIN32) # Define base paths for FFmpeg and ncnn set(FFMPEG_BASE_PATH ${PROJECT_SOURCE_DIR}/third_party/ffmpeg-shared) set(NCNN_BASE_PATH ${PROJECT_SOURCE_DIR}/third_party/ncnn-shared/x64) - set(OPENCV_BASE_PATH ${PROJECT_SOURCE_DIR}/third_party/opencv-shared) # FFmpeg set(FFMPEG_LIB @@ -83,10 +81,6 @@ if(WIN32) ${SPIRV_LIB} ) 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() # FFmpeg find_package(PkgConfig REQUIRED) @@ -107,54 +101,6 @@ else() list(APPEND FFMPEG_LIB ${${PKG}_LIBRARIES}) endforeach() 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 # Find ncnn package @@ -397,10 +343,6 @@ else() set(MODEL_DESTINATION_DEFAULT "share/video2x") 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(INSTALL_BIN_DESTINATION ${BIN_DESTINATION_DEFAULT} CACHE STRING "") set(INSTALL_INCLUDE_DESTINATION ${INCLUDE_DESTINATION_DEFAULT} CACHE STRING "") @@ -447,8 +389,6 @@ if(WIN32) install(FILES ${CMAKE_BINARY_DIR}/realesrgan_install/bin/librealesrgan-ncnn-vulkan.dll ${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 ${BOOST_DLL_PATH} DESTINATION ${INSTALL_BIN_DESTINATION} diff --git a/Makefile b/Makefile index 9e1b02b..e40e061 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,6 @@ debug: windows: cmake -S . -B $(BINDIR) \ -DUSE_SYSTEM_NCNN=OFF \ - -DUSE_SYSTEM_OPENCV=OFF \ -DUSE_SYSTEM_SPDLOG=OFF \ -DUSE_SYSTEM_BOOST=OFF \ -DCMAKE_BUILD_TYPE=Release \ @@ -51,7 +50,6 @@ windows: windows-debug: cmake -S . -B $(BINDIR) \ -DUSE_SYSTEM_NCNN=OFF \ - -DUSE_SYSTEM_OPENCV=OFF \ -DUSE_SYSTEM_SPDLOG=OFF \ -DUSE_SYSTEM_BOOST=OFF \ -DCMAKE_BUILD_TYPE=Debug \ @@ -72,7 +70,6 @@ debian: glslang-tools \ libomp-dev \ libspdlog-dev \ - libopencv-dev \ libboost-program-options-dev cmake -B /tmp/build -S . -DUSE_SYSTEM_NCNN=OFF \ -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX) \ @@ -94,7 +91,6 @@ ubuntu2404: libvulkan-dev \ glslang-tools \ libomp-dev \ - libopencv-dev \ libboost-program-options-dev cmake -B build -S . -DUSE_SYSTEM_NCNN=OFF -DUSE_SYSTEM_SPDLOG=OFF -DSPDLOG_NO_EXCEPTIONS=ON \ -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ \ @@ -120,7 +116,6 @@ ubuntu2204: libvulkan-dev \ glslang-tools \ libomp-dev \ - libopencv-dev \ libboost-program-options-dev cmake -B build -S . -DUSE_SYSTEM_NCNN=OFF -DUSE_SYSTEM_SPDLOG=OFF -DSPDLOG_NO_EXCEPTIONS=ON \ -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ \ diff --git a/packaging/arch/PKGBUILD b/packaging/arch/PKGBUILD index 646f755..7890388 100644 --- a/packaging/arch/PKGBUILD +++ b/packaging/arch/PKGBUILD @@ -5,7 +5,7 @@ pkgdesc="A machine learning-based lossless video super resolution framework" arch=('x86_64') url="https://github.com/k4yt3x/video2x" 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') pkgver() { diff --git a/packaging/docker/Dockerfile b/packaging/docker/Dockerfile index d0396d7..673d916 100644 --- a/packaging/docker/Dockerfile +++ b/packaging/docker/Dockerfile @@ -9,7 +9,7 @@ FROM docker.io/archlinux:latest AS builder # Install dependencies and create a non-root user RUN pacman -Syy --noconfirm \ 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 \ && useradd -m 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 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 \ && rm -rf /video2x.pkg.tar.zst /var/cache/pacman/pkg/* diff --git a/third_party/opencv b/third_party/opencv deleted file mode 160000 index 71d3237..0000000 --- a/third_party/opencv +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 71d3237a093b60a27601c20e9ee6c3e52154e8b1