From 689be0723dea52ffe76577e1f33b9f31aa8876b4 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Sat, 10 Oct 2015 11:07:55 +0200 Subject: [PATCH] add option to store rendered image at a different prefix --- src/colorize.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/colorize.c b/src/colorize.c index 4190854..fe50913 100644 --- a/src/colorize.c +++ b/src/colorize.c @@ -186,6 +186,7 @@ again: static int in_itr_num = 5, out_itr_num = 1, quick = 0, optical_flow = 1, bright_contrast = 1, alpha_change = 1; int scale = 1, scalexyz = 999; +static char output_prefix[256] = ""; static enum test test = NO_TEST; @@ -230,6 +231,7 @@ static int handle_options(int argc, char **argv) static struct option long_options[] = { {"help", 0, 0, 'h'}, {"depth", 1, 0, 'd'}, + {"output-prefix", 1, 0, 'O'}, {"in-itr-num", 1, 0, 'i'}, {"out-itr-num", 1, 0, 'o'}, {"quick", 0, 0, 'q'}, @@ -241,7 +243,7 @@ static int handle_options(int argc, char **argv) {0, 0, 0, 0}, }; - c = getopt_long(argc, argv, "hd:i:o:qz:b:f:s:t:", long_options, &option_index); + c = getopt_long(argc, argv, "hd:O:i:o:qz:b:f:s:t:", long_options, &option_index); if (c == -1) break; @@ -254,6 +256,10 @@ static int handle_options(int argc, char **argv) save_depth = atoi(optarg); skip_args += 2; break; + case 'O': + strcpy(output_prefix, optarg); + skip_args += 2; + break; case 'i': in_itr_num = atoi(optarg); skip_args += 2; @@ -322,6 +328,7 @@ static void print_help(const char *app) printf("\nOptions:\n"); printf(" -h --help This help\n"); printf(" -d --depth Save images with given color bit depth (default=%d)\n", save_depth); + printf(" -O --output-prefix / Store result image of a sequence using this prefix\n"); printf(" -i --in-itr-num Alter inner iterations (weightening count) of colorization algorithm (default=%d)\n", in_itr_num); printf(" -o --out-itr-num Alter outer iterations (complete turns) of colorization algorithm (default=%d)\n", out_itr_num); printf(" -q --quick Use quick render, but sufaces may be colorized incomplete\n"); @@ -684,9 +691,13 @@ next_sequence: p = sequence[z].filename; while((q = strchr(p, DIR_SEPERATOR))) p = q + 1; - strcpy(name, sequence[z].filename); - name[p - sequence[z].filename] = '\0'; - strcat(name, "colorized_"); + if (output_prefix[0] == '\0') { + strcpy(name, sequence[z].filename); + name[p - sequence[z].filename] = '\0'; + strcat(name, "colorized_"); + } else { + strcpy(name, output_prefix); + } strcat(name, p); filename = name; } else -- 2.13.6