summaryrefslogtreecommitdiff
path: root/opencl
diff options
context:
space:
mode:
authorTéo Mazars <teo.mazars@ensimag.fr>2013-10-31 16:43:25 +0100
committerTéo Mazars <teo.mazars@ensimag.fr>2013-10-31 16:44:46 +0100
commit5bfa7251d606dd242679feaee33e161dee527069 (patch)
treebe835f28dee62a38c86e0d5f0744a9aadbadd403 /opencl
parent1ff66f59f4081a331636d62b9ef9b5c35df20e4e (diff)
opencl: fix a bunch of opencl compilation error with pocl
Diffstat (limited to 'opencl')
-rw-r--r--opencl/c2g.cl4
-rw-r--r--opencl/c2g.cl.h4
-rw-r--r--opencl/noise-reduction.cl4
-rw-r--r--opencl/noise-reduction.cl.h4
-rw-r--r--opencl/snn-mean.cl4
-rw-r--r--opencl/snn-mean.cl.h4
6 files changed, 12 insertions, 12 deletions
diff --git a/opencl/c2g.cl b/opencl/c2g.cl
index 6442eebb..6140c91f 100644
--- a/opencl/c2g.cl
+++ b/opencl/c2g.cl
@@ -103,8 +103,8 @@ void compute_envelopes(const __global float4 *src_buf,
range_sum += range;
}
- float4 relative_brightness = relative_brightness_sum / iterations;
- float4 range = range_sum / iterations;
+ float4 relative_brightness = relative_brightness_sum / (float4)(iterations);
+ float4 range = range_sum / (float4)(iterations);
if(max_envelope)
*max_envelope = pixel + (1.0f - relative_brightness) * range;
diff --git a/opencl/c2g.cl.h b/opencl/c2g.cl.h
index 3831faf3..451a1767 100644
--- a/opencl/c2g.cl.h
+++ b/opencl/c2g.cl.h
@@ -104,8 +104,8 @@ static const char* c2g_cl_source =
" range_sum += range; \n"
" } \n"
" \n"
-" float4 relative_brightness = relative_brightness_sum / iterations; \n"
-" float4 range = range_sum / iterations; \n"
+" float4 relative_brightness = relative_brightness_sum / (float4)(iterations);\n"
+" float4 range = range_sum / (float4)(iterations); \n"
" \n"
" if(max_envelope) \n"
" *max_envelope = pixel + (1.0f - relative_brightness) * range; \n"
diff --git a/opencl/noise-reduction.cl b/opencl/noise-reduction.cl
index 312087bb..e84d172a 100644
--- a/opencl/noise-reduction.cl
+++ b/opencl/noise-reduction.cl
@@ -3,7 +3,7 @@
#define POW2(a) ((a)*(a))
-#define GEN_METRIC(before, center, after) POW2((center) * 2 - (before) - (after))
+#define GEN_METRIC(before, center, after) POW2((center) * (float4)(2.0f) - (before) - (after))
#define BAIL_CONDITION(new,original) ((new) < (original))
@@ -60,7 +60,7 @@ __kernel void noise_reduction_cl (__global float4 *src_buf,
after_pix);
mask = BAIL_CONDITION (metric_new, metric_reference[axis]) & mask;
}
- sum += mask >0 ? value : 0;
+ sum += mask >0 ? value : (float4)(0.0);
count += mask >0 ? 1 : 0;
}
dst_buf[dst_offset] = (sum/convert_float4(count));
diff --git a/opencl/noise-reduction.cl.h b/opencl/noise-reduction.cl.h
index 969fe2a3..9794fd81 100644
--- a/opencl/noise-reduction.cl.h
+++ b/opencl/noise-reduction.cl.h
@@ -4,7 +4,7 @@ static const char* noise_reduction_cl_source =
" \n"
"#define POW2(a) ((a)*(a)) \n"
" \n"
-"#define GEN_METRIC(before, center, after) POW2((center) * 2 - (before) - (after))\n"
+"#define GEN_METRIC(before, center, after) POW2((center) * (float4)(2.0f) - (before) - (after))\n"
" \n"
"#define BAIL_CONDITION(new,original) ((new) < (original)) \n"
" \n"
@@ -61,7 +61,7 @@ static const char* noise_reduction_cl_source =
" after_pix); \n"
" mask = BAIL_CONDITION (metric_new, metric_reference[axis]) & mask;\n"
" } \n"
-" sum += mask >0 ? value : 0; \n"
+" sum += mask >0 ? value : (float4)(0.0); \n"
" count += mask >0 ? 1 : 0; \n"
" } \n"
" dst_buf[dst_offset] = (sum/convert_float4(count)); \n"
diff --git a/opencl/snn-mean.cl b/opencl/snn-mean.cl
index 9802b460..8270e56b 100644
--- a/opencl/snn-mean.cl
+++ b/opencl/snn-mean.cl
@@ -62,7 +62,7 @@ __kernel void snn_mean (__global const float4 *src_buf,
break;
}
}
- dst_buf[offset] = accumulated/count;
+ dst_buf[offset] = accumulated/(float4)(count);
return;
}
else if(pairs==1)
@@ -108,7 +108,7 @@ __kernel void snn_mean (__global const float4 *src_buf,
break;
}
}
- dst_buf[offset] = accumulated/count;
+ dst_buf[offset] = accumulated / (float4)(count);
return;
}
return;
diff --git a/opencl/snn-mean.cl.h b/opencl/snn-mean.cl.h
index 21b4935d..0aec7e63 100644
--- a/opencl/snn-mean.cl.h
+++ b/opencl/snn-mean.cl.h
@@ -63,7 +63,7 @@ static const char* snn_mean_cl_source =
" break; \n"
" } \n"
" } \n"
-" dst_buf[offset] = accumulated/count; \n"
+" dst_buf[offset] = accumulated/(float4)(count); \n"
" return; \n"
" } \n"
" else if(pairs==1) \n"
@@ -109,7 +109,7 @@ static const char* snn_mean_cl_source =
" break; \n"
" } \n"
" } \n"
-" dst_buf[offset] = accumulated/count; \n"
+" dst_buf[offset] = accumulated / (float4)(count); \n"
" return; \n"
" } \n"
" return; \n"