av1: WIP monochrome plane model (key-frame entropy syncs; luma not yet byte-exact)
Browse files at this commit13af755223bd52528449add43ea14b08d114d31bParent: 6d8d1b24 changed files +249 -22
- crates/ec-av1/examples/decode_probe.rs +9 -4
- crates/ec-av1/src/decode.rs +128 -18
- crates/ec-av1/src/stream.rs +8 -0
- lanes/av1mono.report.md +104 -0
crates/ec-av1/examples/decode_probe.rsmodified+9 -4
| @@ -266,9 +266,10 @@ fn main() { | |||
| 266 | // triage needs. | 266 | // triage needs. |
| 267 | if let Some(seq) = parser.sequence_header() { | 267 | if let Some(seq) = parser.sequence_header() { |
| 268 | println!( | 268 | println!( |
| 269 | - "SEQ: use_128x128_superblock={} bit_depth={} max_frame={}x{}", | 269 | + "SEQ: use_128x128_superblock={} bit_depth={} mono_chrome={} max_frame={}x{}", |
| 270 | seq.use_128x128_superblock, | 270 | seq.use_128x128_superblock, |
| 271 | seq.color_config.bit_depth, | 271 | seq.color_config.bit_depth, |
| 272 | + seq.color_config.mono_chrome, | ||
| 272 | seq.max_frame_width, | 273 | seq.max_frame_width, |
| 273 | seq.max_frame_height | 274 | seq.max_frame_height |
| 274 | ); | 275 | ); |
| @@ -310,6 +311,9 @@ fn main() { | |||
| 310 | let mut shown = 0usize; | 311 | let mut shown = 0usize; |
| 311 | let mut dims = (0usize, 0usize); | 312 | let mut dims = (0usize, 0usize); |
| 312 | let mut buf: Vec<u8> = Vec::new(); | 313 | let mut buf: Vec<u8> = Vec::new(); |
| 314 | + // lane-av1mono: a monochrome stream is luma only, so the raw dump is a | ||
| 315 | + // single plane -- exactly what `ffmpeg -pix_fmt gray -f rawvideo` writes. | ||
| 316 | + let mono = parser.sequence_header().is_some_and(|s| s.color_config.mono_chrome); | ||
| 313 | let result = ec_av1::stream::decode_stream_with(&data, |f, _idx, is_shown| { | 317 | let result = ec_av1::stream::decode_stream_with(&data, |f, _idx, is_shown| { |
| 314 | if !is_shown { | 318 | if !is_shown { |
| 315 | return Ok(()); | 319 | return Ok(()); |
| @@ -318,8 +322,9 @@ fn main() { | |||
| 318 | if shown == 1 { | 322 | if shown == 1 { |
| 319 | dims = (f.width, f.height); | 323 | dims = (f.width, f.height); |
| 320 | } | 324 | } |
| 325 | + let planes: &[&Vec<u16>] = if mono { &[&f.y] } else { &[&f.y, &f.u, &f.v] }; | ||
| 321 | if let Some(w) = f16.as_mut() { | 326 | if let Some(w) = f16.as_mut() { |
| 322 | - let n = 2 * (f.y.len() + f.u.len() + f.v.len()); | 327 | + let n = 2 * planes.iter().map(|p| p.len()).sum::<usize>(); |
| 323 | if null16 { | 328 | if null16 { |
| 324 | // Timing runs point EC_PROBE_OUT16 at /dev/null; the u16->LE | 329 | // Timing runs point EC_PROBE_OUT16 at /dev/null; the u16->LE |
| 325 | // conversion was ~2% of the main thread for bytes nobody reads. | 330 | // conversion was ~2% of the main thread for bytes nobody reads. |
| @@ -328,7 +333,7 @@ fn main() { | |||
| 328 | buf.clear(); | 333 | buf.clear(); |
| 329 | buf.resize(n, 0); | 334 | buf.resize(n, 0); |
| 330 | let mut off = 0; | 335 | let mut off = 0; |
| 331 | - for p in [&f.y, &f.u, &f.v] { | 336 | + for p in planes { |
| 332 | let end = off + 2 * p.len(); | 337 | let end = off + 2 * p.len(); |
| 333 | for (d, &s) in buf[off..end].chunks_exact_mut(2).zip(p.iter()) { | 338 | for (d, &s) in buf[off..end].chunks_exact_mut(2).zip(p.iter()) { |
| 334 | d.copy_from_slice(&s.to_le_bytes()); | 339 | d.copy_from_slice(&s.to_le_bytes()); |
| @@ -341,7 +346,7 @@ fn main() { | |||
| 341 | } | 346 | } |
| 342 | if let Some(w) = f8.as_mut() { | 347 | if let Some(w) = f8.as_mut() { |
| 343 | buf.clear(); | 348 | buf.clear(); |
| 344 | - for p in [&f.y, &f.u, &f.v] { | 349 | + for p in planes { |
| 345 | buf.extend(p.iter().map(|&s| s as u8)); | 350 | buf.extend(p.iter().map(|&s| s as u8)); |
| 346 | } | 351 | } |
| 347 | w.write_all(&buf).expect("writing raw planes"); | 352 | w.write_all(&buf).expect("writing raw planes"); |
crates/ec-av1/src/decode.rsmodified+128 -18
| @@ -86,6 +86,16 @@ pub(crate) struct FrameCtx { | |||
| 86 | pub(crate) lossless_flag: std::cell::Cell<bool>, | 86 | pub(crate) lossless_flag: std::cell::Cell<bool>, |
| 87 | pub(crate) cdef_bits: std::cell::Cell<u8>, | 87 | pub(crate) cdef_bits: std::cell::Cell<u8>, |
| 88 | pub(crate) bit_depth: std::cell::Cell<u8>, | 88 | pub(crate) bit_depth: std::cell::Cell<u8>, |
| 89 | + /// lane-av1mono: the sequence header's `color_config.mono_chrome` (spec | ||
| 90 | + /// 5.5.2), i.e. `NumPlanes == 1`. libaom threads this as | ||
| 91 | + /// `av1_num_planes(cm)` and every chroma read site is guarded by | ||
| 92 | + /// `!cm->seq_params->monochrome && xd->is_chroma_ref` (`decodemv.c:933`, | ||
| 93 | + /// `:1208`) or bounded by `plane < num_planes`; a monochrome frame codes | ||
| 94 | + /// NO `uv_mode`/`cfl`/`angle_delta_uv`/`palette_uv` symbol and NO chroma | ||
| 95 | + /// coefficients on any block. Set once per frame from the sequence header | ||
| 96 | + /// (like [`FrameCtx::bit_depth`]), so a mono frame decoded on a thread | ||
| 97 | + /// that last saw a 4:2:0 one never inherits the wrong plane count. | ||
| 98 | + pub(crate) mono_chrome: std::cell::Cell<bool>, | ||
| 89 | pub(crate) superres: std::cell::Cell<(u32, u32)>, | 99 | pub(crate) superres: std::cell::Cell<(u32, u32)>, |
| 90 | pub(crate) cdef_transmitted: std::cell::Cell<bool>, | 100 | pub(crate) cdef_transmitted: std::cell::Cell<bool>, |
| 91 | pub(crate) cdef_sb_cols: std::cell::Cell<usize>, | 101 | pub(crate) cdef_sb_cols: std::cell::Cell<usize>, |
| @@ -175,6 +185,7 @@ impl FrameCtx { | |||
| 175 | lossless_flag: std::cell::Cell::new(false), | 185 | lossless_flag: std::cell::Cell::new(false), |
| 176 | cdef_bits: std::cell::Cell::new(0), | 186 | cdef_bits: std::cell::Cell::new(0), |
| 177 | bit_depth: std::cell::Cell::new(8), | 187 | bit_depth: std::cell::Cell::new(8), |
| 188 | + mono_chrome: std::cell::Cell::new(false), | ||
| 178 | superres: std::cell::Cell::new((0, 8)), | 189 | superres: std::cell::Cell::new((0, 8)), |
| 179 | cdef_transmitted: std::cell::Cell::new(false), | 190 | cdef_transmitted: std::cell::Cell::new(false), |
| 180 | cdef_sb_cols: std::cell::Cell::new(0), | 191 | cdef_sb_cols: std::cell::Cell::new(0), |
| @@ -269,6 +280,7 @@ impl<T: ?Sized> WithRef for T {} | |||
| 269 | pub(crate) fn filter_ctx_copy(fctx: &FrameCtx) -> FrameCtx { | 280 | pub(crate) fn filter_ctx_copy(fctx: &FrameCtx) -> FrameCtx { |
| 270 | let out = FrameCtx::new(); | 281 | let out = FrameCtx::new(); |
| 271 | out.bit_depth.set(fctx.bit_depth.get()); | 282 | out.bit_depth.set(fctx.bit_depth.get()); |
| 283 | + out.mono_chrome.set(fctx.mono_chrome.get()); | ||
| 272 | out.interp_filter.set(fctx.interp_filter.get()); | 284 | out.interp_filter.set(fctx.interp_filter.get()); |
| 273 | out.grain_bit_depth.set(fctx.grain_bit_depth.get()); | 285 | out.grain_bit_depth.set(fctx.grain_bit_depth.get()); |
| 274 | out.superres.set(fctx.superres.get()); | 286 | out.superres.set(fctx.superres.get()); |
| @@ -566,6 +578,19 @@ pub(crate) fn set_bit_depth(bit_depth: u8, fctx: &crate::decode::FrameCtx) { | |||
| 566 | fctx.bit_depth.with(|c| c.set(bit_depth)); | 578 | fctx.bit_depth.with(|c| c.set(bit_depth)); |
| 567 | } | 579 | } |
| 568 | 580 | ||
| 581 | +/// This stream's `mono_chrome` (see [`FrameCtx::mono_chrome`]): a | ||
| 582 | +/// monochrome frame has `NumPlanes == 1`, so no block codes any chroma | ||
| 583 | +/// symbol or chroma coefficient and the output picture is luma only. | ||
| 584 | +pub(crate) fn mono(fctx: &crate::decode::FrameCtx) -> bool { | ||
| 585 | + fctx.mono_chrome.with(std::cell::Cell::get) | ||
| 586 | +} | ||
| 587 | + | ||
| 588 | +/// Sets [`mono`] for the current thread, called once per frame from | ||
| 589 | +/// [`crate::stream`]'s decode loop like [`set_bit_depth`]. | ||
| 590 | +pub(crate) fn set_mono(mono_chrome: bool, fctx: &crate::decode::FrameCtx) { | ||
| 591 | + fctx.mono_chrome.with(|c| c.set(mono_chrome)); | ||
| 592 | +} | ||
| 593 | + | ||
| 569 | /// This frame's superres state: `(upscaled_width, superres_denom)`, or | 594 | /// This frame's superres state: `(upscaled_width, superres_denom)`, or |
| 570 | /// `(0, 8)` when the frame is not scaled. Spec 7.16's upscale runs | 595 | /// `(0, 8)` when the frame is not scaled. Spec 7.16's upscale runs |
| 571 | /// between CDEF and loop restoration, so LOOP RESTORATION -- unit grid, | 596 | /// between CDEF and loop restoration, so LOOP RESTORATION -- unit grid, |
| @@ -9047,6 +9072,12 @@ fn read_intra_mode_rect( | |||
| 9047 | Option<PaletteY>, | 9072 | Option<PaletteY>, |
| 9048 | Option<PaletteUv>, | 9073 | Option<PaletteUv>, |
| 9049 | )> { | 9074 | )> { |
| 9075 | + // lane-av1mono: libaom guards every chroma symbol read with | ||
| 9076 | + // `!cm->seq_params->monochrome && xd->is_chroma_ref` (`decodemv.c:933`), | ||
| 9077 | + // so a monochrome block codes no `uv_mode`/`cfl`/`angle_delta_uv`/ | ||
| 9078 | + // `palette_uv` even on a chroma-reference strip. Fold the plane count | ||
| 9079 | + // into the same `has_chroma` this reader already gates on. | ||
| 9080 | + let has_chroma = has_chroma && !mono(fctx); | ||
| 9050 | let ec_istep = crate::envflags::env_flag!("EC_TRACE_MODE_STEP"); | 9081 | let ec_istep = crate::envflags::env_flag!("EC_TRACE_MODE_STEP"); |
| 9051 | if ec_istep { | 9082 | if ec_istep { |
| 9052 | // Mirrors the oracle's own `EC_IMODE mi_row=.. mi_col=.. rng=..` line | 9083 | // Mirrors the oracle's own `EC_IMODE mi_row=.. mi_col=.. rng=..` line |
| @@ -9805,7 +9836,14 @@ fn decode_rect_split( | |||
| 9805 | let mut ll_chroma_units: Vec<((usize, usize), usize, Grid)> = Vec::new(); | 9836 | let mut ll_chroma_units: Vec<((usize, usize), usize, Grid)> = Vec::new(); |
| 9806 | let ac = m.alpha.map(|_| cfl_src_rect(px, py, bw, bh)); | 9837 | let ac = m.alpha.map(|_| cfl_src_rect(px, py, bw, bh)); |
| 9807 | let reach = block_reach; | 9838 | let reach = block_reach; |
| 9808 | - let (u_grid, v_grid) = if m.skip { | 9839 | + let (u_grid, v_grid) = if mono(fctx) { |
| 9840 | + // lane-av1mono: a monochrome frame codes no chroma coefficients on | ||
| 9841 | + // any block (`plane < av1_num_planes == 1`), so the whole chroma | ||
| 9842 | + // section -- the skipped-strip pushes, the lossless raster and the | ||
| 9843 | + // un-split `read_coeffs_rect` below -- is bypassed. | ||
| 9844 | + let zero = Grid::Zero(chroma_w * chroma_h); | ||
| 9845 | + (zero.clone(), zero) | ||
| 9846 | + } else if m.skip { | ||
| 9809 | let zero = Grid::Zero(chroma_w * chroma_h); | 9847 | let zero = Grid::Zero(chroma_w * chroma_h); |
| 9810 | if let Some((ub, _)) = &m.palette_uv { | 9848 | if let Some((ub, _)) = &m.palette_uv { |
| 9811 | set_palette_pred(ub.clone(), fctx); | 9849 | set_palette_pred(ub.clone(), fctx); |
| @@ -10456,8 +10494,14 @@ fn decode_intra_rect_in_inter( | |||
| 10456 | // `is_cfl_allowed` (spec 5.11.5) caps CFL at 32x32, so the | 10494 | // `is_cfl_allowed` (spec 5.11.5) caps CFL at 32x32, so the |
| 10457 | // superblock-level strip reads the no-CFL alphabet -- the same split | 10495 | // superblock-level strip reads the no-CFL alphabet -- the same split |
| 10458 | // [`read_intra_mode_rect`] makes for [`decode_block_rect64`]. | 10496 | // [`read_intra_mode_rect`] makes for [`decode_block_rect64`]. |
| 10459 | - let cfl_allowed = cfl_allowed_px(bw, bh, fctx); | 10497 | + // |
| 10460 | - let uv_mode = if cfl_allowed { | 10498 | + // lane-av1mono: a monochrome strip codes no chroma mode/CFL symbol |
| 10499 | + // (libaom `decodemv.c:933`). | ||
| 10500 | + let has_chroma = !mono(fctx); | ||
| 10501 | + let cfl_allowed = has_chroma && cfl_allowed_px(bw, bh, fctx); | ||
| 10502 | + let uv_mode = if !has_chroma { | ||
| 10503 | + DC_PRED | ||
| 10504 | + } else if cfl_allowed { | ||
| 10461 | dec.symbol(&mut cdfs.uv_mode_cfl[mode]) | 10505 | dec.symbol(&mut cdfs.uv_mode_cfl[mode]) |
| 10462 | } else { | 10506 | } else { |
| 10463 | dec.symbol(&mut cdfs.uv_mode_no_cfl[mode]) | 10507 | dec.symbol(&mut cdfs.uv_mode_no_cfl[mode]) |
| @@ -10518,8 +10562,11 @@ fn decode_intra_rect_in_inter( | |||
| 10518 | } | 10562 | } |
| 10519 | // A 2:1 strip of at least 8x8 is always a chroma reference, so | 10563 | // A 2:1 strip of at least 8x8 is always a chroma reference, so |
| 10520 | // `read_palette_mode_info`'s `xd->is_chroma_ref` guard holds here. | 10564 | // `read_palette_mode_info`'s `xd->is_chroma_ref` guard holds here. |
| 10521 | - let use_palette_uv = | 10565 | + // lane-av1mono: libaom's actual guard is `num_planes > 1 && |
| 10522 | - uv_mode == DC_PRED && dec.symbol(&mut cdfs.palette_uv_mode[usize::from(use_palette_y)]) != 0; | 10566 | + // uv_mode == UV_DC_PRED && xd->is_chroma_ref` (decodemv.c:602). |
| 10567 | + let use_palette_uv = has_chroma | ||
| 10568 | + && uv_mode == DC_PRED | ||
| 10569 | + && dec.symbol(&mut cdfs.palette_uv_mode[usize::from(use_palette_y)]) != 0; | ||
| 10523 | if crate::envflags::env_flag!("EC_PALSYN") { | 10570 | if crate::envflags::env_flag!("EC_PALSYN") { |
| 10524 | eprintln!("EC_PALSYN rect mi={mi_r},{mi_c} bw={bw} bh={bh} mode={mode} uv={uv_mode} ctx={palette_ctx} y={} uv={} rng={}", use_palette_y as i32, use_palette_uv as i32, dec.debug_state().0); | 10571 | eprintln!("EC_PALSYN rect mi={mi_r},{mi_c} bw={bw} bh={bh} mode={mode} uv={uv_mode} ctx={palette_ctx} y={} uv={} rng={}", use_palette_y as i32, use_palette_uv as i32, dec.debug_state().0); |
| 10525 | } | 10572 | } |
| @@ -13270,11 +13317,15 @@ fn read_intra_mode( | |||
| 13270 | 0 | 13317 | 0 |
| 13271 | }; | 13318 | }; |
| 13272 | istep!("angle_y", angle_delta_y); | 13319 | istep!("angle_y", angle_delta_y); |
| 13273 | - // lane-sb128c r3 (class sweep): `is_cfl_allowed` on the luma bsize, decided | 13320 | + // lane-av1mono: a monochrome block codes no chroma mode/CFL/palette |
| 13274 | - // here so every `decode_block` caller (64x64 and 128x128 roots included) | 13321 | + // symbol at all (libaom `decodemv.c:933`'s `!monochrome && is_chroma_ref` |
| 13275 | - // picks the right alphabet -- see [`read_intra_mode_rect`]'s twin. | 13322 | + // guard). Fold `NumPlanes == 1` into the same `has_chroma` this reader |
| 13276 | - let cfl = cfl && cfl_allowed_px(side, side, fctx); | 13323 | + // gates its chroma symbols on. |
| 13277 | - let uv_mode = if cfl { | 13324 | + let has_chroma = !mono(fctx); |
| 13325 | + let cfl = cfl && has_chroma && cfl_allowed_px(side, side, fctx); | ||
| 13326 | + let uv_mode = if !has_chroma { | ||
| 13327 | + DC_PRED | ||
| 13328 | + } else if cfl { | ||
| 13278 | dec.symbol(&mut cdfs.uv_mode_cfl[mode]) | 13329 | dec.symbol(&mut cdfs.uv_mode_cfl[mode]) |
| 13279 | } else { | 13330 | } else { |
| 13280 | dec.symbol(&mut cdfs.uv_mode_no_cfl[mode]) | 13331 | dec.symbol(&mut cdfs.uv_mode_no_cfl[mode]) |
| @@ -13375,8 +13426,16 @@ fn read_intra_mode( | |||
| 13375 | // scope always reconstructs chroma alongside luma (`decode_block` | 13426 | // scope always reconstructs chroma alongside luma (`decode_block` |
| 13376 | // always calls `u.reconstruct`/`v.reconstruct`), so `is_chroma_ref` | 13427 | // always calls `u.reconstruct`/`v.reconstruct`), so `is_chroma_ref` |
| 13377 | // is always true here and does not need threading in. | 13428 | // is always true here and does not need threading in. |
| 13429 | + // | ||
| 13430 | + // lane-av1mono: libaom's actual guard is `num_planes > 1 && | ||
| 13431 | + // uv_mode == UV_DC_PRED && xd->is_chroma_ref` (decodemv.c:602), so a | ||
| 13432 | + // monochrome frame reads NO `palette_uv_mode`/`palette_uv_size` | ||
| 13433 | + // symbol even at this chroma-owning square block. | ||
| 13378 | let palette_uv_mode_ctx = usize::from(use_palette_y); | 13434 | let palette_uv_mode_ctx = usize::from(use_palette_y); |
| 13379 | - if uv_mode == DC_PRED && dec.symbol(&mut cdfs.palette_uv_mode[palette_uv_mode_ctx]) != 0 { | 13435 | + if has_chroma |
| 13436 | + && uv_mode == DC_PRED | ||
| 13437 | + && dec.symbol(&mut cdfs.palette_uv_mode[palette_uv_mode_ctx]) != 0 | ||
| 13438 | + { | ||
| 13380 | let n = 2 + dec.symbol(&mut cdfs.palette_uv_size[bsize_ctx]); | 13439 | let n = 2 + dec.symbol(&mut cdfs.palette_uv_size[bsize_ctx]); |
| 13381 | let (u_colors, v_colors) = read_palette_colors_uv(dec, n, palette_uv_cache, fctx); | 13440 | let (u_colors, v_colors) = read_palette_colors_uv(dec, n, palette_uv_cache, fctx); |
| 13382 | palette_uv_pending = Some((n, u_colors, v_colors)); | 13441 | palette_uv_pending = Some((n, u_colors, v_colors)); |
| @@ -14038,6 +14097,14 @@ fn read_plane( | |||
| 14038 | // See [`PlaneBuf::reconstruct`]'s own doc: caller's neighbour-smooth check. | 14097 | // See [`PlaneBuf::reconstruct`]'s own doc: caller's neighbour-smooth check. |
| 14039 | smooth_neighbor: bool, fctx: &crate::decode::FrameCtx, | 14098 | smooth_neighbor: bool, fctx: &crate::decode::FrameCtx, |
| 14040 | ) -> Result<Grid> { | 14099 | ) -> Result<Grid> { |
| 14100 | + // lane-av1mono: a monochrome frame has `NumPlanes == 1`, so libaom's | ||
| 14101 | + // coefficient loop (`for (plane = 0; plane < av1_num_planes(cm); ++plane)`) | ||
| 14102 | + // never reaches a chroma plane -- no u/v coefficient symbol is coded and | ||
| 14103 | + // no chroma write is recorded. Return the all-zero grid the caller's | ||
| 14104 | + // neighbour bookkeeping reads, without consuming a bit. | ||
| 14105 | + if plane_idx > 0 && mono(fctx) { | ||
| 14106 | + return Ok(Grid::Zero(side * side)); | ||
| 14107 | + } | ||
| 14041 | let skip_ctx = if plane_idx == 0 { | 14108 | let skip_ctx = if plane_idx == 0 { |
| 14042 | luma_skip_ctx.unwrap_or(0) | 14109 | luma_skip_ctx.unwrap_or(0) |
| 14043 | } else { | 14110 | } else { |
| @@ -15916,6 +15983,9 @@ fn read_intra_mode_sub8( | |||
| 15916 | seg_w_mi: usize, | 15983 | seg_w_mi: usize, |
| 15917 | seg_h_mi: usize, fctx: &crate::decode::FrameCtx, | 15984 | seg_h_mi: usize, fctx: &crate::decode::FrameCtx, |
| 15918 | ) -> Result<(bool, usize, i32, Option<(usize, i32, Option<(i32, i32)>)>, Option<usize>)> { | 15985 | ) -> Result<(bool, usize, i32, Option<(usize, i32, Option<(i32, i32)>)>, Option<usize>)> { |
| 15986 | + // lane-av1mono: a monochrome leaf codes no chroma mode (libaom | ||
| 15987 | + // `decodemv.c:933`), so fold `NumPlanes == 1` into `has_chroma`. | ||
| 15988 | + let has_chroma = has_chroma && !mono(fctx); | ||
| 15919 | let trace = crate::envflags::env_flag!("EC_AV1_TRACE"); | 15989 | let trace = crate::envflags::env_flag!("EC_AV1_TRACE"); |
| 15920 | let ec_istep = crate::envflags::env_flag!("EC_TRACE_MODE_STEP"); | 15990 | let ec_istep = crate::envflags::env_flag!("EC_TRACE_MODE_STEP"); |
| 15921 | if ec_istep { | 15991 | if ec_istep { |
| @@ -16131,6 +16201,11 @@ fn decode_leaf_split4( | |||
| 16131 | last_uv = chroma; | 16201 | last_uv = chroma; |
| 16132 | } | 16202 | } |
| 16133 | } | 16203 | } |
| 16204 | + // lane-av1mono: as [`decode_leaf_rect8`] -- a monochrome frame has no | ||
| 16205 | + // chroma to reconstruct and no uv_mode was read. | ||
| 16206 | + let (u_grid, v_grid): (Grid, Grid) = if mono(fctx) { | ||
| 16207 | + (Grid::Zero(16), Grid::Zero(16)) | ||
| 16208 | + } else { | ||
| 16134 | let (gpx, gpy) = (leaf_mi.1 * MI, leaf_mi.0 * MI); | 16209 | let (gpx, gpy) = (leaf_mi.1 * MI, leaf_mi.0 * MI); |
| 16135 | let (cpx, cpy) = (gpx / 2, gpy / 2); | 16210 | let (cpx, cpy) = (gpx / 2, gpy / 2); |
| 16136 | let group_reach = Reach::of(8, gpx, gpy, y.width, y.height, fctx); | 16211 | let group_reach = Reach::of(8, gpx, gpy, y.width, y.height, fctx); |
| @@ -16172,6 +16247,8 @@ fn decode_leaf_split4( | |||
| 16172 | )?; | 16247 | )?; |
| 16173 | (ug, vg) | 16248 | (ug, vg) |
| 16174 | }; | 16249 | }; |
| 16250 | + (u_grid, v_grid) | ||
| 16251 | + }; | ||
| 16175 | // Chroma neighbour bookkeeping for the whole 8x8 group -- mirrors | 16252 | // Chroma neighbour bookkeeping for the whole 8x8 group -- mirrors |
| 16176 | // [`decode_leaf8`]'s own tx4-chroma section (`record_split_luma`'s | 16253 | // [`decode_leaf8`]'s own tx4-chroma section (`record_split_luma`'s |
| 16177 | // rescaling is wrong for an already-mi-unit position, so this inlines | 16254 | // rescaling is wrong for an already-mi-unit position, so this inlines |
| @@ -16518,6 +16595,12 @@ fn decode_leaf_rect8( | |||
| 16518 | last_uv = chroma; | 16595 | last_uv = chroma; |
| 16519 | } | 16596 | } |
| 16520 | } | 16597 | } |
| 16598 | + // lane-av1mono: a monochrome frame codes no chroma at all -- no | ||
| 16599 | + // `uv_mode` was read ([`read_intra_mode_sub8`] folds the plane count in), | ||
| 16600 | + // so there is no chroma to reconstruct and no chroma coefficient to read. | ||
| 16601 | + let (u_grid, v_grid): (Grid, Grid) = if mono(fctx) { | ||
| 16602 | + (Grid::Zero(16), Grid::Zero(16)) | ||
| 16603 | + } else { | ||
| 16521 | let (gpx, gpy) = (leaf_mi.1 * MI, leaf_mi.0 * MI); | 16604 | let (gpx, gpy) = (leaf_mi.1 * MI, leaf_mi.0 * MI); |
| 16522 | let (cpx, cpy) = (gpx / 2, gpy / 2); | 16605 | let (cpx, cpy) = (gpx / 2, gpy / 2); |
| 16523 | let group_reach = Reach::of(8, gpx, gpy, y.width, y.height, fctx); | 16606 | let group_reach = Reach::of(8, gpx, gpy, y.width, y.height, fctx); |
| @@ -16559,6 +16642,8 @@ fn decode_leaf_rect8( | |||
| 16559 | )?; | 16642 | )?; |
| 16560 | (ug, vg) | 16643 | (ug, vg) |
| 16561 | }; | 16644 | }; |
| 16645 | + (u_grid, v_grid) | ||
| 16646 | + }; | ||
| 16562 | // `update_partition_context` at the 8x8 level writes | 16647 | // `update_partition_context` at the 8x8 level writes |
| 16563 | // `partition_context_lookup[subsize]` over the whole 8x8 span: BLOCK_4X8 | 16648 | // `partition_context_lookup[subsize]` over the whole 8x8 span: BLOCK_4X8 |
| 16564 | // is `{31, 30}` (bit0 set on the above half only), BLOCK_8X4 `{30, 31}` | 16649 | // is `{31, 30}` (bit0 set on the above half only), BLOCK_8X4 `{30, 31}` |
| @@ -18498,6 +18583,11 @@ fn read_inter_plane_rect( | |||
| 18498 | inherited_luma_tx_type: Option<TxType>, | 18583 | inherited_luma_tx_type: Option<TxType>, |
| 18499 | luma_skip_ctx: Option<usize>, fctx: &crate::decode::FrameCtx, | 18584 | luma_skip_ctx: Option<usize>, fctx: &crate::decode::FrameCtx, |
| 18500 | ) -> Result<(Grid, TxType)> { | 18585 | ) -> Result<(Grid, TxType)> { |
| 18586 | + // lane-av1mono: as [`read_plane`] -- a monochrome frame codes no chroma | ||
| 18587 | + // coefficients (`plane < av1_num_planes == 1`). | ||
| 18588 | + if plane_idx > 0 && mono(fctx) { | ||
| 18589 | + return Ok((Grid::Zero(w * h), TxType::DctDct)); | ||
| 18590 | + } | ||
| 18501 | let skip_ctx = if plane_idx == 0 { | 18591 | let skip_ctx = if plane_idx == 0 { |
| 18502 | // `get_txb_ctx_general`: 0 only when this unit IS the whole plane | 18592 | // `get_txb_ctx_general`: 0 only when this unit IS the whole plane |
| 18503 | // block; a var-tx leaf passes its own neighbour-table context. | 18593 | // block; a var-tx leaf passes its own neighbour-table context. |
| @@ -24737,6 +24827,11 @@ fn read_inter_plane( | |||
| 24737 | // lone-transform-unit 0. | 24827 | // lone-transform-unit 0. |
| 24738 | luma_skip_ctx: Option<usize>, fctx: &crate::decode::FrameCtx, | 24828 | luma_skip_ctx: Option<usize>, fctx: &crate::decode::FrameCtx, |
| 24739 | ) -> Result<(Grid, TxType)> { | 24829 | ) -> Result<(Grid, TxType)> { |
| 24830 | + // lane-av1mono: as [`read_plane`] -- a monochrome frame codes no chroma | ||
| 24831 | + // coefficients (`plane < av1_num_planes == 1`). | ||
| 24832 | + if plane_idx > 0 && mono(fctx) { | ||
| 24833 | + return Ok((Grid::Zero(side * side), TxType::DctDct)); | ||
| 24834 | + } | ||
| 24740 | let skip_ctx = if plane_idx == 0 { | 24835 | let skip_ctx = if plane_idx == 0 { |
| 24741 | luma_skip_ctx.unwrap_or(0) | 24836 | luma_skip_ctx.unwrap_or(0) |
| 24742 | } else { | 24837 | } else { |
| @@ -29747,11 +29842,16 @@ fn decode_inter_block( | |||
| 29747 | // the 14-symbol CFL one gave the same DC_PRED VALUE but narrowed the | 29842 | // the 14-symbol CFL one gave the same DC_PRED VALUE but narrowed the |
| 29748 | // arithmetic coder by the wrong interval, desyncing the tile from this | 29843 | // arithmetic coder by the wrong interval, desyncing the tile from this |
| 29749 | // block on. | 29844 | // block on. |
| 29750 | - let cfl_allowed = cfl_allowed_px(write_w, write_h, fctx); | 29845 | + // lane-av1mono: a monochrome block codes no chroma mode/CFL symbol |
| 29846 | + // (libaom `decodemv.c:933`). | ||
| 29847 | + let has_chroma = !mono(fctx); | ||
| 29848 | + let cfl_allowed = has_chroma && cfl_allowed_px(write_w, write_h, fctx); | ||
| 29751 | if !cfl_allowed { | 29849 | if !cfl_allowed { |
| 29752 | hit!(NOCFL_UV_MODE_HITS); | 29850 | hit!(NOCFL_UV_MODE_HITS); |
| 29753 | } | 29851 | } |
| 29754 | - let uv_mode = if cfl_allowed { | 29852 | + let uv_mode = if !has_chroma { |
| 29853 | + DC_PRED | ||
| 29854 | + } else if cfl_allowed { | ||
| 29755 | dec.symbol(&mut cdfs.uv_mode_cfl[mode]) | 29855 | dec.symbol(&mut cdfs.uv_mode_cfl[mode]) |
| 29756 | } else { | 29856 | } else { |
| 29757 | dec.symbol(&mut cdfs.uv_mode_no_cfl[mode]) | 29857 | dec.symbol(&mut cdfs.uv_mode_no_cfl[mode]) |
| @@ -29822,8 +29922,9 @@ fn decode_inter_block( | |||
| 29822 | if crate::envflags::env_flag!("EC_PALSYN") { | 29922 | if crate::envflags::env_flag!("EC_PALSYN") { |
| 29823 | eprintln!("EC_PALSYN_PRE sq mi={rmi},{cmi} bw={write_w} bh={write_h} mode={mode} uv={uv_mode} ctx={palette_ctx} y={} rng={}", palette_y_pending.map_or(0, |(n, _)| n), dec.debug_state().0); | 29923 | eprintln!("EC_PALSYN_PRE sq mi={rmi},{cmi} bw={write_w} bh={write_h} mode={mode} uv={uv_mode} ctx={palette_ctx} y={} rng={}", palette_y_pending.map_or(0, |(n, _)| n), dec.debug_state().0); |
| 29824 | } | 29924 | } |
| 29825 | - let use_palette_uv = | 29925 | + let use_palette_uv = has_chroma |
| 29826 | - uv_mode == DC_PRED && dec.symbol(&mut cdfs.palette_uv_mode[usize::from(use_palette_y)]) != 0; | 29926 | + && uv_mode == DC_PRED |
| 29927 | + && dec.symbol(&mut cdfs.palette_uv_mode[usize::from(use_palette_y)]) != 0; | ||
| 29827 | if crate::envflags::env_flag!("EC_PALSYN") { | 29928 | if crate::envflags::env_flag!("EC_PALSYN") { |
| 29828 | eprintln!("EC_PALSYN sq mi={rmi},{cmi} bw={write_w} bh={write_h} mode={mode} uv={uv_mode} ctx={palette_ctx} y={} uv={} rng={}", use_palette_y as i32, use_palette_uv as i32, dec.debug_state().0); | 29929 | eprintln!("EC_PALSYN sq mi={rmi},{cmi} bw={write_w} bh={write_h} mode={mode} uv={uv_mode} ctx={palette_ctx} y={} uv={} rng={}", use_palette_y as i32, use_palette_uv as i32, dec.debug_state().0); |
| 29829 | } | 29930 | } |
| @@ -31177,6 +31278,9 @@ fn decode_intra_sub8_leaf( | |||
| 31177 | tx_select: bool, | 31278 | tx_select: bool, |
| 31178 | reduced_tx_set: bool, fctx: &crate::decode::FrameCtx, | 31279 | reduced_tx_set: bool, fctx: &crate::decode::FrameCtx, |
| 31179 | ) -> Result<usize> { | 31280 | ) -> Result<usize> { |
| 31281 | + // lane-av1mono: a monochrome leaf codes no chroma mode (libaom | ||
| 31282 | + // `decodemv.c:933`). | ||
| 31283 | + let has_chroma = has_chroma && !mono(fctx); | ||
| 31180 | let vert = bw < bh; | 31284 | let vert = bw < bh; |
| 31181 | let (w_mi, h_mi) = (bw / MI, bh / MI); | 31285 | let (w_mi, h_mi) = (bw / MI, bh / MI); |
| 31182 | let (gr, gc) = group_mi; | 31286 | let (gr, gc) = group_mi; |
| @@ -33871,7 +33975,12 @@ fn decode_inter_block8( | |||
| 33871 | // row (`get_uv_mode`, identity over `V_PRED..=D67_PRED`). Every value | 33975 | // row (`get_uv_mode`, identity over `V_PRED..=D67_PRED`). Every value |
| 33872 | // but `DC_PRED` was refused here, which is what blocked the low-cq | 33976 | // but `DC_PRED` was refused here, which is what blocked the low-cq |
| 33873 | // CDEF arms and the 10-bit gates. | 33977 | // CDEF arms and the 10-bit gates. |
| 33874 | - let uv_mode = dec.symbol(&mut cdfs.uv_mode_cfl[mode]); | 33978 | + let has_chroma = !mono(fctx); |
| 33979 | + let uv_mode = if !has_chroma { | ||
| 33980 | + DC_PRED | ||
| 33981 | + } else { | ||
| 33982 | + dec.symbol(&mut cdfs.uv_mode_cfl[mode]) | ||
| 33983 | + }; | ||
| 33875 | if crate::envflags::env_flag!("EC_TRACE_MODE_STEP") { | 33984 | if crate::envflags::env_flag!("EC_TRACE_MODE_STEP") { |
| 33876 | eprintln!( | 33985 | eprintln!( |
| 33877 | "EC_ISTEP8 mi_row={} mi_col={} name=modes y={mode} uv={uv_mode} fi_enabled={} rng={}", | 33986 | "EC_ISTEP8 mi_row={} mi_col={} name=modes y={mode} uv={uv_mode} fi_enabled={} rng={}", |
| @@ -33885,7 +33994,7 @@ fn decode_inter_block8( | |||
| 33885 | hit!(SMOOTH_UV_HITS); | 33994 | hit!(SMOOTH_UV_HITS); |
| 33886 | hit!(INTRA_IN_INTER8_UV_SMOOTH_HITS); | 33995 | hit!(INTRA_IN_INTER8_UV_SMOOTH_HITS); |
| 33887 | } | 33996 | } |
| 33888 | - let alpha = if uv_mode == UV_CFL_PRED { | 33997 | + let alpha = if has_chroma && uv_mode == UV_CFL_PRED { |
| 33889 | hit!(INTRA_IN_INTER8_UV_CFL_HITS); | 33998 | hit!(INTRA_IN_INTER8_UV_CFL_HITS); |
| 33890 | Some(read_cfl_alphas(dec, cdfs)) | 33999 | Some(read_cfl_alphas(dec, cdfs)) |
| 33891 | } else { | 34000 | } else { |
| @@ -33942,7 +34051,8 @@ fn decode_inter_block8( | |||
| 33942 | } | 34051 | } |
| 33943 | // lane-uv8 r1: `read_palette_mode_info` reads the UV symbol only | 34052 | // lane-uv8 r1: `read_palette_mode_info` reads the UV symbol only |
| 33944 | // when `uv_mode == UV_DC_PRED` (decodemv.c). | 34053 | // when `uv_mode == UV_DC_PRED` (decodemv.c). |
| 33945 | - let use_palette_uv = uv_mode == DC_PRED | 34054 | + let use_palette_uv = has_chroma |
| 34055 | + && uv_mode == DC_PRED | ||
| 33946 | && dec.symbol(&mut cdfs.palette_uv_mode[usize::from(use_palette_y)]) != 0; | 34056 | && dec.symbol(&mut cdfs.palette_uv_mode[usize::from(use_palette_y)]) != 0; |
| 33947 | if crate::envflags::env_flag!("EC_PALSYN") { | 34057 | if crate::envflags::env_flag!("EC_PALSYN") { |
| 33948 | eprintln!( | 34058 | eprintln!( |
crates/ec-av1/src/stream.rsmodified+8 -0
| @@ -1243,6 +1243,9 @@ pub(crate) struct SeqFlags { | |||
| 1243 | pub(crate) enable_interintra_compound: bool, | 1243 | pub(crate) enable_interintra_compound: bool, |
| 1244 | pub(crate) use_sb128: bool, | 1244 | pub(crate) use_sb128: bool, |
| 1245 | pub(crate) bit_depth: u8, | 1245 | pub(crate) bit_depth: u8, |
| 1246 | + /// lane-av1mono: `color_config.mono_chrome` (spec 5.5.2): | ||
| 1247 | + /// `NumPlanes == 1`, no chroma is coded or reconstructed. | ||
| 1248 | + pub(crate) mono_chrome: bool, | ||
| 1246 | pub(crate) order_hint_bits: u32, | 1249 | pub(crate) order_hint_bits: u32, |
| 1247 | pub(crate) mc_identity: bool, | 1250 | pub(crate) mc_identity: bool, |
| 1248 | } | 1251 | } |
| @@ -1259,6 +1262,7 @@ impl SeqFlags { | |||
| 1259 | enable_interintra_compound: seq.is_some_and(|s| s.enable_interintra_compound), | 1262 | enable_interintra_compound: seq.is_some_and(|s| s.enable_interintra_compound), |
| 1260 | use_sb128: seq.is_some_and(|s| s.use_128x128_superblock), | 1263 | use_sb128: seq.is_some_and(|s| s.use_128x128_superblock), |
| 1261 | bit_depth: seq.map_or(8, |s| s.color_config.bit_depth), | 1264 | bit_depth: seq.map_or(8, |s| s.color_config.bit_depth), |
| 1265 | + mono_chrome: seq.is_some_and(|s| s.color_config.mono_chrome), | ||
| 1262 | order_hint_bits: seq.map_or(0, |s| s.order_hint_bits), | 1266 | order_hint_bits: seq.map_or(0, |s| s.order_hint_bits), |
| 1263 | mc_identity: seq.is_some_and(|s| s.color_config.matrix_coefficients == 0), | 1267 | mc_identity: seq.is_some_and(|s| s.color_config.matrix_coefficients == 0), |
| 1264 | } | 1268 | } |
| @@ -1633,6 +1637,10 @@ fn decode_frame( | |||
| 1633 | // `a_lossless_libaom_inter_frame_decodes_sample_exact`. | 1637 | // `a_lossless_libaom_inter_frame_decodes_sample_exact`. |
| 1634 | crate::decode::set_lossless(coded_lossless, fctx); | 1638 | crate::decode::set_lossless(coded_lossless, fctx); |
| 1635 | crate::decode::set_bit_depth(bit_depth, fctx); | 1639 | crate::decode::set_bit_depth(bit_depth, fctx); |
| 1640 | + // lane-av1mono: the sequence header's `mono_chrome`, set per frame like | ||
| 1641 | + // the bit depth so a mono frame decoded on a thread that last saw a | ||
| 1642 | + // 4:2:0 one never inherits the wrong plane count. | ||
| 1643 | + crate::decode::set_mono(seq.mono_chrome, fctx); | ||
| 1636 | // spec 7.16: this frame's superres state, for the filter chain -- | 1644 | // spec 7.16: this frame's superres state, for the filter chain -- |
| 1637 | // `decode.rs` upscales between CDEF and loop restoration and sizes | 1645 | // `decode.rs` upscales between CDEF and loop restoration and sizes |
| 1638 | // the LR unit grid in upscaled coordinates. Cleared (0, 8) on an | 1646 | // the LR unit grid in upscaled coordinates. Cleared (0, 8) on an |
lanes/av1mono.report.mdadded+104 -0
| @@ -0,0 +1,104 @@ | |||
| 1 | +# lane-av1-mono (WIP) — monochrome AV1 key-frame decompiles; luma not yet byte-exact | ||
| 2 | + | ||
| 3 | +Base: `main` **f0727a87** (2026-09-19). Worktree `edith_codecs-av1mono`, branch | ||
| 4 | +`lane-av1-mono`, `CARGO_TARGET_DIR=$HOME/.cache/cargo-target-av1mono` (private). | ||
| 5 | +No push. Status: **INCOMPLETE** — entropy now syncs through a real monochrome | ||
| 6 | +key frame (the pilot's first-wall refusal is gone), but the reconstructed luma is | ||
| 7 | +NOT yet byte-exact against ffmpeg; a small block region diverges. | ||
| 8 | + | ||
| 9 | +## TL;DR | ||
| 10 | + | ||
| 11 | +The pilot (`lanes/av1decode.report.md`, branch `lane-av1-decode`) root-caused the | ||
| 12 | +first monochrome stop to libaom `decodemv.c:933`'s | ||
| 13 | +`!monochrome && is_chroma_ref` guard on the chroma mode symbols. This lane ports | ||
| 14 | +the monochrome plane model into ec-av1: | ||
| 15 | + | ||
| 16 | +- new `FrameCtx::mono_chrome` (from the sequence header's `color_config.mono_chrome`), | ||
| 17 | +- every chroma **symbol** read gated (uv_mode/cfl/angle_uv/palette_uv), | ||
| 18 | +- every chroma **coefficient** read gated (`read_plane`/`read_inter_plane`/ | ||
| 19 | + `read_inter_plane_rect`/`decode_rect_split`'s un-split `read_coeffs_rect`), | ||
| 20 | +- the probe writes a single luma plane for a mono sequence. | ||
| 21 | + | ||
| 22 | +**Result: the gray/key-frame refusal `a Golomb tail longer than this decoder | ||
| 23 | +reads` is GONE — `decode_probe` now returns `OK: 60 frames decoded` for both the | ||
| 24 | +pilot's gray recipe and `fixtures/bitstreams/av1-monochrome.ivf`.** The 4:2:0 | ||
| 25 | +twin still decodes 60/60. | ||
| 26 | + | ||
| 27 | +**Remaining defect:** the decoded luma is NOT byte-exact. First divergence on the | ||
| 28 | +pilot's gray stream is frame 0, row 0, column 37 (off-by-one), and a small | ||
| 29 | +~6×2-pixel block region at row 1, cols 36-42 decodes wrong (probe 20/19 vs ref | ||
| 30 | +76). Because entropy stays in sync (all 60 frames decode, no refusal) this is a | ||
| 31 | +**luma reconstruction/prediction** defect, not an entropy desync — most likely a | ||
| 32 | +block whose intra prediction reads a neighbour state that the mono path no longer | ||
| 33 | +updates, or a residual/palette interaction on a chroma-adjacent block. This needs | ||
| 34 | +one more round. | ||
| 35 | + | ||
| 36 | +## Changes (uncommitted→committed on `lane-av1-mono`) | ||
| 37 | + | ||
| 38 | +`crates/ec-av1/src/decode.rs` | ||
| 39 | +- `FrameCtx::mono_chrome: Cell<bool>` + `mono(fctx)` / `set_mono(...)` helpers; | ||
| 40 | + copied in `filter_ctx_copy`. | ||
| 41 | +- `read_intra_mode_rect`: `has_chroma &= !mono` (gates uv_mode/cfl/angle_uv/palette_uv). | ||
| 42 | +- `read_intra_mode` (square), `decode_intra_rect_in_inter`, `decode_inter_block` | ||
| 43 | + intra-in-inter, `decode_inter_block8` intra-in-inter: explicit mono branch on | ||
| 44 | + the chroma mode read + palette_uv gate. | ||
| 45 | +- `read_intra_mode_sub8`, `decode_intra_sub8_leaf`: `has_chroma &= !mono`. | ||
| 46 | +- `read_plane`, `read_inter_plane`, `read_inter_plane_rect`: early-return | ||
| 47 | + `Grid::Zero` for `plane_idx > 0 && mono` (no coefficient symbol consumed). | ||
| 48 | +- `decode_rect_split`: whole chroma section bypassed for mono (its un-split path | ||
| 49 | + read chroma through `read_coeffs_rect` directly, NOT through `read_plane`, so | ||
| 50 | + the reader gate did not cover it — this was a real desync source). | ||
| 51 | +- `decode_leaf_rect8` / `decode_leaf_split4`: chroma reconstruction tail | ||
| 52 | + bypassed for mono (the `last_uv.expect("…has_chroma…")` panics otherwise). | ||
| 53 | + | ||
| 54 | +`crates/ec-av1/src/stream.rs` | ||
| 55 | +- `SeqFlags::mono_chrome` from `sequence_header().color_config.mono_chrome`; | ||
| 56 | + `set_mono(...)` called per frame in `decode_frame` (like `set_bit_depth`). | ||
| 57 | + | ||
| 58 | +`crates/ec-av1/examples/decode_probe.rs` | ||
| 59 | +- prints `mono_chrome` in the `SEQ:` line; writes only the luma plane when the | ||
| 60 | + sequence is monochrome (so the raw dump is what `ffmpeg -pix_fmt gray -f | ||
| 61 | + rawvideo` writes). | ||
| 62 | + | ||
| 63 | +## Repro | ||
| 64 | + | ||
| 65 | +``` | ||
| 66 | +# generate (pilot recipe) | ||
| 67 | +ffmpeg -v error -f lavfi -i "testsrc2=size=320x240:rate=30:duration=2" \ | ||
| 68 | + -pix_fmt gray -c:v libaom-av1 -cpu-used 8 -b:v 300k -f obu -y /tmp/gray.obu | ||
| 69 | +ffmpeg -v error -i fixtures/bitstreams/av1-monochrome.ivf -c:v copy -f obu -y /tmp/mono.obu | ||
| 70 | + | ||
| 71 | +P=$HOME/.cache/cargo-target-av1mono/release/examples/decode_probe | ||
| 72 | +EC_PROBE_OUT16=$HOME/m.raw16 $P /tmp/gray.obu # OK: 60 frames (was REFUSED) | ||
| 73 | +ffmpeg -v error -i /tmp/gray.obu -pix_fmt gray -f rawvideo $HOME/ref.gray | ||
| 74 | +python3 -c "d=open('$HOME/m.raw16','rb').read();print(bytes(d[0::2])==open('$HOME/ref.gray','rb').read())" | ||
| 75 | +# -> False today; first differing byte at index 37. | ||
| 76 | +``` | ||
| 77 | + | ||
| 78 | +## Verified | ||
| 79 | + | ||
| 80 | +- `decode_probe` gray recipe: `OK: 60 frames decoded, 320x240` (was REFUSED). | ||
| 81 | +- `decode_probe` `av1-monochrome.ivf` (remuxed to OBU): `OK: 60 frames` (was REFUSED). | ||
| 82 | +- 4:2:0 twin of the same recipe: `OK: 60 frames` (unchanged). | ||
| 83 | +- Byte-exactness vs ffmpeg gray: **FAILS** (see above). | ||
| 84 | + | ||
| 85 | +## NOT done (blocking acceptance) | ||
| 86 | + | ||
| 87 | +- Byte-exact luma on the three required witnesses (gray recipe, av1-monochrome.ivf, | ||
| 88 | + a 60+ frame inter gray encode). The key-frame luma mismatch must be found first. | ||
| 89 | +- Inter-frame mono streams not yet exercised past the key frame (an earlier run | ||
| 90 | + panicked in `mc.rs:1141` "a reference plane has samples" when the mono Picture | ||
| 91 | + carried empty u/v; that was fixed by keeping the chroma scratch planes in the | ||
| 92 | + Picture and making the probe — not the Picture — luma-only. Inter mono still | ||
| 93 | + needs a byte-exactness gate.) | ||
| 94 | +- The pilot's gate `a_real_libaom_monochrome_key_frame_is_refused_by_name` | ||
| 95 | + (branch `lane-av1-decode`, not on main) must be INVERTED to a pixel-exact | ||
| 96 | + witness once the luma defect is fixed. | ||
| 97 | +- `cargo test -p ec-av1 --lib` suite + `cargo check -p ec-av1 --all-targets` | ||
| 98 | + 0-warning gate not run this session. | ||
| 99 | +- Refusal inventory count not updated. | ||
| 100 | +- Film-window probes not re-run on this build. | ||
| 101 | + | ||
| 102 | +## Deferred / not chased | ||
| 103 | + | ||
| 104 | +- The other 34 refusals (pilot terrain map Wave 2/3) — untouched, per charter. | ||