summaryrefslogtreecommitdiff
path: root/interpolation.c
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2015-03-01 20:51:37 +0100
committerLars-Dominik Braun <lars@6xq.net>2015-05-02 21:36:45 +0200
commit4c21b2ea8d42a92e2f1cbfd93346ff77041ea44d (patch)
tree32b955a06368886d4df77c0e2bfb53ef137580ef /interpolation.c
parent4d2d896e28446928d820bf1353abcf40e3f66ed8 (diff)
downloadpucket-4c21b2ea8d42a92e2f1cbfd93346ff77041ea44d.tar.gz
pucket-4c21b2ea8d42a92e2f1cbfd93346ff77041ea44d.tar.bz2
pucket-4c21b2ea8d42a92e2f1cbfd93346ff77041ea44d.zip
Fix colormap segfault
The segfaults due to unaligned vector access should have happened before the recent changes. Not sure why it worked before. Reverts colormap vectorization. This is going to be restored once I rework the colormaps.
Diffstat (limited to 'interpolation.c')
-rw-r--r--interpolation.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/interpolation.c b/interpolation.c
index 279e1a2..7e1d482 100644
--- a/interpolation.c
+++ b/interpolation.c
@@ -159,8 +159,8 @@ void interpolate_cmap(flam3_palette cmap, double blend,
double4 t, s;
double t4, s4;
- s = rgb2hsv(p0[i].color);
- t = rgb2hsv(p1[i].color);
+ s = rgb2hsv(vector_d4 (p0[i].color));
+ t = rgb2hsv(vector_d4 (p1[i].color));
s[3] = p0[i].color[3];
t[3] = p1[i].color[3];
@@ -172,7 +172,10 @@ void interpolate_cmap(flam3_palette cmap, double blend,
t[j] = ((1.0-blend) * s[j]) + (blend * t[j]);
t4 = ((1.0-blend) * s4) + (blend * t4);
- cmap[i].color = hsv2rgb(t);
+ const double4 c = hsv2rgb(t);
+ cmap[i].color[0] = c[0];
+ cmap[i].color[1] = c[1];
+ cmap[i].color[2] = c[2];
cmap[i].color[3] = t[3];
cmap[i].index = t4;
}
@@ -371,7 +374,7 @@ void flam3_interpolate_n(flam3_genome *result, int ncp,
s[0] = s[1] = s[2] = s[3] = s4 = 0.0;
for (k = 0; k < ncp; k++) {
- t = rgb2hsv(cpi[k].palette[i].color);
+ t = rgb2hsv(vector_d4 (cpi[k].palette[i].color));
for (j = 0; j < 3; j++)
s[j] += c[k] * t[j];
@@ -385,7 +388,10 @@ void flam3_interpolate_n(flam3_genome *result, int ncp,
if (alpha1 == 1)
s[3] = 1.0;
- result->palette[i].color = hsv2rgb(s);
+ const double4 ret_color = hsv2rgb(s);
+ result->palette[i].color[0] = ret_color[0];
+ result->palette[i].color[1] = ret_color[1];
+ result->palette[i].color[2] = ret_color[2];
result->palette[i].color[3] = s[3];
result->palette[i].index = s4;