forge
Explore
Log in

Don't you dare go Hollow

A recorded inter write names where its prediction comes from

Browse files at this commit

8aa7db153f618b6c26409eee75368ba7ca71c195Ahmet Kaan GümüşParent: 11ef8ca
  • refactor
    • a recorded inter write names where its prediction comes from
Show full message
refactor(av1): a recorded inter write names where its prediction comes from

lane-wave4 step 1: `ReconOp::Mc` carries a `PredSrc` (an owned window, or
an offset into the block prediction a worker builds) and the inter readers
take a `Pred` instead of a slice, so a prediction can be deferred without
touching every call site again. No deferral yet: every site passes
`Pred::dense`, which is the same window copy as before.
crates/ec-av1/src/decode.rsmodified+231 -72
@@ -2112,7 +2112,117 @@ impl Residual {
21122112 }
21132113 }
21142114
2115+/// Where a recorded motion-compensated write reads its prediction from.
2116+///
2117+/// lane-wave4: a block's whole-block prediction (mc + warp + interintra) is
2118+/// the parse thread's single biggest reconstruction cost, so at
2119+/// `EC_AV1_RECON_THREADS > 1` it is not built at parse at all: the block
2120+/// pushes a [`ReconOp::Pred`] carrying the build as a closure, the worker
2121+/// runs it into its own three-plane slot, and every transform unit of that
2122+/// block then reads its window out of that slot ([`Pred::Cur`]).
2123+#[derive(Clone, Copy)]
2124+pub(crate) enum Pred<'a> {
2125+ /// A prediction the parse thread already built. `stride == 0` means "the
2126+ /// reader's own `stride` argument", which is every pre-lane-wave4 site.
2127+ Inline(&'a [u16], usize),
2128+ /// The current block's deferred prediction: plane, its stride, and this
2129+ /// unit's offset into it.
2130+ Cur { plane: usize, stride: usize, off: usize },
2131+}
2132+
2133+impl<'a> Pred<'a> {
2134+ fn dense(buf: &'a [u16]) -> Self {
2135+ Self::Inline(buf, 0)
2136+ }
2137+ /// The same prediction read at an explicit stride.
2138+ fn view(self, stride: usize) -> Self {
2139+ match self {
2140+ Self::Inline(b, _) => Self::Inline(b, stride),
2141+ Self::Cur { plane, off, .. } => Self::Cur { plane, stride, off },
2142+ }
2143+ }
2144+ /// The materialised buffer and the stride to read it at (`stride` is the
2145+ /// reader's own when this prediction was built dense); `None` for a
2146+ /// deferred prediction, which only a recorded op can carry.
2147+ fn inline(self, stride: usize) -> Option<(&'a [u16], usize)> {
2148+ match self {
2149+ Self::Inline(b, s) => Some((b, if s == 0 { stride } else { s })),
2150+ Self::Cur { .. } => None,
2151+ }
2152+ }
2153+ /// This prediction's window starting `n` samples in.
2154+ fn offset(self, n: usize) -> Self {
2155+ match self {
2156+ Self::Inline(b, s) => Self::Inline(&b[n..], s),
2157+ Self::Cur { plane, stride, off } => Self::Cur { plane, stride, off: off + n },
2158+ }
2159+ }
2160+}
2161+
2162+/// [`Pred`], resolved into what a recorded op carries.
2163+pub(crate) enum PredSrc {
2164+ Owned(Vec<u16>),
2165+ Cur { plane: usize, off: usize },
2166+}
2167+
2168+/// One block's whole-block prediction build, deferred to a recon worker.
2169+///
2170+/// The closure borrows the tile's reference pictures and its own frame-level
2171+/// tables; [`WaveGuard`] joins every worker before the tile decoder returns,
2172+/// so those borrows outlive it -- the [`ReconPlanes`] trade-off, stated once
2173+/// here for the closure's `'static`/`Send` laundering in [`push_pred`].
2174+pub(crate) struct PredBuild(
2175+ Box<
2176+ dyn FnOnce(
2177+ &mut PlaneBuf<'static>,
2178+ &mut PlaneBuf<'static>,
2179+ &mut PlaneBuf<'static>,
2180+ &crate::decode::FrameCtx,
2181+ ) -> [Vec<u16>; 3],
2182+ >,
2183+);
2184+
2185+// SAFETY: see [`PredBuild`] -- the captured borrows are read-only reference
2186+// pictures and frame tables, and the closure runs on exactly one worker.
2187+#[allow(unsafe_code)]
2188+unsafe impl Send for PredBuild {}
2189+
2190+/// `true` when this tile's writes are recorded for the wavefront instead of
2191+/// performed at the push site, i.e. when a prediction may be deferred.
2192+fn recon_deferred(fctx: &crate::decode::FrameCtx) -> bool {
2193+ fctx.recon_planes.with(std::cell::Cell::get).is_none()
2194+}
2195+
2196+/// Records one block's prediction build for the worker that reconstructs it.
2197+#[allow(unsafe_code)]
2198+fn push_pred<'a>(
2199+ fctx: &crate::decode::FrameCtx,
2200+ f: impl FnOnce(
2201+ &mut PlaneBuf<'static>,
2202+ &mut PlaneBuf<'static>,
2203+ &mut PlaneBuf<'static>,
2204+ &crate::decode::FrameCtx,
2205+ ) -> [Vec<u16>; 3]
2206+ + 'a,
2207+) {
2208+ type Built = [Vec<u16>; 3];
2209+ type Dyn<'x> = dyn FnOnce(
2210+ &mut PlaneBuf<'static>,
2211+ &mut PlaneBuf<'static>,
2212+ &mut PlaneBuf<'static>,
2213+ &crate::decode::FrameCtx,
2214+ ) -> Built
2215+ + 'x;
2216+ let boxed: Box<Dyn<'a>> = Box::new(f);
2217+ // SAFETY: see [`PredBuild`] -- every worker is joined by [`WaveGuard`]
2218+ // before the borrows the closure holds go out of scope.
2219+ let boxed: Box<Dyn<'static>> = unsafe { std::mem::transmute(boxed) };
2220+ push_op(fctx, ReconOp::Pred(PredBuild(boxed)));
2221+}
2222+
21152223 pub(crate) enum ReconOp {
2224+ /// lane-wave4: build this block's prediction into the worker's slot.
2225+ Pred(PredBuild),
21162226 Intra {
21172227 plane: usize,
21182228 x: usize,
@@ -2141,7 +2251,7 @@ pub(crate) enum ReconOp {
21412251 stride: usize,
21422252 w: usize,
21432253 h: usize,
2144- prediction: Vec<u16>,
2254+ prediction: PredSrc,
21452255 residual: Residual,
21462256 },
21472257 }
@@ -2222,7 +2332,7 @@ fn push_op(fctx: &crate::decode::FrameCtx, op: ReconOp) {
22222332 if let Some(ReconPlanes(y, u, v)) = fctx.recon_planes.with(std::cell::Cell::get) {
22232333 // SAFETY: see [`ReconPlanes`] -- one thread, and the write is the one
22242334 // the parse site would have performed itself before lane-wave1.
2225- unsafe { exec_op(op, &mut *y, &mut *u, &mut *v, fctx) };
2335+ unsafe { exec_op(op, &mut *y, &mut *u, &mut *v, &mut Default::default(), fctx) };
22262336 return;
22272337 }
22282338 fctx.recon_ops.with(|c| c.borrow_mut().push(op));
@@ -2295,9 +2405,10 @@ fn wave_worker(st: &WaveState) {
22952405 // SAFETY: this job writes only superblock (r, c)'s own pixels, and
22962406 // every superblock that could have written or be reading them is
22972407 // complete by the wavefront rule above.
2408+ let mut cur: [Vec<u16>; 3] = Default::default();
22982409 unsafe {
22992410 for op in ops {
2300- exec_op(op, &mut *y, &mut *u, &mut *v, &fctx);
2411+ exec_op(op, &mut *y, &mut *u, &mut *v, &mut cur, &fctx);
23012412 }
23022413 }
23032414 let mut q = st.q.lock().unwrap();
@@ -2520,14 +2631,25 @@ fn push_mc_rect_owned(
25202631 stride: usize,
25212632 w: usize,
25222633 h: usize,
2523- prediction: &[u16],
2634+ prediction: Pred<'_>,
25242635 residual: Vec<i32>, fctx: &crate::decode::FrameCtx,
25252636 ) {
2526- if inline_mc(plane, x, y, stride, w, h, prediction, &residual, fctx) {
2637+ let (src, stride) = match prediction.inline(stride) {
2638+ Some(v) => v,
2639+ None => {
2640+ let Pred::Cur { plane: sp, stride: ss, off } = prediction else { unreachable!() };
2641+ push_op(fctx, ReconOp::Mc {
2642+ plane, x, y, stride: ss, w, h, prediction: PredSrc::Cur { plane: sp, off },
2643+ residual: Residual::Done(residual),
2644+ });
2645+ return;
2646+ }
2647+ };
2648+ if inline_mc(plane, x, y, stride, w, h, src, &residual, fctx) {
25272649 return;
25282650 }
25292651 push_op(fctx, ReconOp::Mc {
2530- plane, x, y, stride, w, h, prediction: prediction.to_vec(),
2652+ plane, x, y, stride, w, h, prediction: PredSrc::Owned(src.to_vec()),
25312653 residual: Residual::Done(residual),
25322654 });
25332655 }
@@ -2567,7 +2689,7 @@ fn push_mc(
25672689 x: usize,
25682690 y: usize,
25692691 side: usize,
2570- prediction: &[u16],
2692+ prediction: Pred<'_>,
25712693 residual: &[i32], fctx: &crate::decode::FrameCtx,
25722694 ) {
25732695 push_mc_rect(plane, x, y, side, side, side, prediction, residual, fctx);
@@ -2582,15 +2704,26 @@ fn push_mc_rect(
25822704 stride: usize,
25832705 w: usize,
25842706 h: usize,
2585- prediction: &[u16],
2707+ prediction: Pred<'_>,
25862708 residual: &[i32], fctx: &crate::decode::FrameCtx,
25872709 ) {
2588- if inline_mc(plane, x, y, stride, w, h, prediction, residual, fctx) {
2710+ let (src, stride) = match prediction.inline(stride) {
2711+ Some(v) => v,
2712+ None => {
2713+ let Pred::Cur { plane: sp, stride: ss, off } = prediction else { unreachable!() };
2714+ push_op(fctx, ReconOp::Mc {
2715+ plane, x, y, stride: ss, w, h, prediction: PredSrc::Cur { plane: sp, off },
2716+ residual: Residual::Done(residual.to_vec()),
2717+ });
2718+ return;
2719+ }
2720+ };
2721+ if inline_mc(plane, x, y, stride, w, h, src, residual, fctx) {
25892722 return;
25902723 }
25912724 push_op(fctx, ReconOp::Mc {
25922725 plane, x, y, stride, w, h,
2593- prediction: prediction.to_vec(), residual: Residual::Done(residual.to_vec()),
2726+ prediction: PredSrc::Owned(src.to_vec()), residual: Residual::Done(residual.to_vec()),
25942727 });
25952728 }
25962729
@@ -2638,11 +2771,28 @@ fn push_mc_rect_tx(
26382771 stride: usize,
26392772 w: usize,
26402773 h: usize,
2641- prediction: &[u16],
2774+ prediction: Pred<'_>,
26422775 tx: TxParams,
26432776 grid: &[i32],
26442777 fctx: &crate::decode::FrameCtx,
26452778 ) {
2779+ // lane-wave4: a deferred prediction is not there to be windowed -- the
2780+ // op carries its offset into the block's prediction instead, and the
2781+ // residual is laid out at that same stride (`reconstruct_mc_rect` reads
2782+ // both buffers at one stride).
2783+ let (prediction, stride) = match prediction.inline(stride) {
2784+ Some(v) => v,
2785+ None => {
2786+ let Pred::Cur { plane: sp, stride: ss, off } = prediction else { unreachable!() };
2787+ let mut tx = tx;
2788+ tx.stride = ss;
2789+ push_op(fctx, ReconOp::Mc {
2790+ plane, x, y, stride: ss, w, h, prediction: PredSrc::Cur { plane: sp, off },
2791+ residual: Residual::Coeffs(tx, grid.to_vec()),
2792+ });
2793+ return;
2794+ }
2795+ };
26462796 if fctx.recon_planes.with(std::cell::Cell::get).is_some() {
26472797 inline_mc(plane, x, y, stride, w, h, prediction, &tx.run(grid), fctx);
26482798 return;
@@ -2660,7 +2810,7 @@ fn push_mc_rect_tx(
26602810 let mut tx = tx;
26612811 tx.stride = 0;
26622812 push_op(fctx, ReconOp::Mc {
2663- plane, x, y, stride: w, w, h, prediction: window,
2813+ plane, x, y, stride: w, w, h, prediction: PredSrc::Owned(window),
26642814 residual: Residual::Coeffs(tx, grid.to_vec()),
26652815 });
26662816 }
@@ -2684,8 +2834,9 @@ fn flush_recon(
26842834 wave_barrier(fctx);
26852835 let mut ops = fctx.recon_spare.with(|c| std::mem::take(&mut *c.borrow_mut()));
26862836 fctx.recon_ops.with(|c| std::mem::swap(&mut *c.borrow_mut(), &mut ops));
2837+ let mut cur: [Vec<u16>; 3] = Default::default();
26872838 for op in ops.drain(..) {
2688- exec_op(op, y, u, v, fctx);
2839+ exec_op(op, y, u, v, &mut cur, fctx);
26892840 }
26902841 fctx.recon_spare.with(|c| *c.borrow_mut() = ops);
26912842 }
@@ -2697,9 +2848,11 @@ fn exec_op(
26972848 y: &mut PlaneBuf<'static>,
26982849 u: &mut PlaneBuf<'static>,
26992850 v: &mut PlaneBuf<'static>,
2851+ cur: &mut [Vec<u16>; 3],
27002852 fctx: &crate::decode::FrameCtx,
27012853 ) {
27022854 match op {
2855+ ReconOp::Pred(b) => *cur = (b.0)(y, u, v, fctx),
27032856 ReconOp::Intra {
27042857 plane, x, y: oy, bw, bh, rect, mode, angle_delta, reach, residual, cfl,
27052858 filter_intra, smooth_neighbor, pred,
@@ -2708,7 +2861,17 @@ fn exec_op(
27082861 cfl, filter_intra, smooth_neighbor, pred, fctx,
27092862 ),
27102863 ReconOp::Mc { plane, x, y: oy, stride, w, h, prediction, residual } => {
2711- exec_mc(y, u, v, plane, x, oy, stride, w, h, &prediction, &residual.resolve(), fctx);
2864+ let residual = residual.resolve();
2865+ match prediction {
2866+ PredSrc::Owned(p) => {
2867+ exec_mc(y, u, v, plane, x, oy, stride, w, h, &p, &residual, fctx);
2868+ }
2869+ PredSrc::Cur { plane: sp, off } => {
2870+ let src = std::mem::take(&mut cur[sp]);
2871+ exec_mc(y, u, v, plane, x, oy, stride, w, h, &src[off..], &residual, fctx);
2872+ cur[sp] = src;
2873+ }
2874+ }
27122875 }
27132876 }
27142877 }
@@ -16941,7 +17104,7 @@ fn read_inter_plane_rect(
1694117104 _plane: &mut PlaneBuf<'static>,
1694217105 x: usize,
1694317106 y: usize,
16944- prediction: &[u16],
17107+ prediction: Pred<'_>,
1694517108 inherited_luma_tx_type: Option<TxType>,
1694617109 luma_skip_ctx: Option<usize>, fctx: &crate::decode::FrameCtx,
1694717110 ) -> Result<(Vec<i32>, TxType)> {
@@ -17052,7 +17215,7 @@ fn read_inter_luma8(
1705217215 y: &mut PlaneBuf<'static>,
1705317216 px: usize,
1705417217 py: usize,
17055- pred_y: &[u16],
17218+ pred_y: Pred<'_>,
1705617219 mode_for_tx: usize,
1705717220 base_q_idx: u8,
1705817221 scan8: &[u16],
@@ -17087,11 +17250,7 @@ fn read_inter_luma8(
1708717250 for tu_row in 0..2 {
1708817251 for tu_col in 0..2 {
1708917252 let tu_mi = (leaf_mi.0 + tu_row, leaf_mi.1 + tu_col);
17090- let mut tu_pred = Vec::with_capacity(16);
17091- for rr in 0..4 {
17092- let start = (tu_row * 4 + rr) * 8 + tu_col * 4;
17093- tu_pred.extend_from_slice(&pred_y[start..start + 4]);
17094- }
17253+ let tu_pred = pred_y.view(8).offset(tu_row * 4 * 8 + tu_col * 4);
1709517254 let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, 1);
1709617255 let (tu_grid, tu_tx_type) = read_inter_plane(
1709717256 dec,
@@ -17110,7 +17269,7 @@ fn read_inter_luma8(
1711017269 py + tu_row * 4,
1711117270 4,
1711217271 base_q_idx,
17113- &tu_pred,
17272+ tu_pred,
1711417273 None,
1711517274 Some(tu_skip_ctx), fctx,
1711617275 )?;
@@ -21525,7 +21684,7 @@ fn read_inter_plane(
2152521684 y: usize,
2152621685 side: usize,
2152721686 _base_q_idx: u8,
21528- prediction: &[u16],
21687+ prediction: Pred<'_>,
2152921688 // lane-chromau: this block's own luma transform's *actual coded*
2153021689 // `tx_type` -- `av1_get_tx_type` (libaom `blockd.h`): an inter block's
2153121690 // chroma plane never codes its own `tx_type` symbol, but (unlike an
@@ -24117,7 +24276,7 @@ fn decode_inter_block(
2411724276 side,
2411824277 write_w,
2411924278 write_h,
24120- &pred_y,
24279+ Pred::dense(&pred_y),
2412124280 &vec![0i32; side * side], fctx,
2412224281 );
2412324282 push_mc_rect(1,
@@ -24126,7 +24285,7 @@ fn decode_inter_block(
2412624285 chroma_side,
2412724286 write_chroma_w,
2412824287 write_chroma_h,
24129- &pred_u,
24288+ Pred::dense(&pred_u),
2413024289 &vec![0i32; chroma_side * chroma_side], fctx,
2413124290 );
2413224291 push_mc_rect(2,
@@ -24135,7 +24294,7 @@ fn decode_inter_block(
2413524294 chroma_side,
2413624295 write_chroma_w,
2413724296 write_chroma_h,
24138- &pred_v,
24297+ Pred::dense(&pred_v),
2413924298 &vec![0i32; chroma_side * chroma_side], fctx,
2414024299 );
2414124300 luma_grid = vec![0i32; side * side];
@@ -24189,7 +24348,7 @@ fn decode_inter_block(
2418924348 tu_py,
2419024349 tx_px,
2419124350 base_q_idx,
24192- &tu_pred,
24351+ Pred::dense(&tu_pred),
2419324352 None,
2419424353 Some(tu_skip_ctx), fctx,
2419524354 )?
@@ -24217,7 +24376,7 @@ fn decode_inter_block(
2421724376 y,
2421824377 tu_px,
2421924378 tu_py,
24220- &pred_y[start..],
24379+ Pred::dense(&pred_y[start..]),
2422124380 None,
2422224381 Some(tu_skip_ctx), fctx,
2422324382 )?
@@ -24274,7 +24433,7 @@ fn decode_inter_block(
2427424433 cu_y,
2427524434 cu_tx,
2427624435 base_q_idx,
24277- &cu_pred,
24436+ Pred::dense(&cu_pred),
2427824437 Some(first_tx_type),
2427924438 Some(3), fctx,
2428024439 )?
@@ -24321,7 +24480,7 @@ fn decode_inter_block(
2432124480 y,
2432224481 px,
2432324482 py,
24324- &pred_y,
24483+ Pred::dense(&pred_y),
2432524484 None,
2432624485 None, fctx,
2432724486 )?;
@@ -24341,7 +24500,7 @@ fn decode_inter_block(
2434124500 py,
2434224501 side,
2434324502 base_q_idx,
24344- &pred_y,
24503+ Pred::dense(&pred_y),
2434524504 None,
2434624505 None, fctx,
2434724506 )?;
@@ -24371,7 +24530,7 @@ fn decode_inter_block(
2437124530 u,
2437224531 cpx,
2437324532 cpy,
24374- &pred_u,
24533+ Pred::dense(&pred_u),
2437524534 Some(luma_tx_type),
2437624535 None, fctx,
2437724536 )?
@@ -24393,7 +24552,7 @@ fn decode_inter_block(
2439324552 v,
2439424553 cpx,
2439524554 cpy,
24396- &pred_v,
24555+ Pred::dense(&pred_v),
2439724556 Some(luma_tx_type),
2439824557 None, fctx,
2439924558 )?
@@ -24416,7 +24575,7 @@ fn decode_inter_block(
2441624575 cpy,
2441724576 chroma_side,
2441824577 base_q_idx,
24419- &pred_u,
24578+ Pred::dense(&pred_u),
2442024579 Some(luma_tx_type),
2442124580 None, fctx,
2442224581 )?
@@ -24434,7 +24593,7 @@ fn decode_inter_block(
2443424593 cpy,
2443524594 chroma_side,
2443624595 base_q_idx,
24437- &pred_v,
24596+ Pred::dense(&pred_v),
2443824597 Some(luma_tx_type),
2443924598 None, fctx,
2444024599 )?
@@ -25328,7 +25487,7 @@ fn decode_inter_block(
2532825487 side,
2532925488 write_w,
2533025489 write_h,
25331- &pred_y,
25490+ Pred::dense(&pred_y),
2533225491 &vec![0i32; side * side], fctx,
2533325492 );
2533425493 if has_chroma {
@@ -25338,7 +25497,7 @@ fn decode_inter_block(
2533825497 chroma_side,
2533925498 write_chroma_w,
2534025499 write_chroma_h,
25341- &pred_u,
25500+ Pred::dense(&pred_u),
2534225501 &vec![0i32; chroma_side * chroma_side], fctx,
2534325502 );
2534425503 push_mc_rect(2,
@@ -25347,7 +25506,7 @@ fn decode_inter_block(
2534725506 chroma_side,
2534825507 write_chroma_w,
2534925508 write_chroma_h,
25350- &pred_v,
25509+ Pred::dense(&pred_v),
2535125510 &vec![0i32; chroma_side * chroma_side], fctx,
2535225511 );
2535325512 }
@@ -25414,7 +25573,7 @@ fn decode_inter_block(
2541425573 tu_py,
2541525574 tx_px,
2541625575 base_q_idx,
25417- &tu_pred,
25576+ Pred::dense(&tu_pred),
2541825577 None,
2541925578 Some(tu_skip_ctx), fctx,
2542025579 )?
@@ -25442,7 +25601,7 @@ fn decode_inter_block(
2544225601 y,
2544325602 tu_px,
2544425603 tu_py,
25445- &pred_y[start..],
25604+ Pred::dense(&pred_y[start..]),
2544625605 None,
2544725606 Some(tu_skip_ctx), fctx,
2544825607 )?
@@ -25499,7 +25658,7 @@ fn decode_inter_block(
2549925658 cu_y,
2550025659 cu_tx,
2550125660 base_q_idx,
25502- &cu_pred,
25661+ Pred::dense(&cu_pred),
2550325662 Some(first_tx_type),
2550425663 Some(3), fctx,
2550525664 )?
@@ -25546,7 +25705,7 @@ fn decode_inter_block(
2554625705 y,
2554725706 px,
2554825707 py,
25549- &pred_y,
25708+ Pred::dense(&pred_y),
2555025709 None,
2555125710 None, fctx,
2555225711 )?;
@@ -25566,7 +25725,7 @@ fn decode_inter_block(
2556625725 py,
2556725726 side,
2556825727 base_q_idx,
25569- &pred_y,
25728+ Pred::dense(&pred_y),
2557025729 None,
2557125730 None, fctx,
2557225731 )?;
@@ -25605,7 +25764,7 @@ fn decode_inter_block(
2560525764 u,
2560625765 cpx,
2560725766 cpy,
25608- &pred_u,
25767+ Pred::dense(&pred_u),
2560925768 Some(luma_tx_type),
2561025769 None, fctx,
2561125770 )?
@@ -25627,7 +25786,7 @@ fn decode_inter_block(
2562725786 v,
2562825787 cpx,
2562925788 cpy,
25630- &pred_v,
25789+ Pred::dense(&pred_v),
2563125790 Some(luma_tx_type),
2563225791 None, fctx,
2563325792 )?
@@ -25650,7 +25809,7 @@ fn decode_inter_block(
2565025809 cpy,
2565125810 chroma_side,
2565225811 base_q_idx,
25653- &pred_u,
25812+ Pred::dense(&pred_u),
2565425813 Some(luma_tx_type),
2565525814 None, fctx,
2565625815 )?
@@ -25668,7 +25827,7 @@ fn decode_inter_block(
2566825827 cpy,
2566925828 chroma_side,
2567025829 base_q_idx,
25671- &pred_v,
25830+ Pred::dense(&pred_v),
2567225831 Some(luma_tx_type),
2567325832 None, fctx,
2567425833 )?
@@ -26962,7 +27121,7 @@ fn decode_inter_sub8_split4(
2696227121 // txsize_to_bsize[tx_size]` branch (`txb_skip_ctx = 0`, which
2696327122 // `read_inter_plane`'s `plane_idx == 0` arm already assumes).
2696427123 if skip {
26965- push_mc(0, px, py, B4, &pred_y, &vec![0i32; B4 * B4], fctx);
27124+ push_mc(0, px, py, B4, Pred::dense(&pred_y), &vec![0i32; B4 * B4], fctx);
2696627125 neighbours.record_mi_luma_rect(lmi, B4, B4, &vec![0i32; B4 * B4]);
2696727126 } else {
2696827127 let around = neighbours.around_mi(lmi, B4);
@@ -26983,7 +27142,7 @@ fn decode_inter_sub8_split4(
2698327142 py,
2698427143 B4,
2698527144 base_q_idx,
26986- &pred_y,
27145+ Pred::dense(&pred_y),
2698727146 None,
2698827147 None, fctx,
2698927148 )?;
@@ -27077,19 +27236,19 @@ fn decode_inter_sub8_split4(
2707727236 }
2707827237 }
2707927238 let (u_grid, v_grid) = if last_skip {
27080- push_mc(1, cpx, cpy, B4, &pred_u, &vec![0i32; B4 * B4], fctx);
27081- push_mc(2, cpx, cpy, B4, &pred_v, &vec![0i32; B4 * B4], fctx);
27239+ push_mc(1, cpx, cpy, B4, Pred::dense(&pred_u), &vec![0i32; B4 * B4], fctx);
27240+ push_mc(2, cpx, cpy, B4, Pred::dense(&pred_v), &vec![0i32; B4 * B4], fctx);
2708227241 (vec![0i32; B4 * B4], vec![0i32; B4 * B4])
2708327242 } else {
2708427243 let around = neighbours.around_mi(group_mi, 8);
2708527244 let ug = read_inter_plane(
2708627245 dec, cdfs, TxbSet::Chroma4, scan4, 1, around[1], 0, u, cpx, cpy, B4, base_q_idx,
27087- &pred_u, Some(first_tx_type), None, fctx,
27246+ Pred::dense(&pred_u), Some(first_tx_type), None, fctx,
2708827247 )?
2708927248 .0;
2709027249 let vg = read_inter_plane(
2709127250 dec, cdfs, TxbSet::Chroma4, scan4, 2, around[2], 0, v, cpx, cpy, B4, base_q_idx,
27092- &pred_v, Some(first_tx_type), None, fctx,
27251+ Pred::dense(&pred_v), Some(first_tx_type), None, fctx,
2709327252 )?
2709427253 .0;
2709527254 let coded = ug.iter().chain(vg.iter()).any(|&c| c != 0);
@@ -27935,7 +28094,7 @@ fn decode_inter_sub8_rect2(
2793528094 }
2793628095 }
2793728096 if skip {
27938- push_mc_rect(0, px, py, SIDE, bw, bh, &pred_y, &vec![0i32; SIDE * SIDE], fctx);
28097+ push_mc_rect(0, px, py, SIDE, bw, bh, Pred::dense(&pred_y), &vec![0i32; SIDE * SIDE], fctx);
2793928098 neighbours.record_mi_luma_rect(lmi, bw, bh, &vec![0i32; bw * bh]);
2794028099 neighbours.fill_lf_grid_rect(lmi, w_mi, h_mi, bw as u8, bh as u8, ref_frame.max(LAST_FRAME), fctx);
2794128100 } else {
@@ -27971,7 +28130,7 @@ fn decode_inter_sub8_rect2(
2797128130 tu_py,
2797228131 tw,
2797328132 base_q_idx,
27974- &tu_pred,
28133+ Pred::dense(&tu_pred),
2797528134 None,
2797628135 Some(tu_skip_ctx), fctx,
2797728136 )?
@@ -27996,7 +28155,7 @@ fn decode_inter_sub8_rect2(
2799628155 y,
2799728156 tu_px,
2799828157 tu_py,
27999- &pred_y[start..],
28158+ Pred::dense(&pred_y[start..]),
2800028159 None,
2800128160 None, fctx,
2800228161 )?
@@ -28101,19 +28260,19 @@ fn decode_inter_sub8_rect2(
2810128260 }
2810228261 }
2810328262 let (u_grid, v_grid) = if last_skip {
28104- push_mc(1, cpx, cpy, B4, &pred_u, &vec![0i32; B4 * B4], fctx);
28105- push_mc(2, cpx, cpy, B4, &pred_v, &vec![0i32; B4 * B4], fctx);
28263+ push_mc(1, cpx, cpy, B4, Pred::dense(&pred_u), &vec![0i32; B4 * B4], fctx);
28264+ push_mc(2, cpx, cpy, B4, Pred::dense(&pred_v), &vec![0i32; B4 * B4], fctx);
2810628265 (vec![0i32; B4 * B4], vec![0i32; B4 * B4])
2810728266 } else {
2810828267 let around = neighbours.around_mi(group_mi, 8);
2810928268 let ug = read_inter_plane(
2811028269 dec, cdfs, TxbSet::Chroma4, scan4, 1, around[1], 0, u, cpx, cpy, B4, base_q_idx,
28111- &pred_u, Some(first_tx_type), None, fctx,
28270+ Pred::dense(&pred_u), Some(first_tx_type), None, fctx,
2811228271 )?
2811328272 .0;
2811428273 let vg = read_inter_plane(
2811528274 dec, cdfs, TxbSet::Chroma4, scan4, 2, around[2], 0, v, cpx, cpy, B4, base_q_idx,
28116- &pred_v, Some(first_tx_type), None, fctx,
28275+ Pred::dense(&pred_v), Some(first_tx_type), None, fctx,
2811728276 )?
2811828277 .0;
2811928278 let coded = ug.iter().chain(vg.iter()).any(|&c| c != 0);
@@ -28938,19 +29097,19 @@ fn decode_inter_block8(
2893829097 .1
2893929098 .is_some();
2894029099 if skip {
28941- push_mc(0, px, py, SIDE, &pred_y, &vec![0i32; SIDE * SIDE], fctx);
29100+ push_mc(0, px, py, SIDE, Pred::dense(&pred_y), &vec![0i32; SIDE * SIDE], fctx);
2894229101 push_mc(1,
2894329102 cpx,
2894429103 cpy,
2894529104 CHROMA_SIDE,
28946- &pred_u,
29105+ Pred::dense(&pred_u),
2894729106 &vec![0i32; CHROMA_SIDE * CHROMA_SIDE], fctx,
2894829107 );
2894929108 push_mc(2,
2895029109 cpx,
2895129110 cpy,
2895229111 CHROMA_SIDE,
28953- &pred_v,
29112+ Pred::dense(&pred_v),
2895429113 &vec![0i32; CHROMA_SIDE * CHROMA_SIDE], fctx,
2895529114 );
2895629115 luma_grid = vec![0i32; SIDE * SIDE];
@@ -28966,7 +29125,7 @@ fn decode_inter_block8(
2896629125 y,
2896729126 px,
2896829127 py,
28969- &pred_y,
29128+ Pred::dense(&pred_y),
2897029129 mode_for_tx,
2897129130 base_q_idx,
2897229131 scan8,
@@ -28988,7 +29147,7 @@ fn decode_inter_block8(
2898829147 cpy,
2898929148 CHROMA_SIDE,
2899029149 base_q_idx,
28991- &pred_u,
29150+ Pred::dense(&pred_u),
2899229151 Some(luma_tx_type),
2899329152 None, fctx,
2899429153 )?
@@ -29006,7 +29165,7 @@ fn decode_inter_block8(
2900629165 cpy,
2900729166 CHROMA_SIDE,
2900829167 base_q_idx,
29009- &pred_v,
29168+ Pred::dense(&pred_v),
2901029169 Some(luma_tx_type),
2901129170 None, fctx,
2901229171 )?
@@ -29588,19 +29747,19 @@ fn decode_inter_block8(
2958829747 .1
2958929748 .is_some();
2959029749 if skip {
29591- push_mc(0, px, py, SIDE, &pred_y, &vec![0i32; SIDE * SIDE], fctx);
29750+ push_mc(0, px, py, SIDE, Pred::dense(&pred_y), &vec![0i32; SIDE * SIDE], fctx);
2959229751 push_mc(1,
2959329752 cpx,
2959429753 cpy,
2959529754 CHROMA_SIDE,
29596- &pred_u,
29755+ Pred::dense(&pred_u),
2959729756 &vec![0i32; CHROMA_SIDE * CHROMA_SIDE], fctx,
2959829757 );
2959929758 push_mc(2,
2960029759 cpx,
2960129760 cpy,
2960229761 CHROMA_SIDE,
29603- &pred_v,
29762+ Pred::dense(&pred_v),
2960429763 &vec![0i32; CHROMA_SIDE * CHROMA_SIDE], fctx,
2960529764 );
2960629765 luma_grid = vec![0i32; SIDE * SIDE];
@@ -29616,7 +29775,7 @@ fn decode_inter_block8(
2961629775 y,
2961729776 px,
2961829777 py,
29619- &pred_y,
29778+ Pred::dense(&pred_y),
2962029779 mode_for_tx,
2962129780 base_q_idx,
2962229781 scan8,
@@ -29638,7 +29797,7 @@ fn decode_inter_block8(
2963829797 cpy,
2963929798 CHROMA_SIDE,
2964029799 base_q_idx,
29641- &pred_u,
29800+ Pred::dense(&pred_u),
2964229801 Some(luma_tx_type),
2964329802 None, fctx,
2964429803 )?
@@ -29656,7 +29815,7 @@ fn decode_inter_block8(
2965629815 cpy,
2965729816 CHROMA_SIDE,
2965829817 base_q_idx,
29659- &pred_v,
29818+ Pred::dense(&pred_v),
2966029819 Some(luma_tx_type),
2966129820 None, fctx,
2966229821 )?