Code Monkey home page Code Monkey logo

fftf's Introduction

Fast Fourier Transform Frontend

This library puts various Fast Fourier Transform implementations (built-in and third party) under a single interface. Supported backends are:

  • KissFFT
  • Ooura FFT
  • libavcodec
  • FFTW3
  • Intel Integrated Performance Primitives
  • Intel Math Kernel Library
  • Nvidia cuFFT
  • AMD OpenCL
  • ViennaCL

Refer to Doxygen documentation for details. FFTF uses SEAPT build system, so is compiled on UNIX systems only.

Installation

Getting the source

git clone https://github.com/vmarkovtsev/FFTF.git

Compiling

The following commands will install FFTF to /opt:

./autogen.sh build --enable-gpl --enable-opencl --enable-cuda --prefix=/opt
cd build && make -j$(getconf _NPROCESSORS_ONLN)
sudo make install

Example

#include <assert.h>  // for assert()
#include <fftf/api.h>
#include <stdlib.h>  // for atexit()

// Scan for libraries
FFTFBackendbackends = fftf_available_backends(NULL, NULL);

// Check if FFTW3 was successfully loaded
assert(backends[FFTF_BACKEND_FFTW3].path != NULL);

// Give it maximal priority
fftf_set_backend_priority(FFTF_BACKEND_FFTW3,
                          BACKEND_MAX_INITIAL_PRIORITY + 1);

// Note: the alternative way to use that backend is just
assert(fftf_set_backend(FFTF_BACKEND_FFTW3) == FFTF_SET_BACKEND_SUCCESS);
// without even scanning for available backends

// Schedule the FFTF resources cleanup
atexit(fftf_cleanup);

// Transform N complex numbers
const int N = 2048;
floatin = fftf_malloc(N2sizeof(float));
fill_with_numbers(in, N);

// Prepare the space for the result
floatout = fftf_malloc(N2sizeof(float));

// Obtain the calculation plan (instance)
FFTFInstance instance = fftf_init(FFTF_TYPE_COMPLEX, FFTF_DIRECTION_FORWARD,
                                 FFTF_DIMENSION_1D, N, FFTF_NO_OPTIONS,
                                 in, out);

// Calculate the forward 1-dimensional complex FFT
fftf_calc(instance);

// Free the plan
fftf_destroy(instance);

// Free in and out arrays
fftf_free(in);
fftf_free(out);

FFTF is released under the Simplified BSD License. If FFTW3 backend is configured, FFTF automatically becomes GPL. Copyright 2013 Samsung R&D Institute Russia.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.