mirror of
https://github.com/k4yt3x/video2x.git
synced 2024-12-28 06:59:11 +00:00
fix(video2x): fixed RealESRGAN model name parsing
Signed-off-by: k4yt3x <i@k4yt3x.com>
This commit is contained in:
parent
bb74144070
commit
fb0e3a040d
@ -252,7 +252,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
// RealESRGAN options
|
// RealESRGAN options
|
||||||
("gpuid,g", po::value<int>(&arguments.gpuid)->default_value(0), "Vulkan GPU ID (default: 0)")
|
("gpuid,g", po::value<int>(&arguments.gpuid)->default_value(0), "Vulkan GPU ID (default: 0)")
|
||||||
("model,m", po::wvalue<std::wstring>(), "Name of the model to use")
|
("model,m", po::wvalue<std::wstring>(&arguments.model_name), "Name of the model to use")
|
||||||
("scale,r", po::value<int>(&arguments.scaling_factor), "Scaling factor (2, 3, or 4)")
|
("scale,r", po::value<int>(&arguments.scaling_factor), "Scaling factor (2, 3, or 4)")
|
||||||
;
|
;
|
||||||
#else
|
#else
|
||||||
@ -284,7 +284,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
// RealESRGAN options
|
// RealESRGAN options
|
||||||
("gpuid,g", po::value<int>(&arguments.gpuid)->default_value(0), "Vulkan GPU ID (default: 0)")
|
("gpuid,g", po::value<int>(&arguments.gpuid)->default_value(0), "Vulkan GPU ID (default: 0)")
|
||||||
("model,m", po::value<std::string>(), "Name of the model to use")
|
("model,m", po::value<std::string>(&arguments.model_name), "Name of the model to use")
|
||||||
("scale,r", po::value<int>(&arguments.scaling_factor), "Scaling factor (2, 3, or 4)")
|
("scale,r", po::value<int>(&arguments.scaling_factor), "Scaling factor (2, 3, or 4)")
|
||||||
;
|
;
|
||||||
#endif
|
#endif
|
||||||
@ -366,11 +366,12 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
if (vm.count("model")) {
|
if (vm.count("model")) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
arguments.model_name = std::filesystem::path(vm["model"].as<std::wstring>());
|
bool is_valid_model =
|
||||||
|
is_valid_realesrgan_model(wstring_to_utf8(vm["model"].as<std::wstring>()));
|
||||||
#else
|
#else
|
||||||
arguments.model_name = vm["model"].as<std::string>();
|
bool is_valid_model = is_valid_realesrgan_model(vm["model"].as<std::string>());
|
||||||
#endif
|
#endif
|
||||||
if (!is_valid_realesrgan_model(vm["model"].as<std::string>())) {
|
if (!is_valid_model) {
|
||||||
spdlog::error(
|
spdlog::error(
|
||||||
"Error: Invalid model specified. Must be 'realesrgan-plus', "
|
"Error: Invalid model specified. Must be 'realesrgan-plus', "
|
||||||
"'realesrgan-plus-anime', or 'realesr-animevideov3'."
|
"'realesrgan-plus-anime', or 'realesr-animevideov3'."
|
||||||
@ -382,7 +383,7 @@ int main(int argc, char **argv) {
|
|||||||
spdlog::error("Error parsing options: {}", e.what());
|
spdlog::error("Error parsing options: {}", e.what());
|
||||||
return 1;
|
return 1;
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
spdlog::error("Exception caught: {}", e.what());
|
spdlog::error("Unexpected exception caught while parsing options: {}", e.what());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,7 +508,6 @@ int main(int argc, char **argv) {
|
|||||||
filter_config.config.realesrgan.model_name = arguments.model_name.c_str();
|
filter_config.config.realesrgan.model_name = arguments.model_name.c_str();
|
||||||
#else
|
#else
|
||||||
filter_config.config.realesrgan.model_name = arguments.model_name.c_str();
|
filter_config.config.realesrgan.model_name = arguments.model_name.c_str();
|
||||||
filter_config.config.realesrgan.model_name = "realesr-animevideov4";
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user