7#include "xorshift128p.hpp"
8#include "../utility/utility.hpp"
9#include "../macros.hpp"
13namespace hi::inline
v1 {
28 dither(dither
const &) =
default;
29 dither(dither &&) =
default;
30 dither &operator=(dither
const &) =
default;
31 dither &operator=(dither &&) =
default;
40 hi_axiom(num_bits > 0);
41 auto maximum_value =
static_cast<float>((1_uz << num_bits) - 1);
44 maximum_value *= 127.0f;
47 maximum_value *= 2.0f;
49 _multiplier = f32x4::broadcast(1.0f / maximum_value);
77 [[nodiscard]] f32x4
next(f32x4 samples)
noexcept
79 return samples +
next();
87 [[nodiscard]]
float next(
float sample)
noexcept
89 return get<0>(f32x4::broadcast(sample) +
next());
93 f32x4 _multiplier = {};
95 xorshift128p _state = {};
96 unsigned char _counter = 0;
DOXYGEN BUG.
Definition algorithm.hpp:16
dither(int num_bits) noexcept
Create a dither object.
Definition dither.hpp:38
f32x4 next() noexcept
Get 8 floating point number to add to a samples.
Definition dither.hpp:55
f32x4 next(f32x4 samples) noexcept
Add dither to the given samples.
Definition dither.hpp:77
float next(float sample) noexcept
Add dither to the given samples.
Definition dither.hpp:87