forge
Explore
Log in

Don't you dare go Hollow

wip(av1): lossless lane snapshot at the turn cap (orchestrator)

Browse files at this commit

9a5f8e7285cd1a574166b54c9b0f3267fa47d9a5Ahmet Kaan GümüşParent: f0a5a15
crates/ec-av1/src/decode.rsmodified+20 -9
@@ -9153,7 +9153,18 @@ struct RectStripModes {
91539153 /// TX_32X16`) and only the second reaches a square -- the reason
91549154 /// `bw.min(bh) >> (depth - 1)` (correct for a 2:1 strip, where step one is
91559155 /// already square) mis-tiled 1:4 strips.
9156-fn depth_to_tx_wh(bw: usize, bh: usize, depth: usize) -> (usize, usize) {
9156+fn depth_to_tx_wh(
9157+ bw: usize,
9158+ bh: usize,
9159+ depth: usize,
9160+ fctx: &crate::decode::FrameCtx,
9161+) -> (usize, usize) {
9162+ // lane-lossless: TX_4X4 whatever the strip's own size and depth (libaom
9163+ // `read_tx_size`: the lossless early return comes before
9164+ // `max_txsize_rect_lookup`), and no `tx_depth` symbol was read to get here.
9165+ if lossless(fctx) {
9166+ return (4, 4);
9167+ }
91579168 let (mut w, mut h) = (bw.min(64), bh.min(64));
91589169 for _ in 0..depth {
91599170 match w.cmp(&h) {
@@ -10289,7 +10300,7 @@ fn decode_intra_rect_in_inter(
1028910300 if crate::envflags::env_flag!("EC_SPLITSTRIP") {
1029010301 eprintln!("EC_SPLITSTRIP mi_row={mi_r} mi_col={mi_c} bw={bw} bh={bh} depth={depth}");
1029110302 }
10292- let (tx_w, tx_h) = depth_to_tx_wh(bw, bh, depth);
10303+ let (tx_w, tx_h) = depth_to_tx_wh(bw, bh, depth, fctx);
1029310304 // lane-inter16ab r8: libaom runs `set_txfm_ctxs(tx_size, n4_w, n4_h,
1029410305 // skip && is_inter, xd)` (decodeframe.c `decode_block`) for EVERY block
1029510306 // of an inter frame, intra ones included -- with the skip term 0 it
@@ -10489,7 +10500,7 @@ fn decode_block_rect(
1048910500 // per transform unit, each unit taking its edges from the previous
1049010501 // unit's reconstruction inside this same strip (spec 5.11.36) --
1049110502 // [`decode_rect_split`], the unit named by [`depth_to_tx_wh`].
10492- let (tx_w, tx_h) = depth_to_tx_wh(bw, bh, depth);
10503+ let (tx_w, tx_h) = depth_to_tx_wh(bw, bh, depth, fctx);
1049310504 if crate::envflags::env_flag!("EC_SBPART_DUMP64") {
1049410505 eprintln!(
1049510506 "DUMP64SPLIT mi_r={mi_r} mi_c={mi_c} px={px} py={py} bw={bw} bh={bh} \
@@ -10995,7 +11006,7 @@ fn decode_leaf_rect(
1099511006 // depth 2), addressed at this leaf's own mi position.
1099611007 hit!(TX_DEPTH_HITS);
1099711008 hit!(SUB16_SPLIT_HITS);
10998- let (tx_w, tx_h) = depth_to_tx_wh(bw, bh, depth);
11009+ let (tx_w, tx_h) = depth_to_tx_wh(bw, bh, depth, fctx);
1099911010 let modes = RectStripModes {
1100011011 skip,
1100111012 mode,
@@ -11328,7 +11339,7 @@ fn decode_block_rect4(
1132811339 publish_txfm_bands_if_in_inter(
1132911340 neighbours,
1133011341 (mi_r, mi_c),
11331- depth_to_tx_wh(bw, bh, depth),
11342+ depth_to_tx_wh(bw, bh, depth, fctx),
1133211343 (bw, bh), fctx,
1133311344 );
1133411345 if depth != 0 {
@@ -11338,7 +11349,7 @@ fn decode_block_rect4(
1133811349 // (`sub_tx_size_map[TX_32X8] == TX_16X8`), depth 2 the square TX_8X8;
1133911350 // both interleave in every real stream.
1134011351 hit!(TX_DEPTH_HITS);
11341- let (tx_w, tx_h) = depth_to_tx_wh(bw, bh, depth);
11352+ let (tx_w, tx_h) = depth_to_tx_wh(bw, bh, depth, fctx);
1134211353 // lane-rectsplitx r2: both depths ship together, as the r1 handoff
1134311354 // predicted -- depth 1 fires FIRST in every attempt that splits at
1134411355 // all, so a depth-2-only lift could never be gated. The r1 mismatch
@@ -11853,7 +11864,7 @@ fn decode_rect4_16_strip(
1185311864 hit!(TX_DEPTH_HITS);
1185411865 hit!(RECT4_16_SPLIT_HITS);
1185511866 }
11856- let (tx_w, tx_h) = depth_to_tx_wh(bw, bh, depth);
11867+ let (tx_w, tx_h) = depth_to_tx_wh(bw, bh, depth, fctx);
1185711868 let (px, py) = (lmi.1 * MI, lmi.0 * MI);
1185811869 let reach = Reach::of_rect(bw, bh, px, py, y.width, y.height, fctx);
1185911870 neighbours.record_mode_mi(lmi.0, lmi.1, mi_w, mi_h, mode);
@@ -12344,7 +12355,7 @@ fn decode_block_rect64(
1234412355 publish_txfm_bands_if_in_inter(
1234512356 neighbours,
1234612357 (mi_r, mi_c),
12347- depth_to_tx_wh(bw, bh, depth),
12358+ depth_to_tx_wh(bw, bh, depth, fctx),
1234812359 (bw, bh), fctx,
1234912360 );
1235012361 if depth != 0 {
@@ -12354,7 +12365,7 @@ fn decode_block_rect64(
1235412365 // sibling; [`depth_to_tx_wh`] names the unit, which for a 64x16/16x64
1235512366 // 1:4 strip is the 2:1 rect TX_32X16 at depth 1 (lane-rectchroma r1
1235612367 // measured the old square formula mis-tiling exactly that strip).
12357- let (tx_w, tx_h) = depth_to_tx_wh(bw, bh, depth);
12368+ let (tx_w, tx_h) = depth_to_tx_wh(bw, bh, depth, fctx);
1235812369 if bw.max(bh) / bw.min(bh) == 4 {
1235912370 let which = if depth == 1 {
1236012371 &RECT4_SPLIT_DEPTH1_HITS