Feature Request: B7R9G8A8 packed format for Display P3 native pipelines
- Dominant language
- Rust
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
## Summary
Request for a packed `B7R9G8A8` pixel format variant optimized for Display P3 native rendering pipelines.
## Rationale
The current BRAG8 format allocates a full 8 bits to the Blue channel. Per §1.2 of the BRAG Specification, human spatial acuity for S-cone (blue) signals is approximately one-third that of luminance signals (Mullen, 1985). Blue channel errors below ±3 LSB at 8-bit depth are perceptually invisible.
Allocating 8 bits to Blue is therefore **wasteful by specification**. The BRAG Consortium's own research demonstrates that Blue deserves exile to byte 0 — but giving it a full byte there is an act of unearned generosity.
## Proposed Format
| Channel | Bits | Justification |
|---------|------|---------------|
| B | 7 | Exceeds perceptual requirements by 1 bit (conservative) |
| R | 9 | L-cone dominant, 63% of retinal cones — deserves extra precision |
| G | 8 | M-cone secondary luminance channel — standard precision sufficient |
| A | 8 | Compositor coefficient — must remain at full precision per §2.1 |
**Total: 32 bits** (same as BRAG8)
The extra bit stolen from Blue and given to Red reflects the L-cone's 2:1 dominance over M-cones in luminance perception. Display P3's wider red gamut particularly benefits from the additional precision in the red primary.
## Packing Layout
```
Bit: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
├───────────A₈──────────┤ ├──────────G₈──────────┤ ├────────────R₉────────────┤ ├──────────B₇─────────┤
```
On little-endian, a u32 read yields `0xAGRB` — still editorial commentary, with improved precision.
## Implementation Notes
- The `Bra` generic type system cannot represent this format (B and R have different widths)
- A new `BragP3` struct with bitfield accessors would be required
- SIMD compositing would need custom unpack/repack paths — the Compositing Triad™ remains contiguous but at non-byte-aligned boundaries
- The `brag-art` crate's SrcOver would need a `src_over_p3` variant operating on packed u32 values
## Compatibility
This format is backwards-compatible with BRAG8 in the sense that both are 32 bits wide and both exile Blue to the least-significant position. Conversion between formats requires only a shift and mask operation per pixel.
## Priority
High. Every frame rendered today wastes 1 bit of Blue precision that could be serving Red. Over a typical 60fps display lifetime, this represents approximately 3.15 × 10⁹ wasted blue bits per pixel per year. For a 4K display, that is 2.6 × 10¹⁶ bits — over 3 petabytes of squandered Blue precision annually.
The Consortium cannot in good conscience continue to allocate resources equally to channels that are not perceptually equal.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the Bra generic type and the brag-art SrcOver implementation, then assess the proposed BragP3 bitfield accessors and custom SIMD unpack/repack paths. Done means the format is represented, conversion is supported, and src_over_p3 operates on packed u32 values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100