HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Member Functions
v1::dither Class Reference

#include <hikogui/random/dither.hpp>

Public Member Functions

 dither (dither const &)=default
 
 dither (dither &&)=default
 
ditheroperator= (dither const &)=default
 
ditheroperator= (dither &&)=default
 
 dither (int num_bits) noexcept
 Create a dither object.
 
f32x4 next () noexcept
 Get 8 floating point number to add to a samples.
 
f32x4 next (f32x4 samples) noexcept
 Add dither to the given samples.
 
float next (float sample) noexcept
 Add dither to the given samples.
 

Detailed Description

An object that create dither values to add to samples before rounding.

Dither is created by adding two 8 bit RPDF into a 9 bit TPDF. Then this 9 bit TPDF is converted to floating point, which can be added to the original floating point sample.

We start of with 128 bit from an xorshift128p random number generated that is split into 8 bit chunks, made into TPDF and converted to 8 floating point values.

Constructor & Destructor Documentation

◆ dither()

v1::dither::dither ( int num_bits)
inlinenoexcept

Create a dither object.

Parameters
num_bitsNumber of significant fraction bits, excluding the sign bit. For 24 bit signed PCM samples this value is 23.

Member Function Documentation

◆ next() [1/3]

f32x4 v1::dither::next ( )
inlinenoexcept

Get 8 floating point number to add to a samples.

The dither is a TPDF with the maximum being 2 quantization steps.

◆ next() [2/3]

f32x4 v1::dither::next ( f32x4 samples)
inlinenoexcept

Add dither to the given samples.

Parameters
samplesThe samples to add dithering to.
Returns
The sample with included dither.

◆ next() [3/3]

float v1::dither::next ( float sample)
inlinenoexcept

Add dither to the given samples.

Parameters
sampleThe sample to add dithering to.
Returns
The sample with included dither.

The documentation for this class was generated from the following file: