001package com.nativelibs4java.opencl.util.fft; 002import com.nativelibs4java.opencl.CLAbstractUserProgram; 003import com.nativelibs4java.opencl.CLBuffer; 004import com.nativelibs4java.opencl.CLBuildException; 005import com.nativelibs4java.opencl.CLContext; 006import com.nativelibs4java.opencl.CLEvent; 007import com.nativelibs4java.opencl.CLKernel; 008import com.nativelibs4java.opencl.CLProgram; 009import com.nativelibs4java.opencl.CLQueue; 010import java.io.IOException; 011/** Wrapper around the OpenCL program FloatFFTProgram */ 012public class FloatFFTProgram extends CLAbstractUserProgram { 013 public FloatFFTProgram(CLContext context) throws IOException { 014 super(context, readRawSourceForClass(FloatFFTProgram.class)); 015 } 016 public FloatFFTProgram(CLProgram program) throws IOException { 017 super(program, readRawSourceForClass(FloatFFTProgram.class)); 018 } 019 CLKernel cooleyTukeyFFTCopy_kernel; 020 public synchronized CLEvent cooleyTukeyFFTCopy(CLQueue commandQueue, CLBuffer<Float > X, CLBuffer<Float > Y, int N, CLBuffer<Integer > offsetsX, float factor, int globalWorkSizes[], int localWorkSizes[], CLEvent... eventsToWaitFor) throws CLBuildException { 021 if ((cooleyTukeyFFTCopy_kernel == null)) 022 cooleyTukeyFFTCopy_kernel = createKernel("cooleyTukeyFFTCopy"); 023 cooleyTukeyFFTCopy_kernel.setArgs(X, Y, N, offsetsX, factor); 024 return cooleyTukeyFFTCopy_kernel.enqueueNDRange(commandQueue, globalWorkSizes, localWorkSizes, eventsToWaitFor); 025 } 026 CLKernel cooleyTukeyFFTTwiddleFactors_kernel; 027 public synchronized CLEvent cooleyTukeyFFTTwiddleFactors(CLQueue commandQueue, int N, CLBuffer<Float > twiddleFactors, int globalWorkSizes[], int localWorkSizes[], CLEvent... eventsToWaitFor) throws CLBuildException { 028 if ((cooleyTukeyFFTTwiddleFactors_kernel == null)) 029 cooleyTukeyFFTTwiddleFactors_kernel = createKernel("cooleyTukeyFFTTwiddleFactors"); 030 cooleyTukeyFFTTwiddleFactors_kernel.setArgs(N, twiddleFactors); 031 return cooleyTukeyFFTTwiddleFactors_kernel.enqueueNDRange(commandQueue, globalWorkSizes, localWorkSizes, eventsToWaitFor); 032 } 033 CLKernel cooleyTukeyFFT_kernel; 034 public synchronized CLEvent cooleyTukeyFFT(CLQueue commandQueue, CLBuffer<Float > Y, int N, CLBuffer<Float > twiddleFactors, int inverse, int globalWorkSizes[], int localWorkSizes[], CLEvent... eventsToWaitFor) throws CLBuildException { 035 if ((cooleyTukeyFFT_kernel == null)) 036 cooleyTukeyFFT_kernel = createKernel("cooleyTukeyFFT"); 037 cooleyTukeyFFT_kernel.setArgs(Y, N, twiddleFactors, inverse); 038 return cooleyTukeyFFT_kernel.enqueueNDRange(commandQueue, globalWorkSizes, localWorkSizes, eventsToWaitFor); 039 } 040}