Skip to content

Commit

Permalink
media-video/video2x: add 6.2.0, drop 6.1.1
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Udvare <[email protected]>
  • Loading branch information
Tatsh committed Dec 17, 2024
1 parent 7378646 commit a344157
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 26 deletions.
7 changes: 4 additions & 3 deletions media-video/video2x/Manifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
AUX video2x-0001-build-system-fix.patch 3173 BLAKE2B b362698ef29b2798c2e7a889ee58342018857773fe35fac599898113d21dea607567044bfd16d379adee7ab8a6e17c837227d49591d4d7fec6ed1190ca287ff6 SHA512 2b7ff07a2fd047cfb09d1b007d94596f7beb79059075db054fbb77694baf6ed7370bd0da262c97a7d3bb436c64adbdac04168fea3ee02f9bda02cbc1f913ba23
DIST video2x-6.1.1.tar.gz 43812298 BLAKE2B d885be849922e29d70f8eee5b3e72c31a0a3baed96783bfa081040718bb0764f63c38fc59a9397352c5d97ed365284eaf75889a049d2ed43134b78de5e7d61c4 SHA512 57a9ddf74648377ca17bf07a87d499e54473605a01909cfd229f5d10c9ca0255c9b946020aa59f703449d146978440e73dd1ccad3da1d03a967156ac68a9b274
AUX video2x-0001-build-system-fix.patch 5577 BLAKE2B ebc69780b973691183089373fadf04d5abff03d5f76d9ee3dc367a9a370638352e29e3932eae6c9ff95bdecc60c70ed6400396445e06aa8c9ce96e9ca4ca3c54 SHA512 c7937896e2569ab2d0226656a25d7a94b72fa475be2079c267dcf1386e68307333e983af8dafbeecfd3bf9eb7e2b801782ea09ecef3f6684a8f9d6ba06812839
DIST video2x-6.2.0.tar.gz 472079658 BLAKE2B 70a9fd6b53fc2a288c879c5697b11b87bda9116b82848a5c6bb904fabb9c114ff7c8d4db27c39a6d0e1b41ce473a9cc2c141fce96990db9525d573eb4e0f0d23 SHA512 b14d72243541848431866c51e9ede5ec7bcd31a63b8b49d0cc5b2f4aecb6a54dbb35b9d21ef6d14746b616768449ac0f7e486fccfd8a17408ddc57cec6c78de4
DIST video2x-libreal-esrgan-ncnn-vulkan-cd68df6f98f036fcc9e7d63597ea6faa427c2d2d.tar.gz 108374 BLAKE2B d7736dc1da75a59c267d40e51445a382d97708a02d760517492dc23a9cdf5b4b7195597aba9660bfe94b3e175f3cddaf3c67eea61b6acbc69f638b8bcf75b634 SHA512 8de2688c9b410911e253269f0456991334335e217ffcdf925dcfef563ab376a1d92179ddf82b5e8334f30bf51b16e0d0cf5d7c8b8af5e4e687e83a19f2bd7b50
EBUILD video2x-6.1.1.ebuild 1410 BLAKE2B f52fa8af9bf182fdd4aa3326684fda8aef7408695b15069f34e0209f51c9bff1f6ec71cae05619cd185f48b1bc808081f7573e110725a324b70b7a3e2c64d110 SHA512 8b22dd1bc6e8ac9083366812880374f32036352948adf0cd3f985bf829a1f00e8042339041e6a33200ae6d887ab3495cc89f4b090f2a9ea10fd1dbdf791294d0
DIST video2x-librife-ncnn-vulkan-f2edda49a5fd817a7137509e54e70d2e30d9b684.tar.gz 428382218 BLAKE2B c5a79ba3e3729cadb03d6162e12a28e6afafaf427b2a5b78e9741ca0fc35b667b13baf799691d76d51d81d420ddc6712936ea3c491b3573a519d650848cb3b45 SHA512 73933e67757bb92ab7ee6f56203ee4d47f5dd3437505fb9b83ef82221e01605711f7a47765446e668787ef234c259cd0574bb8f9f03354c2a1be38d08b9d8d5b
EBUILD video2x-6.2.0.ebuild 1779 BLAKE2B d74dc41c5faa4e37408792218568fe5412df6b36a4408f5704c05491a3ae201a784816bb4b683f9087a568009bc0dd2ae97801a3702ceaa6c27eb3cee2a07729 SHA512 5e1329966742b8f6c33db15eb0a5114ee66958809d86a793c5bd0f18d825ffcc730986e73e0dad7c6a2aca0274559483914dbe5e6cb8c2faedaede3fe176e294
MISC livecheck.json 52 BLAKE2B 0d59afccac4e1597d98fbda28bdeaf754940154b45d5ca0831f10e7dab90423befb11e2a5c56fe99d27ead33c4e79470d7fc0e269497beb573a2fdab1d64718f SHA512 73057960b1add426098a2142f32e29efd77a3c3359eb81186fd63ea0952755277eb733555278c59cb586bd03a6faf3d5fed0d2a378775d204d95e542eb0eae70
MISC metadata.xml 325 BLAKE2B 0ea7eb006fca13b5515153f44c1f20a4e5cece7344b0054a42e0281e07863b9179c6cba1a02752a14911721580748ad5a43eddf6008dc431b85cbc032eb77e68 SHA512 7c2ed36f4fb21ebac801eb4868f297b4723d4dff68f5aa4c742fcba16209bfc38955adea3ed300e5e2f6b780c95a74c974258c61b2172f48c9307f49286310bd
113 changes: 95 additions & 18 deletions media-video/video2x/files/video2x-0001-build-system-fix.patch
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
From f4729f9b6daeb7d4c1c92933cc5cfc2bd8653945 Mon Sep 17 00:00:00 2001
From ad838fbabc820a99c5d4ceb3102e82a0d9bfd499 Mon Sep 17 00:00:00 2001
From: Andrew Udvare <[email protected]>
Date: Sun, 27 Oct 2024 06:08:21 -0400
Subject: [PATCH] Build system fix

---
CMakeLists.txt | 35 +++++------------------------------
1 file changed, 5 insertions(+), 30 deletions(-)
CMakeLists.txt | 52 ++++++----------------------------
src/encoder.cpp | 1 +
tools/video2x/src/argparse.cpp | 28 +-----------------
3 files changed, 10 insertions(+), 71 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6d0035b..9d2f1c1 100644
index 3307f8a..c0a274a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -256,6 +256,8 @@ else()
@@ -206,6 +206,9 @@ else()
add_subdirectory(third_party/ncnn)
endif()

+add_subdirectory(third_party/realesrgan)
+add_subdirectory(third_party/rife)
+
# spdlog
if (USE_SYSTEM_SPDLOG)
if(USE_SYSTEM_SPDLOG)
find_package(spdlog REQUIRED)
@@ -287,22 +289,6 @@ if (BUILD_VIDEO2X_CLI)
@@ -237,35 +240,6 @@ if(BUILD_VIDEO2X_CLI)
set(VULKAN_LIB Vulkan::Vulkan)
endif()

Expand All @@ -39,16 +42,29 @@ index 6d0035b..9d2f1c1 100644
- BUILD_ALWAYS ON
- INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config ${CMAKE_BUILD_TYPE}
-)
-
-# Add librealesrgan-ncnn-vulkan as an external project
-ExternalProject_Add(
- rife
- SOURCE_DIR ${PROJECT_SOURCE_DIR}/third_party/librife_ncnn_vulkan/src
- CMAKE_ARGS
- -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
- -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/rife_install
- -DCMAKE_POSITION_INDEPENDENT_CODE=ON
- -DUSE_SYSTEM_NCNN=${USE_SYSTEM_NCNN}
- BUILD_ALWAYS ON
- INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config ${CMAKE_BUILD_TYPE}
-)
-
# Remove duplicate entries
list(REMOVE_DUPLICATES ALL_INCLUDE_DIRS)
list(REMOVE_DUPLICATES ALL_LIBRARIES)
@@ -325,16 +311,13 @@ else()
@@ -280,17 +254,14 @@ else()
set_target_properties(libvideo2x PROPERTIES OUTPUT_NAME video2x)
endif()

-# Ensure libvideo2x depends on realesrgan being built and installed
-add_dependencies(libvideo2x realesrgan)
-# Ensure that the shared library is built after the external projects
-add_dependencies(libvideo2x realesrgan rife)
-
# Include directories for the shared library
target_include_directories(libvideo2x PRIVATE
Expand All @@ -57,20 +73,24 @@ index 6d0035b..9d2f1c1 100644
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/include/libvideo2x
- ${PROJECT_SOURCE_DIR}/third_party/librealesrgan_ncnn_vulkan/src
- ${PROJECT_SOURCE_DIR}/third_party/librife_ncnn_vulkan/src
+ ${PROJECT_SOURCE_DIR}/third_party/realesrgan
+ ${PROJECT_SOURCE_DIR}/third_party/rife
)

# Compile options for the shared library
@@ -349,7 +332,7 @@ if(WIN32)
@@ -305,8 +276,8 @@ if(WIN32)
set(REALESRGAN_LIB ${CMAKE_BINARY_DIR}/realesrgan_install/lib/librealesrgan-ncnn-vulkan.lib)
list(APPEND ALL_LIBRARIES ${REALESRGAN_LIB})
set(RIFE_LIB ${CMAKE_BINARY_DIR}/rife_install/lib/librife-ncnn-vulkan.lib)
else()
- set(REALESRGAN_LIB ${CMAKE_BINARY_DIR}/realesrgan_install/lib/librealesrgan-ncnn-vulkan.so)
- set(RIFE_LIB ${CMAKE_BINARY_DIR}/rife_install/lib/librife-ncnn-vulkan.so)
+ set(REALESRGAN_LIB ${CMAKE_BINARY_DIR}/third_party/realesrgan/librealesrgan-ncnn-vulkan.so)
list(APPEND ALL_LIBRARIES ${REALESRGAN_LIB})
+ set(RIFE_LIB ${CMAKE_BINARY_DIR}/third_party/rife/librife-ncnn-vulkan.so)
endif()
list(APPEND ALL_LIBRARIES ${REALESRGAN_LIB} ${RIFE_LIB})

@@ -399,7 +382,7 @@ if(WIN32)
@@ -357,7 +328,7 @@ if(WIN32)
else()
set(BIN_DESTINATION_DEFAULT "bin")
set(INCLUDE_DESTINATION_DEFAULT "include/libvideo2x")
Expand All @@ -79,19 +99,76 @@ index 6d0035b..9d2f1c1 100644
set(MODEL_DESTINATION_DEFAULT "share/video2x")
endif()

@@ -467,12 +450,4 @@ if(WIN32)
@@ -413,11 +384,4 @@ if(WIN32)
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)
-else()
- # Install Unix-specific dependencies
- install(FILES ${REALESRGAN_LIB}
- install(FILES ${REALESRGAN_LIB} ${RIFE_LIB}
- DESTINATION ${INSTALL_LIB_DESTINATION}
- PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
- GROUP_READ GROUP_EXECUTE
- WORLD_READ WORLD_EXECUTE
- )
endif()
diff --git a/src/encoder.cpp b/src/encoder.cpp
index cf1195f..edeb642 100644
--- a/src/encoder.cpp
+++ b/src/encoder.cpp
@@ -8,6 +8,7 @@ extern "C" {

#include "avutils.h"
#include "conversions.h"
+#include "libvideo2x/fsutils.h"

Encoder::Encoder()
: ofmt_ctx_(nullptr), enc_ctx_(nullptr), out_vstream_idx_(-1), stream_map_(nullptr) {}
diff --git a/tools/video2x/src/argparse.cpp b/tools/video2x/src/argparse.cpp
index ff9b532..8c52707 100644
--- a/tools/video2x/src/argparse.cpp
+++ b/tools/video2x/src/argparse.cpp
@@ -12,6 +12,7 @@
#include <vulkan_utils.h>
#include <boost/program_options.hpp>

+#include "libvideo2x/fsutils.h"
#include "logging.h"
#include "validators.h"

@@ -24,33 +25,6 @@

namespace po = boost::program_options;

-#ifdef _WIN32
-std::string wstring_to_u8string(const std::wstring &wstr) {
- if (wstr.empty()) {
- return std::string();
- }
- int size_needed = WideCharToMultiByte(
- CP_UTF8, 0, wstr.data(), static_cast<int>(wstr.size()), nullptr, 0, nullptr, nullptr
- );
- std::string converted_str(size_needed, 0);
- WideCharToMultiByte(
- CP_UTF8,
- 0,
- wstr.data(),
- static_cast<int>(wstr.size()),
- &converted_str[0],
- size_needed,
- nullptr,
- nullptr
- );
- return converted_str;
-}
-#else
-std::string wstring_to_u8string(const std::string &str) {
- return str;
-}
-#endif
-
int parse_args(
int argc,
#ifdef _WIN32
--
2.47.0
2.47.1

Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ inherit cmake
DESCRIPTION="A lossless video/GIF/image upscaler."
HOMEPAGE="https://video2x.org/ https://github.com/k4yt3x/video2x"
LIBREAL_ESRGAN_NCNN_VULKAN_SHA="cd68df6f98f036fcc9e7d63597ea6faa427c2d2d"
LIBRIFE_NCNN_VULKAN_SHA="f2edda49a5fd817a7137509e54e70d2e30d9b684"
SRC_URI="https://github.com/k4yt3x/${PN}/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz
https://github.com/k4yt3x/libreal-esrgan-ncnn-vulkan/archive/${LIBREAL_ESRGAN_NCNN_VULKAN_SHA}.tar.gz -> ${PN}-libreal-esrgan-ncnn-vulkan-${LIBREAL_ESRGAN_NCNN_VULKAN_SHA}.tar.gz"
https://github.com/k4yt3x/libreal-esrgan-ncnn-vulkan/archive/${LIBREAL_ESRGAN_NCNN_VULKAN_SHA}.tar.gz -> ${PN}-libreal-esrgan-ncnn-vulkan-${LIBREAL_ESRGAN_NCNN_VULKAN_SHA}.tar.gz
https://github.com/k4yt3x/librife-ncnn-vulkan/archive/${LIBRIFE_NCNN_VULKAN_SHA}.tar.gz -> ${PN}-librife-ncnn-vulkan-${LIBRIFE_NCNN_VULKAN_SHA}.tar.gz"

LICENSE="GPL-3 LGPL-3"
SLOT="0"
Expand All @@ -26,19 +28,19 @@ DEPEND="dev-libs/boost:=
PATCHES=( "${FILESDIR}/${PN}-0001-build-system-fix.patch" )

src_prepare() {
rmdir "${S}/third_party/librealesrgan_ncnn_vulkan" || die
rmdir "${S}/third_party/lib"{realesrgan,rife}_ncnn_vulkan || die
mv "${WORKDIR}/librealesrgan-ncnn-vulkan-${LIBREAL_ESRGAN_NCNN_VULKAN_SHA}/src" "${S}/third_party/realesrgan" || die
sed -re 's/(LIBRARY|ARCHIVE) DESTINATION lib/\1 DESTINATION lib64/' -i third_party/realesrgan/CMakeLists.txt || die
mv "${WORKDIR}/librife-ncnn-vulkan-${LIBRIFE_NCNN_VULKAN_SHA}/src" "${S}/third_party/rife" || die
sed -re 's/(LIBRARY|ARCHIVE) DESTINATION lib/\1 DESTINATION lib64/' -i third_party/{realesrgan,rife}/CMakeLists.txt || die
sed -re 's/generate-spirv/generate-spirv2/g' -i third_party/rife/CMakeLists.txt || die
cmake_src_prepare
}

src_configure() {
local mycmakeargs=(
-DBUILD_SHARED_LIBS=OFF
-DBUILD_STATIC_LIBS=OFF
-DUSE_SYSTEM_BOOST=ON
-DUSE_SYSTEM_NCNN=ON
-DUSE_SYSTEM_OPENCV=ON
-DUSE_SYSTEM_SPDLOG=ON
-Wno-dev
)
Expand Down

0 comments on commit a344157

Please sign in to comment.