forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'lane-wave1' (4c9f7f81): inter prediction of both decode_inter_block arms deferred to the reconstruction worker as a closure op; interintra blend on the worker; byte-exact at recon 1, 4 and the composed setting; 11% faster at recon-only settings, neutral at the composed best

Browse files at this commit

33312b9cab212afa7dfc1f5e0f34d18e0fad71d7Ahmet Kaan GümüşParent: 11ef8ca3d6af60
crates/ec-av1/src/decode.rsmodified+377 -120
@@ -2112,7 +2112,121 @@ impl Residual {
2112 }2112 }
2113 }2113 }
2114 2114
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+ /// A window of the block prediction: its plane, its offset, and the
2166+ /// stride it is read at -- which is the block's, not necessarily the
2167+ /// op's (a transform unit's residual stays dense, so the worker takes
2168+ /// its window out of the block prediction itself).
2169+ Cur { plane: usize, off: usize, src: usize },
2170+}
2171+
2172+/// One block's whole-block prediction build, deferred to a recon worker.
2173+///
2174+/// The closure borrows the tile's reference pictures and its own frame-level
2175+/// tables; [`WaveGuard`] joins every worker before the tile decoder returns,
2176+/// so those borrows outlive it -- the [`ReconPlanes`] trade-off, stated once
2177+/// here for the closure's `'static`/`Send` laundering in [`push_pred`].
2178+pub(crate) struct PredBuild(
2179+ Box<
2180+ dyn FnOnce(
2181+ &mut PlaneBuf<'static>,
2182+ &mut PlaneBuf<'static>,
2183+ &mut PlaneBuf<'static>,
2184+ &crate::decode::FrameCtx,
2185+ ) -> [Vec<u16>; 3],
2186+ >,
2187+);
2188+
2189+// SAFETY: see [`PredBuild`] -- the captured borrows are read-only reference
2190+// pictures and frame tables, and the closure runs on exactly one worker.
2191+#[allow(unsafe_code)]
2192+unsafe impl Send for PredBuild {}
2193+
2194+/// `true` when this tile's writes are recorded for the wavefront instead of
2195+/// performed at the push site, i.e. when a prediction may be deferred.
2196+fn recon_deferred(fctx: &crate::decode::FrameCtx) -> bool {
2197+ fctx.recon_planes.with(std::cell::Cell::get).is_none()
2198+}
2199+
2200+/// Records one block's prediction build for the worker that reconstructs it.
2201+#[allow(unsafe_code)]
2202+fn push_pred<'a>(
2203+ fctx: &crate::decode::FrameCtx,
2204+ f: impl FnOnce(
2205+ &mut PlaneBuf<'static>,
2206+ &mut PlaneBuf<'static>,
2207+ &mut PlaneBuf<'static>,
2208+ &crate::decode::FrameCtx,
2209+ ) -> [Vec<u16>; 3]
2210+ + 'a,
2211+) {
2212+ type Built = [Vec<u16>; 3];
2213+ type Dyn<'x> = dyn FnOnce(
2214+ &mut PlaneBuf<'static>,
2215+ &mut PlaneBuf<'static>,
2216+ &mut PlaneBuf<'static>,
2217+ &crate::decode::FrameCtx,
2218+ ) -> Built
2219+ + 'x;
2220+ let boxed: Box<Dyn<'a>> = Box::new(f);
2221+ // SAFETY: see [`PredBuild`] -- every worker is joined by [`WaveGuard`]
2222+ // before the borrows the closure holds go out of scope.
2223+ let boxed: Box<Dyn<'static>> = unsafe { std::mem::transmute(boxed) };
2224+ push_op(fctx, ReconOp::Pred(PredBuild(boxed)));
2225+}
2226+
2115 pub(crate) enum ReconOp {2227 pub(crate) enum ReconOp {
2228+ /// lane-wave4: build this block's prediction into the worker's slot.
2229+ Pred(PredBuild),
2116 Intra {2230 Intra {
2117 plane: usize,2231 plane: usize,
2118 x: usize,2232 x: usize,
@@ -2141,7 +2255,7 @@ pub(crate) enum ReconOp {
2141 stride: usize,2255 stride: usize,
2142 w: usize,2256 w: usize,
2143 h: usize,2257 h: usize,
2144- prediction: Vec<u16>,2258+ prediction: PredSrc,
2145 residual: Residual,2259 residual: Residual,
2146 },2260 },
2147 }2261 }
@@ -2222,7 +2336,7 @@ fn push_op(fctx: &crate::decode::FrameCtx, op: ReconOp) {
2222 if let Some(ReconPlanes(y, u, v)) = fctx.recon_planes.with(std::cell::Cell::get) {2336 if let Some(ReconPlanes(y, u, v)) = fctx.recon_planes.with(std::cell::Cell::get) {
2223 // SAFETY: see [`ReconPlanes`] -- one thread, and the write is the one2337 // SAFETY: see [`ReconPlanes`] -- one thread, and the write is the one
2224 // the parse site would have performed itself before lane-wave1.2338 // the parse site would have performed itself before lane-wave1.
2225- unsafe { exec_op(op, &mut *y, &mut *u, &mut *v, fctx) };2339+ unsafe { exec_op(op, &mut *y, &mut *u, &mut *v, &mut Default::default(), fctx) };
2226 return;2340 return;
2227 }2341 }
2228 fctx.recon_ops.with(|c| c.borrow_mut().push(op));2342 fctx.recon_ops.with(|c| c.borrow_mut().push(op));
@@ -2295,9 +2409,10 @@ fn wave_worker(st: &WaveState) {
2295 // SAFETY: this job writes only superblock (r, c)'s own pixels, and2409 // SAFETY: this job writes only superblock (r, c)'s own pixels, and
2296 // every superblock that could have written or be reading them is2410 // every superblock that could have written or be reading them is
2297 // complete by the wavefront rule above.2411 // complete by the wavefront rule above.
2412+ let mut cur: [Vec<u16>; 3] = Default::default();
2298 unsafe {2413 unsafe {
2299 for op in ops {2414 for op in ops {
2300- exec_op(op, &mut *y, &mut *u, &mut *v, &fctx);2415+ exec_op(op, &mut *y, &mut *u, &mut *v, &mut cur, &fctx);
2301 }2416 }
2302 }2417 }
2303 let mut q = st.q.lock().unwrap();2418 let mut q = st.q.lock().unwrap();
@@ -2520,14 +2635,26 @@ fn push_mc_rect_owned(
2520 stride: usize,2635 stride: usize,
2521 w: usize,2636 w: usize,
2522 h: usize,2637 h: usize,
2523- prediction: &[u16],2638+ prediction: Pred<'_>,
2524 residual: Vec<i32>, fctx: &crate::decode::FrameCtx,2639 residual: Vec<i32>, fctx: &crate::decode::FrameCtx,
2525 ) {2640 ) {
2526- if inline_mc(plane, x, y, stride, w, h, prediction, &residual, fctx) {2641+ let (src, stride) = match prediction.inline(stride) {
2642+ Some(v) => v,
2643+ None => {
2644+ let Pred::Cur { plane: sp, stride: ss, off } = prediction else { unreachable!() };
2645+ push_op(fctx, ReconOp::Mc {
2646+ plane, x, y, stride: ss, w, h,
2647+ prediction: PredSrc::Cur { plane: sp, off, src: ss },
2648+ residual: Residual::Done(residual),
2649+ });
2650+ return;
2651+ }
2652+ };
2653+ if inline_mc(plane, x, y, stride, w, h, src, &residual, fctx) {
2527 return;2654 return;
2528 }2655 }
2529 push_op(fctx, ReconOp::Mc {2656 push_op(fctx, ReconOp::Mc {
2530- plane, x, y, stride, w, h, prediction: prediction.to_vec(),2657+ plane, x, y, stride, w, h, prediction: PredSrc::Owned(src.to_vec()),
2531 residual: Residual::Done(residual),2658 residual: Residual::Done(residual),
2532 });2659 });
2533 }2660 }
@@ -2567,7 +2694,7 @@ fn push_mc(
2567 x: usize,2694 x: usize,
2568 y: usize,2695 y: usize,
2569 side: usize,2696 side: usize,
2570- prediction: &[u16],2697+ prediction: Pred<'_>,
2571 residual: &[i32], fctx: &crate::decode::FrameCtx,2698 residual: &[i32], fctx: &crate::decode::FrameCtx,
2572 ) {2699 ) {
2573 push_mc_rect(plane, x, y, side, side, side, prediction, residual, fctx);2700 push_mc_rect(plane, x, y, side, side, side, prediction, residual, fctx);
@@ -2582,15 +2709,27 @@ fn push_mc_rect(
2582 stride: usize,2709 stride: usize,
2583 w: usize,2710 w: usize,
2584 h: usize,2711 h: usize,
2585- prediction: &[u16],2712+ prediction: Pred<'_>,
2586 residual: &[i32], fctx: &crate::decode::FrameCtx,2713 residual: &[i32], fctx: &crate::decode::FrameCtx,
2587 ) {2714 ) {
2588- if inline_mc(plane, x, y, stride, w, h, prediction, residual, fctx) {2715+ let (src, stride) = match prediction.inline(stride) {
2716+ Some(v) => v,
2717+ None => {
2718+ let Pred::Cur { plane: sp, stride: ss, off } = prediction else { unreachable!() };
2719+ push_op(fctx, ReconOp::Mc {
2720+ plane, x, y, stride: ss, w, h,
2721+ prediction: PredSrc::Cur { plane: sp, off, src: ss },
2722+ residual: Residual::Done(residual.to_vec()),
2723+ });
2724+ return;
2725+ }
2726+ };
2727+ if inline_mc(plane, x, y, stride, w, h, src, residual, fctx) {
2589 return;2728 return;
2590 }2729 }
2591 push_op(fctx, ReconOp::Mc {2730 push_op(fctx, ReconOp::Mc {
2592 plane, x, y, stride, w, h,2731 plane, x, y, stride, w, h,
2593- prediction: prediction.to_vec(), residual: Residual::Done(residual.to_vec()),2732+ prediction: PredSrc::Owned(src.to_vec()), residual: Residual::Done(residual.to_vec()),
2594 });2733 });
2595 }2734 }
2596 2735
@@ -2638,13 +2777,49 @@ fn push_mc_rect_tx(
2638 stride: usize,2777 stride: usize,
2639 w: usize,2778 w: usize,
2640 h: usize,2779 h: usize,
2641- prediction: &[u16],2780+ prediction: Pred<'_>,
2642 tx: TxParams,2781 tx: TxParams,
2643 grid: &[i32],2782 grid: &[i32],
2644 fctx: &crate::decode::FrameCtx,2783 fctx: &crate::decode::FrameCtx,
2645 ) {2784 ) {
2785+ // lane-wave4: a deferred prediction is not there to be windowed -- the
2786+ // op carries its offset into the block's prediction instead, and the
2787+ // residual is laid out at that same stride (`reconstruct_mc_rect` reads
2788+ // both buffers at one stride).
2789+ let (prediction, stride) = match prediction.inline(stride) {
2790+ Some(v) => v,
2791+ None => {
2792+ let Pred::Cur { plane: sp, stride: ss, off } = prediction else { unreachable!() };
2793+ let mut tx = tx;
2794+ tx.stride = 0;
2795+ push_op(fctx, ReconOp::Mc {
2796+ plane, x, y, stride: w, w, h,
2797+ prediction: PredSrc::Cur { plane: sp, off, src: ss },
2798+ residual: Residual::Coeffs(tx, grid.to_vec()),
2799+ });
2800+ return;
2801+ }
2802+ };
2646 if fctx.recon_planes.with(std::cell::Cell::get).is_some() {2803 if fctx.recon_planes.with(std::cell::Cell::get).is_some() {
2647- inline_mc(plane, x, y, stride, w, h, prediction, &tx.run(grid), fctx);2804+ // `reconstruct_mc_rect` reads the prediction and the residual at ONE
2805+ // stride, so a prediction handed over at the block's stride (a var-tx
2806+ // unit's window, lane-wave4) has to be densified for a dense residual
2807+ // -- which is exactly what the recorded path below does.
2808+ let residual = tx.run(grid);
2809+ let res_stride = if tx.stride == 0 { w } else { tx.stride };
2810+ let window;
2811+ let prediction = if stride == res_stride {
2812+ prediction
2813+ } else {
2814+ debug_assert_eq!(res_stride, w);
2815+ let mut win = Vec::with_capacity(w * h);
2816+ for row in 0..h {
2817+ win.extend_from_slice(&prediction[row * stride..][..w]);
2818+ }
2819+ window = win;
2820+ &window[..]
2821+ };
2822+ inline_mc(plane, x, y, res_stride, w, h, prediction, &residual, fctx);
2648 return;2823 return;
2649 }2824 }
2650 // `reconstruct_mc_rect` reads exactly rows `0..h`, columns `0..w` of the2825 // `reconstruct_mc_rect` reads exactly rows `0..h`, columns `0..w` of the
@@ -2660,7 +2835,7 @@ fn push_mc_rect_tx(
2660 let mut tx = tx;2835 let mut tx = tx;
2661 tx.stride = 0;2836 tx.stride = 0;
2662 push_op(fctx, ReconOp::Mc {2837 push_op(fctx, ReconOp::Mc {
2663- plane, x, y, stride: w, w, h, prediction: window,2838+ plane, x, y, stride: w, w, h, prediction: PredSrc::Owned(window),
2664 residual: Residual::Coeffs(tx, grid.to_vec()),2839 residual: Residual::Coeffs(tx, grid.to_vec()),
2665 });2840 });
2666 }2841 }
@@ -2684,8 +2859,9 @@ fn flush_recon(
2684 wave_barrier(fctx);2859 wave_barrier(fctx);
2685 let mut ops = fctx.recon_spare.with(|c| std::mem::take(&mut *c.borrow_mut()));2860 let mut ops = fctx.recon_spare.with(|c| std::mem::take(&mut *c.borrow_mut()));
2686 fctx.recon_ops.with(|c| std::mem::swap(&mut *c.borrow_mut(), &mut ops));2861 fctx.recon_ops.with(|c| std::mem::swap(&mut *c.borrow_mut(), &mut ops));
2862+ let mut cur: [Vec<u16>; 3] = Default::default();
2687 for op in ops.drain(..) {2863 for op in ops.drain(..) {
2688- exec_op(op, y, u, v, fctx);2864+ exec_op(op, y, u, v, &mut cur, fctx);
2689 }2865 }
2690 fctx.recon_spare.with(|c| *c.borrow_mut() = ops);2866 fctx.recon_spare.with(|c| *c.borrow_mut() = ops);
2691 }2867 }
@@ -2697,9 +2873,11 @@ fn exec_op(
2697 y: &mut PlaneBuf<'static>,2873 y: &mut PlaneBuf<'static>,
2698 u: &mut PlaneBuf<'static>,2874 u: &mut PlaneBuf<'static>,
2699 v: &mut PlaneBuf<'static>,2875 v: &mut PlaneBuf<'static>,
2876+ cur: &mut [Vec<u16>; 3],
2700 fctx: &crate::decode::FrameCtx,2877 fctx: &crate::decode::FrameCtx,
2701 ) {2878 ) {
2702 match op {2879 match op {
2880+ ReconOp::Pred(b) => *cur = (b.0)(y, u, v, fctx),
2703 ReconOp::Intra {2881 ReconOp::Intra {
2704 plane, x, y: oy, bw, bh, rect, mode, angle_delta, reach, residual, cfl,2882 plane, x, y: oy, bw, bh, rect, mode, angle_delta, reach, residual, cfl,
2705 filter_intra, smooth_neighbor, pred,2883 filter_intra, smooth_neighbor, pred,
@@ -2708,7 +2886,28 @@ fn exec_op(
2708 cfl, filter_intra, smooth_neighbor, pred, fctx,2886 cfl, filter_intra, smooth_neighbor, pred, fctx,
2709 ),2887 ),
2710 ReconOp::Mc { plane, x, y: oy, stride, w, h, prediction, residual } => {2888 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);2889+ let residual = residual.resolve();
2890+ match prediction {
2891+ PredSrc::Owned(p) => {
2892+ exec_mc(y, u, v, plane, x, oy, stride, w, h, &p, &residual, fctx);
2893+ }
2894+ PredSrc::Cur { plane: sp, off, src } => {
2895+ let block = std::mem::take(&mut cur[sp]);
2896+ if src == stride {
2897+ exec_mc(y, u, v, plane, x, oy, stride, w, h, &block[off..], &residual, fctx);
2898+ } else {
2899+ // A transform unit's residual is dense, so its window
2900+ // of the block prediction is taken out dense too --
2901+ // the copy the parsing thread used to make, made here.
2902+ let mut window = Vec::with_capacity(w * h);
2903+ for row in 0..h {
2904+ window.extend_from_slice(&block[off + row * src..][..w]);
2905+ }
2906+ exec_mc(y, u, v, plane, x, oy, stride, w, h, &window, &residual, fctx);
2907+ }
2908+ cur[sp] = block;
2909+ }
2910+ }
2712 }2911 }
2713 }2912 }
2714 }2913 }
@@ -16941,7 +17140,7 @@ fn read_inter_plane_rect(
16941 _plane: &mut PlaneBuf<'static>,17140 _plane: &mut PlaneBuf<'static>,
16942 x: usize,17141 x: usize,
16943 y: usize,17142 y: usize,
16944- prediction: &[u16],17143+ prediction: Pred<'_>,
16945 inherited_luma_tx_type: Option<TxType>,17144 inherited_luma_tx_type: Option<TxType>,
16946 luma_skip_ctx: Option<usize>, fctx: &crate::decode::FrameCtx,17145 luma_skip_ctx: Option<usize>, fctx: &crate::decode::FrameCtx,
16947 ) -> Result<(Vec<i32>, TxType)> {17146 ) -> Result<(Vec<i32>, TxType)> {
@@ -17052,7 +17251,7 @@ fn read_inter_luma8(
17052 y: &mut PlaneBuf<'static>,17251 y: &mut PlaneBuf<'static>,
17053 px: usize,17252 px: usize,
17054 py: usize,17253 py: usize,
17055- pred_y: &[u16],17254+ pred_y: Pred<'_>,
17056 mode_for_tx: usize,17255 mode_for_tx: usize,
17057 base_q_idx: u8,17256 base_q_idx: u8,
17058 scan8: &[u16],17257 scan8: &[u16],
@@ -17087,11 +17286,7 @@ fn read_inter_luma8(
17087 for tu_row in 0..2 {17286 for tu_row in 0..2 {
17088 for tu_col in 0..2 {17287 for tu_col in 0..2 {
17089 let tu_mi = (leaf_mi.0 + tu_row, leaf_mi.1 + tu_col);17288 let tu_mi = (leaf_mi.0 + tu_row, leaf_mi.1 + tu_col);
17090- let mut tu_pred = Vec::with_capacity(16);17289+ let tu_pred = pred_y.view(8).offset(tu_row * 4 * 8 + tu_col * 4);
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- }
17095 let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, 1);17290 let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, 1);
17096 let (tu_grid, tu_tx_type) = read_inter_plane(17291 let (tu_grid, tu_tx_type) = read_inter_plane(
17097 dec,17292 dec,
@@ -17110,7 +17305,7 @@ fn read_inter_luma8(
17110 py + tu_row * 4,17305 py + tu_row * 4,
17111 4,17306 4,
17112 base_q_idx,17307 base_q_idx,
17113- &tu_pred,17308+ tu_pred,
17114 None,17309 None,
17115 Some(tu_skip_ctx), fctx,17310 Some(tu_skip_ctx), fctx,
17116 )?;17311 )?;
@@ -21525,7 +21720,7 @@ fn read_inter_plane(
21525 y: usize,21720 y: usize,
21526 side: usize,21721 side: usize,
21527 _base_q_idx: u8,21722 _base_q_idx: u8,
21528- prediction: &[u16],21723+ prediction: Pred<'_>,
21529 // lane-chromau: this block's own luma transform's *actual coded*21724 // lane-chromau: this block's own luma transform's *actual coded*
21530 // `tx_type` -- `av1_get_tx_type` (libaom `blockd.h`): an inter block's21725 // `tx_type` -- `av1_get_tx_type` (libaom `blockd.h`): an inter block's
21531 // chroma plane never codes its own `tx_type` symbol, but (unlike an21726 // chroma plane never codes its own `tx_type` symbol, but (unlike an
@@ -23860,6 +24055,18 @@ fn decode_inter_block(
23860 MIXED_SCALE_COMPOUND_HITS.with(|c| c.set(c.get() + 1));24055 MIXED_SCALE_COMPOUND_HITS.with(|c| c.set(c.get() + 1));
23861 }24056 }
23862 24057
24058+ // lane-wave4 (the compound arm's half): this block's whole
24059+ // prediction -- both references, the wedge/diffwtd/distance
24060+ // blend, every plane -- as a closure, run here at one
24061+ // reconstruction thread and on the wavefront worker otherwise
24062+ // (see the single-reference arm below). A compound block reads
24063+ // neither `motion_mode` nor `interintra`, so nothing but the
24064+ // blend itself lives in here.
24065+ let build = move |_y: &mut PlaneBuf<'static>,
24066+ _u: &mut PlaneBuf<'static>,
24067+ _v: &mut PlaneBuf<'static>,
24068+ fctx: &crate::decode::FrameCtx|
24069+ -> [Vec<u16>; 3] {
23863 let mut inter0_y = vec![0i32; side * side];24070 let mut inter0_y = vec![0i32; side * side];
23864 mc::predict_compound_intermediate_kern(24071 mc::predict_compound_intermediate_kern(
23865 &py0.data,24072 &py0.data,
@@ -24086,6 +24293,26 @@ fn decode_inter_block(
24086 24293
24087 // lane-inter4 r2: a rectangular strip's transform tree starts from24294 // lane-inter4 r2: a rectangular strip's transform tree starts from
24088 // its own rect `max_txsize_rect_lookup` entry, not a square one.24295 // its own rect `max_txsize_rect_lookup` entry, not a square one.
24296+ [pred_y, pred_u, pred_v]
24297+ };
24298+ let (pred_y, pred_u, pred_v): (Vec<u16>, Vec<u16>, Vec<u16>);
24299+ let (sy, su, sv) = if recon_deferred(fctx) {
24300+ push_pred(fctx, build);
24301+ (
24302+ Pred::Cur { plane: 0, stride: side, off: 0 },
24303+ Pred::Cur { plane: 1, stride: chroma_side, off: 0 },
24304+ Pred::Cur { plane: 2, stride: chroma_side, off: 0 },
24305+ )
24306+ } else {
24307+ let [by, bu, bv] = build(y, u, v, fctx);
24308+ (pred_y, pred_u, pred_v) = (by, bu, bv);
24309+ (
24310+ Pred::Inline(&pred_y, side),
24311+ Pred::Inline(&pred_u, chroma_side),
24312+ Pred::Inline(&pred_v, chroma_side),
24313+ )
24314+ };
24315+
24089 let rect_tu = (write_w, write_h) != (side, side);24316 let rect_tu = (write_w, write_h) != (side, side);
24090 vartx_leaves = if rect_tu {24317 vartx_leaves = if rect_tu {
24091 read_block_tx_size_rect(24318 read_block_tx_size_rect(
@@ -24117,7 +24344,7 @@ fn decode_inter_block(
24117 side,24344 side,
24118 write_w,24345 write_w,
24119 write_h,24346 write_h,
24120- &pred_y,24347+ sy,
24121 &vec![0i32; side * side], fctx,24348 &vec![0i32; side * side], fctx,
24122 );24349 );
24123 push_mc_rect(1, 24350 push_mc_rect(1,
@@ -24126,7 +24353,7 @@ fn decode_inter_block(
24126 chroma_side,24353 chroma_side,
24127 write_chroma_w,24354 write_chroma_w,
24128 write_chroma_h,24355 write_chroma_h,
24129- &pred_u,24356+ su,
24130 &vec![0i32; chroma_side * chroma_side], fctx,24357 &vec![0i32; chroma_side * chroma_side], fctx,
24131 );24358 );
24132 push_mc_rect(2, 24359 push_mc_rect(2,
@@ -24135,7 +24362,7 @@ fn decode_inter_block(
24135 chroma_side,24362 chroma_side,
24136 write_chroma_w,24363 write_chroma_w,
24137 write_chroma_h,24364 write_chroma_h,
24138- &pred_v,24365+ sv,
24139 &vec![0i32; chroma_side * chroma_side], fctx,24366 &vec![0i32; chroma_side * chroma_side], fctx,
24140 );24367 );
24141 luma_grid = vec![0i32; side * side];24368 luma_grid = vec![0i32; side * side];
@@ -24169,11 +24396,7 @@ fn decode_inter_block(
24169 let (tu_px, tu_py) = (px + col * MI, py + row * MI);24396 let (tu_px, tu_py) = (px + col * MI, py + row * MI);
24170 let (tu_grid, tu_tx_type) = if tw == th {24397 let (tu_grid, tu_tx_type) = if tw == th {
24171 let tx_px = tw;24398 let tx_px = tw;
24172- let mut tu_pred = Vec::with_capacity(tx_px * tx_px);24399+ let tu_pred = sy.offset(row * MI * side + col * MI);
24173- for rr in 0..tx_px {
24174- let start = (row * MI + rr) * side + col * MI;
24175- tu_pred.extend_from_slice(&pred_y[start..start + tx_px]);
24176- }
24177 let scan = default_scan(tx_px.min(32));24400 let scan = default_scan(tx_px.min(32));
24178 let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tx_px / MI);24401 let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tx_px / MI);
24179 read_inter_plane(24402 read_inter_plane(
@@ -24189,7 +24412,7 @@ fn decode_inter_block(
24189 tu_py,24412 tu_py,
24190 tx_px,24413 tx_px,
24191 base_q_idx,24414 base_q_idx,
24192- &tu_pred,24415+ tu_pred,
24193 None,24416 None,
24194 Some(tu_skip_ctx), fctx,24417 Some(tu_skip_ctx), fctx,
24195 )?24418 )?
@@ -24217,7 +24440,7 @@ fn decode_inter_block(
24217 y,24440 y,
24218 tu_px,24441 tu_px,
24219 tu_py,24442 tu_py,
24220- &pred_y[start..],24443+ sy.offset(start),
24221 None,24444 None,
24222 Some(tu_skip_ctx), fctx,24445 Some(tu_skip_ctx), fctx,
24223 )?24446 )?
@@ -24251,16 +24474,12 @@ fn decode_inter_block(
24251 let cu_scan = default_scan(cu_tx);24474 let cu_scan = default_scan(cu_tx);
24252 for plane_idx in 1..3 {24475 for plane_idx in 1..3 {
24253 let (src, buf) = if plane_idx == 1 {24476 let (src, buf) = if plane_idx == 1 {
24254- (&pred_u, &mut *u)24477+ (su, &mut *u)
24255 } else {24478 } else {
24256- (&pred_v, &mut *v)24479+ (sv, &mut *v)
24257 };24480 };
24258- let mut cu_pred = Vec::with_capacity(cu_tx * cu_tx);24481+ let cu_pred =
24259- for rr in 0..cu_tx {24482+ src.offset(cr * cu_tx * chroma_side + cc * cu_tx);
24260- let start =
24261- (cr * cu_tx + rr) * chroma_side + cc * cu_tx;
24262- cu_pred.extend_from_slice(&src[start..start + cu_tx]);
24263- }
24264 let cu_grid = read_inter_plane(24483 let cu_grid = read_inter_plane(
24265 dec,24484 dec,
24266 cdfs,24485 cdfs,
@@ -24274,7 +24493,7 @@ fn decode_inter_block(
24274 cu_y,24493 cu_y,
24275 cu_tx,24494 cu_tx,
24276 base_q_idx,24495 base_q_idx,
24277- &cu_pred,24496+ cu_pred,
24278 Some(first_tx_type),24497 Some(first_tx_type),
24279 Some(3), fctx,24498 Some(3), fctx,
24280 )?24499 )?
@@ -24321,7 +24540,7 @@ fn decode_inter_block(
24321 y,24540 y,
24322 px,24541 px,
24323 py,24542 py,
24324- &pred_y,24543+ sy,
24325 None,24544 None,
24326 None, fctx,24545 None, fctx,
24327 )?;24546 )?;
@@ -24341,7 +24560,7 @@ fn decode_inter_block(
24341 py,24560 py,
24342 side,24561 side,
24343 base_q_idx,24562 base_q_idx,
24344- &pred_y,24563+ sy,
24345 None,24564 None,
24346 None, fctx,24565 None, fctx,
24347 )?;24566 )?;
@@ -24371,7 +24590,7 @@ fn decode_inter_block(
24371 u,24590 u,
24372 cpx,24591 cpx,
24373 cpy,24592 cpy,
24374- &pred_u,24593+ su,
24375 Some(luma_tx_type),24594 Some(luma_tx_type),
24376 None, fctx,24595 None, fctx,
24377 )?24596 )?
@@ -24393,7 +24612,7 @@ fn decode_inter_block(
24393 v,24612 v,
24394 cpx,24613 cpx,
24395 cpy,24614 cpy,
24396- &pred_v,24615+ sv,
24397 Some(luma_tx_type),24616 Some(luma_tx_type),
24398 None, fctx,24617 None, fctx,
24399 )?24618 )?
@@ -24416,7 +24635,7 @@ fn decode_inter_block(
24416 cpy,24635 cpy,
24417 chroma_side,24636 chroma_side,
24418 base_q_idx,24637 base_q_idx,
24419- &pred_u,24638+ su,
24420 Some(luma_tx_type),24639 Some(luma_tx_type),
24421 None, fctx,24640 None, fctx,
24422 )?24641 )?
@@ -24434,7 +24653,7 @@ fn decode_inter_block(
24434 cpy,24653 cpy,
24435 chroma_side,24654 chroma_side,
24436 base_q_idx,24655 base_q_idx,
24437- &pred_v,24656+ sv,
24438 Some(luma_tx_type),24657 Some(luma_tx_type),
24439 None, fctx,24658 None, fctx,
24440 )?24659 )?
@@ -25057,6 +25276,21 @@ fn decode_inter_block(
25057 // (reconinter_template.inc:75-82); record them for the next 1:425276 // (reconinter_template.inc:75-82); record them for the next 1:4
25058 // strip, which is the only reader.25277 // strip, which is the only reader.
25059 fctx.inter_last_mc.with(|c| c.set(Some((ref_frame, mv, h_filter, v_filter))));25278 fctx.inter_last_mc.with(|c| c.set(Some((ref_frame, mv, h_filter, v_filter))));
25279+ let sub8_piece =
25280+ strip_chroma.filter(|s| s.has_chroma).and_then(|s| s.prev).is_some();
25281+ // lane-wave4: the whole-block prediction (motion compensation +
25282+ // warp + the interintra blend) as a closure, so it runs where the
25283+ // writes it feeds run. At one reconstruction thread that is right
25284+ // here on the parsing thread, exactly as before; on the wavefront
25285+ // it travels with the block's recorded ops and runs on the worker
25286+ // ([`push_pred`]), which is what takes mc off the parse thread.
25287+ // OBMC and the sub-8x8 chroma piece stay here: both can fail, and
25288+ // a recorded op has no way to report it.
25289+ let build = move |y: &mut PlaneBuf<'static>,
25290+ u: &mut PlaneBuf<'static>,
25291+ v: &mut PlaneBuf<'static>,
25292+ fctx: &crate::decode::FrameCtx|
25293+ -> [Vec<u16>; 3] {
25060 let mut pred_y = vec![0u16; side * side];25294 let mut pred_y = vec![0u16; side * side];
25061 let mut pred_u = vec![0u16; chroma_side * chroma_side];25295 let mut pred_u = vec![0u16; chroma_side * chroma_side];
25062 let mut pred_v = vec![0u16; chroma_side * chroma_side];25296 let mut pred_v = vec![0u16; chroma_side * chroma_side];
@@ -25198,7 +25432,51 @@ fn decode_inter_block(
25198 );25432 );
25199 }25433 }
25200 }25434 }
25201-25435+ // Mutually exclusive with warp/OBMC (motion_mode is not read for
25436+ // an interintra block): blend the intra predictor over the MC
25437+ // result, all planes (reconinter.c av1_build_interintra_predictor
25438+ // plane loop).
25439+ if let Some(ii) = interintra_mode {
25440+ if write_w != write_h {
25441+ INTERINTRA_RECT_HITS.with(|c| c.set(c.get() + 1));
25442+ }
25443+ interintra_blend(y, px, py, write_w, write_h, side, ii, wedge_mask, &mut pred_y, fctx);
25444+ interintra_blend(
25445+ u, cpx, cpy, write_chroma_w, write_chroma_h, chroma_side, ii, wedge_mask,
25446+ &mut pred_u, fctx,
25447+ );
25448+ interintra_blend(
25449+ v, cpx, cpy, write_chroma_w, write_chroma_h, chroma_side, ii, wedge_mask,
25450+ &mut pred_v, fctx,
25451+ );
25452+ }
25453+ [pred_y, pred_u, pred_v]
25454+ };
25455+ // OBMC and interintra are mutually exclusive (`motion_mode` is
25456+ // never read for an interintra block), so blending interintra
25457+ // inside `build` and OBMC after it is still the coded order.
25458+ debug_assert!(!(obmc_selected && interintra_mode.is_some()));
25459+ let deferred = recon_deferred(fctx) && !obmc_selected && !sub8_piece;
25460+ let (mut pred_y, mut pred_u, mut pred_v): (Vec<u16>, Vec<u16>, Vec<u16>);
25461+ let (sy, su, sv) = if deferred {
25462+ // The interintra predictor inside `build` reads this block's
25463+ // own above/left edges: by the wavefront rule ((r-1, c+1) and
25464+ // (r, c-1) complete) and this superblock's own ops replaying
25465+ // in push order ahead of it, they are written by the time the
25466+ // worker runs it -- which retires the `flush_recon` barrier
25467+ // this arm used to take for interintra.
25468+ push_pred(fctx, build);
25469+ (
25470+ Pred::Cur { plane: 0, stride: side, off: 0 },
25471+ Pred::Cur { plane: 1, stride: chroma_side, off: 0 },
25472+ Pred::Cur { plane: 2, stride: chroma_side, off: 0 },
25473+ )
25474+ } else {
25475+ if interintra_mode.is_some() {
25476+ flush_recon(fctx, y, u, v);
25477+ }
25478+ let [by, bu, bv] = build(y, u, v, fctx);
25479+ (pred_y, pred_u, pred_v) = (by, bu, bv);
25202 if obmc_selected {25480 if obmc_selected {
25203 obmc_blend(25481 obmc_blend(
25204 grid,25482 grid,
@@ -25229,26 +25507,6 @@ fn decode_inter_block(
25229 )?;25507 )?;
25230 }25508 }
25231 25509
25232- // Mutually exclusive with warp/OBMC (motion_mode is not read for
25233- // an interintra block): blend the intra predictor over the MC
25234- // result, all planes (reconinter.c av1_build_interintra_predictor
25235- // plane loop).
25236- if let Some(ii) = interintra_mode {
25237- flush_recon(fctx, y, u, v);
25238- if write_w != write_h {
25239- INTERINTRA_RECT_HITS.with(|c| c.set(c.get() + 1));
25240- }
25241- interintra_blend(y, px, py, write_w, write_h, side, ii, wedge_mask, &mut pred_y, fctx);
25242- interintra_blend(
25243- u, cpx, cpy, write_chroma_w, write_chroma_h, chroma_side, ii, wedge_mask,
25244- &mut pred_u, fctx,
25245- );
25246- interintra_blend(
25247- v, cpx, cpy, write_chroma_w, write_chroma_h, chroma_side, ii, wedge_mask,
25248- &mut pred_v, fctx,
25249- );
25250- }
25251-
25252 // lane-inter16ab r2: libaom `build_inter_predictors_sub8x8`25510 // lane-inter16ab r2: libaom `build_inter_predictors_sub8x8`
25253 // (reconinter_template.inc:87-160). A 4:2:0 chroma block under a25511 // (reconinter_template.inc:87-160). A 4:2:0 chroma block under a
25254 // 16x4 (4x16) luma pair covers TWO luma blocks, so it is built in25512 // 16x4 (4x16) luma pair covers TWO luma blocks, so it is built in
@@ -25294,6 +25552,13 @@ fn decode_inter_block(
25294 }25552 }
25295 INTER16_SUB8_PIECE_HITS.with(|c| c.set(c.get() + 1));25553 INTER16_SUB8_PIECE_HITS.with(|c| c.set(c.get() + 1));
25296 }25554 }
25555+ (
25556+ Pred::Inline(&pred_y, side),
25557+ Pred::Inline(&pred_u, chroma_side),
25558+ Pred::Inline(&pred_v, chroma_side),
25559+ )
25560+ };
25561+
25297 25562
25298 // lane-inter4 r2: a rectangular strip's transform tree starts from25563 // lane-inter4 r2: a rectangular strip's transform tree starts from
25299 // its own rect `max_txsize_rect_lookup` entry, not a square one.25564 // its own rect `max_txsize_rect_lookup` entry, not a square one.
@@ -25328,7 +25593,7 @@ fn decode_inter_block(
25328 side,25593 side,
25329 write_w,25594 write_w,
25330 write_h,25595 write_h,
25331- &pred_y,25596+ sy,
25332 &vec![0i32; side * side], fctx,25597 &vec![0i32; side * side], fctx,
25333 );25598 );
25334 if has_chroma {25599 if has_chroma {
@@ -25338,7 +25603,7 @@ fn decode_inter_block(
25338 chroma_side,25603 chroma_side,
25339 write_chroma_w,25604 write_chroma_w,
25340 write_chroma_h,25605 write_chroma_h,
25341- &pred_u,25606+ su,
25342 &vec![0i32; chroma_side * chroma_side], fctx,25607 &vec![0i32; chroma_side * chroma_side], fctx,
25343 );25608 );
25344 push_mc_rect(2, 25609 push_mc_rect(2,
@@ -25347,7 +25612,7 @@ fn decode_inter_block(
25347 chroma_side,25612 chroma_side,
25348 write_chroma_w,25613 write_chroma_w,
25349 write_chroma_h,25614 write_chroma_h,
25350- &pred_v,25615+ sv,
25351 &vec![0i32; chroma_side * chroma_side], fctx,25616 &vec![0i32; chroma_side * chroma_side], fctx,
25352 );25617 );
25353 }25618 }
@@ -25394,11 +25659,7 @@ fn decode_inter_block(
25394 let (tu_px, tu_py) = (px + col * MI, py + row * MI);25659 let (tu_px, tu_py) = (px + col * MI, py + row * MI);
25395 let (tu_grid, tu_tx_type) = if tw == th {25660 let (tu_grid, tu_tx_type) = if tw == th {
25396 let tx_px = tw;25661 let tx_px = tw;
25397- let mut tu_pred = Vec::with_capacity(tx_px * tx_px);25662+ let tu_pred = sy.offset(row * MI * side + col * MI);
25398- for rr in 0..tx_px {
25399- let start = (row * MI + rr) * side + col * MI;
25400- tu_pred.extend_from_slice(&pred_y[start..start + tx_px]);
25401- }
25402 let scan = default_scan(tx_px.min(32));25663 let scan = default_scan(tx_px.min(32));
25403 let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tx_px / MI);25664 let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tx_px / MI);
25404 read_inter_plane(25665 read_inter_plane(
@@ -25414,7 +25675,7 @@ fn decode_inter_block(
25414 tu_py,25675 tu_py,
25415 tx_px,25676 tx_px,
25416 base_q_idx,25677 base_q_idx,
25417- &tu_pred,25678+ tu_pred,
25418 None,25679 None,
25419 Some(tu_skip_ctx), fctx,25680 Some(tu_skip_ctx), fctx,
25420 )?25681 )?
@@ -25442,7 +25703,7 @@ fn decode_inter_block(
25442 y,25703 y,
25443 tu_px,25704 tu_px,
25444 tu_py,25705 tu_py,
25445- &pred_y[start..],25706+ sy.offset(start),
25446 None,25707 None,
25447 Some(tu_skip_ctx), fctx,25708 Some(tu_skip_ctx), fctx,
25448 )?25709 )?
@@ -25476,16 +25737,12 @@ fn decode_inter_block(
25476 let cu_scan = default_scan(cu_tx);25737 let cu_scan = default_scan(cu_tx);
25477 for plane_idx in 1..3 {25738 for plane_idx in 1..3 {
25478 let (src, buf) = if plane_idx == 1 {25739 let (src, buf) = if plane_idx == 1 {
25479- (&pred_u, &mut *u)25740+ (su, &mut *u)
25480 } else {25741 } else {
25481- (&pred_v, &mut *v)25742+ (sv, &mut *v)
25482 };25743 };
25483- let mut cu_pred = Vec::with_capacity(cu_tx * cu_tx);25744+ let cu_pred =
25484- for rr in 0..cu_tx {25745+ src.offset(cr * cu_tx * chroma_side + cc * cu_tx);
25485- let start =
25486- (cr * cu_tx + rr) * chroma_side + cc * cu_tx;
25487- cu_pred.extend_from_slice(&src[start..start + cu_tx]);
25488- }
25489 let cu_grid = read_inter_plane(25746 let cu_grid = read_inter_plane(
25490 dec,25747 dec,
25491 cdfs,25748 cdfs,
@@ -25499,7 +25756,7 @@ fn decode_inter_block(
25499 cu_y,25756 cu_y,
25500 cu_tx,25757 cu_tx,
25501 base_q_idx,25758 base_q_idx,
25502- &cu_pred,25759+ cu_pred,
25503 Some(first_tx_type),25760 Some(first_tx_type),
25504 Some(3), fctx,25761 Some(3), fctx,
25505 )?25762 )?
@@ -25546,7 +25803,7 @@ fn decode_inter_block(
25546 y,25803 y,
25547 px,25804 px,
25548 py,25805 py,
25549- &pred_y,25806+ sy,
25550 None,25807 None,
25551 None, fctx,25808 None, fctx,
25552 )?;25809 )?;
@@ -25566,7 +25823,7 @@ fn decode_inter_block(
25566 py,25823 py,
25567 side,25824 side,
25568 base_q_idx,25825 base_q_idx,
25569- &pred_y,25826+ sy,
25570 None,25827 None,
25571 None, fctx,25828 None, fctx,
25572 )?;25829 )?;
@@ -25605,7 +25862,7 @@ fn decode_inter_block(
25605 u,25862 u,
25606 cpx,25863 cpx,
25607 cpy,25864 cpy,
25608- &pred_u,25865+ su,
25609 Some(luma_tx_type),25866 Some(luma_tx_type),
25610 None, fctx,25867 None, fctx,
25611 )?25868 )?
@@ -25627,7 +25884,7 @@ fn decode_inter_block(
25627 v,25884 v,
25628 cpx,25885 cpx,
25629 cpy,25886 cpy,
25630- &pred_v,25887+ sv,
25631 Some(luma_tx_type),25888 Some(luma_tx_type),
25632 None, fctx,25889 None, fctx,
25633 )?25890 )?
@@ -25650,7 +25907,7 @@ fn decode_inter_block(
25650 cpy,25907 cpy,
25651 chroma_side,25908 chroma_side,
25652 base_q_idx,25909 base_q_idx,
25653- &pred_u,25910+ su,
25654 Some(luma_tx_type),25911 Some(luma_tx_type),
25655 None, fctx,25912 None, fctx,
25656 )?25913 )?
@@ -25668,7 +25925,7 @@ fn decode_inter_block(
25668 cpy,25925 cpy,
25669 chroma_side,25926 chroma_side,
25670 base_q_idx,25927 base_q_idx,
25671- &pred_v,25928+ sv,
25672 Some(luma_tx_type),25929 Some(luma_tx_type),
25673 None, fctx,25930 None, fctx,
25674 )?25931 )?
@@ -26962,7 +27219,7 @@ fn decode_inter_sub8_split4(
26962 // txsize_to_bsize[tx_size]` branch (`txb_skip_ctx = 0`, which27219 // txsize_to_bsize[tx_size]` branch (`txb_skip_ctx = 0`, which
26963 // `read_inter_plane`'s `plane_idx == 0` arm already assumes).27220 // `read_inter_plane`'s `plane_idx == 0` arm already assumes).
26964 if skip {27221 if skip {
26965- push_mc(0, px, py, B4, &pred_y, &vec![0i32; B4 * B4], fctx);27222+ push_mc(0, px, py, B4, Pred::dense(&pred_y), &vec![0i32; B4 * B4], fctx);
26966 neighbours.record_mi_luma_rect(lmi, B4, B4, &vec![0i32; B4 * B4]);27223 neighbours.record_mi_luma_rect(lmi, B4, B4, &vec![0i32; B4 * B4]);
26967 } else {27224 } else {
26968 let around = neighbours.around_mi(lmi, B4);27225 let around = neighbours.around_mi(lmi, B4);
@@ -26983,7 +27240,7 @@ fn decode_inter_sub8_split4(
26983 py,27240 py,
26984 B4,27241 B4,
26985 base_q_idx,27242 base_q_idx,
26986- &pred_y,27243+ Pred::dense(&pred_y),
26987 None,27244 None,
26988 None, fctx,27245 None, fctx,
26989 )?;27246 )?;
@@ -27077,19 +27334,19 @@ fn decode_inter_sub8_split4(
27077 }27334 }
27078 }27335 }
27079 let (u_grid, v_grid) = if last_skip {27336 let (u_grid, v_grid) = if last_skip {
27080- push_mc(1, cpx, cpy, B4, &pred_u, &vec![0i32; B4 * B4], fctx);27337+ push_mc(1, cpx, cpy, B4, Pred::dense(&pred_u), &vec![0i32; B4 * B4], fctx);
27081- push_mc(2, cpx, cpy, B4, &pred_v, &vec![0i32; B4 * B4], fctx);27338+ push_mc(2, cpx, cpy, B4, Pred::dense(&pred_v), &vec![0i32; B4 * B4], fctx);
27082 (vec![0i32; B4 * B4], vec![0i32; B4 * B4])27339 (vec![0i32; B4 * B4], vec![0i32; B4 * B4])
27083 } else {27340 } else {
27084 let around = neighbours.around_mi(group_mi, 8);27341 let around = neighbours.around_mi(group_mi, 8);
27085 let ug = read_inter_plane(27342 let ug = read_inter_plane(
27086 dec, cdfs, TxbSet::Chroma4, scan4, 1, around[1], 0, u, cpx, cpy, B4, base_q_idx,27343 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,27344+ Pred::dense(&pred_u), Some(first_tx_type), None, fctx,
27088 )?27345 )?
27089 .0;27346 .0;
27090 let vg = read_inter_plane(27347 let vg = read_inter_plane(
27091 dec, cdfs, TxbSet::Chroma4, scan4, 2, around[2], 0, v, cpx, cpy, B4, base_q_idx,27348 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,27349+ Pred::dense(&pred_v), Some(first_tx_type), None, fctx,
27093 )?27350 )?
27094 .0;27351 .0;
27095 let coded = ug.iter().chain(vg.iter()).any(|&c| c != 0);27352 let coded = ug.iter().chain(vg.iter()).any(|&c| c != 0);
@@ -27935,7 +28192,7 @@ fn decode_inter_sub8_rect2(
27935 }28192 }
27936 }28193 }
27937 if skip {28194 if skip {
27938- push_mc_rect(0, px, py, SIDE, bw, bh, &pred_y, &vec![0i32; SIDE * SIDE], fctx);28195+ push_mc_rect(0, px, py, SIDE, bw, bh, Pred::dense(&pred_y), &vec![0i32; SIDE * SIDE], fctx);
27939 neighbours.record_mi_luma_rect(lmi, bw, bh, &vec![0i32; bw * bh]);28196 neighbours.record_mi_luma_rect(lmi, bw, bh, &vec![0i32; bw * bh]);
27940 neighbours.fill_lf_grid_rect(lmi, w_mi, h_mi, bw as u8, bh as u8, ref_frame.max(LAST_FRAME), fctx);28197 neighbours.fill_lf_grid_rect(lmi, w_mi, h_mi, bw as u8, bh as u8, ref_frame.max(LAST_FRAME), fctx);
27941 } else {28198 } else {
@@ -27971,7 +28228,7 @@ fn decode_inter_sub8_rect2(
27971 tu_py,28228 tu_py,
27972 tw,28229 tw,
27973 base_q_idx,28230 base_q_idx,
27974- &tu_pred,28231+ Pred::dense(&tu_pred),
27975 None,28232 None,
27976 Some(tu_skip_ctx), fctx,28233 Some(tu_skip_ctx), fctx,
27977 )?28234 )?
@@ -27996,7 +28253,7 @@ fn decode_inter_sub8_rect2(
27996 y,28253 y,
27997 tu_px,28254 tu_px,
27998 tu_py,28255 tu_py,
27999- &pred_y[start..],28256+ Pred::dense(&pred_y[start..]),
28000 None,28257 None,
28001 None, fctx,28258 None, fctx,
28002 )?28259 )?
@@ -28101,19 +28358,19 @@ fn decode_inter_sub8_rect2(
28101 }28358 }
28102 }28359 }
28103 let (u_grid, v_grid) = if last_skip {28360 let (u_grid, v_grid) = if last_skip {
28104- push_mc(1, cpx, cpy, B4, &pred_u, &vec![0i32; B4 * B4], fctx);28361+ push_mc(1, cpx, cpy, B4, Pred::dense(&pred_u), &vec![0i32; B4 * B4], fctx);
28105- push_mc(2, cpx, cpy, B4, &pred_v, &vec![0i32; B4 * B4], fctx);28362+ push_mc(2, cpx, cpy, B4, Pred::dense(&pred_v), &vec![0i32; B4 * B4], fctx);
28106 (vec![0i32; B4 * B4], vec![0i32; B4 * B4])28363 (vec![0i32; B4 * B4], vec![0i32; B4 * B4])
28107 } else {28364 } else {
28108 let around = neighbours.around_mi(group_mi, 8);28365 let around = neighbours.around_mi(group_mi, 8);
28109 let ug = read_inter_plane(28366 let ug = read_inter_plane(
28110 dec, cdfs, TxbSet::Chroma4, scan4, 1, around[1], 0, u, cpx, cpy, B4, base_q_idx,28367 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,28368+ Pred::dense(&pred_u), Some(first_tx_type), None, fctx,
28112 )?28369 )?
28113 .0;28370 .0;
28114 let vg = read_inter_plane(28371 let vg = read_inter_plane(
28115 dec, cdfs, TxbSet::Chroma4, scan4, 2, around[2], 0, v, cpx, cpy, B4, base_q_idx,28372 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,28373+ Pred::dense(&pred_v), Some(first_tx_type), None, fctx,
28117 )?28374 )?
28118 .0;28375 .0;
28119 let coded = ug.iter().chain(vg.iter()).any(|&c| c != 0);28376 let coded = ug.iter().chain(vg.iter()).any(|&c| c != 0);
@@ -28938,19 +29195,19 @@ fn decode_inter_block8(
28938 .129195 .1
28939 .is_some();29196 .is_some();
28940 if skip {29197 if skip {
28941- push_mc(0, px, py, SIDE, &pred_y, &vec![0i32; SIDE * SIDE], fctx);29198+ push_mc(0, px, py, SIDE, Pred::dense(&pred_y), &vec![0i32; SIDE * SIDE], fctx);
28942 push_mc(1, 29199 push_mc(1,
28943 cpx,29200 cpx,
28944 cpy,29201 cpy,
28945 CHROMA_SIDE,29202 CHROMA_SIDE,
28946- &pred_u,29203+ Pred::dense(&pred_u),
28947 &vec![0i32; CHROMA_SIDE * CHROMA_SIDE], fctx,29204 &vec![0i32; CHROMA_SIDE * CHROMA_SIDE], fctx,
28948 );29205 );
28949 push_mc(2, 29206 push_mc(2,
28950 cpx,29207 cpx,
28951 cpy,29208 cpy,
28952 CHROMA_SIDE,29209 CHROMA_SIDE,
28953- &pred_v,29210+ Pred::dense(&pred_v),
28954 &vec![0i32; CHROMA_SIDE * CHROMA_SIDE], fctx,29211 &vec![0i32; CHROMA_SIDE * CHROMA_SIDE], fctx,
28955 );29212 );
28956 luma_grid = vec![0i32; SIDE * SIDE];29213 luma_grid = vec![0i32; SIDE * SIDE];
@@ -28966,7 +29223,7 @@ fn decode_inter_block8(
28966 y,29223 y,
28967 px,29224 px,
28968 py,29225 py,
28969- &pred_y,29226+ Pred::dense(&pred_y),
28970 mode_for_tx,29227 mode_for_tx,
28971 base_q_idx,29228 base_q_idx,
28972 scan8,29229 scan8,
@@ -28988,7 +29245,7 @@ fn decode_inter_block8(
28988 cpy,29245 cpy,
28989 CHROMA_SIDE,29246 CHROMA_SIDE,
28990 base_q_idx,29247 base_q_idx,
28991- &pred_u,29248+ Pred::dense(&pred_u),
28992 Some(luma_tx_type),29249 Some(luma_tx_type),
28993 None, fctx,29250 None, fctx,
28994 )?29251 )?
@@ -29006,7 +29263,7 @@ fn decode_inter_block8(
29006 cpy,29263 cpy,
29007 CHROMA_SIDE,29264 CHROMA_SIDE,
29008 base_q_idx,29265 base_q_idx,
29009- &pred_v,29266+ Pred::dense(&pred_v),
29010 Some(luma_tx_type),29267 Some(luma_tx_type),
29011 None, fctx,29268 None, fctx,
29012 )?29269 )?
@@ -29588,19 +29845,19 @@ fn decode_inter_block8(
29588 .129845 .1
29589 .is_some();29846 .is_some();
29590 if skip {29847 if skip {
29591- push_mc(0, px, py, SIDE, &pred_y, &vec![0i32; SIDE * SIDE], fctx);29848+ push_mc(0, px, py, SIDE, Pred::dense(&pred_y), &vec![0i32; SIDE * SIDE], fctx);
29592 push_mc(1, 29849 push_mc(1,
29593 cpx,29850 cpx,
29594 cpy,29851 cpy,
29595 CHROMA_SIDE,29852 CHROMA_SIDE,
29596- &pred_u,29853+ Pred::dense(&pred_u),
29597 &vec![0i32; CHROMA_SIDE * CHROMA_SIDE], fctx,29854 &vec![0i32; CHROMA_SIDE * CHROMA_SIDE], fctx,
29598 );29855 );
29599 push_mc(2, 29856 push_mc(2,
29600 cpx,29857 cpx,
29601 cpy,29858 cpy,
29602 CHROMA_SIDE,29859 CHROMA_SIDE,
29603- &pred_v,29860+ Pred::dense(&pred_v),
29604 &vec![0i32; CHROMA_SIDE * CHROMA_SIDE], fctx,29861 &vec![0i32; CHROMA_SIDE * CHROMA_SIDE], fctx,
29605 );29862 );
29606 luma_grid = vec![0i32; SIDE * SIDE];29863 luma_grid = vec![0i32; SIDE * SIDE];
@@ -29616,7 +29873,7 @@ fn decode_inter_block8(
29616 y,29873 y,
29617 px,29874 px,
29618 py,29875 py,
29619- &pred_y,29876+ Pred::dense(&pred_y),
29620 mode_for_tx,29877 mode_for_tx,
29621 base_q_idx,29878 base_q_idx,
29622 scan8,29879 scan8,
@@ -29638,7 +29895,7 @@ fn decode_inter_block8(
29638 cpy,29895 cpy,
29639 CHROMA_SIDE,29896 CHROMA_SIDE,
29640 base_q_idx,29897 base_q_idx,
29641- &pred_u,29898+ Pred::dense(&pred_u),
29642 Some(luma_tx_type),29899 Some(luma_tx_type),
29643 None, fctx,29900 None, fctx,
29644 )?29901 )?
@@ -29656,7 +29913,7 @@ fn decode_inter_block8(
29656 cpy,29913 cpy,
29657 CHROMA_SIDE,29914 CHROMA_SIDE,
29658 base_q_idx,29915 base_q_idx,
29659- &pred_v,29916+ Pred::dense(&pred_v),
29660 Some(luma_tx_type),29917 Some(luma_tx_type),
29661 None, fctx,29918 None, fctx,
29662 )?29919 )?