From 8ef9abd084d4bf3a66cad8e36b5203568894af71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Tue, 8 Sep 2026 13:57:48 +0300 Subject: [PATCH] test(av1): the seven encode-then-decode stream gates take the encoder's own superblock size Each built a plain FrameCtx (superblock 64) and handed it to encode_*_with_ctx, so under EC_AV1_SB128=1 the writer coded a 128 root while the encoder's own trial decode -- and the raw tile decode beside it -- read at 64. First divergent symbol on the key-frame gate at 216x96: index 33, the writer's 8-symbol partition_w128 (SPLIT), which the reader skipped straight past into the 10-symbol partition_w64. The other six surfaced as the arf refusing a reference slot inside the encoder's trial decode. Same class the lane-b128 merge swept through ten of their neighbours; these seven were the rest of it. --- crates/ec-av1/src/stream.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index 0c38f1eb..3f6d74d4 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -3014,7 +3014,10 @@ pub(crate) mod tests { /// the encoder's own reconstruction, at an even and an odd size. #[test] fn decode_stream_matches_the_tile_path_on_a_key_frame() { - let fctx = &crate::decode::FrameCtx::new(); + // lane-b128m: the ENCODER writes at this process's superblock size, so + // its own trial decode -- and the raw tile decode below -- must be given + // that size too (class: stale header in the test harness). + let fctx = &crate::decode::FrameCtx::for_encoder(); for &(width, height) in &[(64usize, 64usize), (216, 96)] { let picture = test_card(width, height); let encoded = encode_key_frame_with_ctx(&picture, 100, 0.5, fctx).unwrap(); @@ -3085,7 +3088,7 @@ pub(crate) mod tests { #[test] fn decode_stream_round_trips_a_gop() { - let fctx = &crate::decode::FrameCtx::new(); + let fctx = &crate::decode::FrameCtx::for_encoder(); gop_round_trips(128, 64, fctx); } @@ -3093,7 +3096,7 @@ pub(crate) mod tests { /// the inter frame's 16x16-leaf split path is exercised too. #[test] fn decode_stream_round_trips_an_odd_size_gop() { - let fctx = &crate::decode::FrameCtx::new(); + let fctx = &crate::decode::FrameCtx::for_encoder(); gop_round_trips(216, 96, fctx); } @@ -3105,7 +3108,7 @@ pub(crate) mod tests { /// decode indices non-decreasing, and an `Err` from the sink aborting. #[test] fn streaming_decode_matches_the_collecting_one() { - let fctx = &crate::decode::FrameCtx::new(); + let fctx = &crate::decode::FrameCtx::for_encoder(); let pictures: Vec<_> = (0..4).map(|i| panned_test_card(128, 64, i * 3)).collect(); let stream = encode_sequence_with_ctx(&pictures, 100, 0.5, fctx).unwrap().stream; let collected = decode_stream(&stream).unwrap(); @@ -3402,7 +3405,7 @@ pub(crate) mod tests { /// independent decoder, not just this crate checking its own tile path. #[test] fn decode_stream_agrees_with_ffmpeg_on_a_gop() { - let fctx = &crate::decode::FrameCtx::new(); + let fctx = &crate::decode::FrameCtx::for_encoder(); if !have_ffmpeg() { eprintln!("SKIP decode_stream_agrees_with_ffmpeg_on_a_gop: no ffmpeg"); return; @@ -3456,7 +3459,7 @@ pub(crate) mod tests { /// geometry that never fires it. #[test] fn a_sweep_of_doubly_straddling_sizes_round_trips_through_ffmpeg() { - let fctx = &crate::decode::FrameCtx::new(); + let fctx = &crate::decode::FrameCtx::for_encoder(); if !have_ffmpeg() { eprintln!("SKIP a_sweep_of_doubly_straddling_sizes_round_trips_through_ffmpeg: no ffmpeg"); return; @@ -3516,7 +3519,7 @@ pub(crate) mod tests { /// reconstruction, and ffmpeg. #[test] fn a_doubly_cut_superblock_root_round_trips_in_every_plane() { - let fctx = &crate::decode::FrameCtx::new(); + let fctx = &crate::decode::FrameCtx::for_encoder(); if !have_ffmpeg() { eprintln!("SKIP a_doubly_cut_superblock_root_round_trips_in_every_plane: no ffmpeg"); return;