wip(sub8): fix split-vs-8x8 partition context bit (side_mi 8->4); real divergence traced upstream of sub8 code
Browse files at this commit1d65b2d4036781f784baabf1f08fcb53193a1977Parent: 5d4c5551 changed file +15 -3
- crates/ec-av1/src/decode.rs +15 -3
crates/ec-av1/src/decode.rsmodified+15 -3
| @@ -5671,11 +5671,23 @@ fn decode_leaf_split4( | ||
| 5671 | 5671 | // Chroma neighbour bookkeeping for the whole 8x8 group -- mirrors |
| 5672 | 5672 | // [`decode_leaf8`]'s own tx4-chroma section (`record_split_luma`'s |
| 5673 | 5673 | // rescaling is wrong for an already-mi-unit position, so this inlines |
| 5674 | - // its tail directly at `leaf_mi`, side_mi=2). | |
| 5674 | + // its tail directly at `leaf_mi`, side_mi=2), EXCEPT for the partition | |
| 5675 | + // context value itself. Unlike `decode_leaf8`'s TX4 branch (still one | |
| 5676 | + // `BLOCK_8X8`, `PARTITION_NONE`, transform depth only), this group is | |
| 5677 | + // genuinely four `BLOCK_4X4` blocks (`PARTITION_SPLIT` at the 8x8 | |
| 5678 | + // level, libaom `decode_partition`'s `bsize2`/`subsize` recursion | |
| 5679 | + // bottom). libaom's `update_ext_partition_context` writes | |
| 5680 | + // `partition_context_lookup[subsize]` at the 8x8 slot -- `{30,30}` for | |
| 5681 | + // `BLOCK_8X8` (bit0=0, what `decode_leaf8` already reproduces via | |
| 5682 | + // side_mi=8) but `{31,31}` for `BLOCK_4X4` (bit0=1) here, and | |
| 5683 | + // `partition_ctx_mi`'s `left_side_mi[mi_r]*2 <= side` needs | |
| 5684 | + // `left_side_mi <= 4` to read that bit as 1. Leaving this at 8 (this | |
| 5685 | + // round's bug) makes the very next sibling 8x8's `partition_w8` read | |
| 5686 | + // with the wrong context and desync immediately. | |
| 5675 | 5687 | let side_mi = 2; |
| 5676 | 5688 | for cell in 0..side_mi { |
| 5677 | - neighbours.left_side_mi[leaf_mi.0 + cell] = 8; | |
| 5678 | - neighbours.above_side_mi[leaf_mi.1 + cell] = 8; | |
| 5689 | + neighbours.left_side_mi[leaf_mi.0 + cell] = 4; | |
| 5690 | + neighbours.above_side_mi[leaf_mi.1 + cell] = 4; | |
| 5679 | 5691 | } |
| 5680 | 5692 | let round_up_even = |n: usize| n.div_ceil(2) * 2; |
| 5681 | 5693 | let bound_h = round_up_even(neighbours.mi_rows); |