summaryrefslogtreecommitdiff
path: root/rect.c
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2015-02-12 16:36:05 +0100
committerLars-Dominik Braun <lars@6xq.net>2015-05-02 21:36:44 +0200
commitcb40d04fa6c5d6105adc42278b13954ee003d0e9 (patch)
treee085c3ad3a900ae163dd2aff97d59966a3233c08 /rect.c
parent334e82a0a23db8a5c0816756021611bfffe2fa26 (diff)
downloadpucket-cb40d04fa6c5d6105adc42278b13954ee003d0e9.tar.gz
pucket-cb40d04fa6c5d6105adc42278b13954ee003d0e9.tar.bz2
pucket-cb40d04fa6c5d6105adc42278b13954ee003d0e9.zip
Vectorize flam3_iterate
Diffstat (limited to 'rect.c')
-rw-r--r--rect.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/rect.c b/rect.c
index 0b18993..30d76fd 100644
--- a/rect.c
+++ b/rect.c
@@ -390,13 +390,15 @@ static void iter_thread(void *fth) {
}
/* Seed iterations */
- fthp->iter_storage[0] = flam3_random_isaac_11(&(fthp->rc));
- fthp->iter_storage[1] = flam3_random_isaac_11(&(fthp->rc));
- fthp->iter_storage[2] = flam3_random_isaac_01(&(fthp->rc));
- fthp->iter_storage[3] = flam3_random_isaac_01(&(fthp->rc));
+ const double4 start = (double4) {
+ flam3_random_isaac_11(&(fthp->rc)),
+ flam3_random_isaac_11(&(fthp->rc)),
+ flam3_random_isaac_01(&(fthp->rc)),
+ flam3_random_isaac_01(&(fthp->rc)),
+ };
/* Execute iterations */
- badcount = flam3_iterate(&(fthp->cp), sub_batch_size, fuse, fthp->iter_storage, ficp->xform_distrib, &(fthp->rc));
+ badcount = flam3_iterate(&(fthp->cp), sub_batch_size, fuse, start, fthp->iter_storage, ficp->xform_distrib, &(fthp->rc));
#if defined(HAVE_LIBPTHREAD) && defined(USE_LOCKS)
/* Lock mutex for access to accumulator */
@@ -407,12 +409,12 @@ static void iter_thread(void *fth) {
ficp->badvals += badcount;
/* Put them in the bucket accumulator */
- for (j = 0; j < sub_batch_size*4; j+=4) {
+ for (j = 0; j < sub_batch_size; j++) {
double p0, p1, p00, p11;
double dbl_index0,dbl_frac;
double interpcolor[4];
int ci, color_index0;
- double *p = &(fthp->iter_storage[j]);
+ const double4 p = fthp->iter_storage[j];
bucket *b;
if (fthp->cp.rotate != 0.0) {
@@ -532,7 +534,7 @@ static int render_rectangle(flam3_frame *spec, void *out,
double nsamples, batch_size;
bucket *buckets;
abucket *accumulate;
- double *points;
+ double4 *points;
double *filter, *temporal_filter, *temporal_deltas, *batch_filter;
double ppux=0, ppuy=0;
int image_width, image_height; /* size of the image to produce */
@@ -698,7 +700,7 @@ static int render_rectangle(flam3_frame *spec, void *out,
/* Just free buckets at the end */
buckets = (bucket *) last_block;
accumulate = (abucket *) (last_block + sizeof(bucket) * nbuckets);
- points = (double *) (last_block + (sizeof(bucket) + sizeof(abucket)) * nbuckets);
+ points = (double4 *) (last_block + (sizeof(bucket) + sizeof(abucket)) * nbuckets);
if (verbose) {
fprintf(stderr, "chaos: ");
@@ -874,7 +876,7 @@ static int render_rectangle(flam3_frame *spec, void *out,
fth[thi].timer_initialize = 0;
}
- fth[thi].iter_storage = &(points[thi*(spec->sub_batch_size)*4]);
+ fth[thi].iter_storage = &(points[thi*spec->sub_batch_size]);
fth[thi].fic = &fic;
flam3_copy(&(fth[thi].cp),&cp);