Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
dancazarin committed Feb 5, 2024
1 parent 345343c commit 51be484
Show file tree
Hide file tree
Showing 11 changed files with 452 additions and 289 deletions.
42 changes: 28 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ https://www.kfr.dev

KFR is an open source C++ DSP framework that contains high performance building blocks for DSP, audio, scientific and other applications. It is distributed under dual GPLv2/v3 and [commercial license](https://kfr.dev/purchase).

## [Installation](docs/docs/installation.md)
## KFR6

New features, performance improvements, easier setup.

:arrow_right: [What's new in KFR6](docs/docs/whatsnew6.md)

:arrow_right: [Upgrade from a previous version](docs/docs/upgrade6.md)

## Installation

Compiler support:

Expand All @@ -23,22 +31,21 @@ Compiler support:
![MSVC 2019](https://img.shields.io/badge/MSVC-2019%2B-brightgreen.svg?style=flat-square)
![Xcode 12+](https://img.shields.io/badge/Xcode-12%2B-brightgreen.svg?style=flat-square)

KFR has no external dependencies except a C++17 compatible standard C++ library.
CMake is used as build system.
KFR has no external dependencies except for a C++17-compatible standard C++ library. CMake is used as the build system.

Clang is highly recommended and proven to provide the best performance for KFR. You can use clang as a drop-in replacement of both GCC on Linux and MSVC on Windows. On macOS clang is the default compiler and included in the official Xcode toolchain.
Clang is highly recommended and proven to provide the best performance for KFR. You can use Clang as a drop-in replacement for both GCC on Linux and MSVC on Windows. On macOS, Clang is the default compiler and included in the official Xcode toolchain.

_Note_: Building DFT module requires Clang at this moment due to internal compiler errors and lack of optimization in GCC and MSVC.
_Note_: Building the DFT module currently requires Clang due to internal compiler errors and a lack of optimization in GCC and MSVC.

:arrow_right: See [Installation](docs/docs/installation.md) for more details
:arrow_right: See [Installation](docs/docs/installation.md) docs for more details

## Features

### FFT/DFT
* Optimized DFT implementation for any size (non-power of two sizes are supported)
* DFT performance is on par with the most performant implementation currently available [See Benchmarks](#benchmark-results)
* Real forward and inverse DFT
* Multidimensional complex and real DFT
* [:star2: new in KFR6] Multidimensional complex and real DFT
* Discrete Cosine Transform type II (and its inverse, also called DCT type III)
* Convolution using FFT
* Convolution filter
Expand All @@ -65,6 +72,8 @@ _Note_: Building DFT module requires Clang at this moment due to internal compil
### Base

* Tensors (multidimensional arrays)
* [:star2: new in KFR6] .npy support (reading/writing)
* [:star2: new in KFR6] Matrix transpose
* Statistical functions
* Random number generation
* Template expressions (See examples)
Expand All @@ -91,10 +100,18 @@ _Note_: Building DFT module requires Clang at this moment due to internal compil
* FLAC
* MP3

### Multiarchitecture

Multiarchitecture mode enables building algorithms for multiple architectures with runtime dispatch to detect the CPU of the target machine and select the best code path.

* [:star2: new in KFR6] Multiarchitecture for DFT, resampling, FIR and IIR filters.

### C API

C API is available and includes a subset of KFR features including FFT and filter processing.

[:star2: new in KFR6] Support for non x86 systems.

## Benchmark results

### DFT
Expand Down Expand Up @@ -126,13 +143,11 @@ See [fft benchmark](https://github.com/kfrlib/fft-benchmark) for details about b

## Documentation

Documentation home:

KFR 5 (latest)
KFR 6 (latest)
https://www.kfrlib.com/docs/latest/

KFR 4
https://www.kfrlib.com/docs/v4/
KFR 5
https://www.kfrlib.com/docs/v5/

Built with
* [cxxdox - generates markdown docs from C++](https://github.com/kfrlib/cxxdox)
Expand All @@ -147,9 +162,8 @@ Built with

`v5` - previous version of KFR (no new features, fixes only)


## License

KFR is dual-licensed, available under both commercial and open-source GPL 2+ license.

If you want to use KFR in a commercial product or a closed-source project, you need to [purchase a Commercial License](https://kfr.dev/purchase-license)
If you want to use KFR in a commercial product or a closed-source project, you need to [purchase a Commercial License](https://kfr.dev/purchase-license).
19 changes: 10 additions & 9 deletions docs/docs/capi.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,25 @@

Clang is required. See [Installation](installation.md)

C API is supported on non-x86 platforms.
C API requires that `KFR_ENABLE_MULTIARCH` be enabled (enabled by default).

### Windows

These commands must be executed in MSVC2019 command prompt.
These commands must be executed in the MSVC command prompt.

```bash
cd <path_to_kfr_repository>
mkdir build && cd build
cmake -GNinja -DENABLE_CAPI_BUILD=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER="<PATH_TO_LLVM_DIR>/bin/clang-cl.exe" ..
ninja kfr_capi
cmake -B build -GNinja -DCMAKE_INSTALL_PREFIX=path/to/install/dir -DENABLE_CAPI_BUILD=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER="<PATH_TO_LLVM_DIR>/bin/clang-cl.exe" ..
ninja -C build install
```

### Linux, macOS, other

On Linux and macOS, the `CMAKE_POSITION_INDEPENDENT_CODE` CMake option is required for building the C API:

```bash
cd <path_to_kfr_repository>
mkdir build && cd build
cmake -GNinja -DENABLE_CAPI_BUILD=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang++ ..
ninja kfr_capi
cmake -B build -GNinja -DCMAKE_INSTALL_PREFIX=path/to/install/dir -DENABLE_CAPI_BUILD=ON -DDCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang++ ..
ninja -C build install
```

Optionally, you can install the binaries into your system using `ninja install`
61 changes: 61 additions & 0 deletions docs/docs/clang.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Installing Clang

## Installing Clang on Linux

Install the latest clang available in your package manager:

`apt` (Ubuntu/Debian):
```bash
sudo apt install clang
```

or install any version from llvm apt:
```bash
wget -O - https://apt.llvm.org/llvm.sh | sudo bash -s - 17
```

### CMake

The following defines are required to instruct CMake on which compiler to use:

```bash
cmake -DCMAKE_CXX_COMPILER=clang++ ...
```
or with specific version:
```bash
cmake -DCMAKE_CXX_COMPILER=clang++-17 ...
```

### make

Set `CXX=clang++` or `CXX=clang++-17` environment variables before running make.

## Installing Clang on macOS

On macOS clang is the default compiler and already included in the official Xcode toolchain. No additional setup required.

## Installing Clang on Windows

### CMake + Ninja

Download and install the latest `win64` build from the official LLVM GitHub page:

https://github.com/llvm/llvm-project/releases

### Visual Studio

In MSVC 2019 and 2022, there is built-in support for the Clang toolchain:

https://learn.microsoft.com/en-us/cpp/build/clang-support-msbuild?view=msvc-170
https://learn.microsoft.com/en-us/cpp/build/clang-support-cmake?view=msvc-170

LLVM/Clang has very good compatibility with the MSVC ABI and is widely used for building large projects on Windows (including Chrome). Therefore, switching to LLVM/Clang should not cause any compatibility problems.

## Transparent Clang use (experimental)

Setting `KFR_WITH_CLANG` to `ON` instructs KFR to download Clang from the official GitHub, extract it to the build directory, and set all required CMake variables to enable its usage.
Works on Windows and Linux.

```bash
cmake -B build -GNinja -DKFR_WITH_CLANG=ON -DCMAKE_BUILD_TYPE=Release
```
18 changes: 9 additions & 9 deletions docs/docs/conversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ i24 s = convert_sample<i24, f32>(1.f);

## Supported formats

Constant | Type | Description | Range
-------- | ---- | ----------- | -----
audio_sample_type::i8 | i8 | 8-bit signed | -127..+127
audio_sample_type::i16 | i16 | 16-bit signed | -32767..+32767
audio_sample_type::i24 | i24 | 24-bit signed | -8388607..+8388607
audio_sample_type::i32 | i32 | 32-bit signed | -2147483647..+2147483647
audio_sample_type::i64 | i64 | 64-bit signed | -9223372036854775807..+9223372036854775807
audio_sample_type::f32 | f32 | 32-bit IEEE | -1..+1
audio_sample_type::f64 | f64 | 64-bit IEEE | -1..+1
| Constant | Type | Description | Range |
|------------------------|------|---------------|--------------------------------------------|
| audio_sample_type::i8 | i8 | 8-bit signed | -127..+127 |
| audio_sample_type::i16 | i16 | 16-bit signed | -32767..+32767 |
| audio_sample_type::i24 | i24 | 24-bit signed | -8388607..+8388607 |
| audio_sample_type::i32 | i32 | 32-bit signed | -2147483647..+2147483647 |
| audio_sample_type::i64 | i64 | 64-bit signed | -9223372036854775807..+9223372036854775807 |
| audio_sample_type::f32 | f32 | 32-bit IEEE | -1..+1 |
| audio_sample_type::f64 | f64 | 64-bit IEEE | -1..+1 |
2 changes: 1 addition & 1 deletion docs/docs/expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ univector<int, 5> z = x - y;
```

!!! note
when an expression is assigned to a `univector` variable, expression is evaluated in `process` function and values are being written to the target storage.
When an expression is assigned to a `univector` variable, expression is evaluated in `process` function and values are being written to the target storage.

Same applies to calling KFR functions on univectors, this doesn't calculate values immediately. Instead, new expression will be created.

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

## Getting started

* [What's new in KFR 5](whatsnew5.md)
* [What's new in KFR 6](whatsnew6.md)
* [Installation](installation.md)
* [Basics](basics.md)
* [Expressions](expressions.md)
* [C API](capi.md)
* [Upgrade to KFR 5](upgrade5.md)
* [Upgrade to KFR 6](upgrade6.md)

## Guides

Expand Down
Loading

0 comments on commit 51be484

Please sign in to comment.