ec-av1: measure the tile-rows / superres / odd-size cells the sweep left open
Browse files at this commit36b576f506ff1cf1b2008d88b8466732ba259b59Parent: a460dca2 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
| @@ -43597,4 +43597,496 @@ pub(crate) mod tests { | |||
| 43597 | } | 43597 | } |
| 43598 | assert!(seen, "{name}: no sequence header parsed"); | 43598 | assert!(seen, "{name}: no sequence header parsed"); |
| 43599 | } | 43599 | } |
| 43600 | + | ||
| 43601 | + /// lane-av1tilemeasure: the per-frame facts a tiling / superres / odd-size | ||
| 43602 | + /// cell's OWN claim needs, read off the parsed stream. | ||
| 43603 | + /// | ||
| 43604 | + /// Every gate below asserts its cell through this, never through the | ||
| 43605 | + /// aomenc flag that was supposed to produce it. `lanes/av1formatsweep. | ||
| 43606 | + /// report.md` trap 2 is exactly that failure: `--tile-rows=1` below 256px | ||
| 43607 | + /// high at `--sb-size=128` leaves the stream byte-identical, so a gate | ||
| 43608 | + /// that trusted the flag would report an untiled decode as a tile-row | ||
| 43609 | + /// decode (and the sweep's own 10/12-bit "tile rows" numbers were that). | ||
| 43610 | + #[derive(Debug, Clone, Copy)] | ||
| 43611 | + struct FrameFacts { | ||
| 43612 | + tile_cols: u32, | ||
| 43613 | + tile_rows: u32, | ||
| 43614 | + use_superres: bool, | ||
| 43615 | + coded_w: u32, | ||
| 43616 | + coded_h: u32, | ||
| 43617 | + upscaled_w: u32, | ||
| 43618 | + mi_cols: u32, | ||
| 43619 | + mi_rows: u32, | ||
| 43620 | + } | ||
| 43621 | + | ||
| 43622 | + fn frame_facts(stream: &[u8], name: &str) -> Vec<FrameFacts> { | ||
| 43623 | + let mut parser = Av1Parser::new(); | ||
| 43624 | + let mut pos = 0usize; | ||
| 43625 | + let mut out: Vec<FrameFacts> = Vec::new(); | ||
| 43626 | + while pos < stream.len() { | ||
| 43627 | + let obu = parser | ||
| 43628 | + .parse_obu(&stream[pos..]) | ||
| 43629 | + .unwrap_or_else(|e| panic!("{name}: aomenc OBU does not parse: {e:?}")); | ||
| 43630 | + if obu.total_size == 0 { | ||
| 43631 | + break; | ||
| 43632 | + } | ||
| 43633 | + pos += obu.total_size; | ||
| 43634 | + if let ObuKind::FrameHeader(h) | ObuKind::Frame(h, _) = obu.kind { | ||
| 43635 | + out.push(FrameFacts { | ||
| 43636 | + tile_cols: h.tile_info.cols, | ||
| 43637 | + tile_rows: h.tile_info.rows, | ||
| 43638 | + use_superres: h.use_superres, | ||
| 43639 | + coded_w: h.frame_width, | ||
| 43640 | + coded_h: h.frame_height, | ||
| 43641 | + upscaled_w: h.upscaled_width, | ||
| 43642 | + mi_cols: h.mi_cols, | ||
| 43643 | + mi_rows: h.mi_rows, | ||
| 43644 | + }); | ||
| 43645 | + } | ||
| 43646 | + } | ||
| 43647 | + assert!( | ||
| 43648 | + !out.is_empty(), | ||
| 43649 | + "{name}: the stream carries no frame header" | ||
| 43650 | + ); | ||
| 43651 | + out | ||
| 43652 | + } | ||
| 43653 | + | ||
| 43654 | + /// lane-av1tilemeasure: 12-BIT 4:2:0 with tile ROWS genuinely enabled, and | ||
| 43655 | + /// with a 2x2 tile grid. `gate_coverage.rs` records that the multi-tile | ||
| 43656 | + /// 2D grid is covered "at both bit depths" -- meaning 8 and 10; 12 was the | ||
| 43657 | + /// gap, and the sweep's 12-bit "tile rows" cell (t420_12_row) never | ||
| 43658 | + /// encoded an untiled control, so nobody could say which stream it had | ||
| 43659 | + /// measured. | ||
| 43660 | + /// | ||
| 43661 | + /// Recipe (per arm): `mandelbrot 256x256` + `-vf gblur=sigma=6` | ||
| 43662 | + /// yuv420p12le 6 frames (the 12-bit screen-tools refusal fires on a sharp | ||
| 43663 | + /// source -- H6), `aomenc --codec=av1 --passes=1 --end-usage=q | ||
| 43664 | + /// --cq-level=20 --cpu-used=2 --enable-palette=0 --enable-intrabc=0 | ||
| 43665 | + /// --threads=1 --row-mt=0 --lag-in-frames=0 --kf-max-dist=100 --limit=6 | ||
| 43666 | + /// --input-bit-depth=12 --bit-depth=12 --obu -o - -` plus `--tile-rows=1` | ||
| 43667 | + /// (arm 1) or `--tile-columns=1 --tile-rows=1` (arm 2). | ||
| 43668 | + /// | ||
| 43669 | + /// NON-VACUITY, in the order a reader should check it: | ||
| 43670 | + /// 1. the sequence header is `ss (1,1)` at 12 bits | ||
| 43671 | + /// (`odd_dim_header_mi_grid`); | ||
| 43672 | + /// 2. EVERY frame header's parsed `tile_info` is 1x2 / 2x2 -- the trap-2 | ||
| 43673 | + /// guard: an untiled stream fails here before a pixel is read; | ||
| 43674 | + /// 3. `decode::tile_hits()` advances by at least one hit per tile per | ||
| 43675 | + /// frame, so tile 1 (and the second ROW) really decoded rather than the | ||
| 43676 | + /// first tile being decoded twice; | ||
| 43677 | + /// 4. every decoded plane is 256*256 samples -- a truncated or | ||
| 43678 | + /// quarter-extent decode fails the shape assert; | ||
| 43679 | + /// 5. `decode_all_frames_vs_oracle` asserts the decode-order frame COUNT | ||
| 43680 | + /// and each frame's byte LENGTH against the instrumented `aomdec` | ||
| 43681 | + /// before any sample is compared (a prefix compare is not a compare -- | ||
| 43682 | + /// the same report's trap 1). | ||
| 43683 | + #[test] | ||
| 43684 | + fn a_real_aomenc_12bit_stream_with_two_tile_rows_and_a_two_by_two_tile_grid_decodes_pixel_exact() | ||
| 43685 | + { | ||
| 43686 | + const NAME: &str = "a_real_aomenc_12bit_stream_with_two_tile_rows_and_a_two_by_two_tile_grid_decodes_pixel_exact"; | ||
| 43687 | + let _gate_lock = lock_gate_counters(); | ||
| 43688 | + if !have_ffmpeg() || !have_aomenc() { | ||
| 43689 | + eprintln!("SKIP {NAME}: no ffmpeg/aomenc"); | ||
| 43690 | + return; | ||
| 43691 | + } | ||
| 43692 | + let arms: [(&str, &[&str], u32, u32); 2] = [ | ||
| 43693 | + ("two tile rows", &["--tile-rows=1"], 1, 2), | ||
| 43694 | + ( | ||
| 43695 | + "a 2x2 tile grid", | ||
| 43696 | + &["--tile-columns=1", "--tile-rows=1"], | ||
| 43697 | + 2, | ||
| 43698 | + 2, | ||
| 43699 | + ), | ||
| 43700 | + ]; | ||
| 43701 | + for (label, tiles, want_cols, want_rows) in arms { | ||
| 43702 | + let mut extra = vec![ | ||
| 43703 | + "--cq-level=20", | ||
| 43704 | + "--cpu-used=2", | ||
| 43705 | + "--enable-palette=0", | ||
| 43706 | + "--enable-intrabc=0", | ||
| 43707 | + ]; | ||
| 43708 | + extra.extend_from_slice(tiles); | ||
| 43709 | + let stream = chroma_format_stream(256, 256, "yuv420p12le", 12, 6, &extra, 1); | ||
| 43710 | + odd_dim_header_mi_grid(&stream, NAME, 12); | ||
| 43711 | + let facts = frame_facts(&stream, NAME); | ||
| 43712 | + assert_eq!( | ||
| 43713 | + facts.len(), | ||
| 43714 | + 6, | ||
| 43715 | + "{NAME} ({label}): expected six frame headers, parsed {}", | ||
| 43716 | + facts.len() | ||
| 43717 | + ); | ||
| 43718 | + for (i, f) in facts.iter().enumerate() { | ||
| 43719 | + assert_eq!( | ||
| 43720 | + (f.tile_cols, f.tile_rows), | ||
| 43721 | + (want_cols, want_rows), | ||
| 43722 | + "{NAME} ({label}): decode-order frame {i} parses tile_info {}x{}, not \ | ||
| 43723 | + {want_cols}x{want_rows} -- the aomenc tile flag was a NO-OP at this \ | ||
| 43724 | + geometry, so this arm would be measuring an untiled stream", | ||
| 43725 | + f.tile_cols, | ||
| 43726 | + f.tile_rows | ||
| 43727 | + ); | ||
| 43728 | + } | ||
| 43729 | + let before_tiles = crate::decode::tile_hits(); | ||
| 43730 | + let frames = decode_stream(&stream) | ||
| 43731 | + .unwrap_or_else(|e| panic!("{NAME} ({label}): refused the stream: {e}")); | ||
| 43732 | + let tile_hits = crate::decode::tile_hits() - before_tiles; | ||
| 43733 | + assert!( | ||
| 43734 | + tile_hits >= facts.len() * (want_cols * want_rows) as usize, | ||
| 43735 | + "{NAME} ({label}): tile_hits advanced by {tile_hits} over {} frames of a \ | ||
| 43736 | + {}x{} grid -- not every tile decoded", | ||
| 43737 | + facts.len(), | ||
| 43738 | + want_cols, | ||
| 43739 | + want_rows | ||
| 43740 | + ); | ||
| 43741 | + for (i, f) in frames.iter().enumerate() { | ||
| 43742 | + assert_eq!( | ||
| 43743 | + f.y.len(), | ||
| 43744 | + 256 * 256, | ||
| 43745 | + "{NAME} ({label}): frame {i} luma plane is {} samples, not 256x256", | ||
| 43746 | + f.y.len() | ||
| 43747 | + ); | ||
| 43748 | + } | ||
| 43749 | + let (frames_decoded, _hidden) = decode_all_frames_vs_oracle(&stream, NAME); | ||
| 43750 | + assert!( | ||
| 43751 | + frames_decoded >= 6, | ||
| 43752 | + "{NAME} ({label}): {frames_decoded} decode-order frames" | ||
| 43753 | + ); | ||
| 43754 | + eprintln!( | ||
| 43755 | + "{NAME} ({label}): {frames_decoded} frames byte-exact vs aomdec, tiles \ | ||
| 43756 | + {want_cols}x{want_rows} confirmed on every frame header, tile_hits {tile_hits}" | ||
| 43757 | + ); | ||
| 43758 | + } | ||
| 43759 | + } | ||
| 43760 | + | ||
| 43761 | + /// lane-av1tilemeasure: 4:4:4 SUPERRES at 8, 10 and 12 bits. The sweep's | ||
| 43762 | + /// superres row was `--superres-mode=1` alone, and measured that recipe | ||
| 43763 | + /// at 4:4:4 8 bits: this lane re-encoded it and read `use_superres` on | ||
| 43764 | + /// every frame header -- ZERO frames carried it, so that cell never | ||
| 43765 | + /// exercised the upscaler at all (the same "an aomenc flag is not | ||
| 43766 | + /// evidence" trap as tile rows, one axis over). libaom only signals | ||
| 43767 | + /// `use_superres` when a DENOMINATOR is given, so the arms here spell | ||
| 43768 | + /// `--superres-denominator=12 --superres-kf-denominator=12` and the | ||
| 43769 | + /// header says `use_superres=1` on all four frames. | ||
| 43770 | + /// | ||
| 43771 | + /// Recipe: `testsrc2 128x128` yuv444p10le (12-bit: the gblur'd | ||
| 43772 | + /// `mandelbrot`, H6) 4 frames, `aomenc --codec=av1 --passes=1 | ||
| 43773 | + /// --end-usage=q --cq-level=20 --cpu-used=2 --enable-palette=0 | ||
| 43774 | + /// --enable-intrabc=0 --superres-mode=1 --superres-denominator=12 | ||
| 43775 | + /// --superres-kf-denominator=12 --threads=1 --row-mt=0 --lag-in-frames=0 | ||
| 43776 | + /// --kf-max-dist=100 --limit=4 --input-bit-depth=N --bit-depth=N --obu | ||
| 43777 | + /// -o - -`. Coded width comes out 85px, upscaled to 128. | ||
| 43778 | + /// | ||
| 43779 | + /// NON-VACUITY: `ss (0,0)` at the claimed depth; EVERY frame header has | ||
| 43780 | + /// `use_superres` with a coded width strictly below the upscaled one (a | ||
| 43781 | + /// stream without it fails here, not at the pixel compare); | ||
| 43782 | + /// `superres::superres_hits()` advances once per frame (the upscaler | ||
| 43783 | + /// really ran); every decoded plane is the UPSCALED 128x128 -- a decoder | ||
| 43784 | + /// that forgot the upsample would hand back 85x128 and fail the shape | ||
| 43785 | + /// assert, and at `ss (0,0)` the chroma planes must be full resolution | ||
| 43786 | + /// too; then the length-asserting `aomdec` compare. | ||
| 43787 | + #[test] | ||
| 43788 | + fn a_real_aomenc_444_superres_stream_at_8_10_and_12_bit_decodes_pixel_exact() { | ||
| 43789 | + const NAME: &str = | ||
| 43790 | + "a_real_aomenc_444_superres_stream_at_8_10_and_12_bit_decodes_pixel_exact"; | ||
| 43791 | + let _gate_lock = lock_gate_counters(); | ||
| 43792 | + if !have_ffmpeg() || !have_aomenc() { | ||
| 43793 | + eprintln!("SKIP {NAME}: no ffmpeg/aomenc"); | ||
| 43794 | + return; | ||
| 43795 | + } | ||
| 43796 | + for (depth, pix_fmt, smooth) in [ | ||
| 43797 | + (8usize, "yuv444p", 0u8), | ||
| 43798 | + (10, "yuv444p10le", 0), | ||
| 43799 | + (12, "yuv444p12le", 1), | ||
| 43800 | + ] { | ||
| 43801 | + let stream = chroma_format_stream( | ||
| 43802 | + 128, | ||
| 43803 | + 128, | ||
| 43804 | + pix_fmt, | ||
| 43805 | + depth, | ||
| 43806 | + 4, | ||
| 43807 | + &[ | ||
| 43808 | + "--cq-level=20", | ||
| 43809 | + "--cpu-used=2", | ||
| 43810 | + "--enable-palette=0", | ||
| 43811 | + "--enable-intrabc=0", | ||
| 43812 | + "--superres-mode=1", | ||
| 43813 | + "--superres-denominator=12", | ||
| 43814 | + "--superres-kf-denominator=12", | ||
| 43815 | + ], | ||
| 43816 | + smooth, | ||
| 43817 | + ); | ||
| 43818 | + assert_444_header(&stream, NAME, depth); | ||
| 43819 | + let facts = frame_facts(&stream, NAME); | ||
| 43820 | + for (i, f) in facts.iter().enumerate() { | ||
| 43821 | + assert!( | ||
| 43822 | + f.use_superres, | ||
| 43823 | + "{NAME} ({depth}-bit): decode-order frame {i} has use_superres=0 -- the \ | ||
| 43824 | + superres cell would be measuring an ordinary 4:4:4 stream" | ||
| 43825 | + ); | ||
| 43826 | + assert!( | ||
| 43827 | + f.coded_w < f.upscaled_w, | ||
| 43828 | + "{NAME} ({depth}-bit): frame {i} codes {}px and upscaled_width says {}px", | ||
| 43829 | + f.coded_w, | ||
| 43830 | + f.upscaled_w | ||
| 43831 | + ); | ||
| 43832 | + assert_eq!(f.upscaled_w, 128, "{NAME} ({depth}-bit): upscaled width"); | ||
| 43833 | + } | ||
| 43834 | + let before_sr = crate::superres::superres_hits(); | ||
| 43835 | + let frames = decode_stream(&stream) | ||
| 43836 | + .unwrap_or_else(|e| panic!("{NAME} ({depth}-bit): refused the stream: {e}")); | ||
| 43837 | + let superres_hits = crate::superres::superres_hits() - before_sr; | ||
| 43838 | + assert!( | ||
| 43839 | + superres_hits >= facts.len(), | ||
| 43840 | + "{NAME} ({depth}-bit): superres_hits advanced by {superres_hits} over {} \ | ||
| 43841 | + frames -- the upscaler never ran", | ||
| 43842 | + facts.len() | ||
| 43843 | + ); | ||
| 43844 | + for (i, f) in frames.iter().enumerate() { | ||
| 43845 | + assert_eq!( | ||
| 43846 | + f.y.len(), | ||
| 43847 | + 128 * 128, | ||
| 43848 | + "{NAME} ({depth}-bit): frame {i} luma is {} samples -- a superres decode \ | ||
| 43849 | + must hand back the UPSCALED 128x128, not the 85px coded width", | ||
| 43850 | + f.y.len() | ||
| 43851 | + ); | ||
| 43852 | + assert_eq!( | ||
| 43853 | + f.u.len(), | ||
| 43854 | + 128 * 128, | ||
| 43855 | + "{NAME} ({depth}-bit): frame {i} chroma is {} samples -- at 4:4:4 the chroma \ | ||
| 43856 | + plane is full resolution at the upscaled size", | ||
| 43857 | + f.u.len() | ||
| 43858 | + ); | ||
| 43859 | + } | ||
| 43860 | + let (frames_decoded, _hidden) = decode_all_frames_vs_oracle(&stream, NAME); | ||
| 43861 | + assert!( | ||
| 43862 | + frames_decoded >= 4, | ||
| 43863 | + "{NAME} ({depth}-bit): {frames_decoded} decode-order frames" | ||
| 43864 | + ); | ||
| 43865 | + eprintln!( | ||
| 43866 | + "{NAME} ({depth}-bit): {frames_decoded} frames byte-exact vs aomdec, \ | ||
| 43867 | + use_superres on every frame, superres_hits {superres_hits}" | ||
| 43868 | + ); | ||
| 43869 | + } | ||
| 43870 | + } | ||
| 43871 | + | ||
| 43872 | + /// lane-av1tilemeasure: 4:4:4 at PARTIAL and ODD coded dimensions, | ||
| 43873 | + /// 8/10/12 bits -- and a correction to what the sweep's "odd dims" cell | ||
| 43874 | + /// was measuring. | ||
| 43875 | + /// | ||
| 43876 | + /// **The sweep's odd-dimension 4:4:4 cells were not odd.** 66x66, | ||
| 43877 | + /// 130x122 and 194x130 are even in BOTH axes; what they are is "not a | ||
| 43878 | + /// multiple of 8", the same class as the 4:2:0 row the sweep measured as | ||
| 43879 | + /// "even, not a multiple of 8". This gate's own assert said so out loud | ||
| 43880 | + /// on its first run: `the 66x66 arm is even in BOTH axes`. The genuinely | ||
| 43881 | + /// odd arms are the two 12-bit ones, and they are producible only at 12 | ||
| 43882 | + /// bits: at 8 and 10 bits aomenc rounds a 4:4:4 odd size DOWN to even | ||
| 43883 | + /// (`67x67` -> coded 66x66, `131x131` -> coded 130x130, both measured), | ||
| 43884 | + /// the same rounding the sweep proved for 4:2:0. 12-bit (seq_profile 2) | ||
| 43885 | + /// keeps 67x67 and 65x67 odd, and both decode byte-exact. | ||
| 43886 | + /// | ||
| 43887 | + /// The sweep's 130x122 DIVERGENT verdict is also corrected here: this | ||
| 43888 | + /// lane re-encoded the identical stream (the bytes reproduce the | ||
| 43889 | + /// sweep's sha256 `c87ac65b…`) and it is byte-exact against `aomdec`. | ||
| 43890 | + /// That published verdict came from the prefix compare the same report | ||
| 43891 | + /// documents as its trap 1. | ||
| 43892 | + /// | ||
| 43893 | + /// Recipe per arm: `testsrc2 WxH` yuv444p[10le|12le] 4 frames (12-bit: | ||
| 43894 | + /// the gblur'd `mandelbrot`, H6), `aomenc --codec=av1 --passes=1 | ||
| 43895 | + /// --end-usage=q --cq-level=20 --cpu-used=2 --enable-palette=0 | ||
| 43896 | + /// --enable-intrabc=0 --threads=1 --row-mt=0 --lag-in-frames=0 | ||
| 43897 | + /// --kf-max-dist=100 --limit=4 --obu -o - -` (plus `--input-bit-depth` / | ||
| 43898 | + /// `--bit-depth` above 8). | ||
| 43899 | + /// | ||
| 43900 | + /// NON-VACUITY: `ss (0,0)` at the claimed depth; the arm is not a | ||
| 43901 | + /// multiple of 8 in some axis, and the `odd` flag says whether an axis is | ||
| 43902 | + /// odd, so an arm cannot quietly become the cell next door; EVERY frame | ||
| 43903 | + /// header's coded width and height are exactly the claimed sizes -- a | ||
| 43904 | + ///omenc rounding would make the arm measure a different geometry and fails | ||
| 43905 | + /// here rather than at the pixel compare; the mode-info grid is PARTIAL | ||
| 43906 | + /// (`mi_cols*8 > width` or `mi_rows*8 > height`), the partial-plane walk | ||
| 43907 | + /// the cell exists for; every decoded plane is exactly `width*height` (at | ||
| 43908 | + /// `ss (0,0)` the chroma planes are full resolution, so a 4:2:0 extent or | ||
| 43909 | + /// a truncated decode fails the shape assert); then the | ||
| 43910 | + /// length-asserting `aomdec` compare. | ||
| 43911 | + #[test] | ||
| 43912 | + fn a_real_aomenc_444_partial_and_odd_coded_dimension_streams_decode_pixel_exact() { | ||
| 43913 | + const NAME: &str = | ||
| 43914 | + "a_real_aomenc_444_partial_and_odd_coded_dimension_streams_decode_pixel_exact"; | ||
| 43915 | + let _gate_lock = lock_gate_counters(); | ||
| 43916 | + if !have_ffmpeg() || !have_aomenc() { | ||
| 43917 | + eprintln!("SKIP {NAME}: no ffmpeg/aomenc"); | ||
| 43918 | + return; | ||
| 43919 | + } | ||
| 43920 | + // (width, height, bit depth, smooth source, an axis is odd) | ||
| 43921 | + let arms: [(usize, usize, usize, u8, bool); 10] = [ | ||
| 43922 | + (66, 66, 8, 0, false), | ||
| 43923 | + (98, 66, 8, 0, false), | ||
| 43924 | + (130, 122, 8, 0, false), | ||
| 43925 | + (66, 66, 10, 0, false), | ||
| 43926 | + (194, 130, 10, 0, false), | ||
| 43927 | + (130, 122, 10, 0, false), | ||
| 43928 | + (66, 66, 12, 1, false), | ||
| 43929 | + (130, 122, 12, 1, false), | ||
| 43930 | + (67, 67, 12, 1, true), | ||
| 43931 | + (65, 67, 12, 1, true), | ||
| 43932 | + ]; | ||
| 43933 | + for (w, h, depth, smooth, odd) in arms { | ||
| 43934 | + assert!( | ||
| 43935 | + w % 8 != 0 || h % 8 != 0, | ||
| 43936 | + "{NAME}: the {w}x{h} arm is a multiple of 8 -- it is not a partial-size cell" | ||
| 43937 | + ); | ||
| 43938 | + assert_eq!( | ||
| 43939 | + w % 2 == 1 || h % 2 == 1, | ||
| 43940 | + odd, | ||
| 43941 | + "{NAME}: the {w}x{h} arm's `odd` flag is wrong" | ||
| 43942 | + ); | ||
| 43943 | + let pix_fmt = match depth { | ||
| 43944 | + 8 => "yuv444p", | ||
| 43945 | + 10 => "yuv444p10le", | ||
| 43946 | + _ => "yuv444p12le", | ||
| 43947 | + }; | ||
| 43948 | + let stream = chroma_format_stream( | ||
| 43949 | + w, | ||
| 43950 | + h, | ||
| 43951 | + pix_fmt, | ||
| 43952 | + depth, | ||
| 43953 | + 4, | ||
| 43954 | + &[ | ||
| 43955 | + "--cq-level=20", | ||
| 43956 | + "--cpu-used=2", | ||
| 43957 | + "--enable-palette=0", | ||
| 43958 | + "--enable-intrabc=0", | ||
| 43959 | + ], | ||
| 43960 | + smooth, | ||
| 43961 | + ); | ||
| 43962 | + assert_444_header(&stream, NAME, depth); | ||
| 43963 | + let facts = frame_facts(&stream, NAME); | ||
| 43964 | + for (i, f) in facts.iter().enumerate() { | ||
| 43965 | + assert_eq!( | ||
| 43966 | + (f.coded_w as usize, f.coded_h as usize), | ||
| 43967 | + (w, h), | ||
| 43968 | + "{NAME} ({w}x{h} {depth}-bit): decode-order frame {i} codes {}x{} -- the arm \ | ||
| 43969 | + is not measuring the geometry it names", | ||
| 43970 | + f.coded_w, | ||
| 43971 | + f.coded_h | ||
| 43972 | + ); | ||
| 43973 | + assert!( | ||
| 43974 | + f.mi_cols as usize * 8 > w || f.mi_rows as usize * 8 > h, | ||
| 43975 | + "{NAME} ({w}x{h} {depth}-bit): frame {i} has a {}x{} mode-info grid, which \ | ||
| 43976 | + covers the frame exactly -- the partial-plane walk never runs", | ||
| 43977 | + f.mi_cols, | ||
| 43978 | + f.mi_rows | ||
| 43979 | + ); | ||
| 43980 | + } | ||
| 43981 | + let frames = decode_stream(&stream) | ||
| 43982 | + .unwrap_or_else(|e| panic!("{NAME} ({w}x{h} {depth}-bit): refused: {e}")); | ||
| 43983 | + for (i, f) in frames.iter().enumerate() { | ||
| 43984 | + assert_eq!( | ||
| 43985 | + f.y.len(), | ||
| 43986 | + w * h, | ||
| 43987 | + "{NAME} ({w}x{h} {depth}-bit): frame {i} luma is {} samples", | ||
| 43988 | + f.y.len() | ||
| 43989 | + ); | ||
| 43990 | + assert_eq!( | ||
| 43991 | + f.u.len(), | ||
| 43992 | + w * h, | ||
| 43993 | + "{NAME} ({w}x{h} {depth}-bit): frame {i} chroma is {} samples -- at 4:4:4 \ | ||
| 43994 | + the chroma plane is full resolution even at an odd coded size", | ||
| 43995 | + f.u.len() | ||
| 43996 | + ); | ||
| 43997 | + } | ||
| 43998 | + let (frames_decoded, _hidden) = decode_all_frames_vs_oracle(&stream, NAME); | ||
| 43999 | + assert!( | ||
| 44000 | + frames_decoded >= 4, | ||
| 44001 | + "{NAME} ({w}x{h} {depth}-bit): {frames_decoded} decode-order frames" | ||
| 44002 | + ); | ||
| 44003 | + eprintln!( | ||
| 44004 | + "{NAME}: {w}x{h} {depth}-bit codes exactly as named (odd axis: {odd}), \ | ||
| 44005 | + {frames_decoded} frames byte-exact vs aomdec" | ||
| 44006 | + ); | ||
| 44007 | + } | ||
| 44008 | + } | ||
| 44009 | + | ||
| 44010 | + /// lane-av1tilemeasure: the H3 CONTROL -- 4:4:4 LOSSLESS 8-bit with NO | ||
| 44011 | + /// tiles -- beside its two-tile-column sibling at the same geometry. The | ||
| 44012 | + /// sweep's H3 named a 90-chroma-sample divergence on a lossless 4:4:4 | ||
| 44013 | + /// tile-column stream; the control it never encoded is the untiled stream | ||
| 44014 | + /// at the same size, and without it "tiles cause it" and "4:4:4 lossless | ||
| 44015 | + /// chroma causes it" are the same sentence. Measured here: BOTH arms are | ||
| 44016 | + /// byte-exact against the oracle at 256x128, so at THIS geometry the | ||
| 44017 | + /// defect does not reproduce with or without tiles; the first 4:4:4 | ||
| 44018 | + /// lossless fork measured in this lane is at 192x192 (34 chroma samples, | ||
| 44019 | + /// first U(90,25)), where the tiled and untiled streams diverge at the | ||
| 44020 | + /// very same sample -- see `lanes/av1tilemeasure.report.md`. | ||
| 44021 | + /// | ||
| 44022 | + /// Recipe per arm: `testsrc2 256x128` yuv444p 6 frames, `aomenc | ||
| 44023 | + /// --codec=av1 --lossless=1 --passes=1 --end-usage=q --threads=1 | ||
| 44024 | + /// --row-mt=0 --lag-in-frames=0 --kf-max-dist=100 --limit=6 | ||
| 44025 | + /// --enable-palette=0 --enable-intrabc=0 --obu -o - -`, plus | ||
| 44026 | + /// `--tile-columns=1` on the sibling. | ||
| 44027 | + /// | ||
| 44028 | + /// NON-VACUITY: `ss (0,0)` at 8 bits; every frame header's parsed | ||
| 44029 | + /// `tile_info` is 1x1 for the control and 2x1 for the sibling (so the | ||
| 44030 | + /// control cannot silently become a tiled stream, which is the whole | ||
| 44031 | + /// point of the arm); `decode::rect_split_lossless_chroma444_hits()` | ||
| 44032 | + /// advances, i.e. a lossless strip really walked its chroma as 4:4:4 4x4 | ||
| 44033 | + /// units; then the length-asserting `aomdec` compare. | ||
| 44034 | + #[test] | ||
| 44035 | + fn a_lossless_444_8bit_untiled_control_and_its_two_tile_column_sibling_decode_pixel_exact() { | ||
| 44036 | + const NAME: &str = "a_lossless_444_8bit_untiled_control_and_its_two_tile_column_sibling_decode_pixel_exact"; | ||
| 44037 | + let _gate_lock = lock_gate_counters(); | ||
| 44038 | + if !have_ffmpeg() || !have_aomenc() { | ||
| 44039 | + eprintln!("SKIP {NAME}: no ffmpeg/aomenc"); | ||
| 44040 | + return; | ||
| 44041 | + } | ||
| 44042 | + let arms: [(&str, &[&str], u32, u32); 2] = [ | ||
| 44043 | + ( | ||
| 44044 | + "untiled control", | ||
| 44045 | + &["--lossless=1", "--enable-palette=0", "--enable-intrabc=0"], | ||
| 44046 | + 1, | ||
| 44047 | + 1, | ||
| 44048 | + ), | ||
| 44049 | + ( | ||
| 44050 | + "two tile columns", | ||
| 44051 | + &[ | ||
| 44052 | + "--lossless=1", | ||
| 44053 | + "--enable-palette=0", | ||
| 44054 | + "--enable-intrabc=0", | ||
| 44055 | + "--tile-columns=1", | ||
| 44056 | + ], | ||
| 44057 | + 2, | ||
| 44058 | + 1, | ||
| 44059 | + ), | ||
| 44060 | + ]; | ||
| 44061 | + for (label, flags, want_cols, want_rows) in arms { | ||
| 44062 | + let stream = chroma_format_stream(256, 128, "yuv444p", 8, 6, flags, 0); | ||
| 44063 | + assert_444_header(&stream, NAME, 8); | ||
| 44064 | + let facts = frame_facts(&stream, NAME); | ||
| 44065 | + for (i, f) in facts.iter().enumerate() { | ||
| 44066 | + assert_eq!( | ||
| 44067 | + (f.tile_cols, f.tile_rows), | ||
| 44068 | + (want_cols, want_rows), | ||
| 44069 | + "{NAME} ({label}): decode-order frame {i} parses tile_info {}x{}, not \ | ||
| 44070 | + {want_cols}x{want_rows}", | ||
| 44071 | + f.tile_cols, | ||
| 44072 | + f.tile_rows | ||
| 44073 | + ); | ||
| 44074 | + } | ||
| 44075 | + let before_444 = crate::decode::rect_split_lossless_chroma444_hits(); | ||
| 44076 | + let (frames_decoded, _hidden) = decode_all_frames_vs_oracle(&stream, NAME); | ||
| 44077 | + assert!( | ||
| 44078 | + crate::decode::rect_split_lossless_chroma444_hits() > before_444, | ||
| 44079 | + "{NAME} ({label}) went blind: no lossless strip walked its chroma as 4:4:4 4x4 \ | ||
| 44080 | + units, so the cell never reached the 4:4:4 chroma path" | ||
| 44081 | + ); | ||
| 44082 | + assert!( | ||
| 44083 | + frames_decoded >= 6, | ||
| 44084 | + "{NAME} ({label}): {frames_decoded} decode-order frames" | ||
| 44085 | + ); | ||
| 44086 | + eprintln!( | ||
| 44087 | + "{NAME} ({label}): {frames_decoded} frames byte-exact vs aomdec, tiles \ | ||
| 44088 | + {want_cols}x{want_rows} confirmed on every frame header" | ||
| 44089 | + ); | ||
| 44090 | + } | ||
| 44091 | + } | ||
| 43600 | } | 44092 | } |
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. | ||