Compound 8x8 leaf's early return clobbered its own per-TU luma coefficient context
Browse files at this commitd0f01ab516795d31e3563f3321c20f7da9c90ffeParent: 35461bb- fix
- compound 8x8 leaf's early return clobbered its own per-TU luma coefficient context
1 changed file +31 -1
- crates/ec-av1/src/decode.rs +31 -1
crates/ec-av1/src/decode.rsmodified+31 -1
| @@ -5396,7 +5396,8 @@ impl Neighbours { | ||
| 5396 | 5396 | let ctx = SKIP_CONTEXTS[(top as usize).min(4)][(left as usize).min(4)]; |
| 5397 | 5397 | if std::env::var_os("EC_AV1_TRACE").is_some() { |
| 5398 | 5398 | eprintln!( |
| 5399 | - "TRACE luma_skip_ctx mi=({mi_r},{mi_c}) side_mi={side_mi} top={top} left={left} ctx={ctx}" | |
| 5399 | + "TRACE luma_skip_ctx mi=({mi_r},{mi_c}) side_mi={side_mi} top={top} left={left} ctx={ctx} band={:?}", | |
| 5400 | + self.left.iter().map(|e| e[0].level).collect::<Vec<_>>() | |
| 5400 | 5401 | ); |
| 5401 | 5402 | } |
| 5402 | 5403 | ctx |
| @@ -24941,7 +24942,36 @@ fn decode_inter_block8( | ||
| 24941 | 24942 | // there before. Every leaf of the gate's stream is compound, |
| 24942 | 24943 | // so the 16x16 below a split block read partition ctx 0 |
| 24943 | 24944 | // instead of 1 and mis-read PARTITION_SPLIT as NONE. |
| 24945 | + // lane-sub8x4 r1: the same plane-0 save/restore the fall-through | |
| 24946 | + // (single-ref) path runs below -- a `split8` leaf's plane-0 | |
| 24947 | + // neighbour context is per 4x4 transform unit (written by | |
| 24948 | + // `record_mi_luma` inside `read_inter_luma8`), and `record_mi` | |
| 24949 | + // rewrites all three planes from the whole-block grid, which is | |
| 24950 | + // all-zero in the split case. Missing here, a compound var-tx 8x8 | |
| 24951 | + // leaf published level 0 to its right/below neighbours: the next | |
| 24952 | + // block's first TU read `skip_contexts[4][0] = 3` where aomdec | |
| 24953 | + // reads `[4][4] = 6` (class early-return-skips-tail). | |
| 24954 | + let saved_luma_ctx = split8.then(|| { | |
| 24955 | + ( | |
| 24956 | + [ | |
| 24957 | + neighbours.left[leaf_mi.0][0], | |
| 24958 | + neighbours.left[leaf_mi.0 + 1][0], | |
| 24959 | + ], | |
| 24960 | + [ | |
| 24961 | + neighbours.above[leaf_mi.1][0], | |
| 24962 | + neighbours.above[leaf_mi.1 + 1][0], | |
| 24963 | + ], | |
| 24964 | + ) | |
| 24965 | + }); | |
| 24944 | 24966 | neighbours.record_mi(leaf_mi, 8, &[luma_grid, u_grid, v_grid]); |
| 24967 | + if let Some((left, above)) = saved_luma_ctx { | |
| 24968 | + for (cell, state) in left.into_iter().enumerate() { | |
| 24969 | + neighbours.left[leaf_mi.0 + cell][0] = state; | |
| 24970 | + } | |
| 24971 | + for (cell, state) in above.into_iter().enumerate() { | |
| 24972 | + neighbours.above[leaf_mi.1 + cell][0] = state; | |
| 24973 | + } | |
| 24974 | + } | |
| 24945 | 24975 | // lane-cdef r1: ... and the CDEF skip band too. `apply_cdef`'s |
| 24946 | 24976 | // `is_8x8_block_skip` (libaom `cdef.c:29-38`) reads all four mi |
| 24947 | 24977 | // cells of the 8x8; this leaf wrote none of them, so a 64x64 |