The palette neighbour bands are cleared by the key-frame sub-8x8 leaves
Browse files at this commit2fe9a361b00e3c0df5c0bb0af64ad4ac0bcee851Parent: 66e8f70- fix
- the palette neighbour bands are cleared by the key-frame sub-8x8 leaves
2 changed files +17 -59
- crates/ec-av1/src/decode.rs +0 -54
- lanes/dkey.report.md +17 -5
crates/ec-av1/src/decode.rsmodified+0 -54
| @@ -29614,15 +29614,6 @@ fn decode_inter_block( | ||
| 29614 | 29614 | write_h / MI, |
| 29615 | 29615 | skip, |
| 29616 | 29616 | ); |
| 29617 | - // lane-dkey sweep: an INTER block (and every sub-8x8 leaf) has | |
| 29618 | - // `palette_size == 0` in libaom's mi grid, so the next block's | |
| 29619 | - // `av1_get_palette_mode_ctx`/colour cache must read 0 across this | |
| 29620 | - // footprint. Only the >=8x8 intra readers published palette state, so a | |
| 29621 | - // palette block's size/colours stayed standing in the mi-granular bands | |
| 29622 | - // and a later intra block read `palette_y_mode` off the wrong CDF row | |
| 29623 | - // (class [[cdf-row-held-constant]]). | |
| 29624 | - neighbours.record_palette_y_rect((rmi, cmi), write_w, write_h, 0, [0u16; 8]); | |
| 29625 | - neighbours.record_palette_uv_rect((rmi, cmi), write_w, write_h, 0, [0u16; 8]); | |
| 29626 | 29617 | neighbours.fill_lf_grid_rect( |
| 29627 | 29618 | (rmi, cmi), |
| 29628 | 29619 | write_w / MI, |
| @@ -30107,15 +30098,6 @@ fn decode_inter_sub8_split4( | ||
| 30107 | 30098 | // var-tx context instead of leaving whatever the previous block left. |
| 30108 | 30099 | set_txfm_ctxs(neighbours, lmi, B4, 1, 1, false); |
| 30109 | 30100 | neighbours.fill_skip_grid_rect(lmi, 1, 1, skip); |
| 30110 | - // lane-dkey sweep: an INTER block (and every sub-8x8 leaf) has | |
| 30111 | - // `palette_size == 0` in libaom's mi grid, so the next block's | |
| 30112 | - // `av1_get_palette_mode_ctx`/colour cache must read 0 across this | |
| 30113 | - // footprint. Only the >=8x8 intra readers published palette state, so a | |
| 30114 | - // palette block's size/colours stayed standing in the mi-granular bands | |
| 30115 | - // and a later intra block read `palette_y_mode` off the wrong CDF row | |
| 30116 | - // (class [[cdf-row-held-constant]]). | |
| 30117 | - neighbours.record_palette_y_rect(lmi, MI, MI, 0, [0u16; 8]); | |
| 30118 | - neighbours.record_palette_uv_rect(lmi, MI, MI, 0, [0u16; 8]); | |
| 30119 | 30101 | neighbours.fill_lf_grid_rect(lmi, 1, 1, B4 as u8, B4 as u8, ref_frame.max(LAST_FRAME), fctx); |
| 30120 | 30102 | last_skip = skip; |
| 30121 | 30103 | } |
| @@ -30573,15 +30555,6 @@ fn decode_intra_sub8_leaf( | ||
| 30573 | 30555 | } |
| 30574 | 30556 | let (tx_w, tx_h) = if split { (4, 4) } else { (bw, bh) }; |
| 30575 | 30557 | neighbours.fill_skip_grid_rect(lmi, w_mi, h_mi, skip); |
| 30576 | - // lane-dkey sweep: an INTER block (and every sub-8x8 leaf) has | |
| 30577 | - // `palette_size == 0` in libaom's mi grid, so the next block's | |
| 30578 | - // `av1_get_palette_mode_ctx`/colour cache must read 0 across this | |
| 30579 | - // footprint. Only the >=8x8 intra readers published palette state, so a | |
| 30580 | - // palette block's size/colours stayed standing in the mi-granular bands | |
| 30581 | - // and a later intra block read `palette_y_mode` off the wrong CDF row | |
| 30582 | - // (class [[cdf-row-held-constant]]). | |
| 30583 | - neighbours.record_palette_y_rect(lmi, w_mi * MI, h_mi * MI, 0, [0u16; 8]); | |
| 30584 | - neighbours.record_palette_uv_rect(lmi, w_mi * MI, h_mi * MI, 0, [0u16; 8]); | |
| 30585 | 30558 | neighbours.fill_lf_grid_rect(lmi, w_mi, h_mi, tx_w as u8, tx_h as u8, 0, fctx); |
| 30586 | 30559 | // `set_txfm_ctxs(tx_size, n4_w, n4_h, skip && is_inter == 0, xd)`: an |
| 30587 | 30560 | // intra block of an inter frame publishes its TRANSFORM dims, never its |
| @@ -31195,15 +31168,6 @@ fn decode_inter_sub8_rect2( | ||
| 31195 | 31168 | neighbours.record_mode_mi(rmi, cmi, w_mi, h_mi, DC_PRED); |
| 31196 | 31169 | neighbours.record_inter_rect_mi(lmi, w_mi, h_mi, skip, true, ref_frame, resolved_filter, false); |
| 31197 | 31170 | neighbours.fill_skip_grid_rect(lmi, w_mi, h_mi, skip); |
| 31198 | - // lane-dkey sweep: an INTER block (and every sub-8x8 leaf) has | |
| 31199 | - // `palette_size == 0` in libaom's mi grid, so the next block's | |
| 31200 | - // `av1_get_palette_mode_ctx`/colour cache must read 0 across this | |
| 31201 | - // footprint. Only the >=8x8 intra readers published palette state, so a | |
| 31202 | - // palette block's size/colours stayed standing in the mi-granular bands | |
| 31203 | - // and a later intra block read `palette_y_mode` off the wrong CDF row | |
| 31204 | - // (class [[cdf-row-held-constant]]). | |
| 31205 | - neighbours.record_palette_y_rect(lmi, w_mi * MI, h_mi * MI, 0, [0u16; 8]); | |
| 31206 | - neighbours.record_palette_uv_rect(lmi, w_mi * MI, h_mi * MI, 0, [0u16; 8]); | |
| 31207 | 31171 | last_skip = skip; |
| 31208 | 31172 | } |
| 31209 | 31173 | // lane-sub8intra: when the chroma-reference sub-block was INTRA it coded |
| @@ -32306,15 +32270,6 @@ fn decode_inter_block8( | ||
| 32306 | 32270 | // dlist excludes it (3 luma samples on a 192x128 inter frame). |
| 32307 | 32271 | hit!(INTER8_SKIP_BAND_HITS); |
| 32308 | 32272 | neighbours.fill_skip_grid(leaf_mi, 2, skip); |
| 32309 | - // lane-dkey sweep: an INTER block (and every sub-8x8 leaf) has | |
| 32310 | - // `palette_size == 0` in libaom's mi grid, so the next block's | |
| 32311 | - // `av1_get_palette_mode_ctx`/colour cache must read 0 across this | |
| 32312 | - // footprint. Only the >=8x8 intra readers published palette state, so a | |
| 32313 | - // palette block's size/colours stayed standing in the mi-granular bands | |
| 32314 | - // and a later intra block read `palette_y_mode` off the wrong CDF row | |
| 32315 | - // (class [[cdf-row-held-constant]]). | |
| 32316 | - neighbours.record_palette_y_rect(leaf_mi, 8, 8, 0, [0u16; 8]); | |
| 32317 | - neighbours.record_palette_uv_rect(leaf_mi, 8, 8, 0, [0u16; 8]); | |
| 32318 | 32273 | // lane-sub8x4 r2: `split8` is this leaf's OWN var-tx split, so |
| 32319 | 32274 | // the deblock grid must publish the TX_4X4 leaves' width the |
| 32320 | 32275 | // same way the fall-through arm below does (libaom |
| @@ -33512,15 +33467,6 @@ fn decode_inter_block8( | ||
| 33512 | 33467 | // gate failed on an instrumentation gap, with the band written either way. |
| 33513 | 33468 | hit!(INTER8_SKIP_BAND_HITS); |
| 33514 | 33469 | neighbours.fill_skip_grid(leaf_mi, 2, skip); |
| 33515 | - // lane-dkey sweep: an INTER block (and every sub-8x8 leaf) has | |
| 33516 | - // `palette_size == 0` in libaom's mi grid, so the next block's | |
| 33517 | - // `av1_get_palette_mode_ctx`/colour cache must read 0 across this | |
| 33518 | - // footprint. Only the >=8x8 intra readers published palette state, so a | |
| 33519 | - // palette block's size/colours stayed standing in the mi-granular bands | |
| 33520 | - // and a later intra block read `palette_y_mode` off the wrong CDF row | |
| 33521 | - // (class [[cdf-row-held-constant]]). | |
| 33522 | - neighbours.record_palette_y_rect(leaf_mi, 8, 8, 0, [0u16; 8]); | |
| 33523 | - neighbours.record_palette_uv_rect(leaf_mi, 8, 8, 0, [0u16; 8]); | |
| 33524 | 33470 | neighbours.fill_lf_grid( |
| 33525 | 33471 | leaf_mi, |
| 33526 | 33472 | 2, |
lanes/dkey.report.mdmodified+17 -5
| @@ -47,8 +47,15 @@ paths only. | ||
| 47 | 47 | ## Sweep |
| 48 | 48 | |
| 49 | 49 | `fill_skip_grid*` (every leaf block publishes it) vs `record_palette_*` over |
| 50 | -all 16 block readers: 9 readers had skip but no palette publication. Fixed the | |
| 51 | -7 that provably code no palette. **Remaining, deferred:** `decode_rect_split`, | |
| 50 | +all 16 block readers: 9 readers had skip but no palette publication. Stamped | |
| 51 | +7; the 5 INTER-side stamps (`decode_inter_block`, `decode_inter_block8` x2, | |
| 52 | +`decode_inter_sub8_split4`, `decode_inter_sub8_rect2`, `decode_intra_sub8_leaf`) | |
| 53 | +REGRESSED 13 tests (our own encoder's screen streams stopped decoding: "a | |
| 54 | +reference frame selected with no picture at this frame's own ref_frame_idx | |
| 55 | +slot") and were reverted -- the inter readers' `(rmi, cmi)`/`write_w`/`write_h` | |
| 56 | +are not the same footprint convention the palette bands index, so those stamps | |
| 57 | +zeroed cells belonging to real palette blocks. Only the two KEY-frame sub-8x8 | |
| 58 | +stamps ship. **Remaining, deferred:** `decode_rect_split`, | |
| 52 | 59 | `decode_leaf_rect`, `decode_block_rect4`, `decode_rect4_16_strip` and |
| 53 | 60 | `decode_intra_rect_in_inter` are >=8x8 intra readers that CAN code palette |
| 54 | 61 | (`decode_intra_rect_in_inter` reads `palette_y_mode` at decode.rs:10131) and |
| @@ -68,8 +75,8 @@ neighbours). Needs each reader's decoded palette threaded to the tail. | ||
| 68 | 75 | |
| 69 | 76 | ## Files |
| 70 | 77 | |
| 71 | -* `crates/ec-av1/src/decode.rs` — the 7 zero-stamps (2 in the key-frame sub8 | |
| 72 | - readers, 5 in the inter/sub8 readers). | |
| 78 | +* `crates/ec-av1/src/decode.rs` — 2 zero-stamps, in `decode_leaf_split4` and | |
| 79 | + `decode_leaf_rect8` (the key-frame sub-8x8 groups). | |
| 73 | 80 | * `crates/ec-av1/src/encode.rs` — `external_ladder` now decodes EVERY reference |
| 74 | 81 | ladder point through `decode_stream` and asserts sample-exactness against |
| 75 | 82 | ffmpeg, naming encoder/params/frame/plane/sample (the assertion that would |
| @@ -82,7 +89,12 @@ neighbours). Needs each reader's decoded palette threaded to the tail. | ||
| 82 | 89 | 1. **crf 5 inter-frame Golomb refusal** — key frame is exact now; the failure |
| 83 | 90 | is in an inter frame (`EC_MM` trace, last read mi(124,412)). Unblocks: diff |
| 84 | 91 | aomdec `EC_MODE`/`EC_STACK` against our `EC_MM` from the first inter frame. |
| 85 | -2. **The palette-publishing mirror gap** above (5 readers). | |
| 92 | +2. **The inter-side half of the sweep** (5 readers, reverted above) and the | |
| 93 | + palette-publishing mirror gap (`decode_intra_rect_in_inter` reads | |
| 94 | + `palette_y_mode` and publishes nothing). Unblocks: read each inter reader's | |
| 95 | + real band-index/footprint convention before stamping (the failing tests are | |
| 96 | + `encoder::tests::the_content_gate_keeps_screen_streams_flat` and the 12 | |
| 97 | + others listed in the suite log). | |
| 86 | 98 | 3. **The sensitive `force_integer_mv` fixture**: a 1920x1024 source with a |
| 87 | 99 | textured patch moving 2.5 px per duplicate-pair (half-pel motion, exact |
| 88 | 100 | duplicate frames) makes libaom round 72 projected candidates |