Field Guide · term

Also known as: interleaved IQ, I/Q interleaving

Interleaved IQ is the memory layout in which the two halves of each IQ sample are stored adjacently and consecutively — I₀, Q₀, I₁, Q₁, I₂, Q₂, … — packing a complex stream into a single flat array of real numbers.1 It is the near-universal way SDR hardware delivers samples over USB or the network and the way IQ is laid out in files, so nearly every SDR program reads and writes this order at its boundaries.

I0 Q0 I1 Q1 I2 Q2 I0 I1 I2 Q0 Q1 Q2 I arrayQ array
Interleaved on the wire (I, Q, I, Q); some DSP deinterleaves into separate I and Q (planar) arrays for vectorized processing.

How it works

Interleaving is just a serialization order. Each complex sample is two real numbers, and interleaved layout writes them in the sequence they were captured, alternating I then Q, using whatever sample format the stream carries — so a CS16 interleaved buffer is int16 I, int16 Q, int16 I, …, and a CF32 .cfile is float32 I, float32 Q, …. To recover complex numbers a program strides through the array two elements at a time: element 2k is the I of sample k and element 2k+1 is its Q.

The chief alternative is planar (or “split”) layout, where all the I values sit in one array and all the Q values in another. Planar is friendlier to SIMD kernels that want to load a run of same-component values, and some math libraries expect it. Deinterleaving converts interleaved input into planar buffers, and re-interleaving does the reverse on the way out. Because both orders describe the identical samples, the choice is purely about which downstream code runs fastest.

Relevance to SDR

Interleaved IQ is what crosses almost every SDR boundary: the USB bulk transfer from an RTL-SDR, the UDP payload from a networked radio, and the bytes of a saved capture are all interleaved. That makes the interleaved buffer the natural unit for a sample buffer or ring, and the interleaving convention part of any IQ file format definition — the header (or external metadata) has to state the sample format and that the data is interleaved for a reader to make sense of it. A subtle but real bug class is a half-sample misalignment that swaps every I and Q, rotating the whole constellation by 90°; it comes from reading an interleaved stream at the wrong byte offset.

GopherTrunk, as a pure-Go SDR application, ingests interleaved IQ throughout. Its device drivers hand up interleaved sample buffers, and its .cfile replay reads interleaved complex-float32 data straight from disk. GT treats an interleaved buffer as its working unit, converting the element pairs into the complex values the demodulator consumes at the front of the chain. Keeping the layout explicit at these boundaries is what lets the same decode path serve both live hardware and recorded files.

In practice

When wiring up a new source or file, pin down three things before trusting a single sample: the sample format (byte width and signedness), the interleave order (essentially always I-first), and any per-sample padding. Get all three right and the sample rate alone tells you how to slice time; get the interleave stride wrong and every downstream measurement is quietly corrupt.

Sources

  1. IQ files and SigMF — PySDR, on interleaved I/Q storage and reading complex samples from a flat array. 

See also