The frame-edge partition bit was read and thrown away
Browse files at this commit005ba230362ad229400c099f4fc870b5d8f3ecd9Parent: 5959a93- fix
- the frame-edge partition bit was read and thrown away
5 changed files +226 -65
- crates/ec-av1/fixtures/reelb_head_key_frame.obu +0 -0
- crates/ec-av1/src/decode.rs +143 -65
- crates/ec-av1/src/refusal_inventory.rs +1 -0
- crates/ec-av1/src/stream.rs +35 -0
- lanes/golomb-r1.report.md +47 -0
crates/ec-av1/fixtures/reelb_head_key_frame.obuadded+0 -0
Binary file changed
crates/ec-av1/src/decode.rsmodified+143 -65
| @@ -10213,16 +10213,31 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 10213 | } | 10213 | } |
| 10214 | p | 10214 | p |
| 10215 | } else { | 10215 | } else { |
| 10216 | + // lane-golomb r1 (class `parsed-then-discarded`): the gathered | ||
| 10217 | + // bit is the answer, not a formality -- libaom's | ||
| 10218 | + // `ec_read_partition_impl` returns `PARTITION_HORZ` (resp. | ||
| 10219 | + // `PARTITION_VERT`) when it reads 0, and only `PARTITION_SPLIT` | ||
| 10220 | + // when it reads 1. Forcing SPLIT here desynced the last | ||
| 10221 | + // superblock row of every frame whose height is not a multiple | ||
| 10222 | + // of 64 -- the ReelB head (3840x1608) diverges at | ||
| 10223 | + // mi_row=400 mi_col=0, the first block of that row. | ||
| 10216 | match (has_cols, has_rows) { | 10224 | match (has_cols, has_rows) { |
| 10217 | (true, false) => { | 10225 | (true, false) => { |
| 10218 | - dec.symbol_fixed(&gather(&cdfs.partition_w64[ctx], VERT_ALIKE)); | 10226 | + if dec.symbol_fixed(&gather(&cdfs.partition_w64[ctx], VERT_ALIKE)) == 1 { |
| 10227 | + PARTITION_SPLIT | ||
| 10228 | + } else { | ||
| 10229 | + PARTITION_HORZ | ||
| 10230 | + } | ||
| 10219 | } | 10231 | } |
| 10220 | (false, true) => { | 10232 | (false, true) => { |
| 10221 | - dec.symbol_fixed(&gather(&cdfs.partition_w64[ctx], HORZ_ALIKE)); | 10233 | + if dec.symbol_fixed(&gather(&cdfs.partition_w64[ctx], HORZ_ALIKE)) == 1 { |
| 10234 | + PARTITION_SPLIT | ||
| 10235 | + } else { | ||
| 10236 | + PARTITION_VERT | ||
| 10237 | + } | ||
| 10222 | } | 10238 | } |
| 10223 | - _ => {} | 10239 | + _ => PARTITION_SPLIT, |
| 10224 | } | 10240 | } |
| 10225 | - PARTITION_SPLIT | ||
| 10226 | }; | 10241 | }; |
| 10227 | match part { | 10242 | match part { |
| 10228 | PARTITION_NONE => { | 10243 | PARTITION_NONE => { |
| @@ -10279,20 +10294,27 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 10279 | } else { | 10294 | } else { |
| 10280 | match (has_cols32, has_rows32) { | 10295 | match (has_cols32, has_rows32) { |
| 10281 | (true, false) => { | 10296 | (true, false) => { |
| 10282 | - dec.symbol_fixed(&gather( | 10297 | + // lane-golomb r1 (class `parsed-then-discarded`): the gathered |
| 10283 | - &cdfs.partition_w32[ctx32], | 10298 | + // bit IS the partition -- 0 means PARTITION_HORZ, only 1 means SPLIT |
| 10284 | - VERT_ALIKE, | 10299 | + // (libaom `ec_read_partition_impl`). |
| 10285 | - )); | 10300 | + if dec.symbol_fixed(&gather(&cdfs.partition_w32[ctx32], VERT_ALIKE)) == 1 { |
| 10301 | + PARTITION_SPLIT | ||
| 10302 | + } else { | ||
| 10303 | + PARTITION_HORZ | ||
| 10304 | + } | ||
| 10286 | } | 10305 | } |
| 10287 | (false, true) => { | 10306 | (false, true) => { |
| 10288 | - dec.symbol_fixed(&gather( | 10307 | + // lane-golomb r1 (class `parsed-then-discarded`): the gathered |
| 10289 | - &cdfs.partition_w32[ctx32], | 10308 | + // bit IS the partition -- 0 means PARTITION_VERT, only 1 means SPLIT |
| 10290 | - HORZ_ALIKE, | 10309 | + // (libaom `ec_read_partition_impl`). |
| 10291 | - )); | 10310 | + if dec.symbol_fixed(&gather(&cdfs.partition_w32[ctx32], HORZ_ALIKE)) == 1 { |
| 10311 | + PARTITION_SPLIT | ||
| 10312 | + } else { | ||
| 10313 | + PARTITION_VERT | ||
| 10314 | + } | ||
| 10292 | } | 10315 | } |
| 10293 | - _ => {} | 10316 | + _ => PARTITION_SPLIT, |
| 10294 | } | 10317 | } |
| 10295 | - PARTITION_SPLIT | ||
| 10296 | }; | 10318 | }; |
| 10297 | match part32 { | 10319 | match part32 { |
| 10298 | PARTITION_NONE => { | 10320 | PARTITION_NONE => { |
| @@ -10710,15 +10732,29 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 10710 | does not code yet", | 10732 | does not code yet", |
| 10711 | )); | 10733 | )); |
| 10712 | } | 10734 | } |
| 10713 | - if has_cols16 { | 10735 | + // lane-golomb r1 (class |
| 10736 | + // `parsed-then-discarded`): the gathered | ||
| 10737 | + // bit IS the partition -- 0 names | ||
| 10738 | + // PARTITION_HORZ (resp. VERT), only 1 is | ||
| 10739 | + // SPLIT (libaom `ec_read_partition_impl`). | ||
| 10740 | + // This path can only walk the four SPLIT | ||
| 10741 | + // leaves, so a 0 refuses by name instead | ||
| 10742 | + // of desyncing. | ||
| 10743 | + let edge_split = if has_cols16 { | ||
| 10714 | dec.symbol_fixed(&gather( | 10744 | dec.symbol_fixed(&gather( |
| 10715 | &cdfs.partition_w16[ctx16], | 10745 | &cdfs.partition_w16[ctx16], |
| 10716 | VERT_ALIKE, | 10746 | VERT_ALIKE, |
| 10717 | - )); | 10747 | + )) |
| 10718 | } else { | 10748 | } else { |
| 10719 | dec.symbol_fixed(&gather( | 10749 | dec.symbol_fixed(&gather( |
| 10720 | &cdfs.partition_w16[ctx16], | 10750 | &cdfs.partition_w16[ctx16], |
| 10721 | HORZ_ALIKE, | 10751 | HORZ_ALIKE, |
| 10752 | + )) | ||
| 10753 | + }; | ||
| 10754 | + if edge_split == 0 { | ||
| 10755 | + return Err(unsupported( | ||
| 10756 | + "a 16x16 block at the true frame edge coded as a \ | ||
| 10757 | + rect strip rather than SPLIT", | ||
| 10722 | )); | 10758 | )); |
| 10723 | } | 10759 | } |
| 10724 | let (mi_row0, mi_col0) = | 10760 | let (mi_row0, mi_col0) = |
| @@ -11269,22 +11305,27 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 11269 | tx_select, | 11305 | tx_select, |
| 11270 | reduced_tx_set, | 11306 | reduced_tx_set, |
| 11271 | )?; | 11307 | )?; |
| 11272 | - decode_block_rect64( | 11308 | + // lane-golomb r1: at the frame edge only the first half of the |
| 11273 | - &mut dec, | 11309 | + // strip is coded (libaom `decode_partition` guards the second |
| 11274 | - &mut cdfs, | 11310 | + // with the same has_rows test that made this partition non-square). |
| 11275 | - &mut neighbours, | 11311 | + if has_rows { |
| 11276 | - (at.0 + 2, at.1), | 11312 | + decode_block_rect64( |
| 11277 | - 64, | 11313 | + &mut dec, |
| 11278 | - 32, | 11314 | + &mut cdfs, |
| 11279 | - &mut y, | 11315 | + &mut neighbours, |
| 11280 | - &mut u, | 11316 | + (at.0 + 2, at.1), |
| 11281 | - &mut v, | 11317 | + 64, |
| 11282 | - enable_filter_intra, | 11318 | + 32, |
| 11283 | - allow_screen_content_tools, | 11319 | + &mut y, |
| 11284 | - base_q_idx, | 11320 | + &mut u, |
| 11285 | - tx_select, | 11321 | + &mut v, |
| 11286 | - reduced_tx_set, | 11322 | + enable_filter_intra, |
| 11287 | - )?; | 11323 | + allow_screen_content_tools, |
| 11324 | + base_q_idx, | ||
| 11325 | + tx_select, | ||
| 11326 | + reduced_tx_set, | ||
| 11327 | + )?; | ||
| 11328 | + } | ||
| 11288 | } | 11329 | } |
| 11289 | PARTITION_VERT => { | 11330 | PARTITION_VERT => { |
| 11290 | // lane-sbpart r2: mirror of PARTITION_HORZ above with | 11331 | // lane-sbpart r2: mirror of PARTITION_HORZ above with |
| @@ -11305,22 +11346,27 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 11305 | tx_select, | 11346 | tx_select, |
| 11306 | reduced_tx_set, | 11347 | reduced_tx_set, |
| 11307 | )?; | 11348 | )?; |
| 11308 | - decode_block_rect64( | 11349 | + // lane-golomb r1: at the frame edge only the first half of the |
| 11309 | - &mut dec, | 11350 | + // strip is coded (libaom `decode_partition` guards the second |
| 11310 | - &mut cdfs, | 11351 | + // with the same has_cols test that made this partition non-square). |
| 11311 | - &mut neighbours, | 11352 | + if has_cols { |
| 11312 | - (at.0, at.1 + 2), | 11353 | + decode_block_rect64( |
| 11313 | - 32, | 11354 | + &mut dec, |
| 11314 | - 64, | 11355 | + &mut cdfs, |
| 11315 | - &mut y, | 11356 | + &mut neighbours, |
| 11316 | - &mut u, | 11357 | + (at.0, at.1 + 2), |
| 11317 | - &mut v, | 11358 | + 32, |
| 11318 | - enable_filter_intra, | 11359 | + 64, |
| 11319 | - allow_screen_content_tools, | 11360 | + &mut y, |
| 11320 | - base_q_idx, | 11361 | + &mut u, |
| 11321 | - tx_select, | 11362 | + &mut v, |
| 11322 | - reduced_tx_set, | 11363 | + enable_filter_intra, |
| 11323 | - )?; | 11364 | + allow_screen_content_tools, |
| 11365 | + base_q_idx, | ||
| 11366 | + tx_select, | ||
| 11367 | + reduced_tx_set, | ||
| 11368 | + )?; | ||
| 11369 | + } | ||
| 11324 | } | 11370 | } |
| 11325 | PARTITION_HORZ_A | PARTITION_HORZ_B | PARTITION_VERT_A | PARTITION_VERT_B => { | 11371 | PARTITION_HORZ_A | PARTITION_HORZ_B | PARTITION_VERT_A | PARTITION_VERT_B => { |
| 11326 | // lane-part32 r4: the four superblock-level AB arms, each | 11372 | // lane-part32 r4: the four superblock-level AB arms, each |
| @@ -17161,12 +17207,24 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 17161 | p | 17207 | p |
| 17162 | } | 17208 | } |
| 17163 | (true, false) => { | 17209 | (true, false) => { |
| 17164 | - dec.symbol_fixed(&gather(&cdfs.partition_w64[sb_ctx], VERT_ALIKE)); | 17210 | + // lane-golomb r1 (class `parsed-then-discarded`): the gathered |
| 17165 | - PARTITION_SPLIT | 17211 | + // bit IS the partition -- 0 means PARTITION_HORZ, only 1 means SPLIT |
| 17212 | + // (libaom `ec_read_partition_impl`). | ||
| 17213 | + if dec.symbol_fixed(&gather(&cdfs.partition_w64[sb_ctx], VERT_ALIKE)) == 1 { | ||
| 17214 | + PARTITION_SPLIT | ||
| 17215 | + } else { | ||
| 17216 | + PARTITION_HORZ | ||
| 17217 | + } | ||
| 17166 | } | 17218 | } |
| 17167 | (false, true) => { | 17219 | (false, true) => { |
| 17168 | - dec.symbol_fixed(&gather(&cdfs.partition_w64[sb_ctx], HORZ_ALIKE)); | 17220 | + // lane-golomb r1 (class `parsed-then-discarded`): the gathered |
| 17169 | - PARTITION_SPLIT | 17221 | + // bit IS the partition -- 0 means PARTITION_VERT, only 1 means SPLIT |
| 17222 | + // (libaom `ec_read_partition_impl`). | ||
| 17223 | + if dec.symbol_fixed(&gather(&cdfs.partition_w64[sb_ctx], HORZ_ALIKE)) == 1 { | ||
| 17224 | + PARTITION_SPLIT | ||
| 17225 | + } else { | ||
| 17226 | + PARTITION_VERT | ||
| 17227 | + } | ||
| 17170 | } | 17228 | } |
| 17171 | (false, false) => PARTITION_SPLIT, | 17229 | (false, false) => PARTITION_SPLIT, |
| 17172 | }; | 17230 | }; |
| @@ -17271,14 +17329,27 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 17271 | } else { | 17329 | } else { |
| 17272 | match (has_cols32, has_rows32) { | 17330 | match (has_cols32, has_rows32) { |
| 17273 | (true, false) => { | 17331 | (true, false) => { |
| 17274 | - dec.symbol_fixed(&gather(&cdfs.partition_w32[ctx32], VERT_ALIKE)); | 17332 | + // lane-golomb r1 (class `parsed-then-discarded`): the gathered |
| 17333 | + // bit IS the partition -- 0 means PARTITION_HORZ, only 1 means SPLIT | ||
| 17334 | + // (libaom `ec_read_partition_impl`). | ||
| 17335 | + if dec.symbol_fixed(&gather(&cdfs.partition_w32[ctx32], VERT_ALIKE)) == 1 { | ||
| 17336 | + PARTITION_SPLIT | ||
| 17337 | + } else { | ||
| 17338 | + PARTITION_HORZ | ||
| 17339 | + } | ||
| 17275 | } | 17340 | } |
| 17276 | (false, true) => { | 17341 | (false, true) => { |
| 17277 | - dec.symbol_fixed(&gather(&cdfs.partition_w32[ctx32], HORZ_ALIKE)); | 17342 | + // lane-golomb r1 (class `parsed-then-discarded`): the gathered |
| 17343 | + // bit IS the partition -- 0 means PARTITION_VERT, only 1 means SPLIT | ||
| 17344 | + // (libaom `ec_read_partition_impl`). | ||
| 17345 | + if dec.symbol_fixed(&gather(&cdfs.partition_w32[ctx32], HORZ_ALIKE)) == 1 { | ||
| 17346 | + PARTITION_SPLIT | ||
| 17347 | + } else { | ||
| 17348 | + PARTITION_VERT | ||
| 17349 | + } | ||
| 17278 | } | 17350 | } |
| 17279 | - _ => {} | 17351 | + _ => PARTITION_SPLIT, |
| 17280 | } | 17352 | } |
| 17281 | - PARTITION_SPLIT | ||
| 17282 | }; | 17353 | }; |
| 17283 | match part32 { | 17354 | match part32 { |
| 17284 | PARTITION_NONE => { | 17355 | PARTITION_NONE => { |
| @@ -17370,17 +17441,24 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 17370 | p | 17441 | p |
| 17371 | } else { | 17442 | } else { |
| 17372 | if has_cols16 { | 17443 | if has_cols16 { |
| 17373 | - dec.symbol_fixed(&gather( | 17444 | + // lane-golomb r1 (class `parsed-then-discarded`): the gathered |
| 17374 | - &cdfs.partition_w16[ctx16], | 17445 | + // bit IS the partition -- 0 means PARTITION_HORZ, only 1 means SPLIT |
| 17375 | - VERT_ALIKE, | 17446 | + // (libaom `ec_read_partition_impl`). |
| 17376 | - )); | 17447 | + if dec.symbol_fixed(&gather(&cdfs.partition_w16[ctx16], VERT_ALIKE)) == 1 { |
| 17448 | + PARTITION_SPLIT | ||
| 17449 | + } else { | ||
| 17450 | + PARTITION_HORZ | ||
| 17451 | + } | ||
| 17377 | } else { | 17452 | } else { |
| 17378 | - dec.symbol_fixed(&gather( | 17453 | + // lane-golomb r1 (class `parsed-then-discarded`): the gathered |
| 17379 | - &cdfs.partition_w16[ctx16], | 17454 | + // bit IS the partition -- 0 means PARTITION_VERT, only 1 means SPLIT |
| 17380 | - HORZ_ALIKE, | 17455 | + // (libaom `ec_read_partition_impl`). |
| 17381 | - )); | 17456 | + if dec.symbol_fixed(&gather(&cdfs.partition_w16[ctx16], HORZ_ALIKE)) == 1 { |
| 17457 | + PARTITION_SPLIT | ||
| 17458 | + } else { | ||
| 17459 | + PARTITION_VERT | ||
| 17460 | + } | ||
| 17382 | } | 17461 | } |
| 17383 | - PARTITION_SPLIT | ||
| 17384 | }; | 17462 | }; |
| 17385 | if part16 == PARTITION_NONE { | 17463 | if part16 == PARTITION_NONE { |
| 17386 | decode_inter_block( | 17464 | decode_inter_block( |
crates/ec-av1/src/refusal_inventory.rsmodified+1 -0
| @@ -37,6 +37,7 @@ const REFUSALS: &[&str] = &[ | |||
| 37 | "a HORZ_A/HORZ_B/VERT_A partition below 16x16 (this decoder codes only the square arms, HORZ, VERT, VERT_B, and a clean split below 16x16)", | 37 | "a HORZ_A/HORZ_B/VERT_A partition below 16x16 (this decoder codes only the square arms, HORZ, VERT, VERT_B, and a clean split below 16x16)", |
| 38 | "an inter partition below 8x8 (this decoder codes no inter leaf smaller than 8x8; lane-sub8 scoped to intra)", | 38 | "an inter partition below 8x8 (this decoder codes no inter leaf smaller than 8x8; lane-sub8 scoped to intra)", |
| 39 | "a 16x16 block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet", | 39 | "a 16x16 block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet", |
| 40 | + "a 16x16 block at the true frame edge coded as a rect strip rather than SPLIT", | ||
| 40 | "a 16x16 inter block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet", | 41 | "a 16x16 inter block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet", |
| 41 | "a 32x32 partition type this decoder does not code (value={part32})", | 42 | "a 32x32 partition type this decoder does not code (value={part32})", |
| 42 | "a 32x32-level 1:4 strip with a split transform (per-unit 4:1 prediction is not ported, depth={depth})", | 43 | "a 32x32-level 1:4 strip with a split transform (per-unit 4:1 prediction is not ported, depth={depth})", |
crates/ec-av1/src/stream.rsmodified+35 -0
| @@ -2671,6 +2671,41 @@ mod tests { | |||
| 2671 | eprintln!("{NAME}: pixel-exact, grain_hits={}", crate::film_grain::grain_hits()); | 2671 | eprintln!("{NAME}: pixel-exact, grain_hits={}", crate::film_grain::grain_hits()); |
| 2672 | } | 2672 | } |
| 2673 | 2673 | ||
| 2674 | + /// lane-golomb r1: THE FILM ITSELF. `crates/ec-av1/fixtures/reelb_head_key_frame.obu` | ||
| 2675 | + /// is the first frame of the user's ReelB AV1 release (3840x1608 | ||
| 2676 | + /// yuv420p10le, `ffmpeg -i <mkv> -c copy -frames:v 1 -f obu`, 147 bytes) -- | ||
| 2677 | + /// a real 10-bit key frame whose height is NOT a multiple of the 64-pixel | ||
| 2678 | + /// superblock, so its last superblock row (mi_row=400 of 402) carries the | ||
| 2679 | + /// edge partition symbol this lane fixed: libaom's `ec_read_partition_impl` | ||
| 2680 | + /// returns `PARTITION_HORZ` when the gathered `split_or_horz` bit is 0, and | ||
| 2681 | + /// this decoder used to READ that bit and throw it away, forcing SPLIT | ||
| 2682 | + /// (class `parsed-then-discarded`). The desync surfaced two rows later as | ||
| 2683 | + /// "a Golomb tail longer than this decoder reads" -- a refusal naming the | ||
| 2684 | + /// symptom, never the cause. | ||
| 2685 | + #[test] | ||
| 2686 | + fn the_reelb_head_key_frame_decodes_pixel_exact() { | ||
| 2687 | + const NAME: &str = "the_reelb_head_key_frame_decodes_pixel_exact"; | ||
| 2688 | + if !have_ffmpeg() { | ||
| 2689 | + eprintln!("SKIP {NAME}: no ffmpeg"); | ||
| 2690 | + return; | ||
| 2691 | + } | ||
| 2692 | + let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")) | ||
| 2693 | + .join("fixtures/reelb_head_key_frame.obu"); | ||
| 2694 | + let stream = std::fs::read(&path) | ||
| 2695 | + .unwrap_or_else(|e| panic!("{NAME}: reading {}: {e}", path.display())); | ||
| 2696 | + let (width, height) = (3840usize, 1608usize); | ||
| 2697 | + let frames = match decode_stream(&stream) { | ||
| 2698 | + Ok(frames) => frames, | ||
| 2699 | + Err(e) => panic!("{NAME}: decode_stream refused: {e}"), | ||
| 2700 | + }; | ||
| 2701 | + assert_eq!(frames.len(), 1, "{NAME}: one key frame"); | ||
| 2702 | + assert_eq!((frames[0].width, frames[0].height), (width, height)); | ||
| 2703 | + let ffmpeg_frames = ffmpeg_decode_sequence_10bit(&stream, width, height, 1); | ||
| 2704 | + assert_eq!(frames[0].y, ffmpeg_frames[0].y, "{NAME}: luma vs ffmpeg"); | ||
| 2705 | + assert_eq!(frames[0].u, ffmpeg_frames[0].u, "{NAME}: U vs ffmpeg"); | ||
| 2706 | + assert_eq!(frames[0].v, ffmpeg_frames[0].v, "{NAME}: V vs ffmpeg"); | ||
| 2707 | + } | ||
| 2708 | + | ||
| 2674 | /// lane-hbd10 r1: a real `aomenc --bit-depth=10 --superres-mode=1 | 2709 | /// lane-hbd10 r1: a real `aomenc --bit-depth=10 --superres-mode=1 |
| 2675 | /// --superres-denominator=12` key frame, decoded pixel-exact against | 2710 | /// --superres-denominator=12` key frame, decoded pixel-exact against |
| 2676 | /// ffmpeg's own 10-bit decode. Proves `superres::upscale_row`'s | 2711 | /// ffmpeg's own 10-bit decode. Proves `superres::upscale_row`'s |
lanes/golomb-r1.report.mdadded+47 -0
| @@ -0,0 +1,47 @@ | |||
| 1 | +# lane-golomb r1 — the edge partition bit was read and thrown away | ||
| 2 | + | ||
| 3 | +## Verdict | ||
| 4 | +The "a Golomb tail longer than this decoder reads" refusal on the ReelB head was, as | ||
| 5 | +suspected (`refusal-from-own-desync`), a symptom. Root cause: at a frame edge the partition | ||
| 6 | +symbol is a single *gathered* bit, and this decoder read it and **discarded** it, always | ||
| 7 | +inferring `PARTITION_SPLIT`. libaom `ec_read_partition_impl` (decodeframe.c:1255): | ||
| 8 | +`!has_rows && has_cols` → `read ? PARTITION_SPLIT : PARTITION_HORZ`; the mirror case → | ||
| 9 | +`PARTITION_VERT`. Class: `parsed-then-discarded`. | ||
| 10 | + | ||
| 11 | +Charter STEP-2 fallback ("libaom read_golomb caps at 32 bits, extend the reader") is FALSE: | ||
| 12 | +`~/.cache/aom-oracle/src/av1/decoder/decodetxb.c:22` aborts the frame at `length > 20`, exactly | ||
| 13 | +our cap. The cap was never the bug and is unchanged. | ||
| 14 | + | ||
| 15 | +## First divergent element (EVIDENCE) | ||
| 16 | +EVIDENCE: /tmp/.../scratchpad/{ao-all.txt,ours-all.txt} | instrumented aomdec vs decode_probe, | ||
| 17 | +EC_TRACE_MODE+EC_TRACE_MODE_STEP+EC_TRACE_COEFF on the 2-frame extract f2.obu, ladders aligned | ||
| 18 | +element by element on msac RANGE | first diff at element 12053: key frame, **mi_row=400 | ||
| 19 | +mi_col=0** (last, 8-pixel-tall superblock row of a 1608-tall frame), `name=skip` | ||
| 20 | +oracle rng=34753 vs ours rng=43258. Oracle codes that superblock as one `BLOCK_64X32` | ||
| 21 | +(`EC_IMODE ... bsize=11`, PARTITION_HORZ); we forced SPLIT and descended to 16x16. | ||
| 22 | +After the fix the range ladder is element-exact for all 13712 shared elements of the key frame | ||
| 23 | +(EVIDENCE: /tmp/.../scratchpad/{a4.n,o4.n} | awk first-diff | idx 13713, inside a later INTER | ||
| 24 | +frame, i.e. past the whole key frame). | ||
| 25 | + | ||
| 26 | +## Fix | ||
| 27 | +`crates/ec-av1/src/decode.rs` — every edge-partition site, both tile paths, all three levels | ||
| 28 | +(64/32/16, intra and inter): the gathered bit now names HORZ/VERT vs SPLIT. The 64-level | ||
| 29 | +HORZ/VERT arms only decode the second half when it is inside the frame (`has_rows`/`has_cols`), | ||
| 30 | +mirroring libaom `decode_partition`. The intra 16x16 edge site can only walk four SPLIT leaves, | ||
| 31 | +so a 0 bit refuses by name there (new string, listed in `refusal_inventory.rs`) instead of | ||
| 32 | +desyncing. | ||
| 33 | + | ||
| 34 | +## Gates | ||
| 35 | +- NEW `stream::tests::the_reelb_head_key_frame_decodes_pixel_exact` — the film itself: | ||
| 36 | + `crates/ec-av1/fixtures/reelb_head_key_frame.obu` (147 B, first frame of his 3840x1608 | ||
| 37 | + yuv420p10le release) decodes and matches `ffmpeg -pix_fmt yuv420p10le` on Y, U and V. | ||
| 38 | + EVIDENCE: cargo test -p ec-av1 --lib -- the_reelb_head_key_frame | 1 passed | | ||
| 39 | + Y/U/V all equal to ffmpeg's decode, 3840x1608. | ||
| 40 | +- Full lib suite: `$HOME/.cache/golomb-suite.log` — **337 passed / 0 failed / 31 ignored**. | ||
| 41 | + | ||
| 42 | +## Film probes after the fix | ||
| 43 | +- `hg-head.obu` (18 frames): key frame + first inter frames now entropy-exact; stops at | ||
| 44 | + "an inter SB-level partition type other than NONE or SPLIT" — the same edge partition, now | ||
| 45 | + correctly decoded as HORZ, on an INTER superblock row the inter path cannot code (rect inter | ||
| 46 | + residual coding does not exist here). Next lane. | ||
| 47 | +- `reelb5.obu`: "a 32x32-level 1:4 strip with a split transform (depth=2)" (unchanged by this lane). | ||