mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 19:24:06 +00:00
Add --tiles parameter
Add new parameter --tiles that accept only uniform split. I considered supporting the syntax of --tiles-width-split for this, but writing --tiles=u2xu2 is just not as intuitive as --tiles=2x2, and there is hardly ever any reason to use anything but uniform split. The more cumbersome --tiles-width-split and --tiles-height-split parameters are still there to allow finer control.
This commit is contained in:
parent
fd34dd9bc6
commit
95b8dd99f6
26
src/cfg.c
26
src/cfg.c
|
@ -567,6 +567,32 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
|
|||
return parse_tiles_specification(value, &cfg->tiles_width_count, &cfg->tiles_width_split);
|
||||
else if OPT("tiles-height-split")
|
||||
return parse_tiles_specification(value, &cfg->tiles_height_count, &cfg->tiles_height_split);
|
||||
else if OPT("tiles")
|
||||
{
|
||||
// A simpler interface for setting tiles, accepting only uniform split.
|
||||
unsigned width = 0;
|
||||
unsigned height = 0;
|
||||
if (2 != sscanf(value, "%ux%u", &width, &height)) {
|
||||
fprintf(stderr, "Wrong format for tiles. Expected \"%%ux%%u\", but got \"%s\"\n", value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (MAX_TILES_PER_DIM <= width || 0 >= width) {
|
||||
fprintf(stderr, "Invalid number of tiles (0 < %d <= %d = MAX_TILES_PER_DIM)!\n", width, MAX_TILES_PER_DIM);
|
||||
return 0;
|
||||
}
|
||||
if (MAX_TILES_PER_DIM <= height || 0 >= height) {
|
||||
fprintf(stderr, "Invalid number of tiles (0 < %d <= %d = MAX_TILES_PER_DIM)!\n", height, MAX_TILES_PER_DIM);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Free split arrays incase they have already been set by another parameter.
|
||||
FREE_POINTER(cfg->tiles_width_split);
|
||||
FREE_POINTER(cfg->tiles_height_split);
|
||||
cfg->tiles_width_count = width;
|
||||
cfg->tiles_height_count = height;
|
||||
return 1;
|
||||
}
|
||||
else if OPT("wpp")
|
||||
cfg->wpp = atobool(value);
|
||||
else if OPT("owf") {
|
||||
|
|
|
@ -78,6 +78,7 @@ static const struct option long_options[] = {
|
|||
{ "no-aud", no_argument, NULL, 0 },
|
||||
{ "cqmfile", required_argument, NULL, 0 },
|
||||
{ "seek", required_argument, NULL, 0 },
|
||||
{ "tiles", required_argument, NULL, 0 },
|
||||
{ "tiles-width-split", required_argument, NULL, 0 },
|
||||
{ "tiles-height-split", required_argument, NULL, 0 },
|
||||
{ "wpp", no_argument, NULL, 0 },
|
||||
|
@ -395,6 +396,7 @@ void print_help(void)
|
|||
" Disable threads if set to 0.\n"
|
||||
"\n"
|
||||
" Tiles:\n"
|
||||
" --tiles <int>x<int> : Split picture into wdith x height uniform tiles.\n"
|
||||
" --tiles-width-split <string>|u<int> :\n"
|
||||
" Specifies a comma separated list of pixel\n"
|
||||
" positions of tiles columns separation coordinates.\n"
|
||||
|
|
Loading…
Reference in a new issue