This crate provides a lookup table to map I/Q byte pairs from the RTL-SDR to complex, floating-point samples.
The raw byte pairs should first be transmuted to a sequence of
u16 indexes (for
slice-cast), which can then be
used with the lookup table. Each lookup compiles to an unchecked array access, which
can be safely done due to the size limit of the index falling within the guaranteed
length of the table.
The I sample is always the first sample sent by the RTL-SDR and is always lower in memory than the corresponding Q sample. As such, the resulting 16-bit word will differ between little-endian and big-endian targets. To resolve this issue, the crate compiles a lookup table specific to the endianness of the target platform.
use rtlsdr_iq::IQ; // This is assuming little endian, where the Q byte is in the upper half of the word // and the I byte is in the lower half. let a = IQ[0x01_00u16]; let b = IQ[0x01_02u16]; let c = IQ[0x00_02u16]; assert!(a.re != b.re); assert!(a.im == b.im); assert!(b.re == c.re); assert!(b.im != c.im);
Maps a packed 16-bit I/Q sample to a corresponding
Static instance of