• Stars
    star
    154
  • Rank 242,095 (Top 5 %)
  • Language
    C
  • License
    MIT License
  • Created over 9 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A library for computing the Fast Fourier Transform (FFT) in one or two dimensions.

muFFT

muFFT is a library for doing the fast fourier transform (FFT) in one or two dimensions. The FFT has many applications in digital signal processing. The main use cases are fast linear convolution and conversion from time domain into frequency domain and vice versa. See [The Fast Fourier Transform](@ref FFT) for details on how the algorithm works and how it is implemented in muFFT.

Features

muFFT is a moderately featured single-precision FFT library. It focuses particularly on linear convolution for audio applications and being optimized for modern architectures.

  • Power-of-two transforms
  • 1D/2D complex-to-complex transform
  • 1D/2D real-to-complex transform
  • 1D/2D complex-to-real transform
  • 1D fast convolution for applying large filters. Supports both complex/real convolutions and real/real convolutions. The complex/real convolution is particularly useful for filtering interleaved stereo audio.
  • Designed and optimized for SIMD architectures, with optimizations for SSE, SSE3 and AVX-256 currently implemented. ARMv7 and ARMv8 NEON optimizations are expected to be implemented soon.
  • Radix-2, radix-4 and radix-8 butterfly implementations.
  • Input and output does not have to be reordered, as is sometimes the case with FFT algorithms. muFFT implements the Stockham autosort algorithm to avoid any explicit permutation of FFT coefficients.
  • Detects SIMD support for your hardware in runtime. Same muFFT binary can support wide ranges of hardware feature sets.

Building

muFFT is built with straight CMake. Use add_subdirectory in your project.

muFFT uses the C99 and C++ ABI for complex numbers, interleaved real and imaginary samples, i.e.:

struct complex_float {
	float real;
	float imag;
};

C99 complex float from <complex.h> and C++ std::complex<float> from <complex> can safely be used with muFFT.

Performance

muFFT is written for performance and is usually competitive with highly optimized libraries like FFTW3 and FFmpeg/libavcodec FFT. See Benchmark for how to run your own benchmarks.

muFFT is designed with moderate size FFTs in mind. Very large FFTs which don't fit in cache could be better optimized by designing for cache utilization and tiny FFTs (N = 2, 4, 8) don't have special handcoded vectorized transforms.

muFFT does not need to run micro benchmarks ahead of time to determine optimal FFT decompositions, as is supported in more sophisticated FFT libraries. Reasonable decompositions are found statically.

License

The muFFT library is licensed under the permissive MIT license, see COPYING and preambles in source files for more detail.

Note that the muFFT-bench and muFFT-test binaries link against FFTW3 for verification purposes, a GPLv2+ library. If you choose to distribute either of these binaries, muFFT source must be provided as well. See COPYING.GPLv2 for details. These binaries are non-essential, and are only intended for use during development and verification, and not for distribution.

Documentation

The public muFFT API is documented with doxygen. Run doxygen to generate documentation. Doxygen 1.8.3 is required.

After running Doxygen, documents are found in docs/index.html.

Sample code

There is currently no dedicated sample code for muFFT. See test.c, bench.c and the documentation for reference on how to use the API. The various test and benchmark routines flex most of the API. It it also a good way to see how the API calls match up to equivalent FFTW3 routines.

Unit tests

All muFFT APIs have unit tests. muFFT output is verified against the FFTW library. The convolution API is verified against a straight O(N^2) convolution.

The FFTW3 library must be present on your system via pkg-config when building this. Note that FFTW3 (as of writing) is licensed under GPLv2+. The muFFT-test binary falls under licensing requirements of GPLv2 as per FFTW license.

Benchmark

muFFT can be benchmarked using FFTW as a reference.

Gflops values reported are based on the estimated number of flops consumed by a generic complex FFT, which is 5.0 * N * log2(N). Values reported should be taken with a grain of salt, but it gives a reasonable estimate for throughput. Average time consumed by a single FFT is reported as well.

To run the benchmark:

    ./muFFT-bench 1000000 64  # 1 million iterations of various N = 64 FFTs variants
    ./muFFT-bench 10000 64 64 # 10k iterations of 64-by-64 2D FFT
    ./muFFT-bench # Run various 1D and 2D benchmarks

The benchmark for 1D tests various things:

  • Complex-to-complex transform
  • Real-to-complex and Complex-to-real in one iteration (typical convolution scenario)
  • Mono convolution, stereo convolution

The FFTW3 library must be present on your system via pkg-config when building this. Note that FFTW3 (as of writing) is licensed under GPLv2+. The muFFT-bench binary falls under licensing requirements of GPLv2 as per FFTW3 license.

More Repositories

1

Granite

My personal Vulkan renderer
C++
1,473
star
2

libfmsynth

A C library which implements an FM synthesizer
C
327
star
3

GLFFT

A C++11/OpenGL library for the Fast Fourier Transform
C
207
star
4

parallel-rdp

A low-level Vulkan compute emulation of the N64 RDP
C++
141
star
5

Emulator-Shader-Pack

Various pixel shaders in Cg for oldschool emulators
87
star
6

RetroWarp

A Vulkan compute shader implementation of a fictional retro GPU
C++
52
star
7

MIPS-LLVM-Jitter

A simple MIPS to LLVM IR recompiler with ahead-of-time recompilation support
C++
42
star
8

slang-shaders

C
41
star
9

Dinothawr

Dinothawr is a block pushing puzzle game on slippery surfaces. Our hero is a dinosaur whose friends are trapped in ice. Through puzzles it is your task to free the dinos from their ice prison.
C
40
star
10

libmaru

USB audio class driver in userspace using libusb.
C
37
star
11

Fossilize

This repository is discontinued, see https://github.com/ValveSoftware/Fossilize
C
34
star
12

simple-irc-bot

A simple IRC bot. Hackable.
C
32
star
13

RSound

A multi-platform, simple PCM audio server and client.
C
30
star
14

RetroArch-Phoenix

Simple GUI frontend for RetroArch using Phoenix
C++
28
star
15

boxes

OpenGL 4.3 experiment with compute shaders and tons of instanced geometry! Targets libretro GL.
C
25
star
16

Granite-MicroSamples

Micro-samples for Granite to read along with my blog post: http://themaister.net/blog/2019/04/14/a-tour-of-granites-vulkan-backend-part-1/
C++
19
star
17

parallel-rdp-standalone

A standalone, distilled codebase of parallel-rdp. Autogenerated.
C++
17
star
18

alsa-plugins-rsound

RSound plugin for ALSA
C
16
star
19

SimpleGL

NIH library for OpenGL window/context creation for X11/Win32/OSX.
C
11
star
20

ToneFilterVST

Basic recreation of the Nier Automata tone filter in VST form
C++
10
star
21

SLIMPlayer

Simple and Lightweight Media Player (using FFmpeg)
C++
9
star
22

pyrofling

PyroFling is a simple solution for capturing Vulkan applications and broadcast video and audio to streaming platforms using FFmpeg.
C++
8
star
23

SFC-Pong

A very newbish Pong game for Super Nintendo.
Assembly
5
star
24

airsynth

Multi-instrument polyphonic synthesizer for LV2 with a standalone JACK implementation.
C++
5
star
25

bsnes-Qt

Fork of BSNES/QT (v073)
C++
4
star
26

MIPS-Toolchain-PKGBUILD

A set of PKGBUILDs to build a MIPS (big-endian) toolchain
Shell
4
star
27

SC-MIPS

Simple, single cycle MIPS implementation in VHDL. Extended to support most instructions.
VHDL
4
star
28

libretro-ffmpeg

Video player implemented in libretro.
C++
2
star
29

XMLShaderView

View XML shaders in your browser!
JavaScript
2
star
30

parallel-psx-dump-replayer

Standalone tool to replay dumps from Parallel PSX
C++
2
star
31

alsa-reroute

Small script/preloaded lib that intercepts calls to ALSA and force them to open different devices.
C
2
star
32

Quickbuild

Simplistic build system written in sh to help with configuring building from source.
Shell
2
star
33

blipper

Band-limited decimator for emulators.
C
2
star
34

umusd

Microscopic music player controlled over TCP.
C++
2
star
35

Scale

Small and simple image scaler.
C
2
star
36

DirectRSound

Reimplement a subset of DirectSound with RSound.
C++
2
star
37

RetroArch-DSP-plugins

Audio DSP plugins for RetroArch.
C++
2
star
38

sussybard

Simple app which converts MIDI key inputs to X key presses, designed for playing FF XIV Bard
C++
2
star
39

SSNES-core

Futile attempt to create a SNES emulator :)
C
2
star
40

SC-MIPS-Chain

Simple toolchain for SC-MIPS
C
2
star
41

GLModelViewer

Simple modelviewer in OpenGL 3.0+
C
2
star
42

stile

Simple picture converter to SNES-format tilemap/tileset palette and stuff.
C++
1
star
43

midiviz

Crappy ad-hoc MIDI visualizer
C
1
star
44

iceypuzzle

Some simple engine for doing sliding puzzles, or something... :')
C++
1
star
45

RetroArch-D3D9

D3D9 external driver plugin for RetroArch.
C++
1
star
46

libretro-remotejoy

RemoteJoy client side code rewritten for libretro.
C
1
star
47

rtorrent-nogui

Attempts to run rtorrent as a pure daemon without GUI.
C++
1
star