forge
Explore
Log in

Don't you dare go Hollow

Eob_pt class-1 CDF row existed only for two luma sizes -- every chroma (and 16x16+) 1D-class transform read the 2D table

Browse files at this commit

d1963fa545dc53cd31ad5ac971efd278690971cbAhmet Kaan GümüşParent: 154097b
  • fix
    • eob_pt class-1 CDF row existed only for two luma sizes -- every chroma (and 16x16+) 1D-class transform read the 2D table
Show full message
fix(av1): eob_pt class-1 CDF row existed only for two luma sizes -- every chroma (and 16x16+) 1D-class transform read the 2D table

lane-gmaffine r4. libaom's av1_default_eob_multi*_cdfs are
[q][PLANE_TYPES][2], the second index being eob_multi_ctx = (tx_class ==
TX_CLASS_2D) ? 0 : 1. This crate carried that class-1 row for
eob_pt_16_luma and eob_pt_64_luma only; 14 of the 16 TxbSet arms passed
eob_pt_class1: None and silently read the 2D row.

It bites on every INTER block's chroma, because chroma never codes a
tx_type symbol -- it inherits the colocated luma type verbatim
(av1_get_tx_type, blockd.h:1291). The two 8x8-leaf motion gates code
H_ADST luma, so their 4x4 chroma is class 1: right eob value, wrong
interval, desync one symbol later, surfacing as bogus partition refusals
('an inter partition below 16x16 other than SPLIT', 'a partition below
8x8').

Measured: EC_TRACE_COEFF ladder vs instrumented aomdec on the globalmv
gate's own 8-bit cq32 stream -- first divergent element is the chroma
4x4 eob of leaf mi=(6,4), both entering at rng=37748 and decoding
eob=16, ours leaving at 35080 vs aomdec's 54536. All four gate streams
now decode all 24 frames.

Also: warp is per PLANE and libaom's av1_init_warp_params bails out at
block_width/height < 8, so an 8x8 leaf's 4x4 chroma is predicted
translationally even when its luma warps -- guarded at both warp sites.

Both 8x8 motion gates remain RED on PIXELS now, not refusals: luma
byte-exact on all 24 frames, U/V off by +-1..3 in the three 4x4 chroma
blocks whose luma tx_type is the 1D-class H_ADST (leaves mi (6,4),
(8,4), (10,4), none of them warped or global). Suite 271 passed, 2
failed, 24 ignored.
crates/ec-av1/examples/decode_probe.rsmodified+15 -1
@@ -32,7 +32,21 @@ fn main() {
3232 Ok(frames) if frames.is_empty() => {
3333 println!("OK but EMPTY: no frames -- is {path} an IVF rather than a raw OBU stream?");
3434 }
35- Ok(frames) => println!("OK: {} frames decoded", frames.len()),
35+ Ok(frames) => {
36+ // lane-gmaffine r4: `EC_PROBE_DUMP=<path>` writes the decoded
37+ // planes as raw 8-bit I420 so a pixel diff against ffmpeg can
38+ // name the mismatching block without a test harness.
39+ if let Ok(dump) = std::env::var("EC_PROBE_DUMP") {
40+ let mut out = Vec::new();
41+ for f in &frames {
42+ for p in [&f.y, &f.u, &f.v] {
43+ out.extend(p.iter().map(|&v| v as u8));
44+ }
45+ }
46+ std::fs::write(&dump, out).expect("writing EC_PROBE_DUMP");
47+ }
48+ println!("OK: {} frames decoded", frames.len())
49+ }
3650 Err(e) => println!("REFUSED: {e}"),
3751 }
3852 }
crates/ec-av1/src/cdf.rsmodified+61 -0
@@ -4996,3 +4996,64 @@ pub const INTRA_TX_TYPE_SET1_4: [[u16; 8]; 13] = [
49964996 [277, 4369, 5255, 8905, 16465, 22271, 32768, 0],
49974997 [3409, 5436, 10599, 15599, 19687, 24040, 32768, 0],
49984998 ];
4999+
5000+// lane-gmaffine r4: the `TX_CLASS_HORIZ`/`TX_CLASS_VERT` (`eob_multi_ctx == 1`)
5001+// half of libaom's `av1_default_eob_multi*_cdfs[q][plane][2]` for every eob_pt
5002+// table that carried only its 2D row -- an inter block's chroma inherits the
5003+// colocated luma `tx_type` verbatim, so a 1D-class chroma TU is routine and
5004+// used to read the 2D CDF (right value, wrong interval).
5005+
5006+/// `EOB_PT_16_CHROMA`'s class-1 sibling (`av1_default_eob_multi16_cdfs[q][1][1]`).
5007+pub const EOB_PT_16_CHROMA_CLASS1_Q0: [u16; 6] = [1904, 3354, 7763, 14647, 32768, 0];
5008+pub const EOB_PT_16_CHROMA_CLASS1_Q1: [u16; 6] = [2497, 4096, 8866, 16993, 32768, 0];
5009+pub const EOB_PT_16_CHROMA_CLASS1: [u16; 6] = [3192, 5032, 10297, 19755, 32768, 0];
5010+pub const EOB_PT_16_CHROMA_CLASS1_Q3: [u16; 6] = [7297, 10767, 19273, 28194, 32768, 0];
5011+
5012+/// `EOB_PT_64_CHROMA`'s class-1 sibling (`av1_default_eob_multi64_cdfs[q][1][1]`).
5013+pub const EOB_PT_64_CHROMA_CLASS1_Q0: [u16; 8] = [1563, 2700, 4876, 10911, 14706, 22480, 32768, 0];
5014+pub const EOB_PT_64_CHROMA_CLASS1_Q1: [u16; 8] = [1923, 3127, 5867, 9703, 14277, 27100, 32768, 0];
5015+pub const EOB_PT_64_CHROMA_CLASS1: [u16; 8] = [4034, 6290, 10235, 14982, 21214, 28491, 32768, 0];
5016+pub const EOB_PT_64_CHROMA_CLASS1_Q3: [u16; 8] = [8726, 12378, 19409, 26450, 30038, 32462, 32768, 0];
5017+
5018+/// `EOB_PT_128_CHROMA`'s class-1 sibling (`av1_default_eob_multi128_cdfs[q][1][1]`).
5019+pub const EOB_PT_128_CHROMA_CLASS1_Q0: [u16; 9] = [2054, 3472, 5869, 14232, 18242, 20590, 26752, 32768, 0];
5020+pub const EOB_PT_128_CHROMA_CLASS1_Q1: [u16; 9] = [2310, 4160, 7471, 14997, 17931, 20768, 30240, 32768, 0];
5021+pub const EOB_PT_128_CHROMA_CLASS1: [u16; 9] = [6275, 9889, 14769, 23164, 27988, 30493, 32272, 32768, 0];
5022+pub const EOB_PT_128_CHROMA_CLASS1_Q3: [u16; 9] = [9165, 13282, 21150, 30286, 31894, 32571, 32712, 32768, 0];
5023+
5024+/// `EOB_PT_256_LUMA`'s class-1 sibling (`av1_default_eob_multi256_cdfs[q][0][1]`).
5025+pub const EOB_PT_256_LUMA_CLASS1_Q0: [u16; 10] = [998, 1850, 2998, 5604, 17341, 19888, 22899, 25583, 32768, 0];
5026+pub const EOB_PT_256_LUMA_CLASS1_Q1: [u16; 10] = [399, 1019, 1749, 3038, 10444, 15546, 22739, 27294, 32768, 0];
5027+pub const EOB_PT_256_LUMA_CLASS1: [u16; 10] = [1084, 2358, 3488, 5122, 11483, 18103, 26023, 29799, 32768, 0];
5028+pub const EOB_PT_256_LUMA_CLASS1_Q3: [u16; 10] = [2453, 4474, 6307, 8777, 16474, 22975, 29000, 31547, 32768, 0];
5029+
5030+/// `EOB_PT_256_CHROMA`'s class-1 sibling (`av1_default_eob_multi256_cdfs[q][1][1]`).
5031+pub const EOB_PT_256_CHROMA_CLASS1_Q0: [u16; 10] = [2203, 4130, 7435, 10739, 20652, 23681, 25609, 27261, 32768, 0];
5032+pub const EOB_PT_256_CHROMA_CLASS1_Q1: [u16; 10] = [1674, 3252, 5734, 10159, 22397, 23802, 24821, 30940, 32768, 0];
5033+pub const EOB_PT_256_CHROMA_CLASS1: [u16; 10] = [6571, 9610, 15516, 21826, 29092, 30829, 31842, 32708, 32768, 0];
5034+pub const EOB_PT_256_CHROMA_CLASS1_Q3: [u16; 10] = [9998, 17661, 25178, 28097, 31308, 32038, 32403, 32695, 32768, 0];
5035+
5036+/// `EOB_PT_512_LUMA`'s class-1 sibling (`av1_default_eob_multi512_cdfs[q][0][1]`).
5037+pub const EOB_PT_512_LUMA_CLASS1_Q0: [u16; 11] = [3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0];
5038+pub const EOB_PT_512_LUMA_CLASS1_Q1: [u16; 11] = [3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0];
5039+pub const EOB_PT_512_LUMA_CLASS1: [u16; 11] = [3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0];
5040+pub const EOB_PT_512_LUMA_CLASS1_Q3: [u16; 11] = [3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0];
5041+
5042+/// `EOB_PT_512_CHROMA`'s class-1 sibling (`av1_default_eob_multi512_cdfs[q][1][1]`).
5043+pub const EOB_PT_512_CHROMA_CLASS1_Q0: [u16; 11] = [3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0];
5044+pub const EOB_PT_512_CHROMA_CLASS1_Q1: [u16; 11] = [3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0];
5045+pub const EOB_PT_512_CHROMA_CLASS1: [u16; 11] = [3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0];
5046+pub const EOB_PT_512_CHROMA_CLASS1_Q3: [u16; 11] = [3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0];
5047+
5048+/// `EOB_PT_1024_LUMA`'s class-1 sibling (`av1_default_eob_multi1024_cdfs[q][0][1]`).
5049+pub const EOB_PT_1024_LUMA_CLASS1_Q0: [u16; 12] = [2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0];
5050+pub const EOB_PT_1024_LUMA_CLASS1_Q1: [u16; 12] = [2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0];
5051+pub const EOB_PT_1024_LUMA_CLASS1: [u16; 12] = [2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0];
5052+pub const EOB_PT_1024_LUMA_CLASS1_Q3: [u16; 12] = [2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0];
5053+
5054+/// `EOB_PT_1024_CHROMA`'s class-1 sibling (`av1_default_eob_multi1024_cdfs[q][1][1]`).
5055+pub const EOB_PT_1024_CHROMA_CLASS1_Q0: [u16; 12] = [2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0];
5056+pub const EOB_PT_1024_CHROMA_CLASS1_Q1: [u16; 12] = [2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0];
5057+pub const EOB_PT_1024_CHROMA_CLASS1: [u16; 12] = [2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0];
5058+pub const EOB_PT_1024_CHROMA_CLASS1_Q3: [u16; 12] = [2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0];
5059+
crates/ec-av1/src/cdf_state.rsmodified+104 -14
@@ -200,6 +200,24 @@ pub(crate) struct Cdfs {
200200 pub eob_pt_16_luma_class1: [u16; 6],
201201 /// `eob_pt_64_luma`'s class-1 sibling (r5), see `eob_pt_16_luma_class1`.
202202 pub eob_pt_64_luma_class1: [u16; 8],
203+ /// `eob_pt_16_chroma`'s class-1 (`TX_CLASS_HORIZ`/`VERT`) sibling, see `eob_pt_16_luma_class1`.
204+ pub eob_pt_16_chroma_class1: [u16; 6],
205+ /// `eob_pt_64_chroma`'s class-1 (`TX_CLASS_HORIZ`/`VERT`) sibling, see `eob_pt_16_luma_class1`.
206+ pub eob_pt_64_chroma_class1: [u16; 8],
207+ /// `eob_pt_128_chroma`'s class-1 (`TX_CLASS_HORIZ`/`VERT`) sibling, see `eob_pt_16_luma_class1`.
208+ pub eob_pt_128_chroma_class1: [u16; 9],
209+ /// `eob_pt_256_luma`'s class-1 (`TX_CLASS_HORIZ`/`VERT`) sibling, see `eob_pt_16_luma_class1`.
210+ pub eob_pt_256_luma_class1: [u16; 10],
211+ /// `eob_pt_256_chroma`'s class-1 (`TX_CLASS_HORIZ`/`VERT`) sibling, see `eob_pt_16_luma_class1`.
212+ pub eob_pt_256_chroma_class1: [u16; 10],
213+ /// `eob_pt_512_luma`'s class-1 (`TX_CLASS_HORIZ`/`VERT`) sibling, see `eob_pt_16_luma_class1`.
214+ pub eob_pt_512_luma_class1: [u16; 11],
215+ /// `eob_pt_512_chroma`'s class-1 (`TX_CLASS_HORIZ`/`VERT`) sibling, see `eob_pt_16_luma_class1`.
216+ pub eob_pt_512_chroma_class1: [u16; 11],
217+ /// `eob_pt_1024_luma`'s class-1 (`TX_CLASS_HORIZ`/`VERT`) sibling, see `eob_pt_16_luma_class1`.
218+ pub eob_pt_1024_luma_class1: [u16; 12],
219+ /// `eob_pt_1024_chroma`'s class-1 (`TX_CLASS_HORIZ`/`VERT`) sibling, see `eob_pt_16_luma_class1`.
220+ pub eob_pt_1024_chroma_class1: [u16; 12],
203221 /// The end-of-block offset bit of a 16x16 luma transform.
204222 pub eob_extra_luma_16: [[u16; 3]; 9],
205223 /// The same, for an 8x8 luma transform.
@@ -592,6 +610,15 @@ impl Cdfs {
592610 reset1(&mut self.eob_pt_16_luma);
593611 reset1(&mut self.eob_pt_16_luma_class1);
594612 reset1(&mut self.eob_pt_64_luma_class1);
613+ reset1(&mut self.eob_pt_16_chroma_class1);
614+ reset1(&mut self.eob_pt_64_chroma_class1);
615+ reset1(&mut self.eob_pt_128_chroma_class1);
616+ reset1(&mut self.eob_pt_256_luma_class1);
617+ reset1(&mut self.eob_pt_256_chroma_class1);
618+ reset1(&mut self.eob_pt_512_luma_class1);
619+ reset1(&mut self.eob_pt_512_chroma_class1);
620+ reset1(&mut self.eob_pt_1024_luma_class1);
621+ reset1(&mut self.eob_pt_1024_chroma_class1);
595622 reset2(&mut self.eob_extra_luma_16);
596623 reset2(&mut self.eob_extra_luma_8);
597624 reset2(&mut self.eob_extra_luma_4);
@@ -805,6 +832,69 @@ impl Cdfs {
805832 cdf::EOB_PT_64_LUMA_CLASS1,
806833 cdf::EOB_PT_64_LUMA_CLASS1_Q3,
807834 ),
835+ eob_pt_16_chroma_class1: pick(
836+ q_ctx,
837+ cdf::EOB_PT_16_CHROMA_CLASS1_Q0,
838+ cdf::EOB_PT_16_CHROMA_CLASS1_Q1,
839+ cdf::EOB_PT_16_CHROMA_CLASS1,
840+ cdf::EOB_PT_16_CHROMA_CLASS1_Q3,
841+ ),
842+ eob_pt_64_chroma_class1: pick(
843+ q_ctx,
844+ cdf::EOB_PT_64_CHROMA_CLASS1_Q0,
845+ cdf::EOB_PT_64_CHROMA_CLASS1_Q1,
846+ cdf::EOB_PT_64_CHROMA_CLASS1,
847+ cdf::EOB_PT_64_CHROMA_CLASS1_Q3,
848+ ),
849+ eob_pt_128_chroma_class1: pick(
850+ q_ctx,
851+ cdf::EOB_PT_128_CHROMA_CLASS1_Q0,
852+ cdf::EOB_PT_128_CHROMA_CLASS1_Q1,
853+ cdf::EOB_PT_128_CHROMA_CLASS1,
854+ cdf::EOB_PT_128_CHROMA_CLASS1_Q3,
855+ ),
856+ eob_pt_256_luma_class1: pick(
857+ q_ctx,
858+ cdf::EOB_PT_256_LUMA_CLASS1_Q0,
859+ cdf::EOB_PT_256_LUMA_CLASS1_Q1,
860+ cdf::EOB_PT_256_LUMA_CLASS1,
861+ cdf::EOB_PT_256_LUMA_CLASS1_Q3,
862+ ),
863+ eob_pt_256_chroma_class1: pick(
864+ q_ctx,
865+ cdf::EOB_PT_256_CHROMA_CLASS1_Q0,
866+ cdf::EOB_PT_256_CHROMA_CLASS1_Q1,
867+ cdf::EOB_PT_256_CHROMA_CLASS1,
868+ cdf::EOB_PT_256_CHROMA_CLASS1_Q3,
869+ ),
870+ eob_pt_512_luma_class1: pick(
871+ q_ctx,
872+ cdf::EOB_PT_512_LUMA_CLASS1_Q0,
873+ cdf::EOB_PT_512_LUMA_CLASS1_Q1,
874+ cdf::EOB_PT_512_LUMA_CLASS1,
875+ cdf::EOB_PT_512_LUMA_CLASS1_Q3,
876+ ),
877+ eob_pt_512_chroma_class1: pick(
878+ q_ctx,
879+ cdf::EOB_PT_512_CHROMA_CLASS1_Q0,
880+ cdf::EOB_PT_512_CHROMA_CLASS1_Q1,
881+ cdf::EOB_PT_512_CHROMA_CLASS1,
882+ cdf::EOB_PT_512_CHROMA_CLASS1_Q3,
883+ ),
884+ eob_pt_1024_luma_class1: pick(
885+ q_ctx,
886+ cdf::EOB_PT_1024_LUMA_CLASS1_Q0,
887+ cdf::EOB_PT_1024_LUMA_CLASS1_Q1,
888+ cdf::EOB_PT_1024_LUMA_CLASS1,
889+ cdf::EOB_PT_1024_LUMA_CLASS1_Q3,
890+ ),
891+ eob_pt_1024_chroma_class1: pick(
892+ q_ctx,
893+ cdf::EOB_PT_1024_CHROMA_CLASS1_Q0,
894+ cdf::EOB_PT_1024_CHROMA_CLASS1_Q1,
895+ cdf::EOB_PT_1024_CHROMA_CLASS1,
896+ cdf::EOB_PT_1024_CHROMA_CLASS1_Q3,
897+ ),
808898 eob_extra_luma_16: pick(
809899 q_ctx,
810900 cdf::EOB_EXTRA_LUMA_16_Q0,
@@ -1191,7 +1281,7 @@ impl Cdfs {
11911281 br: &mut self.br_luma_32,
11921282 dc_sign: &mut self.dc_sign_luma,
11931283 tx_type: None,
1194- eob_pt_class1: None,
1284+ eob_pt_class1: Some(&mut self.eob_pt_1024_luma_class1),
11951285 },
11961286 // lane-comppin r4 (REVERTED, see r4's own commit message):
11971287 // `Some(inter_tx_type_32)` looked wrong against aomdec's 32x32
@@ -1215,7 +1305,7 @@ impl Cdfs {
12151305 br: &mut self.br_luma_32,
12161306 dc_sign: &mut self.dc_sign_luma,
12171307 tx_type: Some(self.inter_tx_type_32.as_mut_slice()),
1218- eob_pt_class1: None,
1308+ eob_pt_class1: Some(&mut self.eob_pt_1024_luma_class1),
12191309 },
12201310 TxbSet::Luma64 => TxbTables {
12211311 side: 32,
@@ -1227,7 +1317,7 @@ impl Cdfs {
12271317 br: &mut self.br_luma_32,
12281318 dc_sign: &mut self.dc_sign_luma,
12291319 tx_type: None,
1230- eob_pt_class1: None,
1320+ eob_pt_class1: Some(&mut self.eob_pt_1024_luma_class1),
12311321 },
12321322 TxbSet::Luma16 => TxbTables {
12331323 side: 16,
@@ -1239,7 +1329,7 @@ impl Cdfs {
12391329 br: &mut self.br_luma_16,
12401330 dc_sign: &mut self.dc_sign_luma,
12411331 tx_type: Some(self.intra_tx_type_16[mode].as_mut_slice()),
1242- eob_pt_class1: None,
1332+ eob_pt_class1: Some(&mut self.eob_pt_256_luma_class1),
12431333 },
12441334 TxbSet::Luma16Inter => TxbTables {
12451335 side: 16,
@@ -1251,7 +1341,7 @@ impl Cdfs {
12511341 br: &mut self.br_luma_16,
12521342 dc_sign: &mut self.dc_sign_luma,
12531343 tx_type: Some(self.inter_tx_type_16.as_mut_slice()),
1254- eob_pt_class1: None,
1344+ eob_pt_class1: Some(&mut self.eob_pt_256_luma_class1),
12551345 },
12561346 TxbSet::Luma16InterSet1 => TxbTables {
12571347 side: 16,
@@ -1263,7 +1353,7 @@ impl Cdfs {
12631353 br: &mut self.br_luma_16,
12641354 dc_sign: &mut self.dc_sign_luma,
12651355 tx_type: Some(self.inter_tx_type_16_set2.as_mut_slice()),
1266- eob_pt_class1: None,
1356+ eob_pt_class1: Some(&mut self.eob_pt_256_luma_class1),
12671357 },
12681358 TxbSet::Luma8 => TxbTables {
12691359 side: 8,
@@ -1323,7 +1413,7 @@ impl Cdfs {
13231413 br: &mut self.br_luma_8,
13241414 dc_sign: &mut self.dc_sign_luma,
13251415 tx_type: Some(self.inter_tx_type_8.as_mut_slice()),
1326- eob_pt_class1: None,
1416+ eob_pt_class1: Some(&mut self.eob_pt_64_luma_class1),
13271417 },
13281418 TxbSet::Luma8InterSet1 => TxbTables {
13291419 side: 8,
@@ -1347,7 +1437,7 @@ impl Cdfs {
13471437 br: &mut self.br_chroma_8,
13481438 dc_sign: &mut self.dc_sign_chroma,
13491439 tx_type: None,
1350- eob_pt_class1: None,
1440+ eob_pt_class1: Some(&mut self.eob_pt_64_chroma_class1),
13511441 },
13521442 TxbSet::Chroma4 => TxbTables {
13531443 side: 4,
@@ -1359,7 +1449,7 @@ impl Cdfs {
13591449 br: &mut self.br_chroma_4,
13601450 dc_sign: &mut self.dc_sign_chroma,
13611451 tx_type: None,
1362- eob_pt_class1: None,
1452+ eob_pt_class1: Some(&mut self.eob_pt_16_chroma_class1),
13631453 },
13641454 TxbSet::Chroma16 => TxbTables {
13651455 side: 16,
@@ -1371,7 +1461,7 @@ impl Cdfs {
13711461 br: &mut self.br_chroma_16,
13721462 dc_sign: &mut self.dc_sign_chroma,
13731463 tx_type: None,
1374- eob_pt_class1: None,
1464+ eob_pt_class1: Some(&mut self.eob_pt_256_chroma_class1),
13751465 },
13761466 TxbSet::Chroma32 => TxbTables {
13771467 side: 32,
@@ -1383,7 +1473,7 @@ impl Cdfs {
13831473 br: &mut self.br_chroma_32,
13841474 dc_sign: &mut self.dc_sign_chroma,
13851475 tx_type: None,
1386- eob_pt_class1: None,
1476+ eob_pt_class1: Some(&mut self.eob_pt_1024_chroma_class1),
13871477 },
13881478 TxbSet::LumaRect32x16 => TxbTables {
13891479 side: 32,
@@ -1395,7 +1485,7 @@ impl Cdfs {
13951485 br: &mut self.br_luma_32,
13961486 dc_sign: &mut self.dc_sign_luma,
13971487 tx_type: None,
1398- eob_pt_class1: None,
1488+ eob_pt_class1: Some(&mut self.eob_pt_512_luma_class1),
13991489 },
14001490 TxbSet::ChromaRect16x8 => TxbTables {
14011491 side: 16,
@@ -1407,7 +1497,7 @@ impl Cdfs {
14071497 br: &mut self.br_chroma_16,
14081498 dc_sign: &mut self.dc_sign_chroma,
14091499 tx_type: None,
1410- eob_pt_class1: None,
1500+ eob_pt_class1: Some(&mut self.eob_pt_128_chroma_class1),
14111501 },
14121502 TxbSet::ChromaRect32x16 => TxbTables {
14131503 side: 32,
@@ -1419,7 +1509,7 @@ impl Cdfs {
14191509 br: &mut self.br_chroma_32,
14201510 dc_sign: &mut self.dc_sign_chroma,
14211511 tx_type: None,
1422- eob_pt_class1: None,
1512+ eob_pt_class1: Some(&mut self.eob_pt_512_chroma_class1),
14231513 },
14241514 }
14251515 }
crates/ec-av1/src/decode.rsmodified+45 -21
@@ -1562,7 +1562,8 @@ fn read_coeffs(
15621562 let ec_trace_coeff = std::env::var_os("EC_TRACE_COEFF").is_some();
15631563 if ec_trace_coeff {
15641564 let (rng, _) = dec.debug_state();
1565- eprintln!("EC_COEFF_STEP tag=eob eob={eob} rng={rng}");
1565+ let cls = match class { TxClass::TwoD => "2d", TxClass::Horiz => "horiz", TxClass::Vert => "vert" };
1566+ eprintln!("EC_COEFF_STEP tag=eob eob={eob} tx={tx_type:?} class={cls} rng={rng}");
15661567 }
15671568 let class_scan;
15681569 let scan: &[u16] = if class == TxClass::TwoD {
@@ -10393,16 +10394,25 @@ fn decode_inter_block(
1039310394 py_ref.width as i32, &mut pred_y, px as i32, py as i32, side as i32,
1039410395 side as i32, side as i32, 0, 0,
1039510396 );
10396- crate::warp::warp_affine(
10397- params, &pu_ref.data, pu_ref.true_width as i32, pu_ref.true_height as i32,
10398- pu_ref.width as i32, &mut pred_u, cpx as i32, cpy as i32, chroma_side as i32,
10399- chroma_side as i32, chroma_side as i32, 1, 1,
10400- );
10401- crate::warp::warp_affine(
10402- params, &pv_ref.data, pv_ref.true_width as i32, pv_ref.true_height as i32,
10403- pv_ref.width as i32, &mut pred_v, cpx as i32, cpy as i32, chroma_side as i32,
10404- chroma_side as i32, chroma_side as i32, 1, 1,
10405- );
10397+ // libaom `av1_init_warp_params` (reconinter.c): warp is
10398+ // per PLANE and bails out at `block_width < 8 ||
10399+ // block_height < 8`, so a plane whose own block is under
10400+ // 8x8 keeps the translational prediction built above --
10401+ // in 420 that is every chroma plane of a luma block below
10402+ // 16x16 (lane-gmaffine r4: chroma-only mismatch of a few
10403+ // levels on both 8x8-leaf motion gates).
10404+ if chroma_side >= 8 {
10405+ crate::warp::warp_affine(
10406+ params, &pu_ref.data, pu_ref.true_width as i32, pu_ref.true_height as i32,
10407+ pu_ref.width as i32, &mut pred_u, cpx as i32, cpy as i32, chroma_side as i32,
10408+ chroma_side as i32, chroma_side as i32, 1, 1,
10409+ );
10410+ crate::warp::warp_affine(
10411+ params, &pv_ref.data, pv_ref.true_width as i32, pv_ref.true_height as i32,
10412+ pv_ref.width as i32, &mut pred_v, cpx as i32, cpy as i32, chroma_side as i32,
10413+ chroma_side as i32, chroma_side as i32, 1, 1,
10414+ );
10415+ }
1040610416 }
1040710417
1040810418 if obmc_selected {
@@ -11750,6 +11760,14 @@ fn decode_inter_block8(
1175011760 AFFINE_GM_HITS.with(|c| c.set(c.get() + 1));
1175111761 }
1175211762 }
11763+ if std::env::var_os("EC_TRACE_MODE").is_some() {
11764+ eprintln!(
11765+ "EC_WARP8 mi_row={} mi_col={} warp={} globalblk={is_global_mv_block}",
11766+ leaf_mi.0,
11767+ leaf_mi.1,
11768+ warp_params.is_some(),
11769+ );
11770+ }
1175311771 for dr in 0..2 {
1175411772 for dc in 0..2 {
1175511773 grid.set(
@@ -11826,16 +11844,22 @@ fn decode_inter_block8(
1182611844 sref_y.width as i32, &mut pred_y, px as i32, py as i32, SIDE as i32,
1182711845 SIDE as i32, SIDE as i32, 0, 0,
1182811846 );
11829- crate::warp::warp_affine(
11830- params, &sref_u.data, sref_u.true_width as i32, sref_u.true_height as i32,
11831- sref_u.width as i32, &mut pred_u, cpx as i32, cpy as i32, CHROMA_SIDE as i32,
11832- CHROMA_SIDE as i32, CHROMA_SIDE as i32, 1, 1,
11833- );
11834- crate::warp::warp_affine(
11835- params, &sref_v.data, sref_v.true_width as i32, sref_v.true_height as i32,
11836- sref_v.width as i32, &mut pred_v, cpx as i32, cpy as i32, CHROMA_SIDE as i32,
11837- CHROMA_SIDE as i32, CHROMA_SIDE as i32, 1, 1,
11838- );
11847+ // `av1_init_warp_params`'s per-plane `block_width/height < 8`
11848+ // bail-out: an 8x8 leaf's chroma plane is 4x4 in 420, so it is
11849+ // predicted translationally even when the luma warps.
11850+ #[allow(clippy::absurd_extreme_comparisons)]
11851+ if CHROMA_SIDE >= 8 {
11852+ crate::warp::warp_affine(
11853+ params, &sref_u.data, sref_u.true_width as i32, sref_u.true_height as i32,
11854+ sref_u.width as i32, &mut pred_u, cpx as i32, cpy as i32, CHROMA_SIDE as i32,
11855+ CHROMA_SIDE as i32, CHROMA_SIDE as i32, 1, 1,
11856+ );
11857+ crate::warp::warp_affine(
11858+ params, &sref_v.data, sref_v.true_width as i32, sref_v.true_height as i32,
11859+ sref_v.width as i32, &mut pred_v, cpx as i32, cpy as i32, CHROMA_SIDE as i32,
11860+ CHROMA_SIDE as i32, CHROMA_SIDE as i32, 1, 1,
11861+ );
11862+ }
1183911863 }
1184011864
1184111865 if obmc_selected {
lanes/gmaffine-r4.report.mdadded+66 -0
@@ -0,0 +1,66 @@
1+# lane-gmaffine r4 — the 8x8-leaf desync was a MISSING CDF ROW (chroma/most-size `eob_pt` class-1), not the mv stack
2+
3+Commits on `lane-gmaffine`, on top of r3 (`f8de9c3`). Suite:
4+`EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --release --lib -j3` →
5+**271 passed, 2 failed, 24 ignored** (r3: 269/2/24 equivalent — no regression; the 2
6+failures are the same two 8x8 motion gates, now failing on PIXELS, not on a refusal).
7+
8+## Root cause 1 (entropy, fixed): `eob_pt` class-1 CDF existed only for two LUMA sizes
9+libaom's `av1_default_eob_multi*_cdfs[q][PLANE_TYPES][2]` splits every eob_pt table by
10+`eob_multi_ctx = (tx_class == TX_CLASS_2D) ? 0 : 1`. This crate carried that second row
11+for `eob_pt_16_luma` and `eob_pt_64_luma` ONLY (lane-av1tx4 r5); every other table —
12+including all chroma — fell back to its 2D row (`cdf_state.rs`, 14 `TxbSet` arms had
13+`eob_pt_class1: None`).
14+Why it bit exactly here: an INTER block's chroma never codes a `tx_type` symbol, it
15+INHERITS the colocated luma type verbatim (`av1_get_tx_type`, blockd.h:1291). The gate's
16+8x8 leaves code `H_ADST` luma, so their 4x4 chroma is a 1D class — a routine case that
17+read the 2D CDF: right value, wrong interval, desync one symbol later.
18+Fix: class-1 siblings for all 9 remaining tables (16/64/128 chroma, 256/512/1024 both
19+planes) — `cdf.rs` (36 new consts, machine-extracted from `token_cdfs.h`),
20+`cdf_state.rs` (fields + `reset1` per-frame counter reset + q-context `pick` + all 14
21+`txb()` arms now `Some(..)`; 0 `eob_pt_class1: None` left).
22+
23+EVIDENCE: `/tmp/.../scratchpad/{ours_c.txt,aom_c.txt}` | `EC_TRACE_COEFF=1 EC_TRACE_MODE=1`
24+ours vs instrumented aomdec on `gm1_cq32.obu` (sha256 22d09738…, the globalmv gate's own
25+8-bit cq32 recipe) | first divergent element = the chroma (plane 1) 4x4 eob of leaf
26+mi=(6,4): both enter at rng=37748 and decode eob=16, ours leaves at rng=35080, aomdec at
27+54536. After the fix all four gate streams (`gm{0,1}_cq{32,45}`) decode all 24 frames
28+instead of refusing ("an inter partition below 16x16 other than SPLIT" / "a partition
29+below 8x8" — both were `refusal-names-a-correlate` symptoms of this desync).
30+
31+## Root cause 2 (prediction, fixed, libaom-cited): warp is per PLANE and bails below 8x8
32+`av1_init_warp_params` (reconinter.c:58) returns before `allow_warp` when
33+`block_width < 8 || block_height < 8` — in 420 that is the chroma plane of every luma
34+block below 16x16. We warped chroma at 4x4. Fixed at both warp sites
35+(`decode.rs` 16x16+ site `chroma_side >= 8`, 8x8-leaf site `CHROMA_SIDE >= 8`).
36+
37+## Still RED: chroma-only pixel residue on both 8x8 motion gates — fix-now, next round
38+Luma is byte-exact on all 24 frames of both gates; U/V differ by ±1..3 in a handful of
39+4x4 chroma blocks (frame 1: 40 U + 45 V pixels in 3 blocks; frames 2/3 similar).
40+EVIDENCE: `/tmp/.../scratchpad/{ours.yuv,ref.yuv}` | `EC_PROBE_DUMP=… decode_probe
41+gm1_cq32.obu` vs `ffmpeg -i gm1_cq32.obu -pix_fmt yuv420p` | frame 1 ydiff 0, udiff 40,
42+vdiff 45, mismatching chroma 4x4 blocks (12,8), (16,8), (20,8) = the 8x8 leaves at mi
43+(6,4), (8,4), (10,4); block (12,8) ours [97,119,105,95] vs ref [98,117,106,94].
44+Facts established for the successor:
45+- those three leaves are NOT warped and NOT global (`EC_WARP8 mi_row=6 mi_col=4
46+ warp=false globalblk=false`), so root cause 2 is not it and neither is the gm/warp code;
47+- their luma tx_type is `H_ADST` (class horiz) — i.e. exactly the blocks whose CHROMA now
48+ inherits a 1D-class type. Prime suspect: the chroma side of that inheritance — either
49+ the inverse basis at 4x4 chroma, or libaom's `av1_get_ext_tx_set_type` clamp
50+ (`if (!av1_ext_tx_used[tx_set_type][tx_type]) tx_type = DCT_DCT`), which we approximate
51+ with `side >= 32` instead of the real per-size/`reduced_tx_set` set membership.
52+ Next step: force `DCT_DCT` for the chroma INVERSE only (keep the class-1 eob/scan) and
53+ see whether the three blocks go exact — that separates basis from prediction in one run.
54+
55+## DEVIATION from the charter (named)
56+Charter item (4) says restore any refusal whose gate cannot go green. I did NOT restore
57+the GLOBALMV/WARPED_CAUSAL 8x8 refusals r1 removed, same reasons r2 gave (a refusal placed
58+before the code it guards makes that code dead, `refusal-short-circuits-its-own-code`, and
59+those refusals are not what fails: both gate streams now decode END TO END and only chroma
60+pixels differ). Reverting is one hunk of `refusal_inventory.rs` plus two `decode.rs`
61+deletions in `65ef3f5` if the orchestrator disagrees.
62+
63+## Instruments kept
64+`EC_WARP8` (per-leaf warp decision, under `EC_TRACE_MODE`), `tx=`/`class=` on the
65+`EC_COEFF_STEP tag=eob` line, and `EC_PROBE_DUMP=<path>` on `examples/decode_probe`
66+(raw 8-bit I420 dump for pixel diffing against ffmpeg without a test harness).