pub fn pack_frame(ambe_fr: &[u8; 72]) -> [u8; 9]Expand description
Pack a 72-bit FEC-codeword array into a 9-byte AMBE wire frame.
This is the inverse of the decoder’s unpack_frame composed with
demodulate_c1: given an ambe_fr array that contains
already-FEC-encoded codewords (C0 Golay-encoded, C1 Golay-encoded
but not yet XOR-scrambled, C2 / C3 as-is), produce the on-wire
byte sequence that a conformant AMBE decoder would recover back
to the same ambe_fr.
§Arguments
ambe_fr: a 72-element array where each byte holds a single bit (0 or 1), laid out in FEC-codeword order (C0 at 0..24, C1 at 24..47, C2 at 47..58, C3 at 58..72). This is the same layoutunpack_framewrites into.
§Returns
9 packed bytes, MSB-first. result[0] bit 7 is the first bit that
goes on the wire.
§Round-trip invariant
For any ambe_fr produced by the decoder’s unpack_frame +
demodulate_c1, the following holds (see tests below):
let mut fr = [0u8; 72];
unpack_frame(&wire, &mut fr);
demodulate_c1(&mut fr);
let wire_round_trip = pack_frame(&fr);
assert_eq!(wire, wire_round_trip);