From 07a8e46ead9e64392384bb053e701f81ccafc40d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Fri, 28 Aug 2026 05:01:06 +0300 Subject: [PATCH] fix(av1): pin the film-grain gate below use_ref_frame_mvs's unimplemented path real_aomenc_film_grain_streams_decode_pixel_exact's frame-1 mismatch was never a grain bug: aomenc turns on temporal MV projection (use_ref_frame_mvs) by default once order hints are enabled, and mvstack.rs's documented corner-cut always computes zero_mv_ctx and the mode-context GLOBALMV_OFFSET bit as if it were off, desyncing the symbol stream from the first NEARESTMV block that inherits a temporal-adjusted context. Add --enable-ref-frame-mvs=0 alongside this gate's other disabled features so it isolates grain synthesis as its own comment already claims, matching every real-aomenc gate's envelope pattern. Temporal MV projection stays a separate, unimplemented capability. --- crates/ec-av1/src/stream.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index afef1658..300f56fe 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -2549,6 +2549,17 @@ mod tests { "--enable-palette=0", "--enable-intrabc=0", "--enable-cfl-intra=0", + // Temporal MV projection (`use_ref_frame_mvs`) has no + // decode path here (`mvstack.rs`'s documented corner-cut: + // `zero_mv_ctx` and the mode-context GLOBALMV_OFFSET bit + // are always computed as if it were off) -- this gate + // isolates grain synthesis, so it must stay inside that + // envelope like every other feature disabled above, not + // silently decode a wrong mode context. Root cause of + // this test's frame-1 mismatch: aomenc turns + // `use_ref_frame_mvs` on by default once order hints are + // enabled, unrelated to `--tune-content=film`. + "--enable-ref-frame-mvs=0", "--tune-content=film", "--obu", "-o",