From aeaf6ba721d10a963086ebecc9578c14c3318c4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sun, 6 Sep 2026 12:20:15 +0300 Subject: [PATCH] fix(av1): the per-tile search job arms its own order hints lane-av1tsearch moved the RD/motion search into one job per tile, and ref_distance (the distance-scaled search step) reads tile.rs' ORDER_HINTS thread-local: a search worker read (0, 0, [0; 7]) and scaled nothing, so the coded bits depended on the thread count -- 2x1 tiles came out 9852 bytes at one thread and 10034 at four. The inter search_tile closure now arms the hints the same way the write jobs do. encoder::tests::tile_bytes_do_not_depend_on_the_thread_count fails before this and passes after. BD unchanged: +94.4/+104.3/+66.8 vs libaom. --- crates/ec-av1/src/encode.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/ec-av1/src/encode.rs b/crates/ec-av1/src/encode.rs index b2dc36de..e66ec880 100644 --- a/crates/ec-av1/src/encode.rs +++ b/crates/ec-av1/src/encode.rs @@ -5537,6 +5537,11 @@ pub(crate) fn encode_inter_frame( let search_tile = |index: usize, fctx: &crate::decode::FrameCtx| -> Result> { + // Thread-local, and this job may be running on a `search_tiles` + // worker: `ref_distance`'s order-hint distance (the scaled motion + // search step) is read by the SEARCH, so every worker arms it or the + // tile's bits depend on the thread count. + crate::tile::arm_order_hints(seq.order_hint_bits, order_hint, order_hints); let rect = layout.rect(index); let mut luma = fresh_plane(&picture_y8, frame_width, frame_height, true_width, true_height); let mut chroma = [