Merge lane-av1tilemeasure @ df1370dd — tile-rows / superres / odd-size cells the format sweep left open
Browse files at this commit2 changed files +801 -0
- crates/ec-av1/src/stream.rs +492 -0
- lanes/av1tilemeasure.report.md +309 -0
crates/ec-av1/src/stream.rsmodified+492 -0
| @@ -44628,4 +44628,496 @@ pub(crate) mod tests { | |||
| 44628 | } | 44628 | } |
| 44629 | assert!(seen, "{name}: no sequence header parsed"); | 44629 | assert!(seen, "{name}: no sequence header parsed"); |
| 44630 | } | 44630 | } |
| 44631 | + | ||
| 44632 | + /// lane-av1tilemeasure: the per-frame facts a tiling / superres / odd-size | ||
| 44633 | + /// cell's OWN claim needs, read off the parsed stream. | ||
| 44634 | + /// | ||
| 44635 | + /// Every gate below asserts its cell through this, never through the | ||
| 44636 | + /// aomenc flag that was supposed to produce it. `lanes/av1formatsweep. | ||
| 44637 | + /// report.md` trap 2 is exactly that failure: `--tile-rows=1` below 256px | ||
| 44638 | + /// high at `--sb-size=128` leaves the stream byte-identical, so a gate | ||
| 44639 | + /// that trusted the flag would report an untiled decode as a tile-row | ||
| 44640 | + /// decode (and the sweep's own 10/12-bit "tile rows" numbers were that). | ||
| 44641 | + #[derive(Debug, Clone, Copy)] | ||
| 44642 | + struct FrameFacts { | ||
| 44643 | + tile_cols: u32, | ||
| 44644 | + tile_rows: u32, | ||
| 44645 | + use_superres: bool, | ||
| 44646 | + coded_w: u32, | ||
| 44647 | + coded_h: u32, | ||
| 44648 | + upscaled_w: u32, | ||
| 44649 | + mi_cols: u32, | ||
| 44650 | + mi_rows: u32, | ||
| 44651 | + } | ||
| 44652 | + | ||
| 44653 | + fn frame_facts(stream: &[u8], name: &str) -> Vec<FrameFacts> { | ||
| 44654 | + let mut parser = Av1Parser::new(); | ||
| 44655 | + let mut pos = 0usize; | ||
| 44656 | + let mut out: Vec<FrameFacts> = Vec::new(); | ||
| 44657 | + while pos < stream.len() { | ||
| 44658 | + let obu = parser | ||
| 44659 | + .parse_obu(&stream[pos..]) | ||
| 44660 | + .unwrap_or_else(|e| panic!("{name}: aomenc OBU does not parse: {e:?}")); | ||
| 44661 | + if obu.total_size == 0 { | ||
| 44662 | + break; | ||
| 44663 | + } | ||
| 44664 | + pos += obu.total_size; | ||
| 44665 | + if let ObuKind::FrameHeader(h) | ObuKind::Frame(h, _) = obu.kind { | ||
| 44666 | + out.push(FrameFacts { | ||
| 44667 | + tile_cols: h.tile_info.cols, | ||
| 44668 | + tile_rows: h.tile_info.rows, | ||
| 44669 | + use_superres: h.use_superres, | ||
| 44670 | + coded_w: h.frame_width, | ||
| 44671 | + coded_h: h.frame_height, | ||
| 44672 | + upscaled_w: h.upscaled_width, | ||
| 44673 | + mi_cols: h.mi_cols, | ||
| 44674 | + mi_rows: h.mi_rows, | ||
| 44675 | + }); | ||
| 44676 | + } | ||
| 44677 | + } | ||
| 44678 | + assert!( | ||
| 44679 | + !out.is_empty(), | ||
| 44680 | + "{name}: the stream carries no frame header" | ||
| 44681 | + ); | ||
| 44682 | + out | ||
| 44683 | + } | ||
| 44684 | + | ||
| 44685 | + /// lane-av1tilemeasure: 12-BIT 4:2:0 with tile ROWS genuinely enabled, and | ||
| 44686 | + /// with a 2x2 tile grid. `gate_coverage.rs` records that the multi-tile | ||
| 44687 | + /// 2D grid is covered "at both bit depths" -- meaning 8 and 10; 12 was the | ||
| 44688 | + /// gap, and the sweep's 12-bit "tile rows" cell (t420_12_row) never | ||
| 44689 | + /// encoded an untiled control, so nobody could say which stream it had | ||
| 44690 | + /// measured. | ||
| 44691 | + /// | ||
| 44692 | + /// Recipe (per arm): `mandelbrot 256x256` + `-vf gblur=sigma=6` | ||
| 44693 | + /// yuv420p12le 6 frames (the 12-bit screen-tools refusal fires on a sharp | ||
| 44694 | + /// source -- H6), `aomenc --codec=av1 --passes=1 --end-usage=q | ||
| 44695 | + /// --cq-level=20 --cpu-used=2 --enable-palette=0 --enable-intrabc=0 | ||
| 44696 | + /// --threads=1 --row-mt=0 --lag-in-frames=0 --kf-max-dist=100 --limit=6 | ||
| 44697 | + /// --input-bit-depth=12 --bit-depth=12 --obu -o - -` plus `--tile-rows=1` | ||
| 44698 | + /// (arm 1) or `--tile-columns=1 --tile-rows=1` (arm 2). | ||
| 44699 | + /// | ||
| 44700 | + /// NON-VACUITY, in the order a reader should check it: | ||
| 44701 | + /// 1. the sequence header is `ss (1,1)` at 12 bits | ||
| 44702 | + /// (`odd_dim_header_mi_grid`); | ||
| 44703 | + /// 2. EVERY frame header's parsed `tile_info` is 1x2 / 2x2 -- the trap-2 | ||
| 44704 | + /// guard: an untiled stream fails here before a pixel is read; | ||
| 44705 | + /// 3. `decode::tile_hits()` advances by at least one hit per tile per | ||
| 44706 | + /// frame, so tile 1 (and the second ROW) really decoded rather than the | ||
| 44707 | + /// first tile being decoded twice; | ||
| 44708 | + /// 4. every decoded plane is 256*256 samples -- a truncated or | ||
| 44709 | + /// quarter-extent decode fails the shape assert; | ||
| 44710 | + /// 5. `decode_all_frames_vs_oracle` asserts the decode-order frame COUNT | ||
| 44711 | + /// and each frame's byte LENGTH against the instrumented `aomdec` | ||
| 44712 | + /// before any sample is compared (a prefix compare is not a compare -- | ||
| 44713 | + /// the same report's trap 1). | ||
| 44714 | + #[test] | ||
| 44715 | + fn a_real_aomenc_12bit_stream_with_two_tile_rows_and_a_two_by_two_tile_grid_decodes_pixel_exact() | ||
| 44716 | + { | ||
| 44717 | + const NAME: &str = "a_real_aomenc_12bit_stream_with_two_tile_rows_and_a_two_by_two_tile_grid_decodes_pixel_exact"; | ||
| 44718 | + let _gate_lock = lock_gate_counters(); | ||
| 44719 | + if !have_ffmpeg() || !have_aomenc() { | ||
| 44720 | + eprintln!("SKIP {NAME}: no ffmpeg/aomenc"); | ||
| 44721 | + return; | ||
| 44722 | + } | ||
| 44723 | + let arms: [(&str, &[&str], u32, u32); 2] = [ | ||
| 44724 | + ("two tile rows", &["--tile-rows=1"], 1, 2), | ||
| 44725 | + ( | ||
| 44726 | + "a 2x2 tile grid", | ||
| 44727 | + &["--tile-columns=1", "--tile-rows=1"], | ||
| 44728 | + 2, | ||
| 44729 | + 2, | ||
| 44730 | + ), | ||
| 44731 | + ]; | ||
| 44732 | + for (label, tiles, want_cols, want_rows) in arms { | ||
| 44733 | + let mut extra = vec![ | ||
| 44734 | + "--cq-level=20", | ||
| 44735 | + "--cpu-used=2", | ||
| 44736 | + "--enable-palette=0", | ||
| 44737 | + "--enable-intrabc=0", | ||
| 44738 | + ]; | ||
| 44739 | + extra.extend_from_slice(tiles); | ||
| 44740 | + let stream = chroma_format_stream(256, 256, "yuv420p12le", 12, 6, &extra, 1); | ||
| 44741 | + odd_dim_header_mi_grid(&stream, NAME, 12); | ||
| 44742 | + let facts = frame_facts(&stream, NAME); | ||
| 44743 | + assert_eq!( | ||
| 44744 | + facts.len(), | ||
| 44745 | + 6, | ||
| 44746 | + "{NAME} ({label}): expected six frame headers, parsed {}", | ||
| 44747 | + facts.len() | ||
| 44748 | + ); | ||
| 44749 | + for (i, f) in facts.iter().enumerate() { | ||
| 44750 | + assert_eq!( | ||
| 44751 | + (f.tile_cols, f.tile_rows), | ||
| 44752 | + (want_cols, want_rows), | ||
| 44753 | + "{NAME} ({label}): decode-order frame {i} parses tile_info {}x{}, not \ | ||
| 44754 | + {want_cols}x{want_rows} -- the aomenc tile flag was a NO-OP at this \ | ||
| 44755 | + geometry, so this arm would be measuring an untiled stream", | ||
| 44756 | + f.tile_cols, | ||
| 44757 | + f.tile_rows | ||
| 44758 | + ); | ||
| 44759 | + } | ||
| 44760 | + let before_tiles = crate::decode::tile_hits(); | ||
| 44761 | + let frames = decode_stream(&stream) | ||
| 44762 | + .unwrap_or_else(|e| panic!("{NAME} ({label}): refused the stream: {e}")); | ||
| 44763 | + let tile_hits = crate::decode::tile_hits() - before_tiles; | ||
| 44764 | + assert!( | ||
| 44765 | + tile_hits >= facts.len() * (want_cols * want_rows) as usize, | ||
| 44766 | + "{NAME} ({label}): tile_hits advanced by {tile_hits} over {} frames of a \ | ||
| 44767 | + {}x{} grid -- not every tile decoded", | ||
| 44768 | + facts.len(), | ||
| 44769 | + want_cols, | ||
| 44770 | + want_rows | ||
| 44771 | + ); | ||
| 44772 | + for (i, f) in frames.iter().enumerate() { | ||
| 44773 | + assert_eq!( | ||
| 44774 | + f.y.len(), | ||
| 44775 | + 256 * 256, | ||
| 44776 | + "{NAME} ({label}): frame {i} luma plane is {} samples, not 256x256", | ||
| 44777 | + f.y.len() | ||
| 44778 | + ); | ||
| 44779 | + } | ||
| 44780 | + let (frames_decoded, _hidden) = decode_all_frames_vs_oracle(&stream, NAME); | ||
| 44781 | + assert!( | ||
| 44782 | + frames_decoded >= 6, | ||
| 44783 | + "{NAME} ({label}): {frames_decoded} decode-order frames" | ||
| 44784 | + ); | ||
| 44785 | + eprintln!( | ||
| 44786 | + "{NAME} ({label}): {frames_decoded} frames byte-exact vs aomdec, tiles \ | ||
| 44787 | + {want_cols}x{want_rows} confirmed on every frame header, tile_hits {tile_hits}" | ||
| 44788 | + ); | ||
| 44789 | + } | ||
| 44790 | + } | ||
| 44791 | + | ||
| 44792 | + /// lane-av1tilemeasure: 4:4:4 SUPERRES at 8, 10 and 12 bits. The sweep's | ||
| 44793 | + /// superres row was `--superres-mode=1` alone, and measured that recipe | ||
| 44794 | + /// at 4:4:4 8 bits: this lane re-encoded it and read `use_superres` on | ||
| 44795 | + /// every frame header -- ZERO frames carried it, so that cell never | ||
| 44796 | + /// exercised the upscaler at all (the same "an aomenc flag is not | ||
| 44797 | + /// evidence" trap as tile rows, one axis over). libaom only signals | ||
| 44798 | + /// `use_superres` when a DENOMINATOR is given, so the arms here spell | ||
| 44799 | + /// `--superres-denominator=12 --superres-kf-denominator=12` and the | ||
| 44800 | + /// header says `use_superres=1` on all four frames. | ||
| 44801 | + /// | ||
| 44802 | + /// Recipe: `testsrc2 128x128` yuv444p10le (12-bit: the gblur'd | ||
| 44803 | + /// `mandelbrot`, H6) 4 frames, `aomenc --codec=av1 --passes=1 | ||
| 44804 | + /// --end-usage=q --cq-level=20 --cpu-used=2 --enable-palette=0 | ||
| 44805 | + /// --enable-intrabc=0 --superres-mode=1 --superres-denominator=12 | ||
| 44806 | + /// --superres-kf-denominator=12 --threads=1 --row-mt=0 --lag-in-frames=0 | ||
| 44807 | + /// --kf-max-dist=100 --limit=4 --input-bit-depth=N --bit-depth=N --obu | ||
| 44808 | + /// -o - -`. Coded width comes out 85px, upscaled to 128. | ||
| 44809 | + /// | ||
| 44810 | + /// NON-VACUITY: `ss (0,0)` at the claimed depth; EVERY frame header has | ||
| 44811 | + /// `use_superres` with a coded width strictly below the upscaled one (a | ||
| 44812 | + /// stream without it fails here, not at the pixel compare); | ||
| 44813 | + /// `superres::superres_hits()` advances once per frame (the upscaler | ||
| 44814 | + /// really ran); every decoded plane is the UPSCALED 128x128 -- a decoder | ||
| 44815 | + /// that forgot the upsample would hand back 85x128 and fail the shape | ||
| 44816 | + /// assert, and at `ss (0,0)` the chroma planes must be full resolution | ||
| 44817 | + /// too; then the length-asserting `aomdec` compare. | ||
| 44818 | + #[test] | ||
| 44819 | + fn a_real_aomenc_444_superres_stream_at_8_10_and_12_bit_decodes_pixel_exact() { | ||
| 44820 | + const NAME: &str = | ||
| 44821 | + "a_real_aomenc_444_superres_stream_at_8_10_and_12_bit_decodes_pixel_exact"; | ||
| 44822 | + let _gate_lock = lock_gate_counters(); | ||
| 44823 | + if !have_ffmpeg() || !have_aomenc() { | ||
| 44824 | + eprintln!("SKIP {NAME}: no ffmpeg/aomenc"); | ||
| 44825 | + return; | ||
| 44826 | + } | ||
| 44827 | + for (depth, pix_fmt, smooth) in [ | ||
| 44828 | + (8usize, "yuv444p", 0u8), | ||
| 44829 | + (10, "yuv444p10le", 0), | ||
| 44830 | + (12, "yuv444p12le", 1), | ||
| 44831 | + ] { | ||
| 44832 | + let stream = chroma_format_stream( | ||
| 44833 | + 128, | ||
| 44834 | + 128, | ||
| 44835 | + pix_fmt, | ||
| 44836 | + depth, | ||
| 44837 | + 4, | ||
| 44838 | + &[ | ||
| 44839 | + "--cq-level=20", | ||
| 44840 | + "--cpu-used=2", | ||
| 44841 | + "--enable-palette=0", | ||
| 44842 | + "--enable-intrabc=0", | ||
| 44843 | + "--superres-mode=1", | ||
| 44844 | + "--superres-denominator=12", | ||
| 44845 | + "--superres-kf-denominator=12", | ||
| 44846 | + ], | ||
| 44847 | + smooth, | ||
| 44848 | + ); | ||
| 44849 | + assert_444_header(&stream, NAME, depth); | ||
| 44850 | + let facts = frame_facts(&stream, NAME); | ||
| 44851 | + for (i, f) in facts.iter().enumerate() { | ||
| 44852 | + assert!( | ||
| 44853 | + f.use_superres, | ||
| 44854 | + "{NAME} ({depth}-bit): decode-order frame {i} has use_superres=0 -- the \ | ||
| 44855 | + superres cell would be measuring an ordinary 4:4:4 stream" | ||
| 44856 | + ); | ||
| 44857 | + assert!( | ||
| 44858 | + f.coded_w < f.upscaled_w, | ||
| 44859 | + "{NAME} ({depth}-bit): frame {i} codes {}px and upscaled_width says {}px", | ||
| 44860 | + f.coded_w, | ||
| 44861 | + f.upscaled_w | ||
| 44862 | + ); | ||
| 44863 | + assert_eq!(f.upscaled_w, 128, "{NAME} ({depth}-bit): upscaled width"); | ||
| 44864 | + } | ||
| 44865 | + let before_sr = crate::superres::superres_hits(); | ||
| 44866 | + let frames = decode_stream(&stream) | ||
| 44867 | + .unwrap_or_else(|e| panic!("{NAME} ({depth}-bit): refused the stream: {e}")); | ||
| 44868 | + let superres_hits = crate::superres::superres_hits() - before_sr; | ||
| 44869 | + assert!( | ||
| 44870 | + superres_hits >= facts.len(), | ||
| 44871 | + "{NAME} ({depth}-bit): superres_hits advanced by {superres_hits} over {} \ | ||
| 44872 | + frames -- the upscaler never ran", | ||
| 44873 | + facts.len() | ||
| 44874 | + ); | ||
| 44875 | + for (i, f) in frames.iter().enumerate() { | ||
| 44876 | + assert_eq!( | ||
| 44877 | + f.y.len(), | ||
| 44878 | + 128 * 128, | ||
| 44879 | + "{NAME} ({depth}-bit): frame {i} luma is {} samples -- a superres decode \ | ||
| 44880 | + must hand back the UPSCALED 128x128, not the 85px coded width", | ||
| 44881 | + f.y.len() | ||
| 44882 | + ); | ||
| 44883 | + assert_eq!( | ||
| 44884 | + f.u.len(), | ||
| 44885 | + 128 * 128, | ||
| 44886 | + "{NAME} ({depth}-bit): frame {i} chroma is {} samples -- at 4:4:4 the chroma \ | ||
| 44887 | + plane is full resolution at the upscaled size", | ||
| 44888 | + f.u.len() | ||
| 44889 | + ); | ||
| 44890 | + } | ||
| 44891 | + let (frames_decoded, _hidden) = decode_all_frames_vs_oracle(&stream, NAME); | ||
| 44892 | + assert!( | ||
| 44893 | + frames_decoded >= 4, | ||
| 44894 | + "{NAME} ({depth}-bit): {frames_decoded} decode-order frames" | ||
| 44895 | + ); | ||
| 44896 | + eprintln!( | ||
| 44897 | + "{NAME} ({depth}-bit): {frames_decoded} frames byte-exact vs aomdec, \ | ||
| 44898 | + use_superres on every frame, superres_hits {superres_hits}" | ||
| 44899 | + ); | ||
| 44900 | + } | ||
| 44901 | + } | ||
| 44902 | + | ||
| 44903 | + /// lane-av1tilemeasure: 4:4:4 at PARTIAL and ODD coded dimensions, | ||
| 44904 | + /// 8/10/12 bits -- and a correction to what the sweep's "odd dims" cell | ||
| 44905 | + /// was measuring. | ||
| 44906 | + /// | ||
| 44907 | + /// **The sweep's odd-dimension 4:4:4 cells were not odd.** 66x66, | ||
| 44908 | + /// 130x122 and 194x130 are even in BOTH axes; what they are is "not a | ||
| 44909 | + /// multiple of 8", the same class as the 4:2:0 row the sweep measured as | ||
| 44910 | + /// "even, not a multiple of 8". This gate's own assert said so out loud | ||
| 44911 | + /// on its first run: `the 66x66 arm is even in BOTH axes`. The genuinely | ||
| 44912 | + /// odd arms are the two 12-bit ones, and they are producible only at 12 | ||
| 44913 | + /// bits: at 8 and 10 bits aomenc rounds a 4:4:4 odd size DOWN to even | ||
| 44914 | + /// (`67x67` -> coded 66x66, `131x131` -> coded 130x130, both measured), | ||
| 44915 | + /// the same rounding the sweep proved for 4:2:0. 12-bit (seq_profile 2) | ||
| 44916 | + /// keeps 67x67 and 65x67 odd, and both decode byte-exact. | ||
| 44917 | + /// | ||
| 44918 | + /// The sweep's 130x122 DIVERGENT verdict is also corrected here: this | ||
| 44919 | + /// lane re-encoded the identical stream (the bytes reproduce the | ||
| 44920 | + /// sweep's sha256 `c87ac65b…`) and it is byte-exact against `aomdec`. | ||
| 44921 | + /// That published verdict came from the prefix compare the same report | ||
| 44922 | + /// documents as its trap 1. | ||
| 44923 | + /// | ||
| 44924 | + /// Recipe per arm: `testsrc2 WxH` yuv444p[10le|12le] 4 frames (12-bit: | ||
| 44925 | + /// the gblur'd `mandelbrot`, H6), `aomenc --codec=av1 --passes=1 | ||
| 44926 | + /// --end-usage=q --cq-level=20 --cpu-used=2 --enable-palette=0 | ||
| 44927 | + /// --enable-intrabc=0 --threads=1 --row-mt=0 --lag-in-frames=0 | ||
| 44928 | + /// --kf-max-dist=100 --limit=4 --obu -o - -` (plus `--input-bit-depth` / | ||
| 44929 | + /// `--bit-depth` above 8). | ||
| 44930 | + /// | ||
| 44931 | + /// NON-VACUITY: `ss (0,0)` at the claimed depth; the arm is not a | ||
| 44932 | + /// multiple of 8 in some axis, and the `odd` flag says whether an axis is | ||
| 44933 | + /// odd, so an arm cannot quietly become the cell next door; EVERY frame | ||
| 44934 | + /// header's coded width and height are exactly the claimed sizes -- a | ||
| 44935 | + ///omenc rounding would make the arm measure a different geometry and fails | ||
| 44936 | + /// here rather than at the pixel compare; the mode-info grid is PARTIAL | ||
| 44937 | + /// (`mi_cols*8 > width` or `mi_rows*8 > height`), the partial-plane walk | ||
| 44938 | + /// the cell exists for; every decoded plane is exactly `width*height` (at | ||
| 44939 | + /// `ss (0,0)` the chroma planes are full resolution, so a 4:2:0 extent or | ||
| 44940 | + /// a truncated decode fails the shape assert); then the | ||
| 44941 | + /// length-asserting `aomdec` compare. | ||
| 44942 | + #[test] | ||
| 44943 | + fn a_real_aomenc_444_partial_and_odd_coded_dimension_streams_decode_pixel_exact() { | ||
| 44944 | + const NAME: &str = | ||
| 44945 | + "a_real_aomenc_444_partial_and_odd_coded_dimension_streams_decode_pixel_exact"; | ||
| 44946 | + let _gate_lock = lock_gate_counters(); | ||
| 44947 | + if !have_ffmpeg() || !have_aomenc() { | ||
| 44948 | + eprintln!("SKIP {NAME}: no ffmpeg/aomenc"); | ||
| 44949 | + return; | ||
| 44950 | + } | ||
| 44951 | + // (width, height, bit depth, smooth source, an axis is odd) | ||
| 44952 | + let arms: [(usize, usize, usize, u8, bool); 10] = [ | ||
| 44953 | + (66, 66, 8, 0, false), | ||
| 44954 | + (98, 66, 8, 0, false), | ||
| 44955 | + (130, 122, 8, 0, false), | ||
| 44956 | + (66, 66, 10, 0, false), | ||
| 44957 | + (194, 130, 10, 0, false), | ||
| 44958 | + (130, 122, 10, 0, false), | ||
| 44959 | + (66, 66, 12, 1, false), | ||
| 44960 | + (130, 122, 12, 1, false), | ||
| 44961 | + (67, 67, 12, 1, true), | ||
| 44962 | + (65, 67, 12, 1, true), | ||
| 44963 | + ]; | ||
| 44964 | + for (w, h, depth, smooth, odd) in arms { | ||
| 44965 | + assert!( | ||
| 44966 | + w % 8 != 0 || h % 8 != 0, | ||
| 44967 | + "{NAME}: the {w}x{h} arm is a multiple of 8 -- it is not a partial-size cell" | ||
| 44968 | + ); | ||
| 44969 | + assert_eq!( | ||
| 44970 | + w % 2 == 1 || h % 2 == 1, | ||
| 44971 | + odd, | ||
| 44972 | + "{NAME}: the {w}x{h} arm's `odd` flag is wrong" | ||
| 44973 | + ); | ||
| 44974 | + let pix_fmt = match depth { | ||
| 44975 | + 8 => "yuv444p", | ||
| 44976 | + 10 => "yuv444p10le", | ||
| 44977 | + _ => "yuv444p12le", | ||
| 44978 | + }; | ||
| 44979 | + let stream = chroma_format_stream( | ||
| 44980 | + w, | ||
| 44981 | + h, | ||
| 44982 | + pix_fmt, | ||
| 44983 | + depth, | ||
| 44984 | + 4, | ||
| 44985 | + &[ | ||
| 44986 | + "--cq-level=20", | ||
| 44987 | + "--cpu-used=2", | ||
| 44988 | + "--enable-palette=0", | ||
| 44989 | + "--enable-intrabc=0", | ||
| 44990 | + ], | ||
| 44991 | + smooth, | ||
| 44992 | + ); | ||
| 44993 | + assert_444_header(&stream, NAME, depth); | ||
| 44994 | + let facts = frame_facts(&stream, NAME); | ||
| 44995 | + for (i, f) in facts.iter().enumerate() { | ||
| 44996 | + assert_eq!( | ||
| 44997 | + (f.coded_w as usize, f.coded_h as usize), | ||
| 44998 | + (w, h), | ||
| 44999 | + "{NAME} ({w}x{h} {depth}-bit): decode-order frame {i} codes {}x{} -- the arm \ | ||
| 45000 | + is not measuring the geometry it names", | ||
| 45001 | + f.coded_w, | ||
| 45002 | + f.coded_h | ||
| 45003 | + ); | ||
| 45004 | + assert!( | ||
| 45005 | + f.mi_cols as usize * 8 > w || f.mi_rows as usize * 8 > h, | ||
| 45006 | + "{NAME} ({w}x{h} {depth}-bit): frame {i} has a {}x{} mode-info grid, which \ | ||
| 45007 | + covers the frame exactly -- the partial-plane walk never runs", | ||
| 45008 | + f.mi_cols, | ||
| 45009 | + f.mi_rows | ||
| 45010 | + ); | ||
| 45011 | + } | ||
| 45012 | + let frames = decode_stream(&stream) | ||
| 45013 | + .unwrap_or_else(|e| panic!("{NAME} ({w}x{h} {depth}-bit): refused: {e}")); | ||
| 45014 | + for (i, f) in frames.iter().enumerate() { | ||
| 45015 | + assert_eq!( | ||
| 45016 | + f.y.len(), | ||
| 45017 | + w * h, | ||
| 45018 | + "{NAME} ({w}x{h} {depth}-bit): frame {i} luma is {} samples", | ||
| 45019 | + f.y.len() | ||
| 45020 | + ); | ||
| 45021 | + assert_eq!( | ||
| 45022 | + f.u.len(), | ||
| 45023 | + w * h, | ||
| 45024 | + "{NAME} ({w}x{h} {depth}-bit): frame {i} chroma is {} samples -- at 4:4:4 \ | ||
| 45025 | + the chroma plane is full resolution even at an odd coded size", | ||
| 45026 | + f.u.len() | ||
| 45027 | + ); | ||
| 45028 | + } | ||
| 45029 | + let (frames_decoded, _hidden) = decode_all_frames_vs_oracle(&stream, NAME); | ||
| 45030 | + assert!( | ||
| 45031 | + frames_decoded >= 4, | ||
| 45032 | + "{NAME} ({w}x{h} {depth}-bit): {frames_decoded} decode-order frames" | ||
| 45033 | + ); | ||
| 45034 | + eprintln!( | ||
| 45035 | + "{NAME}: {w}x{h} {depth}-bit codes exactly as named (odd axis: {odd}), \ | ||
| 45036 | + {frames_decoded} frames byte-exact vs aomdec" | ||
| 45037 | + ); | ||
| 45038 | + } | ||
| 45039 | + } | ||
| 45040 | + | ||
| 45041 | + /// lane-av1tilemeasure: the H3 CONTROL -- 4:4:4 LOSSLESS 8-bit with NO | ||
| 45042 | + /// tiles -- beside its two-tile-column sibling at the same geometry. The | ||
| 45043 | + /// sweep's H3 named a 90-chroma-sample divergence on a lossless 4:4:4 | ||
| 45044 | + /// tile-column stream; the control it never encoded is the untiled stream | ||
| 45045 | + /// at the same size, and without it "tiles cause it" and "4:4:4 lossless | ||
| 45046 | + /// chroma causes it" are the same sentence. Measured here: BOTH arms are | ||
| 45047 | + /// byte-exact against the oracle at 256x128, so at THIS geometry the | ||
| 45048 | + /// defect does not reproduce with or without tiles; the first 4:4:4 | ||
| 45049 | + /// lossless fork measured in this lane is at 192x192 (34 chroma samples, | ||
| 45050 | + /// first U(90,25)), where the tiled and untiled streams diverge at the | ||
| 45051 | + /// very same sample -- see `lanes/av1tilemeasure.report.md`. | ||
| 45052 | + /// | ||
| 45053 | + /// Recipe per arm: `testsrc2 256x128` yuv444p 6 frames, `aomenc | ||
| 45054 | + /// --codec=av1 --lossless=1 --passes=1 --end-usage=q --threads=1 | ||
| 45055 | + /// --row-mt=0 --lag-in-frames=0 --kf-max-dist=100 --limit=6 | ||
| 45056 | + /// --enable-palette=0 --enable-intrabc=0 --obu -o - -`, plus | ||
| 45057 | + /// `--tile-columns=1` on the sibling. | ||
| 45058 | + /// | ||
| 45059 | + /// NON-VACUITY: `ss (0,0)` at 8 bits; every frame header's parsed | ||
| 45060 | + /// `tile_info` is 1x1 for the control and 2x1 for the sibling (so the | ||
| 45061 | + /// control cannot silently become a tiled stream, which is the whole | ||
| 45062 | + /// point of the arm); `decode::rect_split_lossless_chroma444_hits()` | ||
| 45063 | + /// advances, i.e. a lossless strip really walked its chroma as 4:4:4 4x4 | ||
| 45064 | + /// units; then the length-asserting `aomdec` compare. | ||
| 45065 | + #[test] | ||
| 45066 | + fn a_lossless_444_8bit_untiled_control_and_its_two_tile_column_sibling_decode_pixel_exact() { | ||
| 45067 | + const NAME: &str = "a_lossless_444_8bit_untiled_control_and_its_two_tile_column_sibling_decode_pixel_exact"; | ||
| 45068 | + let _gate_lock = lock_gate_counters(); | ||
| 45069 | + if !have_ffmpeg() || !have_aomenc() { | ||
| 45070 | + eprintln!("SKIP {NAME}: no ffmpeg/aomenc"); | ||
| 45071 | + return; | ||
| 45072 | + } | ||
| 45073 | + let arms: [(&str, &[&str], u32, u32); 2] = [ | ||
| 45074 | + ( | ||
| 45075 | + "untiled control", | ||
| 45076 | + &["--lossless=1", "--enable-palette=0", "--enable-intrabc=0"], | ||
| 45077 | + 1, | ||
| 45078 | + 1, | ||
| 45079 | + ), | ||
| 45080 | + ( | ||
| 45081 | + "two tile columns", | ||
| 45082 | + &[ | ||
| 45083 | + "--lossless=1", | ||
| 45084 | + "--enable-palette=0", | ||
| 45085 | + "--enable-intrabc=0", | ||
| 45086 | + "--tile-columns=1", | ||
| 45087 | + ], | ||
| 45088 | + 2, | ||
| 45089 | + 1, | ||
| 45090 | + ), | ||
| 45091 | + ]; | ||
| 45092 | + for (label, flags, want_cols, want_rows) in arms { | ||
| 45093 | + let stream = chroma_format_stream(256, 128, "yuv444p", 8, 6, flags, 0); | ||
| 45094 | + assert_444_header(&stream, NAME, 8); | ||
| 45095 | + let facts = frame_facts(&stream, NAME); | ||
| 45096 | + for (i, f) in facts.iter().enumerate() { | ||
| 45097 | + assert_eq!( | ||
| 45098 | + (f.tile_cols, f.tile_rows), | ||
| 45099 | + (want_cols, want_rows), | ||
| 45100 | + "{NAME} ({label}): decode-order frame {i} parses tile_info {}x{}, not \ | ||
| 45101 | + {want_cols}x{want_rows}", | ||
| 45102 | + f.tile_cols, | ||
| 45103 | + f.tile_rows | ||
| 45104 | + ); | ||
| 45105 | + } | ||
| 45106 | + let before_444 = crate::decode::rect_split_lossless_chroma444_hits(); | ||
| 45107 | + let (frames_decoded, _hidden) = decode_all_frames_vs_oracle(&stream, NAME); | ||
| 45108 | + assert!( | ||
| 45109 | + crate::decode::rect_split_lossless_chroma444_hits() > before_444, | ||
| 45110 | + "{NAME} ({label}) went blind: no lossless strip walked its chroma as 4:4:4 4x4 \ | ||
| 45111 | + units, so the cell never reached the 4:4:4 chroma path" | ||
| 45112 | + ); | ||
| 45113 | + assert!( | ||
| 45114 | + frames_decoded >= 6, | ||
| 45115 | + "{NAME} ({label}): {frames_decoded} decode-order frames" | ||
| 45116 | + ); | ||
| 45117 | + eprintln!( | ||
| 45118 | + "{NAME} ({label}): {frames_decoded} frames byte-exact vs aomdec, tiles \ | ||
| 45119 | + {want_cols}x{want_rows} confirmed on every frame header" | ||
| 45120 | + ); | ||
| 45121 | + } | ||
| 45122 | + } | ||
| 44631 | } | 45123 | } |
lanes/av1tilemeasure.report.mdadded+309 -0
| @@ -0,0 +1,309 @@ | |||
| 1 | +# lane-av1tilemeasure — tile-rows / superres / odd-size cells, measured | ||
| 2 | + | ||
| 3 | +**Tree.** `lane-av1tilemeasure` off `a21f3680`, worktree `~/.cache/wt/av1tilemeasure`. | ||
| 4 | +`crates/ec-av1/src/decode.rs` is **untouched**; every verdict below is HEAD's decoder. | ||
| 5 | + | ||
| 6 | +**Method.** Every cell was encoded live against the durable oracle | ||
| 7 | +(`~/.cache/aom-oracle/build/aomenc`), its OBUs were **parsed** and the frame | ||
| 8 | +headers' `tile_info` / `use_superres` / coded size read off the parse (never off | ||
| 9 | +the aomenc flag), and the stream was decoded against the instrumented | ||
| 10 | +`~/.cache/aom-oracle/build/aomdec` through the same | ||
| 11 | +`decode_all_frames_vs_oracle` path the committed gates use: it asserts the | ||
| 12 | +decode-order frame COUNT and each frame's byte LENGTH before a single sample is | ||
| 13 | +compared. Control arms first: 4:2:0 12-bit untiled and the two existing 4:4:4 | ||
| 14 | +committed recipes both come out byte-exact, so the harness is sound. | ||
| 15 | + | ||
| 16 | +--- | ||
| 17 | + | ||
| 18 | +## 0. Trap 3 (this lane's own): a SHARED `CARGO_TARGET_DIR` silently measures another lane's decoder | ||
| 19 | + | ||
| 20 | +The first two sweeps of this lane were run with the house | ||
| 21 | +`CARGO_TARGET_DIR=$HOME/.cache/cargo-target`, which at that moment was being | ||
| 22 | +written by at least one other lane building `ec-av1` from its own worktree. The | ||
| 23 | +example binary linked **that** lane's in-flight `ec-av1` rlib, and the numbers | ||
| 24 | +were not merely noisy — they were a different decoder: | ||
| 25 | + | ||
| 26 | +| cell | shared target dir | lane-private target dir | | ||
| 27 | +|---|---|---| | ||
| 28 | +| 4:4:4 lossless 8-bit 2x2 tiles, 256x256 | DIVERGENT f1, 11913 samples, first Y(216,128) | **EXACT 6/6** | | ||
| 29 | +| 4:4:4 lossless 8-bit 1 tile row, 128x256 | DIVERGENT f1, 8055 samples, first Y(108,128) | **EXACT 6/6** | | ||
| 30 | +| 4:2:0 lossless 8-bit 2x2 tiles, 256x256 | DIVERGENT f1, 5545 samples, first Y(64,0) | **EXACT 6/6** | | ||
| 31 | +| 4:2:0 lossless 8-bit 1 tile row, 256x256 | DIVERGENT f1, 39763 samples, first Y(128,0) | **EXACT 6/6** | | ||
| 32 | +| 4:2:0 lossless 8-bit 128x256 untiled | DIVERGENT f1, 25334 samples, first Y(86,0) | **EXACT 6/6** | | ||
| 33 | +| 4:4:4 lossless 10-bit 1 tile row, 128x256 | refused by name ("Golomb tail") | DIVERGENT f0, 74 samples, first U(82,188) | | ||
| 34 | +| 4:4:4 lossless 10-bit 1 tile row, 256x256 | 1208 then 1083 samples (two binaries) | 1374 samples, one number | | ||
| 35 | + | ||
| 36 | +A second symptom of the same collision, and the one that could have shipped a | ||
| 37 | +false green: `cargo test -p ec-av1 --lib -- --exact <my new gate>` reported | ||
| 38 | +`0 passed; 717 filtered out` **three times in a row** while the source file | ||
| 39 | +contained the gate — cargo was running the other lane's test binary. It also | ||
| 40 | +rebuilt "successfully" (`Compiling ec-av1`) without my tests in it. | ||
| 41 | + | ||
| 42 | +**Rule this lane proposes:** any lane that measures *or gates* `ec-av1` while | ||
| 43 | +other lanes are live must use a LANE-PRIVATE `CARGO_TARGET_DIR` | ||
| 44 | +(`$HOME/.cache/cargo-target-<lane>`). The shared directory is fine for | ||
| 45 | +`cargo check` on a path that no sibling is building, and useless as evidence. | ||
| 46 | +Every number in this report was re-taken in | ||
| 47 | +`$HOME/.cache/cargo-target-av1tilemeasure` and is stable across repeated runs | ||
| 48 | +(three runs of the same cell, identical counts and identical first-fork values). | ||
| 49 | + | ||
| 50 | +--- | ||
| 51 | + | ||
| 52 | +## 1. The `t420_12_row` correction (published verdict: "may be measuring the same stream") | ||
| 53 | + | ||
| 54 | +**It was not measuring the same stream, and the flag was not a no-op at that | ||
| 55 | +geometry.** The sweep's caveat assumed 128px superblocks; profile-0 4:2:0 | ||
| 56 | +defaults to `--sb-size=64`, so a 256x128 frame is a 4x2 SB grid and | ||
| 57 | +`--tile-rows=1` really does split it. Encoded at the sweep's own flag set | ||
| 58 | +(`--profile=0 --cq-level=20 --cpu-used=2 --enable-palette=0 --enable-intrabc=0 | ||
| 59 | +--threads=1 --row-mt=0 --lag-in-frames=0 --kf-max-dist=100 --limit=6`, source | ||
| 60 | +`mandelbrot=size=256x128:rate=25` + `-vf gblur=sigma=6` yuv420p12le), all three | ||
| 61 | +arms parse as three different grids and are three different streams: | ||
| 62 | + | ||
| 63 | +| arm | parsed `tile_info` (all 6 frames) | bytes | sha256 | verdict vs aomdec | | ||
| 64 | +|---|---|---|---|---| | ||
| 65 | +| `t420_12_notile` (the control the sweep never encoded) | 1x1 | 1675 | `6cd14c13356a5d8e` | **EXACT 6/6** | | ||
| 66 | +| `t420_12_col` (`--tile-columns=1`) | 2x1 | 1747 | `0069fa4b1a9f63bd` | **EXACT 6/6** | | ||
| 67 | +| `t420_12_row` (`--tile-rows=1`) | **1x2** | 1785 | `85050393a76cafae` | **EXACT 6/6** | | ||
| 68 | + | ||
| 69 | +Two independent ways to see the published cells were distinct streams: the | ||
| 70 | +sweep's own table already lists different sha256 and different byte counts for | ||
| 71 | +`t420_12_col` (`c983a91c`, 8713 B) and `t420_12_row` (`0bf14e1e`, 8760 B) — a | ||
| 72 | +no-op flag would have produced identical bytes, which is exactly what the | ||
| 73 | +sweep's own trap-2 table shows happening at `--sb-size=128`. So **the cell did | ||
| 74 | +carry two tile rows, and the EXACT verdict stands on its own stream.** | ||
| 75 | + | ||
| 76 | +Trap 2 is nevertheless real and now has its own reproduction, in the same | ||
| 77 | +report's own words: at `--sb-size=128`, `--tile-rows=1` at 256x128 leaves the | ||
| 78 | +stream byte-identical (`a628e835b8ca1002` for both arms, parsed 1x1 both times). | ||
| 79 | +The flag is a no-op exactly when the frame is one SB row tall. | ||
| 80 | + | ||
| 81 | +**Caveat on the published byte counts.** The sweep's 8713/8760-byte streams are | ||
| 82 | +not reproducible from the recipe text in the report (a re-encode of that exact | ||
| 83 | +flag set gives 1675/1747/1785 bytes). Dropping the `gblur` smoothing — the one | ||
| 84 | +degree of freedom the report leaves open — gives 10830/11139/11147 bytes, and | ||
| 85 | +all three of THOSE hit this decoder's named 12-bit screen-content-tools refusal | ||
| 86 | +(`allow_screen_content_tools=1`). The published byte counts are therefore from a | ||
| 87 | +third variant; the structural answer above does not depend on reproducing them. | ||
| 88 | + | ||
| 89 | +--- | ||
| 90 | + | ||
| 91 | +## 2. Cells measured, with the recipe and the parsed geometry | ||
| 92 | + | ||
| 93 | +Every row: parse asserted before pixels, decode compared against `aomdec` in | ||
| 94 | +decode order with equal frame count and equal byte length asserted first. | ||
| 95 | +Common aomenc tail: `--codec=av1 --passes=1 --end-usage=q --threads=1 --row-mt=0 | ||
| 96 | +--lag-in-frames=0 --kf-max-dist=100 --obu -o - -` (+ `--input-bit-depth=N | ||
| 97 | +--bit-depth=N` above 8). Sources: `testsrc2=WxH:rate=25` unless marked | ||
| 98 | +*smooth* = `mandelbrot=WxH:rate=25` + `-vf gblur=sigma=6` (mandatory at 12 bits, | ||
| 99 | +H6: a sharp 12-bit source sets `allow_screen_content_tools` and the refusal | ||
| 100 | +fires before anything else). | ||
| 101 | + | ||
| 102 | +### 2.1 Tile ROWS genuinely enabled (the cell trap 2 left open) | ||
| 103 | + | ||
| 104 | +| cell | recipe flags | parsed grid | bytes / sha256 | verdict | | ||
| 105 | +|---|---|---|---|---| | ||
| 106 | +| 4:2:0 12-bit 1x2 rows, 256x256 | `--cq-level=20 --cpu-used=2 --enable-palette=0 --enable-intrabc=0 --tile-rows=1`, *smooth*, 6f | 1x2 | 3725 / `40448841c229d18c` | **EXACT 6/6** | | ||
| 107 | +| 4:2:0 12-bit 2x2 grid, 256x256 | same + `--tile-columns=1` | 2x2 | 3886 / `90fff0c014e954c4` | **EXACT 6/6** | | ||
| 108 | +| 4:2:0 10-bit 1x2 rows, 256x256 | same, yuv420p10le | 1x2 | 16509 / `3f2041bb56f4b6c0` | **EXACT 6/6** | | ||
| 109 | +| 4:2:0 8-bit 1x2 rows, 256x256 | same, yuv420p | 1x2 | 15705 / `7726da064e677fb7` | **EXACT 6/6** | | ||
| 110 | +| 4:4:4 lossless 8-bit 1x2 rows, 256x256 | `--lossless=1 --sb-size=128 --tile-rows=1` + tools off | 1x2 | 111159 / `043e31cc555b5946` | DIVERGENT — §3 | | ||
| 111 | +| 4:4:4 lossless 10-bit 1x2 rows, 256x256 | same, yuv444p10le | 1x2 | 189317 / `562ea414b515f715` | DIVERGENT — §3 | | ||
| 112 | +| 4:4:4 lossless 12-bit 1x2 rows, 256x256 | same, yuv444p12le, *smooth* | 1x2 | 414712 / `63d3b7a9c80dc60b` | DIVERGENT — §3 | | ||
| 113 | +| 4:4:4 lossless 10-bit 1x2 rows, 128x256, sb64 | `--lossless=1 --tile-rows=1` + tools off | 1x2 | 126594 / `491982ec18cc45b9` | DIVERGENT — §3 | | ||
| 114 | +| 4:4:4 lossless 8-bit 2x2 grid, 256x256 | `--lossless=1 --sb-size=128 --tile-columns=1 --tile-rows=1` | 2x2 | 111264 / `d517d33ef232770b` | **EXACT 6/6** | | ||
| 115 | +| 4:4:4 lossless 8-bit 1x2 rows, 128x256, sb128 | `--lossless=1 --sb-size=128 --tile-rows=1` | 1x2 | 68908 / `74c85b982ff75ff5` | **EXACT 6/6** | | ||
| 116 | + | ||
| 117 | +`gate_coverage.rs` says the multi-tile 2D grid is covered "at both bit depths" | ||
| 118 | +— meaning 8 and 10. **12-bit was the hole**, and it is now a gate. | ||
| 119 | + | ||
| 120 | +### 2.2 4:4:4 superres, and the trap on the same axis as trap 2 | ||
| 121 | + | ||
| 122 | +`--superres-mode=1` alone does **not** make libaom signal superres: re-encoding | ||
| 123 | +the sweep's own superres recipe (`--superres-mode=1 --cq-level=20 | ||
| 124 | +--cpu-used=2`, 256x128) and parsing every frame header gives `use_superres` on | ||
| 125 | +**0 of 6 frames**, at 8, 10 and 12 bits. A denominator is required. With | ||
| 126 | +`--superres-denominator=12 --superres-kf-denominator=12` every frame header | ||
| 127 | +carries `use_superres=1` and the coded width drops (128x128 display -> 85x128 | ||
| 128 | +coded), i.e. the flag finally did something: | ||
| 129 | + | ||
| 130 | +| cell | recipe | parsed | verdict | | ||
| 131 | +|---|---|---|---| | ||
| 132 | +| 4:4:4 superres 8-bit, 128x128, 4f | `--cq-level=20 --cpu-used=2 --enable-palette=0 --enable-intrabc=0 --superres-mode=1 --superres-denominator=12 --superres-kf-denominator=12` | 85x128 coded, use_superres 4/4 | **EXACT 4/4** | | ||
| 133 | +| 4:4:4 superres 10-bit, same | yuv444p10le | 85x128, 4/4 | **EXACT 4/4** | | ||
| 134 | +| 4:4:4 superres 12-bit, same | yuv444p12le, *smooth* | 85x128, 4/4 | **EXACT 4/4** | | ||
| 135 | +| 4:2:0 superres 12-bit, 128x128, 2f | same, yuv420p12le, *smooth* | 85x128, 2/2 | **EXACT 2/2** | | ||
| 136 | +| 4:4:4 superres 10-bit, 256x256, 4f | same at 256x256 | 171x256, 4/4 | **EXACT 4/4** | | ||
| 137 | +| 4:4:4 superres 12-bit, 256x256, 4f | same at 256x256 | 171x256, 4/4 | **EXACT 4/4** | | ||
| 138 | + | ||
| 139 | +The sweep's published 4:4:4 superres verdicts (`sr444` DIVERGENT from f2; | ||
| 140 | +`sr444_12`/`sr420_12` EXACT) are all `--superres-mode=1`-only recipes, i.e. | ||
| 141 | +streams with `use_superres = 0` on every frame: whatever they measured, it was | ||
| 142 | +not superres. With superres genuinely on, all three depths are exact. | ||
| 143 | + | ||
| 144 | +### 2.3 4:4:4 partial and odd coded dimensions | ||
| 145 | + | ||
| 146 | +The sweep's "odd coded dims" cells (66x66, 130x122, 194x130) are **even in both | ||
| 147 | +axes** — what they are is "not a multiple of 8". This gate said so out loud on | ||
| 148 | +its first run: `the 66x66 arm is even in BOTH axes`. A genuinely odd 4:4:4 | ||
| 149 | +coded size is producible **only at 12 bits** (seq_profile 2): at 8 and 10 bits | ||
| 150 | +aomenc rounds the size down to even — `67x67` -> coded 66x66 (byte-identical to | ||
| 151 | +the 66x66 arm, sha `973eddf4aa6b0bf1`) and `131x131` -> coded 130x130. | ||
| 152 | + | ||
| 153 | +| cell | coded size (parsed) | bytes / sha256 | verdict | | ||
| 154 | +|---|---|---|---| | ||
| 155 | +| 4:4:4 66x66 8-bit | 66x66 (even, not mult. of 8) | 5938 / `973eddf4aa6b0bf1` | **EXACT 4/4** | | ||
| 156 | +| 4:4:4 98x66 8-bit | 98x66 | 6431 / `fc0e13060d1b7ca7` | **EXACT 4/4** | | ||
| 157 | +| 4:4:4 130x122 8-bit | 130x122 | 9513 / `897791f360e3f3fb` | **EXACT 4/4** | | ||
| 158 | +| 4:4:4 66x66 10-bit | 66x66 | 6006 / `995e6d45ca3e6983` | **EXACT 4/4** | | ||
| 159 | +| 4:4:4 194x130 10-bit | 194x130 | 15751 / `cdb16f6a47306bbc` | **EXACT 4/4** | | ||
| 160 | +| 4:4:4 130x122 10-bit | 130x122 | 10237 / `d34448dd0d44e4e9` | **EXACT 4/4** | | ||
| 161 | +| 4:4:4 66x66 12-bit | 66x66 | 791 / `d266e4281c00eb4f` | **EXACT 4/4** | | ||
| 162 | +| 4:4:4 130x122 12-bit | 130x122 | 1994 / `039d0a5aaabbe230` | **EXACT 4/4** | | ||
| 163 | +| 4:4:4 **67x67 12-bit (odd)** | 67x67 | 844 / `da5d680389656d97` | **EXACT 4/4** | | ||
| 164 | +| 4:4:4 **65x67 12-bit (odd)** | 65x67 | 791 / `471e4458babf7fa2` | **EXACT 4/4** | | ||
| 165 | + | ||
| 166 | +Recipe per arm: `testsrc2=WxH:rate=25` yuv444p[10le|12le] (12-bit: *smooth*), | ||
| 167 | +4 frames, `--cq-level=20 --cpu-used=2 --enable-palette=0 --enable-intrabc=0`. | ||
| 168 | + | ||
| 169 | +**Correction to a published verdict.** The sweep records 4:4:4 `130x122` as | ||
| 170 | +DIVERGENT from f3 (11521 samples, first f3 s2208 = Y(128,16)). This lane | ||
| 171 | +re-encoded the sweep's own recipe (no `--enable-palette/intrabc`), reproduced its | ||
| 172 | +stream byte-for-byte (8945 bytes, sha `c87ac65b77579afd`) and it is **byte-exact | ||
| 173 | +4/4** against `aomdec` under a length-asserting compare. That published verdict | ||
| 174 | +is the prefix compare the same report documents as its trap 1. | ||
| 175 | + | ||
| 176 | +### 2.4 The H3 control: 4:4:4 lossless 8-bit WITHOUT tiles | ||
| 177 | + | ||
| 178 | +| arm | parsed grid | bytes / sha256 | verdict | | ||
| 179 | +|---|---|---|---| | ||
| 180 | +| 256x128 untiled (the control the sweep never encoded) | 1x1 | 76468 / `c2cc3bd54d9127a4` | **EXACT 6/6** | | ||
| 181 | +| 256x128 `--tile-columns=1` | 2x1 | 77905 / `1349984ef364c618` | **EXACT 6/6** | | ||
| 182 | +| 256x128 untiled, screen tools left at their default | 1x1 | 74076 / `6c49502811b1a5d8` | **EXACT 6/6** | | ||
| 183 | +| 256x128 `--tile-columns=1`, tools defaulted | 2x1 | 75446 / `65e94e91c56178d2` | **EXACT 6/6** | | ||
| 184 | +| 256x256 untiled | 1x1 | 109215 / `4563a01f17786000` | DIVERGENT — §3 | | ||
| 185 | +| 192x192 untiled | 1x1 | 82918 / `82c3b0a6db9dba2a` | **EXACT 6/6** | | ||
| 186 | +| 192x192 1 tile row | 1x2 | 83105 / `359983962a2c06c3` | **EXACT 6/6** | | ||
| 187 | + | ||
| 188 | +**H3 does not reproduce.** On both flag variants at 256x128, the lossless 4:4:4 | ||
| 189 | +tile-column stream decodes byte-exact 6/6 — no 90-chroma-sample fork, and the | ||
| 190 | +untiled control is exact too. Whatever produced H3's numbers, this recipe is not | ||
| 191 | +it, so H3's "tiles cause it" has no reproduction on this tree and the control | ||
| 192 | +that was missing now exists as a gate. | ||
| 193 | + | ||
| 194 | +--- | ||
| 195 | + | ||
| 196 | +## 3. Divergences (measured, NOT fixed — each is a charter, not this lane's work) | ||
| 197 | + | ||
| 198 | +All of them are the same class: **4:4:4 LOSSLESS, key frame, chroma only, ±1, | ||
| 199 | +luma exactly zero wrong**, at 256x256 or 128x256. Not one of them is | ||
| 200 | +tile-specific. | ||
| 201 | + | ||
| 202 | +| cell | untiled control at the same geometry | tiled arm | first fork (decode order) | | ||
| 203 | +|---|---|---|---| | ||
| 204 | +| 4:4:4 lossless 8-bit 256x256 | DIVERGENT f0, 49 samples | 1 tile row: DIVERGENT f0, 33 samples / 2 tile cols: DIVERGENT f0, 14 samples | control `U(201,200)` ours 160 ref 159; 1x2 `U(199,201)` ours 165 ref 164; 2x1 `U(191,178)` ours 171 ref 172 | | ||
| 205 | +| 4:4:4 lossless 10-bit 256x256 | DIVERGENT f0, 7695 samples, first `U(163,36)` ours 209 ref 129 | 1 tile row: DIVERGENT f0, 1374 samples, **first `U(163,36)` — the same sample** | 10-bit | | ||
| 206 | +| 4:4:4 lossless 12-bit 256x256 | DIVERGENT f0, 17336 samples, first `U(154,32)` ours 84 ref 85 | 1 tile row: DIVERGENT f0, 25152 samples, **first `U(154,32)` — the same sample** | 12-bit | | ||
| 207 | +| 4:4:4 lossless 10-bit 128x256 (sb64) | (not encoded) | 1 tile row: DIVERGENT f0, 74 samples, first `U(82,188)` ours 182 ref 165 | 10-bit, sb64 | | ||
| 208 | + | ||
| 209 | +**Attribution, stated as a measurement and not a theory.** At 10 and 12 bits the | ||
| 210 | +tiled and untiled streams fork at the *same* first sample, so the tile row is | ||
| 211 | +not the cause and the cell does not add a class; the fork belongs to the | ||
| 212 | +4:4:4-lossless chroma defect the sweep already tracks as H3 / §6.1 and handed | ||
| 213 | +to Agent24-2. **H4 ("4:4:4 lossless + 2 tile ROWS: hard divergence", "the whole | ||
| 214 | +plane comes out flat from frame 3") is refuted on two counts:** its recipe was | ||
| 215 | +256x128 with `--tile-rows=1`, which trap 2 shows is a no-op at that geometry | ||
| 216 | +(so it was an untiled stream), and the genuine tile-row stream here diverges by | ||
| 217 | +tens of samples in the key frame, not by 70-85% of the plane from frame 3. At | ||
| 218 | +8 bits the tiled forks land at three nearby-but-different samples inside the | ||
| 219 | +same bottom-right region, all ±1, all frame 0 — the same family, and a | ||
| 220 | +discriminator run is owed before anyone claims one defect. | ||
| 221 | + | ||
| 222 | +The `256x128` control being exact while `256x256` diverges at all three depths | ||
| 223 | +is the sharpest thing this lane measured about the class: it needs a frame that | ||
| 224 | +is 256 rows tall **and** 256 wide, tiled or not. | ||
| 225 | + | ||
| 226 | +--- | ||
| 227 | + | ||
| 228 | +## 4. Gates added (all in `crates/ec-av1/src/stream.rs`) | ||
| 229 | + | ||
| 230 | +| gate | arms | what it pins | | ||
| 231 | +|---|---|---| | ||
| 232 | +| `a_real_aomenc_12bit_stream_with_two_tile_rows_and_a_two_by_two_tile_grid_decodes_pixel_exact` | 4:2:0 12-bit 1x2 rows; 4:2:0 12-bit 2x2 grid | the 12-bit multi-tile hole `gate_coverage.rs` left open | | ||
| 233 | +| `a_real_aomenc_444_superres_stream_at_8_10_and_12_bit_decodes_pixel_exact` | 4:4:4 8/10/12-bit, `use_superres` on every frame | 4:4:4 superres at all three depths, the first with superres actually signalled | | ||
| 234 | +| `a_real_aomenc_444_partial_and_odd_coded_dimension_streams_decode_pixel_exact` | 8 arms: 66x66, 98x66, 130x122 (8-bit), 66x66, 194x130, 130x122 (10-bit), 66x66, 130x122, **67x67, 65x67** (12-bit) | 4:4:4 partial-size at 8/10/12 and the first genuinely ODD 4:4:4 coded sizes | | ||
| 235 | +| `a_lossless_444_8bit_untiled_control_and_its_two_tile_column_sibling_decode_pixel_exact` | 256x128 untiled + 256x128 2 tile columns | the H3 control the sweep never encoded, beside the tile-column sibling it was missing | | ||
| 236 | + | ||
| 237 | +Shared helper added: `frame_facts` (+ `FrameFacts`), which reads | ||
| 238 | +`tile_cols/tile_rows/use_superres/coded_w/coded_h/upscaled_w/mi_cols/mi_rows` | ||
| 239 | +off every frame header of a parsed stream. | ||
| 240 | + | ||
| 241 | +**Non-vacuity.** Each gate asserts, before any pixel: the sequence header's | ||
| 242 | +`ss` and bit depth; the PARSED per-frame `tile_info` equal to the grid the arm | ||
| 243 | +claims (or `use_superres` with `coded_w < upscaled_w` for the superres arms, or | ||
| 244 | +the exact coded size and a partial mode-info grid for the size arms); a | ||
| 245 | +per-path counter (`decode::tile_hits()` >= frames x tiles, | ||
| 246 | +`superres::superres_hits()` >= frames, `decode::rect_split_lossless_chroma444_hits()` | ||
| 247 | +strictly up); the decoded plane extents (256x256, the UPSCALED 128x128, or | ||
| 248 | +exactly `w*h` at `ss (0,0)`), which a truncated or quarter-extent decode fails; | ||
| 249 | +and then `decode_all_frames_vs_oracle`, which asserts equal frame counts and | ||
| 250 | +equal per-frame byte lengths before comparing samples. | ||
| 251 | + | ||
| 252 | +**Red-before proofs (all reverted, all reproduced):** | ||
| 253 | + | ||
| 254 | +1. tile grid — drop `--tile-rows=1` from the 1x2 arm: RED, | ||
| 255 | + `decode-order frame 0 parses tile_info 1x1, not 1x2 -- the aomenc tile flag | ||
| 256 | + was a NO-OP at this geometry`. That is trap 2 caught by the gate. | ||
| 257 | +2. superres — drop both denominators: RED, `decode-order frame 0 has | ||
| 258 | + use_superres=0 -- the superres cell would be measuring an ordinary 4:4:4 | ||
| 259 | + stream`. | ||
| 260 | +3. coded size — expect `(w+1, h)` instead of `(w, h)` on the 66x66 arm: RED, | ||
| 261 | + `left: (66, 66) right: (67, 66)`. | ||
| 262 | +4. arm shape — the first run of the size gate, with an "odd in at least one | ||
| 263 | + axis" assert written before the arm list was checked, went RED on its own | ||
| 264 | + first arm (`the 66x66 arm is even in BOTH axes`). That is where the | ||
| 265 | + "odd dims were not odd" correction came from. | ||
| 266 | + | ||
| 267 | +**`gate_coverage.rs`.** No entry is closed by these gates and none is deleted: | ||
| 268 | +they spell no `--enable-<tool>=1` (the multi-tile and superres tools carry no | ||
| 269 | +`NEVER_EXERCISED` entry — TILING is deliberately outside that derivation, and | ||
| 270 | +superres is already positively covered through the `--superres-mode` alias by | ||
| 271 | +the three existing superres gates), and they add no new `--enable-*` flag name, | ||
| 272 | +so no new hole can open. `gate_coverage`'s three tests are green on this tree. | ||
| 273 | +Entries 17/18/19 of the census were not touched. | ||
| 274 | + | ||
| 275 | +--- | ||
| 276 | + | ||
| 277 | +## 5. Dispositions (cells that cannot be produced, with the tooling path) | ||
| 278 | + | ||
| 279 | +1. **4:4:4 at 8/10 bits with a genuinely ODD coded dimension** — not producible | ||
| 280 | + by recipe. The tooling path that refuses it is aomenc's own frame-size | ||
| 281 | + rounding: `67x67` yuv444p encodes to a stream whose frame header says | ||
| 282 | + `frame_width = 66`, and the bytes are identical to the 66x66 arm | ||
| 283 | + (`973eddf4aa6b0bf1`); `131x131` -> 130x130. At 12 bits (seq_profile 2) the | ||
| 284 | + rounding does not happen and 67x67/65x67 stay odd, which is why the odd arms | ||
| 285 | + are 12-bit. Closing the 8/10-bit odd cell needs a hand-built frame header, | ||
| 286 | + the same conclusion the sweep reached for 4:2:0 odd luma dimensions. | ||
| 287 | +2. **12-bit 4:2:0 from a sharp source** — refused by name before any pixel: | ||
| 288 | + `allow_screen_content_tools=1` trips the 12-bit screen-tools refusal even | ||
| 289 | + with `--enable-palette=0 --enable-intrabc=0` (measured on the no-gblur | ||
| 290 | + variants, 10830/11139/11147 bytes). Every 12-bit arm in this report | ||
| 291 | + therefore carries the smoothed source. | ||
| 292 | +3. **4:4:4 lossless 10-bit with tile rows at 128x256 on the default 64px SB** — | ||
| 293 | + measured, DIVERGENT (§3), not refused: 74 samples, first `U(82,188)`. | ||
| 294 | +4. **4:4:0 (`ss 0,1`)** — carried forward unmeasured from the sweep's §6.4: the | ||
| 295 | + y4m muxer has no `yuv440p` and aomenc has no 4:4:0 input path. Not | ||
| 296 | + re-derived here. | ||
| 297 | +5. **The sweep's exact published byte counts** for the 12-bit 4:2:0 cells | ||
| 298 | + (8713/8760 B) are not reproducible from its recipe text (§1). Disposition: | ||
| 299 | + recorded, not chased; the structural question is answered without them. | ||
| 300 | + | ||
| 301 | +## 6. Handed on | ||
| 302 | + | ||
| 303 | +- **Agent24-2 / the 4:4:4 lossless chroma class** gains the sharpest discriminator | ||
| 304 | + this lane produced: exact at 128x128, 192x192 and 256x128, divergent at | ||
| 305 | + 256x256 at 8, 10 and 12 bits, untiled, key frame, chroma only, +-1 — and the | ||
| 306 | + tile-row stream forks at the *same* first sample as the untiled control at 10 | ||
| 307 | + and 12 bits. H4 (the tile-rows divergence) should be closed as refuted. | ||
| 308 | +- **The shared `CARGO_TARGET_DIR`** is a measurement hazard for every lane that | ||
| 309 | + measures or gates `ec-av1` while siblings build it (§0). Worth a house rule. | ||