forge
Explore
Log in

Don't you dare go Hollow

wip(inter8): session restart -- uncommitted builder state preserved by orchestrator

Browse files at this commit

9f0cf5aa0be7b5c441dae63173b5d18245e74b29Ahmet Kaan GümüşParent: b7d3bdb
crates/ec-av1/src/decode.rsmodified+62 -22
@@ -743,6 +743,20 @@ pub(crate) fn inter_sb_none_hits() -> usize {
743 INTER_SB_NONE_HITS.with(|c| c.get())743 INTER_SB_NONE_HITS.with(|c| c.get())
744 }744 }
745 745
746+// lane-inter8 r1: how many INTERIOR (not frame-edge-straddling) 16x16 inter
747+// blocks coded a real `PARTITION_SPLIT` into four 8x8 leaves -- the straddle
748+// path has always run that loop, so only this counter proves the newly-lifted
749+// alphabet value fired.
750+thread_local! {
751+ static INTER_SUB16_SPLIT_HITS: std::cell::Cell<usize> =
752+ const { std::cell::Cell::new(0) };
753+}
754+
755+/// Current value of [`INTER_SUB16_SPLIT_HITS`].
756+pub(crate) fn inter_sub16_split_hits() -> usize {
757+ INTER_SUB16_SPLIT_HITS.with(|c| c.get())
758+}
759+
746 // lane-rectwire r2: how many `PARTITION_HORZ`/`VERT` strips actually decoded760 // lane-rectwire r2: how many `PARTITION_HORZ`/`VERT` strips actually decoded
747 // real (non-skip) coefficients through [`read_coeffs_rect`] -- proves the761 // real (non-skip) coefficients through [`read_coeffs_rect`] -- proves the
748 // rect coefficient reader itself fired, not just the strip-level partition762 // rect coefficient reader itself fired, not just the strip-level partition
@@ -8157,6 +8171,11 @@ fn num_proj_ref(
8157 /// decoder's own overlap sizes ever produce (luma 8/16/32, chroma 4/8/16)8171 /// decoder's own overlap sizes ever produce (luma 8/16/32, chroma 4/8/16)
8158 /// are transcribed.8172 /// are transcribed.
8159 fn obmc_mask(len: usize) -> &'static [u8] {8173 fn obmc_mask(len: usize) -> &'static [u8] {
8174+ // lane-inter8 r1: `obmc_mask_2` (`reconinter.c` 753) -- reached by the
8175+ // LEFT pass of an 8x8 block's chroma plane (overlap 4 luma columns, 2
8176+ // chroma), which only became live once 8x8 inter leaves stopped being
8177+ // refused.
8178+ const M2: [u8; 2] = [45, 64];
8160 const M4: [u8; 4] = [39, 50, 59, 64];8179 const M4: [u8; 4] = [39, 50, 59, 64];
8161 const M8: [u8; 8] = [36, 42, 48, 53, 57, 61, 64, 64];8180 const M8: [u8; 8] = [36, 42, 48, 53, 57, 61, 64, 64];
8162 const M16: [u8; 16] = [8181 const M16: [u8; 16] = [
@@ -8167,6 +8186,7 @@ fn obmc_mask(len: usize) -> &'static [u8] {
8167 61, 62, 64, 64, 64, 64, 64, 64, 64, 64,8186 61, 62, 64, 64, 64, 64, 64, 64, 64, 64,
8168 ];8187 ];
8169 match len {8188 match len {
8189+ 2 => &M2,
8170 4 => &M4,8190 4 => &M4,
8171 8 => &M8,8191 8 => &M8,
8172 16 => &M16,8192 16 => &M16,
@@ -8400,6 +8420,7 @@ fn obmc_blend(
8400 };8420 };
8401 let overlap_above = write_h / 2;8421 let overlap_above = write_h / 2;
8402 let overlap_left = write_w / 2;8422 let overlap_left = write_w / 2;
8423+ let skip_chroma_above = matches!((write_w, write_h), (8, 8) | (16, 8) | (8, 16));
8403 8424
8404 for (off4, span4, nb) in overlappable_above(grid, mi_row, mi_col, bw4, mi_cols, max_nb(bw4))8425 for (off4, span4, nb) in overlappable_above(grid, mi_row, mi_col, bw4, mi_cols, max_nb(bw4))
8405 {8426 {
@@ -8415,11 +8436,19 @@ fn obmc_blend(
8415 let (bw, bh, ox) = (span4 * 4, overlap_above, off4 * 4);8436 let (bw, bh, ox) = (span4 * 4, overlap_above, off4 * 4);
8416 let tmp_y = obmc_neighbour_pred(ny, px + ox, py, nb.mv, bw, bh, true, h_kind, v_kind);8437 let tmp_y = obmc_neighbour_pred(ny, px + ox, py, nb.mv, bw, bh, true, h_kind, v_kind);
8417 obmc_blend_v(pred_y, side, ox, 0, bw, bh, &tmp_y);8438 obmc_blend_v(pred_y, side, ox, 0, bw, bh, &tmp_y);
8418- let (cbw, cbh, cox) = (bw / 2, overlap_above / 2, ox / 2);8439+ // lane-inter8 r1: `av1_skip_u4x4_pred_in_obmc` (`reconinter.c` 820,
8419- let tmp_u = obmc_neighbour_pred(nu, cpx + cox, cpy, nb.mv, cbw, cbh, false, h_kind, v_kind);8440+ // `DISABLE_CHROMA_U8X8_OBMC == 0` -- "one-sided obmc"): when the
8420- obmc_blend_v(pred_u, chroma_side, cox, 0, cbw, cbh, &tmp_u);8441+ // chroma plane's own block size is BLOCK_4X4/8X4/4X8 (a 8x8, 16x8 or
8421- let tmp_v = obmc_neighbour_pred(nv, cpx + cox, cpy, nb.mv, cbw, cbh, false, h_kind, v_kind);8442+ // 8x16 luma block at 4:2:0), the ABOVE pass skips chroma entirely
8422- obmc_blend_v(pred_v, chroma_side, cox, 0, cbw, cbh, &tmp_v);8443+ // while the LEFT pass still blends it. Blending chroma here as well
8444+ // would both mis-predict every 8x8 leaf and ask for an overlap of 2.
8445+ if !skip_chroma_above {
8446+ let (cbw, cbh, cox) = (bw / 2, overlap_above / 2, ox / 2);
8447+ let tmp_u = obmc_neighbour_pred(nu, cpx + cox, cpy, nb.mv, cbw, cbh, false, h_kind, v_kind);
8448+ obmc_blend_v(pred_u, chroma_side, cox, 0, cbw, cbh, &tmp_u);
8449+ let tmp_v = obmc_neighbour_pred(nv, cpx + cox, cpy, nb.mv, cbw, cbh, false, h_kind, v_kind);
8450+ obmc_blend_v(pred_v, chroma_side, cox, 0, cbw, cbh, &tmp_v);
8451+ }
8423 }8452 }
8424 8453
8425 for (off4, span4, nb) in overlappable_left(grid, mi_row, mi_col, bh4, mi_rows, max_nb(bh4)) {8454 for (off4, span4, nb) in overlappable_left(grid, mi_row, mi_col, bh4, mi_rows, max_nb(bh4)) {
@@ -12305,14 +12334,30 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
12305 ));12334 ));
12306 }12335 }
12307 let at16 = (sr, sc);12336 let at16 = (sr, sc);
12308- if has_cols16 && has_rows16 {12337+ let ctx16 = neighbours.partition_ctx(at16, SUB);
12309- let ctx16 = neighbours.partition_ctx(at16, SUB);12338+ // lane-inter8 r1: a straddling 16x16 cannot name a
12310- let part16 = dec.symbol(&mut cdfs.partition_w16[ctx16]);12339+ // value (spec forces SPLIT, one gathered bit); an
12311- if part16 != PARTITION_NONE {12340+ // interior one reads the real alphabet, and
12312- return Err(unsupported(12341+ // `PARTITION_SPLIT` now recurses into four 8x8
12313- "an inter partition below 16x16 (8x8 and smaller inter blocks are not coded yet)",12342+ // inter leaves through the very same loop the
12343+ // straddling case has always used.
12344+ let part16 = if has_cols16 && has_rows16 {
12345+ dec.symbol(&mut cdfs.partition_w16[ctx16])
12346+ } else {
12347+ if has_cols16 {
12348+ dec.symbol_fixed(&gather(
12349+ &cdfs.partition_w16[ctx16],
12350+ VERT_ALIKE,
12351+ ));
12352+ } else {
12353+ dec.symbol_fixed(&gather(
12354+ &cdfs.partition_w16[ctx16],
12355+ HORZ_ALIKE,
12314 ));12356 ));
12315 }12357 }
12358+ PARTITION_SPLIT
12359+ };
12360+ if part16 == PARTITION_NONE {
12316 decode_inter_block(12361 decode_inter_block(
12317 &mut dec,12362 &mut dec,
12318 &mut cdfs,12363 &mut cdfs,
@@ -12366,18 +12411,13 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
12366 allow_screen_content_tools,12411 allow_screen_content_tools,
12367 frame_width as usize,12412 frame_width as usize,
12368 )?;12413 )?;
12414+ } else if part16 != PARTITION_SPLIT {
12415+ return Err(unsupported(
12416+ "an inter partition below 16x16 other than SPLIT (16x8/8x16 rect inter leaves are not coded yet)",
12417+ ));
12369 } else {12418 } else {
12370- let ctx16 = neighbours.partition_ctx(at16, SUB);12419+ if has_cols16 && has_rows16 {
12371- if has_cols16 {12420+ INTER_SUB16_SPLIT_HITS.with(|c| c.set(c.get() + 1));
12372- dec.symbol_fixed(&gather(
12373- &cdfs.partition_w16[ctx16],
12374- VERT_ALIKE,
12375- ));
12376- } else {
12377- dec.symbol_fixed(&gather(
12378- &cdfs.partition_w16[ctx16],
12379- HORZ_ALIKE,
12380- ));
12381 }12421 }
12382 let (mi_row0, mi_col0) = (sr as u32 * SUB_MI, sc as u32 * SUB_MI);12422 let (mi_row0, mi_col0) = (sr as u32 * SUB_MI, sc as u32 * SUB_MI);
12383 let leaf_positions: Vec<(u32, u32)> = (0..4)12423 let leaf_positions: Vec<(u32, u32)> = (0..4)