MCPcopy Create free account
hub / github.com/FutureSDR/FutureSDR / quantize

Method quantize

examples/rattlegram/src/decoder.rs:243–248  ·  view source on GitHub ↗
(precision: f32, mut value: f32)

Source from the content-addressed store, hash-verified

241
242impl Bpsk {
243 fn quantize(precision: f32, mut value: f32) -> i8 {
244 value *= 2.0 * precision;
245 value = value.round();
246 value = value.clamp(-128.0, 127.0);
247 value as i8
248 }
249
250 fn soft(b: &mut i8, c: Complex32, precision: f32) {
251 *b = Self::quantize(precision, c.re);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected