diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2015-04-08 20:56:23 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2015-05-02 21:36:45 +0200 |
commit | 697f57743e560fad2264b7a2039795432ca5b3a8 (patch) | |
tree | a6a5d2d04604b8171edfee751783d29aa2b9eefe /rect.c | |
parent | d9c048f2028e3103212a1cfc6a29b2dc6c729387 (diff) | |
download | pucket-697f57743e560fad2264b7a2039795432ca5b3a8.tar.gz pucket-697f57743e560fad2264b7a2039795432ca5b3a8.tar.bz2 pucket-697f57743e560fad2264b7a2039795432ca5b3a8.zip |
Refactor flam3_iterate
Diffstat (limited to 'rect.c')
-rw-r--r-- | rect.c | 34 |
1 files changed, 20 insertions, 14 deletions
@@ -89,27 +89,33 @@ static void iter_thread (flam3_genome * const input_genome, const double starttime = omp_get_wtime (); do { - /* Seed iterations */ - const double4 start = (double4) { - rand_d11(&rc), - rand_d11(&rc), - rand_d01(&rc), - rand_d01(&rc), - }; - - /* Execute iterations */ - const unsigned long badcount = flam3_iterate(&genome, - c->sub_batch_size, c->fuse, start, iter_storage, - c->xform_distrib, &rc); + iterator iter; + iterator_init (&iter, &genome, c->xform_distrib, &rc); + + /* throw away fuse steps */ + for (unsigned int i = 0; i < c->fuse; i++) { + double4 p; + iterator_step (&iter, &p, &rc); + } + + /* actual iterations */ + unsigned int samples = 0; + for (unsigned int i = 0; i < c->sub_batch_size; i++) { + if (iterator_step (&iter, &iter_storage[samples], &rc)) { + ++samples; + } + } + + const unsigned long badcount = c->sub_batch_size - samples; #pragma omp critical { /* Add the badcount to the counter */ bucket->badvals += badcount; - bucket->samples += c->sub_batch_size; + bucket->samples += samples; /* Put them in the bucket accumulator */ - for (unsigned int j = 0; j < c->sub_batch_size; j++) { + for (unsigned int j = 0; j < samples; j++) { const double4 p = iter_storage[j]; const double2 origpos = (double2) { p[0], p[1] }; |