Every alt-ref gate now compares hidden frames -- decode-order compare at 13 sites + an --arnr-maxframes=0 second arm
Browse files at this commit33130e2ae48efdbc7262268fc26359e31dc942cdParent: 8981bd6- test
- every alt-ref gate now compares hidden frames -- decode-order compare at 13 sites + an --arnr-maxframes=0 second arm
- finding: the gates' own recipes emit ~0 hidden frames (5 across 281 attempt-streams), the arm emits 1-3 each and all are pixel-exact
- oracle rung 13 (EC_MODE_MV + EC_MODE_VAL stack=) lifted out of the hand-patched build tree into instrument-aom-oracle.sh
3 changed files +437 -0
- crates/ec-av1/src/stream.rs +309 -0
- lanes/hidden-r2.report.md +72 -0
- scripts/instrument-aom-oracle.sh +56 -0
crates/ec-av1/src/stream.rsmodified+309 -0
| @@ -1740,6 +1740,68 @@ mod tests { | |||
| 1740 | (oracle_frames, hidden) | 1740 | (oracle_frames, hidden) |
| 1741 | } | 1741 | } |
| 1742 | 1742 | ||
| 1743 | + /// lane-hidden r2: the `--arnr-maxframes=0` SECOND ARM of an existing | ||
| 1744 | + /// gate -- the gate's own recipe is never changed, this re-encodes the | ||
| 1745 | + /// same fixture with libaom's temporal alt-ref filter switched off and | ||
| 1746 | + /// runs [`decode_all_frames_vs_oracle`] on the result. Measured: with | ||
| 1747 | + /// the filter at its default EVERY alt-ref recipe in this file emits | ||
| 1748 | + /// ZERO hidden frames (the candidates are filtered away), so the | ||
| 1749 | + /// hidden-frame compare on the gate's own stream is vacuous; this arm | ||
| 1750 | + /// is what actually puts `show_frame == 0` frames on the wire. | ||
| 1751 | + /// | ||
| 1752 | + /// Runs at most once per gate name per process (the loop gates sweep | ||
| 1753 | + /// dozens of attempts and each arm costs a full encode + two decodes). | ||
| 1754 | + /// A stream this decoder refuses BY NAME skips the arm -- the arm is | ||
| 1755 | + /// about hidden frames, not about that capability gap -- while a pixel | ||
| 1756 | + /// mismatch is a hard failure raised inside the compare. | ||
| 1757 | + fn hidden_arnr_arm(name: &str, y4m: &[u8], args: &[&str]) -> Option<(usize, usize)> { | ||
| 1758 | + static ARMED: std::sync::OnceLock<std::sync::Mutex<std::collections::HashSet<String>>> = | ||
| 1759 | + std::sync::OnceLock::new(); | ||
| 1760 | + if !ARMED | ||
| 1761 | + .get_or_init(Default::default) | ||
| 1762 | + .lock() | ||
| 1763 | + .unwrap() | ||
| 1764 | + .insert(name.to_string()) | ||
| 1765 | + { | ||
| 1766 | + return None; | ||
| 1767 | + } | ||
| 1768 | + let mut arm: Vec<&str> = vec!["--arnr-maxframes=0"]; | ||
| 1769 | + arm.extend_from_slice(args); | ||
| 1770 | + let mut child = Command::new(aomenc_path()) | ||
| 1771 | + .args(&arm) | ||
| 1772 | + .stdin(Stdio::piped()) | ||
| 1773 | + .stdout(Stdio::piped()) | ||
| 1774 | + .stderr(Stdio::piped()) | ||
| 1775 | + .spawn() | ||
| 1776 | + .expect("aomenc failed to start"); | ||
| 1777 | + child | ||
| 1778 | + .stdin | ||
| 1779 | + .take() | ||
| 1780 | + .expect("aomenc stdin") | ||
| 1781 | + .write_all(y4m) | ||
| 1782 | + .expect("writing y4m to aomenc"); | ||
| 1783 | + let out = child.wait_with_output().expect("aomenc failed to run"); | ||
| 1784 | + assert!( | ||
| 1785 | + out.status.success(), | ||
| 1786 | + "{name} HIDDEN-ARM: aomenc refused its own recipe plus --arnr-maxframes=0: {}", | ||
| 1787 | + String::from_utf8_lossy(&out.stderr) | ||
| 1788 | + ); | ||
| 1789 | + let stream = out.stdout; | ||
| 1790 | + match decode_stream(&stream) { | ||
| 1791 | + Err(e) => { | ||
| 1792 | + let msg = e.to_string(); | ||
| 1793 | + assert!( | ||
| 1794 | + msg.contains("unsupported"), | ||
| 1795 | + "{name} HIDDEN-ARM failed outright: {msg}" | ||
| 1796 | + ); | ||
| 1797 | + eprintln!("{name} HIDDEN-ARM: skipped on a named refusal: {msg}"); | ||
| 1798 | + None | ||
| 1799 | + } | ||
| 1800 | + Ok(_) => Some(decode_all_frames_vs_oracle(&stream, &format!("{name}-arnr0"))), | ||
| 1801 | + } | ||
| 1802 | + } | ||
| 1803 | + | ||
| 1804 | + | ||
| 1743 | /// The repo's first hidden-frame pixel gate. Every other aomenc gate | 1805 | /// The repo's first hidden-frame pixel gate. Every other aomenc gate |
| 1744 | /// here compares `decode_stream`'s output against `ffmpeg -f obu`, and | 1806 | /// here compares `decode_stream`'s output against `ffmpeg -f obu`, and |
| 1745 | /// both sides emit SHOWN frames only -- so an alt-ref frame that is | 1807 | /// both sides emit SHOWN frames only -- so an alt-ref frame that is |
| @@ -4191,6 +4253,25 @@ mod tests { | |||
| 4191 | "{gate_name} frame {i} V vs ffmpeg (seed {seed})" | 4253 | "{gate_name} frame {i} V vs ffmpeg (seed {seed})" |
| 4192 | ); | 4254 | ); |
| 4193 | } | 4255 | } |
| 4256 | + // lane-hidden r2 (class gate-blind-to-hidden-frames): the same | ||
| 4257 | + // stream again, comparing EVERY decode-order frame -- the hidden | ||
| 4258 | + // (show_frame == 0) alt-ref frames the ffmpeg compare above | ||
| 4259 | + // cannot see, because both sides of it emit shown frames only. | ||
| 4260 | + let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, gate_name); | ||
| 4261 | + eprintln!( | ||
| 4262 | + "{gate_name} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \ | ||
| 4263 | + {hidden_n} hidden, all pixel-exact vs the oracle" | ||
| 4264 | + ); | ||
| 4265 | + // lane-hidden r2 SECOND ARM (the recipe above is untouched): | ||
| 4266 | + // libaom's temporal alt-ref filter absorbs this recipe's hidden | ||
| 4267 | + // frames, so the compare above is vacuous -- re-encode the same | ||
| 4268 | + // fixture with --arnr-maxframes=0 and compare THOSE. | ||
| 4269 | + if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(gate_name, &y4m.stdout, &args) { | ||
| 4270 | + eprintln!( | ||
| 4271 | + "{gate_name} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \ | ||
| 4272 | + decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" | ||
| 4273 | + ); | ||
| 4274 | + } | ||
| 4194 | eprintln!( | 4275 | eprintln!( |
| 4195 | "{gate_name} FIRING seed {seed}: {target_ref_name} hits advanced by {}", | 4276 | "{gate_name} FIRING seed {seed}: {target_ref_name} hits advanced by {}", |
| 4196 | decode::ref_hits(target_ref) - before | 4277 | decode::ref_hits(target_ref) - before |
| @@ -4409,6 +4490,25 @@ mod tests { | |||
| 4409 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); | 4490 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); |
| 4410 | } | 4491 | } |
| 4411 | } | 4492 | } |
| 4493 | + // lane-hidden r2 (class gate-blind-to-hidden-frames): the same | ||
| 4494 | + // stream again, comparing EVERY decode-order frame -- the hidden | ||
| 4495 | + // (show_frame == 0) alt-ref frames the ffmpeg compare above | ||
| 4496 | + // cannot see, because both sides of it emit shown frames only. | ||
| 4497 | + let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME); | ||
| 4498 | + eprintln!( | ||
| 4499 | + "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \ | ||
| 4500 | + {hidden_n} hidden, all pixel-exact vs the oracle" | ||
| 4501 | + ); | ||
| 4502 | + // lane-hidden r2 SECOND ARM (the recipe above is untouched): | ||
| 4503 | + // libaom's temporal alt-ref filter absorbs this recipe's hidden | ||
| 4504 | + // frames, so the compare above is vacuous -- re-encode the same | ||
| 4505 | + // fixture with --arnr-maxframes=0 and compare THOSE. | ||
| 4506 | + if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) { | ||
| 4507 | + eprintln!( | ||
| 4508 | + "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \ | ||
| 4509 | + decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" | ||
| 4510 | + ); | ||
| 4511 | + } | ||
| 4412 | eprintln!( | 4512 | eprintln!( |
| 4413 | "{NAME} FIRING seed {seed}: comp_mode hits advanced by {}, decoded \ | 4513 | "{NAME} FIRING seed {seed}: comp_mode hits advanced by {}, decoded \ |
| 4414 | fully and pixel-exact", | 4514 | fully and pixel-exact", |
| @@ -4591,6 +4691,25 @@ mod tests { | |||
| 4591 | ); | 4691 | ); |
| 4592 | } | 4692 | } |
| 4593 | } | 4693 | } |
| 4694 | + // lane-hidden r2 (class gate-blind-to-hidden-frames): the same | ||
| 4695 | + // stream again, comparing EVERY decode-order frame -- the hidden | ||
| 4696 | + // (show_frame == 0) alt-ref frames the ffmpeg compare above | ||
| 4697 | + // cannot see, because both sides of it emit shown frames only. | ||
| 4698 | + let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME); | ||
| 4699 | + eprintln!( | ||
| 4700 | + "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \ | ||
| 4701 | + {hidden_n} hidden, all pixel-exact vs the oracle" | ||
| 4702 | + ); | ||
| 4703 | + // lane-hidden r2 SECOND ARM (the recipe above is untouched): | ||
| 4704 | + // libaom's temporal alt-ref filter absorbs this recipe's hidden | ||
| 4705 | + // frames, so the compare above is vacuous -- re-encode the same | ||
| 4706 | + // fixture with --arnr-maxframes=0 and compare THOSE. | ||
| 4707 | + if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) { | ||
| 4708 | + eprintln!( | ||
| 4709 | + "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \ | ||
| 4710 | + decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" | ||
| 4711 | + ); | ||
| 4712 | + } | ||
| 4594 | eprintln!( | 4713 | eprintln!( |
| 4595 | "{NAME} FIRING seed {seed}: skip_mode hits advanced by {}", | 4714 | "{NAME} FIRING seed {seed}: skip_mode hits advanced by {}", |
| 4596 | decode::skip_mode_hits() - before | 4715 | decode::skip_mode_hits() - before |
| @@ -4753,6 +4872,25 @@ mod tests { | |||
| 4753 | assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); | 4872 | assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); |
| 4754 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); | 4873 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); |
| 4755 | } | 4874 | } |
| 4875 | + // lane-hidden r2 (class gate-blind-to-hidden-frames): the same | ||
| 4876 | + // stream again, comparing EVERY decode-order frame -- the hidden | ||
| 4877 | + // (show_frame == 0) alt-ref frames the ffmpeg compare above | ||
| 4878 | + // cannot see, because both sides of it emit shown frames only. | ||
| 4879 | + let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME); | ||
| 4880 | + eprintln!( | ||
| 4881 | + "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \ | ||
| 4882 | + {hidden_n} hidden, all pixel-exact vs the oracle" | ||
| 4883 | + ); | ||
| 4884 | + // lane-hidden r2 SECOND ARM (the recipe above is untouched): | ||
| 4885 | + // libaom's temporal alt-ref filter absorbs this recipe's hidden | ||
| 4886 | + // frames, so the compare above is vacuous -- re-encode the same | ||
| 4887 | + // fixture with --arnr-maxframes=0 and compare THOSE. | ||
| 4888 | + if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) { | ||
| 4889 | + eprintln!( | ||
| 4890 | + "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \ | ||
| 4891 | + decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" | ||
| 4892 | + ); | ||
| 4893 | + } | ||
| 4756 | eprintln!( | 4894 | eprintln!( |
| 4757 | "{NAME} FIRING seed {seed}: obmc hits advanced by {}", | 4895 | "{NAME} FIRING seed {seed}: obmc hits advanced by {}", |
| 4758 | decode::obmc_hits() - before | 4896 | decode::obmc_hits() - before |
| @@ -4944,6 +5082,25 @@ mod tests { | |||
| 4944 | assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); | 5082 | assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); |
| 4945 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); | 5083 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); |
| 4946 | } | 5084 | } |
| 5085 | + // lane-hidden r2 (class gate-blind-to-hidden-frames): the same | ||
| 5086 | + // stream again, comparing EVERY decode-order frame -- the hidden | ||
| 5087 | + // (show_frame == 0) alt-ref frames the ffmpeg compare above | ||
| 5088 | + // cannot see, because both sides of it emit shown frames only. | ||
| 5089 | + let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME); | ||
| 5090 | + eprintln!( | ||
| 5091 | + "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \ | ||
| 5092 | + {hidden_n} hidden, all pixel-exact vs the oracle" | ||
| 5093 | + ); | ||
| 5094 | + // lane-hidden r2 SECOND ARM (the recipe above is untouched): | ||
| 5095 | + // libaom's temporal alt-ref filter absorbs this recipe's hidden | ||
| 5096 | + // frames, so the compare above is vacuous -- re-encode the same | ||
| 5097 | + // fixture with --arnr-maxframes=0 and compare THOSE. | ||
| 5098 | + if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) { | ||
| 5099 | + eprintln!( | ||
| 5100 | + "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \ | ||
| 5101 | + decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" | ||
| 5102 | + ); | ||
| 5103 | + } | ||
| 4947 | eprintln!( | 5104 | eprintln!( |
| 4948 | "{NAME} FIRING seed {seed}: 8x8 obmc hits {fired8} (total across attempts so far {total_obmc8})" | 5105 | "{NAME} FIRING seed {seed}: 8x8 obmc hits {fired8} (total across attempts so far {total_obmc8})" |
| 4949 | ); | 5106 | ); |
| @@ -5110,6 +5267,25 @@ mod tests { | |||
| 5110 | assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); | 5267 | assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); |
| 5111 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); | 5268 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); |
| 5112 | } | 5269 | } |
| 5270 | + // lane-hidden r2 (class gate-blind-to-hidden-frames): the same | ||
| 5271 | + // stream again, comparing EVERY decode-order frame -- the hidden | ||
| 5272 | + // (show_frame == 0) alt-ref frames the ffmpeg compare above | ||
| 5273 | + // cannot see, because both sides of it emit shown frames only. | ||
| 5274 | + let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME); | ||
| 5275 | + eprintln!( | ||
| 5276 | + "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \ | ||
| 5277 | + {hidden_n} hidden, all pixel-exact vs the oracle" | ||
| 5278 | + ); | ||
| 5279 | + // lane-hidden r2 SECOND ARM (the recipe above is untouched): | ||
| 5280 | + // libaom's temporal alt-ref filter absorbs this recipe's hidden | ||
| 5281 | + // frames, so the compare above is vacuous -- re-encode the same | ||
| 5282 | + // fixture with --arnr-maxframes=0 and compare THOSE. | ||
| 5283 | + if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) { | ||
| 5284 | + eprintln!( | ||
| 5285 | + "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \ | ||
| 5286 | + decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" | ||
| 5287 | + ); | ||
| 5288 | + } | ||
| 5113 | matched += 1; | 5289 | matched += 1; |
| 5114 | } | 5290 | } |
| 5115 | assert!( | 5291 | assert!( |
| @@ -5559,6 +5735,25 @@ mod tests { | |||
| 5559 | assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); | 5735 | assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); |
| 5560 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); | 5736 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); |
| 5561 | } | 5737 | } |
| 5738 | + // lane-hidden r2 (class gate-blind-to-hidden-frames): the same | ||
| 5739 | + // stream again, comparing EVERY decode-order frame -- the hidden | ||
| 5740 | + // (show_frame == 0) alt-ref frames the ffmpeg compare above | ||
| 5741 | + // cannot see, because both sides of it emit shown frames only. | ||
| 5742 | + let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME); | ||
| 5743 | + eprintln!( | ||
| 5744 | + "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \ | ||
| 5745 | + {hidden_n} hidden, all pixel-exact vs the oracle" | ||
| 5746 | + ); | ||
| 5747 | + // lane-hidden r2 SECOND ARM (the recipe above is untouched): | ||
| 5748 | + // libaom's temporal alt-ref filter absorbs this recipe's hidden | ||
| 5749 | + // frames, so the compare above is vacuous -- re-encode the same | ||
| 5750 | + // fixture with --arnr-maxframes=0 and compare THOSE. | ||
| 5751 | + if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) { | ||
| 5752 | + eprintln!( | ||
| 5753 | + "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \ | ||
| 5754 | + decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" | ||
| 5755 | + ); | ||
| 5756 | + } | ||
| 5562 | matched += 1; | 5757 | matched += 1; |
| 5563 | } | 5758 | } |
| 5564 | assert!( | 5759 | assert!( |
| @@ -5739,6 +5934,25 @@ mod tests { | |||
| 5739 | assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); | 5934 | assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); |
| 5740 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); | 5935 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); |
| 5741 | } | 5936 | } |
| 5937 | + // lane-hidden r2 (class gate-blind-to-hidden-frames): the same | ||
| 5938 | + // stream again, comparing EVERY decode-order frame -- the hidden | ||
| 5939 | + // (show_frame == 0) alt-ref frames the ffmpeg compare above | ||
| 5940 | + // cannot see, because both sides of it emit shown frames only. | ||
| 5941 | + let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME); | ||
| 5942 | + eprintln!( | ||
| 5943 | + "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \ | ||
| 5944 | + {hidden_n} hidden, all pixel-exact vs the oracle" | ||
| 5945 | + ); | ||
| 5946 | + // lane-hidden r2 SECOND ARM (the recipe above is untouched): | ||
| 5947 | + // libaom's temporal alt-ref filter absorbs this recipe's hidden | ||
| 5948 | + // frames, so the compare above is vacuous -- re-encode the same | ||
| 5949 | + // fixture with --arnr-maxframes=0 and compare THOSE. | ||
| 5950 | + if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) { | ||
| 5951 | + eprintln!( | ||
| 5952 | + "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \ | ||
| 5953 | + decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" | ||
| 5954 | + ); | ||
| 5955 | + } | ||
| 5742 | matched += 1; | 5956 | matched += 1; |
| 5743 | } | 5957 | } |
| 5744 | assert!( | 5958 | assert!( |
| @@ -6060,6 +6274,25 @@ mod tests { | |||
| 6060 | assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); | 6274 | assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); |
| 6061 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); | 6275 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); |
| 6062 | } | 6276 | } |
| 6277 | + // lane-hidden r2 (class gate-blind-to-hidden-frames): the same | ||
| 6278 | + // stream again, comparing EVERY decode-order frame -- the hidden | ||
| 6279 | + // (show_frame == 0) alt-ref frames the ffmpeg compare above | ||
| 6280 | + // cannot see, because both sides of it emit shown frames only. | ||
| 6281 | + let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME); | ||
| 6282 | + eprintln!( | ||
| 6283 | + "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \ | ||
| 6284 | + {hidden_n} hidden, all pixel-exact vs the oracle" | ||
| 6285 | + ); | ||
| 6286 | + // lane-hidden r2 SECOND ARM (the recipe above is untouched): | ||
| 6287 | + // libaom's temporal alt-ref filter absorbs this recipe's hidden | ||
| 6288 | + // frames, so the compare above is vacuous -- re-encode the same | ||
| 6289 | + // fixture with --arnr-maxframes=0 and compare THOSE. | ||
| 6290 | + if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) { | ||
| 6291 | + eprintln!( | ||
| 6292 | + "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \ | ||
| 6293 | + decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" | ||
| 6294 | + ); | ||
| 6295 | + } | ||
| 6063 | matched += 1; | 6296 | matched += 1; |
| 6064 | } | 6297 | } |
| 6065 | assert!( | 6298 | assert!( |
| @@ -6261,6 +6494,25 @@ mod tests { | |||
| 6261 | assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); | 6494 | assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); |
| 6262 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); | 6495 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); |
| 6263 | } | 6496 | } |
| 6497 | + // lane-hidden r2 (class gate-blind-to-hidden-frames): the same | ||
| 6498 | + // stream again, comparing EVERY decode-order frame -- the hidden | ||
| 6499 | + // (show_frame == 0) alt-ref frames the ffmpeg compare above | ||
| 6500 | + // cannot see, because both sides of it emit shown frames only. | ||
| 6501 | + let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME); | ||
| 6502 | + eprintln!( | ||
| 6503 | + "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \ | ||
| 6504 | + {hidden_n} hidden, all pixel-exact vs the oracle" | ||
| 6505 | + ); | ||
| 6506 | + // lane-hidden r2 SECOND ARM (the recipe above is untouched): | ||
| 6507 | + // libaom's temporal alt-ref filter absorbs this recipe's hidden | ||
| 6508 | + // frames, so the compare above is vacuous -- re-encode the same | ||
| 6509 | + // fixture with --arnr-maxframes=0 and compare THOSE. | ||
| 6510 | + if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) { | ||
| 6511 | + eprintln!( | ||
| 6512 | + "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \ | ||
| 6513 | + decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" | ||
| 6514 | + ); | ||
| 6515 | + } | ||
| 6264 | matched += 1; | 6516 | matched += 1; |
| 6265 | } | 6517 | } |
| 6266 | assert!( | 6518 | assert!( |
| @@ -6467,6 +6719,25 @@ mod tests { | |||
| 6467 | assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); | 6719 | assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); |
| 6468 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); | 6720 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); |
| 6469 | } | 6721 | } |
| 6722 | + // lane-hidden r2 (class gate-blind-to-hidden-frames): the same | ||
| 6723 | + // stream again, comparing EVERY decode-order frame -- the hidden | ||
| 6724 | + // (show_frame == 0) alt-ref frames the ffmpeg compare above | ||
| 6725 | + // cannot see, because both sides of it emit shown frames only. | ||
| 6726 | + let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME); | ||
| 6727 | + eprintln!( | ||
| 6728 | + "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \ | ||
| 6729 | + {hidden_n} hidden, all pixel-exact vs the oracle" | ||
| 6730 | + ); | ||
| 6731 | + // lane-hidden r2 SECOND ARM (the recipe above is untouched): | ||
| 6732 | + // libaom's temporal alt-ref filter absorbs this recipe's hidden | ||
| 6733 | + // frames, so the compare above is vacuous -- re-encode the same | ||
| 6734 | + // fixture with --arnr-maxframes=0 and compare THOSE. | ||
| 6735 | + if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) { | ||
| 6736 | + eprintln!( | ||
| 6737 | + "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \ | ||
| 6738 | + decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" | ||
| 6739 | + ); | ||
| 6740 | + } | ||
| 6470 | matched += 1; | 6741 | matched += 1; |
| 6471 | } | 6742 | } |
| 6472 | // r1: observed flaky at 40 attempts -- aomenc's cpu-used=0 RD is | 6743 | // r1: observed flaky at 40 attempts -- aomenc's cpu-used=0 RD is |
| @@ -6899,6 +7170,25 @@ mod tests { | |||
| 6899 | assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); | 7170 | assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); |
| 6900 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); | 7171 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); |
| 6901 | } | 7172 | } |
| 7173 | + // lane-hidden r2 (class gate-blind-to-hidden-frames): the same | ||
| 7174 | + // stream again, comparing EVERY decode-order frame -- the hidden | ||
| 7175 | + // (show_frame == 0) alt-ref frames the ffmpeg compare above | ||
| 7176 | + // cannot see, because both sides of it emit shown frames only. | ||
| 7177 | + let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME); | ||
| 7178 | + eprintln!( | ||
| 7179 | + "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \ | ||
| 7180 | + {hidden_n} hidden, all pixel-exact vs the oracle" | ||
| 7181 | + ); | ||
| 7182 | + // lane-hidden r2 SECOND ARM (the recipe above is untouched): | ||
| 7183 | + // libaom's temporal alt-ref filter absorbs this recipe's hidden | ||
| 7184 | + // frames, so the compare above is vacuous -- re-encode the same | ||
| 7185 | + // fixture with --arnr-maxframes=0 and compare THOSE. | ||
| 7186 | + if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) { | ||
| 7187 | + eprintln!( | ||
| 7188 | + "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \ | ||
| 7189 | + decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" | ||
| 7190 | + ); | ||
| 7191 | + } | ||
| 6902 | matched += 1; | 7192 | matched += 1; |
| 6903 | } | 7193 | } |
| 6904 | assert!( | 7194 | assert!( |
| @@ -9209,6 +9499,25 @@ mod tests { | |||
| 9209 | assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); | 9499 | assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); |
| 9210 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); | 9500 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); |
| 9211 | } | 9501 | } |
| 9502 | + // lane-hidden r2 (class gate-blind-to-hidden-frames): the same | ||
| 9503 | + // stream again, comparing EVERY decode-order frame -- the hidden | ||
| 9504 | + // (show_frame == 0) alt-ref frames the ffmpeg compare above | ||
| 9505 | + // cannot see, because both sides of it emit shown frames only. | ||
| 9506 | + let (hidden_total, hidden_n) = decode_all_frames_vs_oracle(&stream, NAME); | ||
| 9507 | + eprintln!( | ||
| 9508 | + "{NAME} HIDDEN: seed {seed}: {hidden_total} decode-order frames, \ | ||
| 9509 | + {hidden_n} hidden, all pixel-exact vs the oracle" | ||
| 9510 | + ); | ||
| 9511 | + // lane-hidden r2 SECOND ARM (the recipe above is untouched): | ||
| 9512 | + // libaom's temporal alt-ref filter absorbs this recipe's hidden | ||
| 9513 | + // frames, so the compare above is vacuous -- re-encode the same | ||
| 9514 | + // fixture with --arnr-maxframes=0 and compare THOSE. | ||
| 9515 | + if let Some((arm_total, arm_hidden)) = hidden_arnr_arm(NAME, &y4m.stdout, &args) { | ||
| 9516 | + eprintln!( | ||
| 9517 | + "{NAME} HIDDEN-ARM(--arnr-maxframes=0): seed {seed}: {arm_total} \ | ||
| 9518 | + decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" | ||
| 9519 | + ); | ||
| 9520 | + } | ||
| 9212 | matched += 1; | 9521 | matched += 1; |
| 9213 | } | 9522 | } |
| 9214 | assert!( | 9523 | assert!( |
lanes/hidden-r2.report.mdadded+72 -0
| @@ -0,0 +1,72 @@ | |||
| 1 | +# lane-hidden r2 — hidden-frame compare wired into the 15 alt-ref gates | ||
| 2 | + | ||
| 3 | +## What changed | ||
| 4 | +- `crates/ec-av1/src/stream.rs` — 13 insertion sites, each **after** the gate's existing | ||
| 5 | + shown-frame `assert_eq!` loop, calling r1's `decode_all_frames_vs_oracle(&stream, NAME)` | ||
| 6 | + on the SAME stream bytes: every decode-order frame (hidden alt-refs included) byte-compared | ||
| 7 | + against the instrumented `aomdec`'s `EC_AV1_FINAL_DUMP`. No gate recipe was changed. | ||
| 8 | + Sites: `a_real_aomenc_single_ref_gate` (:4256, covers the last2/last3/bwdref/altref2/**altref** | ||
| 9 | + gates), reference_select :4493, compound_references :4694, obmc :4875, obmc_8x8 :5085, | ||
| 10 | + warped_motion :5270, interintra :5738, interintra_wedge :5937, free_partitions :6277, | ||
| 11 | + ab_partitions :6497, masked_compound :6722, cdef :7173, delta_q_and_delta_lf :9502. | ||
| 12 | +- `crates/ec-av1/src/stream.rs:1745` — new `hidden_arnr_arm(name, y4m, args)`: the SECOND ARM. | ||
| 13 | + Re-encodes the gate's own fixture with the gate's own args **plus** `--arnr-maxframes=0`, | ||
| 14 | + runs the same decode-order compare, at most once per gate per process. A named | ||
| 15 | + ("unsupported") refusal on the arm's stream skips the arm; a pixel mismatch is a hard | ||
| 16 | + failure inside the compare. Called at the same 13 sites. | ||
| 17 | +- `scripts/instrument-aom-oracle.sh` — **rung 13** (coordinator's extra item): lane-inter8 r3's | ||
| 18 | + hand patch of `~/.cache/aom-oracle/src/av1/decoder/decodemv.c` (an `EC_MODE_MV` line right | ||
| 19 | + after `assign_mv`, and `stack=<ref_mv_count[...]>` on rung 4's `EC_MODE_VAL`) existed only in | ||
| 20 | + the build tree; a script rebuild would have dropped it. Both are now script-applied, | ||
| 21 | + `EC_TRACE_MODE`-gated, idempotent. | ||
| 22 | + | ||
| 23 | +## Finding: every gate's own recipe is VACUOUS for hidden frames | ||
| 24 | +`--auto-alt-ref=1 --lag-in-frames=16` does NOT put hidden frames on the wire — libaom's | ||
| 25 | +temporal alt-ref filter absorbs the candidates. Across the whole suite the 15 gates decoded | ||
| 26 | +**281 attempt-streams and saw 5 hidden frames in total**, 13 of the 16 gate names seeing zero. | ||
| 27 | +Every gate claim of "hidden alt-refs included" is propagation only. `--arnr-maxframes=0` as a | ||
| 28 | +second arm fixes it: 13 of 16 arms carry 1-3 hidden frames. | ||
| 29 | + | ||
| 30 | +| gate | attempts compared | hidden (own recipe) | ARM `--arnr-maxframes=0` | result | | ||
| 31 | +|---|---|---|---|---| | ||
| 32 | +| reference_select | 1 | 1 | 22 frames, **2 hidden** | pixel-exact | | ||
| 33 | +| compound_references | 1 | 0 | 25 frames, **1 hidden** | pixel-exact | | ||
| 34 | +| obmc | 1 | 0 | 25 frames, **1 hidden** | pixel-exact | | ||
| 35 | +| obmc_8x8 | 0 (gate SKIPs: 74 attempts, 0 8x8-obmc hits) | — | — | not reached (pre-existing vacuity) | | ||
| 36 | +| warped_motion | 40 | 2 (max 1/stream) | 25 frames, **1 hidden** | pixel-exact | | ||
| 37 | +| interintra | 40 | 2 (max 1/stream) | 25 frames, **1 hidden** | pixel-exact | | ||
| 38 | +| interintra_wedge | 40 | 0 | 25 frames, **1 hidden** | pixel-exact | | ||
| 39 | +| free_partitions | 17 | 0 | 25 frames, **1 hidden** | pixel-exact | | ||
| 40 | +| ab_partitions | 17 | 0 | 25 frames, **1 hidden** | pixel-exact | | ||
| 41 | +| masked_compound | 80 | 0 | 27 frames, **3 hidden** | pixel-exact | | ||
| 42 | +| cdef | 40 | 0 | 27 frames, **3 hidden** | pixel-exact | | ||
| 43 | +| an_altref_reference | 1 | 0 | 17 frames, **1 hidden** | pixel-exact | | ||
| 44 | +| delta_q_and_delta_lf | 40 | 0 | 27 frames, **3 hidden** | pixel-exact | | ||
| 45 | +| a_bwdref_reference (bonus, same helper) | 1 | 0 | 18 frames, **2 hidden** | pixel-exact | | ||
| 46 | +| an_altref2_reference (bonus) | 1 | 0 | 64 frames, 0 hidden | vacuous even with the arm | | ||
| 47 | +| a_last2 / a_last3 (bonus, `--auto-alt-ref=0`) | 1 each | 0 | 8 frames, 0 hidden | vacuous by construction (no alt-ref) | | ||
| 48 | +| gradients_with_cdef | n/a | n/a | n/a | single ffmpeg/libaom KEY frame, no alt-ref possible | | ||
| 49 | +| a_golden_reference | n/a | n/a | n/a | `--lag-in-frames=0`, no alt-ref possible | | ||
| 50 | + | ||
| 51 | +**No hidden-frame mismatch was found.** Nothing is `#[ignore]`d, no assertion weakened, | ||
| 52 | +no refusal touched (`refusal_inventory.rs` / `gate_coverage.rs` unchanged). | ||
| 53 | + | ||
| 54 | +## Commands | ||
| 55 | + cd /home/user/Documents/Code/Rust/edith_codecs-hidden | ||
| 56 | + export CARGO_TARGET_DIR=$HOME/.cache/cargo-target-hidden | ||
| 57 | + EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib -- --nocapture # table lines: grep HIDDEN | ||
| 58 | + bash scripts/instrument-aom-oracle.sh # rung 13 idempotent | ||
| 59 | + | ||
| 60 | +EVIDENCE: /tmp/.../scratchpad/hidden-r2-suite2.log | EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib -- --nocapture (whole suite, 630.72s) | 273 passed, 0 failed, 22 ignored; 281 attempt-streams compared frame-by-frame in decode order, 5 hidden frames on the gates' own recipes, 16 HIDDEN-ARM lines with 21 hidden frames total, every frame pixel-exact | ||
| 61 | +EVIDENCE: same log, HIDDEN-ARM lines | each gate's own args + --arnr-maxframes=0, re-encoded and decoded through decode_all_frames_vs_oracle | 13 of 16 arms carry 1-3 hidden frames; altref2/last2/last3 arms carry 0 | ||
| 62 | +EVIDENCE: /tmp/.../scratchpad/rung13/decodemv.c | pristine `git show HEAD:av1/decoder/decodemv.c` + the script's rung-4 then rung-13 python blocks | both probe regions diff-identical to the live hand-patched ~/.cache/aom-oracle/src copy (SAME_MV, SAME_VAL); second application prints "already applied (no-op)"; live aomdec `strings` contains 3 EC_MODE_MV/stack=%d entries | ||
| 63 | + | ||
| 64 | +## Residue | ||
| 65 | +- fix-now: none — no defect surfaced. | ||
| 66 | +- deferred: obmc_8x8's hidden compare is unreached because that gate itself never fires an 8x8 | ||
| 67 | + OBMC block (74 attempts, 0 hits) — pre-existing vacuity owned by the OBMC lane; unblocked by a | ||
| 68 | + recipe that actually codes 8x8 OBMC. | ||
| 69 | +- deferred: `an_altref2_reference` still shows 0 hidden even with the arm (64-frame clip); | ||
| 70 | + unblocked by a recipe search like the one lanes/altref2-r1.report.md ran for ALTREF2 firing. | ||
| 71 | +- accepted: the arm runs once per gate per process (a full encode + two decodes per arm); the | ||
| 72 | + gates' own per-attempt sweeps still get the (mostly hidden-free) compare on every attempt. | ||
scripts/instrument-aom-oracle.shmodified+56 -0
| @@ -21,6 +21,8 @@ | |||
| 21 | # two lanes stalled on 2026-08-30 because this rung did not exist. | 21 | # two lanes stalled on 2026-08-30 because this rung did not exist. |
| 22 | # EC_TRACE_MODE=1 -> "EC_MODE mi_row=.. mi_col=.. rng=.." before every inter | 22 | # EC_TRACE_MODE=1 -> "EC_MODE mi_row=.. mi_col=.. rng=.." before every inter |
| 23 | # block's mode info, "EC_MODE_VAL .. mode=.. ref0/1=.. mv0=.. rng=.." | 23 | # block's mode info, "EC_MODE_VAL .. mode=.. ref0/1=.. mv0=.. rng=.." |
| 24 | +# (rung 13 adds "stack=" to that line and an "EC_MODE_MV" line right | ||
| 25 | +# after assign_mv) | ||
| 24 | # after -- the mv-stack/DRL/mv reads EC_PART cannot see. The same flag | 26 | # after -- the mv-stack/DRL/mv reads EC_PART cannot see. The same flag |
| 25 | # also emits "EC_IMODE .. rng=.." / "EC_IMODE_VAL .. mode=.. uv_mode=.. | 27 | # also emits "EC_IMODE .. rng=.." / "EC_IMODE_VAL .. mode=.. uv_mode=.. |
| 26 | # skip=.. tx=.. rng=.." around every INTRA key-frame block: without it | 28 | # skip=.. tx=.. rng=.." around every INTRA key-frame block: without it |
| @@ -705,3 +707,57 @@ s = s.replace(anchor, dump + anchor, 1) | |||
| 705 | open(path, "w").write(s) | 707 | open(path, "w").write(s) |
| 706 | print("final dump instrumented") | 708 | print("final dump instrumented") |
| 707 | PYF | 709 | PYF |
| 710 | + | ||
| 711 | +# --- rung 13: MV ground truth inside the inter mode ladder (lane-inter8 r3) -- | ||
| 712 | +# lane-inter8 r3 patched the live oracle tree BY HAND and rebuilt aomdec, so | ||
| 713 | +# these two probes existed only in ~/.cache/aom-oracle/src and any rebuild | ||
| 714 | +# from this script would have silently dropped them (class: instrument that | ||
| 715 | +# lives only in a build tree). Both extend rung 4 and are gated by the same | ||
| 716 | +# EC_TRACE_MODE: | ||
| 717 | +# * EC_MODE_MV .. mode=.. mv0=(..,..) rng=.. -- printed immediately after | ||
| 718 | +# assign_mv, i.e. the MV as decoded, BEFORE interintra/motion-mode/ | ||
| 719 | +# interp-filter syntax moves the range further; lets a lane separate an | ||
| 720 | +# MV defect from a later-symbol defect on the same block. | ||
| 721 | +# * stack=<ref_mv_count[ref_frame_type]> added to rung 4's EC_MODE_VAL -- | ||
| 722 | +# the reference's own mv-stack depth for the block's reference pair. | ||
| 723 | +H="$SRC/av1/decoder/decodemv.c" | ||
| 724 | +[ -f "$H" ] || { echo "no oracle source at $H" >&2; exit 1; } | ||
| 725 | + | ||
| 726 | +python3 - "$H" <<'PYMV' | ||
| 727 | +import sys | ||
| 728 | +path = sys.argv[1] | ||
| 729 | +s = open(path).read() | ||
| 730 | +if "EC_MODE_MV" in s: | ||
| 731 | + print("decodemv rung 13 already applied (no-op)") | ||
| 732 | + sys.exit(0) | ||
| 733 | +assert "EC_INSTRUMENTED" in s, "rung 13 needs rung 4 (run this script top to bottom)" | ||
| 734 | + | ||
| 735 | +# (a) stack= on rung 4's EC_MODE_VAL | ||
| 736 | +old_val = """ "mv0=(%d,%d) rng=%u\\n", | ||
| 737 | + ec_xd->mi_row, ec_xd->mi_col, (int)mbmi->mode, | ||
| 738 | + (int)mbmi->ref_frame[0], (int)mbmi->ref_frame[1], | ||
| 739 | + mbmi->mv[0].as_mv.row, mbmi->mv[0].as_mv.col, | ||
| 740 | + (unsigned)r->ec.rng);""" | ||
| 741 | +new_val = """ "mv0=(%d,%d) stack=%d rng=%u\\n", | ||
| 742 | + ec_xd->mi_row, ec_xd->mi_col, (int)mbmi->mode, | ||
| 743 | + (int)mbmi->ref_frame[0], (int)mbmi->ref_frame[1], | ||
| 744 | + mbmi->mv[0].as_mv.row, mbmi->mv[0].as_mv.col, | ||
| 745 | + /* EC_STACK */ (int)dcb->ref_mv_count[av1_ref_frame_type(mbmi->ref_frame)], | ||
| 746 | + (unsigned)r->ec.rng);""" | ||
| 747 | +assert old_val in s, "rung 4's EC_MODE_VAL body moved" | ||
| 748 | +s = s.replace(old_val, new_val, 1) | ||
| 749 | + | ||
| 750 | +# (b) EC_MODE_MV right after assign_mv's corrupted-flag merge | ||
| 751 | +anchor = " aom_merge_corrupted_flag(&dcb->corrupted, mv_corrupted_flag);\n" | ||
| 752 | +assert s.count(anchor) == 1, "assign_mv corrupted-flag merge is no longer unique" | ||
| 753 | +probe = """ if (getenv("EC_TRACE_MODE") != NULL) { | ||
| 754 | + fprintf(stderr, | ||
| 755 | + "EC_MODE_MV mi_row=%d mi_col=%d mode=%d mv0=(%d,%d) rng=%u\\n", | ||
| 756 | + xd->mi_row, xd->mi_col, (int)mbmi->mode, mbmi->mv[0].as_mv.row, | ||
| 757 | + mbmi->mv[0].as_mv.col, (unsigned)r->ec.rng); | ||
| 758 | + } | ||
| 759 | +""" | ||
| 760 | +s = s.replace(anchor, anchor + probe, 1) | ||
| 761 | +open(path, "w").write(s) | ||
| 762 | +print("decodemv rung 13 (EC_MODE_MV + EC_MODE_VAL stack=) instrumented") | ||
| 763 | +PYMV | ||