A non-skip palette block on a superblock-level strip lost its UV prediction
Browse files at this commit3a302e703f7738b15b5f64e3fef7f951620187e2Parent: c4ca926- fix
- a non-skip palette block on a superblock-level strip lost its UV prediction
3 changed files +26 -33
- crates/ec-av1/src/decode.rs +17 -17
- crates/ec-av1/src/refusal_inventory.rs +0 -11
- crates/ec-av1/src/stream.rs +9 -5
crates/ec-av1/src/decode.rsmodified+17 -17
| @@ -10416,24 +10416,11 @@ fn decode_block_rect64( | |||
| 10416 | c * (SUB / MI), fctx, | 10416 | c * (SUB / MI), fctx, |
| 10417 | )?; | 10417 | )?; |
| 10418 | if (palette_y.is_some() || palette_uv.is_some()) && !skip { | 10418 | if (palette_y.is_some() || palette_uv.is_some()) && !skip { |
| 10419 | - // The luma coefficient path here is the corner-cropped 32x32 real | 10419 | + // lane-t900 r34: a non-skip palette block on a superblock-level strip |
| 10420 | - // transform embedded in a 64x32/32x64 grid ([`decode_block_rect64`]'s | 10420 | + // -- counted so its gate cannot go vacuous (this was a refusal until |
| 10421 | - // own doc comment) -- a real (non-skip) palette block's residual | 10421 | + // r34; see the gate `a_real_aomenc_palette_stream_with_8x8_leaves_ |
| 10422 | - // needs the plain, uncropped rect reader [`decode_block_rect`] already | 10422 | + // decodes_pixel_exact`). |
| 10423 | - // has, not this one's truncation. `skip` (no residual at all) is | ||
| 10424 | - // still supported below (lane-palette2 r4). | ||
| 10425 | - // | ||
| 10426 | - // lane-pal8 r1 MEASURED the lift and it is NOT free: dropping this | ||
| 10427 | - // refusal decodes `testsrc2` 128x128 10-bit cq55 `--enable-palette=1 | ||
| 10428 | - // --min-partition-size=8 --tile-columns=1` with a whole-frame pixel | ||
| 10429 | - // mismatch (the arm the gate below counts). Something in this shape's | ||
| 10430 | - // palette prediction or its corner-cropped residual is wrong, and the | ||
| 10431 | - // refusal stays until that is found -- it is counted, never skipped. | ||
| 10432 | PALETTE_SB_STRIP_HITS.with(|c| c.set(c.get() + 1)); | 10423 | PALETTE_SB_STRIP_HITS.with(|c| c.set(c.get() + 1)); |
| 10433 | - return Err(unsupported( | ||
| 10434 | - "a palette block with a real transform on a superblock-level HORZ/VERT \ | ||
| 10435 | - strip (corner-cropped luma coefficients not ported for palette)", | ||
| 10436 | - )); | ||
| 10437 | } | 10424 | } |
| 10438 | let smooth_neighbor = is_smooth_mode(nb_above_mode) || is_smooth_mode(nb_left_mode); | 10425 | let smooth_neighbor = is_smooth_mode(nb_above_mode) || is_smooth_mode(nb_left_mode); |
| 10439 | if smooth_neighbor { | 10426 | if smooth_neighbor { |
| @@ -10817,6 +10804,16 @@ fn decode_block_rect64( | |||
| 10817 | plane_q_delta(1, fctx).1, | 10804 | plane_q_delta(1, fctx).1, |
| 10818 | u_tx_type, | 10805 | u_tx_type, |
| 10819 | ); | 10806 | ); |
| 10807 | + // lane-t900 r34: the UV-palette prediction override, exactly as the | ||
| 10808 | + // `skip` arm above installs it. The [`PALETTE_PRED`] slot is a | ||
| 10809 | + // set-then-take, so it must be filled again right before each plane's | ||
| 10810 | + // own reconstruct; leaving this out of the non-skip arm predicted a | ||
| 10811 | + // palette block's chroma off its block edges (measured: testsrc2 | ||
| 10812 | + // 128x128 10-bit cq55 `--tile-columns=1`, the 32x64 strip at px=96 -- | ||
| 10813 | + // luma exact, both chroma planes wrong over its whole 16x32). | ||
| 10814 | + if let Some((ub, _)) = &palette_uv_bufs { | ||
| 10815 | + set_palette_pred(ub.clone(), fctx); | ||
| 10816 | + } | ||
| 10820 | u.reconstruct_rect( | 10817 | u.reconstruct_rect( |
| 10821 | cpx, | 10818 | cpx, |
| 10822 | cpy, | 10819 | cpy, |
| @@ -10871,6 +10868,9 @@ fn decode_block_rect64( | |||
| 10871 | plane_q_delta(2, fctx).1, | 10868 | plane_q_delta(2, fctx).1, |
| 10872 | v_tx_type, | 10869 | v_tx_type, |
| 10873 | ); | 10870 | ); |
| 10871 | + if let Some((_, vb)) = &palette_uv_bufs { | ||
| 10872 | + set_palette_pred(vb.clone(), fctx); | ||
| 10873 | + } | ||
| 10874 | v.reconstruct_rect( | 10874 | v.reconstruct_rect( |
| 10875 | cpx, | 10875 | cpx, |
| 10876 | cpy, | 10876 | cpy, |
crates/ec-av1/src/refusal_inventory.rsmodified+0 -11
| @@ -43,7 +43,6 @@ const REFUSALS: &[&str] = &[ | |||
| 43 | "a 128x128 superblock partition value outside the 8-symbol alphabet", | 43 | "a 128x128 superblock partition value outside the 8-symbol alphabet", |
| 44 | "an inter var-tx tree with a leaf transform larger than 64x64", | 44 | "an inter var-tx tree with a leaf transform larger than 64x64", |
| 45 | "CfL, filter intra or a palette on a 128-root HORZ/VERT intra block (every one of their size gates caps at 64x64 or below, so none of these symbols exists there)", | 45 | "CfL, filter intra or a palette on a 128-root HORZ/VERT intra block (every one of their size gates caps at 64x64 or below, so none of these symbols exists there)", |
| 46 | - "a palette block with a real transform on a superblock-level HORZ/VERT strip (corner-cropped luma coefficients not ported for palette)", | ||
| 47 | // lane-t900 r23: palette RECONSTRUCTION now covers the key-frame paths | 46 | // lane-t900 r23: palette RECONSTRUCTION now covers the key-frame paths |
| 48 | // (earlier lanes), the intra-in-inter square/rect paths (r22) and the | 47 | // (earlier lanes), the intra-in-inter square/rect paths (r22) and the |
| 49 | // 8x8 LEAF inside an inter frame (this round, gate | 48 | // 8x8 LEAF inside an inter frame (this round, gate |
| @@ -371,16 +370,6 @@ const PROVEN: &[(&str, &str)] = &[ | |||
| 371 | "CfL, filter intra or a palette on a 128-root HORZ/VERT intra block (every one of their size gates caps at 64x64 or below, so none of these symbols exists there)", | 370 | "CfL, filter intra or a palette on a 128-root HORZ/VERT intra block (every one of their size gates caps at 64x64 or below, so none of these symbols exists there)", |
| 372 | "no_128_root_half_reads_a_cfl_filter_intra_or_palette_symbol", | 371 | "no_128_root_half_reads_a_cfl_filter_intra_or_palette_symbol", |
| 373 | ), | 372 | ), |
| 374 | - // lane-t900 r33, WITNESS of a capability gap: the refusal is REACHED by | ||
| 375 | - // real `--tune-content=screen --enable-palette=1` streams, counted | ||
| 376 | - // (`palette_sb_strip_hits`) and hard-asserted non-zero by its gate, which | ||
| 377 | - // also decodes the arms that do not reach it pixel-exact. lane-pal8 r1 | ||
| 378 | - // measured the lift and it mismatches whole-frame, so the string names a | ||
| 379 | - // real shape a real encoder writes -- an open capability, not a claim. | ||
| 380 | - ( | ||
| 381 | - "a palette block with a real transform on a superblock-level HORZ/VERT strip (corner-cropped luma coefficients not ported for palette)", | ||
| 382 | - "a_real_aomenc_palette_stream_with_8x8_leaves_decodes_pixel_exact", | ||
| 383 | - ), | ||
| 384 | // lane-t900 r33, CENSUS: the `use_intrabc` symbol IS read at the sub-8 | 373 | // lane-t900 r33, CENSUS: the `use_intrabc` symbol IS read at the sub-8 |
| 385 | // reader for every sub-8x8 leaf of an `allow_intrabc` frame, and over the | 374 | // reader for every sub-8x8 leaf of an `allow_intrabc` frame, and over the |
| 386 | // `--min-partition-size=4` exact-repetition screen arms every such symbol | 375 | // `--min-partition-size=4` exact-repetition screen arms every such symbol |
crates/ec-av1/src/stream.rsmodified+9 -5
| @@ -4141,8 +4141,8 @@ mod tests { | |||
| 4141 | (0usize, 0u32, 0u32, 0usize); | 4141 | (0usize, 0u32, 0u32, 0usize); |
| 4142 | let (mut out_of_scope, mut out_of_scope_mismatch, mut refusals) = (0u32, 0u32, 0u32); | 4142 | let (mut out_of_scope, mut out_of_scope_mismatch, mut refusals) = (0u32, 0u32, 0u32); |
| 4143 | let (mut sb_strip_total, mut sb_strip_arms) = (0usize, 0u32); | 4143 | let (mut sb_strip_total, mut sb_strip_arms) = (0usize, 0u32); |
| 4144 | - // The one palette shape this round did NOT lift (measured: lifting it | 4144 | + // lane-t900 r34 LIFTED this shape; the counter stays so the gate |
| 4145 | - // mismatches -- see [`decode_block_rect64`]'s own comment). | 4145 | + // fails loudly if the refusal ever comes back. |
| 4146 | let mut sb_strip_refusals = 0u32; | 4146 | let mut sb_strip_refusals = 0u32; |
| 4147 | for src in ["testsrc2", "smptebars"] { | 4147 | for src in ["testsrc2", "smptebars"] { |
| 4148 | for depth in [8usize, 10usize] { | 4148 | for depth in [8usize, 10usize] { |
| @@ -4322,10 +4322,14 @@ mod tests { | |||
| 4322 | leaf8_total > 0 && fired_arms > 0, | 4322 | leaf8_total > 0 && fired_arms > 0, |
| 4323 | "{NAME}: gate is vacuous -- no compared arm decoded an 8x8-leaf palette block" | 4323 | "{NAME}: gate is vacuous -- no compared arm decoded an 8x8-leaf palette block" |
| 4324 | ); | 4324 | ); |
| 4325 | + assert_eq!( | ||
| 4326 | + sb_strip_refusals, 0, | ||
| 4327 | + "{NAME}: the superblock-strip palette refusal is back (lane-t900 r34 lifted it)" | ||
| 4328 | + ); | ||
| 4325 | assert!( | 4329 | assert!( |
| 4326 | - sb_strip_refusals > 0, | 4330 | + sb_strip_arms > 0 && sb_strip_total > 0, |
| 4327 | - "{NAME}: no arm reached the superblock-strip palette refusal -- the open residue \ | 4331 | + "{NAME}: no arm decoded a non-skip palette block on a superblock-level strip -- \ |
| 4328 | - this gate documents is no longer exercised" | 4332 | + the shape r34 lifted is no longer exercised" |
| 4329 | ); | 4333 | ); |
| 4330 | assert_eq!( | 4334 | assert_eq!( |
| 4331 | out_of_scope_mismatch, 0, | 4335 | out_of_scope_mismatch, 0, |