vpcc: decode chroma_subsampling as 3 bits, not 1#168
Conversation
chromaSubsampling in the VPCodecConfigurationRecord is a 3-bit field (0/1 = 4:2:0, 2 = 4:2:2, 3 = 4:4:4) but decode masked it with 0x01, so 4:2:2 parsed as 0 and 4:4:4 as 1. The encode side already writes all 3 bits, so a decode/encode round-trip silently rewrote a 4:2:2/4:4:4 vpcC as 4:2:0. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 59 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
In the
vpcC(VPCodecConfigurationRecord) decoder, the byte holdingbitDepth (4) | chromaSubsampling (3) | videoFullRangeFlag (1)is decoded with(b >> 1) & 0x01forchromaSubsampling— masking only 1 of the 3 bits. Per the VP9 Codec ISO Media File Format Binding,chromaSubsamplingis 3 bits with defined values 0–3 (4:2:0 vertical / 4:2:0 colocated / 4:2:2 / 4:4:4).The corruption is value-only and asymmetric: the encoder writes all 3 bits correctly, so a decode→encode round trip through this crate silently rewrites 4:2:2 (2) and 4:4:4 (3) streams as 4:2:0 variants (0/1).
Change
One-line decode fix:
& 0x01→& 0x07.Tests
Round-trip tests for
chroma_subsampling2 and 3 (both fail against the old mask), plus a decode of raw record bytes asserting the value survives.cargo test --all-features, clippy-D warnings, andfmt --checkare green.🤖 Generated with Claude Code