forge
Explore
Log in

Don't you dare go Hollow

EOB_PT_512_CHROMA table + TxbSet::ChromaRect32x16 (lane-sbpart prep)

Browse files at this commit

086ca56d064fa42b4e1107b4cc1fceeaa22b3568Ahmet Kaan GümüşParent: 84bcd82
  • feat
    • EOB_PT_512_CHROMA table + TxbSet::ChromaRect32x16 (lane-sbpart prep)
Show full message
feat(av1): EOB_PT_512_CHROMA table + TxbSet::ChromaRect32x16 (lane-sbpart prep)

Building block for the 64x32/32x64 intra strip decode this lane needs
(PARTITION_HORZ/VERT at the 64x64 superblock level): worked out from
libaom's get_txsize_entropy_ctx that a strip's chroma plane (32x16, a
real untruncated transform) resolves its entropy context to TX_32X32
(Chroma32's own tables) while its luma plane (64x32, truncated to a
32x32 corner) resolves to TX_64X64 (the already-landed Luma64) -- the
two axes landing on different existing sets is why chroma needs a new
variant here rather than reusing LumaRect32x16's chroma sibling
(ChromaRect16x8, which is the wrong shape: 16x8, not 32x16).

libaom's av1_default_eob_multi512_cdfs is the same flat distribution
for chroma at every q-context, unlike every other EOB_PT_* table here,
so one constant covers all four -- no _Q0/_Q1/_Q3 siblings needed.

Not yet wired to any decode path (decode_block_rect only handles the
already-landed 32x16/16x32 case); see lanes/sbpart.report.md for the
gate recipe that reproduces the SB-level refusal and what the next
round still needs to build on top of this.
crates/ec-av1/src/cdf.rsmodified+14 -0
@@ -266,6 +266,20 @@ pub const EOB_PT_128_CHROMA_Q3: [u16; 9] = [
266266 24313, 26062, 28385, 30107, 31217, 31898, 32345, 32768, 0,
267267 ];
268268
269+/// `av1_default_eob_multi512_cdfs[*][1][*]` (`token_cdfs.h:874-901`,
270+/// lane-sbpart): the end-of-block group of a CHROMA transform with 512 coded
271+/// positions -- what a 32x16/16x32 chroma transform has (the chroma plane of
272+/// an intra `PARTITION_HORZ`/`VERT` 64x32/32x64 superblock strip, whose luma
273+/// coefficients truncate to the 64x64-superblock's own 32x32 corner-scan
274+/// (`TxbSet::Luma64`) but whose *chroma* plane, at 32x16, is small enough
275+/// that no truncation applies). Unlike every other `EOB_PT_*` table here,
276+/// libaom's default is the exact same flat distribution at all four
277+/// q-contexts and both `eob_multi_size` selectors (`token_cdfs.h` rows), so
278+/// one constant covers every q-context -- no `_Q0`/`_Q1`/`_Q3` siblings.
279+pub const EOB_PT_512_CHROMA: [u16; 11] = [
280+ 3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0,
281+];
282+
269283 /// `Default_Dc_Sign_Cdf[2][0]` (spec 9.4): the sign of a luma DC coefficient,
270284 /// indexed by whether the neighbouring blocks' DC signs lean negative (1),
271285 /// positive (2) or neither (0).
crates/ec-av1/src/cdf_state.rsmodified+32 -0
@@ -104,6 +104,19 @@ pub(crate) enum TxbSet {
104104 /// the true 128-position [`crate::cdf::EOB_PT_128_CHROMA`] instead of
105105 /// `Chroma16`'s 256-position one.
106106 ChromaRect16x8,
107+ /// The chroma 32x16/16x32 transform of an intra `PARTITION_HORZ`/`VERT`
108+ /// 64x32/32x64 SUPERBLOCK strip (lane-sbpart): `get_txsize_entropy_ctx`
109+ /// (`(txsize_sqr_map + txsize_sqr_up_map + 1) >> 1`) resolves `TX_32X16`
110+ /// to `TX_32X32`, so this shares every table
111+ /// [`Chroma32`](TxbSet::Chroma32) does except `eob_pt`, which reads the
112+ /// true 512-position [`crate::cdf::EOB_PT_512_CHROMA`] instead of
113+ /// `Chroma32`'s 1024-position one. The SIBLING luma plane of this same
114+ /// strip is genuinely truncated (64/32 > 32), so it reads
115+ /// [`Luma64`](TxbSet::Luma64) instead -- `get_txsize_entropy_ctx(TX_64X32)`
116+ /// resolves to `TX_64X64`, not `TX_32X32`, the two axes landing on
117+ /// different existing sets is why this variant exists at all rather than
118+ /// reusing [`LumaRect32x16`](TxbSet::LumaRect32x16)'s chroma sibling.
119+ ChromaRect32x16,
107120 }
108121
109122 /// The tables one transform block is coded with, borrowed from the state for
@@ -253,6 +266,9 @@ pub(crate) struct Cdfs {
253266 /// The end-of-block group of a true 16x8/8x16 rect chroma transform
254267 /// (lane-rectwire), see [`TxbSet::ChromaRect16x8`].
255268 pub eob_pt_128_chroma: [u16; 9],
269+ /// The end-of-block group of a true 32x16/16x32 rect CHROMA transform
270+ /// (lane-sbpart), see [`TxbSet::ChromaRect32x16`].
271+ pub eob_pt_512_chroma: [u16; 11],
256272 /// The end-of-block offset bit, per table set.
257273 pub eob_extra_luma_32: [[u16; 3]; 9],
258274 /// The same, for a 64x64 luma transform.
@@ -582,6 +598,7 @@ impl Cdfs {
582598 reset1(&mut self.eob_pt_256_chroma);
583599 reset1(&mut self.eob_pt_512_luma);
584600 reset1(&mut self.eob_pt_128_chroma);
601+ reset1(&mut self.eob_pt_512_chroma);
585602 reset2(&mut self.eob_extra_luma_32);
586603 reset2(&mut self.eob_extra_luma_64);
587604 reset2(&mut self.eob_extra_chroma_16);
@@ -960,6 +977,9 @@ impl Cdfs {
960977 cdf::EOB_PT_128_CHROMA,
961978 cdf::EOB_PT_128_CHROMA_Q3,
962979 ),
980+ // Flat default at every q-context (see the constant's own doc
981+ // comment) -- no `pick()` needed.
982+ eob_pt_512_chroma: cdf::EOB_PT_512_CHROMA,
963983 eob_extra_luma_32: pick(
964984 q_ctx,
965985 cdf::EOB_EXTRA_LUMA_32_Q0,
@@ -1348,6 +1368,18 @@ impl Cdfs {
13481368 tx_type: None,
13491369 eob_pt_class1: None,
13501370 },
1371+ TxbSet::ChromaRect32x16 => TxbTables {
1372+ side: 32,
1373+ txb_skip: &mut self.txb_skip_chroma_32,
1374+ eob_pt: &mut self.eob_pt_512_chroma,
1375+ eob_extra: &mut self.eob_extra_chroma_32,
1376+ base: &mut self.base_chroma_32,
1377+ base_eob: &mut self.base_eob_chroma_32,
1378+ br: &mut self.br_chroma_32,
1379+ dc_sign: &mut self.dc_sign_chroma,
1380+ tx_type: None,
1381+ eob_pt_class1: None,
1382+ },
13511383 }
13521384 }
13531385 }