From 07bd15c693b50df33501a22f93983f091ef2f21d Mon Sep 17 00:00:00 2001 From: lltcggie Date: Thu, 4 Feb 2016 17:38:27 +0900 Subject: [PATCH] =?UTF-8?q?tga=E5=87=BA=E5=8A=9B=E6=99=82=E3=81=ABRLE?= =?UTF-8?q?=E5=9C=A7=E7=B8=AE=E3=82=92=E4=BD=BF=E3=81=86=E3=81=8B=E8=A8=AD?= =?UTF-8?q?=E5=AE=9A=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +++ common/waifu2x.cpp | 23 ++++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 035b5f7..65ceec9 100644 --- a/README.md +++ b/README.md @@ -107,10 +107,12 @@ cuDNN ###「出力画質設定」 変換後の画像の画質を指定します。 + 設定できる値は整数です。 指定できる値の範囲と意味は「出力拡張子」で設定した形式により異なります。 * .jpg : 値の範囲(0~100) 数字が高いほど高画質 * .webp : 値の範囲(1~100) 数字が高いほど高画質 100だと可逆圧縮 + * .tga : 値の範囲(0~1) 0なら圧縮なし、1ならRLE圧縮 ###「出力深度ビット数」 変換後の画像の1チャンネルあたりのビット数を指定します @@ -342,3 +344,4 @@ ex. オリジナルの[waifu2x](https://github.com/nagadomi/waifu2x)、及びモデルの制作を行い、MITライセンスの下で公開して下さった [ultraist](https://twitter.com/ultraistter)さん、 オリジナルのwaifu2xを元に[waifu2x-converter](https://github.com/WL-Amigo/waifu2x-converter-cpp)を作成して下さった [アミーゴ](https://twitter.com/WL_Amigo)さん(READMEやLICENSE.txtの書き方、OpenCVの使い方等かなり参考にさせていただきました) に、感謝します。 +また、メッセージを英訳してくださった @paul70078 さん、メッセージを中国語(簡体字)に翻訳してくださった @yoonhakcher さん、中国語(簡体字)訳のプルリクエストを下さった @mzhboy さんに感謝します。 diff --git a/common/waifu2x.cpp b/common/waifu2x.cpp index 1f6c1f2..abd8312 100644 --- a/common/waifu2x.cpp +++ b/common/waifu2x.cpp @@ -137,7 +137,7 @@ const std::vector Waifu2x::OutputExtentionLis { L".exr", { 8, 16, 32 }, boost::optional(), boost::optional(), boost::optional(), boost::optional() }, { L".ppm", { 8, 16 }, boost::optional(), boost::optional(), boost::optional(), boost::optional() }, { L".webp", { 8 }, 1, 100, 100, cv::IMWRITE_WEBP_QUALITY }, - { L".tga", { 8 }, boost::optional(), boost::optional(), boost::optional(), boost::optional() }, + { L".tga", { 8 }, 0, 1, 0, 0 }, }; #ifndef CUDA_CHECK_WAIFU2X @@ -1357,6 +1357,27 @@ Waifu2x::eWaifu2xError Waifu2x::WriteMat(const cv::Mat &im, const boost::filesys if(!os) return eWaifu2xError_FailedOpenOutputFile; + // RLEk̐ݒ + bool isSet = false; + const auto &OutputExtentionList = Waifu2x::OutputExtentionList; + for (const auto &elm : OutputExtentionList) + { + if (elm.ext == L".tga") + { + if (elm.imageQualitySettingVolume && output_quality) + { + stbi_write_tga_with_rle = *output_quality; + isSet = true; + } + + break; + } + } + + // ݒ肳Ȃ̂ŃftHgɂ + if (!isSet) + stbi_write_tga_with_rle = 1; + if (!stbi_write_tga_to_func(Waifu2x_stbi_write_func, &os, im.size().width, im.size().height, im.channels(), data)) return eWaifu2xError_FailedOpenOutputFile;