forge
Explore
Log in

Don't you dare go Hollow

wip(rectx): non-skip TX_16X8/TX_8X16 rect-leaf coefficient decode

Browse files at this commit

625392219b253d6e499c9b284343b5ca863497b9Ahmet Kaan GümüşParent: d21774e
Uncommitted at the agent's turn cap, committed by the orchestrator.
`cargo check -p ec-av1 --lib` clean; NO test run, NO gate, NO pixel-exact
proof yet.

Adds EOB_PT_128_LUMA and EOB_PT_32_CHROMA (the only tables the size
actually needed -- av1_get_ext_tx_set_type puts TX_16X8/TX_8X16 under
use_reduced_set in the SAME EXT_TX_SET_DTT4_IDTX the square Luma16 set
already reads, so the adapted intra_tx_type_16[mode] table is correct to
share and no new tx_type CDF was needed); TxbSet::LumaRect16x8 and
::ChromaRect8x4; SCAN_8X4/SCAN_4X8; an optional tx_type symbol in
read_coeffs_rect, which previously hard-refused it; and the non-skip
branch of decode_leaf_rect wired to real coefficient decode through the
existing around_mi_rect/record_mi_rect machinery.

Note for whoever reads the scan constants: this repo's SCAN_WxH naming is
axis-swapped from libaom's -- repo SCAN_16X8 is libaom default_scan_8x16
verbatim. The new pair follows that established convention rather than
re-deriving it, and it is NOT yet covered by a transposed-pair test.
crates/ec-av1/src/cdf.rsmodified+36 -0
@@ -266,6 +266,42 @@ pub const EOB_PT_128_CHROMA_Q3: [u16; 9] = [
266 24313, 26062, 28385, 30107, 31217, 31898, 32345, 32768, 0,266 24313, 26062, 28385, 30107, 31217, 31898, 32345, 32768, 0,
267 ];267 ];
268 268
269+/// `av1_default_eob_multi128_cdfs[2][0][0]` (`token_cdfs.h:830-849`,
270+/// lane-rectx): the end-of-block group of a LUMA transform with 128 coded
271+/// positions -- what a true 16x8/8x16 rectangular transform has
272+/// (`decode_leaf_rect`'s own leaf, one level below [`EOB_PT_512_LUMA`]'s
273+/// 32x16/16x32), distinct from [`EOB_PT_256_LUMA`]'s 256-position group a
274+/// *square* 16x16 reads. Read straight from the plane-0 half of the same
275+/// `token_cdfs.h` table [`EOB_PT_128_CHROMA`] reads its plane-1 half from.
276+pub const EOB_PT_128_LUMA: [u16; 9] = [
277+ 1366, 1738, 2527, 5016, 9355, 15797, 24643, 32768, 0,
278+];
279+/// [`EOB_PT_128_LUMA`], q-context 0.
280+pub const EOB_PT_128_LUMA_Q0: [u16; 9] = [
281+ 219, 482, 1140, 2091, 3680, 6028, 12586, 32768, 0,
282+];
283+/// [`EOB_PT_128_LUMA`], q-context 1.
284+pub const EOB_PT_128_LUMA_Q1: [u16; 9] = [
285+ 685, 933, 1488, 2714, 4766, 8562, 19254, 32768, 0,
286+];
287+/// [`EOB_PT_128_LUMA`], q-context 3.
288+pub const EOB_PT_128_LUMA_Q3: [u16; 9] = [
289+ 3472, 4885, 7489, 12481, 18517, 24536, 29635, 32768, 0,
290+];
291+
292+/// `av1_default_eob_multi32_cdfs[2][1][0]` (`token_cdfs.h:792-808`,
293+/// lane-rectx): the end-of-block group of a CHROMA transform with 32 coded
294+/// positions -- what a true 8x4/4x8 rectangular transform has (the chroma
295+/// plane of a [`decode_leaf_rect`] 16x8/8x16 luma strip), distinct from
296+/// [`EOB_PT_16_CHROMA`]'s 16-position group a *square* 4x4 reads.
297+pub const EOB_PT_32_CHROMA: [u16; 7] = [13468, 16303, 20361, 25105, 29281, 32768, 0];
298+/// [`EOB_PT_32_CHROMA`], q-context 0.
299+pub const EOB_PT_32_CHROMA_Q0: [u16; 7] = [2636, 4273, 7588, 11794, 20401, 32768, 0];
300+/// [`EOB_PT_32_CHROMA`], q-context 1.
301+pub const EOB_PT_32_CHROMA_Q1: [u16; 7] = [8394, 10352, 13932, 18855, 26014, 32768, 0];
302+/// [`EOB_PT_32_CHROMA`], q-context 3.
303+pub const EOB_PT_32_CHROMA_Q3: [u16; 7] = [22086, 24282, 27010, 29770, 31743, 32768, 0];
304+
269 /// `av1_default_eob_multi512_cdfs[*][1][*]` (`token_cdfs.h:874-901`,305 /// `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 coded306 /// 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 of307 /// positions -- what a 32x16/16x32 chroma transform has (the chroma plane of
crates/ec-av1/src/cdf_state.rsmodified+70 -0
@@ -117,6 +117,30 @@ pub(crate) enum TxbSet {
117 /// different existing sets is why this variant exists at all rather than117 /// different existing sets is why this variant exists at all rather than
118 /// reusing [`LumaRect32x16`](TxbSet::LumaRect32x16)'s chroma sibling.118 /// reusing [`LumaRect32x16`](TxbSet::LumaRect32x16)'s chroma sibling.
119 ChromaRect32x16,119 ChromaRect32x16,
120+ /// The luma 16x8/8x16 transform of a `PARTITION_HORZ`/`VERT` intra strip
121+ /// below 16x16 (lane-rectx, `decode_leaf_rect`'s own leaf, one level
122+ /// under [`LumaRect32x16`](TxbSet::LumaRect32x16)): `get_txsize_entropy_ctx`
123+ /// reduces this 2:1 rect size to `TX_16X16` too, so this shares every
124+ /// table [`Luma16`](TxbSet::Luma16) does -- INCLUDING its mode-indexed
125+ /// `tx_type` CDF, the same adapted table object -- except `eob_pt`, which
126+ /// reads the true 128-position [`crate::cdf::EOB_PT_128_LUMA`] rather
127+ /// than `Luma16`'s 256-position one. Unlike
128+ /// [`LumaRect32x16`](TxbSet::LumaRect32x16), this size DOES carry a
129+ /// `tx_type` symbol: `av1_get_ext_tx_set_type`'s `use_reduced_set` branch
130+ /// returns `EXT_TX_SET_DTT4_IDTX` for every `tx_size_sqr_up == TX_16X16`
131+ /// regardless of the real (non-square) `tx_size`, the same set
132+ /// `Luma16`'s own read already uses -- confirmed against
133+ /// `av1/common/blockd.h`'s `av1_get_ext_tx_set_type` before landing,
134+ /// see `decode_block_rect`'s own doc comment for the desync this gap
135+ /// left when it was still unhandled.
136+ LumaRect16x8,
137+ /// The chroma 8x4/4x8 transform under the same leaf (lane-rectx):
138+ /// [`Chroma8`](TxbSet::Chroma8)'s tables except `eob_pt`, which reads the
139+ /// true 32-position [`crate::cdf::EOB_PT_32_CHROMA`] instead of
140+ /// `Chroma8`'s 64-position one -- the same square-up relationship
141+ /// [`ChromaRect16x8`](TxbSet::ChromaRect16x8) has to `Chroma16`, one size
142+ /// class down.
143+ ChromaRect8x4,
120 }144 }
121 145
122 /// The tables one transform block is coded with, borrowed from the state for146 /// The tables one transform block is coded with, borrowed from the state for
@@ -269,6 +293,12 @@ pub(crate) struct Cdfs {
269 /// The end-of-block group of a true 32x16/16x32 rect CHROMA transform293 /// The end-of-block group of a true 32x16/16x32 rect CHROMA transform
270 /// (lane-sbpart), see [`TxbSet::ChromaRect32x16`].294 /// (lane-sbpart), see [`TxbSet::ChromaRect32x16`].
271 pub eob_pt_512_chroma: [u16; 11],295 pub eob_pt_512_chroma: [u16; 11],
296+ /// The end-of-block group of a true 16x8/8x16 rect LUMA transform
297+ /// (lane-rectx), see [`TxbSet::LumaRect16x8`].
298+ pub eob_pt_128_luma: [u16; 9],
299+ /// The end-of-block group of a true 8x4/4x8 rect CHROMA transform
300+ /// (lane-rectx), see [`TxbSet::ChromaRect8x4`].
301+ pub eob_pt_32_chroma: [u16; 7],
272 /// The end-of-block offset bit, per table set.302 /// The end-of-block offset bit, per table set.
273 pub eob_extra_luma_32: [[u16; 3]; 9],303 pub eob_extra_luma_32: [[u16; 3]; 9],
274 /// The same, for a 64x64 luma transform.304 /// The same, for a 64x64 luma transform.
@@ -624,6 +654,8 @@ impl Cdfs {
624 reset1(&mut self.eob_pt_512_luma);654 reset1(&mut self.eob_pt_512_luma);
625 reset1(&mut self.eob_pt_128_chroma);655 reset1(&mut self.eob_pt_128_chroma);
626 reset1(&mut self.eob_pt_512_chroma);656 reset1(&mut self.eob_pt_512_chroma);
657+ reset1(&mut self.eob_pt_128_luma);
658+ reset1(&mut self.eob_pt_32_chroma);
627 reset2(&mut self.eob_extra_luma_32);659 reset2(&mut self.eob_extra_luma_32);
628 reset2(&mut self.eob_extra_luma_64);660 reset2(&mut self.eob_extra_luma_64);
629 reset2(&mut self.eob_extra_chroma_16);661 reset2(&mut self.eob_extra_chroma_16);
@@ -1010,6 +1042,20 @@ impl Cdfs {
1010 cdf::EOB_PT_128_CHROMA,1042 cdf::EOB_PT_128_CHROMA,
1011 cdf::EOB_PT_128_CHROMA_Q3,1043 cdf::EOB_PT_128_CHROMA_Q3,
1012 ),1044 ),
1045+ eob_pt_128_luma: pick(
1046+ q_ctx,
1047+ cdf::EOB_PT_128_LUMA_Q0,
1048+ cdf::EOB_PT_128_LUMA_Q1,
1049+ cdf::EOB_PT_128_LUMA,
1050+ cdf::EOB_PT_128_LUMA_Q3,
1051+ ),
1052+ eob_pt_32_chroma: pick(
1053+ q_ctx,
1054+ cdf::EOB_PT_32_CHROMA_Q0,
1055+ cdf::EOB_PT_32_CHROMA_Q1,
1056+ cdf::EOB_PT_32_CHROMA,
1057+ cdf::EOB_PT_32_CHROMA_Q3,
1058+ ),
1013 // Flat default at every q-context (see the constant's own doc1059 // Flat default at every q-context (see the constant's own doc
1014 // comment) -- no `pick()` needed.1060 // comment) -- no `pick()` needed.
1015 eob_pt_512_chroma: cdf::EOB_PT_512_CHROMA,1061 eob_pt_512_chroma: cdf::EOB_PT_512_CHROMA,
@@ -1421,6 +1467,30 @@ impl Cdfs {
1421 tx_type: None,1467 tx_type: None,
1422 eob_pt_class1: None,1468 eob_pt_class1: None,
1423 },1469 },
1470+ TxbSet::LumaRect16x8 => TxbTables {
1471+ side: 16,
1472+ txb_skip: &mut self.txb_skip_luma_16,
1473+ eob_pt: &mut self.eob_pt_128_luma,
1474+ eob_extra: &mut self.eob_extra_luma_16,
1475+ base: &mut self.base_luma_16,
1476+ base_eob: &mut self.base_eob_luma_16,
1477+ br: &mut self.br_luma_16,
1478+ dc_sign: &mut self.dc_sign_luma,
1479+ tx_type: Some(self.intra_tx_type_16[mode].as_mut_slice()),
1480+ eob_pt_class1: None,
1481+ },
1482+ TxbSet::ChromaRect8x4 => TxbTables {
1483+ side: 8,
1484+ txb_skip: &mut self.txb_skip_chroma_8,
1485+ eob_pt: &mut self.eob_pt_32_chroma,
1486+ eob_extra: &mut self.eob_extra_chroma_8,
1487+ base: &mut self.base_chroma_8,
1488+ base_eob: &mut self.base_eob_chroma_8,
1489+ br: &mut self.br_chroma_8,
1490+ dc_sign: &mut self.dc_sign_chroma,
1491+ tx_type: None,
1492+ eob_pt_class1: None,
1493+ },
1424 }1494 }
1425 }1495 }
1426 }1496 }
crates/ec-av1/src/decode.rsmodified+139 -70
@@ -744,6 +744,19 @@ pub(crate) fn rect_coeff_hits() -> usize {
744 RECT_COEFF_HITS.with(|c| c.get())744 RECT_COEFF_HITS.with(|c| c.get())
745 }745 }
746 746
747+// lane-rectx r1: how many below-16x16 HORZ/VERT leaves ([`decode_leaf_rect`])
748+// decoded real (non-skip) TX_16X8/TX_8X16 coefficients -- the counter the
749+// charter's real-aomenc gate hard-asserts.
750+thread_local! {
751+ static RECT_LEAF_COEFF_HITS: std::cell::Cell<usize> =
752+ const { std::cell::Cell::new(0) };
753+}
754+
755+/// Current value of [`RECT_LEAF_COEFF_HITS`].
756+pub(crate) fn rect_leaf_coeff_hits() -> usize {
757+ RECT_LEAF_COEFF_HITS.with(|c| c.get())
758+}
759+
747 // lane-sbpart r2: how many superblock-level `PARTITION_HORZ`/`PARTITION_VERT`760 // lane-sbpart r2: how many superblock-level `PARTITION_HORZ`/`PARTITION_VERT`
748 // blocks (two true 64x32/32x64 strips, [`decode_block_rect64`]) fired -- the761 // blocks (two true 64x32/32x64 strips, [`decode_block_rect64`]) fired -- the
749 // gate's proof this round's arms actually reached a real block, not just762 // gate's proof this round's arms actually reached a real block, not just
@@ -1236,6 +1249,26 @@ const SCAN_8X16: [u16; 128] = [
1236 123, 103, 110, 117, 124, 111, 118, 125, 119, 126, 127,1249 123, 103, 110, 117, 124, 111, 118, 125, 119, 126, 127,
1237 ];1250 ];
1238 1251
1252+/// `Default_Scan_8x4` (lane-rectx, see [`SCAN_32X16`]'s doc comment for the
1253+/// transposition rule this repo's `SCAN_WxH` names follow): this repo's
1254+/// `(w=8, h=4)` reads libaom's own `default_scan_4x8` verbatim -- the same
1255+/// axis swap [`SCAN_16X8`]/[`SCAN_8X16`] already carry one size class up
1256+/// (repo `SCAN_16X8` == libaom `default_scan_8x16`, repo `SCAN_8X16` ==
1257+/// libaom `default_scan_16x8`), checked against `scan.c` before landing
1258+/// rather than re-deriving the zigzag formula.
1259+const SCAN_8X4: [u16; 32] = [
1260+ 0, 8, 1, 16, 9, 2, 24, 17, 10, 3, 25, 18, 11, 4, 26, 19, 12, 5, 27, 20, 13, 6, 28, 21, 14, 7,
1261+ 29, 22, 15, 30, 23, 31,
1262+];
1263+
1264+/// `Default_Scan_4x8` (lane-rectx): this repo's `(w=4, h=8)` reads libaom's
1265+/// own `default_scan_8x4` verbatim, the same transposition [`SCAN_8X4`]'s
1266+/// doc comment explains.
1267+const SCAN_4X8: [u16; 32] = [
1268+ 0, 1, 4, 2, 5, 8, 3, 6, 9, 12, 7, 10, 13, 16, 11, 14, 17, 20, 15, 18, 21, 24, 19, 22, 25, 28,
1269+ 23, 26, 29, 27, 30, 31,
1270+];
1271+
1239 /// [`neighbour`] with independent `w` (row stride)/`h` (row-bound) extents1272 /// [`neighbour`] with independent `w` (row stride)/`h` (row-bound) extents
1240 /// (lane-rectwire, mirrors [`record_rect`](Neighbours::record_rect)'s1273 /// (lane-rectwire, mirrors [`record_rect`](Neighbours::record_rect)'s
1241 /// asymmetric-extent pattern).1274 /// asymmetric-extent pattern).
@@ -1599,12 +1632,14 @@ fn read_coeffs(
1599 Ok((grid, tx_type))1632 Ok((grid, tx_type))
1600 }1633 }
1601 1634
1602-/// [`read_coeffs`] widened to `(w, h)` (lane-rectwire), restricted to1635+/// [`read_coeffs`] widened to `(w, h)` (lane-rectwire; lane-rectx added the
1603-/// `TxClass::TwoD` -- the only class either rect size pair this decoder codes1636+/// `tx_type` read [`TxbSet::LumaRect16x8`] needs), restricted to
1604-/// can ever produce (see [`decode_block_rect`]'s doc comment): refuses by1637+/// `TxClass::TwoD` -- the only class any rect size pair this decoder codes
1605-/// name rather than guess-decode if a `tx_type` symbol or non-2D class ever1638+/// can ever produce, since every `tx_type` this decoder's rect sets can read
1606-/// shows up here, since neither `base_ctx_rect`/`br_ctx_rect` nor1639+/// (`EXT_TX_SET_DTT4_IDTX`'s five members) is itself 2D: refuses by name
1607-/// [`class_scan_table`] have a rect form for those.1640+/// rather than guess-decode if a non-2D class ever shows up here, since
1641+/// neither `base_ctx_rect`/`br_ctx_rect` nor [`class_scan_table`] have a rect
1642+/// form for those.
1608 fn read_coeffs_rect(1643 fn read_coeffs_rect(
1609 dec: &mut SymbolDecoder,1644 dec: &mut SymbolDecoder,
1610 coding: &mut TxbTables,1645 coding: &mut TxbTables,
@@ -1620,12 +1655,21 @@ fn read_coeffs_rect(
1620 if all_zero {1655 if all_zero {
1621 return Ok((grid, TxType::DctDct));1656 return Ok((grid, TxType::DctDct));
1622 }1657 }
1623- if coding.tx_type.is_some() {1658+ let mut tx_type = default_tx_type;
1624- return Err(unsupported(1659+ if let Some(tx_type_cdf) = coding.tx_type.as_deref_mut() {
1625- "a tx_type symbol on a rectangular transform (never expected at this size)",1660+ // Mirrors [`read_coeffs`]'s own `tx_type` read: the CDF row's width
1626- ));1661+ // names its set (lane-rectx, `TxbSet::LumaRect16x8` -- the one rect
1662+ // set here that carries a `tx_type` symbol at all).
1663+ let len = tx_type_cdf.len();
1664+ let t = dec.symbol(tx_type_cdf);
1665+ tx_type = match len {
1666+ 17 => TxType::from_symbol_all16(t),
1667+ 13 => TxType::from_symbol_set2_12(t),
1668+ 8 => TxType::from_symbol_set1(t),
1669+ _ => TxType::from_symbol(t),
1670+ }
1671+ .ok_or_else(|| unsupported(format!("a tx_type symbol outside its CDF's own set: {t}")))?;
1627 }1672 }
1628- let tx_type = default_tx_type;
1629 if TxClass::of(tx_type) != TxClass::TwoD {1673 if TxClass::of(tx_type) != TxClass::TwoD {
1630 return Err(unsupported(1674 return Err(unsupported(
1631 "a non-2D tx class on a rectangular transform (never expected at this size)",1675 "a non-2D tx class on a rectangular transform (never expected at this size)",
@@ -3469,9 +3513,10 @@ fn decode_block_rect(
3469 /// writers (`record_mi_rect`, `fill_skip_grid_rect`, `fill_lf_grid_rect`) at3513 /// writers (`record_mi_rect`, `fill_skip_grid_rect`, `fill_lf_grid_rect`) at
3470 /// this strip's real position, never the coarse `record_rect` (which the3514 /// this strip's real position, never the coarse `record_rect` (which the
3471 /// caller uses once, after both strips, exactly like the `VERT_B` arm next3515 /// caller uses once, after both strips, exactly like the `VERT_B` arm next
3472-/// to it). Only the skip case is ported -- see [`decode_block_rect`]'s own3516+/// to it). The non-skip case (lane-rectx) reads real `TX_16X8`/`TX_8X16`
3473-/// doc for why a coded rect strip below 16x16 has no coefficient tables here3517+/// luma coefficients (`TxbSet::LumaRect16x8`) and their `TX_8X4`/`TX_4X8`
3474-/// yet.3518+/// chroma half (`TxbSet::ChromaRect8x4`), the two size classes one level
3519+/// under [`decode_block_rect`]'s own 32x16/16x32 strip.
3475 #[allow(clippy::too_many_arguments)]3520 #[allow(clippy::too_many_arguments)]
3476 fn decode_leaf_rect(3521 fn decode_leaf_rect(
3477 dec: &mut SymbolDecoder,3522 dec: &mut SymbolDecoder,
@@ -3540,66 +3585,90 @@ fn decode_leaf_rect(
3540 prediction is not ported)",3585 prediction is not ported)",
3541 ));3586 ));
3542 }3587 }
3543- if !skip {
3544- return Err(unsupported(
3545- "a coded (non-skip) HORZ/VERT rect strip below 16x16 (this decoder ports only \
3546- the skip case at this size)",
3547- ));
3548- }
3549 let (px, py) = (leaf_mi.1 * MI, leaf_mi.0 * MI);3588 let (px, py) = (leaf_mi.1 * MI, leaf_mi.0 * MI);
3550 let reach = Reach::of_rect(bw, bh, px, py, y.width, y.height);3589 let reach = Reach::of_rect(bw, bh, px, py, y.width, y.height);
3551 let (cpx, cpy) = (px / 2, py / 2);3590 let (cpx, cpy) = (px / 2, py / 2);
3552 let (chroma_w, chroma_h) = (bw / 2, bh / 2);3591 let (chroma_w, chroma_h) = (bw / 2, bh / 2);
3553- y.reconstruct_rect(3592+ let (luma_levels, u_levels, v_levels);
3554- px,3593+ if skip {
3555- py,3594+ luma_levels = vec![0i32; bw * bh];
3556- bw,3595+ u_levels = vec![0i32; chroma_w * chroma_h];
3557- bh,3596+ v_levels = vec![0i32; chroma_w * chroma_h];
3558- mode,3597+ y.reconstruct_rect(
3559- angle_delta_y,3598+ px, py, bw, bh, mode, angle_delta_y, reach, &luma_levels, None, filter_intra,
3560- reach,3599+ smooth_neighbor,
3561- &vec![0i32; bw * bh],3600+ );
3562- None,3601+ let ac = alpha.map(|_| cfl_ac_q3_rect(y, px, py, bw, bh));
3563- filter_intra,3602+ u.reconstruct_rect(
3564- smooth_neighbor,3603+ cpx, cpy, chroma_w, chroma_h, uv_predict_mode, angle_delta_uv, reach, &u_levels,
3565- );3604+ alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), None, false,
3566- let ac = alpha.map(|_| cfl_ac_q3_rect(y, px, py, bw, bh));3605+ );
3567- u.reconstruct_rect(3606+ v.reconstruct_rect(
3568- cpx,3607+ cpx, cpy, chroma_w, chroma_h, uv_predict_mode, angle_delta_uv, reach, &v_levels,
3569- cpy,3608+ alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), None, false,
3570- chroma_w,3609+ );
3571- chroma_h,3610+ } else {
3572- uv_predict_mode,3611+ // lane-rectx: a genuine 16x8/8x16 luma transform (`TxbSet::LumaRect16x8`,
3573- angle_delta_uv,3612+ // real `EOB_PT_128_LUMA` alphabet + the same mode-indexed `tx_type`
3574- reach,3613+ // symbol the square `Luma16` set reads -- `get_ext_tx_set_type`'s
3575- &vec![0i32; chroma_w * chroma_h],3614+ // `use_reduced_set` branch returns `EXT_TX_SET_DTT4_IDTX` at
3576- alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)),3615+ // `tx_size_sqr_up == TX_16X16` regardless of the true, non-square
3577- None,3616+ // `tx_size`) and its chroma half (8x4/4x8, `TxbSet::ChromaRect8x4`).
3578- false,3617+ let (luma_scan, chroma_scan): (&[u16], &[u16]) = if bw == 16 {
3579- );3618+ (&SCAN_16X8, &SCAN_8X4)
3580- v.reconstruct_rect(3619+ } else {
3581- cpx,3620+ (&SCAN_8X16, &SCAN_4X8)
3582- cpy,3621+ };
3583- chroma_w,3622+ let around = neighbours.around_mi_rect(leaf_mi, bw, bh);
3584- chroma_h,3623+ let mut luma_coding = cdfs.txb(TxbSet::LumaRect16x8, mode);
3585- uv_predict_mode,3624+ let (l_levels, luma_tx_type) = read_coeffs_rect(
3586- angle_delta_uv,3625+ dec, &mut luma_coding, luma_scan, bw, bh, 0, dc_sign_ctx(around[0].2), TxType::DctDct,
3587- reach,3626+ )?;
3588- &vec![0i32; chroma_w * chroma_h],3627+ luma_levels = l_levels;
3589- alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)),3628+ let luma_residual = dequant_and_inverse_typed_wh(
3590- None,3629+ &luma_levels, bw, bh, crate::decode::bit_depth(),
3591- false,3630+ CURRENT_Q_IDX.with(|c| c.get()), plane_q_delta(0).0, plane_q_delta(0).1, luma_tx_type,
3592- );3631+ );
3593- neighbours.record_mi_rect(3632+ y.reconstruct_rect(
3594- leaf_mi,3633+ px, py, bw, bh, mode, angle_delta_y, reach, &luma_residual, None, filter_intra,
3595- bw,3634+ smooth_neighbor,
3596- bh,3635+ );
3597- &[3636+ let ac = alpha.map(|_| cfl_ac_q3_rect(y, px, py, bw, bh));
3598- vec![0i32; bw * bh],3637+ let u_default_tx = default_intra_tx_type(uv_predict_mode as u8);
3599- vec![0i32; chroma_w * chroma_h],3638+ let u_skip_ctx = usize::from(around[1].0) + usize::from(around[1].1);
3600- vec![0i32; chroma_w * chroma_h],3639+ let mut u_coding = cdfs.txb(TxbSet::ChromaRect8x4, uv_predict_mode);
3601- ],3640+ let (u_l, u_tx_type) = read_coeffs_rect(
3602- );3641+ dec, &mut u_coding, chroma_scan, chroma_w, chroma_h, u_skip_ctx,
3642+ dc_sign_ctx(around[1].2), u_default_tx,
3643+ )?;
3644+ u_levels = u_l;
3645+ let u_residual = dequant_and_inverse_typed_wh(
3646+ &u_levels, chroma_w, chroma_h, crate::decode::bit_depth(),
3647+ CURRENT_Q_IDX.with(|c| c.get()), plane_q_delta(1).0, plane_q_delta(1).1, u_tx_type,
3648+ );
3649+ u.reconstruct_rect(
3650+ cpx, cpy, chroma_w, chroma_h, uv_predict_mode, angle_delta_uv, reach, &u_residual,
3651+ alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), None, false,
3652+ );
3653+ let v_default_tx = default_intra_tx_type(uv_predict_mode as u8);
3654+ let v_skip_ctx = usize::from(around[2].0) + usize::from(around[2].1);
3655+ let mut v_coding = cdfs.txb(TxbSet::ChromaRect8x4, uv_predict_mode);
3656+ let (v_l, v_tx_type) = read_coeffs_rect(
3657+ dec, &mut v_coding, chroma_scan, chroma_w, chroma_h, v_skip_ctx,
3658+ dc_sign_ctx(around[2].2), v_default_tx,
3659+ )?;
3660+ v_levels = v_l;
3661+ let v_residual = dequant_and_inverse_typed_wh(
3662+ &v_levels, chroma_w, chroma_h, crate::decode::bit_depth(),
3663+ CURRENT_Q_IDX.with(|c| c.get()), plane_q_delta(2).0, plane_q_delta(2).1, v_tx_type,
3664+ );
3665+ v.reconstruct_rect(
3666+ cpx, cpy, chroma_w, chroma_h, uv_predict_mode, angle_delta_uv, reach, &v_residual,
3667+ alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), None, false,
3668+ );
3669+ RECT_LEAF_COEFF_HITS.with(|c| c.set(c.get() + 1));
3670+ }
3671+ neighbours.record_mi_rect(leaf_mi, bw, bh, &[luma_levels, u_levels, v_levels]);
3603 neighbours.fill_skip_grid_rect(leaf_mi, mi_w, mi_h, skip);3672 neighbours.fill_skip_grid_rect(leaf_mi, mi_w, mi_h, skip);
3604 neighbours.fill_lf_grid_rect(leaf_mi, mi_w, mi_h, bw as u8, bh as u8, 0);3673 neighbours.fill_lf_grid_rect(leaf_mi, mi_w, mi_h, bw as u8, bh as u8, 0);
3605 Ok(mode)3674 Ok(mode)
crates/ec-av1/src/refusal_inventory.rsmodified+0 -2
@@ -29,14 +29,12 @@ const CAPABILITY_CLAIMS: &[&str] = &[
29 "a non-DC chroma mode on an 8x8 inter-frame leaf (this encoder never writes one)",29 "a non-DC chroma mode on an 8x8 inter-frame leaf (this encoder never writes one)",
30 "a nonzero angle delta (this encoder never writes one)",30 "a nonzero angle delta (this encoder never writes one)",
31 "a partition below 8x8 (this decoder codes no leaf smaller than 8x8)",31 "a partition below 8x8 (this decoder codes no leaf smaller than 8x8)",
32- "a tx_type symbol on a rectangular transform (never expected at this size)",
33 ];32 ];
34 33
35 #[cfg(test)]34 #[cfg(test)]
36 const REFUSALS: &[&str] = &[35 const REFUSALS: &[&str] = &[
37 "GLOBALMV (round 3)",36 "GLOBALMV (round 3)",
38 "a coded (non-skip) HORZ_B/VERT_B rect strip below 16x16 (this decoder ports only the skip case at this size)",37 "a coded (non-skip) HORZ_B/VERT_B rect strip below 16x16 (this decoder ports only the skip case at this size)",
39- "a coded (non-skip) HORZ/VERT rect strip below 16x16 (this decoder ports only the skip case at this size)",
40 "a HORZ_A/HORZ_B/VERT_A partition below 16x16 (this decoder codes only the square arms, HORZ, VERT, VERT_B, and a clean split below 16x16)",38 "a HORZ_A/HORZ_B/VERT_A partition below 16x16 (this decoder codes only the square arms, HORZ, VERT, VERT_B, and a clean split below 16x16)",
41 "a 16x16 block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet",39 "a 16x16 block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet",
42 "a 16x16 inter block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet",40 "a 16x16 inter block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet",