Merge branch 'lane-screen2': palette syntax on inter-frame intra sub-blocks
Browse files at this commit3 changed files +181 -11
- crates/ec-av1/src/decode.rs +77 -0
- crates/ec-av1/src/stream.rs +8 -11
- lanes/screen-r2.report.md +96 -0
crates/ec-av1/src/decode.rsmodified+77 -0
| @@ -5796,6 +5796,15 @@ fn decode_inter_block( | |||
| 5796 | // for every existing (square) caller. | 5796 | // for every existing (square) caller. |
| 5797 | write_w: usize, | 5797 | write_w: usize, |
| 5798 | write_h: usize, | 5798 | write_h: usize, |
| 5799 | + // lane-screen r2: this frame header's own `allow_screen_content_tools` | ||
| 5800 | + // bit, threaded to the intra-sub-block branch below -- libaom's | ||
| 5801 | + // `read_intra_block_mode_info` (decodemv.c:1065-1107, the inter-frame | ||
| 5802 | + // counterpart of `read_intra_frame_mode_info`) reads `y_mode_cdf` | ||
| 5803 | + // (never `kf_y_mode_cdf`) and has NO `use_intrabc` call at all (that | ||
| 5804 | + // symbol is intra-frame-only, spec `av1_read_mode_info` dispatches on | ||
| 5805 | + // `frame_is_intra_only`), but it still calls `read_palette_mode_info` | ||
| 5806 | + // under the same `av1_allow_palette` gate as the key-frame path. | ||
| 5807 | + allow_screen_content_tools: bool, | ||
| 5799 | ) -> Result<()> { | 5808 | ) -> Result<()> { |
| 5800 | let (r, c) = at; | 5809 | let (r, c) = at; |
| 5801 | let (px, py) = (c * SUB, r * SUB); | 5810 | let (px, py) = (c * SUB, r * SUB); |
| @@ -7240,6 +7249,26 @@ fn decode_inter_block( | |||
| 7240 | } else { | 7249 | } else { |
| 7241 | return Err(unsupported("a directional chroma mode (round 2)")); | 7250 | return Err(unsupported("a directional chroma mode (round 2)")); |
| 7242 | }; | 7251 | }; |
| 7252 | + // `read_palette_mode_info` (decodemv.c:567, called from | ||
| 7253 | + // `read_intra_block_mode_info` right after `xd->cfl.store_y`, same | ||
| 7254 | + // gating and same corner-cut as `read_intra_mode`'s own copy above | ||
| 7255 | + // -- `palette_mode_ctx`/`palette_uv_mode_ctx` hardcoded 0, provably | ||
| 7256 | + // safe since a nonzero neighbour `palette_size` would already have | ||
| 7257 | + // refused the decode that produced it. | ||
| 7258 | + if allow_screen_content_tools | ||
| 7259 | + && let Some(bsize_ctx) = palette_bsize_ctx(side) | ||
| 7260 | + { | ||
| 7261 | + if mode == DC_PRED && dec.symbol(&mut cdfs.palette_y_mode[bsize_ctx][0]) != 0 { | ||
| 7262 | + return Err(unsupported( | ||
| 7263 | + "a block that actually uses a palette (Y) -- reconstruction is out of scope", | ||
| 7264 | + )); | ||
| 7265 | + } | ||
| 7266 | + if uv_mode == DC_PRED && dec.symbol(&mut cdfs.palette_uv_mode[0]) != 0 { | ||
| 7267 | + return Err(unsupported( | ||
| 7268 | + "a block that actually uses a palette (UV) -- reconstruction is out of scope", | ||
| 7269 | + )); | ||
| 7270 | + } | ||
| 7271 | + } | ||
| 7243 | mode_for_tx = mode; | 7272 | mode_for_tx = mode; |
| 7244 | block_filter = [3, 3]; | 7273 | block_filter = [3, 3]; |
| 7245 | ref_frame_for_lf = 0; | 7274 | ref_frame_for_lf = 0; |
| @@ -7503,6 +7532,10 @@ fn decode_inter_block8( | |||
| 7503 | // `compound_ctx` local, just handed back instead of applied here (this | 7532 | // `compound_ctx` local, just handed back instead of applied here (this |
| 7504 | // fn's `neighbours` recording happens once for the whole straddling | 7533 | // fn's `neighbours` recording happens once for the whole straddling |
| 7505 | // 16x16 block, after every leaf). | 7534 | // 16x16 block, after every leaf). |
| 7535 | + // lane-screen r2: see [`decode_inter_block`]'s own copy of this param -- | ||
| 7536 | + // `BLOCK_8X8` (this leaf's fixed size) is always `av1_allow_palette`- | ||
| 7537 | + // eligible (`bsize >= BLOCK_8X8`). | ||
| 7538 | + allow_screen_content_tools: bool, | ||
| 7506 | ) -> Result<(bool, bool, bool, Option<(i8, i8, u8, u8)>)> { | 7539 | ) -> Result<(bool, bool, bool, Option<(i8, i8, u8, u8)>)> { |
| 7507 | const LAST_FRAME: i8 = 1; | 7540 | const LAST_FRAME: i8 = 1; |
| 7508 | /// `Y_MODE`'s size group (`common_data.h`'s `size_group_lookup[BLOCK_8X8]`). | 7541 | /// `Y_MODE`'s size group (`common_data.h`'s `size_group_lookup[BLOCK_8X8]`). |
| @@ -8295,6 +8328,23 @@ fn decode_inter_block8( | |||
| 8295 | "a non-DC chroma mode on an 8x8 inter-frame leaf (this encoder never writes one)", | 8328 | "a non-DC chroma mode on an 8x8 inter-frame leaf (this encoder never writes one)", |
| 8296 | )); | 8329 | )); |
| 8297 | } | 8330 | } |
| 8331 | + // lane-screen r2: see [`decode_inter_block`]'s own copy -- `mode`/ | ||
| 8332 | + // `uv_mode` are both effectively `DC_PRED`-gated already on this | ||
| 8333 | + // leaf (a nonzero `mode` still passes, but `uv_mode` is forced | ||
| 8334 | + // `DC_PRED` by the refusal just above), same order as libaom's | ||
| 8335 | + // `read_palette_mode_info` call right after `xd->cfl.store_y`. | ||
| 8336 | + if allow_screen_content_tools { | ||
| 8337 | + if mode == DC_PRED && dec.symbol(&mut cdfs.palette_y_mode[0][0]) != 0 { | ||
| 8338 | + return Err(unsupported( | ||
| 8339 | + "a block that actually uses a palette (Y) -- reconstruction is out of scope", | ||
| 8340 | + )); | ||
| 8341 | + } | ||
| 8342 | + if dec.symbol(&mut cdfs.palette_uv_mode[0]) != 0 { | ||
| 8343 | + return Err(unsupported( | ||
| 8344 | + "a block that actually uses a palette (UV) -- reconstruction is out of scope", | ||
| 8345 | + )); | ||
| 8346 | + } | ||
| 8347 | + } | ||
| 8298 | mode_for_tx = mode; | 8348 | mode_for_tx = mode; |
| 8299 | let (mi_row, mi_col) = leaf_mi; | 8349 | let (mi_row, mi_col) = leaf_mi; |
| 8300 | for dr in 0..2 { | 8350 | for dr in 0..2 { |
| @@ -8489,6 +8539,7 @@ pub fn decode_inter_frame_tile( | |||
| 8489 | true, | 8539 | true, |
| 8490 | false, | 8540 | false, |
| 8491 | false, | 8541 | false, |
| 8542 | + false, | ||
| 8492 | ) | 8543 | ) |
| 8493 | .map(|(picture, _, _)| picture) | 8544 | .map(|(picture, _, _)| picture) |
| 8494 | } | 8545 | } |
| @@ -8552,6 +8603,12 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 8552 | // `decode_inter_block8` call below (spec 5.11.24's `read_motion_mode`). | 8603 | // `decode_inter_block8` call below (spec 5.11.24's `read_motion_mode`). |
| 8553 | switchable_motion_mode: bool, | 8604 | switchable_motion_mode: bool, |
| 8554 | allow_warped_motion: bool, | 8605 | allow_warped_motion: bool, |
| 8606 | + // lane-screen r2: this frame header's own `allow_screen_content_tools` | ||
| 8607 | + // bit, threaded to every `decode_inter_block`/`decode_inter_block8` | ||
| 8608 | + // call below -- consumes (never reconstructs) the intra-sub-block | ||
| 8609 | + // palette syntax libaom's `read_intra_block_mode_info` reads under the | ||
| 8610 | + // same `av1_allow_palette` gate as the key-frame path. | ||
| 8611 | + allow_screen_content_tools: bool, | ||
| 8555 | ) -> Result<(Picture, Cdfs, crate::motion_field::MotionField)> { | 8612 | ) -> Result<(Picture, Cdfs, crate::motion_field::MotionField)> { |
| 8556 | let tpl_frame = tpl_field.map(|field| TplFrameArgs { | 8613 | let tpl_frame = tpl_field.map(|field| TplFrameArgs { |
| 8557 | field, | 8614 | field, |
| @@ -8798,6 +8855,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 8798 | false, | 8855 | false, |
| 8799 | BLOCK, | 8856 | BLOCK, |
| 8800 | BLOCK, | 8857 | BLOCK, |
| 8858 | + allow_screen_content_tools, | ||
| 8801 | )?; | 8859 | )?; |
| 8802 | } | 8860 | } |
| 8803 | PARTITION_SPLIT => { | 8861 | PARTITION_SPLIT => { |
| @@ -8876,6 +8934,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 8876 | false, | 8934 | false, |
| 8877 | SUB, | 8935 | SUB, |
| 8878 | SUB, | 8936 | SUB, |
| 8937 | + allow_screen_content_tools, | ||
| 8879 | )?; | 8938 | )?; |
| 8880 | } else { | 8939 | } else { |
| 8881 | let ctx16 = neighbours.partition_ctx(at16, SUB); | 8940 | let ctx16 = neighbours.partition_ctx(at16, SUB); |
| @@ -8943,6 +9002,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 8943 | interp_fixed, | 9002 | interp_fixed, |
| 8944 | switchable_motion_mode, | 9003 | switchable_motion_mode, |
| 8945 | allow_warped_motion, | 9004 | allow_warped_motion, |
| 9005 | + allow_screen_content_tools, | ||
| 8946 | )?; | 9006 | )?; |
| 8947 | prev_leaf = Some((leaf_mi, skip, is_inter)); | 9007 | prev_leaf = Some((leaf_mi, skip, is_inter)); |
| 8948 | last_skip_mode = skip_mode_leaf; | 9008 | last_skip_mode = skip_mode_leaf; |
| @@ -9052,6 +9112,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 9052 | // corner-cut rect-flake-1 exposed on HORZ). | 9112 | // corner-cut rect-flake-1 exposed on HORZ). |
| 9053 | BLOCK, | 9113 | BLOCK, |
| 9054 | SUB, | 9114 | SUB, |
| 9115 | + allow_screen_content_tools, | ||
| 9055 | )?; | 9116 | )?; |
| 9056 | if (r32 * 2 + 1) as u32 * SUB_MI < mi_rows { | 9117 | if (r32 * 2 + 1) as u32 * SUB_MI < mi_rows { |
| 9057 | decode_inter_block( | 9118 | decode_inter_block( |
| @@ -9104,6 +9165,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 9104 | false, | 9165 | false, |
| 9105 | SUB, | 9166 | SUB, |
| 9106 | SUB, | 9167 | SUB, |
| 9168 | + allow_screen_content_tools, | ||
| 9107 | )?; | 9169 | )?; |
| 9108 | if (c32 * 2 + 1) as u32 * SUB_MI < mi_cols { | 9170 | if (c32 * 2 + 1) as u32 * SUB_MI < mi_cols { |
| 9109 | decode_inter_block( | 9171 | decode_inter_block( |
| @@ -9156,6 +9218,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 9156 | false, | 9218 | false, |
| 9157 | SUB, | 9219 | SUB, |
| 9158 | SUB, | 9220 | SUB, |
| 9221 | + allow_screen_content_tools, | ||
| 9159 | )?; | 9222 | )?; |
| 9160 | } | 9223 | } |
| 9161 | } | 9224 | } |
| @@ -9214,6 +9277,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 9214 | true, | 9277 | true, |
| 9215 | BLOCK, | 9278 | BLOCK, |
| 9216 | SUB, | 9279 | SUB, |
| 9280 | + allow_screen_content_tools, | ||
| 9217 | )?; | 9281 | )?; |
| 9218 | decode_inter_block( | 9282 | decode_inter_block( |
| 9219 | &mut dec, | 9283 | &mut dec, |
| @@ -9261,6 +9325,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 9261 | true, | 9325 | true, |
| 9262 | BLOCK, | 9326 | BLOCK, |
| 9263 | SUB, | 9327 | SUB, |
| 9328 | + allow_screen_content_tools, | ||
| 9264 | )?; | 9329 | )?; |
| 9265 | } | 9330 | } |
| 9266 | PARTITION_VERT => { | 9331 | PARTITION_VERT => { |
| @@ -9313,6 +9378,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 9313 | true, | 9378 | true, |
| 9314 | SUB, | 9379 | SUB, |
| 9315 | BLOCK, | 9380 | BLOCK, |
| 9381 | + allow_screen_content_tools, | ||
| 9316 | )?; | 9382 | )?; |
| 9317 | decode_inter_block( | 9383 | decode_inter_block( |
| 9318 | &mut dec, | 9384 | &mut dec, |
| @@ -9360,6 +9426,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 9360 | true, | 9426 | true, |
| 9361 | SUB, | 9427 | SUB, |
| 9362 | BLOCK, | 9428 | BLOCK, |
| 9429 | + allow_screen_content_tools, | ||
| 9363 | )?; | 9430 | )?; |
| 9364 | } | 9431 | } |
| 9365 | PARTITION_HORZ_A => { | 9432 | PARTITION_HORZ_A => { |
| @@ -9417,6 +9484,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 9417 | false, | 9484 | false, |
| 9418 | SUB, | 9485 | SUB, |
| 9419 | SUB, | 9486 | SUB, |
| 9487 | + allow_screen_content_tools, | ||
| 9420 | )?; | 9488 | )?; |
| 9421 | decode_inter_block( | 9489 | decode_inter_block( |
| 9422 | &mut dec, | 9490 | &mut dec, |
| @@ -9468,6 +9536,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 9468 | false, | 9536 | false, |
| 9469 | SUB, | 9537 | SUB, |
| 9470 | SUB, | 9538 | SUB, |
| 9539 | + allow_screen_content_tools, | ||
| 9471 | )?; | 9540 | )?; |
| 9472 | decode_inter_block( | 9541 | decode_inter_block( |
| 9473 | &mut dec, | 9542 | &mut dec, |
| @@ -9515,6 +9584,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 9515 | true, | 9584 | true, |
| 9516 | BLOCK, | 9585 | BLOCK, |
| 9517 | SUB, | 9586 | SUB, |
| 9587 | + allow_screen_content_tools, | ||
| 9518 | )?; | 9588 | )?; |
| 9519 | } | 9589 | } |
| 9520 | PARTITION_VERT_A => { | 9590 | PARTITION_VERT_A => { |
| @@ -9571,6 +9641,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 9571 | false, | 9641 | false, |
| 9572 | SUB, | 9642 | SUB, |
| 9573 | SUB, | 9643 | SUB, |
| 9644 | + allow_screen_content_tools, | ||
| 9574 | )?; | 9645 | )?; |
| 9575 | decode_inter_block( | 9646 | decode_inter_block( |
| 9576 | &mut dec, | 9647 | &mut dec, |
| @@ -9622,6 +9693,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 9622 | false, | 9693 | false, |
| 9623 | SUB, | 9694 | SUB, |
| 9624 | SUB, | 9695 | SUB, |
| 9696 | + allow_screen_content_tools, | ||
| 9625 | )?; | 9697 | )?; |
| 9626 | decode_inter_block( | 9698 | decode_inter_block( |
| 9627 | &mut dec, | 9699 | &mut dec, |
| @@ -9669,6 +9741,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 9669 | true, | 9741 | true, |
| 9670 | SUB, | 9742 | SUB, |
| 9671 | BLOCK, | 9743 | BLOCK, |
| 9744 | + allow_screen_content_tools, | ||
| 9672 | )?; | 9745 | )?; |
| 9673 | } | 9746 | } |
| 9674 | PARTITION_VERT_B => { | 9747 | PARTITION_VERT_B => { |
| @@ -9722,6 +9795,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 9722 | true, | 9795 | true, |
| 9723 | SUB, | 9796 | SUB, |
| 9724 | BLOCK, | 9797 | BLOCK, |
| 9798 | + allow_screen_content_tools, | ||
| 9725 | )?; | 9799 | )?; |
| 9726 | decode_inter_block( | 9800 | decode_inter_block( |
| 9727 | &mut dec, | 9801 | &mut dec, |
| @@ -9773,6 +9847,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 9773 | false, | 9847 | false, |
| 9774 | SUB, | 9848 | SUB, |
| 9775 | SUB, | 9849 | SUB, |
| 9850 | + allow_screen_content_tools, | ||
| 9776 | )?; | 9851 | )?; |
| 9777 | decode_inter_block( | 9852 | decode_inter_block( |
| 9778 | &mut dec, | 9853 | &mut dec, |
| @@ -9824,6 +9899,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 9824 | false, | 9899 | false, |
| 9825 | SUB, | 9900 | SUB, |
| 9826 | SUB, | 9901 | SUB, |
| 9902 | + allow_screen_content_tools, | ||
| 9827 | )?; | 9903 | )?; |
| 9828 | } | 9904 | } |
| 9829 | _ => { | 9905 | _ => { |
| @@ -10601,6 +10677,7 @@ mod tests { | |||
| 10601 | false, | 10677 | false, |
| 10602 | side, | 10678 | side, |
| 10603 | side, | 10679 | side, |
| 10680 | + false, | ||
| 10604 | ) | 10681 | ) |
| 10605 | .unwrap(); | 10682 | .unwrap(); |
| 10606 | 10683 | ||
crates/ec-av1/src/stream.rsmodified+8 -11
| @@ -166,17 +166,13 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> { | |||
| 166 | // (spec 5.11.10/5.11.11, one symbol group per superblock). Refuse | 166 | // (spec 5.11.10/5.11.11, one symbol group per superblock). Refuse |
| 167 | // before desyncing rather than silently miscode, the same pattern as | 167 | // before desyncing rather than silently miscode, the same pattern as |
| 168 | // the CDEF/TxMode::Select refusals above. | 168 | // the CDEF/TxMode::Select refusals above. |
| 169 | - // Key frames now consume (not reconstruct) palette/intrabc syntax | 169 | + // lane-screen r2: key frames consume (not reconstruct) palette/ |
| 170 | - // via read_intra_mode, so the arithmetic decoder stays in sync; | 170 | + // intrabc syntax via read_intra_mode, and decode_inter_block/ |
| 171 | - // decode_inter_block/decode_inter_block8's intra-sub-block branches | 171 | + // decode_inter_block8's own intra-sub-block branches now consume |
| 172 | - // still have no such wiring, so a non-key frame with the bit set | 172 | + // palette the same way (libaom's read_intra_block_mode_info has no |
| 173 | - // still desyncs and must refuse. | 173 | + // intrabc call at all -- that symbol is intra-frame-only). A |
| 174 | - if header.frame_type != FrameType::Key && header.allow_screen_content_tools { | 174 | + // genuine palette/intrabc use still refuses by name deeper in the |
| 175 | - return Err(Error::unsupported( | 175 | + // block readers, so no whole-frame refusal is needed here anymore. |
| 176 | - "AV1 decode_stream", | ||
| 177 | - "a non-key frame with allow_screen_content_tools set (this decoder's inter path never reads intrabc/palette_mode_info)", | ||
| 178 | - )); | ||
| 179 | - } | ||
| 180 | if header.delta.q_present || header.delta.lf_present { | 176 | if header.delta.q_present || header.delta.lf_present { |
| 181 | return Err(Error::unsupported( | 177 | return Err(Error::unsupported( |
| 182 | "AV1 decode_stream", | 178 | "AV1 decode_stream", |
| @@ -464,6 +460,7 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> { | |||
| 464 | header.reduced_tx_set, | 460 | header.reduced_tx_set, |
| 465 | header.is_motion_mode_switchable, | 461 | header.is_motion_mode_switchable, |
| 466 | header.allow_warped_motion, | 462 | header.allow_warped_motion, |
| 463 | + header.allow_screen_content_tools, | ||
| 467 | )? | 464 | )? |
| 468 | }; | 465 | }; |
| 469 | // Spec 7.20: `disable_frame_end_update_cdf` stores the frame's | 466 | // Spec 7.20: `disable_frame_end_update_cdf` stores the frame's |
lanes/screen-r2.report.mdadded+96 -0
| @@ -0,0 +1,96 @@ | |||
| 1 | +VERDICT: GREEN — decode_inter_block/decode_inter_block8's intra-sub-block branches now consume PALETTE_Y_MODE/PALETTE_UV_MODE the same way read_intra_mode does for key frames; stream.rs:169's `frame_type != Key && allow_screen_content_tools` whole-frame refusal is removed entirely; 231/0 lib suite unchanged. | ||
| 2 | + | ||
| 3 | +## What landed (commit daa6934, on top of merged lane-screen r1 at 42af470) | ||
| 4 | + | ||
| 5 | +libaom's inter-frame intra-sub-block reader is `read_intra_block_mode_info` | ||
| 6 | +(decodemv.c:1065-1107) — confirmed by reading it directly, NOT the | ||
| 7 | +key-frame `read_intra_frame_mode_info` the charter warned might not | ||
| 8 | +transfer. Two findings that changed scope from what the charter assumed: | ||
| 9 | + | ||
| 10 | +- Its `mbmi->mode` read already uses `ec_ctx->y_mode_cdf[size_group_lookup[bsize]]`, | ||
| 11 | + never `kf_y_mode_cdf` — and this decoder's `decode_inter_block`/ | ||
| 12 | + `decode_inter_block8` intra branches already read `cdfs.y_mode[size_group]`/ | ||
| 13 | + `cdfs.y_mode[SIZE_GROUP_8]` respectively (pre-existing code, unrelated to | ||
| 14 | + this lane). No CDF-selection bug to fix here. | ||
| 15 | +- `read_intra_block_mode_info` has **no `use_intrabc` call at all**. | ||
| 16 | + `av1_read_mode_info` dispatches `use_intrabc = 0` then branches on | ||
| 17 | + `frame_is_intra_only(cm)`: only that branch calls `read_intra_frame_mode_info` | ||
| 18 | + (which reads `use_intrabc`); the inter-frame branch calls | ||
| 19 | + `read_inter_frame_mode_info` → `read_intra_block_mode_info` for an intra | ||
| 20 | + sub-block, with no intrabc symbol at all — it's an intra-frame-only bit by | ||
| 21 | + spec construction, not something this decoder was ever missing here. So | ||
| 22 | + this round's whole job collapsed to palette only. | ||
| 23 | + | ||
| 24 | +What was added, mirroring `read_intra_mode`'s existing r1 wiring exactly | ||
| 25 | +(same `av1_allow_palette` gate reused via the existing `palette_bsize_ctx` | ||
| 26 | +helper, same `palette_mode_ctx`/`palette_uv_mode_ctx` hardcoded-0 | ||
| 27 | +corner-cut — still safe, unchanged reasoning): | ||
| 28 | + | ||
| 29 | +- `decode_inter_block`'s square-intra branch: after `uv_mode`/`alpha` are | ||
| 30 | + read (same point `read_palette_mode_info` sits at in libaom, right after | ||
| 31 | + `xd->cfl.store_y`), reads `palette_y_mode[bsize_ctx][0]` when | ||
| 32 | + `mode == DC_PRED` and `palette_uv_mode[0]` when `uv_mode == DC_PRED`, | ||
| 33 | + refusing by name on either firing nonzero. | ||
| 34 | +- `decode_inter_block8`'s 8x8-leaf intra branch: same two reads, `bsize_ctx` | ||
| 35 | + fixed at 0 (`BLOCK_8X8` is always `av1_allow_palette`-eligible; the leaf's | ||
| 36 | + own existing refusal already forces `uv_mode == DC_PRED`, so the UV read | ||
| 37 | + is unconditional there, matching libaom's own always-true gate for this | ||
| 38 | + shape). | ||
| 39 | +- Both functions gained a trailing `allow_screen_content_tools: bool` param; | ||
| 40 | + `decode_inter_frame_tile_with_cdfs` gained the same param, threaded to all | ||
| 41 | + 19 `decode_inter_block` and 1 `decode_inter_block8` call sites (the public | ||
| 42 | + `decode_inter_frame_tile` wrapper and one test call site pass `false`, | ||
| 43 | + matching the existing key-frame wrapper convention). | ||
| 44 | +- `stream.rs`'s production call passes `header.allow_screen_content_tools`. | ||
| 45 | +- `stream.rs:169`'s remaining `frame_type != Key && allow_screen_content_tools` | ||
| 46 | + refusal is deleted (comment left explaining why no whole-frame refusal is | ||
| 47 | + needed anymore — genuine palette use still refuses deeper in the block | ||
| 48 | + readers, same as key frames). The `delta.q_present || delta.lf_present` | ||
| 49 | + refusal on the lines below is untouched, per charter. | ||
| 50 | + | ||
| 51 | +No new CDF tables — `palette_y_mode`/`palette_uv_mode`/`palette_y_size`/ | ||
| 52 | +`palette_uv_size` already exist and were already 4-site-wired in r1 | ||
| 53 | +(`reset2`/`reset3` length-generic, save/restore whole-struct, defaults | ||
| 54 | +checked then). This round only reused them from a second call site. | ||
| 55 | + | ||
| 56 | +Rect intra strips inside a screen-content frame still refuse by name | ||
| 57 | +("a HORZ/VERT intra strip in a screen-content frame (palette syntax is | ||
| 58 | +consumed for square blocks only)") — untouched, per charter. | ||
| 59 | + | ||
| 60 | +## Verification | ||
| 61 | + | ||
| 62 | +`cargo check -p ec-av1 --lib --tests`: clean (pre-existing warnings only). | ||
| 63 | + | ||
| 64 | +`cargo test -p ec-av1 --release --lib`: **231 passed, 0 failed, 17 ignored** | ||
| 65 | +— identical to the pre-change baseline; the bit is clear on every existing | ||
| 66 | +stream, so the new palette reads are unreached (inert) for all of them. | ||
| 67 | + | ||
| 68 | +`allow_screen_content_tools` refusal count, before (commit 42af470) vs after | ||
| 69 | +(daa6934), same seed range, same test: | ||
| 70 | + | ||
| 71 | +- `a_real_aomenc_stream_with_ab_partitions_decodes_pixel_exact`: **before 6/40** | ||
| 72 | + refusing specifically on `"a non-key frame with allow_screen_content_tools set"` | ||
| 73 | + (34 named refusals total, 6 pixel-exact matches, partab_hits=3) → **after | ||
| 74 | + 0/40** on that string (31 named refusals — same partition/rect-transform/ | ||
| 75 | + rect-screen-content-strip reasons as before minus the 6 whole-frame ones, | ||
| 76 | + 9 pixel-exact matches, partab_hits=5). | ||
| 77 | +- `a_real_aomenc_stream_with_interintra_wedge_decodes_pixel_exact`: 0/40 on | ||
| 78 | + that string both before and after in this fixed-seed run — every refusal | ||
| 79 | + here is `"more than one concurrently active ROTZOOM/AFFINE global-motion | ||
| 80 | + ref slot"` (unrelated, pre-existing gap), 20/40 pixel-exact both times | ||
| 81 | + (wii_hits 8-9, consistent with the documented aomenc-RD-nondeterminism | ||
| 82 | + attempt-selection class). The charter's "9 of 40" estimate for this gate | ||
| 83 | + did not reproduce in this measurement — noted rather than silently | ||
| 84 | + dropped; the AB-partitions gate is the one that actually carried this | ||
| 85 | + refusal in both rounds. | ||
| 86 | + | ||
| 87 | +## What still refuses | ||
| 88 | + | ||
| 89 | +- Genuine palette use (nonzero `palette_size`) or genuine intrabc use, on | ||
| 90 | + any frame type — reconstruction is out of scope, by design (spec-correct | ||
| 91 | + named refusal, not a desync). | ||
| 92 | +- A HORZ/VERT (rect) intra strip in a screen-content frame — the square-only | ||
| 93 | + `palette_bsize_ctx` doesn't cover rect strips; unchanged from r1. | ||
| 94 | +- `SMOOTH_PRED`/`PAETH_PRED` chroma, directional chroma on the general | ||
| 95 | + intra-in-inter path, non-angle-zero deltas, `mode >= 13` — all pre-existing, | ||
| 96 | + unrelated round-2 gaps this lane didn't touch. | ||