forge
Explore
Log in

Don't you dare go Hollow

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 commit

5165af732327953f59f9bdaee83cef5ea88275f4Ahmet Kaan GümüşParent: ed54604f546cd0
crates/ec-av1/src/decode.rsmodified+22 -8
@@ -16399,10 +16399,6 @@ pub(crate) fn decode_key_frame_tile_with_cdfs(
1639916399 mi_rows as usize,
1640016400 );
1640116401 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];
1640616402
1640716403 // lane-tiles r2: each tile gets its own fresh `SymbolDecoder` over its
1640816404 // 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(
1643016426 let (sb_r0, sb_r1) = ((mi_row0 / SB_MI).min(sb_rows), mi_row1.div_ceil(SB_MI).min(sb_rows));
1643116427 let (sb_c0, sb_c1) = ((mi_col0 / SB_MI).min(sb_cols), mi_col1.div_ceil(SB_MI).min(sb_cols));
1643216428
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];
1643316440 let mut cdfs = base_cdfs.clone();
1643416441 // spec `decode_tile`: `CurrentQIndex` resets to the frame's own
1643516442 // `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(
2743527442 );
2743627443 let mut grid = MiGrid::new(mi_cols as usize, mi_rows as usize);
2743727444 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];
2744227445
2744327446 // lane-tiles r6: mirrors decode_key_frame_tile_with_cdfs's own per-tile
2744427447 // 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(
2746027463 (mi_col0 / SB_MI).min(sb_cols),
2746127464 mi_col1.div_ceil(SB_MI).min(sb_cols),
2746227465 );
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];
2746327477 let mut cdfs = base_cdfs.clone();
2746427478 CURRENT_Q_IDX.with(|c| c.set(i32::from(base_q_idx)));
2746527479 QUANT_DELTAS.with(|c| c.set(deltas));
crates/ec-av1/src/stream.rsmodified+13 -17
@@ -28563,24 +28563,20 @@ mod tests {
2856328563 );
2856428564 }
2856528565
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.
2858228579 #[test]
28583- #[ignore = "open defect: seed-42 32x32 block at x[224..255] y[32..63] mismatches; tile attribution unproven"]
2858428580 fn a_real_aomenc_multi_tile_inter_stream_decodes_pixel_exact() {
2858528581 run_multi_tile_gate(
2858628582 "a_real_aomenc_multi_tile_inter_stream_decodes_pixel_exact",