forge
Explore
Log in

Don't you dare go Hollow

Measure the encoder's first decode -- 94% of it is parse, not reconstruction

Browse files at this commit

591f575f30e17e983a21852658474d6fd242ca5fAhmet Kaan GümüşParent: c9c94fc
  • perf
    • measure the encoder's first decode -- 94% of it is parse, not reconstruction
Show full message
perf(av1): measure the encoder's first decode -- 94% of it is parse, not reconstruction

The encoder decodes its own written tiles once per frame to reach the
reconstruction and the per-mi neighbour state the filter search reads
(`par::S_FIRST`). The plan for removing it was to hand the decoder the
encoder's own reconstruction, which the writer already holds.

`EC_AV1_NORECON=1` drops every recorded pixel write in `exec_op` and
leaves the entropy parse and the neighbour bookkeeping alone. At
3840x1608 (4 frames, 4x2 tiles, 8 tile threads) the stage moves 150 ms
-> 141 ms: the reconstruction is 6% of it, the parse and the per-mi
grids are the other 94%. So the planes are not the lever -- only a
writer-side publisher of the filter-relevant `decode::Neighbours` grids
(blk_grid, tx/tx_h, uv_tx/uv_tx_h, ref_grid, delta_lf_grid), which skips
the parse entirely, can remove the stage.

Measurement only; the flag is off by default and the encoder's own
streams are byte-identical to their pins.
crates/ec-av1/src/decode.rsmodified+14 -0
@@ -3245,6 +3245,20 @@ fn exec_op(
32453245 preds: &[u16],
32463246 fctx: &crate::decode::FrameCtx,
32473247 ) {
3248+ // lane-nbpub instrument: `EC_AV1_NORECON=1` drops every recorded pixel
3249+ // write, leaving the entropy parse and the per-mi neighbour bookkeeping
3250+ // alone. It makes the encoder's own streams garbage, so it is a
3251+ // MEASUREMENT rung only -- what it measures is how much of the encoder's
3252+ // first decode of its own tiles (`par::S_FIRST`) is reconstruction and
3253+ // how much is parse. Answer at 3840x1608 (4 frames, 4x2 tiles, 8 tile
3254+ // threads): 150 ms -> 141 ms, i.e. the reconstruction is 6% of that
3255+ // stage and the parse plus the neighbour grids are the other 94%. That
3256+ // is why handing the decoder the encoder's own reconstruction cannot
3257+ // shrink the stage: only publishing the per-mi neighbour state the
3258+ // filters read (and so never parsing at all) can.
3259+ if crate::envflags::env_flag!("EC_AV1_NORECON") {
3260+ return;
3261+ }
32483262 let mut scratch = Vec::new();
32493263 match op {
32503264 ReconOp::Pred(b) => (b.0)(y, u, v, fctx, cur),