forge
Explore
Log in

Don't you dare go Hollow

The parse thread stops reading reference pixels -- 8x8 leaf, OBMC and the sub-8x8 chroma piece deferred to the recon workers

Browse files at this commit

fb24177d5a7be0f81320209f45f5c4086af3685cAhmet Kaan GümüşParent: 1d9f0d3
  • perf
    • the parse thread stops reading reference pixels -- 8x8 leaf, OBMC and the sub-8x8 chroma piece deferred to the recon workers
Show full message
perf(av1): the parse thread stops reading reference pixels -- 8x8 leaf, OBMC and the sub-8x8 chroma piece deferred to the recon workers

Every whole-block inter prediction now happens inside its `PredBuild`
closure, so at more than one reconstruction thread it runs on the worker
that writes it:

  * `decode_inter_block8` builds both of its arms (single-reference and
    compound) through `push_pred`, recording `Pred::Cur` windows exactly
    as the 16x16+ path does, instead of predicting into dense `Vec`s on the
    parse thread;
  * OBMC splits into `obmc_plan` (the two neighbour walks and every
    mode-info/neighbour-band read they make, on the parse thread, where that
    state is still this block's) and `obmc_run` (the neighbour predictions
    and blends, from the plan and reference pixels alone);
  * the sub-8x8 chroma piece captures its previous strip's ref/mv/filters
    plus that reference's SIZE and rebuilds the piece inside the closure;
  * the reference PICTURES themselves are resolved inside the closures --
    the parse only asks for `ref_dims`, which answers from the stage-1
    metadata without waiting for a producer's filters.

Ordering is the wavefront rule the deferred path already relied on: a
worker runs a block's ops only once (r-1, c+1) and (r, c-1) are complete,
which covers the interintra predictor's own above/left edges; the inline
arm keeps its `flush_recon` before the build. A deferred prediction has no
`?`, so a reference resolution failure is parked on the `RefPix` and taken
by the frame decoder once every tile's workers are joined.

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, plus six film cuts base vs new. Measured
instructions:u +0.13% (1 thread) / +0.19% (16,4,2) -- the closure boxing and
the OBMC plan. EC_AV1_TWO_STAGE stays default OFF: its chain is 5562 ms vs
base 5618 ms (1%), inside the noise of a box at load 8-18.
crates/ec-av1/src/decode.rsmodified+471 -213
@@ -23200,11 +23200,16 @@ fn read_single_ref(
23200 /// way with a coarser (`LAST_FRAME`-only) neighbour shape.23200 /// way with a coarser (`LAST_FRAME`-only) neighbour shape.
23201 /// lane-twostage: this frame's references as DIMENSIONS now and PIXELS on23201 /// lane-twostage: this frame's references as DIMENSIONS now and PIXELS on
23202 /// demand. An inter tile's parse reads reference SIZES (`mc::scale_factor`)23202 /// demand. An inter tile's parse reads reference SIZES (`mc::scale_factor`)
23203-/// but touches no reference PIXEL until its first prediction -- measured 4.2%23203+/// only, so the pictures are resolved at the first [`ref_planes`] call
23204-/// of a 4K tile's parse into it -- so the pictures are resolved here, at the23204+/// rather than at frame entry. On the threaded path that resolution is a
23205-/// first [`ref_planes`] call, rather than at frame entry. On the threaded23205+/// WAIT on the producing frame's pixels, which is what lets a consumer parse
23206-/// path that resolution is a WAIT on the producing frame's pixels, which is23206+/// while its references are still being filtered.
23207-/// what lets a consumer parse while its references are still being filtered.23207+/// lane-defer8: at more than one reconstruction thread that first call now
23208+/// happens on a recon WORKER -- every whole-block prediction (the 16x16+
23209+/// paths, the 8x8 leaf, OBMC and the sub-8x8 chroma piece) is built inside
23210+/// its [`PredBuild`] closure, and the parse thread only ever asks for
23211+/// [`ref_dims`]. The sub-8x8 GROUP paths (4xN/Nx4 partitions) still predict
23212+/// inline and are the last parse-thread reference readers.
23208 pub(crate) struct RefPix<'p> {23213 pub(crate) struct RefPix<'p> {
23209 /// `(width, height)` per `ref_frame` index (`LAST_FRAME` = 1). `None` is23214 /// `(width, height)` per `ref_frame` index (`LAST_FRAME` = 1). `None` is
23210 /// a slot this frame may not use: empty, or -- for a non-`LAST_FRAME`23215 /// a slot this frame may not use: empty, or -- for a non-`LAST_FRAME`
@@ -23213,6 +23218,10 @@ pub(crate) struct RefPix<'p> {
23213 dims: [Option<(usize, usize)>; 8],23218 dims: [Option<(usize, usize)>; 8],
23214 src: RefSrc<'p>,23219 src: RefSrc<'p>,
23215 bufs: std::sync::OnceLock<[Option<(PlaneBuf<'p>, PlaneBuf<'p>, PlaneBuf<'p>)>; 8]>,23220 bufs: std::sync::OnceLock<[Option<(PlaneBuf<'p>, PlaneBuf<'p>, PlaneBuf<'p>)>; 8]>,
23221+ /// lane-defer8: a DEFERRED prediction's [`ref_planes`] failure, parked
23222+ /// here for the frame decoder to take ([`take_err`](Self::take_err)) --
23223+ /// a recon worker replaying a recorded op has no `?` of its own.
23224+ err: std::sync::Mutex<Option<Error>>,
23216 }23225 }
23217 23226
23218 /// Where a [`RefPix`] gets its pictures: already in hand, or behind a wait23227 /// Where a [`RefPix`] gets its pictures: already in hand, or behind a wait
@@ -23232,7 +23241,7 @@ impl<'p> RefPix<'p> {
23232 let dims = Self::compatible(std::array::from_fn(|i| {23241 let dims = Self::compatible(std::array::from_fn(|i| {
23233 refs[i].map(|p| (p.width, p.height))23242 refs[i].map(|p| (p.width, p.height))
23234 }));23243 }));
23235- Self { dims, src: RefSrc::Ready(refs), bufs: std::sync::OnceLock::new() }23244+ Self { dims, src: RefSrc::Ready(refs), bufs: std::sync::OnceLock::new(), err: std::sync::Mutex::new(None) }
23236 }23245 }
23237 23246
23238 /// References whose sizes are known (from their producers' headers) but23247 /// References whose sizes are known (from their producers' headers) but
@@ -23241,7 +23250,12 @@ impl<'p> RefPix<'p> {
23241 dims: [Option<(usize, usize)>; 8],23250 dims: [Option<(usize, usize)>; 8],
23242 wait: &'p (dyn Fn() -> Result<[Option<&'p Picture>; 8]> + Send + Sync + 'p),23251 wait: &'p (dyn Fn() -> Result<[Option<&'p Picture>; 8]> + Send + Sync + 'p),
23243 ) -> Self {23252 ) -> Self {
23244- Self { dims: Self::compatible(dims), src: RefSrc::Lazy(wait), bufs: std::sync::OnceLock::new() }23253+ Self {
23254+ dims: Self::compatible(dims),
23255+ src: RefSrc::Lazy(wait),
23256+ bufs: std::sync::OnceLock::new(),
23257+ err: std::sync::Mutex::new(None),
23258+ }
23245 }23259 }
23246 23260
23247 /// Spec 7.9's compatible-size rule: a non-`LAST_FRAME` slot at a23261 /// Spec 7.9's compatible-size rule: a non-`LAST_FRAME` slot at a
@@ -23262,6 +23276,23 @@ impl<'p> RefPix<'p> {
23262 self.dims.get(ref_frame as usize).copied().flatten()23276 self.dims.get(ref_frame as usize).copied().flatten()
23263 }23277 }
23264 23278
23279+ /// Parks a deferred prediction's failure (first one wins).
23280+ fn park_err(&self, e: Error) {
23281+ let mut slot = self.err.lock().expect("the parked-error slot is never poisoned");
23282+ if slot.is_none() {
23283+ *slot = Some(e);
23284+ }
23285+ }
23286+
23287+ /// The first failure any deferred prediction parked, taken once every
23288+ /// recon worker of the frame has been joined.
23289+ pub(crate) fn take_err(&self) -> Result<()> {
23290+ match self.err.lock().expect("the parked-error slot is never poisoned").take() {
23291+ Some(e) => Err(e),
23292+ None => Ok(()),
23293+ }
23294+ }
23295+
23265 /// Every usable slot's three planes, resolving (and, on the threaded23296 /// Every usable slot's three planes, resolving (and, on the threaded
23266 /// path, waiting for) the pictures on the first call.23297 /// path, waiting for) the pictures on the first call.
23267 fn planes(&self) -> Result<&[Option<(PlaneBuf<'p>, PlaneBuf<'p>, PlaneBuf<'p>)>; 8]> {23298 fn planes(&self) -> Result<&[Option<(PlaneBuf<'p>, PlaneBuf<'p>, PlaneBuf<'p>)>; 8]> {
@@ -23287,6 +23318,37 @@ impl<'p> RefPix<'p> {
23287 }23318 }
23288 }23319 }
23289 23320
23321+/// This slot's picture SIZE, with [`ref_planes`]' own error when the slot
23322+/// carries no usable picture -- `dims` is `None` exactly when `planes()`
23323+/// would have nothing there, so the parse thread keeps refusing the same
23324+/// streams at the same block WITHOUT waiting for a producer's pixels
23325+/// (lane-defer8).
23326+fn ref_dims(ref_frame: i8, refpix: &RefPix<'_>) -> Result<(usize, usize)> {
23327+ refpix.dims(ref_frame).ok_or_else(|| {
23328+ unsupported(
23329+ "a reference frame selected with no picture at this frame's own \
23330+ ref_frame_idx slot for it",
23331+ )
23332+ })
23333+}
23334+
23335+/// [`ref_planes`] from inside a DEFERRED prediction, where there is no `?`
23336+/// to take: the error is parked on the [`RefPix`] and taken by the frame
23337+/// decoder once the workers are joined ([`RefPix::take_err`]). The block's
23338+/// prediction is left zeroed -- the frame is failing either way.
23339+fn ref_planes_deferred<'a, 'p>(
23340+ ref_frame: i8,
23341+ refpix: &'a RefPix<'p>,
23342+) -> Option<(&'a PlaneBuf<'p>, &'a PlaneBuf<'p>, &'a PlaneBuf<'p>)> {
23343+ match ref_planes(ref_frame, refpix) {
23344+ Ok(planes) => Some(planes),
23345+ Err(e) => {
23346+ refpix.park_err(e);
23347+ None
23348+ }
23349+ }
23350+}
23351+
23290 /// A whole reference plane as a [`PlaneBuf`]: no tile window, no margin.23352 /// A whole reference plane as a [`PlaneBuf`]: no tile window, no margin.
23291 fn whole_plane(data: &[u16], width: usize, height: usize) -> PlaneBuf<'_> {23353 fn whole_plane(data: &[u16], width: usize, height: usize) -> PlaneBuf<'_> {
23292 PlaneBuf {23354 PlaneBuf {
@@ -24012,7 +24074,7 @@ nbmv=({},{}) nbref={} nbbsize={} filt={}",
24012 /// how many bordering blocks actually get blended, separate from the24074 /// how many bordering blocks actually get blended, separate from the
24013 /// eligibility scan's own unbounded ("any at all") walk.24075 /// eligibility scan's own unbounded ("any at all") walk.
24014 #[allow(clippy::too_many_arguments)]24076 #[allow(clippy::too_many_arguments)]
24015-fn obmc_blend(24077+fn obmc_plan(
24016 grid: &MiGrid,24078 grid: &MiGrid,
24017 neighbours: &Neighbours,24079 neighbours: &Neighbours,
24018 mi_row: usize,24080 mi_row: usize,
@@ -24037,10 +24099,7 @@ fn obmc_blend(
24037 // `av1_setup_build_prediction_by_above_pred` passing that ref's own24099 // `av1_setup_build_prediction_by_above_pred` passing that ref's own
24038 // `scale_factors`).24100 // `scale_factors`).
24039 frame_width: usize,24101 frame_width: usize,
24040- pred_y: &mut [u16],24102+) -> Result<ObmcPlan> {
24041- pred_u: &mut [u16],
24042- pred_v: &mut [u16], fctx: &crate::decode::FrameCtx,
24043-) -> Result<()> {
24044 // lane-rect r2 (libaom av1_build_obmc_inter_prediction): each pass has24103 // lane-rect r2 (libaom av1_build_obmc_inter_prediction): each pass has
24045 // its OWN neighbour cap (width-log2 for above, height-log2 for left) and24104 // its OWN neighbour cap (width-log2 for above, height-log2 for left) and
24046 // overlap (bh/2 rows above, bw/2 cols left) -- one square `side` was24105 // overlap (bh/2 rows above, bw/2 cols left) -- one square `side` was
@@ -24060,31 +24119,151 @@ fn obmc_blend(
24060 5..=8 => 3,24119 5..=8 => 3,
24061 _ => 4,24120 _ => 4,
24062 };24121 };
24063- // lane-inter4 r4: r3 refused OBMC on a 16x8/8x16 leaf (5302 luma pixels24122+ // lane-inter4 r4: r3 refused OBMC on a 16x8/8x16 leaf; re-measured
24064- // of one frame wrong). Re-measured on this tree with an `EC_OBMC` rung in24123+ // byte-exact against an instrumented aomdec, the refusal is gone and the
24065- // both decoders on that exact stream: the neighbour lists agree entry for24124+ // counter below is what the gate's `--enable-obmc=1` arm reads.
24066- // entry (position, span, mv, ref, size, filter) and all six pre-filter
24067- // frames are byte-identical to the instrumented aomdec's. The refusal is
24068- // gone; the counter below is what the gate's `--enable-obmc=1` arm reads.
24069- // The only decode-path change between r3's measurement and this one is the
24070- // lane-interbis merge (`build_motion_field`'s compound slot walk), which
24071- // moves temporal MV candidates -- not bisected further.
24072 if matches!((write_w, write_h), (16, 8) | (8, 16)) {24125 if matches!((write_w, write_h), (16, 8) | (8, 16)) {
24073 OBMC_RECT_LEAF_HITS.with(|c| c.set(c.get() + 1));24126 OBMC_RECT_LEAF_HITS.with(|c| c.set(c.get() + 1));
24074 }24127 }
24075 // lane-sb128c r1: libaom caps the overlap strip at a 64x64 block's own24128 // lane-sb128c r1: libaom caps the overlap strip at a 64x64 block's own
24076- // half (`reconinter.c` 860/899: `AOMMIN(block_size_high[bsize],24129+ // half (`reconinter.c` 860/899), inert below 128.
24077- // block_size_high[BLOCK_64X64]) >> 1`, and the `block_size_wide` mirror) --
24078- // inert below 128, where a 128x128 block would otherwise blend a 64-row
24079- // strip `obmc_mask` has no table for.
24080 let overlap_above = write_h.min(64) / 2;24130 let overlap_above = write_h.min(64) / 2;
24081 let overlap_left = write_w.min(64) / 2;24131 let overlap_left = write_w.min(64) / 2;
24082 // lane-inter8 r1 / lane-scaledref r1: `av1_skip_u4x4_pred_in_obmc`24132 // lane-inter8 r1 / lane-scaledref r1: `av1_skip_u4x4_pred_in_obmc`
24083- // (`reconinter.c` 820, `DISABLE_CHROMA_U8X8_OBMC == 0` -- "one-sided24133+ // (`reconinter.c` 820) returns `dir == 0` when the chroma plane's own
24084- // obmc") returns `dir == 0` when the chroma plane's own block is24134+ // block is BLOCK_4X4/8X4/4X8 (an 8x8, 16x8 or 8x16 luma block at 4:2:0):
24085- // BLOCK_4X4/8X4/4X8 (an 8x8, 16x8 or 8x16 luma block at 4:2:0): the24135+ // the ABOVE pass skips chroma entirely, the LEFT pass still blends it.
24086- // ABOVE pass skips chroma entirely, the LEFT pass still blends it.
24087 let skip_chroma_above = matches!((write_w, write_h), (8, 8) | (16, 8) | (8, 16));24136 let skip_chroma_above = matches!((write_w, write_h), (8, 8) | (16, 8) | (8, 16));
24137+ let mut above = Vec::new();
24138+ for (off4, span4, nb, src4) in overlappable_above(grid, mi_row, mi_col, bw4, mi_cols, max_nb(bw4))
24139+ {
24140+ // `Neighbours::above_filter` is indexed in `SUB`(16px)-wide columns,
24141+ // one step coarser than the mi(4px) units `overlappable_above` walks
24142+ // in -- divide back down to that column. lane-gmaffine r2: the
24143+ // neighbour's OWN mi-granular filter (libaom
24144+ // `av1_setup_build_prediction_by_above_pred` reads
24145+ // `above_mbmi->interp_filters`).
24146+ let above_syms = neighbours.above_filter[mi_col + src4];
24147+ obmcrec_probe(
24148+ "above", mi_row, mi_col, write_w, write_h, off4, span4, &nb, above_syms,
24149+ grid.get(mi_row - 1, mi_col + src4), interp_fixed.is_some(),
24150+ );
24151+ let (h_kind, v_kind) = neighbour_filter(interp_fixed, above_syms)?;
24152+ ec_obmc_trace("above", mi_row, mi_col, write_w, write_h, off4, span4, &nb, h_kind, v_kind);
24153+ let (nb_width, _) = ref_dims(nb.ref_frame, refpix)?;
24154+ if mi_col + off4 + span4 > mi_cols {
24155+ OBMC_EDGE_SPAN_HITS.with(|c| c.set(c.get() + 1));
24156+ }
24157+ above.push(ObmcNb {
24158+ off4,
24159+ span4,
24160+ mv: mv32(nb.mv),
24161+ ref_frame: nb.ref_frame,
24162+ h_kind,
24163+ v_kind,
24164+ scale: mc::scale_factor(nb_width, frame_width),
24165+ });
24166+ }
24167+ let mut left = Vec::new();
24168+ for (off4, span4, nb, src4) in overlappable_left(grid, mi_row, mi_col, bh4, mi_rows, max_nb(bh4))
24169+ {
24170+ let left_syms = neighbours.left_filter[mi_row + src4];
24171+ obmcrec_probe(
24172+ "left", mi_row, mi_col, write_w, write_h, off4, span4, &nb, left_syms,
24173+ grid.get(mi_row + src4, mi_col - 1), interp_fixed.is_some(),
24174+ );
24175+ let (h_kind, v_kind) = neighbour_filter(interp_fixed, left_syms)?;
24176+ ec_obmc_trace("left", mi_row, mi_col, write_w, write_h, off4, span4, &nb, h_kind, v_kind);
24177+ let (nb_width, _) = ref_dims(nb.ref_frame, refpix)?;
24178+ if mi_row + off4 + span4 > mi_rows {
24179+ OBMC_EDGE_SPAN_HITS.with(|c| c.set(c.get() + 1));
24180+ }
24181+ left.push(ObmcNb {
24182+ off4,
24183+ span4,
24184+ mv: mv32(nb.mv),
24185+ ref_frame: nb.ref_frame,
24186+ h_kind,
24187+ v_kind,
24188+ scale: mc::scale_factor(nb_width, frame_width),
24189+ });
24190+ }
24191+ Ok(ObmcPlan {
24192+ above,
24193+ left,
24194+ side,
24195+ chroma_side,
24196+ write_w,
24197+ write_h,
24198+ px,
24199+ py,
24200+ cpx,
24201+ cpy,
24202+ overlap_above,
24203+ overlap_left,
24204+ skip_chroma_above,
24205+ })
24206+}
24207+
24208+/// One OBMC neighbour as the PARSE thread resolved it (lane-defer8): every
24209+/// value [`obmc_run`] needs that lives in the mode-info grid or the
24210+/// neighbour bands, which the parse keeps overwriting as it walks on.
24211+struct ObmcNb {
24212+ off4: usize,
24213+ span4: usize,
24214+ mv: (i32, i32),
24215+ ref_frame: i8,
24216+ h_kind: mc::InterpFilterKind,
24217+ v_kind: mc::InterpFilterKind,
24218+ /// spec 7.11.3.3's `x_scale_fp` for THIS neighbour's own reference.
24219+ scale: i64,
24220+}
24221+
24222+/// [`obmc_plan`]'s result: the two neighbour passes plus this block's own
24223+/// geometry, everything [`obmc_run`] reads apart from reference PIXELS.
24224+pub(crate) struct ObmcPlan {
24225+ above: Vec<ObmcNb>,
24226+ left: Vec<ObmcNb>,
24227+ side: usize,
24228+ chroma_side: usize,
24229+ write_w: usize,
24230+ write_h: usize,
24231+ px: usize,
24232+ py: usize,
24233+ cpx: usize,
24234+ cpy: usize,
24235+ overlap_above: usize,
24236+ overlap_left: usize,
24237+ skip_chroma_above: bool,
24238+}
24239+
24240+/// The reference-pixel half of OBMC: re-predicts every planned neighbour
24241+/// over this block's own edge strips and blends it into the prediction
24242+/// (libaom `av1_build_obmc_inter_prediction`). Reads nothing but reference
24243+/// pixels and the plan, so it runs wherever the block's prediction is built
24244+/// -- on a recon worker when that prediction is deferred (lane-defer8).
24245+fn obmc_run(
24246+ plan: &ObmcPlan,
24247+ refpix: &RefPix<'_>,
24248+ pred_y: &mut [u16],
24249+ pred_u: &mut [u16],
24250+ pred_v: &mut [u16],
24251+ fctx: &crate::decode::FrameCtx,
24252+) {
24253+ let &ObmcPlan {
24254+ side,
24255+ chroma_side,
24256+ write_w,
24257+ write_h,
24258+ px,
24259+ py,
24260+ cpx,
24261+ cpy,
24262+ overlap_above,
24263+ overlap_left,
24264+ skip_chroma_above,
24265+ ..
24266+ } = plan;
24088 // lane-alloc: one neighbour-prediction buffer per plane for the whole24267 // lane-alloc: one neighbour-prediction buffer per plane for the whole
24089 // block, reused by every neighbour of the above and left passes.24268 // block, reused by every neighbour of the above and left passes.
24090 let (mut tmp_y, mut tmp_u, mut tmp_v) = (Vec::new(), Vec::new(), Vec::new());24269 let (mut tmp_y, mut tmp_u, mut tmp_v) = (Vec::new(), Vec::new(), Vec::new());
@@ -24122,74 +24301,41 @@ fn obmc_blend(
24122 eprintln!("OUR_MCB prerow{r}: {row:?}");24301 eprintln!("OUR_MCB prerow{r}: {row:?}");
24123 }24302 }
24124 }24303 }
24125- for (off4, span4, nb, src4) in overlappable_above(grid, mi_row, mi_col, bw4, mi_cols, max_nb(bw4))24304+ for nb in &plan.above {
24126- {24305+ let Some((ny, nu, nv)) = ref_planes_deferred(nb.ref_frame, refpix) else {
24127- // `Neighbours::above_filter` is indexed in `SUB`(16px)-wide columns24306+ return;
24128- // (this decoder's own outer block-loop granularity), one step24307+ };
24129- // coarser than the mi(4px) units `overlappable_above` walks in --24308+ let (bw, bh, ox) = (nb.span4 * 4, overlap_above, nb.off4 * 4);
24130- // divide back down to that column.
24131- // lane-gmaffine r2: the neighbour's OWN mi-granular filter
24132- // (libaom `av1_setup_build_prediction_by_above_pred` reads
24133- // `above_mbmi->interp_filters`); the 16px-granular `Neighbours` slot
24134- // stays as the fallback for paths that do not record one yet
24135- // (compound), which is what every earlier round used.
24136- let above_syms = neighbours.above_filter[mi_col + src4];
24137- obmcrec_probe(
24138- "above", mi_row, mi_col, write_w, write_h, off4, span4, &nb, above_syms,
24139- grid.get(mi_row - 1, mi_col + src4), interp_fixed.is_some(),
24140- );
24141- let (h_kind, v_kind) = neighbour_filter(interp_fixed, above_syms)?;
24142- ec_obmc_trace("above", mi_row, mi_col, write_w, write_h, off4, span4, &nb, h_kind, v_kind);
24143- let (ny, nu, nv) = ref_planes(nb.ref_frame, refpix)?;
24144- let nb_scale = mc::scale_factor(ny.width, frame_width);
24145- if mi_col + off4 + span4 > mi_cols {
24146- OBMC_EDGE_SPAN_HITS.with(|c| c.set(c.get() + 1));
24147- }
24148- let (bw, bh, ox) = (span4 * 4, overlap_above, off4 * 4);
24149 // lane-t900 r14: the prediction is `op_mi_size` wide (kernel choice24309 // lane-t900 r14: the prediction is `op_mi_size` wide (kernel choice
24150 // included); only the WRITE is clipped to this block's own buffer.24310 // included); only the WRITE is clipped to this block's own buffer.
24151- obmc_neighbour_pred(ny, px + ox, py, mv32(nb.mv), bw, bh, true, h_kind, v_kind, nb_scale, &mut tmp_y, fctx);24311+ obmc_neighbour_pred(ny, px + ox, py, nb.mv, bw, bh, true, nb.h_kind, nb.v_kind, nb.scale, &mut tmp_y, fctx);
24152 obmc_blend_v(pred_y, side, ox, 0, bw.min(write_w - ox), bh, bw, &tmp_y);24312 obmc_blend_v(pred_y, side, ox, 0, bw.min(write_w - ox), bh, bw, &tmp_y);
24153 if !skip_chroma_above {24313 if !skip_chroma_above {
24154 // lane-t900 r13 (measured, NOT a defect): libaom's min-4 clamp24314 // lane-t900 r13 (measured, NOT a defect): libaom's min-4 clamp
24155- // (`dec_build_prediction_by_above_pred`) sizes only the OBMC24315+ // sizes only the OBMC PREDICTION buffer; the blend length is the
24156- // PREDICTION buffer; the blend length is the plain half24316+ // plain half (`build_obmc_inter_pred_above`: `overlap >> ss_y`).
24157- // (`build_obmc_inter_pred_above`: `overlap >> ss_y`), so flooring
24158- // this at 4 blends rows libaom never blends -- on a 10-bit
24159- // 1920x792 cut that went 36 differing frames -> 266, worst
24160- // 13 B -> 11007 B.
24161 let (cbw, cbh, cox) = (bw / 2, overlap_above / 2, ox / 2);24317 let (cbw, cbh, cox) = (bw / 2, overlap_above / 2, ox / 2);
24162 let cw = cbw.min(write_w / 2 - cox);24318 let cw = cbw.min(write_w / 2 - cox);
24163- obmc_neighbour_pred(nu, cpx + cox, cpy, mv32(nb.mv), cbw, cbh, false, h_kind, v_kind, nb_scale, &mut tmp_u, fctx);24319+ obmc_neighbour_pred(nu, cpx + cox, cpy, nb.mv, cbw, cbh, false, nb.h_kind, nb.v_kind, nb.scale, &mut tmp_u, fctx);
24164 obmc_blend_v(pred_u, chroma_side, cox, 0, cw, cbh, cbw, &tmp_u);24320 obmc_blend_v(pred_u, chroma_side, cox, 0, cw, cbh, cbw, &tmp_u);
24165- obmc_neighbour_pred(nv, cpx + cox, cpy, mv32(nb.mv), cbw, cbh, false, h_kind, v_kind, nb_scale, &mut tmp_v, fctx);24321+ obmc_neighbour_pred(nv, cpx + cox, cpy, nb.mv, cbw, cbh, false, nb.h_kind, nb.v_kind, nb.scale, &mut tmp_v, fctx);
24166 obmc_blend_v(pred_v, chroma_side, cox, 0, cw, cbh, cbw, &tmp_v);24322 obmc_blend_v(pred_v, chroma_side, cox, 0, cw, cbh, cbw, &tmp_v);
24167 }24323 }
24168 }24324 }
24169 24325
24170- for (off4, span4, nb, src4) in overlappable_left(grid, mi_row, mi_col, bh4, mi_rows, max_nb(bh4))24326+ for nb in &plan.left {
24171- {24327+ let Some((ny, nu, nv)) = ref_planes_deferred(nb.ref_frame, refpix) else {
24172- let left_syms = neighbours.left_filter[mi_row + src4];24328+ return;
24173- obmcrec_probe(24329+ };
24174- "left", mi_row, mi_col, write_w, write_h, off4, span4, &nb, left_syms,24330+ let (bw, bh, oy) = (overlap_left, nb.span4 * 4, nb.off4 * 4);
24175- grid.get(mi_row + src4, mi_col - 1), interp_fixed.is_some(),24331+ obmc_neighbour_pred(ny, px, py + oy, nb.mv, bw, bh, true, nb.h_kind, nb.v_kind, nb.scale, &mut tmp_y, fctx);
24176- );
24177- let (h_kind, v_kind) = neighbour_filter(interp_fixed, left_syms)?;
24178- ec_obmc_trace("left", mi_row, mi_col, write_w, write_h, off4, span4, &nb, h_kind, v_kind);
24179- let (ny, nu, nv) = ref_planes(nb.ref_frame, refpix)?;
24180- let nb_scale = mc::scale_factor(ny.width, frame_width);
24181- if mi_row + off4 + span4 > mi_rows {
24182- OBMC_EDGE_SPAN_HITS.with(|c| c.set(c.get() + 1));
24183- }
24184- let (bw, bh, oy) = (overlap_left, span4 * 4, off4 * 4);
24185- obmc_neighbour_pred(ny, px, py + oy, mv32(nb.mv), bw, bh, true, h_kind, v_kind, nb_scale, &mut tmp_y, fctx);
24186 obmc_blend_h(pred_y, side, 0, oy, bw, bh.min(write_h - oy), &tmp_y);24332 obmc_blend_h(pred_y, side, 0, oy, bw, bh.min(write_h - oy), &tmp_y);
24187 let (cbw, cbh, coy) = (overlap_left / 2, bh / 2, oy / 2);24333 let (cbw, cbh, coy) = (overlap_left / 2, bh / 2, oy / 2);
24188- obmc_neighbour_pred(nu, cpx, cpy + coy, mv32(nb.mv), cbw, cbh, false, h_kind, v_kind, nb_scale, &mut tmp_u, fctx);24334+ obmc_neighbour_pred(nu, cpx, cpy + coy, nb.mv, cbw, cbh, false, nb.h_kind, nb.v_kind, nb.scale, &mut tmp_u, fctx);
24189 if let Some((_, _, idx)) = ec_mcb {24335 if let Some((_, _, idx)) = ec_mcb {
24190 eprintln!(24336 eprintln!(
24191- "OUR_MCB left f={idx} off4={off4} span4={span4} cbw={cbw} cbh={cbh} coy={coy} mv=({},{}) ref0={}",24337+ "OUR_MCB left f={idx} off4={} span4={} cbw={cbw} cbh={cbh} coy={coy} mv=({},{}) ref0={}",
24192- nb.mv.0, nb.mv.1, nb.ref_frame24338+ nb.off4, nb.span4, nb.mv.0, nb.mv.1, nb.ref_frame
24193 );24339 );
24194 for r in 0..cbh {24340 for r in 0..cbh {
24195 let row: Vec<u16> = (0..cbw).map(|c| tmp_u[r * cbw + c]).collect();24341 let row: Vec<u16> = (0..cbw).map(|c| tmp_u[r * cbw + c]).collect();
@@ -24198,7 +24344,7 @@ fn obmc_blend(
24198 }24344 }
24199 let ch = cbh.min(write_h / 2 - coy);24345 let ch = cbh.min(write_h / 2 - coy);
24200 obmc_blend_h(pred_u, chroma_side, 0, coy, cbw, ch, &tmp_u);24346 obmc_blend_h(pred_u, chroma_side, 0, coy, cbw, ch, &tmp_u);
24201- obmc_neighbour_pred(nv, cpx, cpy + coy, mv32(nb.mv), cbw, cbh, false, h_kind, v_kind, nb_scale, &mut tmp_v, fctx);24347+ obmc_neighbour_pred(nv, cpx, cpy + coy, nb.mv, cbw, cbh, false, nb.h_kind, nb.v_kind, nb.scale, &mut tmp_v, fctx);
24202 obmc_blend_h(pred_v, chroma_side, 0, coy, cbw, ch, &tmp_v);24348 obmc_blend_h(pred_v, chroma_side, 0, coy, cbw, ch, &tmp_v);
24203 }24349 }
24204 if let Some((_, _, idx)) = ec_mcb {24350 if let Some((_, _, idx)) = ec_mcb {
@@ -24207,7 +24353,6 @@ fn obmc_blend(
24207 eprintln!("OUR_MCB post f={idx} row{r}: {row:?}");24353 eprintln!("OUR_MCB post f={idx} row{r}: {row:?}");
24208 }24354 }
24209 }24355 }
24210- Ok(())
24211 }24356 }
24212 24357
24213 /// `is_any_masked_compound_used` (libaom `reconinter.h`), specialised to24358 /// `is_any_masked_compound_used` (libaom `reconinter.h`), specialised to
@@ -25027,8 +25172,8 @@ fn decode_inter_block(
25027 if gm_nontrans_models && !gm_nontrans {25172 if gm_nontrans_models && !gm_nontrans {
25028 GM_NONTRANS_SMALL_SIDE_HITS.with(|c| c.set(c.get() + 1));25173 GM_NONTRANS_SMALL_SIDE_HITS.with(|c| c.set(c.get() + 1));
25029 }25174 }
25030- let (py0, pu0, pv0) = ref_planes(ref0, refpix)?;25175+ // lane-defer8: both slots' pictures are resolved inside the
25031- let (py1, pu1, pv1) = ref_planes(ref1, refpix)?;25176+ // prediction closure; the parse only needs their SIZES.
25032 // lane-cwarp r1: `is_global_mv_block` (blockd.h:421-429) is25177 // lane-cwarp r1: `is_global_mv_block` (blockd.h:421-429) is
25033 // PER REFERENCE SLOT -- mode GLOBAL_GLOBALMV, block >= 8x8, and25178 // PER REFERENCE SLOT -- mode GLOBAL_GLOBALMV, block >= 8x8, and
25034 // THAT slot's own gm model > TRANSLATION. `bw4`/`bh4` come from25179 // THAT slot's own gm model > TRANSLATION. `bw4`/`bh4` come from
@@ -25070,10 +25215,9 @@ fn decode_inter_block(
25070 // scaled (superres) is predicted translationally while its25215 // scaled (superres) is predicted translationally while its
25071 // sibling may still warp.25216 // sibling may still warp.
25072 let ref_unscaled = |rf: i8| {25217 let ref_unscaled = |rf: i8| {
25073- ref_planes(rf, refpix)25218+ refpix
25074- .is_ok_and(|(py, _, _)| {25219+ .dims(rf)
25075- mc::scale_factor(py.width, frame_width) == mc::REF_NO_SCALE25220+ .is_some_and(|(w, _)| mc::scale_factor(w, frame_width) == mc::REF_NO_SCALE)
25076- })
25077 };25221 };
25078 let warp0 = compound_warp(ref0, is_global_mv0).filter(|_| ref_unscaled(ref0));25222 let warp0 = compound_warp(ref0, is_global_mv0).filter(|_| ref_unscaled(ref0));
25079 let warp1 = compound_warp(ref1, is_global_mv1).filter(|_| ref_unscaled(ref1));25223 let warp1 = compound_warp(ref1, is_global_mv1).filter(|_| ref_unscaled(ref1));
@@ -25495,8 +25639,8 @@ fn decode_inter_block(
25495 // different ratios in the same block. `REF_NO_SCALE` reduces25639 // different ratios in the same block. `REF_NO_SCALE` reduces
25496 // `predict_compound_intermediate`'s walk to the ordinary25640 // `predict_compound_intermediate`'s walk to the ordinary
25497 // stride-1 one, so the unscaled case is unchanged.25641 // stride-1 one, so the unscaled case is unchanged.
25498- let scale0 = mc::scale_factor(py0.width, frame_width);25642+ let scale0 = mc::scale_factor(ref_dims(ref0, refpix)?.0, frame_width);
25499- let scale1 = mc::scale_factor(py1.width, frame_width);25643+ let scale1 = mc::scale_factor(ref_dims(ref1, refpix)?.0, frame_width);
25500 if scale0 != mc::REF_NO_SCALE || scale1 != mc::REF_NO_SCALE {25644 if scale0 != mc::REF_NO_SCALE || scale1 != mc::REF_NO_SCALE {
25501 SCALED_COMPOUND_HITS.with(|c| c.set(c.get() + 1));25645 SCALED_COMPOUND_HITS.with(|c| c.set(c.get() + 1));
25502 }25646 }
@@ -25519,6 +25663,11 @@ fn decode_inter_block(
25519 _v: &mut PlaneBuf<'static>,25663 _v: &mut PlaneBuf<'static>,
25520 fctx: &crate::decode::FrameCtx,25664 fctx: &crate::decode::FrameCtx,
25521 out: &mut [Vec<u16>; 3]| {25665 out: &mut [Vec<u16>; 3]| {
25666+ let (Some((py0, pu0, pv0)), Some((py1, pu1, pv1))) =
25667+ (ref_planes_deferred(ref0, refpix), ref_planes_deferred(ref1, refpix))
25668+ else {
25669+ return;
25670+ };
25522 let mut inter0_y = vec![0i32; side * side];25671 let mut inter0_y = vec![0i32; side * side];
25523 mc::predict_compound_intermediate_kern(25672 mc::predict_compound_intermediate_kern(
25524 &py0.data,25673 &py0.data,
@@ -26151,7 +26300,10 @@ fn decode_inter_block(
26151 // below same as every other non-`LAST_FRAME` reference. lane-av1refs26300 // below same as every other non-`LAST_FRAME` reference. lane-av1refs
26152 // widens this from GOLDEN alone to every reference `read_single_ref`26301 // widens this from GOLDEN alone to every reference `read_single_ref`
26153 // can name.26302 // can name.
26154- let (py_ref, pu_ref, pv_ref) = ref_planes(ref_frame, refpix)?;26303+ // lane-defer8: SIZE here (spec 7.11.3.3's scale factor), pixels
26304+ // inside the prediction closure -- the parse thread of a threaded
26305+ // decode must never wait on a reference picture.
26306+ let (ref_width, _) = ref_dims(ref_frame, refpix)?;
26155 26307
26156 let (mi_row, mi_col) = (rmi, cmi);26308 let (mi_row, mi_col) = (rmi, cmi);
26157 // lane-rect r2: the mv stack must be queried with the block's26309 // lane-rect r2: the mv stack must be queried with the block's
@@ -26487,7 +26639,7 @@ fn decode_inter_block(
26487 // picture whose height does not match this frame's own true26639 // picture whose height does not match this frame's own true
26488 // size", ~14681). Whoever lifts that refusal adds the y term.26640 // size", ~14681). Whoever lifts that refusal adds the y term.
26489 let ref_is_scaled =26641 let ref_is_scaled =
26490- mc::scale_factor(py_ref.width, frame_width) != mc::REF_NO_SCALE;26642+ mc::scale_factor(ref_width, frame_width) != mc::REF_NO_SCALE;
26491 let proj_ok = num_proj_ref(26643 let proj_ok = num_proj_ref(
26492 grid,26644 grid,
26493 mi_row,26645 mi_row,
@@ -26701,7 +26853,7 @@ fn decode_inter_block(
26701 // by name instead of silently sampling a scaled reference wrong26853 // by name instead of silently sampling a scaled reference wrong
26702 // (warp_params/obmc_selected/interintra_mode are all resolved by26854 // (warp_params/obmc_selected/interintra_mode are all resolved by
26703 // this point, every symbol for this block already read).26855 // this point, every symbol for this block already read).
26704- let luma_scale = mc::scale_factor(py_ref.width, frame_width);26856+ let luma_scale = mc::scale_factor(ref_width, frame_width);
26705 if luma_scale != mc::REF_NO_SCALE {26857 if luma_scale != mc::REF_NO_SCALE {
26706 // lane-scaledref r1: libaom `allow_warp`26858 // lane-scaledref r1: libaom `allow_warp`
26707 // (av1/common/reconinter.c:41) suppresses BOTH local and26859 // (av1/common/reconinter.c:41) suppresses BOTH local and
@@ -26727,8 +26879,23 @@ fn decode_inter_block(
26727 // (reconinter_template.inc:75-82); record them for the next 1:426879 // (reconinter_template.inc:75-82); record them for the next 1:4
26728 // strip, which is the only reader.26880 // strip, which is the only reader.
26729 fctx.inter_last_mc.with(|c| c.set(Some((ref_frame, mv, h_filter, v_filter))));26881 fctx.inter_last_mc.with(|c| c.set(Some((ref_frame, mv, h_filter, v_filter))));
26730- let sub8_piece =26882+ // lane-defer8: the sub-8x8 chroma piece's own reference resolved to
26731- strip_chroma.filter(|s| s.has_chroma).and_then(|s| s.prev).is_some();26883+ // a SIZE here and to pixels inside the closure, like the block's own.
26884+ let sub8 = match strip_chroma.filter(|s| s.has_chroma).and_then(|s| s.prev.map(|p| (s.horz, p))) {
26885+ Some((horz, (prev_ref, prev_mv, prev_h, prev_v))) => {
26886+ let (prev_width, _) = ref_dims(prev_ref, refpix)?;
26887+ INTER16_SUB8_PIECE_HITS.with(|c| c.set(c.get() + 1));
26888+ Some((
26889+ horz,
26890+ prev_ref,
26891+ prev_mv,
26892+ prev_h,
26893+ prev_v,
26894+ mc::scale_factor(prev_width, frame_width),
26895+ ))
26896+ }
26897+ None => None,
26898+ };
26732 // lane-wave4: the whole-block prediction (motion compensation +26899 // lane-wave4: the whole-block prediction (motion compensation +
26733 // warp + the interintra blend) as a closure, so it runs where the26900 // warp + the interintra blend) as a closure, so it runs where the
26734 // writes it feeds run. At one reconstruction thread that is right26901 // writes it feeds run. At one reconstruction thread that is right
@@ -26737,11 +26904,42 @@ fn decode_inter_block(
26737 // ([`push_pred`]), which is what takes mc off the parse thread.26904 // ([`push_pred`]), which is what takes mc off the parse thread.
26738 // OBMC and the sub-8x8 chroma piece stay here: both can fail, and26905 // OBMC and the sub-8x8 chroma piece stay here: both can fail, and
26739 // a recorded op has no way to report it.26906 // a recorded op has no way to report it.
26907+ // lane-defer8: OBMC's neighbour walk reads the mode-info grid and
26908+ // the neighbour bands, both of which the parse keeps rewriting --
26909+ // so the walk happens here and the blend inside the closure.
26910+ let obmc = if obmc_selected {
26911+ Some(obmc_plan(
26912+ grid,
26913+ neighbours,
26914+ mi_row,
26915+ mi_col,
26916+ bw4,
26917+ bh4,
26918+ mi_rows as usize,
26919+ mi_cols as usize,
26920+ side,
26921+ write_w,
26922+ write_h,
26923+ chroma_side,
26924+ px,
26925+ py,
26926+ cpx,
26927+ cpy,
26928+ refpix,
26929+ interp_fixed,
26930+ frame_width,
26931+ )?)
26932+ } else {
26933+ None
26934+ };
26740 let build = move |y: &mut PlaneBuf<'static>,26935 let build = move |y: &mut PlaneBuf<'static>,
26741 u: &mut PlaneBuf<'static>,26936 u: &mut PlaneBuf<'static>,
26742 v: &mut PlaneBuf<'static>,26937 v: &mut PlaneBuf<'static>,
26743 fctx: &crate::decode::FrameCtx,26938 fctx: &crate::decode::FrameCtx,
26744 out: &mut [Vec<u16>; 3]| {26939 out: &mut [Vec<u16>; 3]| {
26940+ let Some((py_ref, pu_ref, pv_ref)) = ref_planes_deferred(ref_frame, refpix) else {
26941+ return;
26942+ };
26745 let mut pred_y = refill(std::mem::take(&mut out[0]), side * side);26943 let mut pred_y = refill(std::mem::take(&mut out[0]), side * side);
26746 let mut pred_u = refill(std::mem::take(&mut out[1]), chroma_side * chroma_side);26944 let mut pred_u = refill(std::mem::take(&mut out[1]), chroma_side * chroma_side);
26747 let mut pred_v = refill(std::mem::take(&mut out[2]), chroma_side * chroma_side);26945 let mut pred_v = refill(std::mem::take(&mut out[2]), chroma_side * chroma_side);
@@ -26901,14 +27099,56 @@ fn decode_inter_block(
26901 &mut pred_v, fctx,27099 &mut pred_v, fctx,
26902 );27100 );
26903 }27101 }
27102+ if let Some(plan) = &obmc {
27103+ obmc_run(plan, refpix, &mut pred_y, &mut pred_u, &mut pred_v, fctx);
27104+ }
27105+ // lane-inter16ab r2: libaom `build_inter_predictors_sub8x8`
27106+ // (reconinter_template.inc:87-160). A 4:2:0 chroma block under a
27107+ // 16x4 (4x16) luma pair covers TWO luma blocks, so it is built in
27108+ // `b4_w x b4_h` = 8x2 (2x8) pieces, each from its own strip's
27109+ // mv/ref/filters. The bottom (right) piece is this strip's own mv
27110+ // over its own rows, which the whole-block prediction above
27111+ // already wrote there (MC is position-invariant for a fixed mv),
27112+ // so only the FIRST piece has to be rebuilt -- and only when
27113+ // `is_sub8x8_inter` holds. lane-t900 r28: it scales off the
27114+ // PREVIOUS strip's own reference, not this block's.
27115+ if let Some((horz, prev_ref, prev_mv, prev_h, prev_v, prev_scale)) = sub8 {
27116+ let Some((_, prev_u, prev_v_plane)) = ref_planes_deferred(prev_ref, refpix) else {
27117+ return;
27118+ };
27119+ let (piece_w, piece_h) = if horz { (8usize, 2usize) } else { (2usize, 8usize) };
27120+ for (src, dst) in [(prev_u, &mut pred_u), (prev_v_plane, &mut pred_v)] {
27121+ let mut piece = vec![0u16; piece_w * piece_h];
27122+ mc::predict_maybe_scaled(
27123+ &src.data,
27124+ src.width,
27125+ src.true_width,
27126+ src.true_height,
27127+ mv_to_q4(cpx, prev_mv.1, false),
27128+ mv_to_q4(cpy, prev_mv.0, false),
27129+ prev_scale,
27130+ piece_w,
27131+ piece_h,
27132+ prev_h,
27133+ prev_v,
27134+ &mut piece, fctx,
27135+ );
27136+ for row in 0..piece_h {
27137+ dst[row * chroma_side..row * chroma_side + piece_w]
27138+ .copy_from_slice(&piece[row * piece_w..(row + 1) * piece_w]);
27139+ }
27140+ }
27141+ }
26904 *out = [pred_y, pred_u, pred_v];27142 *out = [pred_y, pred_u, pred_v];
26905 };27143 };
26906 // OBMC and interintra are mutually exclusive (`motion_mode` is27144 // OBMC and interintra are mutually exclusive (`motion_mode` is
26907 // never read for an interintra block), so blending interintra27145 // never read for an interintra block), so blending interintra
26908 // inside `build` and OBMC after it is still the coded order.27146 // inside `build` and OBMC after it is still the coded order.
26909 debug_assert!(!(obmc_selected && interintra_mode.is_some()));27147 debug_assert!(!(obmc_selected && interintra_mode.is_some()));
26910- let deferred = recon_deferred(fctx) && !obmc_selected && !sub8_piece;27148+ // lane-defer8: OBMC and the sub-8x8 piece now live inside `build`,
26911- let (mut pred_y, mut pred_u, mut pred_v): (Vec<u16>, Vec<u16>, Vec<u16>);27149+ // so nothing about this block keeps its prediction on this thread.
27150+ let deferred = recon_deferred(fctx);
27151+ let (pred_y, pred_u, pred_v): (Vec<u16>, Vec<u16>, Vec<u16>);
26912 let (sy, su, sv) = if deferred {27152 let (sy, su, sv) = if deferred {
26913 // The interintra predictor inside `build` reads this block's27153 // The interintra predictor inside `build` reads this block's
26914 // own above/left edges: by the wavefront rule ((r-1, c+1) and27154 // own above/left edges: by the wavefront rule ((r-1, c+1) and
@@ -26930,32 +27170,6 @@ fn decode_inter_block(
26930 build(y, u, v, fctx, &mut built);27170 build(y, u, v, fctx, &mut built);
26931 let [by, bu, bv] = built;27171 let [by, bu, bv] = built;
26932 (pred_y, pred_u, pred_v) = (by, bu, bv);27172 (pred_y, pred_u, pred_v) = (by, bu, bv);
26933- if obmc_selected {
26934- obmc_blend(
26935- grid,
26936- neighbours,
26937- mi_row,
26938- mi_col,
26939- bw4,
26940- bh4,
26941- mi_rows as usize,
26942- mi_cols as usize,
26943- side,
26944- write_w,
26945- write_h,
26946- chroma_side,
26947- px,
26948- py,
26949- cpx,
26950- cpy,
26951- refpix,
26952- interp_fixed,
26953- frame_width,
26954- &mut pred_y,
26955- &mut pred_u,
26956- &mut pred_v, fctx,
26957- )?;
26958- }
26959 27173
26960 // lane-inter16ab r2: libaom `build_inter_predictors_sub8x8`27174 // lane-inter16ab r2: libaom `build_inter_predictors_sub8x8`
26961 // (reconinter_template.inc:87-160). A 4:2:0 chroma block under a27175 // (reconinter_template.inc:87-160). A 4:2:0 chroma block under a
@@ -26968,40 +27182,6 @@ fn decode_inter_block(
26968 // `is_sub8x8_inter` holds, i.e. the previous strip was itself a27182 // `is_sub8x8_inter` holds, i.e. the previous strip was itself a
26969 // single-reference inter block (`prev`), else libaom falls27183 // single-reference inter block (`prev`), else libaom falls
26970 // through to the ordinary whole-block predictor.27184 // through to the ordinary whole-block predictor.
26971- if let Some(s) = strip_chroma.filter(|s| s.has_chroma)
26972- && let Some((prev_ref, prev_mv, prev_h, prev_v)) = s.prev
26973- {
26974- let (piece_w, piece_h) = if s.horz { (8usize, 2usize) } else { (2usize, 8usize) };
26975- // lane-t900 r28 (same-shape sweep of the sub-8x8 scaled-ref
26976- // lift): this piece used to be SKIPPED when the block's
26977- // reference was scaled, which silently left the whole-block
26978- // prediction in place instead of refusing. It scales off the
26979- // PREVIOUS strip's own reference, not this block's.
26980- let (prev_y_plane, prev_u, prev_v_plane) = ref_planes(prev_ref, refpix)?;
26981- let prev_scale = mc::scale_factor(prev_y_plane.width, frame_width);
26982- for (src, dst) in [(prev_u, &mut pred_u), (prev_v_plane, &mut pred_v)] {
26983- let mut piece = vec![0u16; piece_w * piece_h];
26984- mc::predict_maybe_scaled(
26985- &src.data,
26986- src.width,
26987- src.true_width,
26988- src.true_height,
26989- mv_to_q4(cpx, prev_mv.1, false),
26990- mv_to_q4(cpy, prev_mv.0, false),
26991- prev_scale,
26992- piece_w,
26993- piece_h,
26994- prev_h,
26995- prev_v,
26996- &mut piece, fctx,
26997- );
26998- for row in 0..piece_h {
26999- dst[row * chroma_side..row * chroma_side + piece_w]
27000- .copy_from_slice(&piece[row * piece_w..(row + 1) * piece_w]);
27001- }
27002- }
27003- INTER16_SUB8_PIECE_HITS.with(|c| c.set(c.get() + 1));
27004- }
27005 (27185 (
27006 Pred::Inline(&pred_y, side),27186 Pred::Inline(&pred_y, side),
27007 Pred::Inline(&pred_u, chroma_side),27187 Pred::Inline(&pred_u, chroma_side),
@@ -30394,10 +30574,9 @@ fn decode_inter_block8(
30394 COMPOUND8_FILTER_HITS.with(|c| c.set(c.get() + 1));30574 COMPOUND8_FILTER_HITS.with(|c| c.set(c.get() + 1));
30395 }30575 }
30396 30576
30397- let (py0, pu0, pv0) = ref_planes(ref0, refpix)?;30577+ // lane-defer8: both slots' SIZES at parse, pictures in the closure.
30398- let (py1, pu1, pv1) = ref_planes(ref1, refpix)?;30578+ let scale0 = mc::scale_factor(ref_dims(ref0, refpix)?.0, frame_width);
30399- let scale0 = mc::scale_factor(py0.width, frame_width);30579+ let scale1 = mc::scale_factor(ref_dims(ref1, refpix)?.0, frame_width);
30400- let scale1 = mc::scale_factor(py1.width, frame_width);
30401 if scale0 != mc::REF_NO_SCALE || scale1 != mc::REF_NO_SCALE {30580 if scale0 != mc::REF_NO_SCALE || scale1 != mc::REF_NO_SCALE {
30402 SCALED_COMPOUND_HITS.with(|c| c.set(c.get() + 1));30581 SCALED_COMPOUND_HITS.with(|c| c.set(c.get() + 1));
30403 SCALED_BLOCK8_HITS.with(|c| c.set(c.get() + 1));30582 SCALED_BLOCK8_HITS.with(|c| c.set(c.get() + 1));
@@ -30448,10 +30627,9 @@ fn decode_inter_block8(
30448 // lane-t900 r28: same per-slot `allow_warp` scale bail-out as30627 // lane-t900 r28: same per-slot `allow_warp` scale bail-out as
30449 // the 16x16-and-bigger compound path above.30628 // the 16x16-and-bigger compound path above.
30450 let leaf_ref_unscaled = |rf: i8| {30629 let leaf_ref_unscaled = |rf: i8| {
30451- ref_planes(rf, refpix)30630+ refpix
30452- .is_ok_and(|(py, _, _)| {30631+ .dims(rf)
30453- mc::scale_factor(py.width, frame_width) == mc::REF_NO_SCALE30632+ .is_some_and(|(w, _)| mc::scale_factor(w, frame_width) == mc::REF_NO_SCALE)
30454- })
30455 };30633 };
30456 let warp0_c =30634 let warp0_c =
30457 leaf_compound_warp(ref0, is_global_mv0_c).filter(|_| leaf_ref_unscaled(ref0));30635 leaf_compound_warp(ref0, is_global_mv0_c).filter(|_| leaf_ref_unscaled(ref0));
@@ -30481,6 +30659,19 @@ fn decode_inter_block8(
30481 );30659 );
30482 mode_for_tx = 0;30660 mode_for_tx = 0;
30483 30661
30662+ // lane-defer8: this leaf's whole prediction as a closure, so it runs
30663+ // where its writes run -- on a recon worker at more than one
30664+ // reconstruction thread, exactly like [`decode_inter_block`]'s.
30665+ let build = move |_y: &mut PlaneBuf<'static>,
30666+ _u: &mut PlaneBuf<'static>,
30667+ _v: &mut PlaneBuf<'static>,
30668+ fctx: &crate::decode::FrameCtx,
30669+ out: &mut [Vec<u16>; 3]| {
30670+ let (Some((py0, pu0, pv0)), Some((py1, pu1, pv1))) =
30671+ (ref_planes_deferred(ref0, refpix), ref_planes_deferred(ref1, refpix))
30672+ else {
30673+ return;
30674+ };
30484 let mut inter0_y = vec![0i32; SIDE * SIDE];30675 let mut inter0_y = vec![0i32; SIDE * SIDE];
30485 mc::predict_compound_intermediate(30676 mc::predict_compound_intermediate(
30486 &py0.data,30677 &py0.data,
@@ -30525,7 +30716,7 @@ fn decode_inter_block8(
30525 SIDE as i32, SIDE as i32, 0, 0, fctx,30716 SIDE as i32, SIDE as i32, 0, 0, fctx,
30526 );30717 );
30527 }30718 }
30528- let mut pred_y = vec![0u16; SIDE * SIDE];30719+ let mut pred_y = refill(std::mem::take(&mut out[0]), SIDE * SIDE);
30529 let mut diffwtd_mask_y;30720 let mut diffwtd_mask_y;
30530 let mask_y: Option<&[u8]> = if let Some(mask_type) = diffwtd_mask_type {30721 let mask_y: Option<&[u8]> = if let Some(mask_type) = diffwtd_mask_type {
30531 diffwtd_mask_y = vec![0u8; SIDE * SIDE];30722 diffwtd_mask_y = vec![0u8; SIDE * SIDE];
@@ -30573,7 +30764,7 @@ fn decode_inter_block8(
30573 v_filter,30764 v_filter,
30574 &mut inter1_u,30765 &mut inter1_u,
30575 );30766 );
30576- let mut pred_u = vec![0u16; CHROMA_SIDE * CHROMA_SIDE];30767+ let mut pred_u = refill(std::mem::take(&mut out[1]), CHROMA_SIDE * CHROMA_SIDE);
30577 if let Some(mask_y) = mask_y {30768 if let Some(mask_y) = mask_y {
30578 mc::blend_masked_compound(30769 mc::blend_masked_compound(
30579 &inter0_u,30770 &inter0_u,
@@ -30619,7 +30810,7 @@ fn decode_inter_block8(
30619 v_filter,30810 v_filter,
30620 &mut inter1_v,30811 &mut inter1_v,
30621 );30812 );
30622- let mut pred_v = vec![0u16; CHROMA_SIDE * CHROMA_SIDE];30813+ let mut pred_v = refill(std::mem::take(&mut out[2]), CHROMA_SIDE * CHROMA_SIDE);
30623 if let Some(mask_y) = mask_y {30814 if let Some(mask_y) = mask_y {
30624 mc::blend_masked_compound(30815 mc::blend_masked_compound(
30625 &inter0_v,30816 &inter0_v,
@@ -30635,6 +30826,28 @@ fn decode_inter_block8(
30635 mc::combine_compound(&inter0_v, &inter1_v, fwd_offset, bck_offset, &mut pred_v, fctx);30826 mc::combine_compound(&inter0_v, &inter1_v, fwd_offset, bck_offset, &mut pred_v, fctx);
30636 }30827 }
30637 30828
30829+ *out = [pred_y, pred_u, pred_v];
30830+ };
30831+ let deferred = recon_deferred(fctx);
30832+ let (pred_y, pred_u, pred_v): (Vec<u16>, Vec<u16>, Vec<u16>);
30833+ let (sy, su, sv) = if deferred {
30834+ push_pred(fctx, build);
30835+ (
30836+ Pred::Cur { plane: 0, stride: SIDE, off: 0 },
30837+ Pred::Cur { plane: 1, stride: CHROMA_SIDE, off: 0 },
30838+ Pred::Cur { plane: 2, stride: CHROMA_SIDE, off: 0 },
30839+ )
30840+ } else {
30841+ let mut built: [Vec<u16>; 3] = Default::default();
30842+ build(y, u, v, fctx, &mut built);
30843+ let [by, bu, bv] = built;
30844+ (pred_y, pred_u, pred_v) = (by, bu, bv);
30845+ (
30846+ Pred::Inline(&pred_y, SIDE),
30847+ Pred::Inline(&pred_u, CHROMA_SIDE),
30848+ Pred::Inline(&pred_v, CHROMA_SIDE),
30849+ )
30850+ };
30638 split8 = read_block_tx_size(30851 split8 = read_block_tx_size(
30639 dec,30852 dec,
30640 cdfs,30853 cdfs,
@@ -30648,19 +30861,19 @@ fn decode_inter_block8(
30648 .130861 .1
30649 .is_some();30862 .is_some();
30650 if skip {30863 if skip {
30651- push_mc(0, px, py, SIDE, Pred::dense(&pred_y), &ZERO_RESIDUAL[..SIDE * SIDE], fctx);30864+ push_mc(0, px, py, SIDE, sy, &ZERO_RESIDUAL[..SIDE * SIDE], fctx);
30652 push_mc(1, 30865 push_mc(1,
30653 cpx,30866 cpx,
30654 cpy,30867 cpy,
30655 CHROMA_SIDE,30868 CHROMA_SIDE,
30656- Pred::dense(&pred_u),30869+ su,
30657 &ZERO_RESIDUAL[..CHROMA_SIDE * CHROMA_SIDE], fctx,30870 &ZERO_RESIDUAL[..CHROMA_SIDE * CHROMA_SIDE], fctx,
30658 );30871 );
30659 push_mc(2, 30872 push_mc(2,
30660 cpx,30873 cpx,
30661 cpy,30874 cpy,
30662 CHROMA_SIDE,30875 CHROMA_SIDE,
30663- Pred::dense(&pred_v),30876+ sv,
30664 &ZERO_RESIDUAL[..CHROMA_SIDE * CHROMA_SIDE], fctx,30877 &ZERO_RESIDUAL[..CHROMA_SIDE * CHROMA_SIDE], fctx,
30665 );30878 );
30666 luma_grid = vec![0i32; SIDE * SIDE];30879 luma_grid = vec![0i32; SIDE * SIDE];
@@ -30676,7 +30889,7 @@ fn decode_inter_block8(
30676 y,30889 y,
30677 px,30890 px,
30678 py,30891 py,
30679- Pred::dense(&pred_y),30892+ sy,
30680 mode_for_tx,30893 mode_for_tx,
30681 base_q_idx,30894 base_q_idx,
30682 scan8,30895 scan8,
@@ -30698,7 +30911,7 @@ fn decode_inter_block8(
30698 cpy,30911 cpy,
30699 CHROMA_SIDE,30912 CHROMA_SIDE,
30700 base_q_idx,30913 base_q_idx,
30701- Pred::dense(&pred_u),30914+ su,
30702 Some(luma_tx_type),30915 Some(luma_tx_type),
30703 None, fctx,30916 None, fctx,
30704 )?30917 )?
@@ -30716,7 +30929,7 @@ fn decode_inter_block8(
30716 cpy,30929 cpy,
30717 CHROMA_SIDE,30930 CHROMA_SIDE,
30718 base_q_idx,30931 base_q_idx,
30719- Pred::dense(&pred_v),30932+ sv,
30720 Some(luma_tx_type),30933 Some(luma_tx_type),
30721 None, fctx,30934 None, fctx,
30722 )?30935 )?
@@ -30823,7 +31036,9 @@ fn decode_inter_block8(
30823 neighbours.left_ref1[rmi],31036 neighbours.left_ref1[rmi],
30824 );31037 );
30825 leaf_refs = (ref_frame, None);31038 leaf_refs = (ref_frame, None);
30826- let (sref_y, sref_u, sref_v) = ref_planes(ref_frame, refpix)?;31039+ // lane-defer8: this leaf's reference SIZE at parse, its pictures
31040+ // inside the prediction closure below.
31041+ let (ref_width, _) = ref_dims(ref_frame, refpix)?;
30827 31042
30828 let (mi_row, mi_col) = leaf_mi;31043 let (mi_row, mi_col) = leaf_mi;
30829 // lane-inter8 r2: the frame's temporal mv candidates, keyed on THIS31044 // lane-inter8 r2: the frame's temporal mv candidates, keyed on THIS
@@ -30999,7 +31214,7 @@ fn decode_inter_block8(
30999 // desynced every warped-motion superres stream at its first31214 // desynced every warped-motion superres stream at its first
31000 // eligible 8x8 leaf).31215 // eligible 8x8 leaf).
31001 let ref_is_scaled =31216 let ref_is_scaled =
31002- mc::scale_factor(sref_y.width, frame_width) != mc::REF_NO_SCALE;31217+ mc::scale_factor(ref_width, frame_width) != mc::REF_NO_SCALE;
31003 let warp_eligible =31218 let warp_eligible =
31004 allow_warped_motion && !ref_is_scaled && !force_integer_mv && proj_ok;31219 allow_warped_motion && !ref_is_scaled && !force_integer_mv && proj_ok;
31005 if allow_warped_motion && proj_ok && ref_is_scaled {31220 if allow_warped_motion && proj_ok && ref_is_scaled {
@@ -31161,13 +31376,49 @@ fn decode_inter_block8(
31161 // lane-scaledref r1: this leaf's own prediction is always `Regular`31376 // lane-scaledref r1: this leaf's own prediction is always `Regular`
31162 // (documented corner-cut above); under a scaled reference the same31377 // (documented corner-cut above); under a scaled reference the same
31163 // fixed kernel runs through spec 7.11.3.3's scaled walk instead.31378 // fixed kernel runs through spec 7.11.3.3's scaled walk instead.
31164- let luma_scale = mc::scale_factor(sref_y.width, frame_width);31379+ let luma_scale = mc::scale_factor(ref_width, frame_width);
31165 if luma_scale != mc::REF_NO_SCALE {31380 if luma_scale != mc::REF_NO_SCALE {
31166 SCALED_BLOCK8_HITS.with(|c| c.set(c.get() + 1));31381 SCALED_BLOCK8_HITS.with(|c| c.set(c.get() + 1));
31167 }31382 }
31168- let mut pred_y = vec![0u16; SIDE * SIDE];31383+ let obmc = if obmc_selected {
31169- let mut pred_u = vec![0u16; CHROMA_SIDE * CHROMA_SIDE];31384+ Some(obmc_plan(
31170- let mut pred_v = vec![0u16; CHROMA_SIDE * CHROMA_SIDE];31385+ grid,
31386+ neighbours,
31387+ mi_row,
31388+ mi_col,
31389+ 2,
31390+ 2,
31391+ mi_rows as usize,
31392+ mi_cols as usize,
31393+ SIDE,
31394+ SIDE,
31395+ SIDE,
31396+ CHROMA_SIDE,
31397+ px,
31398+ py,
31399+ cpx,
31400+ cpy,
31401+ refpix,
31402+ interp_fixed,
31403+ frame_width,
31404+ )?)
31405+ } else {
31406+ None
31407+ };
31408+ // lane-defer8: this leaf's whole prediction as a closure, so it runs
31409+ // where its writes run -- on a recon worker at more than one
31410+ // reconstruction thread, exactly like [`decode_inter_block`]'s.
31411+ let build = move |y: &mut PlaneBuf<'static>,
31412+ u: &mut PlaneBuf<'static>,
31413+ v: &mut PlaneBuf<'static>,
31414+ fctx: &crate::decode::FrameCtx,
31415+ out: &mut [Vec<u16>; 3]| {
31416+ let Some((sref_y, sref_u, sref_v)) = ref_planes_deferred(ref_frame, refpix) else {
31417+ return;
31418+ };
31419+ let mut pred_y = refill(std::mem::take(&mut out[0]), SIDE * SIDE);
31420+ let mut pred_u = refill(std::mem::take(&mut out[1]), CHROMA_SIDE * CHROMA_SIDE);
31421+ let mut pred_v = refill(std::mem::take(&mut out[2]), CHROMA_SIDE * CHROMA_SIDE);
31171 // Merge of lane-gmaffine (this leaf's own switchable filters) with31422 // Merge of lane-gmaffine (this leaf's own switchable filters) with
31172 // lane-scaledref (spec 7.11.3.3's scaled walk): same kernels either31423 // lane-scaledref (spec 7.11.3.3's scaled walk): same kernels either
31173 // way, only the sample walk differs.31424 // way, only the sample walk differs.
@@ -31240,37 +31491,13 @@ fn decode_inter_block8(
31240 }31491 }
31241 }31492 }
31242 31493
31243- if obmc_selected {31494+ if let Some(plan) = &obmc {
31244- obmc_blend(31495+ obmc_run(plan, refpix, &mut pred_y, &mut pred_u, &mut pred_v, fctx);
31245- grid,
31246- neighbours,
31247- mi_row,
31248- mi_col,
31249- 2,
31250- 2,
31251- mi_rows as usize,
31252- mi_cols as usize,
31253- SIDE,
31254- SIDE,
31255- SIDE,
31256- CHROMA_SIDE,
31257- px,
31258- py,
31259- cpx,
31260- cpy,
31261- refpix,
31262- interp_fixed,
31263- frame_width,
31264- &mut pred_y,
31265- &mut pred_u,
31266- &mut pred_v, fctx,
31267- )?;
31268 }31496 }
31269 31497
31270 // Non-wedge interintra blend, mutually exclusive with OBMC (the31498 // Non-wedge interintra blend, mutually exclusive with OBMC (the
31271 // motion_mode symbol is not read for an interintra block).31499 // motion_mode symbol is not read for an interintra block).
31272 if let Some(ii) = interintra_mode {31500 if let Some(ii) = interintra_mode {
31273- flush_recon(fctx, y, u, v);
31274 interintra_blend(y, px, py, SIDE, SIDE, SIDE, ii, wedge_mask, &mut pred_y, fctx);31501 interintra_blend(y, px, py, SIDE, SIDE, SIDE, ii, wedge_mask, &mut pred_y, fctx);
31275 interintra_blend(31502 interintra_blend(
31276 u, cpx, cpy, CHROMA_SIDE, CHROMA_SIDE, CHROMA_SIDE, ii, wedge_mask, &mut pred_u, fctx,31503 u, cpx, cpy, CHROMA_SIDE, CHROMA_SIDE, CHROMA_SIDE, ii, wedge_mask, &mut pred_u, fctx,
@@ -31280,6 +31507,34 @@ fn decode_inter_block8(
31280 );31507 );
31281 }31508 }
31282 31509
31510+ *out = [pred_y, pred_u, pred_v];
31511+ };
31512+ let deferred = recon_deferred(fctx);
31513+ let (pred_y, pred_u, pred_v): (Vec<u16>, Vec<u16>, Vec<u16>);
31514+ let (sy, su, sv) = if deferred {
31515+ push_pred(fctx, build);
31516+ (
31517+ Pred::Cur { plane: 0, stride: SIDE, off: 0 },
31518+ Pred::Cur { plane: 1, stride: CHROMA_SIDE, off: 0 },
31519+ Pred::Cur { plane: 2, stride: CHROMA_SIDE, off: 0 },
31520+ )
31521+ } else {
31522+ // The interintra predictor reads this block's own above/left
31523+ // edges: deferred, the wavefront rule has them written by the time
31524+ // the worker runs; inline, the queue has to drain first.
31525+ if interintra_mode.is_some() {
31526+ flush_recon(fctx, y, u, v);
31527+ }
31528+ let mut built: [Vec<u16>; 3] = Default::default();
31529+ build(y, u, v, fctx, &mut built);
31530+ let [by, bu, bv] = built;
31531+ (pred_y, pred_u, pred_v) = (by, bu, bv);
31532+ (
31533+ Pred::Inline(&pred_y, SIDE),
31534+ Pred::Inline(&pred_u, CHROMA_SIDE),
31535+ Pred::Inline(&pred_v, CHROMA_SIDE),
31536+ )
31537+ };
31283 split8 = read_block_tx_size(31538 split8 = read_block_tx_size(
31284 dec,31539 dec,
31285 cdfs,31540 cdfs,
@@ -31293,19 +31548,19 @@ fn decode_inter_block8(
31293 .131548 .1
31294 .is_some();31549 .is_some();
31295 if skip {31550 if skip {
31296- push_mc(0, px, py, SIDE, Pred::dense(&pred_y), &ZERO_RESIDUAL[..SIDE * SIDE], fctx);31551+ push_mc(0, px, py, SIDE, sy, &ZERO_RESIDUAL[..SIDE * SIDE], fctx);
31297 push_mc(1, 31552 push_mc(1,
31298 cpx,31553 cpx,
31299 cpy,31554 cpy,
31300 CHROMA_SIDE,31555 CHROMA_SIDE,
31301- Pred::dense(&pred_u),31556+ su,
31302 &ZERO_RESIDUAL[..CHROMA_SIDE * CHROMA_SIDE], fctx,31557 &ZERO_RESIDUAL[..CHROMA_SIDE * CHROMA_SIDE], fctx,
31303 );31558 );
31304 push_mc(2, 31559 push_mc(2,
31305 cpx,31560 cpx,
31306 cpy,31561 cpy,
31307 CHROMA_SIDE,31562 CHROMA_SIDE,
31308- Pred::dense(&pred_v),31563+ sv,
31309 &ZERO_RESIDUAL[..CHROMA_SIDE * CHROMA_SIDE], fctx,31564 &ZERO_RESIDUAL[..CHROMA_SIDE * CHROMA_SIDE], fctx,
31310 );31565 );
31311 luma_grid = vec![0i32; SIDE * SIDE];31566 luma_grid = vec![0i32; SIDE * SIDE];
@@ -31321,7 +31576,7 @@ fn decode_inter_block8(
31321 y,31576 y,
31322 px,31577 px,
31323 py,31578 py,
31324- Pred::dense(&pred_y),31579+ sy,
31325 mode_for_tx,31580 mode_for_tx,
31326 base_q_idx,31581 base_q_idx,
31327 scan8,31582 scan8,
@@ -31343,7 +31598,7 @@ fn decode_inter_block8(
31343 cpy,31598 cpy,
31344 CHROMA_SIDE,31599 CHROMA_SIDE,
31345 base_q_idx,31600 base_q_idx,
31346- Pred::dense(&pred_u),31601+ su,
31347 Some(luma_tx_type),31602 Some(luma_tx_type),
31348 None, fctx,31603 None, fctx,
31349 )?31604 )?
@@ -31361,7 +31616,7 @@ fn decode_inter_block8(
31361 cpy,31616 cpy,
31362 CHROMA_SIDE,31617 CHROMA_SIDE,
31363 base_q_idx,31618 base_q_idx,
31364- Pred::dense(&pred_v),31619+ sv,
31365 Some(luma_tx_type),31620 Some(luma_tx_type),
31366 None, fctx,31621 None, fctx,
31367 )?31622 )?
@@ -34711,6 +34966,9 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
34711 result_cdfs = cdfs;34966 result_cdfs = cdfs;
34712 }34967 }
34713 }34968 }
34969+ // lane-defer8: every tile's recon workers are joined by its own
34970+ // `WaveGuard`, so a deferred prediction's parked failure is complete here.
34971+ refpix.take_err()?;
34714 crate::timeline::recon_done();34972 crate::timeline::recon_done();
34715 // lane-twostage: the motion field is built from the mode-info grid alone34973 // lane-twostage: the motion field is built from the mode-info grid alone
34716 // (no pixel), so it moves up here with the CDFs -- everything a34974 // (no pixel), so it moves up here with the CDFs -- everything a