nk 1.0.0
C++ Numerical Computing Runtime
Loading...
Searching...
No Matches
quantizers.hpp
Go to the documentation of this file.
1
3// toolboxes/signal/include/nk/signal/digital_filtering/quantizers.hpp
4//
5// Uniform-quantization helpers (Phase 4.2):
6// uencode — float → integer (signed/unsigned, N bits, peak V)
7// udecode — integer → float (saturate/wrap on overflow)
8
9#pragma once
10
11#include <memory_resource>
12#include <nk/value/value.hpp>
13
14namespace nk::signal {
15
18
19
31Value uencode(const Value &u, int N, double V = 1.0,
32 bool signedOutput = false,
33 std::pmr::memory_resource *mr = nullptr);
34
45Value udecode(const Value &u, int N, double V = 1.0,
46 bool wrapOnOverflow = false,
47 std::pmr::memory_resource *mr = nullptr);
48
49
51} // namespace nk::signal
Core MATLAB-compatible multidimensional array and scalar value type.
Definition value.hpp:61
Value udecode(const Value &u, int N, double V=1.0, bool wrapOnOverflow=false, std::pmr::memory_resource *mr=nullptr)
Decode integer data back to double with peak ±V (y = udecode(u, N, V, overflow)).
Value uencode(const Value &u, int N, double V=1.0, bool signedOutput=false, std::pmr::memory_resource *mr=nullptr)
Quantise and encode u as N-bit integers (y = uencode(u, N, V, type)).