forge
Explore
Log in

Don't you dare go Hollow

The sub-8x8 group predictions build on the recon worker too

Browse files at this commit

9137abf43e3f9fc12aed232a3b7a8b1dc32d81baAhmet Kaan GümüşParent: 36b27a7
  • perf
    • the sub-8x8 group predictions build on the recon worker too
Show full message
perf(av1): the sub-8x8 group predictions build on the recon worker too

The four remaining parse-thread reference-pixel readers -- the 4x4 SPLIT
group's per-sub-block luma, the 8x4/4x8 HORZ/VERT group's per-piece luma,
and both groups' one chroma unit -- now build inside `PredBuild` closures
through `push_pred`, exactly as lane-defer8 did for the 8x8 leaf: each
piece's ref/mv/filters travel by value, the reference PICTURES resolve
inside the closure (`ref_planes_deferred`, failures parked on `RefPix`),
and the parse thread only asks `ref_dims` for the scale factor its own
counter needs. A group pushes one `Pred` op per piece, each immediately
followed by the ops that read it, so the worker's block-prediction slot is
consumed before the next piece overwrites it.

The rect group's transform units take their window of the block prediction
(`Pred::offset` at the block stride) instead of copying it out on the parse
thread; `push_mc_rect_tx` already densifies that window where the residual
is dense, which is the copy that was made here. `Pred::dense` has no caller
left and is gone.

Byte-exact: all four gate streams at 1, 4, 16(4,2), 16(3,1) threads and at
16(4,2) with EC_AV1_TWO_STAGE=1.
crates/ec-av1/src/decode.rsmodified+229 -129
@@ -2253,8 +2253,8 @@ fn dense_residual(residual: &[i32], n: usize) -> &[i32] {
22532253 /// block then reads its window out of that slot ([`Pred::Cur`]).
22542254 #[derive(Clone, Copy)]
22552255 pub(crate) enum Pred<'a> {
2256- /// A prediction the parse thread already built. `stride == 0` means "the
2257- /// reader's own `stride` argument", which is every pre-lane-wave4 site.
2256+ /// A prediction the parse thread already built, at its own stride
2257+ /// (`stride == 0` means "the reader's own `stride` argument").
22582258 Inline(&'a [u16], usize),
22592259 /// The current block's deferred prediction: plane, its stride, and this
22602260 /// unit's offset into it.
@@ -2262,9 +2262,6 @@ pub(crate) enum Pred<'a> {
22622262 }
22632263
22642264 impl<'a> Pred<'a> {
2265- fn dense(buf: &'a [u16]) -> Self {
2266- Self::Inline(buf, 0)
2267- }
22682265 /// The same prediction read at an explicit stride.
22692266 fn view(self, stride: usize) -> Self {
22702267 match self {
@@ -28686,12 +28683,14 @@ fn decode_inter_sub8_split4(
2868628683 neighbours.left_ref[rmi],
2868728684 neighbours.left_ref1[rmi],
2868828685 );
28689- let (sref_y, _sref_u, _sref_v) = ref_planes(ref_frame, refpix)?;
28686+ // lane-sub8group: this piece's reference SIZE at parse, its pictures
28687+ // inside the prediction closure below.
28688+ let (ref_width, _) = ref_dims(ref_frame, refpix)?;
2869028689 // lane-t900 r28: refusal lifted -- this sub-block's own reference may
2869128690 // be scaled (superres); spec 7.11.3.3's walk is per reference, and
2869228691 // each of the group's pieces (luma and its 2x2 chroma) carries its
2869328692 // OWN factor because each can name a different `ref_frame`.
28694- let luma_scale = mc::scale_factor(sref_y.width, frame_width);
28693+ let luma_scale = mc::scale_factor(ref_width, frame_width);
2869528694 if luma_scale != mc::REF_NO_SCALE {
2869628695 SCALED_SUB8_HITS.with(|c| c.set(c.get() + 1));
2869728696 }
@@ -28854,27 +28853,51 @@ fn decode_inter_sub8_split4(
2885428853 },
2885528854 );
2885628855 piece[i] = Some((ref_frame, mv, h_filter, v_filter));
28857- let mut pred_y = vec![0u16; B4 * B4];
28858- mc::predict_maybe_scaled(
28859- &sref_y.data,
28860- sref_y.width,
28861- sref_y.true_width,
28862- sref_y.true_height,
28863- mv_to_q4(px, mv.1, true),
28864- mv_to_q4(py, mv.0, true),
28865- luma_scale,
28866- B4,
28867- B4,
28868- h_filter,
28869- v_filter,
28870- &mut pred_y, fctx,
28871- );
28856+ // lane-sub8group: this piece's prediction as a closure, so it runs
28857+ // where its writes run -- on a recon worker at more than one
28858+ // reconstruction thread, exactly like the 8x8 leaf's.
28859+ let build = move |_y: &mut PlaneBuf<'static>,
28860+ _u: &mut PlaneBuf<'static>,
28861+ _v: &mut PlaneBuf<'static>,
28862+ fctx: &crate::decode::FrameCtx,
28863+ out: &mut [Vec<u16>; 3]| {
28864+ let Some((sref_y, _, _)) = ref_planes_deferred(ref_frame, refpix) else {
28865+ return;
28866+ };
28867+ let mut pred_y = refill(std::mem::take(&mut out[0]), B4 * B4);
28868+ mc::predict_maybe_scaled(
28869+ &sref_y.data,
28870+ sref_y.width,
28871+ sref_y.true_width,
28872+ sref_y.true_height,
28873+ mv_to_q4(px, mv.1, true),
28874+ mv_to_q4(py, mv.0, true),
28875+ luma_scale,
28876+ B4,
28877+ B4,
28878+ h_filter,
28879+ v_filter,
28880+ &mut pred_y, fctx,
28881+ );
28882+ out[0] = pred_y;
28883+ };
28884+ let pred_y: Vec<u16>;
28885+ let sy = if recon_deferred(fctx) {
28886+ push_pred(fctx, build);
28887+ Pred::Cur { plane: 0, stride: B4, off: 0 }
28888+ } else {
28889+ let mut built: [Vec<u16>; 3] = Default::default();
28890+ build(y, u, v, fctx, &mut built);
28891+ let [by, _, _] = built;
28892+ pred_y = by;
28893+ Pred::Inline(&pred_y, B4)
28894+ };
2887228895 // `BLOCK_4X4` never signals a transform size, so the luma unit is the
2887328896 // whole block and `get_txb_ctx` takes its `plane_bsize ==
2887428897 // txsize_to_bsize[tx_size]` branch (`txb_skip_ctx = 0`, which
2887528898 // `read_inter_plane`'s `plane_idx == 0` arm already assumes).
2887628899 if skip {
28877- push_mc(0, px, py, B4, Pred::dense(&pred_y), &ZERO_RESIDUAL[..B4 * B4], fctx);
28900+ push_mc(0, px, py, B4, sy, &ZERO_RESIDUAL[..B4 * B4], fctx);
2887828901 neighbours.record_mi_luma_rect(lmi, B4, B4, &ZERO_RESIDUAL[..B4 * B4]);
2887928902 } else {
2888028903 let around = neighbours.around_mi(lmi, B4);
@@ -28895,7 +28918,7 @@ fn decode_inter_sub8_split4(
2889528918 py,
2889628919 B4,
2889728920 base_q_idx,
28898- Pred::dense(&pred_y),
28921+ sy,
2889928922 None,
2890028923 None, fctx,
2890128924 )?;
@@ -28934,8 +28957,6 @@ fn decode_inter_sub8_split4(
2893428957 // Chroma, once for the whole group, on the last sub-block's own `skip`
2893528958 // flag -- prediction from all four sub-blocks (2x2 pieces), residual as
2893628959 // one TX_4X4 unit per plane.
28937- let mut pred_u = vec![0u16; B4 * B4];
28938- let mut pred_v = vec![0u16; B4 * B4];
2893928960 // `is_sub8x8_inter` (reconinter_template.inc:54) is false as soon as ANY
2894028961 // mi of the group is intra: the group's 4x4 chroma is then predicted WHOLE
2894128962 // from the chroma-reference (last) sub-block's own mv, not in 2x2 pieces.
@@ -28947,61 +28968,89 @@ fn decode_inter_sub8_split4(
2894728968 h.set(st);
2894828969 });
2894928970 }
28950- for i in 0..4usize {
28951- let (dr, dc) = (i / 2, i % 2);
28952- if mixed && i != 3 {
28953- continue;
28954- }
28955- let Some((ref_frame, mv, h_filter, v_filter)) = piece[i] else {
28956- continue;
28957- };
28958- let (piece_ref_y, sref_u, sref_v) =
28959- ref_planes(ref_frame, refpix)?;
28960- let piece_scale = mc::scale_factor(piece_ref_y.width, frame_width);
28961- let (ox, oy) = if mixed {
28962- (cpx, cpy)
28963- } else {
28964- (cpx + dc * 2, cpy + dr * 2)
28965- };
28966- let (pw, ph) = if mixed { (B4, B4) } else { (2, 2) };
28967- let (row0, col0) = if mixed { (0, 0) } else { (dr * 2, dc * 2) };
28968- for (plane, dst) in [(sref_u, &mut pred_u), (sref_v, &mut pred_v)] {
28969- let mut buf = vec![0u16; pw * ph];
28970- mc::predict_maybe_scaled(
28971- &plane.data,
28972- plane.width,
28973- plane.true_width,
28974- plane.true_height,
28975- mv_to_q4(ox, mv.1, false),
28976- mv_to_q4(oy, mv.0, false),
28977- piece_scale,
28978- pw,
28979- ph,
28980- h_filter,
28981- v_filter,
28982- &mut buf, fctx,
28983- );
28984- for row in 0..ph {
28985- for col in 0..pw {
28986- dst[(row0 + row) * B4 + col0 + col] = buf[row * pw + col];
28971+ // lane-sub8group: the group's chroma pieces, built on the worker that
28972+ // writes them -- the pieces' refs/mvs/filters travel by value.
28973+ let build = move |_y: &mut PlaneBuf<'static>,
28974+ _u: &mut PlaneBuf<'static>,
28975+ _v: &mut PlaneBuf<'static>,
28976+ fctx: &crate::decode::FrameCtx,
28977+ out: &mut [Vec<u16>; 3]| {
28978+ let mut pred_u = refill(std::mem::take(&mut out[1]), B4 * B4);
28979+ let mut pred_v = refill(std::mem::take(&mut out[2]), B4 * B4);
28980+ for i in 0..4usize {
28981+ let (dr, dc) = (i / 2, i % 2);
28982+ if mixed && i != 3 {
28983+ continue;
28984+ }
28985+ let Some((ref_frame, mv, h_filter, v_filter)) = piece[i] else {
28986+ continue;
28987+ };
28988+ let Some((piece_ref_y, sref_u, sref_v)) = ref_planes_deferred(ref_frame, refpix)
28989+ else {
28990+ continue;
28991+ };
28992+ let piece_scale = mc::scale_factor(piece_ref_y.width, frame_width);
28993+ let (ox, oy) = if mixed {
28994+ (cpx, cpy)
28995+ } else {
28996+ (cpx + dc * 2, cpy + dr * 2)
28997+ };
28998+ let (pw, ph) = if mixed { (B4, B4) } else { (2, 2) };
28999+ let (row0, col0) = if mixed { (0, 0) } else { (dr * 2, dc * 2) };
29000+ for (plane, dst) in [(sref_u, &mut pred_u), (sref_v, &mut pred_v)] {
29001+ let mut buf = vec![0u16; pw * ph];
29002+ mc::predict_maybe_scaled(
29003+ &plane.data,
29004+ plane.width,
29005+ plane.true_width,
29006+ plane.true_height,
29007+ mv_to_q4(ox, mv.1, false),
29008+ mv_to_q4(oy, mv.0, false),
29009+ piece_scale,
29010+ pw,
29011+ ph,
29012+ h_filter,
29013+ v_filter,
29014+ &mut buf, fctx,
29015+ );
29016+ for row in 0..ph {
29017+ for col in 0..pw {
29018+ dst[(row0 + row) * B4 + col0 + col] = buf[row * pw + col];
29019+ }
2898729020 }
2898829021 }
2898929022 }
28990- }
29023+ out[1] = pred_u;
29024+ out[2] = pred_v;
29025+ };
29026+ let (pred_u, pred_v): (Vec<u16>, Vec<u16>);
29027+ let (su, sv) = if recon_deferred(fctx) {
29028+ push_pred(fctx, build);
29029+ (
29030+ Pred::Cur { plane: 1, stride: B4, off: 0 },
29031+ Pred::Cur { plane: 2, stride: B4, off: 0 },
29032+ )
29033+ } else {
29034+ let mut built: [Vec<u16>; 3] = Default::default();
29035+ build(y, u, v, fctx, &mut built);
29036+ let [_, bu, bv] = built;
29037+ (pred_u, pred_v) = (bu, bv);
29038+ (Pred::Inline(&pred_u, B4), Pred::Inline(&pred_v, B4))
29039+ };
2899129040 let (u_grid, v_grid) = if last_skip {
28992- push_mc(1, cpx, cpy, B4, Pred::dense(&pred_u), &ZERO_RESIDUAL[..B4 * B4], fctx);
28993- push_mc(2, cpx, cpy, B4, Pred::dense(&pred_v), &ZERO_RESIDUAL[..B4 * B4], fctx);
29041+ push_mc(1, cpx, cpy, B4, su, &ZERO_RESIDUAL[..B4 * B4], fctx);
29042+ push_mc(2, cpx, cpy, B4, sv, &ZERO_RESIDUAL[..B4 * B4], fctx);
2899429043 (Grid::Zero(B4 * B4), Grid::Zero(B4 * B4))
2899529044 } else {
2899629045 let around = neighbours.around_mi(group_mi, 8);
2899729046 let ug = read_inter_plane(
2899829047 dec, cdfs, TxbSet::Chroma4, scan4, 1, around[1], 0, u, cpx, cpy, B4, base_q_idx,
28999- Pred::dense(&pred_u), Some(first_tx_type), None, fctx,
29048+ su, Some(first_tx_type), None, fctx,
2900029049 )?
2900129050 .0;
2900229051 let vg = read_inter_plane(
2900329052 dec, cdfs, TxbSet::Chroma4, scan4, 2, around[2], 0, v, cpx, cpy, B4, base_q_idx,
29004- Pred::dense(&pred_v), Some(first_tx_type), None, fctx,
29053+ sv, Some(first_tx_type), None, fctx,
2900529054 )?
2900629055 .0;
2900729056 let coded = ug.iter().chain(vg.iter()).any(|&c| c != 0);
@@ -29656,9 +29705,11 @@ fn decode_inter_sub8_rect2(
2965629705 neighbours.left_ref[rmi],
2965729706 neighbours.left_ref1[rmi],
2965829707 );
29659- let (sref_y, _, _) = ref_planes(ref_frame, refpix)?;
29708+ // lane-sub8group: this piece's reference SIZE at parse, its pictures
29709+ // inside the prediction closure below.
29710+ let (ref_width, _) = ref_dims(ref_frame, refpix)?;
2966029711 // lane-t900 r28: refusal lifted -- see the split arm above.
29661- let luma_scale = mc::scale_factor(sref_y.width, frame_width);
29712+ let luma_scale = mc::scale_factor(ref_width, frame_width);
2966229713 if luma_scale != mc::REF_NO_SCALE {
2966329714 SCALED_SUB8_HITS.with(|c| c.set(c.get() + 1));
2966429715 }
@@ -29820,8 +29871,18 @@ fn decode_inter_sub8_rect2(
2982029871 // Prediction over the leaf's true footprint, laid out at the group's
2982129872 // square stride (what `reconstruct_mc_rect` and `read_inter_plane_rect`
2982229873 // index with).
29823- let mut pred_y = vec![0u16; SIDE * SIDE];
29824- {
29874+ // lane-sub8group: this piece's prediction as a closure, so it runs
29875+ // where its writes run -- on a recon worker at more than one
29876+ // reconstruction thread, exactly like the 8x8 leaf's.
29877+ let build = move |_y: &mut PlaneBuf<'static>,
29878+ _u: &mut PlaneBuf<'static>,
29879+ _v: &mut PlaneBuf<'static>,
29880+ fctx: &crate::decode::FrameCtx,
29881+ out: &mut [Vec<u16>; 3]| {
29882+ let Some((sref_y, _, _)) = ref_planes_deferred(ref_frame, refpix) else {
29883+ return;
29884+ };
29885+ let mut pred_y = refill(std::mem::take(&mut out[0]), SIDE * SIDE);
2982529886 let mut dense = vec![0u16; bw * bh];
2982629887 mc::predict_maybe_scaled(
2982729888 &sref_y.data,
@@ -29840,9 +29901,21 @@ fn decode_inter_sub8_rect2(
2984029901 for row in 0..bh {
2984129902 pred_y[row * SIDE..][..bw].copy_from_slice(&dense[row * bw..][..bw]);
2984229903 }
29843- }
29904+ out[0] = pred_y;
29905+ };
29906+ let pred_y: Vec<u16>;
29907+ let sy = if recon_deferred(fctx) {
29908+ push_pred(fctx, build);
29909+ Pred::Cur { plane: 0, stride: SIDE, off: 0 }
29910+ } else {
29911+ let mut built: [Vec<u16>; 3] = Default::default();
29912+ build(y, u, v, fctx, &mut built);
29913+ let [by, _, _] = built;
29914+ pred_y = by;
29915+ Pred::Inline(&pred_y, SIDE)
29916+ };
2984429917 if skip {
29845- push_mc_rect(0, px, py, SIDE, bw, bh, Pred::dense(&pred_y), &ZERO_RESIDUAL[..SIDE * SIDE], fctx);
29918+ push_mc_rect(0, px, py, SIDE, bw, bh, sy, &ZERO_RESIDUAL[..SIDE * SIDE], fctx);
2984629919 neighbours.record_mi_luma_rect(lmi, bw, bh, &ZERO_RESIDUAL[..bw * bh]);
2984729920 neighbours.fill_lf_grid_rect(lmi, w_mi, h_mi, bw as u8, bh as u8, ref_frame.max(LAST_FRAME), fctx);
2984829921 } else {
@@ -29850,16 +29923,18 @@ fn decode_inter_sub8_rect2(
2985029923 for (idx, &(row, col, tw, th)) in leaves.iter().enumerate() {
2985129924 let tu_mi = (rmi + row, cmi + col);
2985229925 let (tu_px, tu_py) = (px + col * MI, py + row * MI);
29926+ // This unit's offset into the block prediction (lane-sub8group).
29927+ let start = row * MI * SIDE + col * MI;
2985329928 let (tu_grid, tu_tx_type) = if tw == th {
2985429929 // A split `TX_4X4` unit: square reader, its own
2985529930 // `get_txb_ctx_general` neighbour context (the unit is
2985629931 // smaller than its plane block, so the lone-TU 0 does not
2985729932 // apply).
29858- let mut tu_pred = Vec::with_capacity(tw * th);
29859- for rr in 0..th {
29860- let start = (row * MI + rr) * SIDE + col * MI;
29861- tu_pred.extend_from_slice(&pred_y[start..start + tw]);
29862- }
29933+ // lane-sub8group: the unit's window of the block
29934+ // prediction, at the block's stride -- the dense copy the
29935+ // parse thread used to make is the recorded op's own
29936+ // ([`push_mc_rect_tx`]), and a deferred prediction has no
29937+ // buffer here to copy out of.
2986329938 let tu_skip_ctx = neighbours.luma_skip_ctx_rect(tu_mi, tw / MI, th / MI);
2986429939 read_inter_plane(
2986529940 dec,
@@ -29878,7 +29953,7 @@ fn decode_inter_sub8_rect2(
2987829953 tu_py,
2987929954 tw,
2988029955 base_q_idx,
29881- Pred::dense(&tu_pred),
29956+ sy.offset(start),
2988229957 None,
2988329958 Some(tu_skip_ctx), fctx,
2988429959 )?
@@ -29886,7 +29961,6 @@ fn decode_inter_sub8_rect2(
2988629961 // The whole leaf as one `TX_8X4`/`TX_4X8` unit: it IS the
2988729962 // plane block, so `get_txb_ctx_general` fixes `txb_skip_ctx`
2988829963 // at 0 (`luma_skip_ctx: None`).
29889- let start = row * MI * SIDE + col * MI;
2989029964 read_inter_plane_rect(
2989129965 dec,
2989229966 cdfs,
@@ -29903,7 +29977,7 @@ fn decode_inter_sub8_rect2(
2990329977 y,
2990429978 tu_px,
2990529979 tu_py,
29906- Pred::dense(&pred_y[start..]),
29980+ sy.offset(start),
2990729981 None,
2990829982 None, fctx,
2990929983 )?
@@ -29942,8 +30016,6 @@ fn decode_inter_sub8_rect2(
2994230016 // The group's single 4x4 chroma unit per plane, on the chroma-reference
2994330017 // (second) sub-block's own skip flag.
2994430018 const B4: usize = 4;
29945- let mut pred_u = vec![0u16; B4 * B4];
29946- let mut pred_v = vec![0u16; B4 * B4];
2994730019 // `is_sub8x8_inter` (reconinter_template.inc:54) is false as soon as ANY
2994830020 // mi of the group is intra, so a group whose chroma reference is inter but
2994930021 // whose sibling is INTRA does NOT get the two-piece sub8x8 prediction: the
@@ -29963,64 +30035,92 @@ fn decode_inter_sub8_rect2(
2996330035 (false, true) => (2usize, 4usize),
2996430036 (false, false) => (4usize, 2usize),
2996530037 };
29966- for i in 0..2usize {
29967- let Some((ref_frame, mv, h_filter, v_filter)) = piece[i] else {
29968- continue;
29969- };
29970- let (piece_ref_y, sref_u, sref_v) =
29971- ref_planes(ref_frame, refpix)?;
29972- let piece_scale = mc::scale_factor(piece_ref_y.width, frame_width);
29973- let (ox, oy) = if mixed {
29974- (cpx, cpy)
29975- } else if vert {
29976- (cpx + i * piece_w, cpy)
29977- } else {
29978- (cpx, cpy + i * piece_h)
29979- };
29980- let (dc, dr) = if mixed {
29981- (0, 0)
29982- } else if vert {
29983- (i * piece_w, 0)
29984- } else {
29985- (0, i * piece_h)
29986- };
29987- for (plane, dst) in [(sref_u, &mut pred_u), (sref_v, &mut pred_v)] {
29988- let mut buf = vec![0u16; piece_w * piece_h];
29989- mc::predict_maybe_scaled(
29990- &plane.data,
29991- plane.width,
29992- plane.true_width,
29993- plane.true_height,
29994- mv_to_q4(ox, mv.1, false),
29995- mv_to_q4(oy, mv.0, false),
29996- piece_scale,
29997- piece_w,
29998- piece_h,
29999- h_filter,
30000- v_filter,
30001- &mut buf, fctx,
30002- );
30003- for row in 0..piece_h {
30004- for col in 0..piece_w {
30005- dst[(dr + row) * B4 + dc + col] = buf[row * piece_w + col];
30038+ // lane-sub8group: the group's chroma pieces, built on the worker that
30039+ // writes them -- the pieces' refs/mvs/filters travel by value.
30040+ let build = move |_y: &mut PlaneBuf<'static>,
30041+ _u: &mut PlaneBuf<'static>,
30042+ _v: &mut PlaneBuf<'static>,
30043+ fctx: &crate::decode::FrameCtx,
30044+ out: &mut [Vec<u16>; 3]| {
30045+ let mut pred_u = refill(std::mem::take(&mut out[1]), B4 * B4);
30046+ let mut pred_v = refill(std::mem::take(&mut out[2]), B4 * B4);
30047+ for i in 0..2usize {
30048+ let Some((ref_frame, mv, h_filter, v_filter)) = piece[i] else {
30049+ continue;
30050+ };
30051+ let Some((piece_ref_y, sref_u, sref_v)) = ref_planes_deferred(ref_frame, refpix)
30052+ else {
30053+ continue;
30054+ };
30055+ let piece_scale = mc::scale_factor(piece_ref_y.width, frame_width);
30056+ let (ox, oy) = if mixed {
30057+ (cpx, cpy)
30058+ } else if vert {
30059+ (cpx + i * piece_w, cpy)
30060+ } else {
30061+ (cpx, cpy + i * piece_h)
30062+ };
30063+ let (dc, dr) = if mixed {
30064+ (0, 0)
30065+ } else if vert {
30066+ (i * piece_w, 0)
30067+ } else {
30068+ (0, i * piece_h)
30069+ };
30070+ for (plane, dst) in [(sref_u, &mut pred_u), (sref_v, &mut pred_v)] {
30071+ let mut buf = vec![0u16; piece_w * piece_h];
30072+ mc::predict_maybe_scaled(
30073+ &plane.data,
30074+ plane.width,
30075+ plane.true_width,
30076+ plane.true_height,
30077+ mv_to_q4(ox, mv.1, false),
30078+ mv_to_q4(oy, mv.0, false),
30079+ piece_scale,
30080+ piece_w,
30081+ piece_h,
30082+ h_filter,
30083+ v_filter,
30084+ &mut buf, fctx,
30085+ );
30086+ for row in 0..piece_h {
30087+ for col in 0..piece_w {
30088+ dst[(dr + row) * B4 + dc + col] = buf[row * piece_w + col];
30089+ }
3000630090 }
3000730091 }
3000830092 }
30009- }
30093+ out[1] = pred_u;
30094+ out[2] = pred_v;
30095+ };
30096+ let (pred_u, pred_v): (Vec<u16>, Vec<u16>);
30097+ let (su, sv) = if recon_deferred(fctx) {
30098+ push_pred(fctx, build);
30099+ (
30100+ Pred::Cur { plane: 1, stride: B4, off: 0 },
30101+ Pred::Cur { plane: 2, stride: B4, off: 0 },
30102+ )
30103+ } else {
30104+ let mut built: [Vec<u16>; 3] = Default::default();
30105+ build(y, u, v, fctx, &mut built);
30106+ let [_, bu, bv] = built;
30107+ (pred_u, pred_v) = (bu, bv);
30108+ (Pred::Inline(&pred_u, B4), Pred::Inline(&pred_v, B4))
30109+ };
3001030110 let (u_grid, v_grid) = if last_skip {
30011- push_mc(1, cpx, cpy, B4, Pred::dense(&pred_u), &ZERO_RESIDUAL[..B4 * B4], fctx);
30012- push_mc(2, cpx, cpy, B4, Pred::dense(&pred_v), &ZERO_RESIDUAL[..B4 * B4], fctx);
30111+ push_mc(1, cpx, cpy, B4, su, &ZERO_RESIDUAL[..B4 * B4], fctx);
30112+ push_mc(2, cpx, cpy, B4, sv, &ZERO_RESIDUAL[..B4 * B4], fctx);
3001330113 (Grid::Zero(B4 * B4), Grid::Zero(B4 * B4))
3001430114 } else {
3001530115 let around = neighbours.around_mi(group_mi, 8);
3001630116 let ug = read_inter_plane(
3001730117 dec, cdfs, TxbSet::Chroma4, scan4, 1, around[1], 0, u, cpx, cpy, B4, base_q_idx,
30018- Pred::dense(&pred_u), Some(first_tx_type), None, fctx,
30118+ su, Some(first_tx_type), None, fctx,
3001930119 )?
3002030120 .0;
3002130121 let vg = read_inter_plane(
3002230122 dec, cdfs, TxbSet::Chroma4, scan4, 2, around[2], 0, v, cpx, cpy, B4, base_q_idx,
30023- Pred::dense(&pred_v), Some(first_tx_type), None, fctx,
30123+ sv, Some(first_tx_type), None, fctx,
3002430124 )?
3002530125 .0;
3002630126 let coded = ug.iter().chain(vg.iter()).any(|&c| c != 0);