From a64fabae8710c85234846752fde628915b069bd9 Mon Sep 17 00:00:00 2001 From: k4yt3x Date: Sat, 9 May 2020 20:10:12 -0400 Subject: [PATCH] added more GUI options for waifu2x-converter-cpp --- src/video2x_gui.py | 19 ++++++- src/video2x_gui.pyproject.user | 2 +- src/video2x_gui.ui | 99 ++++++++++++++++++++++++++++++++-- 3 files changed, 113 insertions(+), 7 deletions(-) diff --git a/src/video2x_gui.py b/src/video2x_gui.py index 72099d9..ca70ab2 100755 --- a/src/video2x_gui.py +++ b/src/video2x_gui.py @@ -257,11 +257,16 @@ class Video2XMainWindow(QMainWindow): self.waifu2x_converter_cpp_path_edit_button = self.findChild(QPushButton, 'waifu2xConverterCppPathSelectButton') self.waifu2x_converter_cpp_path_edit_button.clicked.connect(lambda: self.select_driver_binary_path(self.waifu2x_converter_cpp_path_line_edit)) self.waifu2x_converter_cpp_png_compression_spin_box = self.findChild(QSpinBox, 'waifu2xConverterCppPngCompressionSpinBox') + self.waifu2x_converter_cpp_image_quality_spin_box = self.findChild(QSpinBox, 'waifu2xConverterCppImageQualitySpinBox') + self.waifu2x_converter_cpp_block_size_spin_box = self.findChild(QSpinBox, 'waifu2xConverterCppBlockSizeSpinBox') self.waifu2x_converter_cpp_processor_spin_box = self.findChild(QSpinBox, 'waifu2xConverterCppProcessorSpinBox') self.waifu2x_converter_cpp_model_combo_box = self.findChild(QComboBox, 'waifu2xConverterCppModelComboBox') + self.waifu2x_converter_cpp_noise_level_spin_box = self.findChild(QSpinBox, 'waifu2xConverterCppNoiseLevelSpinBox') self.waifu2x_converter_cpp_mode_combo_box = self.findChild(QComboBox, 'waifu2xConverterCppModeComboBox') - self.waifu2x_converter_cpp_disable_gpu_check_box = self.findChild(QCheckBox, 'disableGpuCheckBox') - self.waifu2x_converter_cpp_tta_check_box = self.findChild(QCheckBox, 'ttaCheckBox') + self.waifu2x_converter_cpp_log_level_spin_box = self.findChild(QSpinBox, 'waifu2xConverterCppLogLevelSpinBox') + self.waifu2x_converter_cpp_disable_gpu_check_box = self.findChild(QCheckBox, 'waifu2xConverterCppDisableGpuCheckBox') + self.waifu2x_converter_cpp_force_opencl_check_box = self.findChild(QCheckBox, 'waifu2xConverterCppForceOpenclCheckBox') + self.waifu2x_converter_cpp_tta_check_box = self.findChild(QCheckBox, 'waifu2xConverterCppTtaCheckBox') # waifu2x-ncnn-vulkan self.waifu2x_ncnn_vulkan_path_line_edit = self.findChild(QLineEdit, 'waifu2xNcnnVulkanPathLineEdit') @@ -386,9 +391,14 @@ class Video2XMainWindow(QMainWindow): settings = self.config['waifu2x_converter_cpp'] self.waifu2x_converter_cpp_path_line_edit.setText(str(pathlib.Path(os.path.expandvars(settings['path'])).absolute())) self.waifu2x_converter_cpp_png_compression_spin_box.setValue(settings['png-compression']) + self.waifu2x_converter_cpp_image_quality_spin_box.setValue(settings['image-quality']) + self.waifu2x_converter_cpp_block_size_spin_box.setValue(settings['block-size']) self.waifu2x_converter_cpp_processor_spin_box.setValue(settings['processor']) + self.waifu2x_converter_cpp_noise_level_spin_box.setValue(settings['noise-level']) self.waifu2x_converter_cpp_mode_combo_box.setCurrentText(settings['mode']) + self.waifu2x_converter_cpp_log_level_spin_box.setValue(settings['log-level']) self.waifu2x_converter_cpp_disable_gpu_check_box.setChecked(settings['disable-gpu']) + self.waifu2x_converter_cpp_force_opencl_check_box.setChecked(settings['force-OpenCL']) self.waifu2x_converter_cpp_tta_check_box.setChecked(bool(settings['tta'])) # waifu2x-ncnn-vulkan @@ -445,10 +455,15 @@ class Video2XMainWindow(QMainWindow): # waifu2x-converter-cpp self.config['waifu2x_converter_cpp']['path'] = os.path.expandvars(self.waifu2x_converter_cpp_path_line_edit.text()) self.config['waifu2x_converter_cpp']['png-compression'] = self.waifu2x_converter_cpp_png_compression_spin_box.value() + self.config['waifu2x_converter_cpp']['image-quality'] = self.waifu2x_converter_cpp_image_quality_spin_box.value() + self.config['waifu2x_converter_cpp']['block-size'] = self.waifu2x_converter_cpp_block_size_spin_box.value() self.config['waifu2x_converter_cpp']['processor'] = self.waifu2x_converter_cpp_processor_spin_box.value() self.config['waifu2x_converter_cpp']['model-dir'] = str((pathlib.Path(self.config['waifu2x_converter_cpp']['path']).parent / self.waifu2x_converter_cpp_model_combo_box.currentText()).absolute()) + self.config['waifu2x_converter_cpp']['noise-level'] = self.waifu2x_converter_cpp_noise_level_spin_box.value() self.config['waifu2x_converter_cpp']['mode'] = self.waifu2x_converter_cpp_mode_combo_box.currentText() + self.config['waifu2x_converter_cpp']['log-level'] = self.waifu2x_converter_cpp_log_level_spin_box.value() self.config['waifu2x_converter_cpp']['disable-gpu'] = bool(self.waifu2x_converter_cpp_disable_gpu_check_box.isChecked()) + self.config['waifu2x_converter_cpp']['force-OpenCL'] = bool(self.waifu2x_converter_cpp_force_opencl_check_box.isChecked()) self.config['waifu2x_converter_cpp']['tta'] = int(self.waifu2x_converter_cpp_tta_check_box.isChecked()) # waifu2x-ncnn-vulkan diff --git a/src/video2x_gui.pyproject.user b/src/video2x_gui.pyproject.user index b409f45..7b8bead 100644 --- a/src/video2x_gui.pyproject.user +++ b/src/video2x_gui.pyproject.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/src/video2x_gui.ui b/src/video2x_gui.ui index c330060..335fd96 100644 --- a/src/video2x_gui.ui +++ b/src/video2x_gui.ui @@ -6,7 +6,7 @@ 0 0 - 718 + 719 740 @@ -652,6 +652,48 @@ + + + + + + Image Quality + + + + + + + -1 + + + 101 + + + -1 + + + + + + + + + + + Block Size + + + + + + + 9999 + + + + + @@ -696,6 +738,27 @@ + + + + + + Noise Level + + + + + + + 3 + + + 1 + + + + + @@ -726,17 +789,45 @@ + + + + + + Log Level + + + + + + + 4 + + + 1 + + + + + - + Disable GPU - + + + Force OpenCL + + + + + TTA (Test-Time Augmentation) @@ -1462,7 +1553,7 @@ 0 0 - 718 + 719 21