lane-unwritten-dep r4: the r2 story was still in the source; the gate now pins the call site
Browse files at this commitc14e1db35dc55124238338ce11118e35d083006fParent: 9e84e983 changed files +190 -66
- crates/ec-av1/src/decode.rs +54 -27
- crates/ec-av1/src/stream.rs +78 -22
- lanes/unwritten-dep.report.md +58 -17
crates/ec-av1/src/decode.rsmodified+54 -27
| @@ -21635,28 +21635,46 @@ fn refuse_invalid_plane_block(_bw: usize, _bh: usize, _fctx: &crate::decode::Fra | |||
| 21635 | /// the output does not depend on the plane buffer's initial content. | 21635 | /// the output does not depend on the plane buffer's initial content. |
| 21636 | const PLANE_SENTINEL: u16 = 0xDEAD; | 21636 | const PLANE_SENTINEL: u16 = 0xDEAD; |
| 21637 | 21637 | ||
| 21638 | -/// lane-unwritten-dep: the census count at the LAST point of the pipeline, after | 21638 | +/// lane-unwritten-dep: the census count at the LAST point of the pipeline, on the |
| 21639 | -/// deblock/CDEF/LR -- i.e. on the exact bytes `EC_AV1_FINAL_DUMP` writes. | 21639 | +/// exact bytes `EC_AV1_FINAL_DUMP` writes. |
| 21640 | /// | 21640 | /// |
| 21641 | -/// WHY A SECOND COUNT (the pre-deblock one is not enough, and this is the | 21641 | +/// WHY A SECOND COUNT, and what it is actually for -- the justification this |
| 21642 | -/// measured reason, not a guess): on `440_request_is_422` the pre-deblock plane | 21642 | +/// comment originally carried was WRONG and is corrected here, because a reader |
| 21643 | -/// is BYTE-IDENTICAL between an uninitialised and a `PLANE_SENTINEL`-filled run | 21643 | +/// would otherwise re-derive the wrong conclusion. An earlier revision of this |
| 21644 | -/// (0 sentinel samples in both) while the final output differs by 1986 bytes, | 21644 | +/// lane claimed the pre-deblock plane was byte-identical plain-vs-sentinel and |
| 21645 | -/// all of it in the U/V planes' rows 30..63. The deblock pass is where the | 21645 | +/// that "deblock creates the dependence". That reading came from |
| 21646 | -/// dependence is CREATED: `EC_AV1_POSTDEBLOCK_DUMP16` is identical pre-deblock | 21646 | +/// [`dump_stage16`], which cropped chroma as `(fw/2, fh/2)` -- a 4:2:0 |
| 21647 | -/// and differs by 26 bytes post-deblock, and `EC_AV1_DEBUG_SKIP_DEBLOCK=1` does | 21647 | +/// assumption. On a 64x64 4:2:2 frame (ss_x=1, ss_y=0) that wrote 32x32 chroma |
| 21648 | -/// not remove the difference. So a pre-deblock scan cannot see a hole the loop | 21648 | +/// where the frame carries 32x64, so 2048 chroma samples appeared in NO stage |
| 21649 | -/// filter then READS: deblock reads a neighbour to decide an edge, so an | 21649 | +/// dump, and they are exactly the region where the difference lives. |
| 21650 | -/// unwritten sample changes its neighbour's filtered value even when the | ||
| 21651 | -/// unwritten sample itself is overwritten afterwards. | ||
| 21652 | /// | 21650 | /// |
| 21653 | -/// This count is the same measurement taken where the output is taken, so it is | 21651 | +/// With per-axis extents the corrected measurement on `440_request_is_422` is: |
| 21654 | -/// what a gate can assert: "no sample the tile walk never wrote survives into the | 21652 | +/// the PRE-DEBLOCK dump already DIFFERS by 2158 bytes plain-vs-sentinel, and an |
| 21655 | -/// frame the caller receives". Zero here AND zero pre-deblock = no dependence; | 21653 | +/// exact u16 whole-plane census finds 224 unwritten samples (U 112, V 112, |
| 21656 | -/// non-zero here with zero pre-deblock = a loop-filter read, named. | 21654 | +/// rows 36..63, whole 4x4 groups) -- the same number |
| 21655 | +/// `lanes/av1unwritten.report.md` reports. **The hole is present before any | ||
| 21656 | +/// filter runs, and the pre-deblock census sees it.** This comment previously | ||
| 21657 | +/// said the opposite; that was the instrument's blind spot read as a property of | ||
| 21658 | +/// the pipeline. | ||
| 21659 | +/// | ||
| 21660 | +/// So what this second count is FOR, stated honestly: it is not there because the | ||
| 21661 | +/// pre-deblock census misses holes. It is there because it is the measurement | ||
| 21662 | +/// taken where the OUTPUT is taken -- the bytes stored into the reference slots | ||
| 21663 | +/// and handed to the caller. A hole can be created after reconstruction (a | ||
| 21664 | +/// filter stage, a superres step, a second pass) and be invisible to a scan taken | ||
| 21665 | +/// before it; this one cannot. It is a check on the whole span from the tile walk | ||
| 21666 | +/// to the caller's frame, not a claim that the pre-deblock scan is insufficient. | ||
| 21657 | static FINAL_UNWRITTEN_SAMPLES: std::sync::atomic::AtomicUsize = | 21667 | static FINAL_UNWRITTEN_SAMPLES: std::sync::atomic::AtomicUsize = |
| 21658 | std::sync::atomic::AtomicUsize::new(0); | 21668 | std::sync::atomic::AtomicUsize::new(0); |
| 21659 | 21669 | ||
| 21670 | +/// Samples [`census_unwritten_final`] has looked at since the last | ||
| 21671 | +/// [`take_final_census_scanned`]. A gate that only asserts | ||
| 21672 | +/// [`take_final_unwritten_samples`] == 0 passes on a build whose census call was | ||
| 21673 | +/// deleted, so it reads THIS too -- the same pairing | ||
| 21674 | +/// [`CENSUS_SCANNED`] documents for the pre-deblock census. | ||
| 21675 | +static FINAL_CENSUS_SCANNED: std::sync::atomic::AtomicUsize = | ||
| 21676 | + std::sync::atomic::AtomicUsize::new(0); | ||
| 21677 | + | ||
| 21660 | /// lane-unwritten-dep: reads and clears [`FINAL_UNWRITTEN_SAMPLES`] -- unwritten | 21678 | /// lane-unwritten-dep: reads and clears [`FINAL_UNWRITTEN_SAMPLES`] -- unwritten |
| 21661 | /// samples still present in the frame as handed to the caller, summed over every | 21679 | /// samples still present in the frame as handed to the caller, summed over every |
| 21662 | /// frame and plane. Process-global, like the pre-deblock census's counter, so a | 21680 | /// frame and plane. Process-global, like the pre-deblock census's counter, so a |
| @@ -21666,26 +21684,35 @@ pub fn take_final_unwritten_samples() -> usize { | |||
| 21666 | FINAL_UNWRITTEN_SAMPLES.swap(0, std::sync::atomic::Ordering::SeqCst) | 21684 | FINAL_UNWRITTEN_SAMPLES.swap(0, std::sync::atomic::Ordering::SeqCst) |
| 21667 | } | 21685 | } |
| 21668 | 21686 | ||
| 21687 | +/// Reads and clears [`FINAL_CENSUS_SCANNED`]; the pairing is the reason it | ||
| 21688 | +/// exists, exactly as for [`take_census_scanned`]. | ||
| 21689 | +pub fn take_final_census_scanned() -> usize { | ||
| 21690 | + FINAL_CENSUS_SCANNED.swap(0, std::sync::atomic::Ordering::SeqCst) | ||
| 21691 | +} | ||
| 21692 | + | ||
| 21669 | /// lane-unwritten-dep: the census at the pipeline's last point. Counts, over each | 21693 | /// lane-unwritten-dep: the census at the pipeline's last point. Counts, over each |
| 21670 | -/// plane's true extent, how many samples still hold [`PLANE_SENTINEL`] once every | 21694 | +/// plane, how many samples still hold [`PLANE_SENTINEL`] once every filter has |
| 21671 | -/// filter has run. Env-gated on the same flag as [`fresh_plane`] (there is no | 21695 | +/// run, and records how many samples it LOOKED at in [`FINAL_CENSUS_SCANNED`]. |
| 21672 | -/// separate one: the fill and the census must agree on when they are live). | ||
| 21673 | /// | 21696 | /// |
| 21674 | -/// Scans IN PLACE at the point the picture is finished, which is what | 21697 | +/// Gated on [`plane_sentinel_on`] -- the SAME predicate as [`fresh_plane`] and as |
| 21675 | -/// distinguishes it from the pre-deblock census: this one sees what the caller | 21698 | +/// the pre-deblock [`census_unwritten`]: the env flag OR the thread-local |
| 21676 | -/// receives. | 21699 | +/// [`set_plane_sentinel`] override. An earlier revision gated this on the raw env |
| 21700 | +/// var alone, which made the census silently inert for any in-process test using | ||
| 21701 | +/// the thread-local switch that the rest of the crate honours. The fill and both | ||
| 21702 | +/// censuses must agree on when they are live, or a "0" means nothing. | ||
| 21677 | pub(crate) fn census_unwritten_final(y: &[u16], u: &[u16], v: &[u16]) { | 21703 | pub(crate) fn census_unwritten_final(y: &[u16], u: &[u16], v: &[u16]) { |
| 21678 | - if !crate::envflags::env_flag!("EC_AV1_PLANE_SENTINEL") { | 21704 | + if !plane_sentinel_on() { |
| 21679 | return; | 21705 | return; |
| 21680 | } | 21706 | } |
| 21681 | // The caller passes the frame's planes exactly as they are about to be | 21707 | // The caller passes the frame's planes exactly as they are about to be |
| 21682 | // stored into the reference slots, which are already cropped to the true | 21708 | // stored into the reference slots, which are already cropped to the true |
| 21683 | // extent (no padding past it reaches this point), so a flat count over | 21709 | // extent (no padding past it reaches this point), so a flat count over |
| 21684 | // each plane IS the true-extent count. | 21710 | // each plane IS the true-extent count. |
| 21685 | - let total: usize = [y, u, v] | 21711 | + let (scanned, total): (usize, usize) = [y, u, v] |
| 21686 | .iter() | 21712 | .iter() |
| 21687 | - .map(|p| p.iter().filter(|&&s| s == PLANE_SENTINEL).count()) | 21713 | + .map(|p| (p.len(), p.iter().filter(|&&s| s == PLANE_SENTINEL).count())) |
| 21688 | - .sum(); | 21714 | + .fold((0, 0), |(a, b), (c, d)| (a + c, b + d)); |
| 21715 | + FINAL_CENSUS_SCANNED.fetch_add(scanned, std::sync::atomic::Ordering::SeqCst); | ||
| 21689 | FINAL_UNWRITTEN_SAMPLES.fetch_add(total, std::sync::atomic::Ordering::SeqCst); | 21716 | FINAL_UNWRITTEN_SAMPLES.fetch_add(total, std::sync::atomic::Ordering::SeqCst); |
| 21690 | } | 21717 | } |
| 21691 | 21718 | ||
crates/ec-av1/src/stream.rsmodified+78 -22
| @@ -2221,14 +2221,28 @@ fn decode_frame( | |||
| 2221 | // (scripts/instrument-aom-oracle.sh rung 12), which is what makes a | 2221 | // (scripts/instrument-aom-oracle.sh rung 12), which is what makes a |
| 2222 | // hidden frame's pixels comparable at all. | 2222 | // hidden frame's pixels comparable at all. |
| 2223 | // lane-unwritten-dep: the census AT the output point, beside the dump that | 2223 | // lane-unwritten-dep: the census AT the output point, beside the dump that |
| 2224 | - // defines "the output". The pre-deblock census cannot see a hole the loop | 2224 | + // defines "the output" -- the same bytes, so the claim is about the frame the |
| 2225 | - // filter later READS: deblock reads a neighbour to decide an edge, so an | 2225 | + // caller receives rather than about an intermediate stage. |
| 2226 | - // unwritten sample changes its neighbour's filtered value even when the | 2226 | + // |
| 2227 | - // unwritten sample itself is overwritten afterwards. Measured on | 2227 | + // WHAT THIS IS FOR, corrected: an earlier revision of this comment said the |
| 2228 | - // `440_request_is_422`: pre-deblock 0 sentinel samples and byte-identical | 2228 | + // pre-deblock plane was byte-identical plain-vs-sentinel and that deblock |
| 2229 | - // plain-vs-sentinel, yet the final output differs by 1986 bytes, entering | 2229 | + // creates the dependence. That was wrong, and it was `dump_stage16`'s fault: |
| 2230 | - // the picture at the deblock pass (`EC_AV1_POSTDEBLOCK_DUMP16` is identical | 2230 | + // it cropped chroma as `(fw/2, fh/2)`, a 4:2:0 assumption, so on a 64x64 |
| 2231 | - // pre-deblock and differs by 26 bytes post-deblock). | 2231 | + // 4:2:2 frame 2048 chroma samples appeared in no stage dump at all -- exactly |
| 2232 | + // the region the difference lives in. With per-axis extents the corrected | ||
| 2233 | + // measurement on `440_request_is_422` is that the PRE-DEBLOCK dump already | ||
| 2234 | + // differs by 2158 bytes and an exact u16 census finds 224 unwritten samples | ||
| 2235 | + // (U 112, V 112, rows 36..63) -- the same count `lanes/av1unwritten.report.md` | ||
| 2236 | + // reports. The hole is present before any filter runs, and the pre-deblock | ||
| 2237 | + // census SEES it. | ||
| 2238 | + // | ||
| 2239 | + // So this second census is not a patch for a blind pre-deblock scan. It is | ||
| 2240 | + // the measurement taken where the output is taken, which covers the whole span | ||
| 2241 | + // from the tile walk to the caller's frame: anything a later stage could | ||
| 2242 | + // introduce (a filter, superres, a second pass) is inside its extent, where | ||
| 2243 | + // a scan taken before it would not be. It also runs before `apply_grain`, so | ||
| 2244 | + // the claim is over the PRE-GRAIN planes -- the bytes the reference bank | ||
| 2245 | + // stores and every later frame predicts from. | ||
| 2232 | decode::census_unwritten_final(&picture.y, &picture.u, &picture.v); | 2246 | decode::census_unwritten_final(&picture.y, &picture.u, &picture.v); |
| 2233 | if let Some(prefix) = final_dump { | 2247 | if let Some(prefix) = final_dump { |
| 2234 | use std::io::Write; | 2248 | use std::io::Write; |
| @@ -48221,12 +48235,12 @@ exit 0 | |||
| 48221 | /// | 48235 | /// |
| 48222 | /// SCOPE, stated rather than implied: the census is taken where | 48236 | /// SCOPE, stated rather than implied: the census is taken where |
| 48223 | /// `EC_AV1_FINAL_DUMP` writes, which is BEFORE `apply_grain`. The claim is | 48237 | /// `EC_AV1_FINAL_DUMP` writes, which is BEFORE `apply_grain`. The claim is |
| 48224 | - /// therefore over the PRE-GRAIN planes -- which is also the claim that matters | 48238 | + /// therefore over the PRE-GRAIN planes -- which are also the bytes the |
| 48225 | - /// most, because those exact bytes are what the reference bank stores and what | 48239 | + /// reference bank stores and every later frame predicts from, the dependency |
| 48226 | - /// every later frame predicts from. Film grain synthesises from that pre-grain | 48240 | + /// that matters. Whether `apply_grain` can itself introduce a hole is NOT |
| 48227 | - /// frame plus the grain parameters and does not read the plane buffer, so it | 48241 | + /// measured: the census never sees the planes `apply_grain` allocates. So the |
| 48228 | - /// cannot introduce a hole. The claim is NOT "the caller's final grained | 48242 | + /// claim is NOT "the caller's final grained picture has no hole", and nothing |
| 48229 | - /// picture has no hole" and is not asserted. | 48243 | + /// here asserts that grain cannot introduce one. |
| 48230 | /// | 48244 | /// |
| 48231 | /// NON-VACUITY, the part that makes this gate worth having: a census is only a | 48245 | /// NON-VACUITY, the part that makes this gate worth having: a census is only a |
| 48232 | /// measurement if it CAN report non-zero. The control is a SYNTHETIC positive | 48246 | /// measurement if it CAN report non-zero. The control is a SYNTHETIC positive |
| @@ -48238,6 +48252,20 @@ exit 0 | |||
| 48238 | /// cannot change behaviour when a lane lands. It is proven by mutation in the | 48252 | /// cannot change behaviour when a lane lands. It is proven by mutation in the |
| 48239 | /// same run: neutering `census_unwritten_final` reds it (lane report §5). | 48253 | /// same run: neutering `census_unwritten_final` reds it (lane report §5). |
| 48240 | /// | 48254 | /// |
| 48255 | + /// WHAT THIS IS NOT, corrected from an earlier revision of this comment: it | ||
| 48256 | + /// does NOT rest on a claim that the pre-deblock census is blind. That claim | ||
| 48257 | + /// was wrong. It came from `dump_stage16` cropping chroma as `(fw/2, fh/2)` -- | ||
| 48258 | + /// a 4:2:0 assumption -- so on a 64x64 4:2:2 frame 2048 chroma samples were in | ||
| 48259 | + /// no stage dump at all, and an earlier revision read that blind spot as | ||
| 48260 | + /// "identical pre-deblock, so deblock creates the dependence". With per-axis | ||
| 48261 | + /// extents the corrected measurement is the opposite: the pre-deblock dump on | ||
| 48262 | + /// `440_request_is_422` already DIFFERS by 2158 bytes and the exact u16 census | ||
| 48263 | + /// finds 224 unwritten samples (U 112, V 112, rows 36..63, whole 4x4 groups) -- | ||
| 48264 | + /// the same count `lanes/av1unwritten.report.md` reports. The hole is present | ||
| 48265 | + /// before any filter runs and the pre-deblock census SEES it. This census is | ||
| 48266 | + /// here because it is the measurement taken where the OUTPUT is taken, which | ||
| 48267 | + /// spans the whole route from the tile walk to the caller. | ||
| 48268 | + /// | ||
| 48241 | /// The four film fixtures are the corpus's real 10-bit streams with hidden | 48269 | /// The four film fixtures are the corpus's real 10-bit streams with hidden |
| 48242 | /// alt-refs -- the shapes where a hidden frame's unwritten region would feed | 48270 | /// alt-refs -- the shapes where a hidden frame's unwritten region would feed |
| 48243 | /// a later DISPLAYED frame through the reference bank, which is the only way | 48271 | /// a later DISPLAYED frame through the reference bank, which is the only way |
| @@ -48269,7 +48297,7 @@ exit 0 | |||
| 48269 | // the fill cannot be switched from inside a test process. The child | 48297 | // the fill cannot be switched from inside a test process. The child |
| 48270 | // process below is therefore how the measurement is taken; what the | 48298 | // process below is therefore how the measurement is taken; what the |
| 48271 | // parent asserts is the CHILD's reported count. | 48299 | // parent asserts is the CHILD's reported count. |
| 48272 | - let census = |fixture: &str| -> usize { | 48300 | + let census = |fixture: &str| -> (usize, usize) { |
| 48273 | let exe = std::env::current_exe().expect("test binary path"); | 48301 | let exe = std::env::current_exe().expect("test binary path"); |
| 48274 | let out = std::process::Command::new(exe) | 48302 | let out = std::process::Command::new(exe) |
| 48275 | .args([ | 48303 | .args([ |
| @@ -48290,7 +48318,7 @@ exit 0 | |||
| 48290 | ); | 48318 | ); |
| 48291 | text.lines() | 48319 | text.lines() |
| 48292 | .find_map(|l| l.strip_prefix("UWDEP_CENSUS ")) | 48320 | .find_map(|l| l.strip_prefix("UWDEP_CENSUS ")) |
| 48293 | - .and_then(|v| v.split_whitespace().next().and_then(|n| n.parse().ok())) | 48321 | + .and_then(parse_census_line) |
| 48294 | .unwrap_or_else(|| { | 48322 | .unwrap_or_else(|| { |
| 48295 | panic!( | 48323 | panic!( |
| 48296 | "{NAME}: the census child reported no count for {fixture} \ | 48324 | "{NAME}: the census child reported no count for {fixture} \ |
| @@ -48305,7 +48333,12 @@ exit 0 | |||
| 48305 | // report exactly that number. No fixture is involved, so this cannot be | 48333 | // report exactly that number. No fixture is involved, so this cannot be |
| 48306 | // affected by lane/av1unwritten refusing `440_request_is_422` on merge. | 48334 | // affected by lane/av1unwritten refusing `440_request_is_422` on merge. |
| 48307 | // The fill is env-gated, so even this runs in the child. | 48335 | // The fill is env-gated, so even this runs in the child. |
| 48308 | - let synthetic = census_synthetic(); | 48336 | + let (synthetic, synthetic_scanned) = census_synthetic(); |
| 48337 | + assert_eq!( | ||
| 48338 | + synthetic_scanned, 40, | ||
| 48339 | + "{NAME}: the synthetic control scanned {synthetic_scanned} samples, expected 40 \ | ||
| 48340 | + (16 + 16 + 8) -- the census did not look at what it was handed" | ||
| 48341 | + ); | ||
| 48309 | assert_eq!( | 48342 | assert_eq!( |
| 48310 | synthetic, 7, | 48343 | synthetic, 7, |
| 48311 | "{NAME}: the census reported {synthetic} for planes carrying exactly 7 sentinel \ | 48344 | "{NAME}: the census reported {synthetic} for planes carrying exactly 7 sentinel \ |
| @@ -48319,7 +48352,13 @@ exit 0 | |||
| 48319 | "gm_small_side_witness", | 48352 | "gm_small_side_witness", |
| 48320 | "reelc_sb128_inter_witness", | 48353 | "reelc_sb128_inter_witness", |
| 48321 | ] { | 48354 | ] { |
| 48322 | - let n = census(fixture); | 48355 | + let (n, scanned) = census(fixture); |
| 48356 | + assert!( | ||
| 48357 | + scanned > 0, | ||
| 48358 | + "{NAME}: the census scanned 0 samples on {fixture} -- the call at the output \ | ||
| 48359 | + point is not running, so the {n} below proves nothing (class: \ | ||
| 48360 | + census-never-ran). Deleting the call site reproduces this." | ||
| 48361 | + ); | ||
| 48323 | assert_eq!( | 48362 | assert_eq!( |
| 48324 | n, 0, | 48363 | n, 0, |
| 48325 | "{NAME}: {fixture} hands the caller {n} samples the tile walk never wrote" | 48364 | "{NAME}: {fixture} hands the caller {n} samples the tile walk never wrote" |
| @@ -48327,12 +48366,27 @@ exit 0 | |||
| 48327 | } | 48366 | } |
| 48328 | } | 48367 | } |
| 48329 | 48368 | ||
| 48369 | + /// Parses the child's `UWDEP_CENSUS <unwritten> frames=<n> scanned=<n>` line | ||
| 48370 | + /// into `(unwritten, scanned)`. The scanned count is what makes the fixture | ||
| 48371 | + /// arms meaningful: `unwritten == 0` is also what a build with the census call | ||
| 48372 | + /// deleted reports, and only a non-zero scanned count distinguishes "scanned | ||
| 48373 | + /// and found nothing" from "never scanned". | ||
| 48374 | + fn parse_census_line(v: &str) -> Option<(usize, usize)> { | ||
| 48375 | + let mut parts = v.split_whitespace(); | ||
| 48376 | + let unwritten = parts.next()?.parse().ok()?; | ||
| 48377 | + let scanned = parts | ||
| 48378 | + .find_map(|p| p.strip_prefix("scanned="))? | ||
| 48379 | + .parse() | ||
| 48380 | + .ok()?; | ||
| 48381 | + Some((unwritten, scanned)) | ||
| 48382 | + } | ||
| 48383 | + | ||
| 48330 | /// Runs the census child with `UWDEP_CENSUS_FIXTURE` UNSET, which makes it | 48384 | /// Runs the census child with `UWDEP_CENSUS_FIXTURE` UNSET, which makes it |
| 48331 | /// take the synthetic-positive path: hand [`census_unwritten_final`] planes | 48385 | /// take the synthetic-positive path: hand [`census_unwritten_final`] planes |
| 48332 | /// with a known number of `PLANE_SENTINEL` values and report what it counted. | 48386 | /// with a known number of `PLANE_SENTINEL` values and report what it counted. |
| 48333 | /// This is the non-vacuity control, and it is a direct function-level check | 48387 | /// This is the non-vacuity control, and it is a direct function-level check |
| 48334 | /// rather than a decode, so no fixture's decode behaviour can change it. | 48388 | /// rather than a decode, so no fixture's decode behaviour can change it. |
| 48335 | - fn census_synthetic() -> usize { | 48389 | + fn census_synthetic() -> (usize, usize) { |
| 48336 | const NAME: &str = "the_frame_the_caller_receives_carries_no_unwritten_plane_sample"; | 48390 | const NAME: &str = "the_frame_the_caller_receives_carries_no_unwritten_plane_sample"; |
| 48337 | let exe = std::env::current_exe().expect("test binary path"); | 48391 | let exe = std::env::current_exe().expect("test binary path"); |
| 48338 | let out = std::process::Command::new(exe) | 48392 | let out = std::process::Command::new(exe) |
| @@ -48353,7 +48407,7 @@ exit 0 | |||
| 48353 | ); | 48407 | ); |
| 48354 | text.lines() | 48408 | text.lines() |
| 48355 | .find_map(|l| l.strip_prefix("UWDEP_CENSUS ")) | 48409 | .find_map(|l| l.strip_prefix("UWDEP_CENSUS ")) |
| 48356 | - .and_then(|v| v.split_whitespace().next().and_then(|n| n.parse().ok())) | 48410 | + .and_then(parse_census_line) |
| 48357 | .unwrap_or_else(|| { | 48411 | .unwrap_or_else(|| { |
| 48358 | panic!( | 48412 | panic!( |
| 48359 | "{NAME}: the census child reported no synthetic count (child said: {:?})", | 48413 | "{NAME}: the census child reported no synthetic count (child said: {:?})", |
| @@ -48392,7 +48446,8 @@ exit 0 | |||
| 48392 | let _ = decode::take_final_unwritten_samples(); | 48446 | let _ = decode::take_final_unwritten_samples(); |
| 48393 | decode::census_unwritten_final(&a, &b, &c); | 48447 | decode::census_unwritten_final(&a, &b, &c); |
| 48394 | let n = decode::take_final_unwritten_samples(); | 48448 | let n = decode::take_final_unwritten_samples(); |
| 48395 | - println!("UWDEP_CENSUS {n} synthetic=1"); | 48449 | + let scanned = decode::take_final_census_scanned(); |
| 48450 | + println!("UWDEP_CENSUS {n} synthetic=1 scanned={scanned}"); | ||
| 48396 | return; | 48451 | return; |
| 48397 | } | 48452 | } |
| 48398 | let Ok(fixture) = std::env::var("UWDEP_CENSUS_FIXTURE") else { | 48453 | let Ok(fixture) = std::env::var("UWDEP_CENSUS_FIXTURE") else { |
| @@ -48407,7 +48462,8 @@ exit 0 | |||
| 48407 | let _ = decode::take_final_unwritten_samples(); | 48462 | let _ = decode::take_final_unwritten_samples(); |
| 48408 | let frames = decode_stream(&stream).unwrap_or_else(|e| panic!("{fixture} refused: {e}")); | 48463 | let frames = decode_stream(&stream).unwrap_or_else(|e| panic!("{fixture} refused: {e}")); |
| 48409 | let n = decode::take_final_unwritten_samples(); | 48464 | let n = decode::take_final_unwritten_samples(); |
| 48410 | - println!("UWDEP_CENSUS {n} frames={}", frames.len()); | 48465 | + let scanned = decode::take_final_census_scanned(); |
| 48466 | + println!("UWDEP_CENSUS {n} frames={} scanned={scanned}", frames.len()); | ||
| 48411 | } | 48467 | } |
| 48412 | 48468 | ||
| 48413 | /// lane-t900 r6: the 128-superblock INTER witness. | 48469 | /// lane-t900 r6: the 128-superblock INTER witness. |
lanes/unwritten-dep.report.mdmodified+58 -17
| @@ -131,10 +131,11 @@ region r2's conclusion was drawn from.** | |||
| 131 | **Coordinates, from the corrected pre-deblock dump** (8192 samples, u16, whole | 131 | **Coordinates, from the corrected pre-deblock dump** (8192 samples, u16, whole |
| 132 | plane, `0xDEAD` counted): | 132 | plane, `0xDEAD` counted): |
| 133 | 133 | ||
| 134 | -* unwritten samples, sentinel run: **U 112, V 112, Y 0** — U and V rows 36–63 | 134 | +* unwritten samples, sentinel run: **U 112, V 112, Y 0** — U and V, 28 whole |
| 135 | - (16 distinct rows), cols 0–15, in whole 4×4 groups (row 36: cols 0–3 and | 135 | + 4×4 groups each, spanning rows 36–63 (12 rows carrying 8 samples + 4 rows |
| 136 | - 12–15). **224 total, which is exactly lane/av1unwritten's own census number** | 136 | + carrying 4 = 96 + 16 = 112). The column span runs 0–15 but is NOT filled: |
| 137 | - (`lanes/av1unwritten.report.md:152-156`). | 137 | + every row has cols 0–3 and 12–15. **224 total, exactly lane/av1unwritten's own |
| 138 | + census number** (`lanes/av1unwritten.report.md:152-156`). | ||
| 138 | * plain vs sentinel differing samples, pre-deblock: **U 1004 of 2048, V 1004 of | 139 | * plain vs sentinel differing samples, pre-deblock: **U 1004 of 2048, V 1004 of |
| 139 | 2048, Y 0**, rows 32–63 — the hole plus everything predicted from it. | 140 | 2048, Y 0**, rows 32–63 — the hole plus everything predicted from it. |
| 140 | 141 | ||
| @@ -174,11 +175,12 @@ over the three planes at the point they are stored into the reference slots, wit | |||
| 174 | `stream.rs`: the census is called beside the `EC_AV1_FINAL_DUMP` site. | 175 | `stream.rs`: the census is called beside the `EC_AV1_FINAL_DUMP` site. |
| 175 | 176 | ||
| 176 | **SCOPE, stated not implied:** that point is **before `apply_grain`**, so the | 177 | **SCOPE, stated not implied:** that point is **before `apply_grain`**, so the |
| 177 | -claim is over the **pre-grain** planes. That is also the claim that matters | 178 | +claim is over the **pre-grain** planes only. Those are also the bytes the |
| 178 | -most — those exact bytes are what the reference bank stores and what every later | 179 | +reference bank stores and every later frame predicts from, which is the |
| 179 | -frame predicts from, and grain synthesises from the pre-grain frame plus the | 180 | +dependency that matters. Whether `apply_grain` can itself introduce a hole is |
| 180 | -grain parameters without reading the plane buffer. "The caller's final grained | 181 | +**not measured here** -- the census never sees the planes `apply_grain` |
| 181 | -picture has no hole" is **not** claimed and is not asserted. | 182 | +allocates -- so "the caller's final grained picture has no hole" is **not |
| 183 | +claimed**, and no sentence asserts that grain cannot introduce one. | ||
| 182 | 184 | ||
| 183 | Gate `the_frame_the_caller_receives_carries_no_unwritten_plane_sample`: | 185 | Gate `the_frame_the_caller_receives_carries_no_unwritten_plane_sample`: |
| 184 | 186 | ||
| @@ -198,23 +200,43 @@ meaningless zero. | |||
| 198 | merged into this branch (`c62eeda9`), then: | 200 | merged into this branch (`c62eeda9`), then: |
| 199 | 201 | ||
| 200 | ``` | 202 | ``` |
| 201 | -$ CARGO_TARGET_DIR=.../uwdep-merge cargo test -p ec-av1 --lib -- the_frame_the_caller_receives_carries_no_unwritten_plane_sample | 203 | +$ cargo test -p ec-av1 --lib -- the_frame_the_caller_receives_carries_no_unwritten_plane_sample |
| 202 | -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 816 filtered out; finished in 71.58s | 204 | +test result: ok. 1 passed; 0 failed; 0 ignored; 816 filtered out; finished in 71.59s |
| 203 | ``` | 205 | ``` |
| 204 | 206 | ||
| 205 | -816 filtered (vs 813 on the branch point) — the merged tree's extra tests are | 207 | +The proof that this tree really carries `av1unwritten`'s content is behavioural, |
| 206 | -present, so this is the gate running against both lanes' content, not one. | 208 | +not a test count (a filtered-test count is a count of names, and a merge that |
| 209 | +dropped hunks would print the same number): | ||
| 210 | + | ||
| 211 | +``` | ||
| 212 | +$ decode_probe crates/ec-av1/fixtures/440_request_is_422.obu | ||
| 213 | +REFUSED: unsupported: AV1 tile (a block size 4x8, 8x16 or 16x4 (or 8x4 at 4:4:0) has no | ||
| 214 | +chroma plane block at this frame's subsampling mode ... | ||
| 215 | +``` | ||
| 216 | + | ||
| 217 | +**0 frames, refused** — only reachable with the refusal present. On the branch | ||
| 218 | +point `8d6998d7` the same fixture decodes to `OK: 1 frames decoded`. That is the | ||
| 219 | +merge proof. (It is also why the fixture-carried control had to go: the census | ||
| 220 | +child could not run at all here.) | ||
| 207 | 221 | ||
| 208 | ### Mutations | 222 | ### Mutations |
| 209 | 223 | ||
| 210 | | mutation | result | | 224 | | mutation | result | |
| 211 | |---|---| | 225 | |---|---| |
| 212 | -| `census_unwritten_final` neutered (`if true { return; }`) | **RED**: "the census reported 0 for planes carrying exactly 7 sentinel samples … (class: census-silently-blind)" | | 226 | +| `census_unwritten_final` neutered (`if true { return; }`) | **RED** at the synthetic control: "the census reported 0 for planes carrying exactly 7 sentinel samples … (class: census-silently-blind)" | |
| 213 | -| the `census_unwritten_final` call removed from the output point | RED at the same control | | 227 | +| **the call at `stream.rs` DELETED** (the whole line replaced by a `let _ =`) | **RED**: "the census scanned 0 samples on reelb_arf_witness -- the call at the output point is not running, so the 0 below proves nothing (class: census-never-ran). Deleting the call site reproduces this." | |
| 214 | | one sentinel sample forced into a film frame's output (`p.y[0] = 0xDEAD`) | RED on the fixture: "reelb_arf_witness hands the caller N samples the tile walk never wrote" | | 228 | | one sentinel sample forced into a film frame's output (`p.y[0] = 0xDEAD`) | RED on the fixture: "reelb_arf_witness hands the caller N samples the tile walk never wrote" | |
| 215 | 229 | ||
| 216 | -The first is the non-vacuity proof in the same run, and it no longer depends on | 230 | +The second row was **false as stated in r3** and is the substantive fix here: r3's |
| 217 | -any fixture's decode behaviour. | 231 | +control called `census_unwritten_final` directly, so deleting the pipeline call |
| 232 | +left every assertion passing and the gate pinned nothing about the decode. The | ||
| 233 | +gate now reads `take_final_census_scanned()` alongside | ||
| 234 | +`take_final_unwritten_samples()` — the same pairing the merged pre-deblock census | ||
| 235 | +already documents ("a gate that only asserts `take_unwritten_samples() == 0` | ||
| 236 | +passes on a decode that never scanned anything, so it reads THIS too"). The | ||
| 237 | +fixture arms require `scanned > 0`, the synthetic arm requires `scanned == 40` | ||
| 238 | +(16 + 16 + 8), so "scanned and found nothing" is now distinguishable from | ||
| 239 | +"never scanned". | ||
| 218 | 240 | ||
| 219 | ## 7. Commands | 241 | ## 7. Commands |
| 220 | 242 | ||
| @@ -295,3 +317,22 @@ contradictory: the witness's output depends on ambient memory, and what the | |||
| 295 | allocator hands back is machine- and run-dependent, so a fixed value on one host | 317 | allocator hands back is machine- and run-dependent, so a fixed value on one host |
| 296 | and a varying one on another are the same defect. **Stated as measured: 3/3 | 318 | and a varying one on another are the same defect. **Stated as measured: 3/3 |
| 297 | identical here, and no claim about reproducing their observation.** | 319 | identical here, and no claim about reproducing their observation.** |
| 320 | + | ||
| 321 | +## 11. What the per-axis extent change invalidated in published work | ||
| 322 | + | ||
| 323 | +`round_ss(dim, 1)` is bit-identical to `dim.div_ceil(2)`, so **every 4:2:0 dump is | ||
| 324 | +byte-for-byte unchanged** by the `dump_stage16` fix. The change only affects 4:2:2 | ||
| 325 | +and 4:4:0 frames. | ||
| 326 | + | ||
| 327 | +21 lane files reference the `*_DUMP16` dumps. Of those, exactly one, | ||
| 328 | +`lanes/av1422luma.report.md`, uses non-4:2:0 fixtures (`s422_416x250_10b`). Its | ||
| 329 | +stage table (line 77 onward) is a **Y-only** conclusion — every row reads | ||
| 330 | +"frame 0 Y wrong vs ffmpeg", and the reported numbers are luma sample counts and | ||
| 331 | +a luma first-differing coordinate — so that conclusion **survives** the extent | ||
| 332 | +change unchanged. What the change invalidates is only that report's **label**: | ||
| 333 | +"depth-correct `*_DUMP16`" is no longer accurate for the **chroma half** of those | ||
| 334 | +files, which the 4:2:0 crop had truncated to the top half-height. No published | ||
| 335 | +number moves. | ||
| 336 | + | ||
| 337 | +`lanes/unwritten-dep.report.md` (this file) is the only other DUMP16 reference | ||
| 338 | +touching a non-4:2:0 frame, and its numbers are the corrected ones above. | ||