Overview
The Binary Stage Flight serializer extends the basic binary encoding with CRC-4 (Cyclic Redundancy Check) error detection. This provides a balance between channel density and data integrity, making it suitable for professional applications where reliability is critical.Class: BinaryStageFlight
Namespace: GlobalImplements:
IDMXSerializer
Configuration Constants
Size in pixels of each bit block (4×4 pixels)
Number of DMX channels encoded in each column group before adding CRC
Total bit blocks per column (6 channels × 8 bits = 48 blocks)
Number of bits used for CRC checksum (4 bits = CRC-4)
How It Works
Data Structure
Binary Stage Flight organizes data into column groups:CRC-4 Error Detection
Each column group of 6 channels gets a 4-bit CRC checksum:- Channels 0-5 are serialized
- CRC-4 is calculated over all 6 channel values
- CRC bits are written below the data section
- Pattern repeats for channels 6-11, 12-17, etc.
Bit Endianness
Unlike the basic Binary serializer, Binary Stage Flight uses reverse bit order:Methods
SerializeChannel
Encodes a DMX channel value as 8 reversed binary bits.The pixel array to write the encoded bits to
The DMX channel value (0-255) to encode
The DMX channel number
Width of the output texture
Height of the output texture
- For each of the 8 bits (reversed order, 7→0):
- Extracts the bit value using bitwise operations
- Calculates position with texture wrapping
- Creates a 4×4 color block (white for 1, black for 0)
- Writes the block to the pixel array
CompleteFrame
Generates and writes CRC-4 checksums for all column groups.The pixel array to write CRC blocks to
All channel values for the current frame
Width of the output texture
Height of the output texture
- Groups channels into sets of 6
- For each group:
- Calculates CRC-4 checksum using polynomial 0x03
- Determines CRC block position below the data section
- Writes 4 CRC bits as white/black blocks
- Handles texture wrapping for wide layouts
DeserializeChannel
Decodes a DMX channel value from binary bits.CRC verification during deserialization is marked as TODO in the source code. Currently, bits are read but CRC validation is not performed.
CRC-4 Algorithm
The CRC calculation uses a 4-bit polynomial-based algorithm:CRC Properties
CRC-4 generating polynomial
Checksum size, can detect single-bit errors
Reliably detects all single-bit errors and some multi-bit errors in a 6-channel group
Texture Wrapping
When the data exceeds texture width, Binary Stage Flight wraps to the next row:Usage Example
Channel Capacity
Capacity is reduced compared to basic Binary due to CRC overhead:Capacity by Resolution
| Resolution | Channel Groups | Total Channels |
|---|---|---|
| 256×256 | 64 × 4 = 256 | 1,536 |
| 512×512 | 128 × 8 = 1024 | 6,144 |
| 1024×1024 | 256 × 16 = 4096 | 24,576 |
These are theoretical maximums. Actual capacity may be lower depending on texture wrapping and alignment.
Advantages
Error Detection
CRC-4 detects transmission errors in channel groups
Professional Grade
Suitable for critical applications requiring reliability
High Density
Still maintains high channel density with error protection
Organized Layout
Structured column groups simplify debugging
Limitations
- No Error Correction: CRC can detect errors but cannot fix them
- Group-Based: Errors affect entire 6-channel groups
- Incomplete Decoding: CRC verification not yet implemented in deserialization
- Complexity: More complex than basic Binary serializer
Best Practices
1. Monitor CRC Failures
2. Handle Error Recovery
3. Optimize Channel Grouping
Group related channels together for better error isolation:Comparison with Binary
| Feature | Binary | Binary Stage Flight |
|---|---|---|
| Block Size | 4×4 | 4×4 |
| Bit Order | Standard | Reversed |
| Error Detection | None | CRC-4 |
| Overhead | 0% | ~8% (4 bits per 6 channels) |
| Use Case | Maximum density | Reliable transmission |
| Complexity | Simple | Medium |
Performance
- Encoding: ~0.025ms per channel (includes CRC calculation)
- CRC Calculation: ~0.005ms per 6-channel group
- Decoding: ~0.03ms per channel
- Memory: Minimal overhead
Future Enhancements
The source code includes a TODO comment for implementing CRC verification during deserialization. This would enable automatic error detection when receiving data.
- Complete CRC verification in
DeserializeChannel - Error logging and statistics
- Automatic error recovery strategies
- Configurable CRC polynomial
- Reed-Solomon forward error correction