Get_tx_size_context's inter-neighbour override read a SUB-cell index into two mi-granular bands
Browse files at this commit9fbdab4f85e57fda9942544d4b649d33349dc898Parent: fd8e31a- fix
- get_tx_size_context's inter-neighbour override read a SUB-cell index into two mi-granular bands
2 changed files +28 -12
- crates/ec-av1/src/decode.rs +15 -8
- crates/ec-av1/src/stream.rs +13 -4
crates/ec-av1/src/decode.rsmodified+15 -8
| @@ -6555,11 +6555,12 @@ fn decode_intra_rect_in_inter( | |||
| 6555 | v[depth.min(2)] += 1; | 6555 | v[depth.min(2)] += 1; |
| 6556 | h.set(v); | 6556 | h.set(v); |
| 6557 | }); | 6557 | }); |
| 6558 | - if std::env::var_os("EC_SPLITSTRIP").is_some() { | ||
| 6559 | - eprintln!( | ||
| 6560 | - "EC_SPLITSTRIP mi_row={mi_r} mi_col={mi_c} bw={bw} bh={bh} depth={depth}" | ||
| 6561 | - ); | ||
| 6562 | } | 6558 | } |
| 6559 | + // lane-intrasplit r3: print EVERY intra strip with its depth, not only the | ||
| 6560 | + // split ones -- a `depth=0`-only stream is a witness gap in the SOURCE, and | ||
| 6561 | + // the two are indistinguishable when the diagnostic fires on splits alone. | ||
| 6562 | + if std::env::var_os("EC_SPLITSTRIP").is_some() { | ||
| 6563 | + eprintln!("EC_SPLITSTRIP mi_row={mi_r} mi_col={mi_c} bw={bw} bh={bh} depth={depth}"); | ||
| 6563 | } | 6564 | } |
| 6564 | let (tx_w, tx_h) = depth_to_tx_wh(bw, bh, depth); | 6565 | let (tx_w, tx_h) = depth_to_tx_wh(bw, bh, depth); |
| 6565 | let modes = RectStripModes { | 6566 | let modes = RectStripModes { |
| @@ -11584,10 +11585,10 @@ fn tx_size_context_txfm_rect( | |||
| 11584 | let has_left = mi_c > n.tile_col0_mi; | 11585 | let has_left = mi_c > n.tile_col0_mi; |
| 11585 | let mut above = usize::from(n.above_txfm[mi_c]) >= own_w; | 11586 | let mut above = usize::from(n.above_txfm[mi_c]) >= own_w; |
| 11586 | let mut left = usize::from(n.left_txfm[mi_r]) >= own_h; | 11587 | let mut left = usize::from(n.left_txfm[mi_r]) >= own_h; |
| 11587 | - if has_above && n.above_inter[mi_c / (SUB / MI)] { | 11588 | + if has_above && n.above_inter[mi_c] { |
| 11588 | above = n.above_side_mi[mi_c] >= own_w; | 11589 | above = n.above_side_mi[mi_c] >= own_w; |
| 11589 | } | 11590 | } |
| 11590 | - if has_left && n.left_inter[mi_r / (SUB / MI)] { | 11591 | + if has_left && n.left_inter[mi_r] { |
| 11591 | left = n.left_side_mi[mi_r] >= own_h; | 11592 | left = n.left_side_mi[mi_r] >= own_h; |
| 11592 | } | 11593 | } |
| 11593 | match (has_above, has_left) { | 11594 | match (has_above, has_left) { |
| @@ -11598,15 +11599,21 @@ fn tx_size_context_txfm_rect( | |||
| 11598 | } | 11599 | } |
| 11599 | } | 11600 | } |
| 11600 | 11601 | ||
| 11602 | +/// lane-intrasplit r3: `above_inter`/`left_inter` are mi-granular bands (they | ||
| 11603 | +/// are written and read everywhere else with a raw mi index); the SUB-cell | ||
| 11604 | +/// division this pair used read a cell four blocks away, so the inter-neighbour | ||
| 11605 | +/// override above fired on the wrong neighbour -- the first divergence of the | ||
| 11606 | +/// 10-bit gate's stream was exactly this (`tx_depth` ctx 0 where libaom has 1, | ||
| 11607 | +/// at the intra block right of an inter one). | ||
| 11601 | fn tx_size_context_txfm(n: &Neighbours, (mi_r, mi_c): (usize, usize), side: usize) -> usize { | 11608 | fn tx_size_context_txfm(n: &Neighbours, (mi_r, mi_c): (usize, usize), side: usize) -> usize { |
| 11602 | let has_above = mi_r > n.tile_row0_mi; | 11609 | let has_above = mi_r > n.tile_row0_mi; |
| 11603 | let has_left = mi_c > n.tile_col0_mi; | 11610 | let has_left = mi_c > n.tile_col0_mi; |
| 11604 | let mut above = usize::from(n.above_txfm[mi_c]) >= side; | 11611 | let mut above = usize::from(n.above_txfm[mi_c]) >= side; |
| 11605 | let mut left = usize::from(n.left_txfm[mi_r]) >= side; | 11612 | let mut left = usize::from(n.left_txfm[mi_r]) >= side; |
| 11606 | - if has_above && n.above_inter[mi_c / (SUB / MI)] { | 11613 | + if has_above && n.above_inter[mi_c] { |
| 11607 | above = n.above_side_mi[mi_c] >= side; | 11614 | above = n.above_side_mi[mi_c] >= side; |
| 11608 | } | 11615 | } |
| 11609 | - if has_left && n.left_inter[mi_r / (SUB / MI)] { | 11616 | + if has_left && n.left_inter[mi_r] { |
| 11610 | left = n.left_side_mi[mi_r] >= side; | 11617 | left = n.left_side_mi[mi_r] >= side; |
| 11611 | } | 11618 | } |
| 11612 | match (has_above, has_left) { | 11619 | match (has_above, has_left) { |
crates/ec-av1/src/stream.rsmodified+13 -4
| @@ -5533,7 +5533,16 @@ mod tests { | |||
| 5533 | eprintln!("SKIP {name}: no aomenc at {}", aomenc_path().display()); | 5533 | eprintln!("SKIP {name}: no aomenc at {}", aomenc_path().display()); |
| 5534 | return; | 5534 | return; |
| 5535 | } | 5535 | } |
| 5536 | - let (width, height, frame_count) = (192usize, 128usize, 8usize); | 5536 | + // lane-intrasplit r3, MEASURED (probe3, 20 attempts x 2 depths): at |
| 5537 | + // 192x128 with `--min/--max-partition-size=32` a correctly decoded | ||
| 5538 | + // stream contains ZERO intra HORZ/VERT strips in an inter frame -- the | ||
| 5539 | + // r1/r2 "firing" counters were read off our own desynced decode (class | ||
| 5540 | + // counter-from-refused-stream). The merged unsplit-strip gate's own | ||
| 5541 | + // geometry (96x96, min 16 / max 64) is the one that makes aomenc's RD | ||
| 5542 | + // pick intra strips here, and at `--enable-tx-size-search=1` it splits | ||
| 5543 | + // their transforms: 10-bit attempt 0 = 8 strips, 3 split; 8-bit | ||
| 5544 | + // attempt 0 = 5 strips, 1 split. | ||
| 5545 | + let (width, height, frame_count) = (96usize, 96usize, 8usize); | ||
| 5537 | let mut refusals = Vec::new(); | 5546 | let mut refusals = Vec::new(); |
| 5538 | let mut uncounted_exact = 0u32; | 5547 | let mut uncounted_exact = 0u32; |
| 5539 | let mut counted_exact = 0u32; | 5548 | let mut counted_exact = 0u32; |
| @@ -5547,7 +5556,7 @@ mod tests { | |||
| 5547 | // 1..4, and the quantiser with it (a hard-cut overlay source at | 5556 | // 1..4, and the quantiser with it (a hard-cut overlay source at |
| 5548 | // cpu-used=0 stopped 38/40 attempts on other lanes' refusals). | 5557 | // cpu-used=0 stopped 38/40 attempts on other lanes' refusals). |
| 5549 | let cpu = attempt % 5; | 5558 | let cpu = attempt % 5; |
| 5550 | - let cq = [30u32, 20, 12, 63][((attempt / 5) % 4) as usize]; | 5559 | + let cq = [30u32, 20, 12, 4][((attempt / 5) % 4) as usize]; |
| 5551 | // A FAST ZOOM: consecutive frames share almost no content, so | 5560 | // A FAST ZOOM: consecutive frames share almost no content, so |
| 5552 | // aomenc's RD codes blocks INTRA inside INTER frames | 5561 | // aomenc's RD codes blocks INTRA inside INTER frames |
| 5553 | // (`--kf-min-dist` forbids a new key frame) -- the only way a | 5562 | // (`--kf-min-dist` forbids a new key frame) -- the only way a |
| @@ -5636,8 +5645,8 @@ mod tests { | |||
| 5636 | "--enable-intrabc=0", | 5645 | "--enable-intrabc=0", |
| 5637 | "--enable-cfl-intra=0", | 5646 | "--enable-cfl-intra=0", |
| 5638 | "--enable-ref-frame-mvs=0", | 5647 | "--enable-ref-frame-mvs=0", |
| 5639 | - "--min-partition-size=32", | 5648 | + "--min-partition-size=16", |
| 5640 | - "--max-partition-size=32", | 5649 | + "--max-partition-size=64", |
| 5641 | // Per-arm overrides go LAST (aomenc keeps the last | 5650 | // Per-arm overrides go LAST (aomenc keeps the last |
| 5642 | // occurrence of a repeated --enable-* flag): this gate | 5651 | // occurrence of a repeated --enable-* flag): this gate |
| 5643 | // needs the rect partitions the strip lives in and the | 5652 | // needs the rect partitions the strip lives in and the |