{"id":13628930,"url":"https://github.com/mborgerding/kissfft","last_synced_at":"2025-05-14T05:10:46.520Z","repository":{"id":28946283,"uuid":"108277489","full_name":"mborgerding/kissfft","owner":"mborgerding","description":"a Fast Fourier Transform (FFT) library that tries to Keep it Simple, Stupid","archived":false,"fork":false,"pushed_at":"2025-02-10T13:42:49.000Z","size":984,"stargazers_count":1598,"open_issues_count":39,"forks_count":309,"subscribers_count":48,"default_branch":"master","last_synced_at":"2025-04-11T00:45:45.041Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mborgerding.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-25T13:55:40.000Z","updated_at":"2025-04-10T11:43:11.000Z","dependencies_parsed_at":"2024-01-31T09:03:53.257Z","dependency_job_id":"8664b898-aa5a-4d1a-bb0a-73dac35386e7","html_url":"https://github.com/mborgerding/kissfft","commit_stats":{"total_commits":344,"total_committers":29,"mean_commits":"11.862068965517242","dds":"0.22093023255813948","last_synced_commit":"f5f2a3b2f2cd02bf80639adb12cbeed125bdf420"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mborgerding%2Fkissfft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mborgerding%2Fkissfft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mborgerding%2Fkissfft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mborgerding%2Fkissfft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mborgerding","download_url":"https://codeload.github.com/mborgerding/kissfft/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254076850,"owners_count":22010611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T22:00:59.721Z","updated_at":"2025-05-14T05:10:46.477Z","avatar_url":"https://github.com/mborgerding.png","language":"C","funding_links":[],"categories":["DSP","C","Data processing","Maths","Packages"],"sub_categories":["DSP and Filtering","Signal process"],"readme":"# KISS FFT [![Build Status](https://travis-ci.com/mborgerding/kissfft.svg?branch=master)](https://travis-ci.com/mborgerding/kissfft)\n\nKISS FFT - A mixed-radix Fast Fourier Transform based up on the principle, \n\"Keep It Simple, Stupid.\"\n\nThere are many great fft libraries already around.  Kiss FFT is not trying\nto be better than any of them.  It only attempts to be a reasonably efficient, \nmoderately useful FFT that can use fixed or floating data types and can be \nincorporated into someone's C program in a few minutes with trivial licensing.\n\n## USAGE:\n\nThe basic usage for 1-d complex FFT is:\n\n```c\n    #include \"kiss_fft.h\"\n    kiss_fft_cfg cfg = kiss_fft_alloc( nfft ,is_inverse_fft ,0,0 );\n    while ...\n    \n        ... // put kth sample in cx_in[k].r and cx_in[k].i\n        \n        kiss_fft( cfg , cx_in , cx_out );\n        \n        ... // transformed. DC is in cx_out[0].r and cx_out[0].i \n        \n    kiss_fft_free(cfg);\n```\n - **Note**: frequency-domain data is stored from dc up to 2pi.\n    so cx_out[0] is the dc bin of the FFT\n    and cx_out[nfft/2] is the Nyquist bin (if exists)\n\nDeclarations are in \"kiss_fft.h\", along with a brief description of the \nfunctions you'll need to use. \n\nCode definitions for 1d complex FFTs are in kiss_fft.c.\n\nYou can do other cool stuff with the extras you'll find in tools/\n\u003e - multi-dimensional FFTs \n\u003e - real-optimized FFTs  (returns the positive half-spectrum: \n    (nfft/2+1) complex frequency bins)\n\u003e - fast convolution FIR filtering (not available for fixed point)\n\u003e - spectrum image creation\n\nThe core fft and most tools/ code can be compiled to use float, double,\n Q15 short or Q31 samples. The default is float.\n\n## BUILDING:\n\nThere are two functionally-equivalent build systems supported by kissfft:\n\n - Make (traditional Makefiles for Unix / Linux systems)\n - CMake (more modern and feature-rich build system developed by Kitware)\n\nTo build kissfft, the following build environment can be used:\n\n - GNU build environment with GCC, Clang and GNU Make or CMake (\u003e= 3.6)\n - Microsoft Visual C++ (MSVC) with CMake (\u003e= 3.6)\n\nAdditional libraries required to build and test kissfft include:\n\n - libpng for psdpng tool,\n - libfftw3 to validate kissfft results against it,\n - python 2/3 with Numpy to validate kissfft results against it.\n - OpenMP supported by GCC, Clang or MSVC for multi-core FFT transformations\n\nEnvironments like Cygwin and MinGW can be highly likely used to build kissfft\ntargeting Windows platform, but no tests were performed to the date.\n\nBoth Make and CMake builds are easily configurable:\n\n - `KISSFFT_DATATYPE=\u003cdatatype\u003e` (for Make) or `-DKISSFFT_DATATYPE=\u003cdatatype\u003e`\n   (for CMake) denote the principal datatype used by kissfft. It can be one\n   of the following:\n\n   - float (default)\n   - double\n   - int16_t\n   - int32_t\n   - SIMD (requires SSE instruction set support on target CPU)\n\n - `KISSFFT_OPENMP=1` (for Make) or `-DKISSFFT_OPENMP=ON` (for CMake) builds kissfft\n   with OpenMP support. Please note that a supported compiler is required and this\n   option is turned off by default.\n\n - `KISSFFT_STATIC=1` (for Make) or `-DKISSFFT_STATIC=ON` (for CMake) instructs\n   the builder to create static library ('.lib' for Windows / '.a' for Unix or Linux).\n   By default, this option is turned off and the shared library is created\n   ('.dll' for Windows, '.so' for Linux or Unix, '.dylib' for Mac OSX)\n\n - `-DKISSFFT_TEST=OFF` (for CMake) disables building tests for kissfft. On Make,\n   building tests is done separately by 'make testall' or 'make testsingle', so\n   no specific setting is required.\n\n - `KISSFFT_TOOLS=0` (for Make) or `-DKISSFFT_TOOLS=OFF` (for CMake) builds kissfft\n    without command-line tools like 'fastconv'. By default the tools are built.\n\n    - `KISSFFT_USE_ALLOCA=1` (for Make) or `-DKISSFFT_USE_ALLOCA=ON` (for CMake)\n       build kissfft with 'alloca' usage instead of 'malloc' / 'free'.\n\n    - `PREFIX=/full/path/to/installation/prefix/directory` (for Make) or\n      `-DCMAKE_INSTALL_PREFIX=/full/path/to/installation/prefix/directory` (for CMake)\n      specifies the prefix directory to install kissfft into.\n\nFor example, to build kissfft as a static library with 'int16_t' datatype and\nOpenMP support using Make, run the command from kissfft source tree:\n\n```\nmake KISSFFT_DATATYPE=int16_t KISSFFT_STATIC=1 KISSFFT_OPENMP=1 all\n```\n\nThe same configuration for CMake is:\n\n```\nmkdir build \u0026\u0026 cd build\ncmake -DKISSFFT_DATATYPE=int16_t -DKISSFFT_STATIC=ON -DKISSFFT_OPENMP=ON ..\nmake all\n```\n\nTo specify '/tmp/1234' as installation prefix directory, run:\n\n\n```\nmake PREFIX=/tmp/1234 KISSFFT_DATATYPE=int16_t KISSFFT_STATIC=1 KISSFFT_OPENMP=1 install\n```\n\nor\n\n```\nmkdir build \u0026\u0026 cd build\ncmake -DCMAKE_INSTALL_PREFIX=/tmp/1234 -DKISSFFT_DATATYPE=int16_t -DKISSFFT_STATIC=ON -DKISSFFT_OPENMP=ON ..\nmake all\nmake install\n```\n\n## TESTING:\n\nTo validate the build configured as an example above, run the following command from\nkissfft source tree:\n\n```\nmake KISSFFT_DATATYPE=int16_t KISSFFT_STATIC=1 KISSFFT_OPENMP=1 testsingle\n```\n\nif using Make, or:\n\n```\nmake test\n```\n\nif using CMake.\n\nTo test all possible build configurations, please run an extended testsuite from\nkissfft source tree:\n\n```\nsh test/kissfft-testsuite.sh\n```\n\nPlease note that the extended testsuite takes around 20-40 minutes depending on device\nit runs on. This testsuite is useful for reporting bugs or testing the pull requests.\n\n## BACKGROUND\n\nI started coding this because I couldn't find a fixed point FFT that didn't \nuse assembly code.  I started with floating point numbers so I could get the \ntheory straight before working on fixed point issues.  In the end, I had a \nlittle bit of code that could be recompiled easily to do ffts with short, float\nor double (other types should be easy too).  \n\nOnce I got my FFT working, I was curious about the speed compared to\na well respected and highly optimized fft library.  I don't want to criticize \nthis great library, so let's call it FFT_BRANDX.\nDuring this process, I learned:\n\n\u003e 1. FFT_BRANDX has more than 100K lines of code. The core of kiss_fft is about 500 lines (cpx 1-d).\n\u003e 2. It took me an embarrassingly long time to get FFT_BRANDX working.\n\u003e 3. A simple program using FFT_BRANDX is 522KB. A similar program using kiss_fft is 18KB (without optimizing for size).\n\u003e 4. FFT_BRANDX is roughly twice as fast as KISS FFT in default mode.\n\nIt is wonderful that free, highly optimized libraries like FFT_BRANDX exist.\nBut such libraries carry a huge burden of complexity necessary to extract every \nlast bit of performance.\n\n**Sometimes simpler is better, even if it's not better.**\n\n## FREQUENTLY ASKED QUESTIONS:\n\u003e Q: Can I use kissfft in a project with a ___ license?\u003c/br\u003e\n\u003e A: Yes.  See LICENSE below.\n\n\u003e Q: Why don't I get the output I expect?\u003c/br\u003e\n\u003e A: The two most common causes of this are\n\u003e \t1) scaling : is there a constant multiplier between what you got and what you want?\n\u003e \t2) mixed build environment -- all code must be compiled with same preprocessor \n\u003e \tdefinitions for FIXED_POINT and kiss_fft_scalar\n\n\u003e Q: Will you write/debug my code for me?\u003c/br\u003e\n\u003e A: Probably not unless you pay me.  I am happy to answer pointed and topical questions, but \n\u003e I may refer you to a book, a forum, or some other resource.\n\n\n## PERFORMANCE\n    (on Athlon XP 2100+, with gcc 2.96, float data type)\n\nKiss performed 10000 1024-pt cpx ffts in .63 s of cpu time.\nFor comparison, it took md5sum twice as long to process the same amount of data.\nTransforming 5 minutes of CD quality audio takes less than a second (nfft=1024). \n\n**DO NOT:**\n- use Kiss if you need the Fastest Fourier Transform in the World\n- ask me to add features that will bloat the code\n\n## UNDER THE HOOD\n\nKiss FFT uses a time decimation, mixed-radix, out-of-place FFT. If you give it an input buffer  \nand output buffer that are the same, a temporary buffer will be created to hold the data.\n\nNo static data is used.  The core routines of kiss_fft are thread-safe (but not all of the tools directory).[\n\nNo scaling is done for the floating point version (for speed).  \nScaling is done both ways for the fixed-point version (for overflow prevention).\n\nOptimized butterflies are used for factors 2,3,4, and 5. \n\nThe real (i.e. not complex) optimization code only works for even length ffts.  It does two half-length\nFFTs in parallel (packed into real\u0026imag), and then combines them via twiddling.  The result is \nnfft/2+1 complex frequency bins from DC to Nyquist.  If you don't know what this means, search the web.\n\nThe fast convolution filtering uses the overlap-scrap method, slightly \nmodified to put the scrap at the tail.\n\n## LICENSE\n    Revised BSD License, see COPYING for verbiage. \n    Basically, \"free to use\u0026change, give credit where due, no guarantees\"\n    Note this license is compatible with GPL at one end of the spectrum and closed, commercial software at \n    the other end.  See http://www.fsf.org/licensing/licenses\n  \n## TODO\n - Add real optimization for odd length FFTs \n - Document/revisit the input/output fft scaling\n - Make doc describing the overlap (tail) scrap fast convolution filtering in kiss_fastfir.c\n - Test all the ./tools/ code with fixed point (kiss_fastfir.c doesn't work, maybe others)\n\n## AUTHOR\n    Mark Borgerding\n    Mark@Borgerding.net\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmborgerding%2Fkissfft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmborgerding%2Fkissfft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmborgerding%2Fkissfft/lists"}