forge
Explore
Log in

Don't you dare go Hollow

Record at read_golomb why the tail cap must not be lifted alone

Browse files at this commit

4c3ce8125dd9e9d9479562ccdfc6a05b4821af9eAhmet Kaan GümüşParent: 965c6b6
  • docs
    • record at read_golomb why the tail cap must not be lifted alone
Show full message
docs(av1): record at read_golomb why the tail cap must not be lifted alone
crates/ec-av1/src/decode.rsmodified+12 -0
@@ -1347,6 +1347,18 @@ fn dc_sign_ctx(vote: i32) -> usize {
1347 /// (spec 5.11.40): its bit length in unary, then that many of its own bits,1347 /// (spec 5.11.40): its bit length in unary, then that many of its own bits,
1348 /// most significant first — the exact inverse of [`crate::tile::write_golomb`].1348 /// most significant first — the exact inverse of [`crate::tile::write_golomb`].
1349 fn read_golomb(dec: &mut SymbolDecoder) -> Result<u32> {1349 fn read_golomb(dec: &mut SymbolDecoder) -> Result<u32> {
1350+ // lane-scaledref r1: this cap MASKS A REAL DEFECT and must not be lifted
1351+ // on its own. Reading up to 32 leading zeros (dav1d's `len < 32`; libaom
1352+ // itself calls a 21st bit a corrupt frame, decodetxb.c:30) is bit-identical
1353+ // for every tail any encoder writes -- our own writer tops out at 19 zeros
1354+ // (`tile::MAX_LEVEL == MAX_BR_LEVEL + (1 << 19)`) -- and was implemented
1355+ // and round-trip tested here (commit ee1f980, reverted in 314ee08). It
1356+ // turned `a_real_aomenc_stream_with_a_superblock_level_horz_vert_partition_decodes_pixel_exact`
1357+ // RED: seed 67 stops here today, and with the cap raised it decodes to a
1358+ // frame-0 LUMA MISMATCH instead. A key frame cannot legitimately carry a
1359+ // level above 1<<19, so the long tail is the SYMPTOM of an earlier desync
1360+ // in that intra rect64 stream -- class `refusal-hides-a-defect`. Lift this
1361+ // together with that defect's fix, not before.
1350 let mut length = 1u32;1362 let mut length = 1u32;
1351 while dec.literal(1) == 0 {1363 while dec.literal(1) == 0 {
1352 length += 1;1364 length += 1;