Merge branch 'lane-frame36' (f52ae0d): split superblock-level strips publish their txfm bands; the 10-bit 3840x1608 head cut decodes 48/48 frames byte-exact, pinned hidden-ARF witness
Browse files at this commit7 changed files +419 -1
- crates/ec-av1/examples/decode_probe.rs +66 -0
- crates/ec-av1/fixtures/reelb_arf_witness.obu +0 -0
- crates/ec-av1/src/decode.rs +86 -1
- crates/ec-av1/src/stream.rs +66 -0
- lanes/frame36-r1.handoff.md +76 -0
- lanes/frame36-r2.handoff.md +51 -0
- lanes/frame36-r2.report.md +74 -0
crates/ec-av1/examples/decode_probe.rsmodified+66 -0
| @@ -142,6 +142,72 @@ fn main() { | |||
| 142 | _ => continue, | 142 | _ => continue, |
| 143 | }; | 143 | }; |
| 144 | frames_seen += 1; | 144 | frames_seen += 1; |
| 145 | + // lane-frame36: `EC_PROBE_HDR=1` prints one line per frame header, so a | ||
| 146 | + // silent wall can be triaged by "which header field is new at frame N" | ||
| 147 | + // before any pixel work (class: a header field parsed then never consumed). | ||
| 148 | + if std::env::var("EC_PROBE_HDR").is_ok() { | ||
| 149 | + let h = header; | ||
| 150 | + let gm: Vec<String> = h | ||
| 151 | + .global_motion | ||
| 152 | + .iter() | ||
| 153 | + .map(|w| format!("{:?}", w.model)) | ||
| 154 | + .collect(); | ||
| 155 | + println!( | ||
| 156 | + "HDR {}: type={:?} show={} showable={} show_existing={}({}) intra={} \ | ||
| 157 | + size={}x{} up={} superres={}/{} order_hint={} primary_ref={} refresh={:#04x} \ | ||
| 158 | + refs={:?} order_hints={:?} sign_bias={:?} err_res={} disable_cdf={} \ | ||
| 159 | + screen_tools={} int_mv={} intrabc={} hp_mv={} interp={:?} switchable_motion={} \ | ||
| 160 | + ref_mvs={} base_q={} seg={} deltaq={} deltalf={} lf_level={:?} lf_deltas={:?}/{:?} \ | ||
| 161 | + cdef_bits={} lr={:?} tx_mode={:?} ref_sel={} skip_mode={}({:?}) warp={} \ | ||
| 162 | + reduced_tx={} gm={:?} grain={}/seed={} lossless={}", | ||
| 163 | + frames_seen - 1, | ||
| 164 | + h.frame_type, | ||
| 165 | + h.show_frame, | ||
| 166 | + h.showable_frame, | ||
| 167 | + h.show_existing_frame, | ||
| 168 | + h.frame_to_show_map_idx, | ||
| 169 | + h.frame_is_intra, | ||
| 170 | + h.frame_width, | ||
| 171 | + h.frame_height, | ||
| 172 | + h.upscaled_width, | ||
| 173 | + h.use_superres, | ||
| 174 | + h.superres_denom, | ||
| 175 | + h.order_hint, | ||
| 176 | + h.primary_ref_frame, | ||
| 177 | + h.refresh_frame_flags, | ||
| 178 | + h.ref_frame_idx, | ||
| 179 | + h.order_hints, | ||
| 180 | + h.ref_frame_sign_bias, | ||
| 181 | + h.error_resilient_mode, | ||
| 182 | + h.disable_cdf_update, | ||
| 183 | + h.allow_screen_content_tools, | ||
| 184 | + h.force_integer_mv, | ||
| 185 | + h.allow_intrabc, | ||
| 186 | + h.allow_high_precision_mv, | ||
| 187 | + h.interpolation_filter, | ||
| 188 | + h.is_motion_mode_switchable, | ||
| 189 | + h.use_ref_frame_mvs, | ||
| 190 | + h.quantization.base_q_idx, | ||
| 191 | + h.segmentation.enabled, | ||
| 192 | + h.delta.q_present, | ||
| 193 | + h.delta.lf_present, | ||
| 194 | + h.loop_filter.level, | ||
| 195 | + h.loop_filter.ref_deltas, | ||
| 196 | + h.loop_filter.mode_deltas, | ||
| 197 | + h.cdef.bits, | ||
| 198 | + h.loop_restoration.frame_restoration_type, | ||
| 199 | + h.tx_mode, | ||
| 200 | + h.reference_select, | ||
| 201 | + h.skip_mode_present, | ||
| 202 | + h.skip_mode_frame, | ||
| 203 | + h.allow_warped_motion, | ||
| 204 | + h.reduced_tx_set, | ||
| 205 | + gm, | ||
| 206 | + h.film_grain.apply_grain, | ||
| 207 | + h.film_grain.grain_seed, | ||
| 208 | + h.coded_lossless, | ||
| 209 | + ); | ||
| 210 | + } | ||
| 145 | let t = &header.tile_info; | 211 | let t = &header.tile_info; |
| 146 | let entry = (t.cols, t.rows, t.uniform_spacing, t.context_update_tile_id); | 212 | let entry = (t.cols, t.rows, t.uniform_spacing, t.context_update_tile_id); |
| 147 | if !seen.contains(&entry) { | 213 | if !seen.contains(&entry) { |
crates/ec-av1/fixtures/reelb_arf_witness.obuadded+0 -0
Binary file changed
crates/ec-av1/src/decode.rsmodified+86 -1
| @@ -2652,6 +2652,18 @@ pub(crate) fn sub16_split_hits() -> usize { | |||
| 2652 | SUB16_SPLIT_HITS.with(|c| c.get()) | 2652 | SUB16_SPLIT_HITS.with(|c| c.get()) |
| 2653 | } | 2653 | } |
| 2654 | 2654 | ||
| 2655 | +// lane-frame36 r2: superblock-level strips ([`decode_block_rect64`]) whose | ||
| 2656 | +// luma transform is SPLIT and which therefore leave through that fn's early | ||
| 2657 | +// return -- the arm that published no `TXFM_CONTEXT` band until this round. | ||
| 2658 | +thread_local! { | ||
| 2659 | + static RECT64_SPLIT_TXFM_PUBLISH_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 2660 | +} | ||
| 2661 | + | ||
| 2662 | +/// Current value of `RECT64_SPLIT_TXFM_PUBLISH_HITS`. | ||
| 2663 | +pub(crate) fn rect64_split_txfm_publish_hits() -> usize { | ||
| 2664 | + RECT64_SPLIT_TXFM_PUBLISH_HITS.with(|c| c.get()) | ||
| 2665 | +} | ||
| 2666 | + | ||
| 2655 | /// Current value of `RECT4_COEFF_HITS`. | 2667 | /// Current value of `RECT4_COEFF_HITS`. |
| 2656 | pub(crate) fn rect4_coeff_hits() -> usize { | 2668 | pub(crate) fn rect4_coeff_hits() -> usize { |
| 2657 | RECT4_COEFF_HITS.with(|c| c.get()) | 2669 | RECT4_COEFF_HITS.with(|c| c.get()) |
| @@ -7567,11 +7579,18 @@ fn decode_intra_rect_in_inter( | |||
| 7567 | // The INTER frame's own `TXFM_CONTEXT` bands, not the key frame's | 7579 | // The INTER frame's own `TXFM_CONTEXT` bands, not the key frame's |
| 7568 | // deblock-grid approximation -- [`tx_size_context_txfm_rect`]. | 7580 | // deblock-grid approximation -- [`tx_size_context_txfm_rect`]. |
| 7569 | let ctx = tx_size_context_txfm_rect(neighbours, (mi_r, mi_c), bw.min(64), bh.min(64)); | 7581 | let ctx = tx_size_context_txfm_rect(neighbours, (mi_r, mi_c), bw.min(64), bh.min(64)); |
| 7570 | - match tx_cat { | 7582 | + let d = match tx_cat { |
| 7571 | 1 => dec.symbol(&mut cdfs.tx_size_cat1[ctx]), | 7583 | 1 => dec.symbol(&mut cdfs.tx_size_cat1[ctx]), |
| 7572 | 2 => dec.symbol(&mut cdfs.tx_size_cat2[ctx]), | 7584 | 2 => dec.symbol(&mut cdfs.tx_size_cat2[ctx]), |
| 7573 | _ => dec.symbol(&mut cdfs.tx_size_cat3[ctx]), | 7585 | _ => dec.symbol(&mut cdfs.tx_size_cat3[ctx]), |
| 7586 | + }; | ||
| 7587 | + if std::env::var_os("EC_TRACE_MODE_STEP").is_some() { | ||
| 7588 | + eprintln!( | ||
| 7589 | + "EC_ISTEP mi_row={mi_r} mi_col={mi_c} name=tx_depth val={d} ctx={ctx} cat={tx_cat} rng={}", | ||
| 7590 | + dec.debug_state().0 | ||
| 7591 | + ); | ||
| 7574 | } | 7592 | } |
| 7593 | + d | ||
| 7575 | } else { | 7594 | } else { |
| 7576 | 0 | 7595 | 0 |
| 7577 | }; | 7596 | }; |
| @@ -8628,6 +8647,13 @@ fn decode_block_rect4( | |||
| 8628 | if !skip { | 8647 | if !skip { |
| 8629 | RECT4_COEFF_HITS.with(|c| c.set(c.get() + 1)); | 8648 | RECT4_COEFF_HITS.with(|c| c.set(c.get() + 1)); |
| 8630 | } | 8649 | } |
| 8650 | + // lane-frame36 r2 (same shape as `decode_block_rect64`'s split arm, | ||
| 8651 | + // swept this round): `set_txfm_ctxs` runs for EVERY block of an inter | ||
| 8652 | + // frame, so this 1:4 strip -- which is also the INTER frame's reader | ||
| 8653 | + // for 32x8/8x32 ([`decode_intra_rect4_in_inter`]) -- publishes its | ||
| 8654 | + // transform size in both TXFM_CONTEXT bands. Without it the next block | ||
| 8655 | + // reads the row's stale value. | ||
| 8656 | + txfm_partition_update_rect(neighbours, (mi_r, mi_c), (tx_w, tx_h), (bw, bh)); | ||
| 8631 | return Ok((mode, uv_predict_mode)); | 8657 | return Ok((mode, uv_predict_mode)); |
| 8632 | } | 8658 | } |
| 8633 | // The coarse (16-px [`SUB`] cell) mode/side arrays cannot name a strip | 8659 | // The coarse (16-px [`SUB`] cell) mode/side arrays cannot name a strip |
| @@ -8778,6 +8804,13 @@ fn decode_block_rect4( | |||
| 8778 | } else { | 8804 | } else { |
| 8779 | RECT4_32_VERT_HITS.with(|c| c.set(c.get() + 1)); | 8805 | RECT4_32_VERT_HITS.with(|c| c.set(c.get() + 1)); |
| 8780 | } | 8806 | } |
| 8807 | + // lane-frame36 r2 (same shape as `decode_block_rect64`'s split arm, | ||
| 8808 | + // swept this round): `set_txfm_ctxs` runs for EVERY block of an inter | ||
| 8809 | + // frame, so this 1:4 strip -- which is also the INTER frame's reader | ||
| 8810 | + // for 32x8/8x32 ([`decode_intra_rect4_in_inter`]) -- publishes its | ||
| 8811 | + // transform size in both TXFM_CONTEXT bands. Without it the next block | ||
| 8812 | + // reads the row's stale value. | ||
| 8813 | + txfm_partition_update_rect(neighbours, (mi_r, mi_c), (bw, bh), (bw, bh)); | ||
| 8781 | return Ok((mode, uv_predict_mode)); | 8814 | return Ok((mode, uv_predict_mode)); |
| 8782 | }; | 8815 | }; |
| 8783 | if let Some(b) = &palette_y_buf { | 8816 | if let Some(b) = &palette_y_buf { |
| @@ -8840,6 +8873,13 @@ fn decode_block_rect4( | |||
| 8840 | } else { | 8873 | } else { |
| 8841 | RECT4_32_VERT_HITS.with(|c| c.set(c.get() + 1)); | 8874 | RECT4_32_VERT_HITS.with(|c| c.set(c.get() + 1)); |
| 8842 | } | 8875 | } |
| 8876 | + // lane-frame36 r2 (same shape as `decode_block_rect64`'s split arm, | ||
| 8877 | + // swept this round): `set_txfm_ctxs` runs for EVERY block of an inter | ||
| 8878 | + // frame, so this 1:4 strip -- which is also the INTER frame's reader | ||
| 8879 | + // for 32x8/8x32 ([`decode_intra_rect4_in_inter`]) -- publishes its | ||
| 8880 | + // transform size in both TXFM_CONTEXT bands. Without it the next block | ||
| 8881 | + // reads the row's stale value. | ||
| 8882 | + txfm_partition_update_rect(neighbours, (mi_r, mi_c), (bw, bh), (bw, bh)); | ||
| 8843 | Ok((mode, uv_predict_mode)) | 8883 | Ok((mode, uv_predict_mode)) |
| 8844 | } | 8884 | } |
| 8845 | 8885 | ||
| @@ -9404,6 +9444,17 @@ fn decode_rect4_16_strip( | |||
| 9404 | record_strip_palette( | 9444 | record_strip_palette( |
| 9405 | neighbours, lmi, bw, bh, pal_y_size, pal_y_colors, pal_uv_size, pal_uv_colors, | 9445 | neighbours, lmi, bw, bh, pal_y_size, pal_y_colors, pal_uv_size, pal_uv_colors, |
| 9406 | ); | 9446 | ); |
| 9447 | + // `set_txfm_ctxs(mbmi->tx_size, n4_w, n4_h, skip && is_inter, xd)` | ||
| 9448 | + // (libaom `decode_token_recon_block`, run for EVERY block of an inter | ||
| 9449 | + // frame): the above row records `tx_size_wide` over the block's width and | ||
| 9450 | + // the left column `tx_size_high` over its height. This 1:4 strip reader is | ||
| 9451 | + // also the INTER frame's reader for the shape ([`decode_intra_rect4_in_inter`]), | ||
| 9452 | + // and it published neither band -- so the block after a 64x16 strip read | ||
| 9453 | + // the row's init value 64 as its left transform height and took | ||
| 9454 | + // `tx_size_cat3` row 1 where libaom takes row 0 (lane-frame36 r1: the | ||
| 9455 | + // 3840x1608 10-bit stream's first silent wall, decode-order frame 33 at | ||
| 9456 | + // mi(16,480)). Same write as [`set_txfm_ctxs`], rect-aware. | ||
| 9457 | + txfm_partition_update_rect(neighbours, lmi, (tx_w, tx_h), (bw, bh)); | ||
| 9407 | Ok((mode, last_uv_mode, (tx_w, tx_h))) | 9458 | Ok((mode, last_uv_mode, (tx_w, tx_h))) |
| 9408 | } | 9459 | } |
| 9409 | 9460 | ||
| @@ -9598,6 +9649,16 @@ fn decode_block_rect64( | |||
| 9598 | let (puv_size, puv_colors) = | 9649 | let (puv_size, puv_colors) = |
| 9599 | palette_uv.as_ref().map_or((0, [0u16; 8]), |p| (p.size, p.u_colors)); | 9650 | palette_uv.as_ref().map_or((0, [0u16; 8]), |p| (p.size, p.u_colors)); |
| 9600 | neighbours.record_palette_uv_rect((mi_r, mi_c), bw, bh, puv_size, puv_colors); | 9651 | neighbours.record_palette_uv_rect((mi_r, mi_c), bw, bh, puv_size, puv_colors); |
| 9652 | + // lane-frame36 r2: `set_txfm_ctxs` runs for EVERY block and this early | ||
| 9653 | + // return skips the fn's own tail, so a SPLIT superblock-level strip | ||
| 9654 | + // published no TXFM_CONTEXT band and the next block read the row's init | ||
| 9655 | + // value 64 as its left transform height. Measured on the 10-bit | ||
| 9656 | + // 3840x1608 stream, decode-order frame 33: after the split 16x64 strip | ||
| 9657 | + // at mi(192,140) (`tx_depth=1` -> TX_16X32) the 32x64 block at | ||
| 9658 | + // mi(192,144) took `tx_size_cat3` row 2 where libaom takes row 1. The | ||
| 9659 | + // bands carry the SPLIT unit's size, not the block's. | ||
| 9660 | + txfm_partition_update_rect(neighbours, (mi_r, mi_c), (tx_w, tx_h), (bw, bh)); | ||
| 9661 | + RECT64_SPLIT_TXFM_PUBLISH_HITS.with(|c| c.set(c.get() + 1)); | ||
| 9601 | RECT_PARTITION_HITS.with(|c| c.set(c.get() + 1)); | 9662 | RECT_PARTITION_HITS.with(|c| c.set(c.get() + 1)); |
| 9602 | return Ok(()); | 9663 | return Ok(()); |
| 9603 | } | 9664 | } |
| @@ -9915,6 +9976,17 @@ fn decode_block_rect64( | |||
| 9915 | neighbours.record_palette_uv_rect((mi_r, mi_c), bw, bh, puv_size, puv_colors); | 9976 | neighbours.record_palette_uv_rect((mi_r, mi_c), bw, bh, puv_size, puv_colors); |
| 9916 | neighbours.fill_skip_grid_rect((mi_r, mi_c), bw / MI, bh / MI, skip); | 9977 | neighbours.fill_skip_grid_rect((mi_r, mi_c), bw / MI, bh / MI, skip); |
| 9917 | neighbours.fill_lf_grid_rect((mi_r, mi_c), bw / MI, bh / MI, tx_w as u8, tx_h as u8, 0); | 9978 | neighbours.fill_lf_grid_rect((mi_r, mi_c), bw / MI, bh / MI, tx_w as u8, tx_h as u8, 0); |
| 9979 | + // `set_txfm_ctxs(mbmi->tx_size, n4_w, n4_h, skip && is_inter, xd)` | ||
| 9980 | + // (libaom `decode_token_recon_block`, run for EVERY block of an inter | ||
| 9981 | + // frame): the above row records `tx_size_wide` over the block's width and | ||
| 9982 | + // the left column `tx_size_high` over its height. This 1:4 strip reader is | ||
| 9983 | + // also the INTER frame's reader for the shape ([`decode_intra_rect4_in_inter`]), | ||
| 9984 | + // and it published neither band -- so the block after a 64x16 strip read | ||
| 9985 | + // the row's init value 64 as its left transform height and took | ||
| 9986 | + // `tx_size_cat3` row 1 where libaom takes row 0 (lane-frame36 r1: the | ||
| 9987 | + // 3840x1608 10-bit stream's first silent wall, decode-order frame 33 at | ||
| 9988 | + // mi(16,480)). Same write as [`set_txfm_ctxs`], rect-aware. | ||
| 9989 | + txfm_partition_update_rect(neighbours, (mi_r, mi_c), (tx_w, tx_h), (bw, bh)); | ||
| 9918 | SB_RECT_HITS.with(|c| c.set(c.get() + 1)); | 9990 | SB_RECT_HITS.with(|c| c.set(c.get() + 1)); |
| 9919 | match (bw, bh) { | 9991 | match (bw, bh) { |
| 9920 | (64, 16) => SB_RECT4_HORZ_HITS.with(|c| c.set(c.get() + 1)), | 9992 | (64, 16) => SB_RECT4_HORZ_HITS.with(|c| c.set(c.get() + 1)), |
| @@ -13412,6 +13484,19 @@ fn tx_size_context_txfm(n: &Neighbours, (mi_r, mi_c): (usize, usize), side: usiz | |||
| 13412 | if has_left && n.left_inter[mi_r] { | 13484 | if has_left && n.left_inter[mi_r] { |
| 13413 | left = n.left_side_mi[mi_r] >= side; | 13485 | left = n.left_side_mi[mi_r] >= side; |
| 13414 | } | 13486 | } |
| 13487 | + if std::env::var_os("EC_TXCTX").is_some() { | ||
| 13488 | + eprintln!( | ||
| 13489 | + "EC_TXCTX mi={mi_r},{mi_c} own={side} ha={has_above} hl={has_left} \ | ||
| 13490 | + above_txfm={} left_txfm={} above_inter={} left_inter={} above_side={} left_side={} \ | ||
| 13491 | + above={above} left={left}", | ||
| 13492 | + n.above_txfm[mi_c], | ||
| 13493 | + n.left_txfm[mi_r], | ||
| 13494 | + n.above_inter[mi_c], | ||
| 13495 | + n.left_inter[mi_r], | ||
| 13496 | + n.above_side_mi[mi_c], | ||
| 13497 | + n.left_side_mi[mi_r], | ||
| 13498 | + ); | ||
| 13499 | + } | ||
| 13415 | match (has_above, has_left) { | 13500 | match (has_above, has_left) { |
| 13416 | (true, true) => usize::from(above) + usize::from(left), | 13501 | (true, true) => usize::from(above) + usize::from(left), |
| 13417 | (true, false) => usize::from(above), | 13502 | (true, false) => usize::from(above), |
crates/ec-av1/src/stream.rsmodified+66 -0
| @@ -30144,6 +30144,72 @@ mod tests { | |||
| 30144 | ); | 30144 | ); |
| 30145 | } | 30145 | } |
| 30146 | 30146 | ||
| 30147 | + /// lane-frame36 r2: the hidden-ARF witness. `crates/ec-av1/fixtures/ | ||
| 30148 | + /// reelb_arf_witness.obu`, 32126 bytes, sha256 | ||
| 30149 | + /// `7f3b060da5aa9c537633e760c4af71316237db7692f6ae0d459bd2c2dd867d37`: | ||
| 30150 | + /// the first 58 frame-carrying OBUs of a 2 s head cut of the 10-bit | ||
| 30151 | + /// 3840x1608 AV1 HDR10 stream, 40 decode-order frames, 37 shown. | ||
| 30152 | + /// | ||
| 30153 | + /// What it covers that no earlier fixture did: decode-order frame 33 is a | ||
| 30154 | + /// HIDDEN alt-ref (`show_frame=0`, order_hint 64, `cdef_bits=1`, loop | ||
| 30155 | + /// restoration `[Switchable, Sgrproj, Switchable]`, `skip_mode_frame` | ||
| 30156 | + /// [1,6]) -- the first frame of the stream carrying a SPLIT | ||
| 30157 | + /// superblock-level intra strip in an inter frame. Its 16x64 strip at | ||
| 30158 | + /// mi(192,140) reads `tx_depth=1` (TX_16X32), and until this round | ||
| 30159 | + /// [`decode_block_rect64`]'s split arm returned past the tail that | ||
| 30160 | + /// publishes the `TXFM_CONTEXT` bands, so the 32x64 block at mi(192,144) | ||
| 30161 | + /// read the row's init value 64 as its left transform height and took | ||
| 30162 | + /// `tx_size_cat3` row 2 where aomdec takes row 1 -- a desync no shown | ||
| 30163 | + /// frame exposed until the ARF was displayed (class | ||
| 30164 | + /// `gate-blind-to-hidden-frames`). | ||
| 30165 | + /// | ||
| 30166 | + /// The counter assert is on `rect64_split_txfm_publish_hits`, the split | ||
| 30167 | + /// arm that was silent, so a stream that stopped carrying the shape fails | ||
| 30168 | + /// the gate instead of passing it vacuously. | ||
| 30169 | + #[test] | ||
| 30170 | + fn a_10bit_film_hidden_arf_with_split_superblock_strips_decodes_pixel_exact() { | ||
| 30171 | + const NAME: &str = | ||
| 30172 | + "a_10bit_film_hidden_arf_with_split_superblock_strips_decodes_pixel_exact"; | ||
| 30173 | + if !have_ffmpeg() { | ||
| 30174 | + eprintln!("SKIP {NAME}: no ffmpeg"); | ||
| 30175 | + return; | ||
| 30176 | + } | ||
| 30177 | + let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")) | ||
| 30178 | + .join("fixtures/reelb_arf_witness.obu"); | ||
| 30179 | + let stream = std::fs::read(&path) | ||
| 30180 | + .unwrap_or_else(|e| panic!("{NAME}: reading {}: {e}", path.display())); | ||
| 30181 | + let (width, height) = (3840usize, 1608usize); | ||
| 30182 | + let before = crate::decode::rect64_split_txfm_publish_hits(); | ||
| 30183 | + let frames = match decode_stream(&stream) { | ||
| 30184 | + Ok(frames) => frames, | ||
| 30185 | + Err(e) => panic!("{NAME}: decode_stream refused: {e}"), | ||
| 30186 | + }; | ||
| 30187 | + let fired = crate::decode::rect64_split_txfm_publish_hits() - before; | ||
| 30188 | + assert!( | ||
| 30189 | + fired > 0, | ||
| 30190 | + "{NAME}: no split superblock-level strip in the stream -- the gate would be vacuous" | ||
| 30191 | + ); | ||
| 30192 | + assert_eq!(frames.len(), 37, "{NAME}: 37 shown frames"); | ||
| 30193 | + assert_eq!((frames[0].width, frames[0].height), (width, height)); | ||
| 30194 | + let ffmpeg_frames = ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len()); | ||
| 30195 | + assert_eq!( | ||
| 30196 | + ffmpeg_frames.len(), | ||
| 30197 | + frames.len(), | ||
| 30198 | + "{NAME}: ffmpeg returned {} frames, we decoded {}", | ||
| 30199 | + ffmpeg_frames.len(), | ||
| 30200 | + frames.len() | ||
| 30201 | + ); | ||
| 30202 | + for (i, (ours, theirs)) in frames.iter().zip(&ffmpeg_frames).enumerate() { | ||
| 30203 | + assert_eq!(ours.y, theirs.y, "{NAME}: frame {i} luma vs ffmpeg"); | ||
| 30204 | + assert_eq!(ours.u, theirs.u, "{NAME}: frame {i} U vs ffmpeg"); | ||
| 30205 | + assert_eq!(ours.v, theirs.v, "{NAME}: frame {i} V vs ffmpeg"); | ||
| 30206 | + } | ||
| 30207 | + eprintln!( | ||
| 30208 | + "{NAME}: 37 shown frames pixel-exact on every plane, \ | ||
| 30209 | + rect64_split_txfm_publish={fired}" | ||
| 30210 | + ); | ||
| 30211 | + } | ||
| 30212 | + | ||
| 30147 | 30213 | ||
| 30148 | /// lane-sub8x4 r2, the gate that lifts BOTH sub-8x8 intra refusals ("an | 30214 | /// lane-sub8x4 r2, the gate that lifts BOTH sub-8x8 intra refusals ("an |
| 30149 | /// intra 4x4 block inside an inter frame's sub-8x8 split" and "an intra | 30215 | /// intra 4x4 block inside an inter frame's sub-8x8 split" and "an intra |
lanes/frame36-r1.handoff.mdadded+76 -0
| @@ -0,0 +1,76 @@ | |||
| 1 | +# lane-frame36 r1 HANDOFF (branch `lane-frame36`) | ||
| 2 | + | ||
| 3 | +## Working stream (pinned prefix, not yet a repo fixture) | ||
| 4 | +`~/.cache/frame36-tmp/n58.obu` -- `python3 <scratch>/census4/trunc.py ~/.cache/hg-0.obu 58 <out>` | ||
| 5 | +of the 2 s head cut of the 10-bit 3840x1608 stream. 32126 bytes, | ||
| 6 | +sha256 `7f3b060da5aa9c537633e760c4af71316237db7692f6ae0d459bd2c2dd867d37`, | ||
| 7 | +md5 `1e93c12f622cd1fb0c1cd9485cd8932e`. 58 frame headers, 40 decoded frames, | ||
| 8 | +37 output frames. `ffmpeg -i n58.obu -pix_fmt yuv420p10le -f rawvideo` = 685393920 B. | ||
| 9 | + | ||
| 10 | +## What output frame 36 IS (EC_PROBE_HDR=1, a NEW rung added this round to decode_probe) | ||
| 11 | +The charter's `EC_PROBE_HDR` did not exist; it does now (`decode_probe.rs`, one line per | ||
| 12 | +frame header: type/show/showable/show_existing/refresh/refs/order hints/primary_ref/ | ||
| 13 | +q/seg/delta q,lf/lf levels+deltas/cdef bits/LR types/tx mode/ref_select/skip mode/warp/ | ||
| 14 | +reduced_tx/gm models/grain seed/lossless). | ||
| 15 | + | ||
| 16 | +* OUTPUT frame 36 = header **57**, a `show_existing_frame` of slot 6, whose content is the | ||
| 17 | + hidden frame coded at header **52** (`show=false showable=true`, order_hint 36, | ||
| 18 | + primary_ref=1, refresh 0x40, base_q 61, lf_level [1,1,4,0]). | ||
| 19 | +* The real first wrong frame is **decode-order frame 33 = header 49**: `show=false`, | ||
| 20 | + order_hint 64 (the next ARF), primary_ref=0, refresh 0x02, base_q 34, | ||
| 21 | + refs=[0,2,0,0,0,3,0], order_hints=[32,0,32,32,32,16,32], skip_mode_frame [1,6] | ||
| 22 | + (every other frame uses [1,5]). Fields NEW at this frame vs 0..48: | ||
| 23 | + **cdef_bits 0 -> 1** and **loop_restoration [None,None,None] -> [Switchable,Sgrproj,Switchable]** | ||
| 24 | + (both revert at header 50). First non-zero `lf_level` in the whole stream is header 47 | ||
| 25 | + ([4,4,0,0], luma only); first non-zero CHROMA lf level is header 50 ([3,3,1,1]). | ||
| 26 | + size/superres/seg/intrabc/hp_mv/reduced_tx/gm/tx_mode never change; gm is Identity throughout. | ||
| 27 | +* Decode-order frames 33,34,35,36 map to headers 49,50,51,52; the whole wall is | ||
| 28 | + "hidden ARF wrong -> everything that references it wrong" (class `gate-blind-to-hidden-frames`). | ||
| 29 | + | ||
| 30 | +## Stage narrowing (all on n58.obu, both sides run under systemd-run MemoryMax=6G) | ||
| 31 | +`EC_AV1_PREFILT_DUMP16` (ours) vs aomdec `EC_AV1_PREFILT_DUMP16` (the 8-bit | ||
| 32 | +`EC_AV1_PREFILT_DUMP` **segfaults on this 10-bit stream** -- use the 16 variants; | ||
| 33 | +aomdec has no POSTCDEF rung) at decode frame 33: prefilt already differs | ||
| 34 | +(12222910 B of 18524160), i.e. **prediction/residual, not deblock/CDEF/LR/film grain**. | ||
| 35 | + | ||
| 36 | +## First wrong pixel (BEFORE the fix) | ||
| 37 | +Prefilt frame 33: Y (x=1920, y=64) ours 173 vs aomdec 170; U/V first at (960,32). | ||
| 38 | +That is superblock (mi_row 16, mi_col 480), 64x64, PARTITION_NONE, intra, in an inter frame. | ||
| 39 | + | ||
| 40 | +## Ladder result (EC_TRACE_PART/EC_TRACE_MODE_STEP ours vs aomdec EC_TRACE=1+EC_TRACE_MODE_STEP=1) | ||
| 41 | +SB entry rng matches (36104 both). First diverging element: | ||
| 42 | +`tx_depth` at mi(16,480) -- ours `val=0 ctx=1 rng=56472`, aomdec `val=0 ctx=0 cat=3 rng=34964` | ||
| 43 | +(same value, wrong CDF ROW -> different range -> desync; class `wrong-alphabet-same-value`). | ||
| 44 | +`EC_TXCTX` (print added to `tx_size_context_txfm` this round) shows why: | ||
| 45 | +`left_txfm[16]=64` where libaom has the 64x16 strip's tx HEIGHT 16. | ||
| 46 | +The preceding SB (16,464) is PARTITION_HORZ_4 = four 64x16 INTRA strips inside an inter frame. | ||
| 47 | + | ||
| 48 | +## Root cause + fix (committed) | ||
| 49 | +`decode_block_rect64` / `decode_block_rect4` (the 1:4 strip readers, which are ALSO the inter | ||
| 50 | +frame's readers via `decode_intra_rect4_in_inter`, decode.rs ~7455) never published libaom's | ||
| 51 | +`set_txfm_ctxs` bands, so the next block read `TXFM_CTX_INIT` (64) as the left transform height. | ||
| 52 | +Fix = one call each to the existing `txfm_partition_update_rect(neighbours, at_mi, (tx_w,tx_h), (bw,bh))` | ||
| 53 | +at their tails (decode.rs:9389 area and :9911 area). | ||
| 54 | +Result on n58.obu: output frame 36 differing bytes **1992768 -> 765464**; decode-order | ||
| 55 | +prefilt f33 12222910 -> 6446616, f34 4549085 -> 1005614, f35 -> 759498, f36 -> 763799. | ||
| 56 | +Frames 0..32 and 37,38,39 stay byte-exact vs aomdec's own FINAL dump. | ||
| 57 | + | ||
| 58 | +## EXACT NEXT STEP | ||
| 59 | +The wall is NOT closed -- decode frame 33 (header 49) still differs. Redo the same ladder on the | ||
| 60 | +NEW binary: `EC_TRACE_PART=1 EC_TRACE_MODE_STEP=1` ours vs `EC_TRACE=1 EC_TRACE_MODE_STEP=1` | ||
| 61 | +aomdec, group lines into frames by the `EC_PART mi_row=0 mi_col=0 bsize=12` marker (ours now | ||
| 62 | +emits 40 groups, aomdec 40; our SB-root print skips the last partial SB row -- compare by | ||
| 63 | +`(mi_row,mi_col) -> rng`, our `ctx=` field is NOT aomdec's), find the first SB whose ENTRY rng | ||
| 64 | +differs in frame 33 and dump every line of the SB BEFORE it. Then: pin the prefix as | ||
| 65 | +`crates/ec-av1/fixtures/reelb_frame36_witness.obu` (`git add -f`) with a gate over every plane of | ||
| 66 | +every decode-order frame + a hard assert on `intra_rect4_in_inter` (this stream: 64x16=8 16x64=9), | ||
| 67 | +update gate_coverage, run the suite as a systemd unit, and re-probe the full `hg-0.obu`. | ||
| 68 | + | ||
| 69 | +## Artifacts (all under ~/.cache/frame36-tmp) | ||
| 70 | +`n58.obu`, `hdr58.txt` (58 EC_PROBE_HDR lines), `ours/` + `aom/` (FINAL dumps, 40 frames each), | ||
| 71 | +`opre/` + `apre/` (PREFILT16), `opd/` + `apd/` (POSTDEBLOCK16), `opart.txt`/`apart.txt`, | ||
| 72 | +`omode.txt`/`amode.txt`, `osb464.txt`/`asb464.txt`, `otx.txt`. | ||
| 73 | + | ||
| 74 | +EVIDENCE: ~/.cache/frame36-tmp/{o,r}.raw | release decode_probe + ffmpeg on the pinned 58-OBU prefix, diff16.py 3840x1608 | frames 0-35 0 bytes, frame 36 1992768 -> 765464 after the fix | ||
| 75 | +EVIDENCE: ~/.cache/frame36-tmp/{opre,apre}/p.f33 | ours EC_AV1_PREFILT_DUMP16 vs aomdec EC_AV1_PREFILT_DUMP16 | 12222910 differing bytes pre-filter => not a post-filter defect | ||
| 76 | +EVIDENCE: ~/.cache/frame36-tmp/{omode,amode}.txt | EC_TRACE_PART+EC_TRACE_MODE_STEP vs aomdec EC_TRACE+EC_TRACE_MODE_STEP | first diverging element tx_depth mi(16,480) ctx 1 vs 0, rng 56472 vs 34964 | ||
lanes/frame36-r2.handoff.mdadded+51 -0
| @@ -0,0 +1,51 @@ | |||
| 1 | +# lane-frame36 r2 HANDOFF (branch `lane-frame36`, tip c9e15d7) | ||
| 2 | + | ||
| 3 | +## Root causes this round | ||
| 4 | +1. FIXED (decode.rs:9594) -- `decode_block_rect64`'s `depth != 0` (split) arm returns | ||
| 5 | + early past the tail `txfm_partition_update_rect` r1 added, so a SPLIT superblock-level | ||
| 6 | + strip published NO `TXFM_CONTEXT` band. libaom's `set_txfm_ctxs` runs for every block | ||
| 7 | + with the SPLIT unit's size. Frame 33: the 16x64 strip at mi(192,140) reads `tx_depth=1` | ||
| 8 | + (TX_16X32), so libaom has `left_txfm=32`; ours kept 64 and the 32x64 intra block at | ||
| 9 | + mi(192,144) read `tx_size_cat3` row 2 where aomdec reads row 1 (same value, different | ||
| 10 | + range). | ||
| 11 | +2. FIXED by class sweep, latent (decode.rs:8625/8776/8839) -- `decode_block_rect4` (32-level | ||
| 12 | + 1:4 strips, also the inter frame's 32x8/8x32 intra reader) published the bands on none of | ||
| 13 | + its three exits. This stream carries no such block once frame 33 is correct (the 48/40 | ||
| 14 | + counters before the fix were phantoms of the desync). | ||
| 15 | + | ||
| 16 | +## Current divergence in decode frame 33 | ||
| 17 | +NONE. Ladder identical: every superblock ENTRY range of every traced frame equals aomdec's | ||
| 18 | +(ours[i] = aomdec[i+1]; our SB-root print skips the last partial SB row, and our group 0 | ||
| 19 | +holds frames 0+1). Pixel state: all 37 shown frames of the 58-OBU prefix are byte-exact vs | ||
| 20 | +ffmpeg, and all 48 frames of the whole 2 s head cut are byte-exact. | ||
| 21 | +Frame 36 differing bytes: 0 (1992768 before r1, 765464 at r1's tip fa20907). | ||
| 22 | + | ||
| 23 | +## Instrumentation added | ||
| 24 | +`EC_TRACE_MODE_STEP` now prints the oracle-format | ||
| 25 | +`EC_ISTEP mi_row=.. mi_col=.. name=tx_depth val=.. ctx=.. cat=.. rng=..` in | ||
| 26 | +`decode_intra_rect_in_inter` (decode.rs:7541) -- that line named root cause 1 in one run. | ||
| 27 | +Counter `decode::rect64_split_txfm_publish_hits()`. | ||
| 28 | + | ||
| 29 | +## Gate + fixture | ||
| 30 | +`crates/ec-av1/fixtures/reelb_arf_witness.obu` (32126 B, sha256 | ||
| 31 | +7f3b060da5aa9c537633e760c4af71316237db7692f6ae0d459bd2c2dd867d37, `git add -f`), | ||
| 32 | +gated by `a_10bit_film_hidden_arf_with_split_superblock_strips_decodes_pixel_exact` | ||
| 33 | +(stream.rs): every plane of all 37 shown frames vs ffmpeg + hard assert on the counter | ||
| 34 | +(4 on this stream). Ran alone: `ok. 1 passed`, 94.77 s. | ||
| 35 | +No refusal lifted, so refusal_inventory/gate_coverage are unchanged. | ||
| 36 | + | ||
| 37 | +## EXACT NEXT STEP | ||
| 38 | +1. Full suite (never run this round -- the r2 unit was cancelled at the turn cap): | ||
| 39 | + `systemd-run --user --unit=frame36-suite-$(date +%s) -p MemoryMax=10G --same-dir bash -lc | ||
| 40 | + 'EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-frame36 | ||
| 41 | + nice -n 10 cargo test -p ec-av1 --lib -j3 > $HOME/.cache/frame36-suite.log 2>&1'`. | ||
| 42 | + Known RED on main beecb64 (not this lane): | ||
| 43 | + `real_aomenc_1to4_streams_decode_pixel_exact_and_rect_vartx_leaves_fire_before_a_named_refusal`. | ||
| 44 | + 169 tests had passed, 0 failed, when the unit was cancelled. | ||
| 45 | +2. Then the next wall: cut a LONGER segment of the same stream (`ffmpeg -ss <t> -t 2 ... -f obu`) | ||
| 46 | + and re-run `decode_probe` + `diff16.py`; the 2 s head is now fully exact. | ||
| 47 | + | ||
| 48 | +## Artifacts (~/.cache/frame36-tmp) | ||
| 49 | +`n58.obu`, `r.raw`/`o2.raw` (prefix), `full_r.raw`/`full_o2.raw` (48-frame cut), | ||
| 50 | +`r2/omode5.txt` (ours ladder, post-fix), `r2/amode.txt` (aomdec ladder), | ||
| 51 | +`r2/split.py` + `r2/sb.py` (frame split / per-SB dump), `probe_r2.log` (post-fix counters). | ||
lanes/frame36-r2.report.mdadded+74 -0
| @@ -0,0 +1,74 @@ | |||
| 1 | +# lane-frame36 r2 report (branch `lane-frame36`) | ||
| 2 | + | ||
| 3 | +Tip: `c9e15d7` (r1 tip was `fa20907`). | ||
| 4 | + | ||
| 5 | +## Root cause found this round (one, entropy-level) | ||
| 6 | + | ||
| 7 | +`decode_block_rect64`'s `depth != 0` arm returns early, past the tail | ||
| 8 | +`txfm_partition_update_rect` that r1 added -- so a SPLIT superblock-level strip | ||
| 9 | +(64x16 / 16x64 / 64x32 / 32x64) published NO `TXFM_CONTEXT` band, and the next | ||
| 10 | +block read the row's init value 64 as its left transform height. libaom runs | ||
| 11 | +`set_txfm_ctxs(mbmi->tx_size, ...)` for every block, with the SPLIT unit's size. | ||
| 12 | + | ||
| 13 | +Measured (decode-order frame 33, the hidden ARF, of the 58-OBU prefix): the | ||
| 14 | +16x64 strip at mi(192,140) reads `tx_depth=1` -> TX_16X32, so libaom's | ||
| 15 | +`left_txfm_context[192]` is 32; ours stayed 64, and the 32x64 intra block at | ||
| 16 | +mi(192,144) read `tx_size_cat3` row 2 where aomdec reads row 1 -- same value, | ||
| 17 | +different range (class `wrong-alphabet-same-value`), desync to the end of the | ||
| 18 | +frame. Fix: `crates/ec-av1/src/decode.rs:9594` (one call), plus the counter | ||
| 19 | +`rect64_split_txfm_publish_hits` and the oracle-format | ||
| 20 | +`EC_ISTEP ... name=tx_depth ... cat=` print in `decode_intra_rect_in_inter` | ||
| 21 | +(decode.rs:7541) that named it. | ||
| 22 | + | ||
| 23 | +## Class sweep (same shape) | ||
| 24 | + | ||
| 25 | +`decode_block_rect4` (32-level 1:4 strips; also the inter frame's reader for an | ||
| 26 | +intra 32x8/8x32) published the bands on NONE of its three exits -- fixed the | ||
| 27 | +same way (decode.rs:8625/8776/8839). Latent here: once frame 33 decodes | ||
| 28 | +correctly this stream carries no intra 32x8/8x32 at all (the 48/40 counted | ||
| 29 | +before the fix were phantoms of the desync, class `counter-from-refused-stream`). | ||
| 30 | +The 48-frame decode was re-measured byte-exact WITH the sweep in. | ||
| 31 | + | ||
| 32 | +## Frame 33 state | ||
| 33 | + | ||
| 34 | +EXACT. Every superblock ENTRY range of every traced frame of the prefix equals | ||
| 35 | +aomdec's (39 groups ours vs 40 aomdec: our SB-root print skips the last partial | ||
| 36 | +SB row, and our group 0 holds frames 0+1; the mapping is ours[i] = aomdec[i+1]). | ||
| 37 | +No PREFILT16 stage compare was needed -- the pixels are equal. | ||
| 38 | + | ||
| 39 | +## Film (the 2 s head cut of the 10-bit 3840x1608 stream) | ||
| 40 | + | ||
| 41 | +`~/.cache/hg-0.obu`, 48 decode-order frames: differing bytes per frame | ||
| 42 | +`0,0,0,...,0` (all 48 zero) vs `ffmpeg -pix_fmt yuv420p10le`. The r1 wall | ||
| 43 | +(output frame 36, 765464 differing bytes; 1992768 before r1) is CLOSED. | ||
| 44 | + | ||
| 45 | +## Gate | ||
| 46 | + | ||
| 47 | +`a_10bit_film_hidden_arf_with_split_superblock_strips_decodes_pixel_exact` | ||
| 48 | +(`crates/ec-av1/src/stream.rs`), fixture `crates/ec-av1/fixtures/reelb_arf_witness.obu` | ||
| 49 | +(32126 B, sha256 7f3b060da5aa9c537633e760c4af71316237db7692f6ae0d459bd2c2dd867d37, | ||
| 50 | +`git add -f`): every plane of all 37 shown frames vs ffmpeg, hard assert | ||
| 51 | +`rect64_split_txfm_publish_hits > 0` (4 on this stream). | ||
| 52 | +Command: | ||
| 53 | +`EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-frame36 cargo test -p ec-av1 --lib a_10bit_film_hidden_arf_with_split_superblock_strips -- --nocapture` | ||
| 54 | +Result: `ok. 1 passed`, 94.77 s. | ||
| 55 | + | ||
| 56 | +## Refusals | ||
| 57 | + | ||
| 58 | +None lifted this round (the defect was a wrong decode, not a refusal), so | ||
| 59 | +`refusal_inventory.rs` is unchanged; `gate_coverage.rs` needs no entry either -- | ||
| 60 | +this gate runs a pinned film stream, not an `aomenc` recipe. | ||
| 61 | + | ||
| 62 | +## EVIDENCE | ||
| 63 | + | ||
| 64 | +EVIDENCE: ~/.cache/frame36-tmp/r2/{omode5,amode}.txt | ours EC_TRACE_PART+EC_TRACE_MODE+EC_TRACE_MODE_STEP vs aomdec EC_TRACE+EC_TRACE_MODE+EC_TRACE_MODE_STEP+EC_VARTX on the 58-OBU prefix, SB-root range compare per frame | 0 differing superblock entry ranges in every frame (was: first diff at SB(192,160) of frame 33, 38758 vs 39618) | ||
| 65 | +EVIDENCE: ~/.cache/frame36-tmp/{o2.raw,r.raw} | decode_probe EC_PROBE_OUT16 vs ffmpeg -pix_fmt yuv420p10le on the 58-OBU prefix, diff16.py 3840x1608 | all 37 output frames 0 differing bytes (frame 36 was 765464) | ||
| 66 | +EVIDENCE: ~/.cache/frame36-tmp/{full_o2.raw,full_r.raw} | same, on the whole 48-frame 2 s head cut | all 48 frames 0 differing bytes | ||
| 67 | +EVIDENCE: ~/.cache/frame36-tmp/r2/omode4.txt | ours EC_TXCTX at mi(192,144) | above_txfm=64 left_txfm=64 -> ctx 2, aomdec ctx 1: the stale left band | ||
| 68 | + | ||
| 69 | +## Residue | ||
| 70 | + | ||
| 71 | +- accepted: our `EC_TRACE_PART` SB-root print skips the last partial SB row | ||
| 72 | + (tracing only; pixels of those rows are compared and exact). | ||
| 73 | +- deferred(a longer film cut): only the 2 s head is proven; the next wall in the | ||
| 74 | + full film is unmeasured -- the census under `lanes/` is the unblocker. | ||