mirror of
https://github.com/k4yt3x/video2x.git
synced 2024-12-29 16:09:10 +00:00
moving wrappers into a sub-directory
This commit is contained in:
parent
b1e844dcad
commit
43a2078330
0
src/ffmpeg.py → src/wrappers/ffmpeg.py
Executable file → Normal file
0
src/ffmpeg.py → src/wrappers/ffmpeg.py
Executable file → Normal file
15
src/waifu2x_caffe.py → src/wrappers/waifu2x_caffe.py
Executable file → Normal file
15
src/waifu2x_caffe.py → src/wrappers/waifu2x_caffe.py
Executable file → Normal file
@ -4,7 +4,7 @@
|
||||
Name: Waifu2x Caffe Driver
|
||||
Author: K4YT3X
|
||||
Date Created: Feb 24, 2018
|
||||
Last Modified: February 22, 2020
|
||||
Last Modified: May 3, 2020
|
||||
|
||||
Description: This class is a high-level wrapper
|
||||
for waifu2x-caffe.
|
||||
@ -29,14 +29,12 @@ class Waifu2xCaffe:
|
||||
the upscale function.
|
||||
"""
|
||||
|
||||
def __init__(self, driver_settings, process, model_dir, bit_depth):
|
||||
def __init__(self, driver_settings, model_dir, bit_depth):
|
||||
self.driver_settings = driver_settings
|
||||
self.driver_settings['process'] = process
|
||||
self.driver_settings['model_dir'] = model_dir
|
||||
self.driver_settings['output_depth'] = bit_depth
|
||||
|
||||
# arguments passed through command line overwrites config file values
|
||||
self.process = process
|
||||
self.model_dir = model_dir
|
||||
self.print_lock = threading.Lock()
|
||||
|
||||
@ -64,21 +62,24 @@ class Waifu2xCaffe:
|
||||
|
||||
# list to be executed
|
||||
# initialize the list with waifu2x binary path as the first element
|
||||
execute = [str(self.driver_settings['path'])]
|
||||
execute = [self.driver_settings.pop('path')]
|
||||
|
||||
for key in self.driver_settings.keys():
|
||||
|
||||
value = self.driver_settings[key]
|
||||
|
||||
# is executable key or null or None means that leave this option out (keep default)
|
||||
if key == 'path' or value is None or value is False:
|
||||
if value is None or value is False:
|
||||
continue
|
||||
else:
|
||||
if len(key) == 1:
|
||||
execute.append(f'-{key}')
|
||||
else:
|
||||
execute.append(f'--{key}')
|
||||
execute.append(str(value))
|
||||
|
||||
# true means key is an option
|
||||
if value is not True:
|
||||
execute.append(str(value))
|
||||
|
||||
# return the Popen object of the new process created
|
||||
self.print_lock.acquire()
|
20
src/waifu2x_converter.py → src/wrappers/waifu2x_converter_cpp.py
Executable file → Normal file
20
src/waifu2x_converter.py → src/wrappers/waifu2x_converter_cpp.py
Executable file → Normal file
@ -4,7 +4,7 @@
|
||||
Name: Waifu2x Converter CPP Driver
|
||||
Author: K4YT3X
|
||||
Date Created: February 8, 2019
|
||||
Last Modified: February 22, 2020
|
||||
Last Modified: May 3, 2020
|
||||
|
||||
Description: This class is a high-level wrapper
|
||||
for waifu2x-converter-cpp.
|
||||
@ -21,7 +21,7 @@ import threading
|
||||
from avalon_framework import Avalon
|
||||
|
||||
|
||||
class Waifu2xConverter:
|
||||
class Waifu2xConverterCpp:
|
||||
"""This class communicates with waifu2x cui engine
|
||||
|
||||
An object will be created for this class, containing information
|
||||
@ -56,22 +56,18 @@ class Waifu2xConverter:
|
||||
# models_rgb must be specified manually for waifu2x-converter-cpp
|
||||
# if it's not specified in the arguments, create automatically
|
||||
if self.driver_settings['model-dir'] is None:
|
||||
self.driver_settings['model-dir'] = pathlib.Path(self.driver_settings['path']) / 'models_rgb'
|
||||
self.driver_settings['model-dir'] = pathlib.Path(self.driver_settings['path']).parent / 'models_rgb'
|
||||
|
||||
# list to be executed
|
||||
# initialize the list with waifu2x binary path as the first element
|
||||
execute = [str(pathlib.Path(self.driver_settings['path']) / 'waifu2x-converter-cpp.exe')]
|
||||
execute = [self.driver_settings.pop('path')]
|
||||
|
||||
for key in self.driver_settings.keys():
|
||||
|
||||
value = self.driver_settings[key]
|
||||
|
||||
# the key doesn't need to be passed in this case
|
||||
if key == 'path':
|
||||
continue
|
||||
|
||||
# null or None means that leave this option out (keep default)
|
||||
elif value is None or value is False:
|
||||
if value is None or value is False:
|
||||
continue
|
||||
else:
|
||||
if len(key) == 1:
|
||||
@ -80,10 +76,8 @@ class Waifu2xConverter:
|
||||
execute.append(f'--{key}')
|
||||
|
||||
# true means key is an option
|
||||
if value is True:
|
||||
continue
|
||||
|
||||
execute.append(str(value))
|
||||
if value is not True:
|
||||
execute.append(str(value))
|
||||
|
||||
# return the Popen object of the new process created
|
||||
self.print_lock.acquire()
|
0
src/waifu2x_ncnn_vulkan.py → src/wrappers/waifu2x_ncnn_vulkan.py
Executable file → Normal file
0
src/waifu2x_ncnn_vulkan.py → src/wrappers/waifu2x_ncnn_vulkan.py
Executable file → Normal file
Loading…
Reference in New Issue
Block a user