用NCNN和Vulkan实现的Waifu2x的动态链接库版本
即开即用版:https://github.com/Aloento/YourWaifu2x
本库是 ArknightsAssetStudio 的一部分
Wrapper相关代码大多由 @zuoziqi 编写
对Waifu2x的介绍请参阅
https://github.com/nagadomi/waifu2x
对Waifu2x_NCNN_Vulkan的介绍请参阅
https://github.com/nihui/waifu2x-ncnn-vulkan
使用本库非常简单
假设我们的目标运行环境是 Windows10
-
安装最新的 Visual Studio 和 C++工具链
https://visualstudio.microsoft.com/zh-hans/downloads/ -
安装 CMake
scoop install cmake
或者从官网获取 https://cmake.org/download/ -
获取 Vulkan SDK
scoop install vulkan
或者从官网获取 https://vulkan.lunarg.com/
git clone [email protected]:Aloento/Waifu2x-Vulkan-Library.git
cd Waifu2x-Vulkan-Library
git submodule update --init --recursive
- 注释掉
wrapper.h
中的第12行,并将第11行解除注释 - 删除
CMakeLists.txt
中第229行的wrapper_wrap.cxx
- 进行编译
mkdir build
cd build
cmake ../src
cmake --build . -j 4
随后你将得到名为 libWaifu2x.dll
的文件
它可以通过任何Native方式加载,如JNA和P/Invoke
- 不需要对文件做任何更改
- 安装 swig
scoop install swig
或者从官网获取 http://www.swig.org/download.html
假设我们要生成给在Windows下C#使用的代码
cd src
swig -c++ -csharp wrapper_win.i
mkdir build
cd build
cmake ../
cmake --build . -j 4
随后,生成的*.cs
文件即可给C#项目使用
不要忘记复制生成的 libWaifu2x.dll
具体调用和使用范例请参阅
https://github.com/Aloento/Waifu2x-Vulkan-CSharp