Skip to content

1.0.7: ANC packets start at byte 6, as MXL stores RFC 8331; C bit follows the data stream - #25

Merged
LeeO86 merged 2 commits into
mainfrom
fix/anc-layout
Oct 16, 2026
Merged

LeeO86 merged 2 commits into
mainfrom
fix/anc-layout

Conversation

@LeeO86

@LeeO86 LeeO86 commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

What

MXL 218ddaa docs/Architecture.md (video/smpte291): a grain stores the RFC 8331 payload from the Length field on. Length (16), ANC_Count (8), F (2) and reserved (22) are 6 bytes; the first ANC packet follows at byte 6 (in the RTP packet that is byte 20, 32-bit aligned; MXL drops the first 14 bytes).

encodeRfc8331 padded the header to 8 bytes (alignTo32 after reserved), so every packet sat 2 bytes late. mxl-st2110-gateway's ANC egress, MXL's mxl-data-probe and gst-mxl-rs read packets at byte 6 and would take the 2 padding bytes as the start of packet 1.

Now:

  • no header padding; Length counts the bytes after the 6-byte header;
  • each packet is padded to a multiple of 32 bits from its own start (RFC 8331 word_align);
  • F bits unchanged;
  • decodeRfc8331 (tests) reads the same layout.

The output side does not read ANC, so nothing else changes.

C bit (second commit)

RFC 8331 C = 1 means the colour-difference (chroma) data stream. The writer set C = 1 for every packet with a known line. Now C follows the SDK's GetDataStreamIndex() (third_party/decklink/DeckLinkAPI.h:996: "Usually zero. Can only be 1 if non-SD and the first data stream is completely full"): 0 = luma (and SD) gives C = 0, 1 = chroma gives C = 1, anything else counts as luma.

The same index was also written to S and StreamNum. RFC 8331 keeps those for the link number of a multi-stream interface (e.g. ST 425-3), which the SDK does not give, so S and StreamNum are now 0. The decoder (tests) maps C back to the index.

Tests

  • New unit test: two packets (the gateway's AFD golden packet with its original C = 0, and a chroma-stream packet with C = 1; field 1) encode to exactly the reference vector made by mxl-st2110-gateway's codec::serialiseGrain, and decode back.
  • New unit test: the C bit per SDK data stream index (0, 1, unknown).
  • Checked once against the gateway's parser (codec::parseGrain): no parity or checksum errors; an empty grain is byte-identical too.
  • Existing tests updated for the 6-byte header.

Version 1.0.7 (CMake, src/version.hpp, Kubernetes), CHANGELOG, SPECIFICATION §2.3, IMPLEMENTATION_PLAN.

Companion PRs: LeeO86/mxl-test-player#15, LeeO86/mxl-replay#28.

🤖 Generated with Claude Code
https://claude.ai/code/session_01St7QwmonpoG9EEEqaLFXLi

LeeO86 and others added 2 commits October 16, 2026 12:42
MXL docs/Architecture.md stores a video/smpte291 grain from the RFC 8331
Length field on; Length, ANC_Count, F and reserved are 6 bytes and the
first packet follows at byte 6. The writer padded the header to 8 bytes.
Now no header padding; each packet is padded to a multiple of 32 bits
from its own start, like mxl-st2110-gateway, mxl-data-probe and gst-mxl-rs.
F bits unchanged. New unit test against a reference vector from the
gateway's ANC codec.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01St7QwmonpoG9EEEqaLFXLi
C = 1 means the colour-difference (chroma) data stream. It was 1 for every
packet with a known line. Now it is 1 only for GetDataStreamIndex() == 1
(chroma, HD when the luma stream is full); 0 (luma, SD) and unknown values
give C = 0. S and StreamNum, which RFC 8331 keeps for the link number of a
multi-stream interface, are 0 (they carried the same index). The test
vector is the gateway's AFD golden packet with its original C = 0 plus a
chroma packet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01St7QwmonpoG9EEEqaLFXLi
@LeeO86 LeeO86 changed the title 1.0.7: ANC packets start at byte 6, as MXL stores RFC 8331 1.0.7: ANC packets start at byte 6, as MXL stores RFC 8331; C bit follows the data stream Oct 16, 2026
@LeeO86
LeeO86 merged commit 91be1e8 into main Oct 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant