Packet image format

SSDV algorithm notes

SSDV is easiest to understand as JPEG scan data made restartable for weak links. The image is lossy because JPEG is lossy; the packet wrapper is there to make transport more recoverable with sequence numbers, MCU alignment hints, CRC32, and optional Reed-Solomon parity.

Core idea

Make JPEG fragments survivable.

A normal JPEG assumes the stream arrives in order. SSDV makes each packet carry enough identity and MCU position information for a receiver to continue after corruption or packet loss.

Normal packet

205 data bytes plus FEC.

The 0x66 layout keeps 205 payload bytes and appends 32 parity bytes. The Reed-Solomon block protects bytes 1-223.

No-FEC packet

237 data bytes with CRC.

The 0x67 layout spends the FEC space on payload. It is useful when another frame layer already provides enough error correction.

Encode pipeline

  1. JPEG preparation: Accept a baseline JPEG profile that can be represented with fixed quantisation and Huffman tables, then work with the scan data.
  2. Packet identity: Write callsign, image ID, packet ID, dimensions, quality, subsampling, and EOI state into each packet.
  3. MCU resynchronisation: Record the first complete MCU start inside the payload so a receiver can resume after a lost packet.
  4. Integrity check: Write CRC32 over the active packet body.
  5. Forward error correction: For normal packets, append 32 Reed-Solomon parity bytes calculated over bytes 1-223.
  6. Transport framing: Send fixed-length packets over a modem or frame layer such as RTTY, AX.25, KISS, or mission-specific satellite downlink framing.

Decode pipeline

  1. JPEG preparation: Reconstruct a legal JPEG by writing the expected headers and fixed tables before emitting decoded scan data.
  2. Packet identity: Reject packets whose callsign, image ID, dimensions, quality, or subsampling do not match the current image session.
  3. MCU resynchronisation: Use MCU offset and MCU index to skip unusable bytes, close an incomplete MCU, and resume from the next aligned block.
  4. Integrity check: Validate CRC before accepting a no-FEC packet, or after Reed-Solomon correction for a normal packet.
  5. Forward error correction: Correct byte errors where the receiver still knows the byte positions; insert padding before FEC when a demodulator detects dropped bytes.
  6. Transport framing: Find packet boundaries, repair byte errors where possible, merge packets by callsign and image ID, and finalize the JPEG when EOI or end-of-stream is reached.

Error recovery notes

Byte errors

In normal mode, the Reed-Solomon trailer can correct up to 16 byte errors when the receiver still knows where the bytes sit in the packet. CRC32 then confirms the corrected body.

Missing bytes

FEC does not magically fix a shifted stream. If a demodulator drops bytes, it should insert padding before correction so the code sees byte errors rather than a permanently displaced packet.

Missing packets

The missing packets case is where the decoder uses packet ID, MCU offset, and MCU index to close an incomplete block, fill skipped MCUs, discard unusable leading data, and resume at the next known MCU boundary.

Transport is deliberately separate

SSDV does not require one radio modulation. The UKHAS guide documents 8-bit RTTY practice and also discusses carrying packets inside AX.25. Modern experiments may put the same SSDV bytes behind Bell 202 AFSK, 9600 FSK/GFSK, KISS TCP, or a mission-specific telemetry/FEC container. Keep the layers separate when diagnosing a receive: modem lock, packet framing, SSDV CRC/FEC, and JPEG reconstruction each fail differently.

Implementation checklist

LayerWhat to checkFailure clue
Input JPEGBaseline DCT, compatible dimensions, YCbCr or grayscale, fixed table profile.Encoder rejects the image before packet output.
HeaderSync 0x55, type 0x66 or 0x67, Base-40 encoded callsign, image ID, dimensions, packet ID.Packets parse but do not join the current image session.
FlagsQuality XOR 4, EOI only on final packet, subsampling mode carried in the low bits.Decoder reconstructs wrong dimensions or finalizes early.
CRC32Normal CRC at 220-223; no-FEC CRC at 252-255.Packet is discarded after demodulation or after FEC correction.
Reed-SolomonNormal packets use 32 parity bytes over bytes 1-223.Random byte errors remain uncorrected or corrected packet fails CRC.
TransportConfirm RTTY/AX.25/KISS/modem profile, symbol rate, audio level, and bit ordering.No valid packet boundary appears even though RF/audio energy is present.