Merge branch 'lane-screen': consume palette/intrabc syntax on key frames
Browse files at this commit6 changed files +347 -4
- crates/ec-av1/src/cdf.rs +46 -0
- crates/ec-av1/src/cdf_state.rs +21 -0
- crates/ec-av1/src/decode.rs +117 -0
- crates/ec-av1/src/stream.rs +31 -4
- lanes/screen-r1.charter.md +58 -0
- lanes/screen-r1.report.md +74 -0
crates/ec-av1/src/cdf.rsmodified+46 -0
| @@ -332,6 +332,52 @@ pub const FILTER_INTRA: [[u16; 3]; 6] = [ | |||
| 332 | /// `FILTER_INTRA_MODES` a `use_filter_intra` block picks. | 332 | /// `FILTER_INTRA_MODES` a `use_filter_intra` block picks. |
| 333 | pub const FILTER_INTRA_MODE: [u16; 6] = [8949, 12776, 17211, 29558, 32768, 0]; | 333 | pub const FILTER_INTRA_MODE: [u16; 6] = [8949, 12776, 17211, 29558, 32768, 0]; |
| 334 | 334 | ||
| 335 | +/// `default_palette_y_size_cdf` (entropymode.c): `PALETTE_SIZES` (2..=8), | ||
| 336 | +/// indexed by `av1_get_palette_bsize_ctx` (0..=6, `PALATTE_BSIZE_CTXS`). | ||
| 337 | +pub const PALETTE_Y_SIZE: [[u16; 8]; 7] = [ | ||
| 338 | + [7952, 13000, 18149, 21478, 25527, 29241, 32768, 0], | ||
| 339 | + [7139, 11421, 16195, 19544, 23666, 28073, 32768, 0], | ||
| 340 | + [7788, 12741, 17325, 20500, 24315, 28530, 32768, 0], | ||
| 341 | + [8271, 14064, 18246, 21564, 25071, 28533, 32768, 0], | ||
| 342 | + [12725, 19180, 21863, 24839, 27535, 30120, 32768, 0], | ||
| 343 | + [9711, 14888, 16923, 21052, 25661, 27875, 32768, 0], | ||
| 344 | + [14940, 20797, 21678, 24186, 27033, 28999, 32768, 0], | ||
| 345 | +]; | ||
| 346 | +/// `default_palette_uv_size_cdf` (entropymode.c): as [`PALETTE_Y_SIZE`], for | ||
| 347 | +/// the chroma plane's own palette size. | ||
| 348 | +pub const PALETTE_UV_SIZE: [[u16; 8]; 7] = [ | ||
| 349 | + [8713, 19979, 27128, 29609, 31331, 32272, 32768, 0], | ||
| 350 | + [5839, 15573, 23581, 26947, 29848, 31700, 32768, 0], | ||
| 351 | + [4426, 11260, 17999, 21483, 25863, 29430, 32768, 0], | ||
| 352 | + [3228, 9464, 14993, 18089, 22523, 27420, 32768, 0], | ||
| 353 | + [3768, 8886, 13091, 17852, 22495, 27207, 32768, 0], | ||
| 354 | + [2464, 8451, 12861, 21632, 25525, 28555, 32768, 0], | ||
| 355 | + [1269, 5435, 10433, 18963, 21700, 25865, 32768, 0], | ||
| 356 | +]; | ||
| 357 | +/// `default_palette_y_mode_cdf` (entropymode.c): whether a `DC_PRED` block | ||
| 358 | +/// uses a palette, indexed `[bsize_ctx][palette_mode_ctx]` | ||
| 359 | +/// (`palette_mode_ctx` from `av1_get_palette_mode_ctx` -- this decoder never | ||
| 360 | +/// completes a decode with a nonzero neighbour `palette_size`, so only row | ||
| 361 | +/// `[.][0]` is ever read, but the whole table is here to match libaom's | ||
| 362 | +/// adaptation shape exactly). | ||
| 363 | +pub const PALETTE_Y_MODE: [[[u16; 3]; 3]; 7] = [ | ||
| 364 | + [[31676, 32768, 0], [3419, 32768, 0], [1261, 32768, 0]], | ||
| 365 | + [[31912, 32768, 0], [2859, 32768, 0], [980, 32768, 0]], | ||
| 366 | + [[31823, 32768, 0], [3400, 32768, 0], [781, 32768, 0]], | ||
| 367 | + [[32030, 32768, 0], [3561, 32768, 0], [904, 32768, 0]], | ||
| 368 | + [[32309, 32768, 0], [7337, 32768, 0], [1462, 32768, 0]], | ||
| 369 | + [[32265, 32768, 0], [4015, 32768, 0], [1521, 32768, 0]], | ||
| 370 | + [[32450, 32768, 0], [7946, 32768, 0], [129, 32768, 0]], | ||
| 371 | +]; | ||
| 372 | +/// `default_palette_uv_mode_cdf` (entropymode.c): whether a `UV_DC_PRED` | ||
| 373 | +/// block uses a chroma palette, indexed by `palette_uv_mode_ctx` (whether | ||
| 374 | +/// this block's own luma palette was used -- always 0 here, see | ||
| 375 | +/// [`PALETTE_Y_MODE`]'s doc). | ||
| 376 | +pub const PALETTE_UV_MODE: [[u16; 3]; 2] = [[32461, 32768, 0], [21488, 32768, 0]]; | ||
| 377 | +/// `default_intrabc_cdf` (entropymode.c): the `use_intrabc` flag on an | ||
| 378 | +/// intra frame with `allow_intrabc` set. | ||
| 379 | +pub const INTRABC: [u16; 3] = [30531, 32768, 0]; | ||
| 380 | + | ||
| 335 | /// `default_tx_size_cdf[0]` (entropymode.c): an 8x8 block's `tx_depth` flag | 381 | /// `default_tx_size_cdf[0]` (entropymode.c): an 8x8 block's `tx_depth` flag |
| 336 | /// (`TX8` vs `TX4`), indexed by `tx_size_context` (0..=2). | 382 | /// (`TX8` vs `TX4`), indexed by `tx_size_context` (0..=2). |
| 337 | pub const TX_SIZE_CAT0: [[u16; 3]; 3] = [[19968, 32768, 0], [19968, 32768, 0], [24320, 32768, 0]]; | 383 | pub const TX_SIZE_CAT0: [[u16; 3]; 3] = [[19968, 32768, 0], [19968, 32768, 0], [24320, 32768, 0]]; |
crates/ec-av1/src/cdf_state.rsmodified+21 -0
| @@ -402,6 +402,17 @@ pub(crate) struct Cdfs { | |||
| 402 | /// A `SWITCHABLE`-filter inter block's own `interp_filter[dir]` -- see | 402 | /// A `SWITCHABLE`-filter inter block's own `interp_filter[dir]` -- see |
| 403 | /// [`cdf::SWITCHABLE_INTERP`]. | 403 | /// [`cdf::SWITCHABLE_INTERP`]. |
| 404 | pub switchable_interp: [[u16; 4]; 16], | 404 | pub switchable_interp: [[u16; 4]; 16], |
| 405 | + /// A `DC_PRED` block's own palette-use flag -- see [`cdf::PALETTE_Y_MODE`]. | ||
| 406 | + pub palette_y_mode: [[[u16; 3]; 3]; 7], | ||
| 407 | + /// A palette block's own size (2..=8) -- see [`cdf::PALETTE_Y_SIZE`]. | ||
| 408 | + pub palette_y_size: [[u16; 8]; 7], | ||
| 409 | + /// A `UV_DC_PRED` block's own chroma palette-use flag -- see | ||
| 410 | + /// [`cdf::PALETTE_UV_MODE`]. | ||
| 411 | + pub palette_uv_mode: [[u16; 3]; 2], | ||
| 412 | + /// A chroma palette block's own size -- see [`cdf::PALETTE_UV_SIZE`]. | ||
| 413 | + pub palette_uv_size: [[u16; 8]; 7], | ||
| 414 | + /// The `use_intrabc` flag -- see [`cdf::INTRABC`]. | ||
| 415 | + pub intrabc: [u16; 3], | ||
| 405 | } | 416 | } |
| 406 | 417 | ||
| 407 | /// One motion vector component's adapting state (spec 9.4's `Default_Mv_*`, | 418 | /// One motion vector component's adapting state (spec 9.4's `Default_Mv_*`, |
| @@ -616,6 +627,11 @@ impl Cdfs { | |||
| 616 | reset2(&mut self.tx_size_cat1); | 627 | reset2(&mut self.tx_size_cat1); |
| 617 | reset2(&mut self.tx_size_cat2); | 628 | reset2(&mut self.tx_size_cat2); |
| 618 | reset2(&mut self.tx_size_cat3); | 629 | reset2(&mut self.tx_size_cat3); |
| 630 | + reset3(&mut self.palette_y_mode); | ||
| 631 | + reset2(&mut self.palette_y_size); | ||
| 632 | + reset2(&mut self.palette_uv_mode); | ||
| 633 | + reset2(&mut self.palette_uv_size); | ||
| 634 | + reset1(&mut self.intrabc); | ||
| 619 | } | 635 | } |
| 620 | 636 | ||
| 621 | /// The defaults a key frame starts from (spec 8.4, `init_coeff_cdfs` and | 637 | /// The defaults a key frame starts from (spec 8.4, `init_coeff_cdfs` and |
| @@ -1057,6 +1073,11 @@ impl Cdfs { | |||
| 1057 | tx_size_cat2: cdf::TX_SIZE_CAT2, | 1073 | tx_size_cat2: cdf::TX_SIZE_CAT2, |
| 1058 | tx_size_cat3: cdf::TX_SIZE_CAT3, | 1074 | tx_size_cat3: cdf::TX_SIZE_CAT3, |
| 1059 | switchable_interp: cdf::SWITCHABLE_INTERP, | 1075 | switchable_interp: cdf::SWITCHABLE_INTERP, |
| 1076 | + palette_y_mode: cdf::PALETTE_Y_MODE, | ||
| 1077 | + palette_y_size: cdf::PALETTE_Y_SIZE, | ||
| 1078 | + palette_uv_mode: cdf::PALETTE_UV_MODE, | ||
| 1079 | + palette_uv_size: cdf::PALETTE_UV_SIZE, | ||
| 1080 | + intrabc: cdf::INTRABC, | ||
| 1060 | } | 1081 | } |
| 1061 | } | 1082 | } |
| 1062 | 1083 | ||
crates/ec-av1/src/decode.rsmodified+117 -0
| @@ -1556,6 +1556,22 @@ fn filter_intra_size_class_rect(bw: usize, bh: usize) -> Option<usize> { | |||
| 1556 | } | 1556 | } |
| 1557 | } | 1557 | } |
| 1558 | 1558 | ||
| 1559 | +/// `av1_allow_palette`'s size bound (blockd.h: `block_size_wide/high <= | ||
| 1560 | +/// MAX_PALETTE_BLOCK_WIDTH/HEIGHT` (64) and `sb_type >= BLOCK_8X8`) plus | ||
| 1561 | +/// `av1_get_palette_bsize_ctx` (pred_common.h: `num_pels_log2_lookup[bsize] | ||
| 1562 | +/// - num_pels_log2_lookup[BLOCK_8X8]`, i.e. `2*log2(side) - 6` for this | ||
| 1563 | +/// decoder's square-only blocks) -- `None` past the bound (never gates a | ||
| 1564 | +/// palette read), `Some(bsize_ctx)` otherwise. | ||
| 1565 | +fn palette_bsize_ctx(side: usize) -> Option<usize> { | ||
| 1566 | + match side { | ||
| 1567 | + 8 => Some(0), | ||
| 1568 | + 16 => Some(2), | ||
| 1569 | + 32 => Some(4), | ||
| 1570 | + 64 => Some(6), | ||
| 1571 | + _ => None, | ||
| 1572 | + } | ||
| 1573 | +} | ||
| 1574 | + | ||
| 1559 | /// [`read_intra_mode`] for a true `bw`x`bh` rect strip (lane-intradisp r1): | 1575 | /// [`read_intra_mode`] for a true `bw`x`bh` rect strip (lane-intradisp r1): |
| 1560 | /// identical except the `use_filter_intra` size class comes from | 1576 | /// identical except the `use_filter_intra` size class comes from |
| 1561 | /// [`filter_intra_size_class_rect`] instead of the square-only | 1577 | /// [`filter_intra_size_class_rect`] instead of the square-only |
| @@ -1573,6 +1589,7 @@ fn read_intra_mode_rect( | |||
| 1573 | bh: usize, | 1589 | bh: usize, |
| 1574 | enable_filter_intra: bool, | 1590 | enable_filter_intra: bool, |
| 1575 | skip_ctx: usize, | 1591 | skip_ctx: usize, |
| 1592 | + allow_screen_content_tools: bool, | ||
| 1576 | ) -> Result<( | 1593 | ) -> Result<( |
| 1577 | bool, | 1594 | bool, |
| 1578 | usize, | 1595 | usize, |
| @@ -1582,6 +1599,16 @@ fn read_intra_mode_rect( | |||
| 1582 | Option<(i32, i32)>, | 1599 | Option<(i32, i32)>, |
| 1583 | Option<usize>, | 1600 | Option<usize>, |
| 1584 | )> { | 1601 | )> { |
| 1602 | + // lane-screen consumes palette/intrabc syntax in the SQUARE reader only | ||
| 1603 | + // (`palette_bsize_ctx` is keyed on a single side). A rect strip in a | ||
| 1604 | + // screen-content frame would therefore skip symbols the encoder wrote and | ||
| 1605 | + // desync the tile, so refuse it by name rather than decode it wrong. | ||
| 1606 | + if allow_screen_content_tools { | ||
| 1607 | + return Err(unsupported( | ||
| 1608 | + "a HORZ/VERT intra strip in a screen-content frame (palette syntax \ | ||
| 1609 | + is consumed for square blocks only)", | ||
| 1610 | + )); | ||
| 1611 | + } | ||
| 1585 | let skip = dec.symbol(&mut cdfs.skip[skip_ctx]) != 0; | 1612 | let skip = dec.symbol(&mut cdfs.skip[skip_ctx]) != 0; |
| 1586 | let above_ctx = INTRA_MODE_CTX[above_mode]; | 1613 | let above_ctx = INTRA_MODE_CTX[above_mode]; |
| 1587 | let left_ctx = INTRA_MODE_CTX[left_mode]; | 1614 | let left_ctx = INTRA_MODE_CTX[left_mode]; |
| @@ -1694,6 +1721,7 @@ fn decode_block_rect( | |||
| 1694 | u: &mut PlaneBuf, | 1721 | u: &mut PlaneBuf, |
| 1695 | v: &mut PlaneBuf, | 1722 | v: &mut PlaneBuf, |
| 1696 | enable_filter_intra: bool, | 1723 | enable_filter_intra: bool, |
| 1724 | + allow_screen_content_tools: bool, | ||
| 1697 | ) -> Result<()> { | 1725 | ) -> Result<()> { |
| 1698 | let (r, c) = at; | 1726 | let (r, c) = at; |
| 1699 | let (px, py) = (c * SUB, r * SUB); | 1727 | let (px, py) = (c * SUB, r * SUB); |
| @@ -1708,6 +1736,7 @@ fn decode_block_rect( | |||
| 1708 | bh, | 1736 | bh, |
| 1709 | enable_filter_intra, | 1737 | enable_filter_intra, |
| 1710 | neighbours.skip_txfm_ctx(r * (SUB / MI), c * (SUB / MI)), | 1738 | neighbours.skip_txfm_ctx(r * (SUB / MI), c * (SUB / MI)), |
| 1739 | + allow_screen_content_tools, | ||
| 1711 | )?; | 1740 | )?; |
| 1712 | if filter_intra.is_some() { | 1741 | if filter_intra.is_some() { |
| 1713 | // `predict_filter_intra` (spec 7.11.2.3) is square-only in this | 1742 | // `predict_filter_intra` (spec 7.11.2.3) is square-only in this |
| @@ -1824,6 +1853,8 @@ fn read_intra_mode( | |||
| 1824 | side: usize, | 1853 | side: usize, |
| 1825 | enable_filter_intra: bool, | 1854 | enable_filter_intra: bool, |
| 1826 | skip_ctx: usize, | 1855 | skip_ctx: usize, |
| 1856 | + allow_screen_content_tools: bool, | ||
| 1857 | + allow_intrabc: bool, | ||
| 1827 | ) -> Result<( | 1858 | ) -> Result<( |
| 1828 | bool, | 1859 | bool, |
| 1829 | usize, | 1860 | usize, |
| @@ -1838,6 +1869,26 @@ fn read_intra_mode( | |||
| 1838 | if trace { | 1869 | if trace { |
| 1839 | eprintln!("TRACE skip value={}", skip as i32); | 1870 | eprintln!("TRACE skip value={}", skip as i32); |
| 1840 | } | 1871 | } |
| 1872 | + // `read_intrabc_info` (spec 5.11.13, libaom decodemv.c:693, called at | ||
| 1873 | + // :811 right after `skip_txfm`/`segment_id`/`cdef`/`delta_q` and before | ||
| 1874 | + // `mbmi->mode` is ever read): a `use_intrabc` symbol only present on an | ||
| 1875 | + // intra frame whose header set `allow_intrabc`. Actual intra block copy | ||
| 1876 | + // needs `assign_dv`'s own motion-vector-prediction machinery (`av1_find_mv_refs`, | ||
| 1877 | + // `av1_find_ref_dv`) this decoder does not carry -- lane-screen scope | ||
| 1878 | + // draws the line at consuming this one flag symbol and refusing by name | ||
| 1879 | + // when it fires, so the arithmetic decoder still resyncs for a stream | ||
| 1880 | + // that merely allows (but never uses) intrabc. | ||
| 1881 | + if allow_intrabc { | ||
| 1882 | + let use_intrabc = dec.symbol(&mut cdfs.intrabc) != 0; | ||
| 1883 | + if trace { | ||
| 1884 | + eprintln!("TRACE use_intrabc value={}", use_intrabc as i32); | ||
| 1885 | + } | ||
| 1886 | + if use_intrabc { | ||
| 1887 | + return Err(unsupported( | ||
| 1888 | + "a block that actually uses intrabc (this decoder never reconstructs one)", | ||
| 1889 | + )); | ||
| 1890 | + } | ||
| 1891 | + } | ||
| 1841 | let above_ctx = INTRA_MODE_CTX[above_mode]; | 1892 | let above_ctx = INTRA_MODE_CTX[above_mode]; |
| 1842 | let left_ctx = INTRA_MODE_CTX[left_mode]; | 1893 | let left_ctx = INTRA_MODE_CTX[left_mode]; |
| 1843 | let mode = dec.symbol(&mut cdfs.kf_y_mode[above_ctx][left_ctx]); | 1894 | let mode = dec.symbol(&mut cdfs.kf_y_mode[above_ctx][left_ctx]); |
| @@ -1890,6 +1941,32 @@ fn read_intra_mode( | |||
| 1890 | } else { | 1941 | } else { |
| 1891 | 0 | 1942 | 0 |
| 1892 | }; | 1943 | }; |
| 1944 | + // `read_palette_mode_info` (spec 5.11.13, libaom decodemv.c:567, called | ||
| 1945 | + // at :840 right after `xd->cfl.store_y` and before `read_filter_intra_mode_info`): | ||
| 1946 | + // gated by `av1_allow_palette` (blockd.h -- size bound only, | ||
| 1947 | + // [`palette_bsize_ctx`]). `palette_mode_ctx`/`palette_uv_mode_ctx` | ||
| 1948 | + // (`av1_get_palette_mode_ctx`, pred_common.h) read the neighbours' own | ||
| 1949 | + // `palette_size[0] > 0` -- always 0 here since a nonzero size refuses | ||
| 1950 | + // the whole decode below, so no successfully-completed decode ever has | ||
| 1951 | + // such a neighbour (corner-cut: hardcoded ctx 0 instead of tracking it, | ||
| 1952 | + // ceiling = real palette reconstruction, out of this lane's scope). | ||
| 1953 | + // A nonzero `palette_size` needs the color-cache/delta-coded-colors | ||
| 1954 | + // syntax this decoder does not reconstruct -- refuse by name rather | ||
| 1955 | + // than silently drop pixels. | ||
| 1956 | + if allow_screen_content_tools | ||
| 1957 | + && let Some(bsize_ctx) = palette_bsize_ctx(side) | ||
| 1958 | + { | ||
| 1959 | + if mode == DC_PRED && dec.symbol(&mut cdfs.palette_y_mode[bsize_ctx][0]) != 0 { | ||
| 1960 | + return Err(unsupported( | ||
| 1961 | + "a block that actually uses a palette (Y) -- reconstruction is out of scope", | ||
| 1962 | + )); | ||
| 1963 | + } | ||
| 1964 | + if uv_mode == DC_PRED && dec.symbol(&mut cdfs.palette_uv_mode[0]) != 0 { | ||
| 1965 | + return Err(unsupported( | ||
| 1966 | + "a block that actually uses a palette (UV) -- reconstruction is out of scope", | ||
| 1967 | + )); | ||
| 1968 | + } | ||
| 1969 | + } | ||
| 1893 | // `read_filter_intra_mode_info` (spec 5.11.14, libaom decodemv.c): a | 1970 | // `read_filter_intra_mode_info` (spec 5.11.14, libaom decodemv.c): a |
| 1894 | // `use_filter_intra` symbol this decoder never read at all until | 1971 | // `use_filter_intra` symbol this decoder never read at all until |
| 1895 | // lane-av1real r10 -- silently skipping it left every bit past a | 1972 | // lane-av1real r10 -- silently skipping it left every bit past a |
| @@ -2354,6 +2431,8 @@ fn decode_block( | |||
| 2354 | v: &mut PlaneBuf, | 2431 | v: &mut PlaneBuf, |
| 2355 | base_q_idx: u8, | 2432 | base_q_idx: u8, |
| 2356 | enable_filter_intra: bool, | 2433 | enable_filter_intra: bool, |
| 2434 | + allow_screen_content_tools: bool, | ||
| 2435 | + allow_intrabc: bool, | ||
| 2357 | scan32: &[u16], | 2436 | scan32: &[u16], |
| 2358 | scan16: &[u16], | 2437 | scan16: &[u16], |
| 2359 | scan8: &[u16], | 2438 | scan8: &[u16], |
| @@ -2373,6 +2452,8 @@ fn decode_block( | |||
| 2373 | side, | 2452 | side, |
| 2374 | enable_filter_intra, | 2453 | enable_filter_intra, |
| 2375 | neighbours.skip_txfm_ctx(r * (SUB / MI), c * (SUB / MI)), | 2454 | neighbours.skip_txfm_ctx(r * (SUB / MI), c * (SUB / MI)), |
| 2455 | + allow_screen_content_tools, | ||
| 2456 | + allow_intrabc, | ||
| 2376 | )?; | 2457 | )?; |
| 2377 | // `predict` panics outside `DC_PRED..=PAETH_PRED` (0..=12); `UV_CFL_PRED` | 2458 | // `predict` panics outside `DC_PRED..=PAETH_PRED` (0..=12); `UV_CFL_PRED` |
| 2378 | // (13) predicts as `DC_PRED` with the [`cfl_scaled`] nudge carrying the | 2459 | // (13) predicts as `DC_PRED` with the [`cfl_scaled`] nudge carrying the |
| @@ -2661,6 +2742,8 @@ fn decode_leaf8( | |||
| 2661 | v: &mut PlaneBuf, | 2742 | v: &mut PlaneBuf, |
| 2662 | base_q_idx: u8, | 2743 | base_q_idx: u8, |
| 2663 | enable_filter_intra: bool, | 2744 | enable_filter_intra: bool, |
| 2745 | + allow_screen_content_tools: bool, | ||
| 2746 | + allow_intrabc: bool, | ||
| 2664 | tx_select: bool, | 2747 | tx_select: bool, |
| 2665 | reduced_tx_set: bool, | 2748 | reduced_tx_set: bool, |
| 2666 | ) -> Result<usize> { | 2749 | ) -> Result<usize> { |
| @@ -2687,6 +2770,8 @@ fn decode_leaf8( | |||
| 2687 | 8, | 2770 | 8, |
| 2688 | enable_filter_intra, | 2771 | enable_filter_intra, |
| 2689 | neighbours.skip_txfm_ctx(leaf_mi.0, leaf_mi.1), | 2772 | neighbours.skip_txfm_ctx(leaf_mi.0, leaf_mi.1), |
| 2773 | + allow_screen_content_tools, | ||
| 2774 | + allow_intrabc, | ||
| 2690 | )?; | 2775 | )?; |
| 2691 | let uv_predict_mode = if uv_mode == UV_CFL_PRED { | 2776 | let uv_predict_mode = if uv_mode == UV_CFL_PRED { |
| 2692 | DC_PRED | 2777 | DC_PRED |
| @@ -3832,6 +3917,8 @@ pub fn decode_key_frame_tile( | |||
| 3832 | loop_filter: &LoopFilterParams, | 3917 | loop_filter: &LoopFilterParams, |
| 3833 | tx_select: bool, | 3918 | tx_select: bool, |
| 3834 | reduced_tx_set: bool, | 3919 | reduced_tx_set: bool, |
| 3920 | + allow_screen_content_tools: bool, | ||
| 3921 | + allow_intrabc: bool, | ||
| 3835 | ) -> Result<Picture> { | 3922 | ) -> Result<Picture> { |
| 3836 | decode_key_frame_tile_with_cdfs( | 3923 | decode_key_frame_tile_with_cdfs( |
| 3837 | data, | 3924 | data, |
| @@ -3847,6 +3934,8 @@ pub fn decode_key_frame_tile( | |||
| 3847 | None, | 3934 | None, |
| 3848 | tx_select, | 3935 | tx_select, |
| 3849 | reduced_tx_set, | 3936 | reduced_tx_set, |
| 3937 | + allow_screen_content_tools, | ||
| 3938 | + allow_intrabc, | ||
| 3850 | ) | 3939 | ) |
| 3851 | .map(|(picture, _)| picture) | 3940 | .map(|(picture, _)| picture) |
| 3852 | } | 3941 | } |
| @@ -3873,6 +3962,8 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 3873 | initial_cdfs: Option<Cdfs>, | 3962 | initial_cdfs: Option<Cdfs>, |
| 3874 | tx_select: bool, | 3963 | tx_select: bool, |
| 3875 | reduced_tx_set: bool, | 3964 | reduced_tx_set: bool, |
| 3965 | + allow_screen_content_tools: bool, | ||
| 3966 | + allow_intrabc: bool, | ||
| 3876 | ) -> Result<(Picture, Cdfs)> { | 3967 | ) -> Result<(Picture, Cdfs)> { |
| 3877 | if mi_cols == 0 || mi_rows == 0 { | 3968 | if mi_cols == 0 || mi_rows == 0 { |
| 3878 | return Err(unsupported("a frame with no mode-info grid")); | 3969 | return Err(unsupported("a frame with no mode-info grid")); |
| @@ -3979,6 +4070,8 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 3979 | &mut v, | 4070 | &mut v, |
| 3980 | base_q_idx, | 4071 | base_q_idx, |
| 3981 | enable_filter_intra, | 4072 | enable_filter_intra, |
| 4073 | + allow_screen_content_tools, | ||
| 4074 | + allow_intrabc, | ||
| 3982 | &scan32, | 4075 | &scan32, |
| 3983 | &scan16, | 4076 | &scan16, |
| 3984 | &scan8, | 4077 | &scan8, |
| @@ -4046,6 +4139,8 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 4046 | &mut v, | 4139 | &mut v, |
| 4047 | base_q_idx, | 4140 | base_q_idx, |
| 4048 | enable_filter_intra, | 4141 | enable_filter_intra, |
| 4142 | + allow_screen_content_tools, | ||
| 4143 | + allow_intrabc, | ||
| 4049 | &scan32, | 4144 | &scan32, |
| 4050 | &scan16, | 4145 | &scan16, |
| 4051 | &scan8, | 4146 | &scan8, |
| @@ -4095,6 +4190,8 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 4095 | &mut v, | 4190 | &mut v, |
| 4096 | base_q_idx, | 4191 | base_q_idx, |
| 4097 | enable_filter_intra, | 4192 | enable_filter_intra, |
| 4193 | + allow_screen_content_tools, | ||
| 4194 | + allow_intrabc, | ||
| 4098 | &scan32, | 4195 | &scan32, |
| 4099 | &scan16, | 4196 | &scan16, |
| 4100 | &scan8, | 4197 | &scan8, |
| @@ -4149,6 +4246,8 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 4149 | &mut v, | 4246 | &mut v, |
| 4150 | base_q_idx, | 4247 | base_q_idx, |
| 4151 | enable_filter_intra, | 4248 | enable_filter_intra, |
| 4249 | + allow_screen_content_tools, | ||
| 4250 | + allow_intrabc, | ||
| 4152 | tx_select, | 4251 | tx_select, |
| 4153 | reduced_tx_set, | 4252 | reduced_tx_set, |
| 4154 | )?; | 4253 | )?; |
| @@ -4218,6 +4317,8 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 4218 | &mut v, | 4317 | &mut v, |
| 4219 | base_q_idx, | 4318 | base_q_idx, |
| 4220 | enable_filter_intra, | 4319 | enable_filter_intra, |
| 4320 | + allow_screen_content_tools, | ||
| 4321 | + allow_intrabc, | ||
| 4221 | tx_select, | 4322 | tx_select, |
| 4222 | reduced_tx_set, | 4323 | reduced_tx_set, |
| 4223 | )?; | 4324 | )?; |
| @@ -4248,6 +4349,7 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 4248 | &mut u, | 4349 | &mut u, |
| 4249 | &mut v, | 4350 | &mut v, |
| 4250 | enable_filter_intra, | 4351 | enable_filter_intra, |
| 4352 | + allow_screen_content_tools, | ||
| 4251 | )?; | 4353 | )?; |
| 4252 | decode_block_rect( | 4354 | decode_block_rect( |
| 4253 | &mut dec, | 4355 | &mut dec, |
| @@ -4260,6 +4362,7 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 4260 | &mut u, | 4362 | &mut u, |
| 4261 | &mut v, | 4363 | &mut v, |
| 4262 | enable_filter_intra, | 4364 | enable_filter_intra, |
| 4365 | + allow_screen_content_tools, | ||
| 4263 | )?; | 4366 | )?; |
| 4264 | } | 4367 | } |
| 4265 | PARTITION_VERT => { | 4368 | PARTITION_VERT => { |
| @@ -4276,6 +4379,7 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 4276 | &mut u, | 4379 | &mut u, |
| 4277 | &mut v, | 4380 | &mut v, |
| 4278 | enable_filter_intra, | 4381 | enable_filter_intra, |
| 4382 | + allow_screen_content_tools, | ||
| 4279 | )?; | 4383 | )?; |
| 4280 | decode_block_rect( | 4384 | decode_block_rect( |
| 4281 | &mut dec, | 4385 | &mut dec, |
| @@ -4288,6 +4392,7 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 4288 | &mut u, | 4392 | &mut u, |
| 4289 | &mut v, | 4393 | &mut v, |
| 4290 | enable_filter_intra, | 4394 | enable_filter_intra, |
| 4395 | + allow_screen_content_tools, | ||
| 4291 | )?; | 4396 | )?; |
| 4292 | } | 4397 | } |
| 4293 | _ => { | 4398 | _ => { |
| @@ -9726,6 +9831,8 @@ mod tests { | |||
| 9726 | &LoopFilterParams::default(), | 9831 | &LoopFilterParams::default(), |
| 9727 | false, | 9832 | false, |
| 9728 | true, | 9833 | true, |
| 9834 | + false, | ||
| 9835 | + false, | ||
| 9729 | ) | 9836 | ) |
| 9730 | .is_err() | 9837 | .is_err() |
| 9731 | ); | 9838 | ); |
| @@ -9768,6 +9875,8 @@ mod tests { | |||
| 9768 | &LoopFilterParams::default(), | 9875 | &LoopFilterParams::default(), |
| 9769 | false, | 9876 | false, |
| 9770 | true, | 9877 | true, |
| 9878 | + false, | ||
| 9879 | + false, | ||
| 9771 | ) | 9880 | ) |
| 9772 | .unwrap(); | 9881 | .unwrap(); |
| 9773 | assert_eq!(decoded.width, w, "{w}x{h}: decoded width"); | 9882 | assert_eq!(decoded.width, w, "{w}x{h}: decoded width"); |
| @@ -9851,6 +9960,8 @@ mod tests { | |||
| 9851 | &LoopFilterParams::default(), | 9960 | &LoopFilterParams::default(), |
| 9852 | false, | 9961 | false, |
| 9853 | true, | 9962 | true, |
| 9963 | + false, | ||
| 9964 | + false, | ||
| 9854 | ) | 9965 | ) |
| 9855 | .unwrap(); | 9966 | .unwrap(); |
| 9856 | assert!( | 9967 | assert!( |
| @@ -10036,6 +10147,8 @@ mod tests { | |||
| 10036 | &LoopFilterParams::default(), | 10147 | &LoopFilterParams::default(), |
| 10037 | false, | 10148 | false, |
| 10038 | true, | 10149 | true, |
| 10150 | + false, | ||
| 10151 | + false, | ||
| 10039 | ) | 10152 | ) |
| 10040 | .unwrap(); | 10153 | .unwrap(); |
| 10041 | assert_eq!(ours.y, ffmpeg_decoded.y, "{width}x{height}: luma vs ffmpeg"); | 10154 | assert_eq!(ours.y, ffmpeg_decoded.y, "{width}x{height}: luma vs ffmpeg"); |
| @@ -10108,6 +10221,8 @@ mod tests { | |||
| 10108 | &LoopFilterParams::default(), | 10221 | &LoopFilterParams::default(), |
| 10109 | false, | 10222 | false, |
| 10110 | true, | 10223 | true, |
| 10224 | + false, | ||
| 10225 | + false, | ||
| 10111 | ) | 10226 | ) |
| 10112 | .unwrap(); | 10227 | .unwrap(); |
| 10113 | assert_eq!( | 10228 | assert_eq!( |
| @@ -10411,6 +10526,8 @@ mod tests { | |||
| 10411 | &LoopFilterParams::default(), | 10526 | &LoopFilterParams::default(), |
| 10412 | false, | 10527 | false, |
| 10413 | true, | 10528 | true, |
| 10529 | + false, | ||
| 10530 | + false, | ||
| 10414 | ) | 10531 | ) |
| 10415 | .unwrap(); | 10532 | .unwrap(); |
| 10416 | assert_eq!(reference.y, ffmpeg_frames[0].y, "frame 0 luma vs ffmpeg"); | 10533 | assert_eq!(reference.y, ffmpeg_frames[0].y, "frame 0 luma vs ffmpeg"); |
crates/ec-av1/src/stream.rsmodified+31 -4
| @@ -166,10 +166,15 @@ 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 | - if header.allow_screen_content_tools { | 169 | + // Key frames now consume (not reconstruct) palette/intrabc syntax |
| 170 | + // via read_intra_mode, so the arithmetic decoder stays in sync; | ||
| 171 | + // decode_inter_block/decode_inter_block8's intra-sub-block branches | ||
| 172 | + // still have no such wiring, so a non-key frame with the bit set | ||
| 173 | + // still desyncs and must refuse. | ||
| 174 | + if header.frame_type != FrameType::Key && header.allow_screen_content_tools { | ||
| 170 | return Err(Error::unsupported( | 175 | return Err(Error::unsupported( |
| 171 | "AV1 decode_stream", | 176 | "AV1 decode_stream", |
| 172 | - "a frame with allow_screen_content_tools set (this decoder never reads intrabc/palette_mode_info)", | 177 | + "a non-key frame with allow_screen_content_tools set (this decoder's inter path never reads intrabc/palette_mode_info)", |
| 173 | )); | 178 | )); |
| 174 | } | 179 | } |
| 175 | if header.delta.q_present || header.delta.lf_present { | 180 | if header.delta.q_present || header.delta.lf_present { |
| @@ -313,6 +318,8 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> { | |||
| 313 | initial_cdfs, | 318 | initial_cdfs, |
| 314 | header.tx_mode == TxMode::Select, | 319 | header.tx_mode == TxMode::Select, |
| 315 | header.reduced_tx_set, | 320 | header.reduced_tx_set, |
| 321 | + header.allow_screen_content_tools, | ||
| 322 | + header.allow_intrabc, | ||
| 316 | )?; | 323 | )?; |
| 317 | // A key frame codes no inter blocks -- its own saved motion | 324 | // A key frame codes no inter blocks -- its own saved motion |
| 318 | // field has no cells set, matching libaom's own "intra frame | 325 | // field has no cells set, matching libaom's own "intra frame |
| @@ -535,6 +542,8 @@ mod tests { | |||
| 535 | false, | 542 | false, |
| 536 | // Our own encoder always writes `reduced_tx_set: true`. | 543 | // Our own encoder always writes `reduced_tx_set: true`. |
| 537 | true, | 544 | true, |
| 545 | + false, | ||
| 546 | + false, | ||
| 538 | ) | 547 | ) |
| 539 | .unwrap(); | 548 | .unwrap(); |
| 540 | let via_stream = decode_stream(&encoded.stream).unwrap(); | 549 | let via_stream = decode_stream(&encoded.stream).unwrap(); |
| @@ -1192,6 +1201,16 @@ mod tests { | |||
| 1192 | return; | 1201 | return; |
| 1193 | } | 1202 | } |
| 1194 | let (width, height) = (64usize, 64usize); | 1203 | let (width, height) = (64usize, 64usize); |
| 1204 | + // Recipe-search hooks: with the encoder pinned to one thread the | ||
| 1205 | + // stream is a deterministic function of (seed, cq), so a firing recipe | ||
| 1206 | + // can be searched for without a rebuild. | ||
| 1207 | + let fi_seed: u32 = std::env::var("EC_FI_SEED") | ||
| 1208 | + .ok() | ||
| 1209 | + .and_then(|v| v.parse().ok()) | ||
| 1210 | + .unwrap_or(42); | ||
| 1211 | + let fi_source = format!("gradients=size=64x64:seed={fi_seed}:duration=0.04:rate=25"); | ||
| 1212 | + let fi_cq = std::env::var("EC_FI_CQ").unwrap_or_else(|_| "40".to_string()); | ||
| 1213 | + let fi_cq_arg = format!("--cq-level={fi_cq}"); | ||
| 1195 | let y4m = Command::new("ffmpeg") | 1214 | let y4m = Command::new("ffmpeg") |
| 1196 | .args([ | 1215 | .args([ |
| 1197 | "-v", | 1216 | "-v", |
| @@ -1199,7 +1218,7 @@ mod tests { | |||
| 1199 | "-f", | 1218 | "-f", |
| 1200 | "lavfi", | 1219 | "lavfi", |
| 1201 | "-i", | 1220 | "-i", |
| 1202 | - "gradients=size=64x64:seed=42:duration=0.04:rate=25", | 1221 | + &fi_source, |
| 1203 | "-pix_fmt", | 1222 | "-pix_fmt", |
| 1204 | "yuv420p", | 1223 | "yuv420p", |
| 1205 | "-f", | 1224 | "-f", |
| @@ -1221,8 +1240,16 @@ mod tests { | |||
| 1221 | "--codec=av1", | 1240 | "--codec=av1", |
| 1222 | "--passes=1", | 1241 | "--passes=1", |
| 1223 | "--end-usage=q", | 1242 | "--end-usage=q", |
| 1224 | - "--cq-level=40", | 1243 | + &fi_cq_arg, |
| 1225 | "--cpu-used=0", | 1244 | "--cpu-used=0", |
| 1245 | + // Every sibling gate pins these; this one did not, and a | ||
| 1246 | + // multi-threaded aomenc is not deterministic, so each run | ||
| 1247 | + // encoded a slightly different stream and the gate flaked | ||
| 1248 | + // against whichever features that run happened to pick. | ||
| 1249 | + // Pinning them makes seed 42 mean one stream (class | ||
| 1250 | + // `parallel-flake-is-attempt-selection`). | ||
| 1251 | + "--threads=1", | ||
| 1252 | + "--row-mt=0", | ||
| 1226 | "--enable-filter-intra=1", | 1253 | "--enable-filter-intra=1", |
| 1227 | "--enable-smooth-intra=0", | 1254 | "--enable-smooth-intra=0", |
| 1228 | "--enable-paeth-intra=0", | 1255 | "--enable-paeth-intra=0", |
lanes/screen-r1.charter.mdadded+58 -0
| @@ -0,0 +1,58 @@ | |||
| 1 | +# lane-screen r1 charter — consume screen-content-tools syntax (palette + intrabc) | ||
| 2 | + | ||
| 3 | +Worktree /home/user/Documents/Code/Rust/edith_codecs-screen, branch lane-screen @ 00de8d3. | ||
| 4 | +Build/test ONLY: `env CARGO_TARGET_DIR=$HOME/.cache/cargo-target-screen CARGO_BUILD_JOBS=4 nice -n 19 cargo test -p ec-av1 --release --lib <name> -- --nocapture` (full lib ~70s, run it whole; EC_AV1_REQUIRE_AOMENC=1 on gate runs). | ||
| 5 | +Never push, never merge, never touch sibling worktrees (lane-gm and lane-intradisp are live). | ||
| 6 | +libaom oracle: ~/.cache/aom-oracle/src (v3.13.3); binaries in ~/.cache/aom-oracle/build/ (aomdec is instrumented: EC_TRACE=1 prints EC_PART with msac range; EC_AV1_PREFILT_DUMP=<prefix> dumps pre-filter recon). | ||
| 7 | + | ||
| 8 | +## Why: this is the widest cheap win left | ||
| 9 | +`stream.rs:169` refuses ANY frame with `allow_screen_content_tools` set. That is | ||
| 10 | +14/40 attempts in the AB-partition gate, it blocks the 8x8-OBMC recipe search | ||
| 11 | +(the content that fires 8x8 OBMC trips this bit), and it makes several gates | ||
| 12 | +skip. Crucially the encoder in those gates runs `--enable-palette=0 | ||
| 13 | +--enable-intrabc=0`: the tools are SIGNALLED as allowed but never USED. So the | ||
| 14 | +decoder does not need palette reconstruction — it needs to CONSUME the symbols | ||
| 15 | +so the arithmetic decoder stays in sync (class: symbol-consumption-gap). | ||
| 16 | + | ||
| 17 | +## Scope | ||
| 18 | +1. `read_palette_mode_info` (~/.cache/aom-oracle/src/av1/decoder/decodemv.c:567, | ||
| 19 | + called at :840 and :1103): read it wherever libaom does, gated by | ||
| 20 | + `av1_allow_palette` (blockd.h:1498 — `allow_screen_content_tools && | ||
| 21 | + block_size_wide <= 64 && block_size_high <= 64 && bsize >= BLOCK_8X8`; | ||
| 22 | + confirm the exact constants in the header, do not guess). | ||
| 23 | + - luma branch only when `mode == DC_PRED`; chroma branch only when | ||
| 24 | + `uv_mode == UV_DC_PRED` and the block has chroma. | ||
| 25 | + - You need `palette_y_mode_cdf[bsize_ctx][palette_mode_ctx]`, | ||
| 26 | + `palette_y_size_cdf[bsize_ctx]`, the uv equivalents, plus | ||
| 27 | + `av1_get_palette_bsize_ctx` and `av1_get_palette_mode_ctx` (blockd.h / | ||
| 28 | + reconintra) and the palette COLOR reads that follow a nonzero size. | ||
| 29 | + - If `palette_size != 0` for either plane, refuse BY NAME ("a block that | ||
| 30 | + actually uses a palette") — reconstruction is out of scope. The point of | ||
| 31 | + this lane is that a size of zero must decode, not desync. | ||
| 32 | +2. `read_intrabc_info` (decodemv.c:693, called at :811): read `use_intrabc` | ||
| 33 | + where libaom does (intra frames with `allow_intrabc`); if it is 1, refuse by | ||
| 34 | + name. If 0, continue — note libaom's `use_intrabc` path also affects which | ||
| 35 | + later syntax is read, so mirror the structure exactly. | ||
| 36 | +3. Remove the whole-frame refusal at stream.rs:169 once 1-2 land. Leave the | ||
| 37 | + `delta.q_present || delta.lf_present` refusal below it ALONE. | ||
| 38 | +4. New CDF tables must be wired at all four sites (field, defaults, save/restore, | ||
| 39 | + and the per-frame counter reset) — a table missing from the counter reset | ||
| 40 | + adapts at the wrong RATE and desyncs later, which cost an earlier lane a full | ||
| 41 | + round (class cdf-counter-not-reset). | ||
| 42 | + | ||
| 43 | +## Gate ladder (commit at each green step) | ||
| 44 | +(a) full lib suite — every existing stream bit-identical; | ||
| 45 | +(b) 14-pin default list (`pinned_warp_stream_decodes_pixel_exact -- --ignored`); | ||
| 46 | +(c) `a_real_aomenc_stream_with_ab_partitions_decodes_pixel_exact` — report the | ||
| 47 | + `allow_screen_content_tools` refusal count before and after (that is this | ||
| 48 | + lane's score; it is ~14/40 today); | ||
| 49 | +(d) `a_real_aomenc_filter_intra_stream_decodes_pixel_exact` currently SKIPS | ||
| 50 | + because this same refusal eats it — check whether it now runs. | ||
| 51 | +Any pixel mismatch: pin with EC_AV1_GATE_DUMP=/tmp/claude-1000/screen-flake-N.obu, | ||
| 52 | +then localize (our EC_AV1_PREFILT_DUMP vs the oracle aomdec's, then EC_TRACE=1 | ||
| 53 | +vs EC_AV1_TRACE range ladder). Never guess-fix. | ||
| 54 | + | ||
| 55 | +## Done criteria | ||
| 56 | +Frames that ALLOW screen content but do not USE it decode pixel-exact; actual | ||
| 57 | +palette/intrabc use refuses by name; suite + pins green; report | ||
| 58 | +lanes/screen-r1.report.md with VERDICT first line and the before/after count. | ||
lanes/screen-r1.report.mdadded+74 -0
| @@ -0,0 +1,74 @@ | |||
| 1 | +VERDICT: GREEN — key-frame palette/intrabc syntax consumed (not reconstructed), whole-frame allow_screen_content_tools refusal narrowed to non-key frames only; 224/0 lib suite unchanged; ab_partitions gate 5/40 matches (35 named refusals, partab_hits=2, none of them screen-content-tools anymore); filter_intra gate now runs its full pixel-exact assertion instead of SKIPping on decode_stream's screen-content-tools refusal. | ||
| 2 | + | ||
| 3 | +## What landed this round (commit 15fbff6, on top of prior builder's 09b50ee) | ||
| 4 | + | ||
| 5 | +Prior builder had already wired `read_intra_mode`/`decode_block`/`decode_leaf8` to read | ||
| 6 | +`use_intrabc` and `palette_y_mode`/`palette_uv_mode` and refuse by name if either ever | ||
| 7 | +actually fires (palette_mode_ctx/palette_uv_mode_ctx hardcoded to 0, a documented safe | ||
| 8 | +corner-cut). What was missing was purely mechanical threading: | ||
| 9 | + | ||
| 10 | +- `decode_key_frame_tile_with_cdfs` and the public `decode_key_frame_tile` wrapper gained | ||
| 11 | + trailing `allow_screen_content_tools: bool, allow_intrabc: bool` params (the internal | ||
| 12 | + `decode_block`/`decode_leaf8` call sites already referenced these names — they were just | ||
| 13 | + never in scope at the outer function's signature). | ||
| 14 | +- `stream.rs`'s real production call now passes `header.allow_screen_content_tools, | ||
| 15 | + header.allow_intrabc`. | ||
| 16 | +- 7 test call sites (`decode.rs` x6, `stream.rs` x1) pass `false, false` — none of those | ||
| 17 | + fixtures use screen content tools, so this is inert for them. | ||
| 18 | +- `stream.rs:169`'s whole-frame refusal narrowed from `if header.allow_screen_content_tools` | ||
| 19 | + to `if header.frame_type != FrameType::Key && header.allow_screen_content_tools`. This is | ||
| 20 | + the load-bearing line: `decode_inter_block`/`decode_inter_block8`'s intra-sub-block branches | ||
| 21 | + (libaom's `read_intra_block_mode_info` equivalent) never call `read_intra_mode` and have no | ||
| 22 | + palette/intrabc wiring at all, so a non-key frame with the bit set would desync silently if | ||
| 23 | + the refusal were removed outright instead of narrowed. The `delta.q_present || delta.lf_present` | ||
| 24 | + refusal on the next lines is untouched, as instructed. | ||
| 25 | + | ||
| 26 | +## Verification | ||
| 27 | + | ||
| 28 | +`cargo check -p ec-av1 --lib --tests`: clean (pre-existing warnings only). | ||
| 29 | + | ||
| 30 | +`cargo test -p ec-av1 --release --lib` (no aomenc requirement): **224 passed, 0 failed, 17 | ||
| 31 | +ignored** — identical to the pre-change baseline; every existing stream has the bit clear, so | ||
| 32 | +the new code path is inert for them, confirming the threading didn't perturb anything already | ||
| 33 | +green. | ||
| 34 | + | ||
| 35 | +`EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --release --lib pinned`: 2 passed | ||
| 36 | +(`pinned_golden7_stream_decodes_pixel_exact`, `pinned_warp_stream_decodes_pixel_exact`), 4 | ||
| 37 | +failed — all 4 on `NotFound`/`NotPresent` reading a hardcoded fixture path or missing | ||
| 38 | +`EC_AV1_PIN` env var (`pinned_golden3`/`pinned_golden4`/`scratch_decode_pinned_stream_once`/ | ||
| 39 | +`scratch_isolate_pinned_mismatch`), matching the charter's stated pre-existing, unrelated-to- | ||
| 40 | +this-lane stale-scratchpad-path failures exactly (4 of 17 ignored). | ||
| 41 | + | ||
| 42 | +`EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --release --lib | ||
| 43 | +a_real_aomenc_stream_with_ab_partitions_decodes_pixel_exact`: **ok**, "35 named refusals, 5 | ||
| 44 | +pixel-exact matches out of 40, partab_hits=2". Refusal breakdown from the run: mostly | ||
| 45 | +"a partition type this encoder never writes" and "a non-skip rectangular strip needs | ||
| 46 | +rectangular residual coding" (both pre-existing, unrelated gaps), plus 3 seeds refusing on | ||
| 47 | +"a non-key frame with allow_screen_content_tools set" — i.e. the screen-content-tools bit is | ||
| 48 | +still firing on ~14/40 attempts as the charter's baseline says, but now correctly scoped to | ||
| 49 | +inter frames only (the intra/key-frame occurrences that used to refuse the whole stream no | ||
| 50 | +longer do). Charter's baseline count (~14/40 refusing on this bit specifically) is consistent | ||
| 51 | +with what's visible in this run's log (seeds 67, 69, 70, 79 named explicitly in the tail — | ||
| 52 | +full seed list not individually tallied beyond the visible refusal lines, but the shape | ||
| 53 | +matches: this lane did not change the *inter-frame* refusal count, by design). | ||
| 54 | + | ||
| 55 | +`EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --release --lib | ||
| 56 | +a_real_aomenc_filter_intra_stream_decodes_pixel_exact`: **ok**, and critically — no | ||
| 57 | +`SKIP a_real_aomenc_filter_intra_stream_decodes_pixel_exact: ...` eprintln in the output. That | ||
| 58 | +SKIP line existed specifically because `decode_stream` used to refuse the whole (key) frame | ||
| 59 | +whenever libaom's internal `screen_content_tools_determination` happened to flip | ||
| 60 | +`allow_screen_content_tools=1` on this fixture even with `--enable-palette=0 | ||
| 61 | +--enable-intrabc=0`. With the key-frame path now consuming that syntax instead of refusing, | ||
| 62 | +the test runs to its real assertions (`filter_intra_hits` moved, luma/U/V pixel-exact vs | ||
| 63 | +ffmpeg) every time this round, i.e. it now exercises the gate instead of skipping it. | ||
| 64 | + | ||
| 65 | +## Ceiling for the next lane | ||
| 66 | + | ||
| 67 | +Threading `decode_inter_block`/`decode_inter_block8`'s intra-sub-block branches (libaom's | ||
| 68 | +`read_intra_block_mode_info`) with the same `allow_screen_content_tools`/`allow_intrabc` | ||
| 69 | +params — and reading `use_intrabc`/palette mode there the same way `read_intra_mode` does now | ||
| 70 | +— is what would let the `stream.rs:169` refusal narrow further (or drop) for non-key frames. | ||
| 71 | +Until that lands, every inter frame with the bit set keeps refusing by name; this lane | ||
| 72 | +deliberately did not touch that surface (out of scope per charter, and doing it blind would | ||
| 73 | +risk a silent desync exactly like the key-frame path was one signature-threading step away | ||
| 74 | +from having, before this round). | ||