Spaces:
Sleeping
Sleeping
All files uploaded-1
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +20 -0
- NAFNetModel/.gitattributes +4 -0
- NAFNetModel/CMakeLists.txt +813 -0
- NAFNetModel/NAFNet/.gitignore +9 -0
- NAFNetModel/NAFNet/LICENSE +228 -0
- NAFNetModel/NAFNet/NAFNet-width64.yml +109 -0
- NAFNetModel/NAFNet/VERSION +1 -0
- NAFNetModel/NAFNet/app,py +26 -0
- NAFNetModel/NAFNet/basicsr.egg-info/PKG-INFO +16 -0
- NAFNetModel/NAFNet/basicsr.egg-info/SOURCES.txt +58 -0
- NAFNetModel/NAFNet/basicsr.egg-info/dependency_links.txt +1 -0
- NAFNetModel/NAFNet/basicsr.egg-info/desktop.ini +0 -0
- NAFNetModel/NAFNet/basicsr.egg-info/not-zip-safe +1 -0
- NAFNetModel/NAFNet/basicsr.egg-info/top_level.txt +1 -0
- NAFNetModel/NAFNet/basicsr/.ipynb_checkpoints/desktop.ini +0 -0
- NAFNetModel/NAFNet/basicsr/__init__.py +0 -0
- NAFNetModel/NAFNet/basicsr/__pycache__/__init__.cpython-310.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/__pycache__/__init__.cpython-311.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/__pycache__/__init__.cpython-312.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/__pycache__/desktop.ini +0 -0
- NAFNetModel/NAFNet/basicsr/__pycache__/train.cpython-310.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/__pycache__/train.cpython-312.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/__pycache__/version.cpython-310.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/__pycache__/version.cpython-312.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/data/__init__.py +135 -0
- NAFNetModel/NAFNet/basicsr/data/__pycache__/__init__.cpython-310.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/data/__pycache__/__init__.cpython-311.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/data/__pycache__/__init__.cpython-312.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/data/__pycache__/data_sampler.cpython-310.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/data/__pycache__/data_sampler.cpython-312.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/data/__pycache__/data_util.cpython-310.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/data/__pycache__/data_util.cpython-312.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/data/__pycache__/desktop.ini +0 -0
- NAFNetModel/NAFNet/basicsr/data/__pycache__/ffhq_dataset.cpython-310.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/data/__pycache__/ffhq_dataset.cpython-312.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/data/__pycache__/paired_image_SR_LR_FullImage_Memory_dataset.cpython-310.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/data/__pycache__/paired_image_SR_LR_FullImage_Memory_dataset.cpython-312.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/data/__pycache__/paired_image_SR_LR_dataset.cpython-310.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/data/__pycache__/paired_image_SR_LR_dataset.cpython-312.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/data/__pycache__/paired_image_dataset.cpython-310.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/data/__pycache__/paired_image_dataset.cpython-312.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/data/__pycache__/prefetch_dataloader.cpython-310.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/data/__pycache__/prefetch_dataloader.cpython-312.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/data/__pycache__/reds_dataset.cpython-310.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/data/__pycache__/reds_dataset.cpython-312.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/data/__pycache__/single_image_dataset.cpython-310.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/data/__pycache__/single_image_dataset.cpython-312.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/data/__pycache__/transforms.cpython-310.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/data/__pycache__/transforms.cpython-312.pyc +0 -0
- NAFNetModel/NAFNet/basicsr/data/__pycache__/video_test_dataset.cpython-310.pyc +0 -0
.gitattributes
CHANGED
@@ -33,3 +33,23 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
NAFNetModel/libuv-1.49.2/libuv-1.49.2/docs/src/static/architecture.png filter=lfs diff=lfs merge=lfs -text
|
37 |
+
NAFNetModel/libuv-1.49.2/libuv-1.49.2/docs/src/static/diagrams.key/preview.jpg filter=lfs diff=lfs merge=lfs -text
|
38 |
+
NAFNetModel/NAFNet/demo/101.png filter=lfs diff=lfs merge=lfs -text
|
39 |
+
NAFNetModel/NAFNet/demo/deblur_101.png filter=lfs diff=lfs merge=lfs -text
|
40 |
+
NAFNetModel/NAFNet/demo/deblur_110.jpg filter=lfs diff=lfs merge=lfs -text
|
41 |
+
NAFNetModel/NAFNet/demo/deblur_img.png filter=lfs diff=lfs merge=lfs -text
|
42 |
+
NAFNetModel/NAFNet/demo/deblur16k_101.png filter=lfs diff=lfs merge=lfs -text
|
43 |
+
NAFNetModel/NAFNet/demo/deblur16k_110.jpg filter=lfs diff=lfs merge=lfs -text
|
44 |
+
NAFNetModel/NAFNet/demo/deblur32_101.png filter=lfs diff=lfs merge=lfs -text
|
45 |
+
NAFNetModel/NAFNet/demo/deblur32_110.jpg filter=lfs diff=lfs merge=lfs -text
|
46 |
+
NAFNetModel/NAFNet/demo/deblur3600_101.png filter=lfs diff=lfs merge=lfs -text
|
47 |
+
NAFNetModel/NAFNet/demo/deblur3600_110.jpg filter=lfs diff=lfs merge=lfs -text
|
48 |
+
NAFNetModel/NAFNet/demo/deblur3600_img.png filter=lfs diff=lfs merge=lfs -text
|
49 |
+
NAFNetModel/NAFNet/demo/noisy.png filter=lfs diff=lfs merge=lfs -text
|
50 |
+
NAFNetModel/NAFNet/demo/sr_img_l.png filter=lfs diff=lfs merge=lfs -text
|
51 |
+
NAFNetModel/NAFNet/demo/sr_img_r.png filter=lfs diff=lfs merge=lfs -text
|
52 |
+
NAFNetModel/NAFNet/libuv/docs/src/static/architecture.png filter=lfs diff=lfs merge=lfs -text
|
53 |
+
NAFNetModel/NAFNet/libuv/docs/src/static/diagrams.key/preview.jpg filter=lfs diff=lfs merge=lfs -text
|
54 |
+
NAFNetModel/outputs/output.png filter=lfs diff=lfs merge=lfs -text
|
55 |
+
NAFNetModel/uploads/101.png filter=lfs diff=lfs merge=lfs -text
|
NAFNetModel/.gitattributes
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.ext filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.NAFNet filter=lfs diff=lfs merge=lfs -text
|
3 |
+
NAFNet filter=lfs diff=lfs merge=lfs -text
|
4 |
+
C:/Users/Administrator/Desktop/NAFNetModel/NAFNet filter=lfs diff=lfs merge=lfs -text
|
NAFNetModel/CMakeLists.txt
ADDED
@@ -0,0 +1,813 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
cmake_minimum_required(VERSION 3.9)
|
2 |
+
|
3 |
+
if(POLICY CMP0091)
|
4 |
+
cmake_policy(SET CMP0091 NEW) # Enable MSVC_RUNTIME_LIBRARY setting
|
5 |
+
endif()
|
6 |
+
if(POLICY CMP0092)
|
7 |
+
cmake_policy(SET CMP0092 NEW) # disable /W3 warning, if possible
|
8 |
+
endif()
|
9 |
+
|
10 |
+
project(libuv LANGUAGES C)
|
11 |
+
|
12 |
+
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
13 |
+
|
14 |
+
include(CMakePackageConfigHelpers)
|
15 |
+
include(CMakeDependentOption)
|
16 |
+
include(CheckCCompilerFlag)
|
17 |
+
include(GNUInstallDirs)
|
18 |
+
include(CTest)
|
19 |
+
|
20 |
+
set(CMAKE_C_VISIBILITY_PRESET hidden)
|
21 |
+
set(CMAKE_C_STANDARD_REQUIRED ON)
|
22 |
+
set(CMAKE_C_EXTENSIONS ON)
|
23 |
+
set(CMAKE_C_STANDARD 90)
|
24 |
+
|
25 |
+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
26 |
+
|
27 |
+
option(LIBUV_BUILD_SHARED "Build shared lib" ON)
|
28 |
+
|
29 |
+
cmake_dependent_option(LIBUV_BUILD_TESTS
|
30 |
+
"Build the unit tests when BUILD_TESTING is enabled and we are the root project" ON
|
31 |
+
"BUILD_TESTING;LIBUV_BUILD_SHARED;CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
|
32 |
+
cmake_dependent_option(LIBUV_BUILD_BENCH
|
33 |
+
"Build the benchmarks when building unit tests and we are the root project" ON
|
34 |
+
"LIBUV_BUILD_TESTS" OFF)
|
35 |
+
|
36 |
+
# Qemu Build
|
37 |
+
option(QEMU "build for qemu" OFF)
|
38 |
+
if(QEMU)
|
39 |
+
list(APPEND uv_defines __QEMU__=1)
|
40 |
+
endif()
|
41 |
+
|
42 |
+
# Note: these are mutually exclusive.
|
43 |
+
option(ASAN "Enable AddressSanitizer (ASan)" OFF)
|
44 |
+
option(MSAN "Enable MemorySanitizer (MSan)" OFF)
|
45 |
+
option(TSAN "Enable ThreadSanitizer (TSan)" OFF)
|
46 |
+
option(UBSAN "Enable UndefinedBehaviorSanitizer (UBSan)" OFF)
|
47 |
+
|
48 |
+
if(MSAN AND NOT CMAKE_C_COMPILER_ID MATCHES "AppleClang|Clang")
|
49 |
+
message(SEND_ERROR "MemorySanitizer requires clang. Try again with -DCMAKE_C_COMPILER=clang")
|
50 |
+
endif()
|
51 |
+
|
52 |
+
if(ASAN)
|
53 |
+
list(APPEND uv_defines __ASAN__=1)
|
54 |
+
if(CMAKE_C_COMPILER_ID MATCHES "AppleClang|GNU|Clang")
|
55 |
+
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-omit-frame-pointer -fsanitize=address")
|
56 |
+
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=address")
|
57 |
+
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=address")
|
58 |
+
elseif(MSVC)
|
59 |
+
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /fsanitize=address")
|
60 |
+
else()
|
61 |
+
message(SEND_ERROR "AddressSanitizer support requires clang, gcc, or msvc. Try again with -DCMAKE_C_COMPILER.")
|
62 |
+
endif()
|
63 |
+
endif()
|
64 |
+
|
65 |
+
if(MSAN)
|
66 |
+
list(APPEND uv_defines __MSAN__=1)
|
67 |
+
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-omit-frame-pointer -fsanitize=memory")
|
68 |
+
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=memory")
|
69 |
+
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=memory")
|
70 |
+
endif()
|
71 |
+
|
72 |
+
if(TSAN)
|
73 |
+
list(APPEND uv_defines __TSAN__=1)
|
74 |
+
if(CMAKE_C_COMPILER_ID MATCHES "AppleClang|GNU|Clang")
|
75 |
+
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-omit-frame-pointer -fsanitize=thread")
|
76 |
+
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=thread")
|
77 |
+
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=thread")
|
78 |
+
else()
|
79 |
+
message(SEND_ERROR "ThreadSanitizer support requires clang or gcc. Try again with -DCMAKE_C_COMPILER.")
|
80 |
+
endif()
|
81 |
+
endif()
|
82 |
+
|
83 |
+
if(UBSAN)
|
84 |
+
cmake_minimum_required(VERSION 3.13)
|
85 |
+
list(APPEND uv_defines __UBSAN__=1)
|
86 |
+
if(CMAKE_C_COMPILER_ID MATCHES "AppleClang|GNU|Clang")
|
87 |
+
add_compile_options("-fsanitize=undefined" "-fno-sanitize-recover=undefined")
|
88 |
+
if (NOT WIN32)
|
89 |
+
add_link_options("-fsanitize=undefined")
|
90 |
+
endif()
|
91 |
+
if(MSVC)
|
92 |
+
add_compile_options("/Oy-")
|
93 |
+
else()
|
94 |
+
add_compile_options("-fno-omit-frame-pointer")
|
95 |
+
endif()
|
96 |
+
else()
|
97 |
+
message(SEND_ERROR "UndefinedBehaviorSanitizer support requires clang or gcc. Try again with -DCMAKE_C_COMPILER.")
|
98 |
+
endif()
|
99 |
+
endif()
|
100 |
+
|
101 |
+
# Compiler check
|
102 |
+
string(CONCAT is-msvc $<OR:
|
103 |
+
$<C_COMPILER_ID:MSVC>,
|
104 |
+
$<STREQUAL:${CMAKE_C_COMPILER_FRONTEND_VARIANT},MSVC>
|
105 |
+
>)
|
106 |
+
|
107 |
+
check_c_compiler_flag(/W4 UV_LINT_W4)
|
108 |
+
check_c_compiler_flag(/wd4100 UV_LINT_NO_UNUSED_PARAMETER_MSVC)
|
109 |
+
check_c_compiler_flag(/wd4127 UV_LINT_NO_CONDITIONAL_CONSTANT_MSVC)
|
110 |
+
check_c_compiler_flag(/wd4201 UV_LINT_NO_NONSTANDARD_MSVC)
|
111 |
+
check_c_compiler_flag(/wd4206 UV_LINT_NO_NONSTANDARD_EMPTY_TU_MSVC)
|
112 |
+
check_c_compiler_flag(/wd4210 UV_LINT_NO_NONSTANDARD_FILE_SCOPE_MSVC)
|
113 |
+
check_c_compiler_flag(/wd4232 UV_LINT_NO_NONSTANDARD_NONSTATIC_DLIMPORT_MSVC)
|
114 |
+
check_c_compiler_flag(/wd4456 UV_LINT_NO_HIDES_LOCAL)
|
115 |
+
check_c_compiler_flag(/wd4457 UV_LINT_NO_HIDES_PARAM)
|
116 |
+
check_c_compiler_flag(/wd4459 UV_LINT_NO_HIDES_GLOBAL)
|
117 |
+
check_c_compiler_flag(/wd4706 UV_LINT_NO_CONDITIONAL_ASSIGNMENT_MSVC)
|
118 |
+
check_c_compiler_flag(/wd4996 UV_LINT_NO_UNSAFE_MSVC)
|
119 |
+
|
120 |
+
check_c_compiler_flag(-Wall UV_LINT_WALL) # DO NOT use this under MSVC
|
121 |
+
|
122 |
+
# TODO: Place these into its own function
|
123 |
+
check_c_compiler_flag(-Wno-unused-parameter UV_LINT_NO_UNUSED_PARAMETER)
|
124 |
+
check_c_compiler_flag(-Wstrict-prototypes UV_LINT_STRICT_PROTOTYPES)
|
125 |
+
check_c_compiler_flag(-Wextra UV_LINT_EXTRA)
|
126 |
+
|
127 |
+
check_c_compiler_flag(/utf-8 UV_LINT_UTF8_MSVC)
|
128 |
+
|
129 |
+
set(lint-no-unused-parameter $<$<BOOL:${UV_LINT_NO_UNUSED_PARAMETER}>:-Wno-unused-parameter>)
|
130 |
+
set(lint-strict-prototypes $<$<BOOL:${UV_LINT_STRICT_PROTOTYPES}>:-Wstrict-prototypes>)
|
131 |
+
set(lint-extra $<$<BOOL:${UV_LINT_EXTRA}>:-Wextra>)
|
132 |
+
set(lint-w4 $<$<BOOL:${UV_LINT_W4}>:/W4>)
|
133 |
+
set(lint-no-unused-parameter-msvc $<$<BOOL:${UV_LINT_NO_UNUSED_PARAMETER_MSVC}>:/wd4100>)
|
134 |
+
set(lint-no-conditional-constant-msvc $<$<BOOL:${UV_LINT_NO_CONDITIONAL_CONSTANT_MSVC}>:/wd4127>)
|
135 |
+
set(lint-no-nonstandard-msvc $<$<BOOL:${UV_LINT_NO_NONSTANDARD_MSVC}>:/wd4201>)
|
136 |
+
set(lint-no-nonstandard-empty-tu-msvc $<$<BOOL:${UV_LINT_NO_NONSTANDARD_EMPTY_TU_MSVC}>:/wd4206>)
|
137 |
+
set(lint-no-nonstandard-file-scope-msvc $<$<BOOL:${UV_LINT_NO_NONSTANDARD_FILE_SCOPE_MSVC}>:/wd4210>)
|
138 |
+
set(lint-no-nonstandard-nonstatic-dlimport-msvc $<$<BOOL:${UV_LINT_NO_NONSTANDARD_NONSTATIC_DLIMPORT_MSVC}>:/wd4232>)
|
139 |
+
set(lint-no-hides-local-msvc $<$<BOOL:${UV_LINT_NO_HIDES_LOCAL}>:/wd4456>)
|
140 |
+
set(lint-no-hides-param-msvc $<$<BOOL:${UV_LINT_NO_HIDES_PARAM}>:/wd4457>)
|
141 |
+
set(lint-no-hides-global-msvc $<$<BOOL:${UV_LINT_NO_HIDES_GLOBAL}>:/wd4459>)
|
142 |
+
set(lint-no-conditional-assignment-msvc $<$<BOOL:${UV_LINT_NO_CONDITIONAL_ASSIGNMENT_MSVC}>:/wd4706>)
|
143 |
+
set(lint-no-unsafe-msvc $<$<BOOL:${UV_LINT_NO_UNSAFE_MSVC}>:/wd4996>)
|
144 |
+
# Unfortunately, this one is complicated because MSVC and clang-cl support -Wall
|
145 |
+
# but using it is like calling -Weverything
|
146 |
+
string(CONCAT lint-default $<
|
147 |
+
$<AND:$<BOOL:${UV_LINT_WALL}>,$<NOT:${is-msvc}>>:-Wall
|
148 |
+
>)
|
149 |
+
set(lint-utf8-msvc $<$<BOOL:${UV_LINT_UTF8_MSVC}>:/utf-8>)
|
150 |
+
|
151 |
+
list(APPEND uv_cflags ${lint-strict-prototypes} ${lint-extra} ${lint-default} ${lint-w4})
|
152 |
+
list(APPEND uv_cflags ${lint-no-unused-parameter})
|
153 |
+
list(APPEND uv_cflags ${lint-no-unused-parameter-msvc})
|
154 |
+
list(APPEND uv_cflags ${lint-no-conditional-constant-msvc})
|
155 |
+
list(APPEND uv_cflags ${lint-no-nonstandard-msvc})
|
156 |
+
list(APPEND uv_cflags ${lint-no-nonstandard-empty-tu-msvc})
|
157 |
+
list(APPEND uv_cflags ${lint-no-nonstandard-file-scope-msvc})
|
158 |
+
list(APPEND uv_cflags ${lint-no-nonstandard-nonstatic-dlimport-msvc})
|
159 |
+
list(APPEND uv_cflags ${lint-no-hides-local-msvc})
|
160 |
+
list(APPEND uv_cflags ${lint-no-hides-param-msvc})
|
161 |
+
list(APPEND uv_cflags ${lint-no-hides-global-msvc})
|
162 |
+
list(APPEND uv_cflags ${lint-no-conditional-assignment-msvc})
|
163 |
+
list(APPEND uv_cflags ${lint-no-unsafe-msvc})
|
164 |
+
list(APPEND uv_cflags ${lint-utf8-msvc} )
|
165 |
+
|
166 |
+
check_c_compiler_flag(-fno-strict-aliasing UV_F_STRICT_ALIASING)
|
167 |
+
list(APPEND uv_cflags $<$<BOOL:${UV_F_STRICT_ALIASING}>:-fno-strict-aliasing>)
|
168 |
+
|
169 |
+
if (MSVC)
|
170 |
+
# Error on calling undeclared functions.
|
171 |
+
list(APPEND uv_cflags "/we4013")
|
172 |
+
endif()
|
173 |
+
|
174 |
+
set(uv_sources
|
175 |
+
src/fs-poll.c
|
176 |
+
src/idna.c
|
177 |
+
src/inet.c
|
178 |
+
src/random.c
|
179 |
+
src/strscpy.c
|
180 |
+
src/strtok.c
|
181 |
+
src/thread-common.c
|
182 |
+
src/threadpool.c
|
183 |
+
src/timer.c
|
184 |
+
src/uv-common.c
|
185 |
+
src/uv-data-getter-setters.c
|
186 |
+
src/version.c)
|
187 |
+
|
188 |
+
if(WIN32)
|
189 |
+
list(APPEND uv_defines WIN32_LEAN_AND_MEAN _WIN32_WINNT=0x0602 _CRT_DECLARE_NONSTDC_NAMES=0)
|
190 |
+
list(APPEND uv_libraries
|
191 |
+
psapi
|
192 |
+
user32
|
193 |
+
advapi32
|
194 |
+
iphlpapi
|
195 |
+
userenv
|
196 |
+
ws2_32
|
197 |
+
dbghelp
|
198 |
+
ole32
|
199 |
+
shell32)
|
200 |
+
list(APPEND uv_sources
|
201 |
+
src/win/async.c
|
202 |
+
src/win/core.c
|
203 |
+
src/win/detect-wakeup.c
|
204 |
+
src/win/dl.c
|
205 |
+
src/win/error.c
|
206 |
+
src/win/fs.c
|
207 |
+
src/win/fs-event.c
|
208 |
+
src/win/getaddrinfo.c
|
209 |
+
src/win/getnameinfo.c
|
210 |
+
src/win/handle.c
|
211 |
+
src/win/loop-watcher.c
|
212 |
+
src/win/pipe.c
|
213 |
+
src/win/thread.c
|
214 |
+
src/win/poll.c
|
215 |
+
src/win/process.c
|
216 |
+
src/win/process-stdio.c
|
217 |
+
src/win/signal.c
|
218 |
+
src/win/snprintf.c
|
219 |
+
src/win/stream.c
|
220 |
+
src/win/tcp.c
|
221 |
+
src/win/tty.c
|
222 |
+
src/win/udp.c
|
223 |
+
src/win/util.c
|
224 |
+
src/win/winapi.c
|
225 |
+
src/win/winsock.c)
|
226 |
+
list(APPEND uv_test_libraries ws2_32)
|
227 |
+
list(APPEND uv_test_sources src/win/snprintf.c test/runner-win.c)
|
228 |
+
else()
|
229 |
+
list(APPEND uv_defines _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE)
|
230 |
+
if(NOT CMAKE_SYSTEM_NAME MATCHES "Android|OS390|QNX")
|
231 |
+
# TODO: This should be replaced with find_package(Threads) if possible
|
232 |
+
# Android has pthread as part of its c library, not as a separate
|
233 |
+
# libpthread.so.
|
234 |
+
list(APPEND uv_libraries pthread)
|
235 |
+
endif()
|
236 |
+
list(APPEND uv_sources
|
237 |
+
src/unix/async.c
|
238 |
+
src/unix/core.c
|
239 |
+
src/unix/dl.c
|
240 |
+
src/unix/fs.c
|
241 |
+
src/unix/getaddrinfo.c
|
242 |
+
src/unix/getnameinfo.c
|
243 |
+
src/unix/loop-watcher.c
|
244 |
+
src/unix/loop.c
|
245 |
+
src/unix/pipe.c
|
246 |
+
src/unix/poll.c
|
247 |
+
src/unix/process.c
|
248 |
+
src/unix/random-devurandom.c
|
249 |
+
src/unix/signal.c
|
250 |
+
src/unix/stream.c
|
251 |
+
src/unix/tcp.c
|
252 |
+
src/unix/thread.c
|
253 |
+
src/unix/tty.c
|
254 |
+
src/unix/udp.c)
|
255 |
+
list(APPEND uv_test_sources test/runner-unix.c)
|
256 |
+
endif()
|
257 |
+
|
258 |
+
if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
|
259 |
+
list(APPEND uv_defines
|
260 |
+
_ALL_SOURCE
|
261 |
+
_LINUX_SOURCE_COMPAT
|
262 |
+
_THREAD_SAFE
|
263 |
+
_XOPEN_SOURCE=500
|
264 |
+
HAVE_SYS_AHAFS_EVPRODS_H)
|
265 |
+
list(APPEND uv_libraries perfstat)
|
266 |
+
list(APPEND uv_sources
|
267 |
+
src/unix/aix.c
|
268 |
+
src/unix/aix-common.c)
|
269 |
+
endif()
|
270 |
+
|
271 |
+
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
272 |
+
list(APPEND uv_defines _GNU_SOURCE)
|
273 |
+
list(APPEND uv_libraries dl)
|
274 |
+
list(APPEND uv_sources
|
275 |
+
src/unix/linux.c
|
276 |
+
src/unix/procfs-exepath.c
|
277 |
+
src/unix/random-getentropy.c
|
278 |
+
src/unix/random-getrandom.c
|
279 |
+
src/unix/random-sysctl-linux.c)
|
280 |
+
endif()
|
281 |
+
|
282 |
+
if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "Android|Linux")
|
283 |
+
list(APPEND uv_sources src/unix/proctitle.c)
|
284 |
+
endif()
|
285 |
+
|
286 |
+
if(CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD")
|
287 |
+
list(APPEND uv_sources src/unix/freebsd.c)
|
288 |
+
endif()
|
289 |
+
|
290 |
+
if(CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|NetBSD|OpenBSD")
|
291 |
+
list(APPEND uv_sources src/unix/posix-hrtime.c src/unix/bsd-proctitle.c)
|
292 |
+
endif()
|
293 |
+
|
294 |
+
if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|NetBSD|OpenBSD")
|
295 |
+
list(APPEND uv_sources src/unix/bsd-ifaddrs.c src/unix/kqueue.c)
|
296 |
+
endif()
|
297 |
+
|
298 |
+
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
299 |
+
list(APPEND uv_sources src/unix/random-getrandom.c)
|
300 |
+
endif()
|
301 |
+
|
302 |
+
if(APPLE OR CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
|
303 |
+
list(APPEND uv_sources src/unix/random-getentropy.c)
|
304 |
+
endif()
|
305 |
+
|
306 |
+
if(APPLE)
|
307 |
+
list(APPEND uv_defines _DARWIN_UNLIMITED_SELECT=1 _DARWIN_USE_64_BIT_INODE=1)
|
308 |
+
list(APPEND uv_sources
|
309 |
+
src/unix/darwin-proctitle.c
|
310 |
+
src/unix/darwin.c
|
311 |
+
src/unix/fsevents.c)
|
312 |
+
endif()
|
313 |
+
|
314 |
+
if(CMAKE_SYSTEM_NAME STREQUAL "GNU")
|
315 |
+
list(APPEND uv_defines _GNU_SOURCE _POSIX_C_SOURCE=200112 _XOPEN_SOURCE=500)
|
316 |
+
list(APPEND uv_libraries dl)
|
317 |
+
list(APPEND uv_sources
|
318 |
+
src/unix/bsd-ifaddrs.c
|
319 |
+
src/unix/no-fsevents.c
|
320 |
+
src/unix/no-proctitle.c
|
321 |
+
src/unix/posix-hrtime.c
|
322 |
+
src/unix/posix-poll.c
|
323 |
+
src/unix/hurd.c)
|
324 |
+
endif()
|
325 |
+
|
326 |
+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
327 |
+
list(APPEND uv_defines _GNU_SOURCE _POSIX_C_SOURCE=200112)
|
328 |
+
list(APPEND uv_libraries dl rt)
|
329 |
+
list(APPEND uv_sources
|
330 |
+
src/unix/linux.c
|
331 |
+
src/unix/procfs-exepath.c
|
332 |
+
src/unix/random-getrandom.c
|
333 |
+
src/unix/random-sysctl-linux.c)
|
334 |
+
endif()
|
335 |
+
|
336 |
+
if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
|
337 |
+
list(APPEND uv_sources src/unix/netbsd.c)
|
338 |
+
list(APPEND uv_libraries kvm)
|
339 |
+
endif()
|
340 |
+
|
341 |
+
if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
|
342 |
+
list(APPEND uv_sources src/unix/openbsd.c)
|
343 |
+
endif()
|
344 |
+
|
345 |
+
if(CMAKE_SYSTEM_NAME STREQUAL "OS390")
|
346 |
+
enable_language(CXX)
|
347 |
+
list(APPEND uv_defines PATH_MAX=1024)
|
348 |
+
list(APPEND uv_defines _AE_BIMODAL)
|
349 |
+
list(APPEND uv_defines _ALL_SOURCE)
|
350 |
+
list(APPEND uv_defines _ENHANCED_ASCII_EXT=0xFFFFFFFF)
|
351 |
+
list(APPEND uv_defines _ISOC99_SOURCE)
|
352 |
+
list(APPEND uv_defines _LARGE_TIME_API)
|
353 |
+
list(APPEND uv_defines _OPEN_MSGQ_EXT)
|
354 |
+
list(APPEND uv_defines _OPEN_SYS_FILE_EXT)
|
355 |
+
list(APPEND uv_defines _OPEN_SYS_IF_EXT)
|
356 |
+
list(APPEND uv_defines _OPEN_SYS_SOCK_EXT3)
|
357 |
+
list(APPEND uv_defines _OPEN_SYS_SOCK_IPV6)
|
358 |
+
list(APPEND uv_defines _UNIX03_SOURCE)
|
359 |
+
list(APPEND uv_defines _UNIX03_THREADS)
|
360 |
+
list(APPEND uv_defines _UNIX03_WITHDRAWN)
|
361 |
+
list(APPEND uv_defines _XOPEN_SOURCE=600)
|
362 |
+
list(APPEND uv_defines _XOPEN_SOURCE_EXTENDED)
|
363 |
+
list(APPEND uv_sources
|
364 |
+
src/unix/os390.c
|
365 |
+
src/unix/os390-syscalls.c
|
366 |
+
src/unix/os390-proctitle.c)
|
367 |
+
list(APPEND uv_cflags
|
368 |
+
-q64
|
369 |
+
-qascii
|
370 |
+
-qexportall
|
371 |
+
-qgonumber
|
372 |
+
-qlongname
|
373 |
+
-qlibansi
|
374 |
+
-qfloat=IEEE
|
375 |
+
-qtune=10
|
376 |
+
-qarch=10
|
377 |
+
-qasm
|
378 |
+
-qasmlib=sys1.maclib:sys1.modgen)
|
379 |
+
find_library(ZOSLIB
|
380 |
+
NAMES zoslib
|
381 |
+
PATHS ${ZOSLIB_DIR}
|
382 |
+
PATH_SUFFIXES lib
|
383 |
+
)
|
384 |
+
list(APPEND uv_libraries ${ZOSLIB})
|
385 |
+
endif()
|
386 |
+
|
387 |
+
if(CMAKE_SYSTEM_NAME STREQUAL "OS400")
|
388 |
+
list(APPEND uv_defines
|
389 |
+
_ALL_SOURCE
|
390 |
+
_LINUX_SOURCE_COMPAT
|
391 |
+
_THREAD_SAFE
|
392 |
+
_XOPEN_SOURCE=500)
|
393 |
+
list(APPEND uv_sources
|
394 |
+
src/unix/aix-common.c
|
395 |
+
src/unix/ibmi.c
|
396 |
+
src/unix/no-fsevents.c
|
397 |
+
src/unix/posix-poll.c)
|
398 |
+
endif()
|
399 |
+
|
400 |
+
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
|
401 |
+
if(CMAKE_SYSTEM_VERSION STREQUAL "5.10")
|
402 |
+
list(APPEND uv_defines SUNOS_NO_IFADDRS)
|
403 |
+
list(APPEND uv_libraries rt)
|
404 |
+
endif()
|
405 |
+
list(APPEND uv_defines __EXTENSIONS__ _XOPEN_SOURCE=500 _REENTRANT)
|
406 |
+
list(APPEND uv_libraries kstat nsl sendfile socket)
|
407 |
+
list(APPEND uv_sources
|
408 |
+
src/unix/no-proctitle.c
|
409 |
+
src/unix/sunos.c)
|
410 |
+
endif()
|
411 |
+
|
412 |
+
if(CMAKE_SYSTEM_NAME STREQUAL "Haiku")
|
413 |
+
list(APPEND uv_defines _BSD_SOURCE)
|
414 |
+
list(APPEND uv_libraries bsd network)
|
415 |
+
list(APPEND uv_sources
|
416 |
+
src/unix/haiku.c
|
417 |
+
src/unix/bsd-ifaddrs.c
|
418 |
+
src/unix/no-fsevents.c
|
419 |
+
src/unix/no-proctitle.c
|
420 |
+
src/unix/posix-hrtime.c
|
421 |
+
src/unix/posix-poll.c)
|
422 |
+
endif()
|
423 |
+
|
424 |
+
if(CMAKE_SYSTEM_NAME STREQUAL "QNX")
|
425 |
+
list(APPEND uv_sources
|
426 |
+
src/unix/posix-hrtime.c
|
427 |
+
src/unix/posix-poll.c
|
428 |
+
src/unix/qnx.c
|
429 |
+
src/unix/bsd-ifaddrs.c
|
430 |
+
src/unix/no-proctitle.c
|
431 |
+
src/unix/no-fsevents.c)
|
432 |
+
list(APPEND uv_libraries socket)
|
433 |
+
endif()
|
434 |
+
|
435 |
+
if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|Linux|NetBSD|OpenBSD")
|
436 |
+
list(APPEND uv_test_libraries util)
|
437 |
+
endif()
|
438 |
+
|
439 |
+
if(CYGWIN OR MSYS)
|
440 |
+
list(APPEND uv_defines _GNU_SOURCE)
|
441 |
+
list(APPEND uv_sources
|
442 |
+
src/unix/cygwin.c
|
443 |
+
src/unix/bsd-ifaddrs.c
|
444 |
+
src/unix/no-fsevents.c
|
445 |
+
src/unix/no-proctitle.c
|
446 |
+
src/unix/posix-hrtime.c
|
447 |
+
src/unix/posix-poll.c
|
448 |
+
src/unix/procfs-exepath.c
|
449 |
+
src/unix/sysinfo-loadavg.c
|
450 |
+
src/unix/sysinfo-memory.c)
|
451 |
+
endif()
|
452 |
+
|
453 |
+
if(LIBUV_BUILD_SHARED)
|
454 |
+
add_library(uv SHARED ${uv_sources})
|
455 |
+
target_compile_definitions(uv
|
456 |
+
INTERFACE
|
457 |
+
USING_UV_SHARED=1
|
458 |
+
PRIVATE
|
459 |
+
BUILDING_UV_SHARED=1
|
460 |
+
${uv_defines})
|
461 |
+
target_compile_options(uv PRIVATE ${uv_cflags})
|
462 |
+
target_include_directories(uv
|
463 |
+
PUBLIC
|
464 |
+
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
465 |
+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
466 |
+
PRIVATE
|
467 |
+
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>)
|
468 |
+
if(CMAKE_SYSTEM_NAME STREQUAL "OS390")
|
469 |
+
target_include_directories(uv PUBLIC $<BUILD_INTERFACE:${ZOSLIB_DIR}/include>)
|
470 |
+
set_target_properties(uv PROPERTIES LINKER_LANGUAGE CXX)
|
471 |
+
endif()
|
472 |
+
target_link_libraries(uv ${uv_libraries})
|
473 |
+
set_target_properties(uv PROPERTIES OUTPUT_NAME "uv")
|
474 |
+
endif()
|
475 |
+
|
476 |
+
add_library(uv_a STATIC ${uv_sources})
|
477 |
+
target_compile_definitions(uv_a PRIVATE ${uv_defines})
|
478 |
+
target_compile_options(uv_a PRIVATE ${uv_cflags})
|
479 |
+
target_include_directories(uv_a
|
480 |
+
PUBLIC
|
481 |
+
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
482 |
+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
483 |
+
PRIVATE
|
484 |
+
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>)
|
485 |
+
if(CMAKE_SYSTEM_NAME STREQUAL "OS390")
|
486 |
+
target_include_directories(uv_a PUBLIC $<BUILD_INTERFACE:${ZOSLIB_DIR}/include>)
|
487 |
+
set_target_properties(uv_a PROPERTIES LINKER_LANGUAGE CXX)
|
488 |
+
endif()
|
489 |
+
target_link_libraries(uv_a ${uv_libraries})
|
490 |
+
set_target_properties(uv_a PROPERTIES OUTPUT_NAME "uv")
|
491 |
+
if(WIN32)
|
492 |
+
set_target_properties(uv_a PROPERTIES PREFIX "lib")
|
493 |
+
endif()
|
494 |
+
|
495 |
+
if(LIBUV_BUILD_TESTS)
|
496 |
+
# Small hack: use ${uv_test_sources} now to get the runner skeleton,
|
497 |
+
# before the actual tests are added.
|
498 |
+
add_executable(
|
499 |
+
uv_run_benchmarks_a
|
500 |
+
${uv_test_sources}
|
501 |
+
test/benchmark-async-pummel.c
|
502 |
+
test/benchmark-async.c
|
503 |
+
test/benchmark-fs-stat.c
|
504 |
+
test/benchmark-getaddrinfo.c
|
505 |
+
test/benchmark-loop-count.c
|
506 |
+
test/benchmark-queue-work.c
|
507 |
+
test/benchmark-million-async.c
|
508 |
+
test/benchmark-million-timers.c
|
509 |
+
test/benchmark-multi-accept.c
|
510 |
+
test/benchmark-ping-pongs.c
|
511 |
+
test/benchmark-ping-udp.c
|
512 |
+
test/benchmark-pound.c
|
513 |
+
test/benchmark-pump.c
|
514 |
+
test/benchmark-sizes.c
|
515 |
+
test/benchmark-spawn.c
|
516 |
+
test/benchmark-tcp-write-batch.c
|
517 |
+
test/benchmark-thread.c
|
518 |
+
test/benchmark-udp-pummel.c
|
519 |
+
test/blackhole-server.c
|
520 |
+
test/echo-server.c
|
521 |
+
test/run-benchmarks.c
|
522 |
+
test/runner.c)
|
523 |
+
target_compile_definitions(uv_run_benchmarks_a PRIVATE ${uv_defines})
|
524 |
+
target_compile_options(uv_run_benchmarks_a PRIVATE ${uv_cflags})
|
525 |
+
target_link_libraries(uv_run_benchmarks_a uv_a ${uv_test_libraries})
|
526 |
+
|
527 |
+
list(APPEND uv_test_sources
|
528 |
+
test/blackhole-server.c
|
529 |
+
test/echo-server.c
|
530 |
+
test/run-tests.c
|
531 |
+
test/runner.c
|
532 |
+
test/test-active.c
|
533 |
+
test/test-async-null-cb.c
|
534 |
+
test/test-async.c
|
535 |
+
test/test-barrier.c
|
536 |
+
test/test-callback-stack.c
|
537 |
+
test/test-close-fd.c
|
538 |
+
test/test-close-order.c
|
539 |
+
test/test-condvar.c
|
540 |
+
test/test-connect-unspecified.c
|
541 |
+
test/test-connection-fail.c
|
542 |
+
test/test-cwd-and-chdir.c
|
543 |
+
test/test-default-loop-close.c
|
544 |
+
test/test-delayed-accept.c
|
545 |
+
test/test-dlerror.c
|
546 |
+
test/test-eintr-handling.c
|
547 |
+
test/test-embed.c
|
548 |
+
test/test-emfile.c
|
549 |
+
test/test-env-vars.c
|
550 |
+
test/test-error.c
|
551 |
+
test/test-fail-always.c
|
552 |
+
test/test-fork.c
|
553 |
+
test/test-fs-copyfile.c
|
554 |
+
test/test-fs-event.c
|
555 |
+
test/test-fs-poll.c
|
556 |
+
test/test-fs.c
|
557 |
+
test/test-fs-readdir.c
|
558 |
+
test/test-fs-fd-hash.c
|
559 |
+
test/test-fs-open-flags.c
|
560 |
+
test/test-get-currentexe.c
|
561 |
+
test/test-get-loadavg.c
|
562 |
+
test/test-get-memory.c
|
563 |
+
test/test-get-passwd.c
|
564 |
+
test/test-getaddrinfo.c
|
565 |
+
test/test-gethostname.c
|
566 |
+
test/test-getnameinfo.c
|
567 |
+
test/test-getsockname.c
|
568 |
+
test/test-getters-setters.c
|
569 |
+
test/test-gettimeofday.c
|
570 |
+
test/test-handle-fileno.c
|
571 |
+
test/test-homedir.c
|
572 |
+
test/test-hrtime.c
|
573 |
+
test/test-idle.c
|
574 |
+
test/test-idna.c
|
575 |
+
test/test-iouring-pollhup.c
|
576 |
+
test/test-ip4-addr.c
|
577 |
+
test/test-ip6-addr.c
|
578 |
+
test/test-ip-name.c
|
579 |
+
test/test-ipc-heavy-traffic-deadlock-bug.c
|
580 |
+
test/test-ipc-send-recv.c
|
581 |
+
test/test-ipc.c
|
582 |
+
test/test-loop-alive.c
|
583 |
+
test/test-loop-close.c
|
584 |
+
test/test-loop-configure.c
|
585 |
+
test/test-loop-handles.c
|
586 |
+
test/test-loop-stop.c
|
587 |
+
test/test-loop-time.c
|
588 |
+
test/test-metrics.c
|
589 |
+
test/test-multiple-listen.c
|
590 |
+
test/test-mutexes.c
|
591 |
+
test/test-not-readable-nor-writable-on-read-error.c
|
592 |
+
test/test-not-writable-after-shutdown.c
|
593 |
+
test/test-osx-select.c
|
594 |
+
test/test-pass-always.c
|
595 |
+
test/test-ping-pong.c
|
596 |
+
test/test-pipe-bind-error.c
|
597 |
+
test/test-pipe-close-stdout-read-stdin.c
|
598 |
+
test/test-pipe-connect-error.c
|
599 |
+
test/test-pipe-connect-multiple.c
|
600 |
+
test/test-pipe-connect-prepare.c
|
601 |
+
test/test-pipe-getsockname.c
|
602 |
+
test/test-pipe-pending-instances.c
|
603 |
+
test/test-pipe-sendmsg.c
|
604 |
+
test/test-pipe-server-close.c
|
605 |
+
test/test-pipe-set-fchmod.c
|
606 |
+
test/test-pipe-set-non-blocking.c
|
607 |
+
test/test-platform-output.c
|
608 |
+
test/test-poll-close-doesnt-corrupt-stack.c
|
609 |
+
test/test-poll-close.c
|
610 |
+
test/test-poll-closesocket.c
|
611 |
+
test/test-poll-multiple-handles.c
|
612 |
+
test/test-poll-oob.c
|
613 |
+
test/test-poll.c
|
614 |
+
test/test-process-priority.c
|
615 |
+
test/test-process-title-threadsafe.c
|
616 |
+
test/test-process-title.c
|
617 |
+
test/test-queue-foreach-delete.c
|
618 |
+
test/test-random.c
|
619 |
+
test/test-readable-on-eof.c
|
620 |
+
test/test-ref.c
|
621 |
+
test/test-run-nowait.c
|
622 |
+
test/test-run-once.c
|
623 |
+
test/test-semaphore.c
|
624 |
+
test/test-shutdown-close.c
|
625 |
+
test/test-shutdown-eof.c
|
626 |
+
test/test-shutdown-simultaneous.c
|
627 |
+
test/test-shutdown-twice.c
|
628 |
+
test/test-signal-multiple-loops.c
|
629 |
+
test/test-signal-pending-on-close.c
|
630 |
+
test/test-signal.c
|
631 |
+
test/test-socket-buffer-size.c
|
632 |
+
test/test-spawn.c
|
633 |
+
test/test-stdio-over-pipes.c
|
634 |
+
test/test-strscpy.c
|
635 |
+
test/test-strtok.c
|
636 |
+
test/test-tcp-alloc-cb-fail.c
|
637 |
+
test/test-tcp-bind-error.c
|
638 |
+
test/test-tcp-bind6-error.c
|
639 |
+
test/test-tcp-close-accept.c
|
640 |
+
test/test-tcp-close-after-read-timeout.c
|
641 |
+
test/test-tcp-close-while-connecting.c
|
642 |
+
test/test-tcp-close.c
|
643 |
+
test/test-tcp-close-reset.c
|
644 |
+
test/test-tcp-connect-error-after-write.c
|
645 |
+
test/test-tcp-connect-error.c
|
646 |
+
test/test-tcp-connect-timeout.c
|
647 |
+
test/test-tcp-connect6-error.c
|
648 |
+
test/test-tcp-create-socket-early.c
|
649 |
+
test/test-tcp-flags.c
|
650 |
+
test/test-tcp-oob.c
|
651 |
+
test/test-tcp-open.c
|
652 |
+
test/test-tcp-read-stop.c
|
653 |
+
test/test-tcp-reuseport.c
|
654 |
+
test/test-tcp-read-stop-start.c
|
655 |
+
test/test-tcp-rst.c
|
656 |
+
test/test-tcp-shutdown-after-write.c
|
657 |
+
test/test-tcp-try-write.c
|
658 |
+
test/test-tcp-write-in-a-row.c
|
659 |
+
test/test-tcp-try-write-error.c
|
660 |
+
test/test-tcp-unexpected-read.c
|
661 |
+
test/test-tcp-write-after-connect.c
|
662 |
+
test/test-tcp-write-fail.c
|
663 |
+
test/test-tcp-write-queue-order.c
|
664 |
+
test/test-tcp-write-to-half-open-connection.c
|
665 |
+
test/test-tcp-writealot.c
|
666 |
+
test/test-test-macros.c
|
667 |
+
test/test-thread-affinity.c
|
668 |
+
test/test-thread-equal.c
|
669 |
+
test/test-thread.c
|
670 |
+
test/test-thread-priority.c
|
671 |
+
test/test-threadpool-cancel.c
|
672 |
+
test/test-threadpool.c
|
673 |
+
test/test-timer-again.c
|
674 |
+
test/test-timer-from-check.c
|
675 |
+
test/test-timer.c
|
676 |
+
test/test-tmpdir.c
|
677 |
+
test/test-tty-duplicate-key.c
|
678 |
+
test/test-tty-escape-sequence-processing.c
|
679 |
+
test/test-tty.c
|
680 |
+
test/test-udp-alloc-cb-fail.c
|
681 |
+
test/test-udp-bind.c
|
682 |
+
test/test-udp-connect.c
|
683 |
+
test/test-udp-connect6.c
|
684 |
+
test/test-udp-create-socket-early.c
|
685 |
+
test/test-udp-dgram-too-big.c
|
686 |
+
test/test-udp-ipv6.c
|
687 |
+
test/test-udp-mmsg.c
|
688 |
+
test/test-udp-multicast-interface.c
|
689 |
+
test/test-udp-multicast-interface6.c
|
690 |
+
test/test-udp-multicast-join.c
|
691 |
+
test/test-udp-multicast-join6.c
|
692 |
+
test/test-udp-multicast-ttl.c
|
693 |
+
test/test-udp-open.c
|
694 |
+
test/test-udp-options.c
|
695 |
+
test/test-udp-send-and-recv.c
|
696 |
+
test/test-udp-send-hang-loop.c
|
697 |
+
test/test-udp-send-immediate.c
|
698 |
+
test/test-udp-sendmmsg-error.c
|
699 |
+
test/test-udp-send-unreachable.c
|
700 |
+
test/test-udp-try-send.c
|
701 |
+
test/test-udp-recv-in-a-row.c
|
702 |
+
test/test-udp-reuseport.c
|
703 |
+
test/test-uname.c
|
704 |
+
test/test-walk-handles.c
|
705 |
+
test/test-watcher-cross-stop.c)
|
706 |
+
|
707 |
+
add_executable(uv_run_tests ${uv_test_sources} uv_win_longpath.manifest)
|
708 |
+
target_compile_definitions(uv_run_tests
|
709 |
+
PRIVATE ${uv_defines} USING_UV_SHARED=1)
|
710 |
+
target_compile_options(uv_run_tests PRIVATE ${uv_cflags})
|
711 |
+
target_link_libraries(uv_run_tests uv ${uv_test_libraries})
|
712 |
+
add_test(NAME uv_test
|
713 |
+
COMMAND uv_run_tests
|
714 |
+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
715 |
+
if(CMAKE_SYSTEM_NAME STREQUAL "OS390")
|
716 |
+
set_tests_properties(uv_test PROPERTIES ENVIRONMENT
|
717 |
+
"LIBPATH=${CMAKE_BINARY_DIR}:$ENV{LIBPATH}")
|
718 |
+
endif()
|
719 |
+
if(WIN32)
|
720 |
+
add_custom_command(TARGET uv_run_tests POST_BUILD
|
721 |
+
COMMAND "${CMAKE_COMMAND}" -E copy
|
722 |
+
"$<TARGET_FILE:uv_run_tests>"
|
723 |
+
"$<TARGET_FILE_DIR:uv_run_tests>/uv_run_tests_no_ext")
|
724 |
+
endif()
|
725 |
+
add_executable(uv_run_tests_a ${uv_test_sources} uv_win_longpath.manifest)
|
726 |
+
target_compile_definitions(uv_run_tests_a PRIVATE ${uv_defines})
|
727 |
+
target_compile_options(uv_run_tests_a PRIVATE ${uv_cflags})
|
728 |
+
if(QEMU)
|
729 |
+
target_link_libraries(uv_run_tests_a uv_a ${uv_test_libraries} -static)
|
730 |
+
else()
|
731 |
+
target_link_libraries(uv_run_tests_a uv_a ${uv_test_libraries})
|
732 |
+
endif()
|
733 |
+
add_test(NAME uv_test_a
|
734 |
+
COMMAND uv_run_tests_a
|
735 |
+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
736 |
+
if(CMAKE_SYSTEM_NAME STREQUAL "OS390")
|
737 |
+
set_target_properties(uv_run_benchmarks_a PROPERTIES LINKER_LANGUAGE CXX)
|
738 |
+
set_target_properties(uv_run_tests PROPERTIES LINKER_LANGUAGE CXX)
|
739 |
+
set_target_properties(uv_run_tests_a PROPERTIES LINKER_LANGUAGE CXX)
|
740 |
+
endif()
|
741 |
+
if(WIN32)
|
742 |
+
add_custom_command(TARGET uv_run_tests_a POST_BUILD
|
743 |
+
COMMAND "${CMAKE_COMMAND}" -E copy
|
744 |
+
"$<TARGET_FILE:uv_run_tests_a>"
|
745 |
+
"$<TARGET_FILE_DIR:uv_run_tests_a>/uv_run_tests_a_no_ext")
|
746 |
+
endif()
|
747 |
+
endif()
|
748 |
+
|
749 |
+
# Now for some gibbering horrors from beyond the stars...
|
750 |
+
foreach(lib IN LISTS uv_libraries)
|
751 |
+
list(APPEND LIBS "-l${lib}")
|
752 |
+
endforeach()
|
753 |
+
string(REPLACE ";" " " LIBS "${LIBS}")
|
754 |
+
# Consider setting project version via project() call?
|
755 |
+
file(STRINGS configure.ac configure_ac REGEX ^AC_INIT)
|
756 |
+
string(REGEX MATCH "([0-9]+)[.][0-9]+[.][0-9]+" PACKAGE_VERSION "${configure_ac}")
|
757 |
+
set(UV_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
758 |
+
|
759 |
+
set(includedir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR})
|
760 |
+
set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
|
761 |
+
set(prefix ${CMAKE_INSTALL_PREFIX})
|
762 |
+
configure_file(libuv-static.pc.in libuv-static.pc @ONLY)
|
763 |
+
|
764 |
+
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
765 |
+
install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
|
766 |
+
install(FILES LICENSE-extra DESTINATION ${CMAKE_INSTALL_DOCDIR})
|
767 |
+
install(FILES ${PROJECT_BINARY_DIR}/libuv-static.pc
|
768 |
+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
769 |
+
install(TARGETS uv_a EXPORT libuvConfig
|
770 |
+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
771 |
+
install(EXPORT libuvConfig
|
772 |
+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libuv
|
773 |
+
NAMESPACE libuv::)
|
774 |
+
|
775 |
+
if(LIBUV_BUILD_SHARED)
|
776 |
+
# The version in the filename is mirroring the behaviour of autotools.
|
777 |
+
set_target_properties(uv PROPERTIES
|
778 |
+
VERSION ${UV_VERSION_MAJOR}.0.0
|
779 |
+
SOVERSION ${UV_VERSION_MAJOR})
|
780 |
+
configure_file(libuv.pc.in libuv.pc @ONLY)
|
781 |
+
install(FILES ${PROJECT_BINARY_DIR}/libuv.pc
|
782 |
+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
783 |
+
install(TARGETS uv EXPORT libuvConfig
|
784 |
+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
785 |
+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
786 |
+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
787 |
+
endif()
|
788 |
+
|
789 |
+
if(MSVC)
|
790 |
+
set(CMAKE_DEBUG_POSTFIX d)
|
791 |
+
get_filename_component(CMAKE_C_COMPILER_DIR ${CMAKE_C_COMPILER} DIRECTORY)
|
792 |
+
if(ASAN)
|
793 |
+
file(INSTALL "${CMAKE_C_COMPILER_DIR}/llvm-symbolizer.exe" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
|
794 |
+
file(INSTALL "${CMAKE_C_COMPILER_DIR}/clang_rt.asan_dynamic-x86_64.dll" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
|
795 |
+
file(INSTALL "${CMAKE_C_COMPILER_DIR}/clang_rt.asan_dbg_dynamic-x86_64.dll" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
|
796 |
+
endif()
|
797 |
+
endif()
|
798 |
+
|
799 |
+
if(BUILD_SHARED_LIBS)
|
800 |
+
set(LIB_SELECTED uv)
|
801 |
+
else()
|
802 |
+
set(LIB_SELECTED uv_a)
|
803 |
+
endif()
|
804 |
+
|
805 |
+
add_library(libuv::libuv ALIAS ${LIB_SELECTED})
|
806 |
+
|
807 |
+
message(STATUS "summary of build options:
|
808 |
+
Install prefix: ${CMAKE_INSTALL_PREFIX}
|
809 |
+
Target system: ${CMAKE_SYSTEM_NAME}
|
810 |
+
Compiler:
|
811 |
+
C compiler: ${CMAKE_C_COMPILER} (${CMAKE_C_COMPILER_ID})
|
812 |
+
CFLAGS: ${CMAKE_C_FLAGS_${_build_type}} ${CMAKE_C_FLAGS}
|
813 |
+
")
|
NAFNetModel/NAFNet/.gitignore
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.DS_Store
|
2 |
+
.idea/*
|
3 |
+
experiments
|
4 |
+
logs/
|
5 |
+
*results*
|
6 |
+
*__pycache__*
|
7 |
+
*.sh
|
8 |
+
datasets
|
9 |
+
basicsr.egg-info
|
NAFNetModel/NAFNet/LICENSE
ADDED
@@ -0,0 +1,228 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
MIT License
|
2 |
+
|
3 |
+
Copyright (c) 2022 megvii-model
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to deal
|
7 |
+
in the Software without restriction, including without limitation the rights
|
8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
+
copies of the Software, and to permit persons to whom the Software is
|
10 |
+
furnished to do so, subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in all
|
13 |
+
copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
+
SOFTWARE.
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
BasicSR
|
26 |
+
Copyright 2018-2020 BasicSR Authors
|
27 |
+
|
28 |
+
Apache License
|
29 |
+
Version 2.0, January 2004
|
30 |
+
http://www.apache.org/licenses/
|
31 |
+
|
32 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
33 |
+
|
34 |
+
1. Definitions.
|
35 |
+
|
36 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
37 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
38 |
+
|
39 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
40 |
+
the copyright owner that is granting the License.
|
41 |
+
|
42 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
43 |
+
other entities that control, are controlled by, or are under common
|
44 |
+
control with that entity. For the purposes of this definition,
|
45 |
+
"control" means (i) the power, direct or indirect, to cause the
|
46 |
+
direction or management of such entity, whether by contract or
|
47 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
48 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
49 |
+
|
50 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
51 |
+
exercising permissions granted by this License.
|
52 |
+
|
53 |
+
"Source" form shall mean the preferred form for making modifications,
|
54 |
+
including but not limited to software source code, documentation
|
55 |
+
source, and configuration files.
|
56 |
+
|
57 |
+
"Object" form shall mean any form resulting from mechanical
|
58 |
+
transformation or translation of a Source form, including but
|
59 |
+
not limited to compiled object code, generated documentation,
|
60 |
+
and conversions to other media types.
|
61 |
+
|
62 |
+
"Work" shall mean the work of authorship, whether in Source or
|
63 |
+
Object form, made available under the License, as indicated by a
|
64 |
+
copyright notice that is included in or attached to the work
|
65 |
+
(an example is provided in the Appendix below).
|
66 |
+
|
67 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
68 |
+
form, that is based on (or derived from) the Work and for which the
|
69 |
+
editorial revisions, annotations, elaborations, or other modifications
|
70 |
+
represent, as a whole, an original work of authorship. For the purposes
|
71 |
+
of this License, Derivative Works shall not include works that remain
|
72 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
73 |
+
the Work and Derivative Works thereof.
|
74 |
+
|
75 |
+
"Contribution" shall mean any work of authorship, including
|
76 |
+
the original version of the Work and any modifications or additions
|
77 |
+
to that Work or Derivative Works thereof, that is intentionally
|
78 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
79 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
80 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
81 |
+
means any form of electronic, verbal, or written communication sent
|
82 |
+
to the Licensor or its representatives, including but not limited to
|
83 |
+
communication on electronic mailing lists, source code control systems,
|
84 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
85 |
+
Licensor for the purpose of discussing and improving the Work, but
|
86 |
+
excluding communication that is conspicuously marked or otherwise
|
87 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
88 |
+
|
89 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
90 |
+
on behalf of whom a Contribution has been received by Licensor and
|
91 |
+
subsequently incorporated within the Work.
|
92 |
+
|
93 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
94 |
+
this License, each Contributor hereby grants to You a perpetual,
|
95 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
96 |
+
copyright license to reproduce, prepare Derivative Works of,
|
97 |
+
publicly display, publicly perform, sublicense, and distribute the
|
98 |
+
Work and such Derivative Works in Source or Object form.
|
99 |
+
|
100 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
101 |
+
this License, each Contributor hereby grants to You a perpetual,
|
102 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
103 |
+
(except as stated in this section) patent license to make, have made,
|
104 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
105 |
+
where such license applies only to those patent claims licensable
|
106 |
+
by such Contributor that are necessarily infringed by their
|
107 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
108 |
+
with the Work to which such Contribution(s) was submitted. If You
|
109 |
+
institute patent litigation against any entity (including a
|
110 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
111 |
+
or a Contribution incorporated within the Work constitutes direct
|
112 |
+
or contributory patent infringement, then any patent licenses
|
113 |
+
granted to You under this License for that Work shall terminate
|
114 |
+
as of the date such litigation is filed.
|
115 |
+
|
116 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
117 |
+
Work or Derivative Works thereof in any medium, with or without
|
118 |
+
modifications, and in Source or Object form, provided that You
|
119 |
+
meet the following conditions:
|
120 |
+
|
121 |
+
(a) You must give any other recipients of the Work or
|
122 |
+
Derivative Works a copy of this License; and
|
123 |
+
|
124 |
+
(b) You must cause any modified files to carry prominent notices
|
125 |
+
stating that You changed the files; and
|
126 |
+
|
127 |
+
(c) You must retain, in the Source form of any Derivative Works
|
128 |
+
that You distribute, all copyright, patent, trademark, and
|
129 |
+
attribution notices from the Source form of the Work,
|
130 |
+
excluding those notices that do not pertain to any part of
|
131 |
+
the Derivative Works; and
|
132 |
+
|
133 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
134 |
+
distribution, then any Derivative Works that You distribute must
|
135 |
+
include a readable copy of the attribution notices contained
|
136 |
+
within such NOTICE file, excluding those notices that do not
|
137 |
+
pertain to any part of the Derivative Works, in at least one
|
138 |
+
of the following places: within a NOTICE text file distributed
|
139 |
+
as part of the Derivative Works; within the Source form or
|
140 |
+
documentation, if provided along with the Derivative Works; or,
|
141 |
+
within a display generated by the Derivative Works, if and
|
142 |
+
wherever such third-party notices normally appear. The contents
|
143 |
+
of the NOTICE file are for informational purposes only and
|
144 |
+
do not modify the License. You may add Your own attribution
|
145 |
+
notices within Derivative Works that You distribute, alongside
|
146 |
+
or as an addendum to the NOTICE text from the Work, provided
|
147 |
+
that such additional attribution notices cannot be construed
|
148 |
+
as modifying the License.
|
149 |
+
|
150 |
+
You may add Your own copyright statement to Your modifications and
|
151 |
+
may provide additional or different license terms and conditions
|
152 |
+
for use, reproduction, or distribution of Your modifications, or
|
153 |
+
for any such Derivative Works as a whole, provided Your use,
|
154 |
+
reproduction, and distribution of the Work otherwise complies with
|
155 |
+
the conditions stated in this License.
|
156 |
+
|
157 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
158 |
+
any Contribution intentionally submitted for inclusion in the Work
|
159 |
+
by You to the Licensor shall be under the terms and conditions of
|
160 |
+
this License, without any additional terms or conditions.
|
161 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
162 |
+
the terms of any separate license agreement you may have executed
|
163 |
+
with Licensor regarding such Contributions.
|
164 |
+
|
165 |
+
6. Trademarks. This License does not grant permission to use the trade
|
166 |
+
names, trademarks, service marks, or product names of the Licensor,
|
167 |
+
except as required for reasonable and customary use in describing the
|
168 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
169 |
+
|
170 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
171 |
+
agreed to in writing, Licensor provides the Work (and each
|
172 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
173 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
174 |
+
implied, including, without limitation, any warranties or conditions
|
175 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
176 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
177 |
+
appropriateness of using or redistributing the Work and assume any
|
178 |
+
risks associated with Your exercise of permissions under this License.
|
179 |
+
|
180 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
181 |
+
whether in tort (including negligence), contract, or otherwise,
|
182 |
+
unless required by applicable law (such as deliberate and grossly
|
183 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
184 |
+
liable to You for damages, including any direct, indirect, special,
|
185 |
+
incidental, or consequential damages of any character arising as a
|
186 |
+
result of this License or out of the use or inability to use the
|
187 |
+
Work (including but not limited to damages for loss of goodwill,
|
188 |
+
work stoppage, computer failure or malfunction, or any and all
|
189 |
+
other commercial damages or losses), even if such Contributor
|
190 |
+
has been advised of the possibility of such damages.
|
191 |
+
|
192 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
193 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
194 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
195 |
+
or other liability obligations and/or rights consistent with this
|
196 |
+
License. However, in accepting such obligations, You may act only
|
197 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
198 |
+
of any other Contributor, and only if You agree to indemnify,
|
199 |
+
defend, and hold each Contributor harmless for any liability
|
200 |
+
incurred by, or claims asserted against, such Contributor by reason
|
201 |
+
of your accepting any such warranty or additional liability.
|
202 |
+
|
203 |
+
END OF TERMS AND CONDITIONS
|
204 |
+
|
205 |
+
APPENDIX: How to apply the Apache License to your work.
|
206 |
+
|
207 |
+
To apply the Apache License to your work, attach the following
|
208 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
209 |
+
replaced with your own identifying information. (Don't include
|
210 |
+
the brackets!) The text should be enclosed in the appropriate
|
211 |
+
comment syntax for the file format. We also recommend that a
|
212 |
+
file or class name and description of purpose be included on the
|
213 |
+
same "printed page" as the copyright notice for easier
|
214 |
+
identification within third-party archives.
|
215 |
+
|
216 |
+
Copyright 2018-2020 BasicSR Authors
|
217 |
+
|
218 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
219 |
+
you may not use this file except in compliance with the License.
|
220 |
+
You may obtain a copy of the License at
|
221 |
+
|
222 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
223 |
+
|
224 |
+
Unless required by applicable law or agreed to in writing, software
|
225 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
226 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
227 |
+
See the License for the specific language governing permissions and
|
228 |
+
limitations under the License.
|
NAFNetModel/NAFNet/NAFNet-width64.yml
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ------------------------------------------------------------------------
|
2 |
+
# Copyright (c) 2022 megvii-model. All Rights Reserved.
|
3 |
+
# ------------------------------------------------------------------------
|
4 |
+
# Modified from BasicSR (https://github.com/xinntao/BasicSR)
|
5 |
+
# Copyright 2018-2020 BasicSR Authors
|
6 |
+
# ------------------------------------------------------------------------
|
7 |
+
# general settings
|
8 |
+
name: NAFNet-GoPro-width64
|
9 |
+
model_type: ImageRestorationModel
|
10 |
+
scale: 1
|
11 |
+
num_gpu: 1
|
12 |
+
manual_seed: 10
|
13 |
+
|
14 |
+
datasets:
|
15 |
+
train:
|
16 |
+
name: gopro-train
|
17 |
+
type: PairedImageDataset
|
18 |
+
dataroot_gt: datasets\\GoPro\\train\\sharp_crops.lmdb
|
19 |
+
dataroot_lq: datasets\\GoPro\\train\\blur_crops.lmdb
|
20 |
+
|
21 |
+
|
22 |
+
filename_tmpl: '{}'
|
23 |
+
io_backend:
|
24 |
+
type: lmdb
|
25 |
+
|
26 |
+
gt_size: 256
|
27 |
+
use_flip: true
|
28 |
+
use_rot: true
|
29 |
+
|
30 |
+
# data loader
|
31 |
+
use_shuffle: true
|
32 |
+
num_worker_per_gpu: 1
|
33 |
+
batch_size_per_gpu: 2
|
34 |
+
dataset_enlarge_ratio: 1
|
35 |
+
prefetch_mode: ~
|
36 |
+
|
37 |
+
val:
|
38 |
+
name: gopro-test
|
39 |
+
type: PairedImageDataset
|
40 |
+
dataroot_gt: .\\datasets\\GoPro\\train\\sharp_crops.lmdb
|
41 |
+
dataroot_lq: .\\datasets\\GoPro\\train\\blur_crops.lmdb
|
42 |
+
io_backend:
|
43 |
+
type: lmdb
|
44 |
+
|
45 |
+
|
46 |
+
network_g:
|
47 |
+
type: NAFNetLocal
|
48 |
+
width: 64
|
49 |
+
enc_blk_nums: [1, 1, 1, 28]
|
50 |
+
middle_blk_num: 1
|
51 |
+
dec_blk_nums: [1, 1, 1, 1]
|
52 |
+
|
53 |
+
# path
|
54 |
+
path:
|
55 |
+
pretrain_network_g: ~
|
56 |
+
strict_load_g: true
|
57 |
+
resume_state: ~
|
58 |
+
|
59 |
+
# training settings
|
60 |
+
train:
|
61 |
+
optim_g:
|
62 |
+
type: AdamW
|
63 |
+
lr: !!float 2e-3
|
64 |
+
weight_decay: !!float 1e-3
|
65 |
+
betas: [0.9, 0.9]
|
66 |
+
|
67 |
+
scheduler:
|
68 |
+
type: TrueCosineAnnealingLR
|
69 |
+
T_max: 400000
|
70 |
+
eta_min: !!float 2e-7
|
71 |
+
|
72 |
+
total_iter: 400000
|
73 |
+
warmup_iter: -1 # no warm up
|
74 |
+
|
75 |
+
# losses
|
76 |
+
pixel_opt:
|
77 |
+
type: PSNRLoss
|
78 |
+
loss_weight: 1
|
79 |
+
reduction: mean
|
80 |
+
|
81 |
+
# validation settings
|
82 |
+
val:
|
83 |
+
val_freq: !!float 1e4
|
84 |
+
save_img: false
|
85 |
+
|
86 |
+
|
87 |
+
metrics:
|
88 |
+
psnr: # metric name, can be arbitrary
|
89 |
+
type: calculate_psnr
|
90 |
+
crop_border: 0
|
91 |
+
test_y_channel: false
|
92 |
+
ssim:
|
93 |
+
type: calculate_ssim
|
94 |
+
crop_border: 0
|
95 |
+
test_y_channel: false
|
96 |
+
|
97 |
+
# logging settings
|
98 |
+
logger:
|
99 |
+
print_freq: 200
|
100 |
+
save_checkpoint_freq: !!float 1e3
|
101 |
+
use_tb_logger: true
|
102 |
+
wandb:
|
103 |
+
project: ~
|
104 |
+
resume_id: ~
|
105 |
+
|
106 |
+
# dist training settings
|
107 |
+
dist_params:
|
108 |
+
backend: nccl
|
109 |
+
port: 29500
|
NAFNetModel/NAFNet/VERSION
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
1.2.0
|
NAFNetModel/NAFNet/app,py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from flask import Flask, render_template, send_file
|
2 |
+
import subprocess
|
3 |
+
|
4 |
+
app = Flask(__name__)
|
5 |
+
|
6 |
+
@app.route('/')
|
7 |
+
def index():
|
8 |
+
return render_template('index.html')
|
9 |
+
|
10 |
+
@app.route('/run-nafnet')
|
11 |
+
def run_nafnet():
|
12 |
+
try:
|
13 |
+
subprocess.run(
|
14 |
+
[
|
15 |
+
'python', 'NAFNet/demo.py', '-opt', 'NAFNet/options/test/REDS/NAFNet-width64.yml',
|
16 |
+
'--input_path', 'NAFNet/demo/WhatsApp Image 2025-02-17 at 20.50.10_32b56ef5.png',
|
17 |
+
'--output_path', 'NAFNet/.eggs/output.png'
|
18 |
+
],
|
19 |
+
check=True
|
20 |
+
)
|
21 |
+
return send_file('NAFNet/.eggs/output.png', mimetype='image/png')
|
22 |
+
except Exception as e:
|
23 |
+
return f"Error: {str(e)}"
|
24 |
+
|
25 |
+
if __name__ == '__main__':
|
26 |
+
app.run(debug=True)
|
NAFNetModel/NAFNet/basicsr.egg-info/PKG-INFO
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Metadata-Version: 2.1
|
2 |
+
Name: basicsr
|
3 |
+
Version: 1.2.0+2b4af71
|
4 |
+
Summary: Open Source Image and Video Super-Resolution Toolbox
|
5 |
+
Home-page: https://github.com/xinntao/BasicSR
|
6 |
+
Author: Xintao Wang
|
7 |
+
Author-email: xintao.wang@outlook.com
|
8 |
+
License: Apache License 2.0
|
9 |
+
Keywords: computer vision,restoration,super resolution
|
10 |
+
Classifier: Development Status :: 4 - Beta
|
11 |
+
Classifier: License :: OSI Approved :: Apache Software License
|
12 |
+
Classifier: Operating System :: OS Independent
|
13 |
+
Classifier: Programming Language :: Python :: 3
|
14 |
+
Classifier: Programming Language :: Python :: 3.7
|
15 |
+
Classifier: Programming Language :: Python :: 3.8
|
16 |
+
License-File: LICENSE
|
NAFNetModel/NAFNet/basicsr.egg-info/SOURCES.txt
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
LICENSE
|
2 |
+
setup.cfg
|
3 |
+
setup.py
|
4 |
+
basicsr/__init__.py
|
5 |
+
basicsr/demo_ssr.py
|
6 |
+
basicsr/test.py
|
7 |
+
basicsr/train.py
|
8 |
+
basicsr/version.py
|
9 |
+
basicsr.egg-info/PKG-INFO
|
10 |
+
basicsr.egg-info/SOURCES.txt
|
11 |
+
basicsr.egg-info/dependency_links.txt
|
12 |
+
basicsr.egg-info/desktop.ini
|
13 |
+
basicsr.egg-info/not-zip-safe
|
14 |
+
basicsr.egg-info/top_level.txt
|
15 |
+
basicsr/data/__init__.py
|
16 |
+
basicsr/data/data_sampler.py
|
17 |
+
basicsr/data/data_util.py
|
18 |
+
basicsr/data/ffhq_dataset.py
|
19 |
+
basicsr/data/paired_image_SR_LR_FullImage_Memory_dataset.py
|
20 |
+
basicsr/data/paired_image_SR_LR_dataset.py
|
21 |
+
basicsr/data/paired_image_dataset.py
|
22 |
+
basicsr/data/prefetch_dataloader.py
|
23 |
+
basicsr/data/reds_dataset.py
|
24 |
+
basicsr/data/single_image_dataset.py
|
25 |
+
basicsr/data/transforms.py
|
26 |
+
basicsr/data/video_test_dataset.py
|
27 |
+
basicsr/data/vimeo90k_dataset.py
|
28 |
+
basicsr/metrics/__init__.py
|
29 |
+
basicsr/metrics/fid.py
|
30 |
+
basicsr/metrics/metric_util.py
|
31 |
+
basicsr/metrics/niqe.py
|
32 |
+
basicsr/metrics/psnr_ssim.py
|
33 |
+
basicsr/models/__init__.py
|
34 |
+
basicsr/models/base_model.py
|
35 |
+
basicsr/models/image_restoration_model.py
|
36 |
+
basicsr/models/lr_scheduler.py
|
37 |
+
basicsr/models/archs/Baseline_arch.py
|
38 |
+
basicsr/models/archs/NAFNet_arch.py
|
39 |
+
basicsr/models/archs/NAFSSR_arch.py
|
40 |
+
basicsr/models/archs/__init__.py
|
41 |
+
basicsr/models/archs/arch_util.py
|
42 |
+
basicsr/models/archs/local_arch.py
|
43 |
+
basicsr/models/losses/__init__.py
|
44 |
+
basicsr/models/losses/loss_util.py
|
45 |
+
basicsr/models/losses/losses.py
|
46 |
+
basicsr/utils/__init__.py
|
47 |
+
basicsr/utils/create_lmdb.py
|
48 |
+
basicsr/utils/dist_util.py
|
49 |
+
basicsr/utils/download_util.py
|
50 |
+
basicsr/utils/face_util.py
|
51 |
+
basicsr/utils/file_client.py
|
52 |
+
basicsr/utils/flow_util.py
|
53 |
+
basicsr/utils/img_util.py
|
54 |
+
basicsr/utils/lmdb_util.py
|
55 |
+
basicsr/utils/logger.py
|
56 |
+
basicsr/utils/matlab_functions.py
|
57 |
+
basicsr/utils/misc.py
|
58 |
+
basicsr/utils/options.py
|
NAFNetModel/NAFNet/basicsr.egg-info/dependency_links.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
|
NAFNetModel/NAFNet/basicsr.egg-info/desktop.ini
ADDED
Binary file (246 Bytes). View file
|
|
NAFNetModel/NAFNet/basicsr.egg-info/not-zip-safe
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
|
NAFNetModel/NAFNet/basicsr.egg-info/top_level.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
basicsr
|
NAFNetModel/NAFNet/basicsr/.ipynb_checkpoints/desktop.ini
ADDED
Binary file (246 Bytes). View file
|
|
NAFNetModel/NAFNet/basicsr/__init__.py
ADDED
File without changes
|
NAFNetModel/NAFNet/basicsr/__pycache__/__init__.cpython-310.pyc
ADDED
Binary file (155 Bytes). View file
|
|
NAFNetModel/NAFNet/basicsr/__pycache__/__init__.cpython-311.pyc
ADDED
Binary file (178 Bytes). View file
|
|
NAFNetModel/NAFNet/basicsr/__pycache__/__init__.cpython-312.pyc
ADDED
Binary file (166 Bytes). View file
|
|
NAFNetModel/NAFNet/basicsr/__pycache__/desktop.ini
ADDED
Binary file (246 Bytes). View file
|
|
NAFNetModel/NAFNet/basicsr/__pycache__/train.cpython-310.pyc
ADDED
Binary file (7.37 kB). View file
|
|
NAFNetModel/NAFNet/basicsr/__pycache__/train.cpython-312.pyc
ADDED
Binary file (13 kB). View file
|
|
NAFNetModel/NAFNet/basicsr/__pycache__/version.cpython-310.pyc
ADDED
Binary file (248 Bytes). View file
|
|
NAFNetModel/NAFNet/basicsr/__pycache__/version.cpython-312.pyc
ADDED
Binary file (272 Bytes). View file
|
|
NAFNetModel/NAFNet/basicsr/data/__init__.py
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ------------------------------------------------------------------------
|
2 |
+
# Copyright (c) 2022 megvii-model. All Rights Reserved.
|
3 |
+
# ------------------------------------------------------------------------
|
4 |
+
# Modified from BasicSR (https://github.com/xinntao/BasicSR)
|
5 |
+
# Copyright 2018-2020 BasicSR Authors
|
6 |
+
# ------------------------------------------------------------------------
|
7 |
+
|
8 |
+
import importlib
|
9 |
+
import numpy as np
|
10 |
+
import random
|
11 |
+
import torch
|
12 |
+
import torch.utils.data
|
13 |
+
from functools import partial
|
14 |
+
from os import path as osp
|
15 |
+
|
16 |
+
from basicsr.data.prefetch_dataloader import PrefetchDataLoader
|
17 |
+
from basicsr.utils import get_root_logger, scandir
|
18 |
+
from basicsr.utils.dist_util import get_dist_info
|
19 |
+
|
20 |
+
__all__ = ['create_dataset', 'create_dataloader']
|
21 |
+
|
22 |
+
# automatically scan and import dataset modules
|
23 |
+
# scan all the files under the data folder with '_dataset' in file names
|
24 |
+
data_folder = osp.dirname(osp.abspath(__file__))
|
25 |
+
dataset_filenames = [
|
26 |
+
osp.splitext(osp.basename(v))[0] for v in scandir(data_folder)
|
27 |
+
if v.endswith('_dataset.py')
|
28 |
+
]
|
29 |
+
# import all the dataset modules
|
30 |
+
_dataset_modules = [
|
31 |
+
importlib.import_module(f'basicsr.data.{file_name}')
|
32 |
+
for file_name in dataset_filenames
|
33 |
+
]
|
34 |
+
|
35 |
+
|
36 |
+
def create_dataset(dataset_opt):
|
37 |
+
"""Create dataset.
|
38 |
+
|
39 |
+
Args:
|
40 |
+
dataset_opt (dict): Configuration for dataset. It constains:
|
41 |
+
name (str): Dataset name.
|
42 |
+
type (str): Dataset type.
|
43 |
+
"""
|
44 |
+
dataset_type = dataset_opt['type']
|
45 |
+
|
46 |
+
# dynamic instantiation
|
47 |
+
for module in _dataset_modules:
|
48 |
+
dataset_cls = getattr(module, dataset_type, None)
|
49 |
+
if dataset_cls is not None:
|
50 |
+
break
|
51 |
+
if dataset_cls is None:
|
52 |
+
raise ValueError(f'Dataset {dataset_type} is not found.')
|
53 |
+
|
54 |
+
dataset = dataset_cls(dataset_opt)
|
55 |
+
|
56 |
+
logger = get_root_logger()
|
57 |
+
logger.info(
|
58 |
+
f'Dataset {dataset.__class__.__name__} - {dataset_opt["name"]} '
|
59 |
+
'is created.')
|
60 |
+
return dataset
|
61 |
+
|
62 |
+
|
63 |
+
def create_dataloader(dataset,
|
64 |
+
dataset_opt,
|
65 |
+
num_gpu=1,
|
66 |
+
dist=False,
|
67 |
+
sampler=None,
|
68 |
+
seed=None):
|
69 |
+
"""Create dataloader.
|
70 |
+
|
71 |
+
Args:
|
72 |
+
dataset (torch.utils.data.Dataset): Dataset.
|
73 |
+
dataset_opt (dict): Dataset options. It contains the following keys:
|
74 |
+
phase (str): 'train' or 'val'.
|
75 |
+
num_worker_per_gpu (int): Number of workers for each GPU.
|
76 |
+
batch_size_per_gpu (int): Training batch size for each GPU.
|
77 |
+
num_gpu (int): Number of GPUs. Used only in the train phase.
|
78 |
+
Default: 1.
|
79 |
+
dist (bool): Whether in distributed training. Used only in the train
|
80 |
+
phase. Default: False.
|
81 |
+
sampler (torch.utils.data.sampler): Data sampler. Default: None.
|
82 |
+
seed (int | None): Seed. Default: None
|
83 |
+
"""
|
84 |
+
phase = dataset_opt['phase']
|
85 |
+
rank, _ = get_dist_info()
|
86 |
+
if phase == 'train':
|
87 |
+
if dist: # distributed training
|
88 |
+
batch_size = dataset_opt['batch_size_per_gpu']
|
89 |
+
num_workers = dataset_opt['num_worker_per_gpu']
|
90 |
+
else: # non-distributed training
|
91 |
+
multiplier = 1 if num_gpu == 0 else num_gpu
|
92 |
+
batch_size = dataset_opt['batch_size_per_gpu'] * multiplier
|
93 |
+
num_workers = dataset_opt['num_worker_per_gpu'] * multiplier
|
94 |
+
dataloader_args = dict(
|
95 |
+
dataset=dataset,
|
96 |
+
batch_size=batch_size,
|
97 |
+
shuffle=False,
|
98 |
+
num_workers=num_workers,
|
99 |
+
sampler=sampler,
|
100 |
+
drop_last=True,
|
101 |
+
persistent_workers=True
|
102 |
+
)
|
103 |
+
if sampler is None:
|
104 |
+
dataloader_args['shuffle'] = True
|
105 |
+
dataloader_args['worker_init_fn'] = partial(
|
106 |
+
worker_init_fn, num_workers=num_workers, rank=rank,
|
107 |
+
seed=seed) if seed is not None else None
|
108 |
+
elif phase in ['val', 'test']: # validation
|
109 |
+
dataloader_args = dict(
|
110 |
+
dataset=dataset, batch_size=1, shuffle=False, num_workers=0)
|
111 |
+
else:
|
112 |
+
raise ValueError(f'Wrong dataset phase: {phase}. '
|
113 |
+
"Supported ones are 'train', 'val' and 'test'.")
|
114 |
+
|
115 |
+
dataloader_args['pin_memory'] = dataset_opt.get('pin_memory', False)
|
116 |
+
|
117 |
+
prefetch_mode = dataset_opt.get('prefetch_mode')
|
118 |
+
if prefetch_mode == 'cpu': # CPUPrefetcher
|
119 |
+
num_prefetch_queue = dataset_opt.get('num_prefetch_queue', 1)
|
120 |
+
logger = get_root_logger()
|
121 |
+
logger.info(f'Use {prefetch_mode} prefetch dataloader: '
|
122 |
+
f'num_prefetch_queue = {num_prefetch_queue}')
|
123 |
+
return PrefetchDataLoader(
|
124 |
+
num_prefetch_queue=num_prefetch_queue, **dataloader_args)
|
125 |
+
else:
|
126 |
+
# prefetch_mode=None: Normal dataloader
|
127 |
+
# prefetch_mode='cuda': dataloader for CUDAPrefetcher
|
128 |
+
return torch.utils.data.DataLoader(**dataloader_args)
|
129 |
+
|
130 |
+
|
131 |
+
def worker_init_fn(worker_id, num_workers, rank, seed):
|
132 |
+
# Set the worker seed to num_workers * rank + worker_id + seed
|
133 |
+
worker_seed = num_workers * rank + worker_id + seed
|
134 |
+
np.random.seed(worker_seed)
|
135 |
+
random.seed(worker_seed)
|
NAFNetModel/NAFNet/basicsr/data/__pycache__/__init__.cpython-310.pyc
ADDED
Binary file (3.64 kB). View file
|
|
NAFNetModel/NAFNet/basicsr/data/__pycache__/__init__.cpython-311.pyc
ADDED
Binary file (5.6 kB). View file
|
|
NAFNetModel/NAFNet/basicsr/data/__pycache__/__init__.cpython-312.pyc
ADDED
Binary file (4.85 kB). View file
|
|
NAFNetModel/NAFNet/basicsr/data/__pycache__/data_sampler.cpython-310.pyc
ADDED
Binary file (2.13 kB). View file
|
|
NAFNetModel/NAFNet/basicsr/data/__pycache__/data_sampler.cpython-312.pyc
ADDED
Binary file (2.82 kB). View file
|
|
NAFNetModel/NAFNet/basicsr/data/__pycache__/data_util.cpython-310.pyc
ADDED
Binary file (11.1 kB). View file
|
|
NAFNetModel/NAFNet/basicsr/data/__pycache__/data_util.cpython-312.pyc
ADDED
Binary file (14.8 kB). View file
|
|
NAFNetModel/NAFNet/basicsr/data/__pycache__/desktop.ini
ADDED
Binary file (246 Bytes). View file
|
|
NAFNetModel/NAFNet/basicsr/data/__pycache__/ffhq_dataset.cpython-310.pyc
ADDED
Binary file (2.59 kB). View file
|
|
NAFNetModel/NAFNet/basicsr/data/__pycache__/ffhq_dataset.cpython-312.pyc
ADDED
Binary file (3.68 kB). View file
|
|
NAFNetModel/NAFNet/basicsr/data/__pycache__/paired_image_SR_LR_FullImage_Memory_dataset.cpython-310.pyc
ADDED
Binary file (5.2 kB). View file
|
|
NAFNetModel/NAFNet/basicsr/data/__pycache__/paired_image_SR_LR_FullImage_Memory_dataset.cpython-312.pyc
ADDED
Binary file (8.39 kB). View file
|
|
NAFNetModel/NAFNet/basicsr/data/__pycache__/paired_image_SR_LR_dataset.cpython-310.pyc
ADDED
Binary file (7.02 kB). View file
|
|
NAFNetModel/NAFNet/basicsr/data/__pycache__/paired_image_SR_LR_dataset.cpython-312.pyc
ADDED
Binary file (13.3 kB). View file
|
|
NAFNetModel/NAFNet/basicsr/data/__pycache__/paired_image_dataset.cpython-310.pyc
ADDED
Binary file (3.87 kB). View file
|
|
NAFNetModel/NAFNet/basicsr/data/__pycache__/paired_image_dataset.cpython-312.pyc
ADDED
Binary file (5.89 kB). View file
|
|
NAFNetModel/NAFNet/basicsr/data/__pycache__/prefetch_dataloader.cpython-310.pyc
ADDED
Binary file (4.33 kB). View file
|
|
NAFNetModel/NAFNet/basicsr/data/__pycache__/prefetch_dataloader.cpython-312.pyc
ADDED
Binary file (6.26 kB). View file
|
|
NAFNetModel/NAFNet/basicsr/data/__pycache__/reds_dataset.cpython-310.pyc
ADDED
Binary file (6.5 kB). View file
|
|
NAFNetModel/NAFNet/basicsr/data/__pycache__/reds_dataset.cpython-312.pyc
ADDED
Binary file (10.7 kB). View file
|
|
NAFNetModel/NAFNet/basicsr/data/__pycache__/single_image_dataset.cpython-310.pyc
ADDED
Binary file (2.66 kB). View file
|
|
NAFNetModel/NAFNet/basicsr/data/__pycache__/single_image_dataset.cpython-312.pyc
ADDED
Binary file (3.82 kB). View file
|
|
NAFNetModel/NAFNet/basicsr/data/__pycache__/transforms.cpython-310.pyc
ADDED
Binary file (6.45 kB). View file
|
|
NAFNetModel/NAFNet/basicsr/data/__pycache__/transforms.cpython-312.pyc
ADDED
Binary file (8.56 kB). View file
|
|
NAFNetModel/NAFNet/basicsr/data/__pycache__/video_test_dataset.cpython-310.pyc
ADDED
Binary file (10.2 kB). View file
|
|