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 \
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

View File

@ -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

3
.gitmodules vendored
View File

@ -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

View File

@ -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}

View File

@ -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++ \

View File

@ -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() {

View File

@ -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/*

1
third_party/opencv vendored

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