From 89f1aa33d7d11ee3e7750257fa49bf9bb8cad8e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sat, 5 Sep 2026 04:23:52 +0300 Subject: [PATCH] perf(av1): a recorded inter write carries its own transform unit, not the block reconstruct_mc_rect reads exactly rows 0..h and columns 0..w of the two buffers, so recording the whole block prediction copied 64*64 samples on the parsing thread for a 4x4 unit. The record now holds that window densely at stride w, and the deferred residual is produced dense to match (TxParams::stride = 0) -- the same numbers in the same places. Byte-exact at recon 4 on all four probe inputs. --- crates/ec-av1/src/decode.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index c4eefc39..3218cba3 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -2647,8 +2647,20 @@ fn push_mc_rect_tx( inline_mc(plane, x, y, stride, w, h, prediction, &tx.run(grid), fctx); return; } + // `reconstruct_mc_rect` reads exactly rows `0..h`, columns `0..w` of the + // two buffers at `stride`, so the record carries that window densely + // rather than the whole block's prediction: a 4x4 unit of a 64x64 block + // copied 64*64 samples on the PARSING thread before. The residual is then + // produced dense too (`TxParams::stride = 0`), which is the same numbers + // in the same places at stride `w`. + let mut window = Vec::with_capacity(w * h); + for row in 0..h { + window.extend_from_slice(&prediction[row * stride..][..w]); + } + let mut tx = tx; + tx.stride = 0; push_op(fctx, ReconOp::Mc { - plane, x, y, stride, w, h, prediction: prediction.to_vec(), + plane, x, y, stride: w, w, h, prediction: window, residual: Residual::Coeffs(tx, grid.to_vec()), }); }