kml_ffth_plan_dft_scale_c2r_2d
Create a plan for the two-dimensional C2R transform of a single contiguous data array.
Interface Definition
C interface:
kml_ffth_plan kml_ffth_plan_dft_scale_c2r_2d(int n0, int n1, kml_ffth_complex *in, float *out, unsigned flags);
Return Value
The function returns a structure pointer of the kml_ffth_plan type. This object can be passed to the kml_fft(f/h)_execute function as a parameter to perform FFT on the current input and output. This object can also be passed to the kml_ffth_execute_dft_scale_c2r function as a parameter to perform FFT on new input and output.
If this function returns a non-null pointer, the plan has been successfully created. Otherwise, the plan fails to be created.
Parameters
Parameter |
Data Type |
Description |
Input/Output |
|---|---|---|---|
n0 |
int |
Inputs the size of the first dimension in the FFT array. The constraint is n0 ≥ 1. |
Input |
n1 |
int |
Inputs the size of the second dimension in the FFT array. The constraint is n1 ≥ 1. |
Input |
in |
kml_ffth_complex* |
Inputs the data to be transformed. |
Input |
out |
float* |
Outputs the data generated using FFT. |
Output |
flags |
unsigned int |
Planning option, which describes the ESTIMATE or PATIENT mode. KML_FFT_ESTIMATE: ESTIMATE mode KML_FFT_PATIENT: PATIENT mode |
Input |
Dependencies
C: "kfft.h"
Examples
C interface:
int n0 = 4;
int n1 = 4;
__fp16 init[12][2] = {{120, 0}, {8, 8}, {0, 0}, {0, 16}, {0, 16}, {-8, 8}, {-8, 0}, {-8, 8}, {-16, 0}, {0, -16}, {-40, 8}, {-8, -8}};
kml_ffth_complex *in;
in = (kml_ffth_complex*)kml_ffth_malloc(sizeof(kml_ffth_complex) * n0 * (n1 / 2 + 1));
for (int i = 0; i < n0 * (n1 / 2 + 1); i++){
in[i][0] = init[i][0];
in[i][1] = init[i][1];
}
float *out;
out = (float*)kml_ffth_malloc(sizeof(float) * n0 * n1);
kml_ffth_plan plan;
plan = kml_ffth_plan_dft_scale_c2r_2d(n0, n1, in , out , KML_FFT_ESTIMATE);
kml_ffth_execute_dft_scale_c2r(plan, in, out);
kml_ffth_destroy_plan(plan);
kml_ffth_free(in);
kml_ffth_free(out);
/*
* out = {0.000000e+00, 6.400000e+01, 1.600000e+02, 2.240000e+02,
* 1.120000e+02, 1.600000e+01, 8.000000e+01, 1.760000e+02,
* 1.920000e+02, 1.280000e+02, 3.200000e+01, 9.600000e+01,
* 2.400000e+02, 2.080000e+02, 1.440000e+02, 4.800000e+01}
*/