Implement custom resampling command line args

This change implements -resample X Y command line support in addition to
-resample_factor, when a more sophisticated algorithm is needed to
compute the desired image size.

For example, these can be used to round the image to a multiple of 4 or
to a power of 2 for improved compatibility with various graphics APIs.
This commit is contained in:
Arseny Kapoulkine
2021-04-14 21:13:19 -07:00
parent 24ba5ded22
commit 0eb541a118
3 changed files with 29 additions and 1 deletions
+8
View File
@@ -127,6 +127,7 @@ static void print_usage()
" -disable_hierarchical_endpoint_codebooks: Disable hierarchical endpoint codebook usage, slower but higher quality on some compression levels\n"
" -compare_ssim: Compute and display SSIM of image comparison (slow)\n"
" -bench: UASTC benchmark mode, for development only\n"
" -resample X Y: Resample all input textures to XxY pixels using a box filter\n"
" -resample_factor X: Resample all input textures by scale factor X using a box filter\n"
" -no_sse: Forbid all SSE instruction set usage\n"
" -validate_etc1s: Validate internal ETC1S compressor's data structures during compression (slower, intended for development).\n"
@@ -392,6 +393,13 @@ public:
arg_count++;
}
else if (strcasecmp(pArg, "-resample") == 0)
{
REMAINING_ARGS_CHECK(2);
m_comp_params.m_resample_width = atoi(arg_v[arg_index + 1]);
m_comp_params.m_resample_height = atoi(arg_v[arg_index + 2]);
arg_count += 2;
}
else if (strcasecmp(pArg, "-resample_factor") == 0)
{
REMAINING_ARGS_CHECK(1);