aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2010-03-02 11:29:08 +0100
committerThomas White <taw@bitwiz.org.uk>2010-03-02 11:29:08 +0100
commitac31e1424881a79d23edd3eef27b9adc4b5db528 (patch)
treed4e6244a43d75118fdca36d13237503b7b1d8d86
parent941a11c243ddced4f9a7b7a5723d3b95d77c8651 (diff)
Take modulus when calculating sinc LUT
-rw-r--r--src/diffraction-gpu.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/diffraction-gpu.c b/src/diffraction-gpu.c
index c54b9aea..c76531b8 100644
--- a/src/diffraction-gpu.c
+++ b/src/diffraction-gpu.c
@@ -392,7 +392,7 @@ struct gpu_context *setup_gpu(int no_sfac, struct image *image,
for ( i=1; i<SINC_LUT_ELEMENTS; i++ ) {
double x, val;
x = (double)i/SINC_LUT_ELEMENTS;
- val = sin(M_PI*na*x)/sin(M_PI*x);
+ val = fabs(sin(M_PI*na*x)/sin(M_PI*x));
gctx->func_a_ptr[i] = val;
}
gctx->func_a = clCreateImage2D(gctx->ctx,
@@ -411,7 +411,7 @@ struct gpu_context *setup_gpu(int no_sfac, struct image *image,
for ( i=1; i<SINC_LUT_ELEMENTS; i++ ) {
double x, val;
x = (double)i/SINC_LUT_ELEMENTS;
- val = sin(M_PI*nb*x)/sin(M_PI*x);
+ val = fabs(sin(M_PI*nb*x)/sin(M_PI*x));
gctx->func_b_ptr[i] = val;
}
gctx->func_b = clCreateImage2D(gctx->ctx,
@@ -430,7 +430,7 @@ struct gpu_context *setup_gpu(int no_sfac, struct image *image,
for ( i=1; i<SINC_LUT_ELEMENTS; i++ ) {
double x, val;
x = (double)i/SINC_LUT_ELEMENTS;
- val = sin(M_PI*nc*x)/sin(M_PI*x);
+ val = fabs(sin(M_PI*nc*x)/sin(M_PI*x));
gctx->func_c_ptr[i] = val;
}
gctx->func_c = clCreateImage2D(gctx->ctx,