From fb7a47209c48ac8a0570bb8609fbbbb70930f857 Mon Sep 17 00:00:00 2001 From: lltcggie Date: Sun, 3 Jul 2016 22:46:53 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B3=E3=83=9E=E3=83=B3=E3=83=89=E3=83=A9?= =?UTF-8?q?=E3=82=A4=E3=83=B3=E7=89=88=E3=81=AE=E5=87=BA=E5=8A=9B=E3=83=95?= =?UTF-8?q?=E3=82=A1=E3=82=A4=E3=83=AB=E5=90=8D=E8=87=AA=E5=8B=95=E7=94=9F?= =?UTF-8?q?=E6=88=90=E3=81=AE=E8=A6=8F=E5=89=87=E3=82=92GUI=E7=89=88?= =?UTF-8?q?=E3=81=A8=E6=8F=83=E3=81=88=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- waifu2x-caffe/Source.cpp | 44 +++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/waifu2x-caffe/Source.cpp b/waifu2x-caffe/Source.cpp index 41a1c70..44f4235 100644 --- a/waifu2x-caffe/Source.cpp +++ b/waifu2x-caffe/Source.cpp @@ -190,6 +190,8 @@ int main(int argc, char** argv) if (outputExt.length() > 0 && outputExt[0] != '.') outputExt = "." + outputExt; + const std::string ModelName = Waifu2x::GetModelName(cmdModelPath.getValue()); + const bool use_tta = cmdTTALevel.getValue() == 1; std::vector> file_paths; @@ -201,11 +203,17 @@ int main(int argc, char** argv) { // 「test」なら「test_noise_scale(Level1)(x2.000000)」みたいな感じにする - std::string addstr("_" + cmdMode.getValue()); + std::string addstr("("); + addstr += ModelName; + addstr += ")"; const std::string &mode = cmdMode.getValue(); + + addstr += "(" + mode + ")"; + if (mode.find("noise") != mode.npos || mode.find("auto_scale") != mode.npos) addstr += "(Level" + std::to_string(cmdNRLevel.getValue()) + ")"; + if (use_tta) addstr += "(tta)"; if (mode.find("scale") != mode.npos) @@ -218,6 +226,9 @@ int main(int argc, char** argv) addstr += "(height " + std::to_string(*ScaleHeight) + ")"; } + if (cmdOutputDepth.getValue() != 8) + addstr += "(" + std::to_string(cmdOutputDepth.getValue()) + "bit)"; + output_path = input_path.branch_path() / (input_path.stem().string() + addstr); } else @@ -305,15 +316,34 @@ int main(int argc, char** argv) outputFileName = cmdInputFile.getValue(); const auto tailDot = outputFileName.find_last_of('.'); outputFileName.erase(tailDot, outputFileName.length()); - outputFileName = outputFileName + "(" + cmdMode.getValue() + ")"; - std::string &mode = cmdMode.getValue(); + + std::string addstr("("); + addstr += ModelName; + addstr += ")"; + + const std::string &mode = cmdMode.getValue(); + + addstr += "(" + mode + ")"; + if (mode.find("noise") != mode.npos || mode.find("auto_scale") != mode.npos) - outputFileName = outputFileName + "(Level" + std::to_string(cmdNRLevel.getValue()) + ")"; + addstr += "(Level" + std::to_string(cmdNRLevel.getValue()) + ")"; + if (use_tta) - outputFileName += "(tta)"; + addstr += "(tta)"; if (mode.find("scale") != mode.npos) - outputFileName = outputFileName + "(x" + std::to_string(cmdScaleRatio.getValue()) + ")"; - outputFileName += outputExt; + { + if (ScaleRatio) + addstr += "(x" + std::to_string(*ScaleRatio) + ")"; + else if (ScaleWidth) + addstr += "(width " + std::to_string(*ScaleWidth) + ")"; + else + addstr += "(height " + std::to_string(*ScaleHeight) + ")"; + } + + if (cmdOutputDepth.getValue() != 8) + addstr += "(" + std::to_string(cmdOutputDepth.getValue()) + "bit)"; + + outputFileName += addstr + outputExt; } file_paths.emplace_back(cmdInputFile.getValue(), outputFileName);