Skip to content
This repository has been archived by the owner on Jun 2, 2022. It is now read-only.

Support Huge Image Conversion #158

Merged
merged 71 commits into from
May 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
85d1507
honor enable_log when merging/slicing
DeadSix27 May 7, 2019
ee3c90c
slight rephrase of merge-log
DeadSix27 May 7, 2019
f9cf725
bug fix with scale_ratio
YukihoAA May 8, 2019
a27c0b1
add writing image log
YukihoAA May 8, 2019
bc8e598
minor fix
YukihoAA May 8, 2019
ae1791a
tmp off annoying texts
YukihoAA May 8, 2019
11db52c
print all of debug things
YukihoAA May 8, 2019
42e2c15
set limit to 10000^2
YukihoAA May 8, 2019
aac050c
It is hard to debug too
YukihoAA May 8, 2019
fb5679e
edit test output
YukihoAA May 8, 2019
0b14c32
add slice process log during silent mode (DEBUG, revert before merge)
DeadSix27 May 8, 2019
9020e2b
for time check debug
YukihoAA May 8, 2019
97b3d5e
Add padding to slices
YukihoAA May 8, 2019
0e03361
changed limit to 8000
YukihoAA May 8, 2019
b25ab81
use max_scale_ratio rather than scale
YukihoAA May 8, 2019
27dede5
[TEST] heap 200MB
YukihoAA May 8, 2019
4c1502b
[TEST] same to main
YukihoAA May 8, 2019
536ca2b
STACK 2GB
YukihoAA May 8, 2019
ca40bff
Revert "STACK 2GB"
YukihoAA May 8, 2019
31c9f45
Revert "[TEST] same to main"
YukihoAA May 8, 2019
04b642c
Revert "[TEST] heap 200MB"
YukihoAA May 8, 2019
62502d6
[TEST] test imwrite vector
YukihoAA May 8, 2019
88086d4
Revert "[TEST] test imwrite vector"
YukihoAA May 8, 2019
cada9f6
will fix stack smashing
YukihoAA May 8, 2019
939882f
refine test codes
YukihoAA May 9, 2019
4c867dc
Merge branch 'master' into limit_input_size
YukihoAA May 9, 2019
23d609b
add free memory
YukihoAA May 9, 2019
847ee72
edit some comments
YukihoAA May 9, 2019
efbc99b
add comments
YukihoAA May 9, 2019
f471043
edit debug code
YukihoAA May 9, 2019
386b39b
edit comments
YukihoAA May 9, 2019
56d1bc0
add pad with percentage when scale_ratio is extreamlly big
YukihoAA May 9, 2019
1108a00
format code
YukihoAA May 9, 2019
45a1774
bug fix
YukihoAA May 9, 2019
d8bd68c
[DEBUG] revert needed after debug
YukihoAA May 9, 2019
6a40f33
this is currect max scale ratio
YukihoAA May 9, 2019
2ab0d1c
Revert "bug fix"
YukihoAA May 9, 2019
19311b4
Revert "format code"
YukihoAA May 9, 2019
5981a42
Revert "add pad with percentage when scale_ratio is extreamlly big"
YukihoAA May 9, 2019
fa6281c
edit slightly
YukihoAA May 9, 2019
3e1bf28
slicing is not working over x128
YukihoAA May 9, 2019
2340527
Revert "[DEBUG] revert needed after debug"
YukihoAA May 9, 2019
13e20d4
format things
YukihoAA May 9, 2019
3b89706
fix bug with scale over 1024
YukihoAA May 9, 2019
2624876
better error checking
YukihoAA May 9, 2019
04f3330
Merge branch 'master' into limit_input_size
YukihoAA May 9, 2019
74d4050
[TEST] enabled debug thing
YukihoAA May 9, 2019
e6306bc
add padded slices
YukihoAA May 9, 2019
cc4af41
Remove Unicode Function
YukihoAA May 10, 2019
a89e689
change position
YukihoAA May 10, 2019
d4b31ad
Merge branch 'integrate_unicode' into limit_input_size
YukihoAA May 10, 2019
d60833d
reformat
YukihoAA May 10, 2019
15ef134
reformat
YukihoAA May 10, 2019
c17883c
Merge branch 'integrate_unicode' into limit_input_size
YukihoAA May 10, 2019
0a705f0
bug fix with test code
YukihoAA May 10, 2019
1b1b48c
may fix bugs
YukihoAA May 10, 2019
d27b488
[DEBUG] Enable test Thing
YukihoAA May 10, 2019
c193727
edit test code
YukihoAA May 10, 2019
2fa9283
better error check
YukihoAA May 10, 2019
19c559f
changed pad
YukihoAA May 10, 2019
560598b
Update w2xconv.cpp
YukihoAA May 10, 2019
9509152
change slicer to work only when it is limit
YukihoAA May 11, 2019
29467b2
we should not denoise in every iteration
YukihoAA May 11, 2019
7bb27eb
Now slicing would be accurate and even faster
YukihoAA May 11, 2019
f991e80
remove deug thing
YukihoAA May 11, 2019
95f92a1
minor improvement
YukihoAA May 16, 2019
e178e6f
Revert "minor improvement"
YukihoAA May 20, 2019
e44984e
temporary disabled type 3 with alpha support
YukihoAA May 20, 2019
c078335
Revert "temporary disabled type 3 with alpha support"
YukihoAA May 20, 2019
f8d5ca0
temporary disabled type 3 with alpha support
YukihoAA May 20, 2019
0e93741
Revert "temporary disabled type 3 with alpha support"
YukihoAA May 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/convertRoutine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,10 @@ static bool convertWithModelsBlockSplit(W2XConv *conv,
} else {
clipEndY = r * clipHeight + blockHeight;
}

if (enableLog) {
printf("Processing block, row (%02d/%02d) ...\n", (r+1), splitRows);
}

for (unsigned int c = 0; c < splitColumns; c++) {
// start to convert
Expand Down
52 changes: 15 additions & 37 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,14 @@ std::wstring generate_output_location(std::wstring inputFileName, std::wstring o
}
#endif


void convert_file(ConvInfo info, fs::path inputName, fs::path output) {
//std::cout << "Operating on: " << fs::absolute(inputName).string() << std::endl;

#if defined(WIN32) && defined(UNICODE)
std::wstring outputName = generate_output_location(fs::absolute(inputName).wstring(), output.wstring(), info.mode, info.NRLevel, info.scaleRatio, info.outputFormat);
#else
std::string outputName = generate_output_location(fs::absolute(inputName).string(), output.string(), info.mode, info.NRLevel, info.scaleRatio, info.outputFormat);
#endif

int _nrLevel = -1;

Expand All @@ -476,35 +480,11 @@ void convert_file(ConvInfo info, fs::path inputName, fs::path output) {

int error = w2xconv_convert_file(info.converter,
outputName.c_str(),
fs::absolute(inputName).string().c_str(),
_nrLevel,
_scaleRatio,
info.blockSize,
info.imwrite_params
);

check_for_errors(info.converter, error);
}

#if defined(WIN32) && defined(UNICODE)
void convert_fileW(ConvInfo info, fs::path inputName, fs::path output) {
//std::cout << "Operating on: " << fs::absolute(inputName).string() << std::endl;
std::wstring outputName = generate_output_location(fs::absolute(inputName).wstring(), output.wstring(), info.mode, info.NRLevel, info.scaleRatio, info.outputFormat);

int _nrLevel = -1;

if (strcmp(info.mode.c_str(), "noise")==0 || strcmp(info.mode.c_str(), "noise-scale")==0) {
_nrLevel = info.NRLevel;
}

double _scaleRatio = 1;
if (strcmp(info.mode.c_str(), "scale")==0 || strcmp(info.mode.c_str(), "noise-scale")==0) {
_scaleRatio = info.scaleRatio;
}

int error = w2xconv_convert_fileW(info.converter,
outputName.c_str(),
fs::absolute(inputName).wstring().c_str(),
#else
fs::absolute(inputName).string().c_str(),
#endif
_nrLevel,
_scaleRatio,
info.blockSize,
Expand All @@ -513,7 +493,6 @@ void convert_fileW(ConvInfo info, fs::path inputName, fs::path output) {

check_for_errors(info.converter, error);
}
#endif



Expand Down Expand Up @@ -733,6 +712,13 @@ int main(int argc, char** argv)
std::exit(-1);
}

//Check scale-ratio is vaild.
if (cmdScaleRatio.getValue() < 0 || cmdScaleRatio.getValue() > 1024)
{
std::cout << "Error: Scale Ratio range is 0-1024" << std::endl;
std::exit(-1);
}

//Check Quality/Compression option ranges.
if (cmdPngCompression.getValue() < 0 || cmdPngCompression.getValue() > 9)
{
Expand Down Expand Up @@ -878,11 +864,7 @@ int main(int argc, char** argv)
);

try {
#if defined(WIN32) && defined(UNICODE)
convert_fileW(convInfo, fn, output);
#else
convert_file(convInfo, fn, output);
#endif
}
catch (const std::exception& e) {
numErrors++;
Expand Down Expand Up @@ -916,11 +898,7 @@ int main(int argc, char** argv)
double time_file_start = getsec();
std::cout << "Processing file [1/1] \"" << input << "\":" << (verbose ? "\n" : " ");
try {
#if defined(WIN32) && defined(UNICODE)
convert_fileW(convInfo, input, output);
#else
convert_file(convInfo, input, output);
#endif
}
catch (const std::exception& e) {
numErrors++;
Expand Down
Loading