diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2016-03-27 01:46:26 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2016-03-27 01:46:26 +0000 |
commit | dff6b9fdfeb78fe21a66aa459ddc1d5f7e362dfa (patch) | |
tree | b147568ccffc4cdba9e2a98de1452450ba8e55c3 /editor/pamditherbw.c | |
parent | 4ce684c4978610d1ea42be1b00f7332f3f5f337a (diff) | |
download | netpbm-mirror-dff6b9fdfeb78fe21a66aa459ddc1d5f7e362dfa.tar.gz netpbm-mirror-dff6b9fdfeb78fe21a66aa459ddc1d5f7e362dfa.tar.xz netpbm-mirror-dff6b9fdfeb78fe21a66aa459ddc1d5f7e362dfa.zip |
Promote Advanced (10.73) to Stable
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@2692 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'editor/pamditherbw.c')
-rw-r--r-- | editor/pamditherbw.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/editor/pamditherbw.c b/editor/pamditherbw.c index 90e2abd5..36eb7d9e 100644 --- a/editor/pamditherbw.c +++ b/editor/pamditherbw.c @@ -41,6 +41,8 @@ struct cmdlineInfo { unsigned int clusterRadius; /* Defined only for halftone == QT_CLUSTER */ float threshval; + unsigned int randomseed; + unsigned int randomseedSpec; }; @@ -54,7 +56,7 @@ parseCommandLine(int argc, char ** argv, was passed to us as the argv array. -----------------------------------------------------------------------------*/ optEntry *option_def; - /* Instructions to optParseOptions3 on how to parse our options. + /* Instructions to pm_optParseOptions3 on how to parse our options. */ optStruct3 opt; @@ -83,12 +85,14 @@ parseCommandLine(int argc, char ** argv, &valueSpec, 0); OPTENT3(0, "clump", OPT_UINT, &cmdlineP->clumpSize, &clumpSpec, 0); + OPTENT3(0, "randomseed", OPT_UINT, &cmdlineP->randomseed, + &cmdlineP->randomseedSpec, 0); opt.opt_table = option_def; opt.short_allowed = FALSE; /* We have no short (old-fashioned) options */ opt.allowNegNum = FALSE; /* We may have parms that are negative numbers */ - optParseOptions3(&argc, argv, opt, sizeof(opt), 0); + pm_optParseOptions3(&argc, argv, opt, sizeof(opt), 0); /* Uses and sets argc, argv, and some of *cmdlineP and others. */ if (floydOpt + atkinsonOpt + thresholdOpt + hilbertOpt + dither8Opt + @@ -518,7 +522,6 @@ createFsConverter(struct pam * const graypamP, /* Initialize Floyd-Steinberg error vectors. */ MALLOCARRAY_NOFAIL(stateP->thiserr, graypamP->width + 2); MALLOCARRAY_NOFAIL(stateP->nexterr, graypamP->width + 2); - srand(pm_randseed()); { /* (random errors in [-1/8 .. 1/8]) */ @@ -661,8 +664,6 @@ createAtkinsonConverter(struct pam * const graypamP, for (relRow = 0; relRow < 3; ++relRow) MALLOCARRAY_NOFAIL(stateP->error[relRow], graypamP->width + 2); - srand(pm_randseed()); - { /* (random errors in [-1/8 .. 1/8]) */ unsigned int col; @@ -857,6 +858,8 @@ main(int argc, char *argv[]) { parseCommandLine(argc, argv, &cmdline); + srand(cmdline.randomseedSpec ? cmdline.randomseed : pm_randseed()); + ifP = pm_openr(cmdline.inputFilespec); if (cmdline.halftone == QT_HILBERT) |