Merge branch 'lane-t900' (c14f0c99): loop-restoration coefficient reference reset per tile (spec decode_tile RefLrWiener/RefSgrXqd); multi-tile inter gate un-ignored
Browse files at this commit2 changed files +35 -25
- crates/ec-av1/src/decode.rs +22 -8
- crates/ec-av1/src/stream.rs +13 -17
crates/ec-av1/src/decode.rsmodified+22 -8
| @@ -16399,10 +16399,6 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | ||
| 16399 | 16399 | mi_rows as usize, |
| 16400 | 16400 | ); |
| 16401 | 16401 | let mut lr_grid = crate::restoration::RestorationGrid::new(lr, frame_width, frame_height); |
| 16402 | - let mut lr_reference = [( | |
| 16403 | - crate::restoration::WienerInfo::default(), | |
| 16404 | - crate::restoration::SgrprojInfo::default(), | |
| 16405 | - ); 3]; | |
| 16406 | 16402 | |
| 16407 | 16403 | // lane-tiles r2: each tile gets its own fresh `SymbolDecoder` over its |
| 16408 | 16404 | // own byte range and its own fresh copy of the frame's initial CDFs |
| @@ -16430,6 +16426,17 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | ||
| 16430 | 16426 | let (sb_r0, sb_r1) = ((mi_row0 / SB_MI).min(sb_rows), mi_row1.div_ceil(SB_MI).min(sb_rows)); |
| 16431 | 16427 | let (sb_c0, sb_c1) = ((mi_col0 / SB_MI).min(sb_cols), mi_col1.div_ceil(SB_MI).min(sb_cols)); |
| 16432 | 16428 | |
| 16429 | + // lane-t900 r19: spec 5.11.2 `decode_tile` resets `RefLrWiener` / | |
| 16430 | + // `RefSgrXqd` to the midpoint filter at the top of EVERY tile, not | |
| 16431 | + // once per frame. Carried across a tile boundary, the loop-restoration | |
| 16432 | + // coefficients of the next tile decode off the previous tile's | |
| 16433 | + // reference -- same symbol count, so entropy and reconstruction stay | |
| 16434 | + // exact and only the filtered pixels of every tile after the first | |
| 16435 | + // are wrong. | |
| 16436 | + let mut lr_reference = [( | |
| 16437 | + crate::restoration::WienerInfo::default(), | |
| 16438 | + crate::restoration::SgrprojInfo::default(), | |
| 16439 | + ); 3]; | |
| 16433 | 16440 | let mut cdfs = base_cdfs.clone(); |
| 16434 | 16441 | // spec `decode_tile`: `CurrentQIndex` resets to the frame's own |
| 16435 | 16442 | // `base_q_idx` at the top of every tile, not once per frame. |
| @@ -27435,10 +27442,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 27435 | 27442 | ); |
| 27436 | 27443 | let mut grid = MiGrid::new(mi_cols as usize, mi_rows as usize); |
| 27437 | 27444 | let mut lr_grid = crate::restoration::RestorationGrid::new(lr, frame_width, frame_height); |
| 27438 | - let mut lr_reference = [( | |
| 27439 | - crate::restoration::WienerInfo::default(), | |
| 27440 | - crate::restoration::SgrprojInfo::default(), | |
| 27441 | - ); 3]; | |
| 27442 | 27445 | |
| 27443 | 27446 | // lane-tiles r6: mirrors decode_key_frame_tile_with_cdfs's own per-tile |
| 27444 | 27447 | // loop (spec 5.11.2 decode_tile / 7.20 exit_symbol) -- each tile gets |
| @@ -27460,6 +27463,17 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 27460 | 27463 | (mi_col0 / SB_MI).min(sb_cols), |
| 27461 | 27464 | mi_col1.div_ceil(SB_MI).min(sb_cols), |
| 27462 | 27465 | ); |
| 27466 | + // lane-t900 r19: spec 5.11.2 `decode_tile` resets `RefLrWiener` / | |
| 27467 | + // `RefSgrXqd` to the midpoint filter at the top of EVERY tile, not | |
| 27468 | + // once per frame. Carried across a tile boundary, the loop-restoration | |
| 27469 | + // coefficients of the next tile decode off the previous tile's | |
| 27470 | + // reference -- same symbol count, so entropy and reconstruction stay | |
| 27471 | + // exact and only the filtered pixels of every tile after the first | |
| 27472 | + // are wrong. | |
| 27473 | + let mut lr_reference = [( | |
| 27474 | + crate::restoration::WienerInfo::default(), | |
| 27475 | + crate::restoration::SgrprojInfo::default(), | |
| 27476 | + ); 3]; | |
| 27463 | 27477 | let mut cdfs = base_cdfs.clone(); |
| 27464 | 27478 | CURRENT_Q_IDX.with(|c| c.set(i32::from(base_q_idx))); |
| 27465 | 27479 | QUANT_DELTAS.with(|c| c.set(deltas)); |
crates/ec-av1/src/stream.rsmodified+13 -17
| @@ -28563,24 +28563,20 @@ mod tests { | ||
| 28563 | 28563 | ); |
| 28564 | 28564 | } |
| 28565 | 28565 | |
| 28566 | - /// OPEN DEFECT (lane-tiles r11), which is why this arm is `#[ignore]`d | |
| 28567 | - /// rather than deleted or quietly reseeded: at seed 42 this recipe | |
| 28568 | - /// mismatches ffmpeg from frame 4 on, in one 32x32 block at | |
| 28569 | - /// x[224..255] y[32..63] (measured with `--loopfilter-control=0`, which | |
| 28570 | - /// removes the deblock spreading; with deblocking on the region grows to | |
| 28571 | - /// x[221..255] y[30..69] and crosses the tile row boundary at y=64), and | |
| 28572 | - /// the error then propagates through inter prediction to 12 of 16 frames. | |
| 28573 | - /// Ablations that did NOT remove it: `--enable-restoration=0`, | |
| 28574 | - /// `--enable-cdef=0`, `--loopfilter-control=0`. It is seed-specific | |
| 28575 | - /// (seeds 47 and 48 decode 16/16 exact with two tile rows) and its | |
| 28576 | - /// tile attribution is UNPROVEN: the single-tile control at seed 42 | |
| 28577 | - /// re-encodes to different partitions and refuses on | |
| 28578 | - /// "an inter SB-level partition type other than SPLIT", so no | |
| 28579 | - /// same-content one-tile comparison exists. Reproducer: | |
| 28580 | - /// `EC_AV1_GATE_DUMP=<path> cargo test -p ec-av1 --lib | |
| 28581 | - /// a_real_aomenc_multi_tile_inter_stream -- --ignored`. | |
| 28566 | + /// lane-t900 r19, the defect this arm exists for, now FIXED: spec 5.11.2 | |
| 28567 | + /// `decode_tile` resets `RefLrWiener`/`RefSgrXqd` (the running | |
| 28568 | + /// loop-restoration coefficient reference) to the midpoint filter at the | |
| 28569 | + /// top of EVERY tile; `decode.rs` declared that state once per frame, so | |
| 28570 | + /// every tile after the first decoded its Wiener/Sgrproj coefficients off | |
| 28571 | + /// the previous tile's reference. The symbol COUNT is unchanged, so | |
| 28572 | + /// entropy and reconstruction stayed byte-exact and only the filtered | |
| 28573 | + /// pixels moved -- at seed 44 frame 0 (the key frame) the whole right tile | |
| 28574 | + /// column, luma x[128..255] y[0..91], 1330 samples off by at most 2, with | |
| 28575 | + /// chroma exact. Ladder that named it: `EC_AV1_PREFILT_DUMP` exact, | |
| 28576 | + /// `EC_AV1_POSTDEBLOCK_DUMP` exact, `EC_AV1_POSTCDEF_DUMP` exact (that | |
| 28577 | + /// last rung added to the oracle's `decodeframe.c` in this round), so the | |
| 28578 | + /// only remaining stage was loop restoration. | |
| 28582 | 28579 | #[test] |
| 28583 | - #[ignore = "open defect: seed-42 32x32 block at x[224..255] y[32..63] mismatches; tile attribution unproven"] | |
| 28584 | 28580 | fn a_real_aomenc_multi_tile_inter_stream_decodes_pixel_exact() { |
| 28585 | 28581 | run_multi_tile_gate( |
| 28586 | 28582 | "a_real_aomenc_multi_tile_inter_stream_decodes_pixel_exact", |