diff options
author | Tomas Farago <sensej007@email.cz> | 2020-03-05 15:12:02 +0100 |
---|---|---|
committer | Tomas Farago <sensej007@email.cz> | 2020-03-05 15:12:02 +0100 |
commit | 408475f98550c7f92fc46d608a945a2497f4b6a8 (patch) | |
tree | 54337998192924473a31c42b7b00c72b55b9ec3b | |
parent | 9d39236cadc6cec3f286871efc67da3e7a6d65eb (diff) | |
download | ufo-filters-408475f98550c7f92fc46d608a945a2497f4b6a8.tar.gz ufo-filters-408475f98550c7f92fc46d608a945a2497f4b6a8.tar.bz2 ufo-filters-408475f98550c7f92fc46d608a945a2497f4b6a8.tar.xz ufo-filters-408475f98550c7f92fc46d608a945a2497f4b6a8.zip |
complex: add c_abs_squared kernel
-rw-r--r-- | src/kernels/complex.cl | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/kernels/complex.cl b/src/kernels/complex.cl index 93c0f02..26cc180 100644 --- a/src/kernels/complex.cl +++ b/src/kernels/complex.cl @@ -71,6 +71,19 @@ c_conj (global float *data, out[idx+1] = -data[idx+1]; } +kernel void +c_abs_squared (global float *data, + global float *out) +{ + int y = get_global_id (1) * 2 * get_global_size (0); + int in_idx = y + 2 * get_global_id(0); + int out_idx = y + get_global_id(0); + + /* Store the results in the horizontally first half of the complex *out* + * array, so the result of this should be cropped to half the input width. */ + out[out_idx] = data[in_idx] * data[in_idx] + data[in_idx + 1] * data[in_idx + 1]; +} + /** * c_mul_real_sym: * @frequencies: complex Fourier transform frequencies with interleaved |