mirror of
https://github.com/lltcggie/waifu2x-caffe.git
synced 2025-06-26 13:42:48 +00:00
tga出力時にRLE圧縮を使うか設定できるようにした
This commit is contained in:
parent
9070c8d271
commit
07bd15c693
@ -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 さんに感謝します。
|
||||
|
@ -137,7 +137,7 @@ const std::vector<Waifu2x::stOutputExtentionElement> Waifu2x::OutputExtentionLis
|
||||
{ L".exr", { 8, 16, 32 }, boost::optional<int>(), boost::optional<int>(), boost::optional<int>(), boost::optional<int>() },
|
||||
{ L".ppm", { 8, 16 }, boost::optional<int>(), boost::optional<int>(), boost::optional<int>(), boost::optional<int>() },
|
||||
{ L".webp", { 8 }, 1, 100, 100, cv::IMWRITE_WEBP_QUALITY },
|
||||
{ L".tga", { 8 }, boost::optional<int>(), boost::optional<int>(), boost::optional<int>(), boost::optional<int>() },
|
||||
{ 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;
|
||||
|
||||
// RLE圧縮の設定
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
// 設定されなかったのでデフォルトにする
|
||||
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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user