GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
clFFT.h
Go to the documentation of this file.
1 /*!
2  * \file clFFT.h
3  * \brief FFT in OpenCL
4  *
5  *
6  * Version: <1.0>
7  *
8  * Copyright ( C ) 2008 Apple Inc. All Rights Reserved.
9  * SPDX-License-Identifier: LicenseRef-Apple-Permissive
10  *
11  */
12 
13 #ifndef __CLFFT_H
14 #define __CLFFT_H
15 
16 #ifdef __cplusplus
17 extern "C"
18 {
19 #endif
20 
21 #include <stdio.h>
22 
23 #ifdef __APPLE__
24 #define CL_SILENCE_DEPRECATION
25 #include <OpenCL/opencl.h>
26 #else
27 #include <CL/cl.h>
28 #endif
29 
30  // XForm type
31  typedef enum
32  {
33  clFFT_Forward = -1,
34  clFFT_Inverse = 1
35  } clFFT_Direction;
36 
37  // XForm dimension
38  typedef enum
39  {
40  clFFT_1D = 0,
41  clFFT_2D = 1,
42  clFFT_3D = 3
43  } clFFT_Dimension;
44 
45  // XForm Data type
46  typedef enum
47  {
48  clFFT_SplitComplexFormat = 0,
49  clFFT_InterleavedComplexFormat = 1
50  } clFFT_DataFormat;
51 
52  typedef struct
53  {
54  unsigned int x;
55  unsigned int y;
56  unsigned int z;
57  } clFFT_Dim3;
58 
59  typedef struct
60  {
61  float *real;
62  float *imag;
64 
65  typedef struct
66  {
67  float real;
68  float imag;
69  } clFFT_Complex;
70 
71  typedef void *clFFT_Plan;
72 
73  clFFT_Plan clFFT_CreatePlan(cl_context context, clFFT_Dim3 n, clFFT_Dimension dim, clFFT_DataFormat dataFormat, cl_int *error_code);
74 
75  void clFFT_DestroyPlan(clFFT_Plan plan);
76 
77  cl_int clFFT_ExecuteInterleaved(cl_command_queue queue, clFFT_Plan plan, cl_int batchSize, clFFT_Direction dir,
78  cl_mem data_in, cl_mem data_out,
79  cl_int num_events, cl_event *event_list, cl_event *event);
80 
81  cl_int clFFT_ExecutePlannar(cl_command_queue queue, clFFT_Plan plan, cl_int batchSize, clFFT_Direction dir,
82  cl_mem data_in_real, cl_mem data_in_imag, cl_mem data_out_real, cl_mem data_out_imag,
83  cl_int num_events, cl_event *event_list, cl_event *event);
84 
85  cl_int clFFT_1DTwistInterleaved(clFFT_Plan Plan, cl_command_queue queue, cl_mem array,
86  size_t numRows, size_t numCols, size_t startRow, size_t rowsToProcess, clFFT_Direction dir);
87 
88 
89  cl_int clFFT_1DTwistPlannar(clFFT_Plan Plan, cl_command_queue queue, cl_mem array_real, cl_mem array_imag,
90  size_t numRows, size_t numCols, size_t startRow, size_t rowsToProcess, clFFT_Direction dir);
91 
92  void clFFT_DumpPlan(clFFT_Plan plan, FILE *file);
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 #endif