The 64x72 first-symbol desync is 128x128 superblocks, not odd height -- refuse them by name above 64x64, and gate the odd-size ladder
Browse files at this commitabae99af1f068815db1070b3ca23f3786f349adfParent: a24f329- fix
- the 64x72 first-symbol desync is 128x128 superblocks, not odd height -- refuse them by name above 64x64, and gate the odd-size ladder
3 changed files +354 -4
- crates/ec-av1/src/refusal_inventory.rs +1 -0
- crates/ec-av1/src/stream.rs +256 -4
- lanes/oddh-r2.report.md +97 -0
crates/ec-av1/src/refusal_inventory.rsmodified+1 -0
| @@ -52,6 +52,7 @@ const REFUSALS: &[&str] = &[ | ||
| 52 | 52 | "a sub-8x8 leaf that uses intrabc (this reader has no block-vector path; the 8x8-and-up reader reconstructs one)", |
| 53 | 53 | "an intrabc block under TxMode::Select (its transform size is coded by the inter var-tx partition tree, which this decoder never reads)", |
| 54 | 54 | "a bit depth of 12 (this decoder is gated at 8 and 10 only: warp/MC/wiener rounding shifts change at 12-bit and no 12-bit gate exists)", |
| 55 | + "a sequence using 128x128 superblocks on a frame larger than 64x64 (this decoder's whole partition/CDEF/LR grid is 64x64-superblock only; aomenc picks 128x128 at --cpu-used=0)", | |
| 55 | 56 | "a frame OBU with no tile group", |
| 56 | 57 | "a frame naming primary_ref_frame at a reference slot with no saved CDF state", |
| 57 | 58 | "a frame with no mode-info grid", |
crates/ec-av1/src/stream.rsmodified+256 -4
| @@ -501,6 +501,37 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> { | ||
| 501 | 501 | "a bit depth of 12 (this decoder is gated at 8 and 10 only: warp/MC/wiener rounding shifts change at 12-bit and no 12-bit gate exists)", |
| 502 | 502 | )); |
| 503 | 503 | } |
| 504 | + // lane-oddh r2: `use_128x128_superblock` reaches every level of the | |
| 505 | + // decode -- the partition tree starts at BLOCK_128X128, `SB_MI` is 32 | |
| 506 | + // mi units, and the CDEF/LR/deblock grids are per-128 -- and this | |
| 507 | + // decoder is written for 64x64 superblocks throughout (`SB_MI = 16`, | |
| 508 | + // no BLOCK_128X128 partition read at all). Until r1 that was SILENT: | |
| 509 | + // a 64x72 aomenc key frame at `--cpu-used=0` (libaom picks 128x128 | |
| 510 | + // whenever speed is 0, `av1_select_sb_size`) desynced at the very | |
| 511 | + // first symbol -- aomdec reads a gathered 2-symbol | |
| 512 | + // BLOCK_128X128 partition (has_cols false at mi_cols=16, | |
| 513 | + // has_rows true at mi_rows=18) where we read a 10-symbol | |
| 514 | + // BLOCK_64X64 one from the same byte, giving PARTITION_VERT_4 (9) | |
| 515 | + // against SPLIT (3). Refuse by name rather than decode wrong pixels. | |
| 516 | + // | |
| 517 | + // Scoped, not blanket (measured: a blanket refusal red-lined 29 | |
| 518 | + // previously pixel-exact gates): on a frame of at most 64x64 a | |
| 519 | + // 128x128 superblock decodes IDENTICALLY to a 64x64 one -- mi (0,0) | |
| 520 | + // has neither `has_rows` nor `has_cols`, so BLOCK_128X128 is a forced | |
| 521 | + // SPLIT that reads no symbol, and only one of its four 64x64 children | |
| 522 | + // is inside the frame. Every sibling inter gate at 64x64 and | |
| 523 | + // `--cpu-used=0` is exactly that case. The divergence starts the | |
| 524 | + // moment a superblock has a second child in frame. | |
| 525 | + if parser | |
| 526 | + .sequence_header() | |
| 527 | + .is_some_and(|seq| seq.use_128x128_superblock) | |
| 528 | + && (header.mi_cols > 16 || header.mi_rows > 16) | |
| 529 | + { | |
| 530 | + return Err(Error::unsupported( | |
| 531 | + "AV1 decode_stream", | |
| 532 | + "a sequence using 128x128 superblocks on a frame larger than 64x64 (this decoder's whole partition/CDEF/LR grid is 64x64-superblock only; aomenc picks 128x128 at --cpu-used=0)", | |
| 533 | + )); | |
| 534 | + } | |
| 504 | 535 | crate::decode::set_bit_depth(bit_depth); |
| 505 | 536 | // lane-av1comp: `comp_group_idx`/`compound_idx`'s own gating bits. |
| 506 | 537 | let enable_masked_compound = parser |
| @@ -908,6 +939,209 @@ mod tests { | ||
| 908 | 939 | ); |
| 909 | 940 | } |
| 910 | 941 | |
| 942 | + /// lane-oddh r2 GATE: the frame-edge half-strip arms r1 added (a 64x32 / | |
| 943 | + /// 32x64 superblock-level or 16x8 / 8x16 16-level INTER block where the | |
| 944 | + /// frame's true edge cuts the strip in half) actually fire and decode | |
| 945 | + /// pixel-exact, at both bit depths. 160 = two full superblock rows plus | |
| 946 | + /// 32 pixels, so every superblock in the last row is a half strip; without | |
| 947 | + /// r1's arms these attempts refused outright, which is why this gate | |
| 948 | + /// asserts a nonzero `edge_rect_strip_hits` DELTA on attempts that were | |
| 949 | + /// actually compared -- a refused attempt's hits would prove nothing | |
| 950 | + /// (class "counter from refused stream"). | |
| 951 | + #[test] | |
| 952 | + #[ignore = "2026-09-02 lane-oddh r2: no aomenc recipe reaches the INTER edge half-strip arm yet -- rect partitions OFF makes the encoder answer the forced gathered edge symbol SPLIT every time (both bit depths decode 192x160 pixel-exact, edge_rect_strip_hits=0), and rect ON stops at three other lanes' gaps first: at cq 40 'a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual coding', at cq 62 'an INTER 32x32 partition type this decoder does not code (value=8/9)' (HORZ_4/VERT_4 even with --enable-1to4-partitions=0), and at min-partition 16 'a HORZ/VERT intra strip below 16x16 with a split transform'. The KEY-frame half of the same edge is gated: the tiny size sweep now covers 64x72/72x64/64x136/136x64/192x136"] | |
| 953 | + fn a_real_aomenc_inter_frame_edge_half_strip_decodes_pixel_exact() { | |
| 954 | + const NAME: &str = "a_real_aomenc_inter_frame_edge_half_strip_decodes_pixel_exact"; | |
| 955 | + let _gate_lock = lock_gate_counters(); | |
| 956 | + if !have_ffmpeg() || !have_aomenc() { | |
| 957 | + eprintln!("SKIP {NAME}: no ffmpeg/aomenc"); | |
| 958 | + return; | |
| 959 | + } | |
| 960 | + let (width, height, frames) = (192usize, 160usize, 6usize); | |
| 961 | + let mut compared = 0u32; | |
| 962 | + let mut strip_hits = 0usize; | |
| 963 | + let mut refused = 0u32; | |
| 964 | + for bit_depth in [8u32, 10u32] { | |
| 965 | + let duration = frames as f64 / 25.0; | |
| 966 | + let source = format!("testsrc2=size={width}x{height}:duration={duration}:rate=25"); | |
| 967 | + let pix_fmt = if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" }; | |
| 968 | + let y4m = Command::new("ffmpeg") | |
| 969 | + .args([ | |
| 970 | + "-v", "error", "-f", "lavfi", "-i", &source, "-t", &duration.to_string(), | |
| 971 | + "-pix_fmt", pix_fmt, "-strict", "-1", "-f", "yuv4mpegpipe", "-", | |
| 972 | + ]) | |
| 973 | + .stdin(Stdio::null()) | |
| 974 | + .stdout(Stdio::piped()) | |
| 975 | + .stderr(Stdio::piped()) | |
| 976 | + .output() | |
| 977 | + .expect("ffmpeg failed to run"); | |
| 978 | + assert!( | |
| 979 | + y4m.status.success(), | |
| 980 | + "{NAME}: ffmpeg refused the {bit_depth}-bit fixture: {}", | |
| 981 | + String::from_utf8_lossy(&y4m.stderr) | |
| 982 | + ); | |
| 983 | + let depth_arg = format!("--bit-depth={bit_depth}"); | |
| 984 | + let input_depth_arg = format!("--input-bit-depth={bit_depth}"); | |
| 985 | + let mut child = Command::new(aomenc_path()) | |
| 986 | + .args([ | |
| 987 | + "--codec=av1", "--passes=1", "--end-usage=q", "--cq-level=62", | |
| 988 | + // cpu-used >= 1 keeps libaom on 64x64 superblocks at this | |
| 989 | + // size (`av1_select_sb_size`: speed >= 1 and <= 480p). | |
| 990 | + "--cpu-used=4", "--threads=1", "--row-mt=0", "--kf-max-dist=1000", | |
| 991 | + &depth_arg, &input_depth_arg, | |
| 992 | + // The tool set every sibling inter gate pins; the edge | |
| 993 | + // strip itself needs rect partitions left ON. | |
| 994 | + "--enable-warped-motion=0", "--enable-obmc=0", "--enable-masked-comp=0", | |
| 995 | + "--enable-interintra-comp=0", "--enable-onesided-comp=0", | |
| 996 | + "--enable-interintra-wedge=0", "--enable-smooth-interintra=0", | |
| 997 | + // Rect partitions stay ON: the edge strip is a FORCED | |
| 998 | + // (gathered) HORZ at the boundary, but with rect coding | |
| 999 | + // off the encoder answers that gathered symbol SPLIT every | |
| 1000 | + // time and the arm never fires (measured, r2). | |
| 1001 | + "--enable-ab-partitions=0", "--enable-1to4-partitions=0", | |
| 1002 | + "--enable-palette=0", "--enable-intrabc=0", "--enable-cdef=0", | |
| 1003 | + "--enable-restoration=0", "--enable-ref-frame-mvs=0", | |
| 1004 | + "--enable-tx-size-search=0", "--enable-filter-intra=0", | |
| 1005 | + "--enable-smooth-intra=0", "--enable-paeth-intra=0", | |
| 1006 | + "--enable-directional-intra=0", "--enable-angle-delta=0", | |
| 1007 | + "--enable-cfl-intra=0", | |
| 1008 | + // 16 is the smallest leaf this decoder codes rect strips | |
| 1009 | + // at; below it the sub-16 strip/1:4 refusals fire first | |
| 1010 | + // and the gate never reaches the edge arm. | |
| 1011 | + // 160 = two full superblock rows plus 32, so the forced | |
| 1012 | + // HORZ at the last row is a 64x32 -- the superblock-level | |
| 1013 | + // arm -- and a 32 floor keeps the run out of the sub-16 | |
| 1014 | + // rect-strip gap another lane owns. | |
| 1015 | + "--min-partition-size=32", "--max-partition-size=64", | |
| 1016 | + "--obu", "-o", "-", "-", | |
| 1017 | + ]) | |
| 1018 | + .stdin(Stdio::piped()) | |
| 1019 | + .stdout(Stdio::piped()) | |
| 1020 | + .stderr(Stdio::piped()) | |
| 1021 | + .spawn() | |
| 1022 | + .expect("aomenc failed to start"); | |
| 1023 | + child.stdin.take().expect("aomenc stdin").write_all(&y4m.stdout).expect("write y4m"); | |
| 1024 | + let out = child.wait_with_output().expect("aomenc failed to run"); | |
| 1025 | + assert!(out.status.success(), "aomenc refused: {}", String::from_utf8_lossy(&out.stderr)); | |
| 1026 | + let stream = out.stdout; | |
| 1027 | + | |
| 1028 | + let before = crate::decode::edge_rect_strip_hits(); | |
| 1029 | + let decoded = match decode_stream(&stream) { | |
| 1030 | + Ok(f) => f, | |
| 1031 | + Err(e) => { | |
| 1032 | + let msg = e.to_string(); | |
| 1033 | + assert!( | |
| 1034 | + msg.contains("unsupported"), | |
| 1035 | + "{NAME}: {bit_depth}-bit failed outright, not a named refusal: {msg}" | |
| 1036 | + ); | |
| 1037 | + eprintln!("{NAME}: {bit_depth}-bit REFUSED {msg}"); | |
| 1038 | + refused += 1; | |
| 1039 | + continue; | |
| 1040 | + } | |
| 1041 | + }; | |
| 1042 | + let reference = if bit_depth == 10 { | |
| 1043 | + ffmpeg_decode_sequence_10bit(&stream, width, height, frames) | |
| 1044 | + } else { | |
| 1045 | + ffmpeg_decode_sequence(&stream, width, height, frames) | |
| 1046 | + }; | |
| 1047 | + assert_eq!( | |
| 1048 | + decoded.len(), | |
| 1049 | + reference.len(), | |
| 1050 | + "{NAME}: {bit_depth}-bit frame count" | |
| 1051 | + ); | |
| 1052 | + for (i, (ours, theirs)) in decoded.iter().zip(&reference).enumerate() { | |
| 1053 | + let nd = |a: &[u16], b: &[u16]| a.iter().zip(b).filter(|(x, y)| x != y).count(); | |
| 1054 | + assert_eq!( | |
| 1055 | + (nd(&ours.y, &theirs.y), nd(&ours.u, &theirs.u), nd(&ours.v, &theirs.v)), | |
| 1056 | + (0, 0, 0), | |
| 1057 | + "{NAME}: {bit_depth}-bit frame {i} differs from ffmpeg" | |
| 1058 | + ); | |
| 1059 | + } | |
| 1060 | + compared += 1; | |
| 1061 | + strip_hits += crate::decode::edge_rect_strip_hits() - before; | |
| 1062 | + } | |
| 1063 | + assert!(compared > 0, "{NAME}: every attempt refused ({refused}) -- gate proved nothing"); | |
| 1064 | + assert!( | |
| 1065 | + strip_hits > 0, | |
| 1066 | + "{NAME}: {compared} attempts decoded pixel-exact but not one frame-edge half strip \ | |
| 1067 | + fired -- the recipe no longer reaches the arm this gate exists for" | |
| 1068 | + ); | |
| 1069 | + eprintln!("{NAME}: {compared} attempts pixel-exact, edge_rect_strip_hits={strip_hits}, {refused} refusals"); | |
| 1070 | + } | |
| 1071 | + | |
| 1072 | + /// lane-oddh r2 GATE: a REAL aomenc stream that uses 128x128 superblocks | |
| 1073 | + /// is refused by name, not silently mis-decoded. This is the root cause of | |
| 1074 | + /// r1's pinned 64x72 first-symbol desync: libaom's `av1_select_sb_size` | |
| 1075 | + /// returns BLOCK_128X128 whenever speed is 0, so a tiny frame encoded at | |
| 1076 | + /// `--cpu-used=0` carries 128x128 superblocks, and this 64x64-only | |
| 1077 | + /// decoder read a 10-symbol BLOCK_64X64 partition (value 9, VERT_4) where | |
| 1078 | + /// aomdec read a gathered 2-symbol BLOCK_128X128 one (value 3, SPLIT) from | |
| 1079 | + /// the same byte -- the uncompressed header parse was byte-identical | |
| 1080 | + /// (49 bits, tile data at file offset 20; hand-verified against spec | |
| 1081 | + /// 5.9.2 field by field). | |
| 1082 | + /// | |
| 1083 | + /// The `use_128x128_superblock` assert is the "knob reached the tool" | |
| 1084 | + /// half: without it, an aomenc that ignored `--sb-size=128` would leave | |
| 1085 | + /// the gate asserting a refusal that never fires. | |
| 1086 | + #[test] | |
| 1087 | + fn a_real_aomenc_128x128_superblock_stream_is_refused_by_name() { | |
| 1088 | + if !have_ffmpeg() || !have_aomenc() { | |
| 1089 | + eprintln!("SKIP: no ffmpeg/aomenc"); | |
| 1090 | + return; | |
| 1091 | + } | |
| 1092 | + let (width, height) = (64usize, 72usize); | |
| 1093 | + let y4m = Command::new("ffmpeg") | |
| 1094 | + .args([ | |
| 1095 | + "-v", "error", "-f", "lavfi", "-i", | |
| 1096 | + "mandelbrot=size=64x72:rate=25:start_x=-0.6:start_y=-0.4", "-t", "0.04", | |
| 1097 | + "-pix_fmt", "yuv420p", "-f", "yuv4mpegpipe", "-", | |
| 1098 | + ]) | |
| 1099 | + .stdin(Stdio::null()) | |
| 1100 | + .stdout(Stdio::piped()) | |
| 1101 | + .stderr(Stdio::piped()) | |
| 1102 | + .output() | |
| 1103 | + .expect("ffmpeg failed to run"); | |
| 1104 | + assert!(y4m.status.success(), "ffmpeg fixture: {}", String::from_utf8_lossy(&y4m.stderr)); | |
| 1105 | + let mut child = Command::new(aomenc_path()) | |
| 1106 | + .args([ | |
| 1107 | + "--codec=av1", "--passes=1", "--end-usage=q", "--cq-level=32", | |
| 1108 | + "--cpu-used=0", "--sb-size=128", "--kf-max-dist=0", "--limit=1", | |
| 1109 | + "--threads=1", "--row-mt=0", "--obu", "-o", "-", "-", | |
| 1110 | + ]) | |
| 1111 | + .stdin(Stdio::piped()) | |
| 1112 | + .stdout(Stdio::piped()) | |
| 1113 | + .stderr(Stdio::piped()) | |
| 1114 | + .spawn() | |
| 1115 | + .expect("aomenc failed to start"); | |
| 1116 | + child.stdin.take().expect("aomenc stdin").write_all(&y4m.stdout).expect("write y4m"); | |
| 1117 | + let out = child.wait_with_output().expect("aomenc failed to run"); | |
| 1118 | + assert!(out.status.success(), "aomenc refused: {}", String::from_utf8_lossy(&out.stderr)); | |
| 1119 | + let stream = out.stdout; | |
| 1120 | + | |
| 1121 | + // The knob actually arrived: this stream's sequence header codes | |
| 1122 | + // `use_128x128_superblock = 1`. | |
| 1123 | + let mut parser = Av1Parser::new(); | |
| 1124 | + let mut pos = 0usize; | |
| 1125 | + let mut sb128 = false; | |
| 1126 | + while pos < stream.len() { | |
| 1127 | + let Ok(obu) = parser.parse_obu(&stream[pos..]) else { | |
| 1128 | + break; | |
| 1129 | + }; | |
| 1130 | + pos += obu.total_size.max(1); | |
| 1131 | + if let Some(seq) = parser.sequence_header() { | |
| 1132 | + sb128 = seq.use_128x128_superblock; | |
| 1133 | + break; | |
| 1134 | + } | |
| 1135 | + } | |
| 1136 | + assert!(sb128, "aomenc ignored --sb-size=128: this stream is 64x64-superblock"); | |
| 1137 | + | |
| 1138 | + let err = decode_stream(&stream).unwrap_err().to_string(); | |
| 1139 | + assert!( | |
| 1140 | + err.contains("a sequence using 128x128 superblocks"), | |
| 1141 | + "expected the 128x128-superblock refusal for {width}x{height}, got: {err}" | |
| 1142 | + ); | |
| 1143 | + } | |
| 1144 | + | |
| 911 | 1145 | /// `decode_stream` on a lone key frame's stream matches both the tile |
| 912 | 1146 | /// path (`decode_key_frame_tile` called directly on `Encoded::tile`) and |
| 913 | 1147 | /// the encoder's own reconstruction, at an even and an odd size. |
| @@ -11259,8 +11493,26 @@ mod tests { | ||
| 11259 | 11493 | eprintln!("SKIP: no ffmpeg/aomenc"); |
| 11260 | 11494 | return; |
| 11261 | 11495 | } |
| 11262 | - let sizes: &[(usize, usize)] = | |
| 11263 | - &[(8, 8), (16, 16), (32, 32), (16, 32), (32, 16), (64, 64), (48, 48), (24, 24)]; | |
| 11496 | + // lane-oddh r2: the second half of this list is the odd-height / | |
| 11497 | + // odd-width ladder -- frame sizes whose last superblock row or column | |
| 11498 | + // is a partial 64 (72 = one full SB plus 8 rows, 136 = two plus 8), | |
| 11499 | + // which is where the frame-edge half-strip path r1 added is the only | |
| 11500 | + // way to code the edge. 192x136 is the inter-sized member. | |
| 11501 | + let sizes: &[(usize, usize)] = &[ | |
| 11502 | + (8, 8), | |
| 11503 | + (16, 16), | |
| 11504 | + (32, 32), | |
| 11505 | + (16, 32), | |
| 11506 | + (32, 16), | |
| 11507 | + (64, 64), | |
| 11508 | + (48, 48), | |
| 11509 | + (24, 24), | |
| 11510 | + (64, 72), | |
| 11511 | + (72, 64), | |
| 11512 | + (64, 136), | |
| 11513 | + (136, 64), | |
| 11514 | + (192, 136), | |
| 11515 | + ]; | |
| 11264 | 11516 | let mut total_exact = 0u32; |
| 11265 | 11517 | for &(width, height) in sizes { |
| 11266 | 11518 | let mut ok = 0u32; |
| @@ -11378,12 +11630,12 @@ mod tests { | ||
| 11378 | 11630 | } |
| 11379 | 11631 | // Hit counter: the sweep proved nothing unless every size x seed |
| 11380 | 11632 | // attempt really ran end to end (aomenc -> us -> ffmpeg compare). |
| 11381 | - // Floor (hit counter): 7 of the 8 sizes must decode all 10 seeds | |
| 11633 | + // Floor (hit counter): 12 of the 13 sizes must decode all 10 seeds | |
| 11382 | 11634 | // pixel-exact -- only 8x8 is allowed to refuse outright today. If a |
| 11383 | 11635 | // future change makes sizes refuse instead of decode, this fails |
| 11384 | 11636 | // rather than passing on refusals alone. |
| 11385 | 11637 | assert!( |
| 11386 | - total_exact >= 70, | |
| 11638 | + total_exact >= 120, | |
| 11387 | 11639 | "tiny sweep only reached {total_exact} pixel-exact attempts (floor 70) -- \ |
| 11388 | 11640 | refusals cannot substitute for decodes" |
| 11389 | 11641 | ); |
lanes/oddh-r2.report.mdadded+97 -0
| @@ -0,0 +1,97 @@ | ||
| 1 | +# lane-oddh r2 — the 64x72 first-symbol desync is 128x128 superblocks | |
| 2 | + | |
| 3 | +## Root cause (byte-level proof, not inference) | |
| 4 | + | |
| 5 | +r1's pinned defect — a 64x72 aomenc KEY frame desyncing at the FIRST symbol | |
| 6 | +(aomdec value=3, ours 9) — is **not** an odd-height defect and **not** a header | |
| 7 | +parse defect. The stream's sequence header codes `use_128x128_superblock = 1`, | |
| 8 | +and this decoder is 64x64-superblock only (`SB_MI = 16`, no BLOCK_128X128 | |
| 9 | +partition read anywhere; `decode.rs` never reads `use_128x128_superblock`). | |
| 10 | + | |
| 11 | +libaom picks it: `av1_select_sb_size` (encoder_utils.c:1000-1003) returns | |
| 12 | +BLOCK_64X64 only when `speed >= 1 && min(w,h) <= 480`. r1's fixture was | |
| 13 | +encoded at `--cpu-used=0`, so speed 0 fell through to BLOCK_128X128. | |
| 14 | + | |
| 15 | +What the two decoders do with the same first byte: | |
| 16 | + | |
| 17 | +| | libaom (aomdec) | ours | | |
| 18 | +|---|---|---| | |
| 19 | +| first block | BLOCK_128X128 at mi (0,0): `has_cols = 0+16 < 16` false, `has_rows = 16 < 18` true | BLOCK_64X64 at mi (0,0) | | |
| 20 | +| symbol read | gathered 2-symbol partition (`partition_gather_horz_alike`) | 10-symbol `partition_cdf[12]` | | |
| 21 | +| value | 3 = PARTITION_SPLIT | 9 = PARTITION_VERT_4 | | |
| 22 | + | |
| 23 | +Ruled out first, by hand, field by field against spec 5.9.2 for this stream: | |
| 24 | +the uncompressed header is **49 bits** (3 before tile_info, 1 tile_info, 12 | |
| 25 | +quant, 1 seg, 1 delta, 29 loop filter — levels 36/38/21/19, sharpness 0, | |
| 26 | +mode_ref_delta_enabled 1, update 0 — 0 cdef, 0 lr, tx_mode 1, reduced_tx_set 1), | |
| 27 | +byte-aligning tile data to file offset 20. Our parser reads exactly the same 49 | |
| 28 | +bits. Two independent msac implementations (ours and a from-spec python one) | |
| 29 | +read symbol 9 from offset 20 with `partition_cdf[12]`, so the bytes and the | |
| 30 | +table are both ours-correct — only the *block size* is wrong. | |
| 31 | + | |
| 32 | +EVIDENCE: hand-parsed header bits + msac offset probe (both diagnostics reverted after use) | parsed k-64x72.obu, printed per-section bit positions (3/4/16/17/18/47/47/47/49), then decoded the first partition symbol at file offsets 16..24 with `PARTITION_W64[0]` in ours and in a from-spec python msac | both give 9 at offset 20 (aomdec: 3), i.e. same bytes, same table, different alphabet | |
| 33 | + | |
| 34 | +## What changed | |
| 35 | + | |
| 36 | +- `crates/ec-av1/src/stream.rs:509` — `decode_stream` now REFUSES a sequence | |
| 37 | + with `use_128x128_superblock` **on a frame larger than 64x64** by name | |
| 38 | + instead of silently decoding it as 64x64 superblocks (wrong pixels, whole | |
| 39 | + frame). The scoping is measured, not reasoned: a blanket refusal red-lined | |
| 40 | + 29 previously pixel-exact gates (29 failed / 318 passed), because at | |
| 41 | + <= 64x64 a 128x128 superblock decodes identically -- mi (0,0) has neither | |
| 42 | + `has_rows` nor `has_cols`, so BLOCK_128X128 is a forced SPLIT that reads no | |
| 43 | + symbol and only one 64x64 child is in frame. Every sibling inter gate at | |
| 44 | + 64x64 `--cpu-used=0` is exactly that case. | |
| 45 | +- `crates/ec-av1/src/stream.rs` — new gate | |
| 46 | + `a_real_aomenc_128x128_superblock_stream_is_refused_by_name`: real aomenc, | |
| 47 | + 64x72, `--cpu-used=0 --sb-size=128`; asserts the stream's sequence header | |
| 48 | + really codes `use_128x128_superblock` (knob-reached-the-tool) and then that | |
| 49 | + the refusal fires. | |
| 50 | +- `crates/ec-av1/src/stream.rs` — `a_real_aomenc_tiny_frame_size_sweep_decodes_pixel_exact` | |
| 51 | + extended with the odd ladder 64x72, 72x64, 64x136, 136x64, 192x136; floor | |
| 52 | + raised 70 -> 120 pixel-exact attempts. | |
| 53 | +- `crates/ec-av1/src/refusal_inventory.rs` — the new refusal string pinned. | |
| 54 | +- `crates/ec-av1/src/stream.rs` — `a_real_aomenc_inter_frame_edge_half_strip_decodes_pixel_exact` | |
| 55 | + written and left `#[ignore]`d with its measured reason (below). | |
| 56 | + | |
| 57 | +## The size ladder (the table the charter asked for) | |
| 58 | + | |
| 59 | +`cargo test -p ec-av1 --lib -- a_real_aomenc_tiny_frame_size_sweep_decodes_pixel_exact`, | |
| 60 | +10 seeds each, real aomenc at `--cpu-used=4` (= 64x64 superblocks), 8-bit: | |
| 61 | + | |
| 62 | +| size | pixel-exact | refused | | |
| 63 | +|---|---|---| | |
| 64 | +| 8x8 | 0/10 | 10 (16x16 rect transform, pre-existing) | | |
| 65 | +| 16x16, 32x32, 16x32, 32x16, 64x64, 48x48, 24x24 | 10/10 each | 0 | | |
| 66 | +| **64x72, 72x64, 64x136, 136x64, 192x136** | **10/10 each** | 0 | | |
| 67 | + | |
| 68 | +EVIDENCE: $HOME/.cache/oddh-suite-r2.log + the run above | 13 sizes x 10 seeds, aomenc -> our decoder -> ffmpeg sample compare | 120 pixel-exact attempts, 0 mismatches, "tiny frame sweep: 120 pixel-exact attempts" | |
| 69 | + | |
| 70 | +So odd height/width at 64x64 superblocks is **clean**, including r1's | |
| 71 | +frame-edge half-strip code on the KEY path. | |
| 72 | + | |
| 73 | +## Open / deferred | |
| 74 | + | |
| 75 | +- deferred: 128x128 superblock decode — refused by name, not implemented — the | |
| 76 | + partition tree, `SB_MI`, CDEF/LR/deblock grids and the loop-filter unit size | |
| 77 | + are all 64-only; that is a lane, not a fix. Unblocked by: a lane that makes | |
| 78 | + `SB_MI` a parameter and adds the BLOCK_128X128 partition read. | |
| 79 | +- deferred: the INTER frame-edge half-strip arms r1 added are still UNGATED. | |
| 80 | + Measured this round at 192x160 (last superblock row 32 tall, so the forced | |
| 81 | + gathered edge symbol is a 64x32): with `--enable-rect-partitions=0` both bit | |
| 82 | + depths decode 6 frames **pixel-exact** but `edge_rect_strip_hits = 0` (the | |
| 83 | + encoder answers the forced symbol SPLIT every time); with rect ON the run | |
| 84 | + stops at other lanes' gaps — cq 40 "a non-skip rectangular (HORZ/VERT/HORZ_B) | |
| 85 | + strip needs rectangular residual coding", cq 62 "an INTER 32x32 partition | |
| 86 | + type this decoder does not code (value=8/9)", min-partition 16 "a HORZ/VERT | |
| 87 | + intra strip below 16x16 with a split transform". Unblocked by: the rect | |
| 88 | + inter-residual lane. | |
| 89 | + | |
| 90 | +## Suite | |
| 91 | + | |
| 92 | +`cargo test -p ec-av1 --lib` (systemd unit, log `$HOME/.cache/oddh-suite-r2.log`): | |
| 93 | +the blanket-refusal run was 318 passed / 29 failed / 32 ignored, every failure | |
| 94 | +the new refusal firing on a 64x64 `--cpu-used=0` stream. After scoping the | |
| 95 | +refusal to frames larger than 64x64, the 7-gate subset covering all of them | |
| 96 | +plus the three new/extended gates is green (7 passed, 0 failed); the full-suite | |
| 97 | +rerun on the scoped tree is launched to the same log and is r3's first read. |