MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
Word.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * @file Word.hpp
5 * @brief Samples read as fixed width binary words.
6 *
7 * A value in [-1, 1] maps to the offset binary word round((x + 1) / 2 * (2^bits - 1)):
8 * -1 is all zeros, +1 is all ones, 0 is half scale. Complementing every bit
9 * negates the value, and bit width is limited to 24 so a word fits an element of a
10 * coefficient array exactly.
11 */
12
14
15/**
16 * @brief The offset binary word of a value, clamped to [-1, 1].
17 * @param bits Word width, clamped to 1 to 24
18 */
19[[nodiscard]] MAYAFLUX_API uint32_t to_word(double value, uint32_t bits) noexcept;
20
21/**
22 * @brief The value of an offset binary word; bits above the width are ignored.
23 * @param bits Word width, clamped to 1 to 24
24 */
25[[nodiscard]] MAYAFLUX_API double from_word(uint32_t word, uint32_t bits) noexcept;
26
27} // namespace MayaFlux::Kinesis::Discrete
glm::vec3 value
double from_word(uint32_t word, uint32_t bits) noexcept
The value of an offset binary word; bits above the width are ignored.
Definition Word.cpp:22
uint32_t to_word(double value, uint32_t bits) noexcept
The offset binary word of a value, clamped to [-1, 1].
Definition Word.cpp:16