Expand description
SIMD-accelerated Manchester (Biphase Mark Code) encoding and decoding for LTC.
§LTC Audio Format Specification
Linear Timecode encodes SMPTE timecode as an audio signal using Biphase Mark Code (BMC), also known as bi-phase mark modulation:
§Baud Rate
- At 30 fps: 30 frames/s × 80 bits/frame = 2400 baud (2400 bit-cells/second)
- At 25 fps: 25 × 80 = 2000 baud
- At 24 fps: 24 × 80 = 1920 baud
§Modulation (Biphase Mark Code)
Each bit occupies one bit-cell. Transitions (polarity reversals) occur as follows:
- Bit 0: One transition — only at the beginning of the bit cell.
- Bit 1: Two transitions — at the beginning and in the middle of the cell.
Consequently:
- Logic 0 produces a square wave at the bit-clock frequency (one edge/cell).
- Logic 1 produces a square wave at twice the bit-clock frequency (two edges/cell).
§Sync Word
The 80-bit LTC frame ends with a fixed 16-bit sync word 0x3FFD
(1011_1111_1111_1100 in LSB-first order), which can never appear in the
preceding 64 data bits due to BMC encoding constraints.
§Signal Levels
Typically recorded at line level (−10 dBV to +4 dBu). The signal is polarity- independent and can be read forwards or backwards at speeds from ~0.1× to ~10×.
§Manchester vs. BMC
Strictly speaking LTC uses Biphase Mark (transition at every cell boundary, plus an extra mid-cell transition for logic 1), not classical Manchester code (which uses mid-cell transitions only). The two schemes produce similar output waveforms and are often conflated in practice. This module encodes/decodes both the “LTC biphase mark” variant (used for audio output) and a “classical Manchester” variant (used internally for testing and reference).
Functions§
- manchester_
decode_ scalar - Scalar Manchester / BMC decoder.
- manchester_
decode_ simd - SIMD-accelerated Manchester / BMC decoder (x86_64 AVX2).
- manchester_
encode_ scalar - Scalar Manchester / Biphase Mark Code encoder.
- manchester_
encode_ simd - SIMD-accelerated Manchester / BMC encoder (x86_64 AVX2).