3
0
Fork 0
forked from mirrors/nixpkgs

realesrgan-ncnn-vulkan: init at 0.1.3.2

realesrgan-ncnn-vulkan: formating improvements

Co-authored-by: Yannik Rödel <hey@yannik.info>

realesrgan-ncnn-vulkan: patch CMakeLists.txt

Co-authored-by: Yannik Rödel <hey@yannik.info>

realesrgan-ncnn-vulkan: Add models

realesrgan-ncnn-vulkan: Fix fetchzip

realesrgan-ncnn-vulkan: fix homepage url

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>

realesrgan-ncnn-vulkan: Remove second version
This commit is contained in:
tilcreator 2021-12-28 17:51:21 +01:00
parent 0fbb173703
commit 260bdcf048
4 changed files with 102 additions and 0 deletions

View file

@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a234caa..cd9d2c5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -114,6 +114,8 @@ if(USE_SYSTEM_NCNN)
include("${GLSLANG_TARGET_DIR}/HLSLTargets.cmake")
endif()
include("${GLSLANG_TARGET_DIR}/glslangTargets.cmake")
+ include("${GLSLANG_TARGET_DIR}/SPIRV-Tools/SPIRV-ToolsTarget.cmake")
+ include("${GLSLANG_TARGET_DIR}/SPIRV-Tools-opt/SPIRV-Tools-optTargets.cmake")
include("${GLSLANG_TARGET_DIR}/SPIRVTargets.cmake")
if (NOT TARGET glslang OR NOT TARGET SPIRV)

View file

@ -0,0 +1,65 @@
{ lib
, stdenv
, fetchzip
, fetchFromGitHub
, cmake
, spirv-headers
, vulkan-headers
, vulkan-loader
, glslang
, libgcc
, libwebp
, ncnn
}:
stdenv.mkDerivation rec {
pname = "Real-ESRGAN-ncnn-vulkan";
version = "0.1.3.2";
src = fetchFromGitHub {
owner = "xinntao";
repo = pname;
rev = "v${version}";
sha256 = "sha256-eLAIlOl1sUxijeVPFG+NscZGxDdtrQqVkMuxhegESHk=";
};
sourceRoot = "source/src";
models = fetchzip {
# Choose the newst release from https://github.com/xinntao/Real-ESRGAN/releases to update
url = "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.3.0/realesrgan-ncnn-vulkan-20211212-ubuntu.zip";
stripRoot = false;
sha256 = "sha256-17k6fewVEXxx7hi+vPXjHAOq4IIUHLh7WC80CwTeFKI=";
};
patches = [
./cmakelists.patch
./models_path.patch
];
cmakeFlags = [
"-DUSE_SYSTEM_NCNN=1"
"-DUSE_SYSTEM_WEBP=1"
"-DGLSLANG_TARGET_DIR=${glslang}/lib/cmake"
];
nativeBuildInputs = [ cmake ];
buildInputs = [ vulkan-headers vulkan-loader glslang libgcc libwebp ncnn ];
postPatch = ''
substituteInPlace main.cpp --replace REPLACE_MODELS $out/share/models
'';
installPhase = ''
mkdir -p $out/bin $out/share
cp realesrgan-ncnn-vulkan $out/bin/
cp -r ${models}/models $out/share
'';
meta = with lib; {
description = "NCNN implementation of Real-ESRGAN. Real-ESRGAN aims at developing Practical Algorithms for General Image Restoration.";
homepage = "https://github.com/xinntao/Real-ESRGAN-ncnn-vulkan";
license = licenses.mit;
maintainers = with maintainers; [ tilcreator ];
};
}

View file

@ -0,0 +1,22 @@
diff --git a/main.cpp b/main.cpp
index eb6f6c8..b230bed 100644
--- a/main.cpp
+++ b/main.cpp
@@ -110,7 +110,7 @@ static void print_usage()
fprintf(stderr, " -o output-path output image path (jpg/png/webp) or directory\n");
fprintf(stderr, " -s scale upscale ratio (can be 2, 4. default=4)\n");
fprintf(stderr, " -t tile-size tile size (>=32/0=auto, default=0) can be 0,0,0 for multi-gpu\n");
- fprintf(stderr, " -m model-path folder path to pre-trained models(default=models)\n");
+ fprintf(stderr, " -m model-path folder path to pre-trained models(default=REPLACE_MODELS)\n");
fprintf(stderr, " -n model-name model name (default=realesrgan-x4plus, can be realesrgan-x4plus | realesrgan-x4plus-anime | realesrnet-x4plus | RealESRGANv2-animevideo-xsx2 | RealESRGANv2-animevideo-xsx4 | RealESRGANv2-anime-xsx2 | RealESRGANv2-anime-xsx4)\n");
fprintf(stderr, " -g gpu-id gpu device to use (default=auto) can be 0,1,2 for multi-gpu\n");
fprintf(stderr, " -j load:proc:save thread count for load/proc/save (default=1:2:2) can be 1:2,2,2:2 for multi-gpu\n");
@@ -438,7 +438,7 @@ int main(int argc, char** argv)
path_t outputpath;
int scale = 4;
std::vector<int> tilesize;
- path_t model = PATHSTR("models");
+ path_t model = PATHSTR("REPLACE_MODELS");
path_t modelname = PATHSTR("realesrgan-x4plus");
std::vector<int> gpuid;
int jobs_load = 1;

View file

@ -9156,6 +9156,8 @@ with pkgs;
real_time_config_quick_scan = callPackage ../applications/audio/real_time_config_quick_scan { };
realesrgan-ncnn-vulkan = callPackage ../tools/graphics/realesrgan-ncnn-vulkan { };
react-native-debugger = callPackage ../development/tools/react-native-debugger { };
read-edid = callPackage ../os-specific/linux/read-edid { };