From be7f6fd741737db47eaee10aa4064104e20e4ec5 Mon Sep 17 00:00:00 2001 From: Erik Reckase Date: Sat, 24 Apr 2010 03:41:22 +0000 Subject: changed flam3_colorhist to take a random context as an argument rather than creating a new one each time. Also optimized the loop to only generate the precalc flags once and create the xform distrib array once. git-svn-id: https://flam3.googlecode.com/svn/trunk@6 77852712-ef1d-11de-8684-7d64432d61a3 --- src/flam3.c | 28 +++++++++++----------------- src/flam3.h | 2 +- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/flam3.c b/src/flam3.c index 088eb61..9324d29 100644 --- a/src/flam3.c +++ b/src/flam3.c @@ -343,41 +343,34 @@ int flam3_xform_preview(flam3_genome *cp, int xi, double range, int numvals, int return(0); } -int flam3_colorhist(flam3_genome *cp, int num_batches, double *hist) { +int flam3_colorhist(flam3_genome *cp, int num_batches, randctx *rc, double *hist) { int lp,plp; int mycolor; long int default_isaac_seed = (long int)time(0); - randctx rc; unsigned short *xform_distrib; int sbs = 10000; double sub_batch[4*10000]; - /* Set up the isaac rng */ - for (lp = 0; lp < RANDSIZ; lp++) - rc.randrsl[lp] = default_isaac_seed; - - irandinit(&rc,1); - memset(hist,0,256*sizeof(double)); + // get into the attractor + if (prepare_precalc_flags(cp)) + return(1); + + xform_distrib = flam3_create_xform_distrib(cp); + for (lp=0;lp