ec-av1: lane-av1-422sub8rect -- the sub-8 inter 4:2:2 chroma ported to its real shapes
Browse files at this commit19f693e2ac309f86224ac6455c3f8026e2319f42Parent: 08f3d514 changed files +845 -263
- crates/ec-av1/src/decode.rs +681 -249
- crates/ec-av1/src/encode.rs +1 -0
- crates/ec-av1/src/mc.rs +31 -14
- lanes/av1422sub8rect.report.md +132 -0
crates/ec-av1/src/decode.rsmodified+681 -249
| @@ -2069,6 +2069,22 @@ pub fn chroma422_sub8_hits() -> usize { | |||
| 2069 | CHROMA422_SUB8_HITS.with(|c| c.get()) | 2069 | CHROMA422_SUB8_HITS.with(|c| c.get()) |
| 2070 | } | 2070 | } |
| 2071 | 2071 | ||
| 2072 | +// lane-av1-422sub8rect: how many PER-PIECE TX_4X4 chroma coefficient units | ||
| 2073 | +// the INTER sub-8x8 split4 path read on a 4:2:2 frame (ss 1,0) -- one per | ||
| 2074 | +// non-skipped odd-column piece per plane (`is_chroma_reference`'s | ||
| 2075 | +// `mi_col & 0x01` at ss_x 1). 4:2:0 goes through the shared group unit and | ||
| 2076 | +// 4:4:4 through [`sub8_leaf_chroma444`]'s own per-piece twin, so a witness | ||
| 2077 | +// gate reading 0 here proves the inter 4:2:2 per-piece arm never ran. | ||
| 2078 | +thread_local! { | ||
| 2079 | + static CHROMA422_INTER_SUB8_HITS: std::cell::Cell<usize> = | ||
| 2080 | + const { std::cell::Cell::new(0) }; | ||
| 2081 | +} | ||
| 2082 | + | ||
| 2083 | +/// Current value of [`CHROMA422_INTER_SUB8_HITS`]. | ||
| 2084 | +pub fn chroma422_inter_sub8_hits() -> usize { | ||
| 2085 | + CHROMA422_INTER_SUB8_HITS.with(|c| c.get()) | ||
| 2086 | +} | ||
| 2087 | + | ||
| 2072 | // lane-av1-422m: how many TX_4X4 chunk units the invalid-ss-size chroma arm | 2088 | // lane-av1-422m: how many TX_4X4 chunk units the invalid-ss-size chroma arm |
| 2073 | // read (the 8x32 luma block whose 4:2:2 plane has no `ss_size_lookup` block). | 2089 | // read (the 8x32 luma block whose 4:2:2 plane has no `ss_size_lookup` block). |
| 2074 | // A 4:2:0 or 4:4:4 frame cannot increment it, so a non-zero read proves the | 2090 | // A 4:2:0 or 4:4:4 frame cannot increment it, so a non-zero read proves the |
| @@ -2668,7 +2684,10 @@ impl TxParams { | |||
| 2668 | if self.stride == 0 { | 2684 | if self.stride == 0 { |
| 2669 | return residual; | 2685 | return residual; |
| 2670 | } | 2686 | } |
| 2671 | - let mut strided = vec![0i32; self.stride * self.stride]; | 2687 | + // lane-av1-422sub8rect: `h` rows of `stride` -- a rect unit whose |
| 2688 | + // height exceeds its (narrow) prediction stride needs the full | ||
| 2689 | + // stride * h; every square caller has h == stride and is unchanged. | ||
| 2690 | + let mut strided = vec![0i32; self.stride * self.h]; | ||
| 2672 | for row in 0..self.h { | 2691 | for row in 0..self.h { |
| 2673 | strided[row * self.stride..][..self.w] | 2692 | strided[row * self.stride..][..self.w] |
| 2674 | .copy_from_slice(&residual[row * self.w..][..self.w]); | 2693 | .copy_from_slice(&residual[row * self.w..][..self.w]); |
| @@ -30739,6 +30758,8 @@ fn interintra_blend( | |||
| 30739 | bw: usize, | 30758 | bw: usize, |
| 30740 | bh: usize, | 30759 | bh: usize, |
| 30741 | stride: usize, | 30760 | stride: usize, |
| 30761 | + subw: usize, | ||
| 30762 | + subh: usize, | ||
| 30742 | ii_mode: u8, | 30763 | ii_mode: u8, |
| 30743 | wedge: Option<(&'static [u8], usize)>, | 30764 | wedge: Option<(&'static [u8], usize)>, |
| 30744 | pred: &mut [u16], fctx: &crate::decode::FrameCtx, | 30765 | pred: &mut [u16], fctx: &crate::decode::FrameCtx, |
| @@ -30785,25 +30806,38 @@ fn interintra_blend( | |||
| 30785 | let m = u32::from(match wedge { | 30806 | let m = u32::from(match wedge { |
| 30786 | // lane-wii r2: wedge-interintra mask (aom_blend_a64_mask | 30807 | // lane-wii r2: wedge-interintra mask (aom_blend_a64_mask |
| 30787 | // over the wedge codebook, intra as src0, fixed sign 0). | 30808 | // over the wedge codebook, intra as src0, fixed sign 0). |
| 30788 | - // Luma plane: mask rows are luma-resolution, ms == side. | 30809 | + // `(subw, subh)` are the plane's own subsampling shifts; |
| 30789 | - // 4:2:0 chroma: 2x2 box average (reconinter.c sub8x8 -- | 30810 | + // the four branches mirror aom_dsp/blend-a64-mask.c's |
| 30790 | - // subw == subh == 1). | 30811 | + // `subw`/`subh` pair handling exactly: luma (0, 0) reads |
| 30791 | - Some((mask, ms)) if ms == stride => mask[i * stride + j], | 30812 | + // the direct sample, (1, 1) the 2x2 box average |
| 30792 | - Some((mask, ms)) => { | 30813 | + // (reconinter.c sub8x8), and 4:2:2's (1, 0) the |
| 30793 | - let t = 2 * i * ms + 2 * j; | 30814 | + // `AOM_BLEND_AVG` column pair. |
| 30794 | - ((u32::from(mask[t]) | 30815 | + Some((mask, ms)) => match (subw, subh) { |
| 30795 | - + u32::from(mask[t + 1]) | 30816 | + (0, 0) => u32::from(mask[i * ms + j]), |
| 30796 | - + u32::from(mask[t + ms]) | 30817 | + (1, 1) => { |
| 30797 | - + u32::from(mask[t + ms + 1]) | 30818 | + let t = 2 * i * ms + 2 * j; |
| 30798 | - + 2) | 30819 | + (u32::from(mask[t]) |
| 30799 | - >> 2) as u8 | 30820 | + + u32::from(mask[t + 1]) |
| 30800 | - } | 30821 | + + u32::from(mask[t + ms]) |
| 30801 | - None => match ii_mode { | 30822 | + + u32::from(mask[t + ms + 1]) |
| 30802 | - 0 => 32, | 30823 | + + 2) |
| 30824 | + >> 2 | ||
| 30825 | + } | ||
| 30826 | + (1, 0) => { | ||
| 30827 | + let t = i * ms + 2 * j; | ||
| 30828 | + (u32::from(mask[t]) + u32::from(mask[t + 1]) + 1) >> 1 | ||
| 30829 | + } | ||
| 30830 | + (_sw, _sh) => { | ||
| 30831 | + let t = 2 * i * ms + j; | ||
| 30832 | + (u32::from(mask[t]) + u32::from(mask[t + ms]) + 1) >> 1 | ||
| 30833 | + } | ||
| 30834 | + }, | ||
| 30835 | + None => u32::from(match ii_mode { | ||
| 30836 | + 0 => 32u8, | ||
| 30803 | 1 => II_WEIGHTS_1D[i * scale], | 30837 | 1 => II_WEIGHTS_1D[i * scale], |
| 30804 | 2 => II_WEIGHTS_1D[j * scale], | 30838 | 2 => II_WEIGHTS_1D[j * scale], |
| 30805 | _ => II_WEIGHTS_1D[i.min(j) * scale], | 30839 | _ => II_WEIGHTS_1D[i.min(j) * scale], |
| 30806 | - }, | 30840 | + }), |
| 30807 | }); | 30841 | }); |
| 30808 | let idx = i * stride + j; | 30842 | let idx = i * stride + j; |
| 30809 | pred[idx] = ((m * u32::from(intra[i * bw + j]) + (64 - m) * u32::from(pred[idx]) + 32) | 30843 | pred[idx] = ((m * u32::from(intra[i * bw + j]) + (64 - m) * u32::from(pred[idx]) + 32) |
| @@ -30953,6 +30987,12 @@ pub(crate) fn obmc_plan( | |||
| 30953 | // `av1_setup_build_prediction_by_above_pred` passing that ref's own | 30987 | // `av1_setup_build_prediction_by_above_pred` passing that ref's own |
| 30954 | // `scale_factors`). | 30988 | // `scale_factors`). |
| 30955 | frame_width: usize, | 30989 | frame_width: usize, |
| 30990 | + // lane-av1-422sub8rect: the plane's own subsampling shifts -- every | ||
| 30991 | + // chroma extent below derives from the luma rule by `>> ss` on the | ||
| 30992 | + // subsampled axis (`build_obmc_inter_pred_above`'s | ||
| 30993 | + // `overlap >> pd->subsampling_y` and the left pass's matching `>> ss_x`), | ||
| 30994 | + // never a blind half. 4:2:0 and 4:4:4 reduce to the old /2s and 0s. | ||
| 30995 | + ss: (usize, usize), | ||
| 30956 | ) -> Result<ObmcPlan> { | 30996 | ) -> Result<ObmcPlan> { |
| 30957 | // lane-rect r2 (libaom av1_build_obmc_inter_prediction): each pass has | 30997 | // lane-rect r2 (libaom av1_build_obmc_inter_prediction): each pass has |
| 30958 | // its OWN neighbour cap (width-log2 for above, height-log2 for left) and | 30998 | // its OWN neighbour cap (width-log2 for above, height-log2 for left) and |
| @@ -30984,10 +31024,16 @@ pub(crate) fn obmc_plan( | |||
| 30984 | let overlap_above = write_h.min(64) / 2; | 31024 | let overlap_above = write_h.min(64) / 2; |
| 30985 | let overlap_left = write_w.min(64) / 2; | 31025 | let overlap_left = write_w.min(64) / 2; |
| 30986 | // lane-inter8 r1 / lane-scaledref r1: `av1_skip_u4x4_pred_in_obmc` | 31026 | // lane-inter8 r1 / lane-scaledref r1: `av1_skip_u4x4_pred_in_obmc` |
| 30987 | - // (`reconinter.c` 820) returns `dir == 0` when the chroma plane's own | 31027 | + // (reconinter.c:829) keys on the CHROMA plane block |
| 30988 | - // block is BLOCK_4X4/8X4/4X8 (an 8x8, 16x8 or 8x16 luma block at 4:2:0): | 31028 | + // (`get_plane_block_size(bsize, ss_x, ss_y)`): BLOCK_4X4/BLOCK_8X4/ |
| 30989 | - // the ABOVE pass skips chroma entirely, the LEFT pass still blends it. | 31029 | + // BLOCK_4X8 return `dir == 0`, so the ABOVE pass skips chroma for those |
| 30990 | - let skip_chroma_above = matches!((write_w, write_h), (8, 8) | (16, 8) | (8, 16)); | 31030 | + // and the LEFT pass never does. lane-av1-422sub8rect: keyed on the |
| 31031 | + // per-axis-shifted plane shape now -- an 8x8 leaf is (4, 4) at 4:2:0 | ||
| 31032 | + // (skip) and (4, 8) at 4:2:2 (still skip, BLOCK_4X8 is in the list), | ||
| 31033 | + // while 8x4/4x8 luma leaves are (4, 4) or (8, 4) at 4:2:2. | ||
| 31034 | + let (ss_x, ss_y) = ss; | ||
| 31035 | + let skip_chroma_above = | ||
| 31036 | + matches!((write_w >> ss_x, write_h >> ss_y), (4, 4) | (8, 4) | (4, 8)); | ||
| 30991 | let mut above = Vec::new(); | 31037 | let mut above = Vec::new(); |
| 30992 | for (off4, span4, nb, src4) in overlappable_above(grid, mi_row, mi_col, bw4, mi_cols, max_nb(bw4)) | 31038 | for (off4, span4, nb, src4) in overlappable_above(grid, mi_row, mi_col, bw4, mi_cols, max_nb(bw4)) |
| 30993 | { | 31039 | { |
| @@ -31055,6 +31101,7 @@ pub(crate) fn obmc_plan( | |||
| 31055 | cpy, | 31101 | cpy, |
| 31056 | overlap_above, | 31102 | overlap_above, |
| 31057 | overlap_left, | 31103 | overlap_left, |
| 31104 | + ss, | ||
| 31058 | skip_chroma_above, | 31105 | skip_chroma_above, |
| 31059 | }) | 31106 | }) |
| 31060 | } | 31107 | } |
| @@ -31088,6 +31135,8 @@ pub(crate) struct ObmcPlan { | |||
| 31088 | cpy: usize, | 31135 | cpy: usize, |
| 31089 | overlap_above: usize, | 31136 | overlap_above: usize, |
| 31090 | overlap_left: usize, | 31137 | overlap_left: usize, |
| 31138 | + /// The plane's own subsampling shifts ([`obmc_plan`]). | ||
| 31139 | + ss: (usize, usize), | ||
| 31091 | skip_chroma_above: bool, | 31140 | skip_chroma_above: bool, |
| 31092 | } | 31141 | } |
| 31093 | 31142 | ||
| @@ -31115,9 +31164,18 @@ pub(crate) fn obmc_run( | |||
| 31115 | cpy, | 31164 | cpy, |
| 31116 | overlap_above, | 31165 | overlap_above, |
| 31117 | overlap_left, | 31166 | overlap_left, |
| 31167 | + ss, | ||
| 31118 | skip_chroma_above, | 31168 | skip_chroma_above, |
| 31119 | .. | 31169 | .. |
| 31120 | } = plan; | 31170 | } = plan; |
| 31171 | + // lane-av1-422sub8rect: every chroma extent is the luma rule shifted by | ||
| 31172 | + // the plane's own subsampling (`build_obmc_inter_pred_above`'s | ||
| 31173 | + // `overlap >> pd->subsampling_y`, the left pass's `>> ss_x`, the | ||
| 31174 | + // neighbour-span `>> ss` per axis) -- 4:2:0 and 4:4:4 reduce to the old | ||
| 31175 | + // halves, 4:2:2 keeps the unhalved height. | ||
| 31176 | + let (ss_x, ss_y) = ss; | ||
| 31177 | + let chroma_w = write_w >> ss_x; | ||
| 31178 | + let chroma_h = write_h >> ss_y; | ||
| 31121 | // lane-alloc: one neighbour-prediction buffer per plane for the whole | 31179 | // lane-alloc: one neighbour-prediction buffer per plane for the whole |
| 31122 | // block, reused by every neighbour of the above and left passes. | 31180 | // block, reused by every neighbour of the above and left passes. |
| 31123 | let (mut tmp_y, mut tmp_u, mut tmp_v) = (Vec::new(), Vec::new(), Vec::new()); | 31181 | let (mut tmp_y, mut tmp_u, mut tmp_v) = (Vec::new(), Vec::new(), Vec::new()); |
| @@ -31136,7 +31194,8 @@ pub(crate) fn obmc_run( | |||
| 31136 | let (x, y) = (f[1].parse::<usize>().ok()?, f[2].parse::<usize>().ok()?); | 31194 | let (x, y) = (f[1].parse::<usize>().ok()?, f[2].parse::<usize>().ok()?); |
| 31137 | let fr = f.get(3).and_then(|s| s.parse::<i64>().ok()).unwrap_or(-1); | 31195 | let fr = f.get(3).and_then(|s| s.parse::<i64>().ok()).unwrap_or(-1); |
| 31138 | let idx = PREFILT_PICTURE_IDX.load(std::sync::atomic::Ordering::SeqCst) as i64; | 31196 | let idx = PREFILT_PICTURE_IDX.load(std::sync::atomic::Ordering::SeqCst) as i64; |
| 31139 | - if x >= cpx && x < cpx + write_w / 2 && y >= cpy && y < cpy + write_h / 2 | 31197 | + let (mcb_cw, mcb_ch) = (write_w >> ss_x, write_h >> ss_y); |
| 31198 | + if x >= cpx && x < cpx + mcb_cw && y >= cpy && y < cpy + mcb_ch | ||
| 31140 | && (fr < 0 || fr == idx) | 31199 | && (fr < 0 || fr == idx) |
| 31141 | { | 31200 | { |
| 31142 | Some((x, y, idx)) | 31201 | Some((x, y, idx)) |
| @@ -31147,11 +31206,11 @@ pub(crate) fn obmc_run( | |||
| 31147 | if let Some((_, _, idx)) = ec_mcb { | 31206 | if let Some((_, _, idx)) = ec_mcb { |
| 31148 | eprintln!( | 31207 | eprintln!( |
| 31149 | "OUR_MCB pre f={idx} cpx={cpx} cpy={cpy} cw={} ch={}", | 31208 | "OUR_MCB pre f={idx} cpx={cpx} cpy={cpy} cw={} ch={}", |
| 31150 | - write_w / 2, | 31209 | + write_w >> ss_x, |
| 31151 | - write_h / 2 | 31210 | + write_h >> ss_y |
| 31152 | ); | 31211 | ); |
| 31153 | - for r in 0..write_h / 2 { | 31212 | + for r in 0..(write_h >> ss_y) { |
| 31154 | - let row: Vec<u16> = (0..write_w / 2).map(|c| pred_u[r * chroma_side + c]).collect(); | 31213 | + let row: Vec<u16> = (0..(write_w >> ss_x)).map(|c| pred_u[r * chroma_side + c]).collect(); |
| 31155 | eprintln!("OUR_MCB prerow{r}: {row:?}"); | 31214 | eprintln!("OUR_MCB prerow{r}: {row:?}"); |
| 31156 | } | 31215 | } |
| 31157 | } | 31216 | } |
| @@ -31167,9 +31226,10 @@ pub(crate) fn obmc_run( | |||
| 31167 | if !skip_chroma_above { | 31226 | if !skip_chroma_above { |
| 31168 | // lane-t900 r13 (measured, NOT a defect): libaom's min-4 clamp | 31227 | // lane-t900 r13 (measured, NOT a defect): libaom's min-4 clamp |
| 31169 | // sizes only the OBMC PREDICTION buffer; the blend length is the | 31228 | // sizes only the OBMC PREDICTION buffer; the blend length is the |
| 31170 | - // plain half (`build_obmc_inter_pred_above`: `overlap >> ss_y`). | 31229 | + // plain `overlap >> ss_y` (`build_obmc_inter_pred_above`: |
| 31171 | - let (cbw, cbh, cox) = (bw / 2, overlap_above / 2, ox / 2); | 31230 | + // `bh = overlap >> pd->subsampling_y`). |
| 31172 | - let cw = cbw.min(write_w / 2 - cox); | 31231 | + let (cbw, cbh, cox) = (bw >> ss_x, overlap_above >> ss_y, ox >> ss_x); |
| 31232 | + let cw = cbw.min(chroma_w - cox); | ||
| 31173 | obmc_neighbour_pred(nu, cpx + cox, cpy, nb.mv, cbw, cbh, false, nb.h_kind, nb.v_kind, nb.scale, &mut tmp_u, fctx); | 31233 | obmc_neighbour_pred(nu, cpx + cox, cpy, nb.mv, cbw, cbh, false, nb.h_kind, nb.v_kind, nb.scale, &mut tmp_u, fctx); |
| 31174 | obmc_blend_v(pred_u, chroma_side, cox, 0, cw, cbh, cbw, &tmp_u); | 31234 | obmc_blend_v(pred_u, chroma_side, cox, 0, cw, cbh, cbw, &tmp_u); |
| 31175 | obmc_neighbour_pred(nv, cpx + cox, cpy, nb.mv, cbw, cbh, false, nb.h_kind, nb.v_kind, nb.scale, &mut tmp_v, fctx); | 31235 | obmc_neighbour_pred(nv, cpx + cox, cpy, nb.mv, cbw, cbh, false, nb.h_kind, nb.v_kind, nb.scale, &mut tmp_v, fctx); |
| @@ -31184,7 +31244,7 @@ pub(crate) fn obmc_run( | |||
| 31184 | let (bw, bh, oy) = (overlap_left, nb.span4 * 4, nb.off4 * 4); | 31244 | let (bw, bh, oy) = (overlap_left, nb.span4 * 4, nb.off4 * 4); |
| 31185 | obmc_neighbour_pred(ny, px, py + oy, nb.mv, bw, bh, true, nb.h_kind, nb.v_kind, nb.scale, &mut tmp_y, fctx); | 31245 | obmc_neighbour_pred(ny, px, py + oy, nb.mv, bw, bh, true, nb.h_kind, nb.v_kind, nb.scale, &mut tmp_y, fctx); |
| 31186 | obmc_blend_h(pred_y, side, 0, oy, bw, bh.min(write_h - oy), &tmp_y); | 31246 | obmc_blend_h(pred_y, side, 0, oy, bw, bh.min(write_h - oy), &tmp_y); |
| 31187 | - let (cbw, cbh, coy) = (overlap_left / 2, bh / 2, oy / 2); | 31247 | + let (cbw, cbh, coy) = (overlap_left >> ss_x, bh >> ss_y, oy >> ss_y); |
| 31188 | obmc_neighbour_pred(nu, cpx, cpy + coy, nb.mv, cbw, cbh, false, nb.h_kind, nb.v_kind, nb.scale, &mut tmp_u, fctx); | 31248 | obmc_neighbour_pred(nu, cpx, cpy + coy, nb.mv, cbw, cbh, false, nb.h_kind, nb.v_kind, nb.scale, &mut tmp_u, fctx); |
| 31189 | if let Some((_, _, idx)) = ec_mcb { | 31249 | if let Some((_, _, idx)) = ec_mcb { |
| 31190 | eprintln!( | 31250 | eprintln!( |
| @@ -31196,14 +31256,14 @@ pub(crate) fn obmc_run( | |||
| 31196 | eprintln!("OUR_MCB lrow{r}: {row:?}"); | 31256 | eprintln!("OUR_MCB lrow{r}: {row:?}"); |
| 31197 | } | 31257 | } |
| 31198 | } | 31258 | } |
| 31199 | - let ch = cbh.min(write_h / 2 - coy); | 31259 | + let ch = cbh.min(chroma_h - coy); |
| 31200 | obmc_blend_h(pred_u, chroma_side, 0, coy, cbw, ch, &tmp_u); | 31260 | obmc_blend_h(pred_u, chroma_side, 0, coy, cbw, ch, &tmp_u); |
| 31201 | obmc_neighbour_pred(nv, cpx, cpy + coy, nb.mv, cbw, cbh, false, nb.h_kind, nb.v_kind, nb.scale, &mut tmp_v, fctx); | 31261 | obmc_neighbour_pred(nv, cpx, cpy + coy, nb.mv, cbw, cbh, false, nb.h_kind, nb.v_kind, nb.scale, &mut tmp_v, fctx); |
| 31202 | obmc_blend_h(pred_v, chroma_side, 0, coy, cbw, ch, &tmp_v); | 31262 | obmc_blend_h(pred_v, chroma_side, 0, coy, cbw, ch, &tmp_v); |
| 31203 | } | 31263 | } |
| 31204 | if let Some((_, _, idx)) = ec_mcb { | 31264 | if let Some((_, _, idx)) = ec_mcb { |
| 31205 | - for r in 0..write_h / 2 { | 31265 | + for r in 0..chroma_h { |
| 31206 | - let row: Vec<u16> = (0..write_w / 2).map(|c| pred_u[r * chroma_side + c]).collect(); | 31266 | + let row: Vec<u16> = (0..chroma_w).map(|c| pred_u[r * chroma_side + c]).collect(); |
| 31207 | eprintln!("OUR_MCB post f={idx} row{r}: {row:?}"); | 31267 | eprintln!("OUR_MCB post f={idx} row{r}: {row:?}"); |
| 31208 | } | 31268 | } |
| 31209 | } | 31269 | } |
| @@ -32642,7 +32702,7 @@ fn decode_inter_block( | |||
| 32642 | }; | 32702 | }; |
| 32643 | if let Some(mask_y) = mask_y { | 32703 | if let Some(mask_y) = mask_y { |
| 32644 | mc::blend_masked_compound( | 32704 | mc::blend_masked_compound( |
| 32645 | - &inter0_y, &inter1_y, mask_y, side, side, side, false, &mut pred_y, fctx, | 32705 | + &inter0_y, &inter1_y, mask_y, side, side, side, 0, 0, &mut pred_y, fctx, |
| 32646 | ); | 32706 | ); |
| 32647 | } else { | 32707 | } else { |
| 32648 | mc::combine_compound(&inter0_y, &inter1_y, fwd_offset, bck_offset, &mut pred_y, fctx); | 32708 | mc::combine_compound(&inter0_y, &inter1_y, fwd_offset, bck_offset, &mut pred_y, fctx); |
| @@ -32706,6 +32766,13 @@ fn decode_inter_block( | |||
| 32706 | } | 32766 | } |
| 32707 | let mut pred_u = refill(std::mem::take(&mut out[1]), chroma_side * chroma_side); | 32767 | let mut pred_u = refill(std::mem::take(&mut out[1]), chroma_side * chroma_side); |
| 32708 | if let Some(mask_y) = mask_y { | 32768 | if let Some(mask_y) = mask_y { |
| 32769 | + // lane-av1-422sub8rect stop-note: this fn's 4:2:2 chroma | ||
| 32770 | + // prediction is still the square-cut model (the owning | ||
| 32771 | + // parent-lane surface) -- its buffer is `chroma_side`-square | ||
| 32772 | + // and cannot be indexed by the subsampled-axis mask walks, | ||
| 32773 | + // so at ss_x != ss_y the blend keeps the direct | ||
| 32774 | + // luma-resolution read (the pre-port behaviour, known | ||
| 32775 | + // divergent there) until that surface itself is ported. | ||
| 32709 | mc::blend_masked_compound( | 32776 | mc::blend_masked_compound( |
| 32710 | &inter0_u, | 32777 | &inter0_u, |
| 32711 | &inter1_u, | 32778 | &inter1_u, |
| @@ -32713,7 +32780,8 @@ fn decode_inter_block( | |||
| 32713 | side, | 32780 | side, |
| 32714 | chroma_side, | 32781 | chroma_side, |
| 32715 | chroma_side, | 32782 | chroma_side, |
| 32716 | - ss_x(fctx) == 1 && ss_y(fctx) == 1, | 32783 | + if ss_x(fctx) == ss_y(fctx) { ss_x(fctx) } else { 0 }, |
| 32784 | + if ss_x(fctx) == ss_y(fctx) { ss_y(fctx) } else { 0 }, | ||
| 32717 | &mut pred_u, fctx, | 32785 | &mut pred_u, fctx, |
| 32718 | ); | 32786 | ); |
| 32719 | } else { | 32787 | } else { |
| @@ -32778,6 +32846,13 @@ fn decode_inter_block( | |||
| 32778 | } | 32846 | } |
| 32779 | let mut pred_v = refill(std::mem::take(&mut out[2]), chroma_side * chroma_side); | 32847 | let mut pred_v = refill(std::mem::take(&mut out[2]), chroma_side * chroma_side); |
| 32780 | if let Some(mask_y) = mask_y { | 32848 | if let Some(mask_y) = mask_y { |
| 32849 | + // lane-av1-422sub8rect stop-note: this fn's 4:2:2 chroma | ||
| 32850 | + // prediction is still the square-cut model (the owning | ||
| 32851 | + // parent-lane surface) -- its buffer is `chroma_side`-square | ||
| 32852 | + // and cannot be indexed by the subsampled-axis mask walks, | ||
| 32853 | + // so at ss_x != ss_y the blend keeps the direct | ||
| 32854 | + // luma-resolution read (the pre-port behaviour, known | ||
| 32855 | + // divergent there) until that surface itself is ported. | ||
| 32781 | mc::blend_masked_compound( | 32856 | mc::blend_masked_compound( |
| 32782 | &inter0_v, | 32857 | &inter0_v, |
| 32783 | &inter1_v, | 32858 | &inter1_v, |
| @@ -32785,7 +32860,8 @@ fn decode_inter_block( | |||
| 32785 | side, | 32860 | side, |
| 32786 | chroma_side, | 32861 | chroma_side, |
| 32787 | chroma_side, | 32862 | chroma_side, |
| 32788 | - ss_x(fctx) == 1 && ss_y(fctx) == 1, | 32863 | + if ss_x(fctx) == ss_y(fctx) { ss_x(fctx) } else { 0 }, |
| 32864 | + if ss_x(fctx) == ss_y(fctx) { ss_y(fctx) } else { 0 }, | ||
| 32789 | &mut pred_v, fctx, | 32865 | &mut pred_v, fctx, |
| 32790 | ); | 32866 | ); |
| 32791 | } else { | 32867 | } else { |
| @@ -34039,6 +34115,7 @@ fn decode_inter_block( | |||
| 34039 | refpix, | 34115 | refpix, |
| 34040 | interp_fixed, | 34116 | interp_fixed, |
| 34041 | frame_width, | 34117 | frame_width, |
| 34118 | + (ss_x(fctx), ss_y(fctx)), | ||
| 34042 | )?) | 34119 | )?) |
| 34043 | } else { | 34120 | } else { |
| 34044 | None | 34121 | None |
| @@ -34200,14 +34277,14 @@ fn decode_inter_block( | |||
| 34200 | if write_w != write_h { | 34277 | if write_w != write_h { |
| 34201 | hit!(INTERINTRA_RECT_HITS); | 34278 | hit!(INTERINTRA_RECT_HITS); |
| 34202 | } | 34279 | } |
| 34203 | - interintra_blend(y, px, py, write_w, write_h, side, ii, wedge_mask, &mut pred_y, fctx); | 34280 | + interintra_blend(y, px, py, write_w, write_h, side, 0, 0, ii, wedge_mask, &mut pred_y, fctx); |
| 34204 | interintra_blend( | 34281 | interintra_blend( |
| 34205 | - u, cpx, cpy, write_chroma_w, write_chroma_h, chroma_side, ii, wedge_mask, | 34282 | + u, cpx, cpy, write_chroma_w, write_chroma_h, chroma_side, ss_x(fctx), |
| 34206 | - &mut pred_u, fctx, | 34283 | + ss_y(fctx), ii, wedge_mask, &mut pred_u, fctx, |
| 34207 | ); | 34284 | ); |
| 34208 | interintra_blend( | 34285 | interintra_blend( |
| 34209 | - v, cpx, cpy, write_chroma_w, write_chroma_h, chroma_side, ii, wedge_mask, | 34286 | + v, cpx, cpy, write_chroma_w, write_chroma_h, chroma_side, ss_x(fctx), |
| 34210 | - &mut pred_v, fctx, | 34287 | + ss_y(fctx), ii, wedge_mask, &mut pred_v, fctx, |
| 34211 | ); | 34288 | ); |
| 34212 | } | 34289 | } |
| 34213 | if let Some(plan) = &obmc { | 34290 | if let Some(plan) = &obmc { |
| @@ -36201,6 +36278,17 @@ fn decode_inter_sub8_split4( | |||
| 36201 | // frame 1: plane 0,1,2 per leaf in leaf order) -- there is no shared | 36278 | // frame 1: plane 0,1,2 per leaf in leaf order) -- there is no shared |
| 36202 | // group unit and no 2x2-piece group prediction. | 36279 | // group unit and no 2x2-piece group prediction. |
| 36203 | let chroma_444 = ss_x(fctx) == 0 && ss_y(fctx) == 0; | 36280 | let chroma_444 = ss_x(fctx) == 0 && ss_y(fctx) == 0; |
| 36281 | + // 4:2:2 (lane-av1-422sub8rect): `is_chroma_reference` for a BLOCK_4X4 | ||
| 36282 | + // piece at ss (1, 0) is `(mi_col & 0x01) || !(bw & 0x01) || !ss_x` | ||
| 36283 | + // == ODD mi_col (av1_common_int.h:1459) -- pieces 1 and 3 of the group | ||
| 36284 | + // are their plane's own chroma references and each codes its own | ||
| 36285 | + // TX_4X4 unit right after its luma, exactly the key-frame split-group | ||
| 36286 | + // behaviour the pinned t422 fixture's frame 0 traces (groups (18,54) | ||
| 36287 | + // and (30,42): U+V read on BOTH odd-column leaves) and frame 1's | ||
| 36288 | + // inter group at mi(12,2) repeats (U+V TX_4X4 ctx 8 on leaf (12,3) | ||
| 36289 | + // alone -- the bottom-right leaf was skipped, so it codes nothing). | ||
| 36290 | + // The 4:2:0 shared group unit never exists at 4:2:2. | ||
| 36291 | + let chroma_422 = ss_x(fctx) == 1 && ss_y(fctx) == 0; | ||
| 36204 | for i in 0..4usize { | 36292 | for i in 0..4usize { |
| 36205 | let (dr, dc) = (i / 2, i % 2); | 36293 | let (dr, dc) = (i / 2, i % 2); |
| 36206 | let lmi = (gr + dr, gc + dc); | 36294 | let lmi = (gr + dr, gc + dc); |
| @@ -36253,7 +36341,9 @@ fn decode_inter_sub8_split4( | |||
| 36253 | } | 36341 | } |
| 36254 | // lane-sub8intra: the `BLOCK_4X4` twin of the HORZ/VERT arm -- | 36342 | // lane-sub8intra: the `BLOCK_4X4` twin of the HORZ/VERT arm -- |
| 36255 | // same [`decode_intra_sub8_leaf`], no tx-depth symbol, chroma on | 36343 | // same [`decode_intra_sub8_leaf`], no tx-depth symbol, chroma on |
| 36256 | - // the LAST sub-block (`is_chroma_reference` under 4:2:0). | 36344 | + // the chroma-reference sub-blocks (`is_chroma_reference`: the |
| 36345 | + // LAST one under 4:2:0, BOTH odd-column ones at 4:2:2, every | ||
| 36346 | + // one at 4:4:4). | ||
| 36257 | decode_intra_sub8_leaf( | 36347 | decode_intra_sub8_leaf( |
| 36258 | dec, | 36348 | dec, |
| 36259 | cdfs, | 36349 | cdfs, |
| @@ -36262,7 +36352,7 @@ fn decode_inter_sub8_split4( | |||
| 36262 | group_mi, | 36352 | group_mi, |
| 36263 | lmi, | 36353 | lmi, |
| 36264 | (B4, B4), | 36354 | (B4, B4), |
| 36265 | - chroma_444 || i == 3, | 36355 | + chroma_444 || (cmi & 1 == 1 && chroma_422) || i == 3, |
| 36266 | skip, | 36356 | skip, |
| 36267 | scan4, | 36357 | scan4, |
| 36268 | y, | 36358 | y, |
| @@ -36634,6 +36724,150 @@ fn decode_inter_sub8_split4( | |||
| 36634 | neighbours.record_mi_chroma(lmi, B4, B4, 1, &ug); | 36724 | neighbours.record_mi_chroma(lmi, B4, B4, 1, &ug); |
| 36635 | neighbours.record_mi_chroma(lmi, B4, B4, 2, &vg); | 36725 | neighbours.record_mi_chroma(lmi, B4, B4, 2, &vg); |
| 36636 | } | 36726 | } |
| 36727 | + // lane-av1-422sub8rect: the 4:2:2 per-piece arm. `is_chroma_reference` | ||
| 36728 | + // for a BLOCK_4X4 at ss (1, 0) is the odd mi_col (`av1_common_int.h` | ||
| 36729 | + // :1459), so THIS piece (right column of the group) is a chroma | ||
| 36730 | + // reference and codes its own U and V TX_4X4 units right after its | ||
| 36731 | + // luma -- measured on the pinned t422 fixture: frame 0 key-frame | ||
| 36732 | + // groups (18,54)/(30,42) read U+V on both odd-column leaves, and | ||
| 36733 | + // frame 1's inter group at mi(12,2) reads U+V TX_4X4 ctx 8 on leaf | ||
| 36734 | + // (12,3) alone (its bottom-right twin was skipped). | ||
| 36735 | + // | ||
| 36736 | + // The unit anchors at the FLOORED chroma cell | ||
| 36737 | + // (`av1_setup_dst_planes`' `(mi_col & !1) * MI >> ss_x`, the | ||
| 36738 | + // lane-av1-422kf2 rule), so the 4-px-wide square covers the group's | ||
| 36739 | + // whole chroma width, and the prediction walks | ||
| 36740 | + // `build_inter_predictors_sub8x8` (reconinter_template.inc): the | ||
| 36741 | + // left 2x4 half from the LEFT piece's own ref/mv/filters, the right | ||
| 36742 | + // 2x4 half from this piece's -- unless the left piece is intra (or | ||
| 36743 | + // off-frame), which makes `is_sub8x8_inter` false and predicts the | ||
| 36744 | + // whole 4x4 from THIS piece's own mv. A skipped reference piece | ||
| 36745 | + // still predicts (spec 7.11.3: `predict_inter_block_visit` runs | ||
| 36746 | + // before the `skip_txfm` guard) but codes no coefficients. | ||
| 36747 | + } else if chroma_422 && (cmi & 1) == 1 { | ||
| 36748 | + let (pc_ref, pc_mv, pc_hf, pc_vf) = piece[i].expect("inter piece recorded above"); | ||
| 36749 | + let unit_x = ((cmi & !1) * MI) >> ss_x(fctx); | ||
| 36750 | + let unit_y = py >> ss_y(fctx); | ||
| 36751 | + // `is_sub8x8_inter`'s left-neighbour probe (`mi[-1]`): the piece | ||
| 36752 | + // one mi to the LEFT, when it exists and is inter. | ||
| 36753 | + let piece_left = piece[i - 1]; | ||
| 36754 | + let build_c = move |_y: &mut PlaneBuf<'static>, | ||
| 36755 | + _u: &mut PlaneBuf<'static>, | ||
| 36756 | + _v: &mut PlaneBuf<'static>, | ||
| 36757 | + fctx: &crate::decode::FrameCtx, | ||
| 36758 | + out: &mut [Vec<u16>; 3]| { | ||
| 36759 | + let Some((pc_ref_y, sref_u, sref_v)) = ref_planes_deferred(pc_ref, refpix) else { | ||
| 36760 | + return; | ||
| 36761 | + }; | ||
| 36762 | + let pc_scale = mc::scale_factor(pc_ref_y.width, frame_width); | ||
| 36763 | + // The left piece's own reference planes + mv/filters, when it | ||
| 36764 | + // is an inter piece (`is_sub8x8_inter`'s `mi[-1]` probe). | ||
| 36765 | + let left = piece_left | ||
| 36766 | + .as_ref() | ||
| 36767 | + .map(|&(l_ref, l_mv, l_hf, l_vf)| { | ||
| 36768 | + (l_ref, l_mv, l_hf, l_vf) | ||
| 36769 | + }) | ||
| 36770 | + .and_then(|(l_ref, l_mv, l_hf, l_vf)| { | ||
| 36771 | + ref_planes_deferred(l_ref, refpix).map(|planes| { | ||
| 36772 | + let (lp_y, _, _) = planes; | ||
| 36773 | + let l_scale = mc::scale_factor(lp_y.width, frame_width); | ||
| 36774 | + (l_mv, l_hf, l_vf, planes, l_scale) | ||
| 36775 | + }) | ||
| 36776 | + }); | ||
| 36777 | + let mut pred_u = refill(std::mem::take(&mut out[1]), B4 * B4); | ||
| 36778 | + let mut pred_v = refill(std::mem::take(&mut out[2]), B4 * B4); | ||
| 36779 | + for (plane, dst) in [(sref_u, &mut pred_u), (sref_v, &mut pred_v)] { | ||
| 36780 | + let mut buf = vec![0u16; B4 * B4]; | ||
| 36781 | + // Right 2x4 half: this piece's own ref/mv/filters. | ||
| 36782 | + let mut half = vec![0u16; 2 * 4]; | ||
| 36783 | + mc::predict_maybe_scaled( | ||
| 36784 | + &plane.data, | ||
| 36785 | + plane.width, | ||
| 36786 | + plane.true_width, | ||
| 36787 | + plane.true_height, | ||
| 36788 | + mv_to_q4(unit_x + 2, pc_mv.1, ss_x(fctx)), | ||
| 36789 | + mv_to_q4(unit_y, pc_mv.0, ss_y(fctx)), | ||
| 36790 | + pc_scale, | ||
| 36791 | + 2, | ||
| 36792 | + 4, | ||
| 36793 | + pc_hf, | ||
| 36794 | + pc_vf, | ||
| 36795 | + &mut half, fctx, | ||
| 36796 | + ); | ||
| 36797 | + for row in 0..4 { | ||
| 36798 | + buf[row * B4 + 2..row * B4 + 4] | ||
| 36799 | + .copy_from_slice(&half[row * 2..row * 2 + 2]); | ||
| 36800 | + } | ||
| 36801 | + // Left 2x4 half: the LEFT piece's own mv/filters | ||
| 36802 | + // (sub8x8-inter); a mixed group (left piece intra or | ||
| 36803 | + // off-frame) predicts it from THIS piece too, which | ||
| 36804 | + // reduces to the whole-4x4-from-own rule. | ||
| 36805 | + let (l_mv, l_hf, l_vf, l_planes, l_scale) = match left { | ||
| 36806 | + Some((l_mv, l_hf, l_vf, l_planes, l_scale)) => { | ||
| 36807 | + (l_mv, l_hf, l_vf, l_planes, l_scale) | ||
| 36808 | + } | ||
| 36809 | + None => (pc_mv, pc_hf, pc_vf, (pc_ref_y, sref_u, sref_v), pc_scale), | ||
| 36810 | + }; | ||
| 36811 | + let (_, l_ref_u, _) = l_planes; | ||
| 36812 | + mc::predict_maybe_scaled( | ||
| 36813 | + &l_ref_u.data, | ||
| 36814 | + l_ref_u.width, | ||
| 36815 | + l_ref_u.true_width, | ||
| 36816 | + l_ref_u.true_height, | ||
| 36817 | + mv_to_q4(unit_x, l_mv.1, ss_x(fctx)), | ||
| 36818 | + mv_to_q4(unit_y, l_mv.0, ss_y(fctx)), | ||
| 36819 | + l_scale, | ||
| 36820 | + 2, | ||
| 36821 | + 4, | ||
| 36822 | + l_hf, | ||
| 36823 | + l_vf, | ||
| 36824 | + &mut half, fctx, | ||
| 36825 | + ); | ||
| 36826 | + for row in 0..4 { | ||
| 36827 | + buf[row * B4..row * B4 + 2].copy_from_slice(&half[row * 2..row * 2 + 2]); | ||
| 36828 | + } | ||
| 36829 | + dst.copy_from_slice(&buf); | ||
| 36830 | + } | ||
| 36831 | + out[1] = pred_u; | ||
| 36832 | + out[2] = pred_v; | ||
| 36833 | + }; | ||
| 36834 | + let (pred_cu, pred_cv): (Vec<u16>, Vec<u16>); | ||
| 36835 | + let (su, sv) = if recon_deferred(fctx) { | ||
| 36836 | + push_pred(fctx, build_c); | ||
| 36837 | + ( | ||
| 36838 | + Pred::Cur { plane: 1, stride: B4, off: 0 }, | ||
| 36839 | + Pred::Cur { plane: 2, stride: B4, off: 0 }, | ||
| 36840 | + ) | ||
| 36841 | + } else { | ||
| 36842 | + let mut built: [Vec<u16>; 3] = Default::default(); | ||
| 36843 | + build_c(y, u, v, fctx, &mut built); | ||
| 36844 | + let [_, bu, bv] = built; | ||
| 36845 | + (pred_cu, pred_cv) = (bu, bv); | ||
| 36846 | + (Pred::Inline(&pred_cu, B4), Pred::Inline(&pred_cv, B4)) | ||
| 36847 | + }; | ||
| 36848 | + // The unit's entropy context: one chroma cell wide, floored -- | ||
| 36849 | + // [`Neighbours::around_mi_422_chroma`] at the unit's own 8x4 | ||
| 36850 | + // luma span (the [`sub8_leaf_chroma422`] rule). | ||
| 36851 | + let ctx_mi = (rmi, cmi & !1); | ||
| 36852 | + let ca = neighbours.around_mi_422_chroma(ctx_mi, 8, 4); | ||
| 36853 | + if skip { | ||
| 36854 | + push_mc(1, unit_x, unit_y, B4, su, &ZERO_RESIDUAL[..B4 * B4], fctx); | ||
| 36855 | + push_mc(2, unit_x, unit_y, B4, sv, &ZERO_RESIDUAL[..B4 * B4], fctx); | ||
| 36856 | + neighbours.record_mi_chroma(ctx_mi, 8, 4, 1, &ZERO_RESIDUAL[..B4 * B4]); | ||
| 36857 | + neighbours.record_mi_chroma(ctx_mi, 8, 4, 2, &ZERO_RESIDUAL[..B4 * B4]); | ||
| 36858 | + } else { | ||
| 36859 | + hit!(CHROMA422_INTER_SUB8_HITS); | ||
| 36860 | + let (ug, _) = read_inter_plane( | ||
| 36861 | + dec, cdfs, TxbSet::Chroma4, scan4, 1, ca[1], 0, u, unit_x, unit_y, B4, | ||
| 36862 | + base_q_idx, su, Some(piece_tx_type), None, fctx, | ||
| 36863 | + )?; | ||
| 36864 | + let (vg, _) = read_inter_plane( | ||
| 36865 | + dec, cdfs, TxbSet::Chroma4, scan4, 2, ca[2], 0, v, unit_x, unit_y, B4, | ||
| 36866 | + base_q_idx, sv, Some(piece_tx_type), None, fctx, | ||
| 36867 | + )?; | ||
| 36868 | + neighbours.record_mi_chroma(ctx_mi, 8, 4, 1, &ug); | ||
| 36869 | + neighbours.record_mi_chroma(ctx_mi, 8, 4, 2, &vg); | ||
| 36870 | + } | ||
| 36637 | } | 36871 | } |
| 36638 | neighbours.record_mode_mi(rmi, cmi, 1, 1, DC_PRED); | 36872 | neighbours.record_mode_mi(rmi, cmi, 1, 1, DC_PRED); |
| 36639 | neighbours.record_inter_rect_mi(lmi, 1, 1, skip, true, ref_frame, resolved_filter, false); | 36873 | neighbours.record_inter_rect_mi(lmi, 1, 1, skip, true, ref_frame, resolved_filter, false); |
| @@ -36673,7 +36907,7 @@ fn decode_inter_sub8_split4( | |||
| 36673 | // frames mismatched ffmpeg by +-1..7 (class | 36907 | // frames mismatched ffmpeg by +-1..7 (class |
| 36674 | // `override-slot-on-one-arm`, this lane's own 10-bit film gate | 36908 | // `override-slot-on-one-arm`, this lane's own 10-bit film gate |
| 36675 | // regression at 1ad7e0fc; port of lane-av1-cfl's 7c6dad53). | 36909 | // regression at 1ad7e0fc; port of lane-av1-cfl's 7c6dad53). |
| 36676 | - if !chroma_444 && !intra_chroma { | 36910 | + if !chroma_444 && !chroma_422 && !intra_chroma { |
| 36677 | neighbours.record_uv_mode_mi(gr, gc, 2, 2, DC_PRED); | 36911 | neighbours.record_uv_mode_mi(gr, gc, 2, 2, DC_PRED); |
| 36678 | } | 36912 | } |
| 36679 | // lane-t900 r23 (class [[new-map-ignores-tile-edge]]: a neighbour map | 36913 | // lane-t900 r23 (class [[new-map-ignores-tile-edge]]: a neighbour map |
| @@ -36685,10 +36919,12 @@ fn decode_inter_sub8_split4( | |||
| 36685 | // 0). No sub-8x8 piece can itself be a palette (`av1_allow_palette` | 36919 | // 0). No sub-8x8 piece can itself be a palette (`av1_allow_palette` |
| 36686 | // needs `bsize >= BLOCK_8X8`), so the group always clears. | 36920 | // needs `bsize >= BLOCK_8X8`), so the group always clears. |
| 36687 | record_strip_palette(neighbours, (gr, gc), 8, 8, 0, [0u16; 8], 0, [0u16; 8]); | 36921 | record_strip_palette(neighbours, (gr, gc), 8, 8, 0, [0u16; 8], 0, [0u16; 8]); |
| 36688 | - if !chroma_444 && !intra_chroma { | 36922 | + if !chroma_444 && !chroma_422 && !intra_chroma { |
| 36689 | // Chroma, once for the whole group, on the last sub-block's own `skip` | 36923 | // Chroma, once for the whole group, on the last sub-block's own `skip` |
| 36690 | // flag -- prediction from all four sub-blocks (2x2 pieces), residual as | 36924 | // flag -- prediction from all four sub-blocks (2x2 pieces), residual as |
| 36691 | - // one TX_4X4 unit per plane. | 36925 | + // one TX_4X4 unit per plane. lane-av1-422sub8rect: 4:2:2 never takes |
| 36926 | + // this arm -- the shared group unit does not exist at ss (1, 0); each | ||
| 36927 | + // odd-column piece coded its own chroma inside the loop above. | ||
| 36692 | // `is_sub8x8_inter` (reconinter_template.inc:54) is false as soon as ANY | 36928 | // `is_sub8x8_inter` (reconinter_template.inc:54) is false as soon as ANY |
| 36693 | // mi of the group is intra: the group's 4x4 chroma is then predicted WHOLE | 36929 | // mi of the group is intra: the group's 4x4 chroma is then predicted WHOLE |
| 36694 | // from the chroma-reference (last) sub-block's own mv, not in 2x2 pieces. | 36930 | // from the chroma-reference (last) sub-block's own mv, not in 2x2 pieces. |
| @@ -37213,6 +37449,29 @@ fn decode_intra_sub8_leaf( | |||
| 37213 | // ours ctx 2 where libaom gathers 1). | 37449 | // ours ctx 2 where libaom gathers 1). |
| 37214 | record_strip_palette(neighbours, (gr, gc), 8, 8, 0, [0u16; 8], 0, [0u16; 8]); | 37450 | record_strip_palette(neighbours, (gr, gc), 8, 8, 0, [0u16; 8], 0, [0u16; 8]); |
| 37215 | if !has_chroma { | 37451 | if !has_chroma { |
| 37452 | + // lane-av1-422sub8rect: 4:2:2 has no shared group unit whose tail | ||
| 37453 | + // would stamp the mi map (`is_chroma_reference` runs per piece), so | ||
| 37454 | + // a non-referenced piece publishes its own cell -- libaom leaves | ||
| 37455 | + // `uv_mode` unset on it, `is_smooth` reads 0, i.e. DC_PRED. | ||
| 37456 | + if ss_x(fctx) == 1 && ss_y(fctx) == 0 { | ||
| 37457 | + neighbours.record_uv_mode_mi(lmi.0, lmi.1, 1, 1, DC_PRED); | ||
| 37458 | + } | ||
| 37459 | + return Ok(mode); | ||
| 37460 | + } | ||
| 37461 | + // lane-av1-422sub8rect: at 4:2:2 this (odd-column) piece is its plane's | ||
| 37462 | + // OWN chroma reference -- the key-frame split group's per-leaf TX_4X4 | ||
| 37463 | + // model, floored anchor and per-chroma-cell context included | ||
| 37464 | + // ([`sub8_leaf_chroma422`], measured on the pinned t422 fixture frame 0: | ||
| 37465 | + // groups (18,54)/(30,42) code U+V on both odd-column leaves), never a | ||
| 37466 | + // shared group unit. Inter frames code no intrabc, so `intrabc_dv` is | ||
| 37467 | + // `None` here. | ||
| 37468 | + if ss_x(fctx) == 1 && ss_y(fctx) == 0 { | ||
| 37469 | + sub8_leaf_chroma422( | ||
| 37470 | + dec, cdfs, neighbours, lmi, uv_mode, 0, alpha, skip, | ||
| 37471 | + None, y, u, v, scan4, base_q_idx, | ||
| 37472 | + neighbours.smooth_uv_neighbour(lmi.0, lmi.1, r, c, fctx), | ||
| 37473 | + (bw, bh), fctx, | ||
| 37474 | + )?; | ||
| 37216 | return Ok(mode); | 37475 | return Ok(mode); |
| 37217 | } | 37476 | } |
| 37218 | // The group's single 4x4 chroma unit, intra-predicted from THIS | 37477 | // The group's single 4x4 chroma unit, intra-predicted from THIS |
| @@ -38292,18 +38551,30 @@ fn decode_inter_block8( | |||
| 38292 | // bookkeeping. Always `false` outside a `TxMode::Select` inter frame. | 38551 | // bookkeeping. Always `false` outside a `TxMode::Select` inter frame. |
| 38293 | let split8; | 38552 | let split8; |
| 38294 | const SIDE: usize = 8; | 38553 | const SIDE: usize = 8; |
| 38295 | - // lane-av1-444: this 8x8 leaf's chroma plane block is `8 >> ss` a side -- | 38554 | + // lane-av1-444 / lane-av1-422sub8rect: this 8x8 leaf's chroma plane block |
| 38296 | - // 4 at 4:2:0 (one TX_4X4 unit) and the full 8 at 4:4:4, where libaom | 38555 | + // is `ss_size_lookup[BLOCK_8X8][ss_x][ss_y]` -- 4:2:0 BLOCK_4X4 (one |
| 38297 | - // codes ONE TX_8X8 unit (`av1_get_max_uv_txsize(BLOCK_8X8)` at ss 0/0, | 38556 | + // TX_4X4 unit), 4:4:4 BLOCK_8X8 (ONE TX_8X8 unit, `av1_get_max_uv_txsize` |
| 38298 | - // measured against aomdec's EC_COEFF on `av1-profile1-444.ivf` frame 1: | 38557 | + // at ss 0/0, measured against aomdec's EC_COEFF on `av1-profile1-444.ivf` |
| 38299 | - // plane=1 tx=TX_8X8 per 8x8 block, not a 4:2:0 4x4). | 38558 | + // frame 1), and 4:2:2 BLOCK_4X8 (ONE TX_4X8 RECT unit per plane, measured |
| 38300 | - let chroma_side: usize = SIDE >> ss_x(fctx); | 38559 | + // on the pinned t422 fixture: frame 1 mi(0,0) reads plane 1 tx_size 5 == |
| 38301 | - let (chroma_set, chroma_scan): (TxbSet, &[u16]) = if chroma_side == 8 { | 38560 | + // TX_4X8 at rng 55168 right after the agreed luma TX_8X8 txb_skip -- the |
| 38561 | + // old `SIDE >> ss_x` square read was the first-divergence defect this | ||
| 38562 | + // port fixes). | ||
| 38563 | + let chroma_w: usize = SIDE >> ss_x(fctx); | ||
| 38564 | + let chroma_h: usize = SIDE >> ss_y(fctx); | ||
| 38565 | + let chroma_422 = ss_x(fctx) == 1 && ss_y(fctx) == 0; | ||
| 38566 | + let (chroma_set, chroma_scan): (TxbSet, &[u16]) = if chroma_422 { | ||
| 38567 | + // `get_txsize_entropy_ctx(TX_4X8)`: the rect fills its plane block, | ||
| 38568 | + // so the tables are the rect set and the SCAN_4X8 walk, exactly the | ||
| 38569 | + // pairing the key-frame BLOCK_4X8 arm (`decode_block`'s lane-av1-422f | ||
| 38570 | + // table) reads byte-exact. | ||
| 38571 | + (TxbSet::ChromaRect8x4, &SCAN_4X8[..]) | ||
| 38572 | + } else if chroma_w == 8 { | ||
| 38302 | (TxbSet::Chroma8, scan8) | 38573 | (TxbSet::Chroma8, scan8) |
| 38303 | } else { | 38574 | } else { |
| 38304 | (TxbSet::Chroma4, scan4) | 38575 | (TxbSet::Chroma4, scan4) |
| 38305 | }; | 38576 | }; |
| 38306 | - let chroma_tx = if chroma_side == 8 { TX8 } else { TX4 }; | 38577 | + let chroma_tx = if chroma_w == 8 { TX8 } else { TX4 }; |
| 38307 | 38578 | ||
| 38308 | let (r, c) = outer_at; | 38579 | let (r, c) = outer_at; |
| 38309 | // lane-inter8 r2: this leaf's OWN mi cell, not the enclosing 16x16's -- | 38580 | // lane-inter8 r2: this leaf's OWN mi cell, not the enclosing 16x16's -- |
| @@ -38804,13 +39075,13 @@ fn decode_inter_block8( | |||
| 38804 | }; | 39075 | }; |
| 38805 | if let Some(mask_y) = mask_y { | 39076 | if let Some(mask_y) = mask_y { |
| 38806 | mc::blend_masked_compound( | 39077 | mc::blend_masked_compound( |
| 38807 | - &inter0_y, &inter1_y, mask_y, SIDE, SIDE, SIDE, false, &mut pred_y, fctx, | 39078 | + &inter0_y, &inter1_y, mask_y, SIDE, SIDE, SIDE, 0, 0, &mut pred_y, fctx, |
| 38808 | ); | 39079 | ); |
| 38809 | } else { | 39080 | } else { |
| 38810 | mc::combine_compound(&inter0_y, &inter1_y, fwd_offset, bck_offset, &mut pred_y, fctx); | 39081 | mc::combine_compound(&inter0_y, &inter1_y, fwd_offset, bck_offset, &mut pred_y, fctx); |
| 38811 | } | 39082 | } |
| 38812 | 39083 | ||
| 38813 | - let mut inter0_u = vec![0i32; chroma_side * chroma_side]; | 39084 | + let mut inter0_u = vec![0i32; chroma_w * chroma_h]; |
| 38814 | mc::predict_compound_intermediate( | 39085 | mc::predict_compound_intermediate( |
| 38815 | &pu0.data, | 39086 | &pu0.data, |
| 38816 | pu0.width, | 39087 | pu0.width, |
| @@ -38819,13 +39090,13 @@ fn decode_inter_block8( | |||
| 38819 | mv_to_q4(cpx, mv0.1, ss_x(fctx)), | 39090 | mv_to_q4(cpx, mv0.1, ss_x(fctx)), |
| 38820 | mv_to_q4(cpy, mv0.0, ss_x(fctx)), | 39091 | mv_to_q4(cpy, mv0.0, ss_x(fctx)), |
| 38821 | scale0, | 39092 | scale0, |
| 38822 | - chroma_side, | 39093 | + chroma_w, |
| 38823 | - chroma_side, | 39094 | + chroma_h, |
| 38824 | h_filter, | 39095 | h_filter, |
| 38825 | v_filter, | 39096 | v_filter, |
| 38826 | &mut inter0_u, fctx, | 39097 | &mut inter0_u, fctx, |
| 38827 | ); | 39098 | ); |
| 38828 | - let mut inter1_u = vec![0i32; chroma_side * chroma_side]; | 39099 | + let mut inter1_u = vec![0i32; chroma_w * chroma_h]; |
| 38829 | mc::predict_compound_intermediate( | 39100 | mc::predict_compound_intermediate( |
| 38830 | &pu1.data, | 39101 | &pu1.data, |
| 38831 | pu1.width, | 39102 | pu1.width, |
| @@ -38834,29 +39105,30 @@ fn decode_inter_block8( | |||
| 38834 | mv_to_q4(cpx, mv1.1, ss_x(fctx)), | 39105 | mv_to_q4(cpx, mv1.1, ss_x(fctx)), |
| 38835 | mv_to_q4(cpy, mv1.0, ss_x(fctx)), | 39106 | mv_to_q4(cpy, mv1.0, ss_x(fctx)), |
| 38836 | scale1, | 39107 | scale1, |
| 38837 | - chroma_side, | 39108 | + chroma_w, |
| 38838 | - chroma_side, | 39109 | + chroma_h, |
| 38839 | h_filter, | 39110 | h_filter, |
| 38840 | v_filter, | 39111 | v_filter, |
| 38841 | &mut inter1_u, fctx, | 39112 | &mut inter1_u, fctx, |
| 38842 | ); | 39113 | ); |
| 38843 | - let mut pred_u = refill(std::mem::take(&mut out[1]), chroma_side * chroma_side); | 39114 | + let mut pred_u = refill(std::mem::take(&mut out[1]), chroma_w * chroma_h); |
| 38844 | if let Some(mask_y) = mask_y { | 39115 | if let Some(mask_y) = mask_y { |
| 38845 | mc::blend_masked_compound( | 39116 | mc::blend_masked_compound( |
| 38846 | &inter0_u, | 39117 | &inter0_u, |
| 38847 | &inter1_u, | 39118 | &inter1_u, |
| 38848 | mask_y, | 39119 | mask_y, |
| 38849 | SIDE, | 39120 | SIDE, |
| 38850 | - chroma_side, | 39121 | + chroma_w, |
| 38851 | - chroma_side, | 39122 | + chroma_h, |
| 38852 | - ss_x(fctx) == 1 && ss_y(fctx) == 1, | 39123 | + ss_x(fctx), |
| 39124 | +ss_y(fctx), | ||
| 38853 | &mut pred_u, fctx, | 39125 | &mut pred_u, fctx, |
| 38854 | ); | 39126 | ); |
| 38855 | } else { | 39127 | } else { |
| 38856 | mc::combine_compound(&inter0_u, &inter1_u, fwd_offset, bck_offset, &mut pred_u, fctx); | 39128 | mc::combine_compound(&inter0_u, &inter1_u, fwd_offset, bck_offset, &mut pred_u, fctx); |
| 38857 | } | 39129 | } |
| 38858 | 39130 | ||
| 38859 | - let mut inter0_v = vec![0i32; chroma_side * chroma_side]; | 39131 | + let mut inter0_v = vec![0i32; chroma_w * chroma_h]; |
| 38860 | mc::predict_compound_intermediate( | 39132 | mc::predict_compound_intermediate( |
| 38861 | &pv0.data, | 39133 | &pv0.data, |
| 38862 | pv0.width, | 39134 | pv0.width, |
| @@ -38865,13 +39137,13 @@ fn decode_inter_block8( | |||
| 38865 | mv_to_q4(cpx, mv0.1, ss_x(fctx)), | 39137 | mv_to_q4(cpx, mv0.1, ss_x(fctx)), |
| 38866 | mv_to_q4(cpy, mv0.0, ss_x(fctx)), | 39138 | mv_to_q4(cpy, mv0.0, ss_x(fctx)), |
| 38867 | scale0, | 39139 | scale0, |
| 38868 | - chroma_side, | 39140 | + chroma_w, |
| 38869 | - chroma_side, | 39141 | + chroma_h, |
| 38870 | h_filter, | 39142 | h_filter, |
| 38871 | v_filter, | 39143 | v_filter, |
| 38872 | &mut inter0_v, fctx, | 39144 | &mut inter0_v, fctx, |
| 38873 | ); | 39145 | ); |
| 38874 | - let mut inter1_v = vec![0i32; chroma_side * chroma_side]; | 39146 | + let mut inter1_v = vec![0i32; chroma_w * chroma_h]; |
| 38875 | mc::predict_compound_intermediate( | 39147 | mc::predict_compound_intermediate( |
| 38876 | &pv1.data, | 39148 | &pv1.data, |
| 38877 | pv1.width, | 39149 | pv1.width, |
| @@ -38880,22 +39152,23 @@ fn decode_inter_block8( | |||
| 38880 | mv_to_q4(cpx, mv1.1, ss_x(fctx)), | 39152 | mv_to_q4(cpx, mv1.1, ss_x(fctx)), |
| 38881 | mv_to_q4(cpy, mv1.0, ss_x(fctx)), | 39153 | mv_to_q4(cpy, mv1.0, ss_x(fctx)), |
| 38882 | scale1, | 39154 | scale1, |
| 38883 | - chroma_side, | 39155 | + chroma_w, |
| 38884 | - chroma_side, | 39156 | + chroma_h, |
| 38885 | h_filter, | 39157 | h_filter, |
| 38886 | v_filter, | 39158 | v_filter, |
| 38887 | &mut inter1_v, fctx, | 39159 | &mut inter1_v, fctx, |
| 38888 | ); | 39160 | ); |
| 38889 | - let mut pred_v = refill(std::mem::take(&mut out[2]), chroma_side * chroma_side); | 39161 | + let mut pred_v = refill(std::mem::take(&mut out[2]), chroma_w * chroma_h); |
| 38890 | if let Some(mask_y) = mask_y { | 39162 | if let Some(mask_y) = mask_y { |
| 38891 | mc::blend_masked_compound( | 39163 | mc::blend_masked_compound( |
| 38892 | &inter0_v, | 39164 | &inter0_v, |
| 38893 | &inter1_v, | 39165 | &inter1_v, |
| 38894 | mask_y, | 39166 | mask_y, |
| 38895 | SIDE, | 39167 | SIDE, |
| 38896 | - chroma_side, | 39168 | + chroma_w, |
| 38897 | - chroma_side, | 39169 | + chroma_h, |
| 38898 | - ss_x(fctx) == 1 && ss_y(fctx) == 1, | 39170 | + ss_x(fctx), |
| 39171 | +ss_y(fctx), | ||
| 38899 | &mut pred_v, fctx, | 39172 | &mut pred_v, fctx, |
| 38900 | ); | 39173 | ); |
| 38901 | } else { | 39174 | } else { |
| @@ -38910,8 +39183,8 @@ fn decode_inter_block8( | |||
| 38910 | push_pred(fctx, build); | 39183 | push_pred(fctx, build); |
| 38911 | ( | 39184 | ( |
| 38912 | Pred::Cur { plane: 0, stride: SIDE, off: 0 }, | 39185 | Pred::Cur { plane: 0, stride: SIDE, off: 0 }, |
| 38913 | - Pred::Cur { plane: 1, stride: chroma_side, off: 0 }, | 39186 | + Pred::Cur { plane: 1, stride: chroma_w, off: 0 }, |
| 38914 | - Pred::Cur { plane: 2, stride: chroma_side, off: 0 }, | 39187 | + Pred::Cur { plane: 2, stride: chroma_w, off: 0 }, |
| 38915 | ) | 39188 | ) |
| 38916 | } else { | 39189 | } else { |
| 38917 | let mut built: [Vec<u16>; 3] = Default::default(); | 39190 | let mut built: [Vec<u16>; 3] = Default::default(); |
| @@ -38920,8 +39193,8 @@ fn decode_inter_block8( | |||
| 38920 | (pred_y, pred_u, pred_v) = (by, bu, bv); | 39193 | (pred_y, pred_u, pred_v) = (by, bu, bv); |
| 38921 | ( | 39194 | ( |
| 38922 | Pred::Inline(&pred_y, SIDE), | 39195 | Pred::Inline(&pred_y, SIDE), |
| 38923 | - Pred::Inline(&pred_u, chroma_side), | 39196 | + Pred::Inline(&pred_u, chroma_w), |
| 38924 | - Pred::Inline(&pred_v, chroma_side), | 39197 | + Pred::Inline(&pred_v, chroma_w), |
| 38925 | ) | 39198 | ) |
| 38926 | }; | 39199 | }; |
| 38927 | split8 = read_block_tx_size( | 39200 | split8 = read_block_tx_size( |
| @@ -38938,25 +39211,43 @@ fn decode_inter_block8( | |||
| 38938 | .is_some(); | 39211 | .is_some(); |
| 38939 | if skip { | 39212 | if skip { |
| 38940 | push_mc(0, px, py, SIDE, sy, &ZERO_RESIDUAL[..SIDE * SIDE], fctx); | 39213 | push_mc(0, px, py, SIDE, sy, &ZERO_RESIDUAL[..SIDE * SIDE], fctx); |
| 38941 | - push_mc(1, | 39214 | + // lane-av1-422sub8rect: the plane block is the (chroma_w, |
| 39215 | + // chroma_h) rect at 4:2:2 -- the recorded write is | ||
| 39216 | + // stride `chroma_w`, full `chroma_h` rows. | ||
| 39217 | + push_mc_rect(1, | ||
| 38942 | cpx, | 39218 | cpx, |
| 38943 | cpy, | 39219 | cpy, |
| 38944 | - chroma_side, | 39220 | + chroma_w, |
| 39221 | + chroma_w, | ||
| 39222 | + chroma_h, | ||
| 38945 | su, | 39223 | su, |
| 38946 | - &ZERO_RESIDUAL[..chroma_side * chroma_side], fctx, | 39224 | + &ZERO_RESIDUAL[..chroma_w * chroma_h], fctx, |
| 38947 | ); | 39225 | ); |
| 38948 | - push_mc(2, | 39226 | + push_mc_rect(2, |
| 38949 | cpx, | 39227 | cpx, |
| 38950 | cpy, | 39228 | cpy, |
| 38951 | - chroma_side, | 39229 | + chroma_w, |
| 39230 | + chroma_w, | ||
| 39231 | + chroma_h, | ||
| 38952 | sv, | 39232 | sv, |
| 38953 | - &ZERO_RESIDUAL[..chroma_side * chroma_side], fctx, | 39233 | + &ZERO_RESIDUAL[..chroma_w * chroma_h], fctx, |
| 38954 | ); | 39234 | ); |
| 38955 | luma_grid = Grid::Zero(SIDE * SIDE); | 39235 | luma_grid = Grid::Zero(SIDE * SIDE); |
| 38956 | - u_grid = Grid::Zero(chroma_side * chroma_side); | 39236 | + u_grid = Grid::Zero(chroma_w * chroma_h); |
| 38957 | - v_grid = Grid::Zero(chroma_side * chroma_side); | 39237 | + v_grid = Grid::Zero(chroma_w * chroma_h); |
| 38958 | } else { | 39238 | } else { |
| 38959 | let around = neighbours.around_mi(leaf_mi, 8); | 39239 | let around = neighbours.around_mi(leaf_mi, 8); |
| 39240 | + // lane-av1-422sub8rect: the 4:2:2 chroma unit is the | ||
| 39241 | + // TX_4X8 rect -- its `txb_skip_ctx` reads per chroma | ||
| 39242 | + // 4-px cell ([`Neighbours::around_mi_422_chroma`], the | ||
| 39243 | + // key-frame BLOCK_4X8 arm's own context walk), and the | ||
| 39244 | + // coefficients go through the inter rect reader with the | ||
| 39245 | + // inherited luma tx type. | ||
| 39246 | + let chroma_around = if chroma_422 { | ||
| 39247 | + neighbours.around_mi_422_chroma(leaf_mi, 8, 8) | ||
| 39248 | + } else { | ||
| 39249 | + around | ||
| 39250 | + }; | ||
| 38960 | let (grid8, luma_tx_type) = read_inter_luma8( | 39251 | let (grid8, luma_tx_type) = read_inter_luma8( |
| 38961 | dec, | 39252 | dec, |
| 38962 | cdfs, | 39253 | cdfs, |
| @@ -38974,42 +39265,82 @@ fn decode_inter_block8( | |||
| 38974 | split8, fctx, | 39265 | split8, fctx, |
| 38975 | )?; | 39266 | )?; |
| 38976 | luma_grid = grid8; | 39267 | luma_grid = grid8; |
| 38977 | - u_grid = read_inter_plane( | 39268 | + u_grid = if chroma_422 { |
| 38978 | - dec, | 39269 | + read_inter_plane_rect( |
| 38979 | - cdfs, | 39270 | + dec, |
| 38980 | - chroma_set, | 39271 | + cdfs, |
| 38981 | - chroma_scan, | 39272 | + chroma_set, |
| 38982 | - 1, | 39273 | + (chroma_w, chroma_h), |
| 38983 | - around[1], | 39274 | + chroma_w, |
| 38984 | - mode_for_tx, | 39275 | + 1, |
| 38985 | - u, | 39276 | + chroma_around[1], |
| 38986 | - cpx, | 39277 | + mode_for_tx, |
| 38987 | - cpy, | 39278 | + u, |
| 38988 | - chroma_side, | 39279 | + cpx, |
| 38989 | - base_q_idx, | 39280 | + cpy, |
| 38990 | - su, | 39281 | + su, |
| 38991 | - Some(luma_tx_type), | 39282 | + Some(luma_tx_type), |
| 38992 | - None, fctx, | 39283 | + None, fctx, |
| 38993 | - )? | 39284 | + )? |
| 38994 | - .0; | 39285 | + .0 |
| 38995 | - v_grid = read_inter_plane( | 39286 | + } else { |
| 38996 | - dec, | 39287 | + read_inter_plane( |
| 38997 | - cdfs, | 39288 | + dec, |
| 38998 | - chroma_set, | 39289 | + cdfs, |
| 38999 | - chroma_scan, | 39290 | + chroma_set, |
| 39000 | - 2, | 39291 | + chroma_scan, |
| 39001 | - around[2], | 39292 | + 1, |
| 39002 | - mode_for_tx, | 39293 | + chroma_around[1], |
| 39003 | - v, | 39294 | + mode_for_tx, |
| 39004 | - cpx, | 39295 | + u, |
| 39005 | - cpy, | 39296 | + cpx, |
| 39006 | - chroma_side, | 39297 | + cpy, |
| 39007 | - base_q_idx, | 39298 | + chroma_w, |
| 39008 | - sv, | 39299 | + base_q_idx, |
| 39009 | - Some(luma_tx_type), | 39300 | + su, |
| 39010 | - None, fctx, | 39301 | + Some(luma_tx_type), |
| 39011 | - )? | 39302 | + None, fctx, |
| 39012 | - .0; | 39303 | + )? |
| 39304 | + .0 | ||
| 39305 | + }; | ||
| 39306 | + v_grid = if chroma_422 { | ||
| 39307 | + read_inter_plane_rect( | ||
| 39308 | + dec, | ||
| 39309 | + cdfs, | ||
| 39310 | + chroma_set, | ||
| 39311 | + (chroma_w, chroma_h), | ||
| 39312 | + chroma_w, | ||
| 39313 | + 2, | ||
| 39314 | + chroma_around[2], | ||
| 39315 | + mode_for_tx, | ||
| 39316 | + v, | ||
| 39317 | + cpx, | ||
| 39318 | + cpy, | ||
| 39319 | + sv, | ||
| 39320 | + Some(luma_tx_type), | ||
| 39321 | + None, fctx, | ||
| 39322 | + )? | ||
| 39323 | + .0 | ||
| 39324 | + } else { | ||
| 39325 | + read_inter_plane( | ||
| 39326 | + dec, | ||
| 39327 | + cdfs, | ||
| 39328 | + chroma_set, | ||
| 39329 | + chroma_scan, | ||
| 39330 | + 2, | ||
| 39331 | + chroma_around[2], | ||
| 39332 | + mode_for_tx, | ||
| 39333 | + v, | ||
| 39334 | + cpx, | ||
| 39335 | + cpy, | ||
| 39336 | + chroma_w, | ||
| 39337 | + base_q_idx, | ||
| 39338 | + sv, | ||
| 39339 | + Some(luma_tx_type), | ||
| 39340 | + None, fctx, | ||
| 39341 | + )? | ||
| 39342 | + .0 | ||
| 39343 | + }; | ||
| 39013 | } | 39344 | } |
| 39014 | // lane-inter8 r2: the COMPOUND leaf used to return here | 39345 | // lane-inter8 r2: the COMPOUND leaf used to return here |
| 39015 | // WITHOUT the end-of-function `record_mi`/`fill_lf_grid` the | 39346 | // WITHOUT the end-of-function `record_mi`/`fill_lf_grid` the |
| @@ -39495,7 +39826,7 @@ fn decode_inter_block8( | |||
| 39495 | SIDE, | 39826 | SIDE, |
| 39496 | SIDE, | 39827 | SIDE, |
| 39497 | SIDE, | 39828 | SIDE, |
| 39498 | - chroma_side, | 39829 | + chroma_w, |
| 39499 | px, | 39830 | px, |
| 39500 | py, | 39831 | py, |
| 39501 | cpx, | 39832 | cpx, |
| @@ -39503,6 +39834,7 @@ fn decode_inter_block8( | |||
| 39503 | refpix, | 39834 | refpix, |
| 39504 | interp_fixed, | 39835 | interp_fixed, |
| 39505 | frame_width, | 39836 | frame_width, |
| 39837 | + (ss_x(fctx), ss_y(fctx)), | ||
| 39506 | )?) | 39838 | )?) |
| 39507 | } else { | 39839 | } else { |
| 39508 | None | 39840 | None |
| @@ -39519,15 +39851,15 @@ fn decode_inter_block8( | |||
| 39519 | return; | 39851 | return; |
| 39520 | }; | 39852 | }; |
| 39521 | let mut pred_y = refill(std::mem::take(&mut out[0]), SIDE * SIDE); | 39853 | let mut pred_y = refill(std::mem::take(&mut out[0]), SIDE * SIDE); |
| 39522 | - let mut pred_u = refill(std::mem::take(&mut out[1]), chroma_side * chroma_side); | 39854 | + let mut pred_u = refill(std::mem::take(&mut out[1]), chroma_w * chroma_h); |
| 39523 | - let mut pred_v = refill(std::mem::take(&mut out[2]), chroma_side * chroma_side); | 39855 | + let mut pred_v = refill(std::mem::take(&mut out[2]), chroma_w * chroma_h); |
| 39524 | // Merge of lane-gmaffine (this leaf's own switchable filters) with | 39856 | // Merge of lane-gmaffine (this leaf's own switchable filters) with |
| 39525 | // lane-scaledref (spec 7.11.3.3's scaled walk): same kernels either | 39857 | // lane-scaledref (spec 7.11.3.3's scaled walk): same kernels either |
| 39526 | // way, only the sample walk differs. | 39858 | // way, only the sample walk differs. |
| 39527 | - for (plane, x, y, dim, dst) in [ | 39859 | + for (plane, x, y, (dim_w, dim_h), dst) in [ |
| 39528 | - (sref_y, px, py, SIDE, &mut pred_y), | 39860 | + (sref_y, px, py, (SIDE, SIDE), &mut pred_y), |
| 39529 | - (sref_u, cpx, cpy, chroma_side, &mut pred_u), | 39861 | + (sref_u, cpx, cpy, (chroma_w, chroma_h), &mut pred_u), |
| 39530 | - (sref_v, cpx, cpy, chroma_side, &mut pred_v), | 39862 | + (sref_v, cpx, cpy, (chroma_w, chroma_h), &mut pred_v), |
| 39531 | ] { | 39863 | ] { |
| 39532 | let luma = std::ptr::eq(plane, sref_y); | 39864 | let luma = std::ptr::eq(plane, sref_y); |
| 39533 | if luma_scale == mc::REF_NO_SCALE { | 39865 | if luma_scale == mc::REF_NO_SCALE { |
| @@ -39538,8 +39870,8 @@ fn decode_inter_block8( | |||
| 39538 | plane.true_height, | 39870 | plane.true_height, |
| 39539 | mv_to_q4(x, mv.1, if luma { 0 } else { ss_x(fctx) }), | 39871 | mv_to_q4(x, mv.1, if luma { 0 } else { ss_x(fctx) }), |
| 39540 | mv_to_q4(y, mv.0, if luma { 0 } else { ss_y(fctx) }), | 39872 | mv_to_q4(y, mv.0, if luma { 0 } else { ss_y(fctx) }), |
| 39541 | - dim, | 39873 | + dim_w, |
| 39542 | - dim, | 39874 | + dim_h, |
| 39543 | h_filter, | 39875 | h_filter, |
| 39544 | v_filter, | 39876 | v_filter, |
| 39545 | dst, fctx, | 39877 | dst, fctx, |
| @@ -39553,8 +39885,8 @@ fn decode_inter_block8( | |||
| 39553 | mv_to_q4(x, mv.1, if luma { 0 } else { ss_x(fctx) }), | 39885 | mv_to_q4(x, mv.1, if luma { 0 } else { ss_x(fctx) }), |
| 39554 | mv_to_q4(y, mv.0, if luma { 0 } else { ss_y(fctx) }), | 39886 | mv_to_q4(y, mv.0, if luma { 0 } else { ss_y(fctx) }), |
| 39555 | luma_scale, | 39887 | luma_scale, |
| 39556 | - dim, | 39888 | + dim_w, |
| 39557 | - dim, | 39889 | + dim_h, |
| 39558 | h_filter, | 39890 | h_filter, |
| 39559 | v_filter, | 39891 | v_filter, |
| 39560 | dst, fctx, | 39892 | dst, fctx, |
| @@ -39576,19 +39908,21 @@ fn decode_inter_block8( | |||
| 39576 | SIDE as i32, SIDE as i32, 0, 0, fctx, | 39908 | SIDE as i32, SIDE as i32, 0, 0, fctx, |
| 39577 | ); | 39909 | ); |
| 39578 | // `av1_init_warp_params`'s per-plane `block_width/height < 8` | 39910 | // `av1_init_warp_params`'s per-plane `block_width/height < 8` |
| 39579 | - // bail-out: an 8x8 leaf's chroma plane is 4x4 in 420, so it is | 39911 | + // bail-out: an 8x8 leaf's chroma plane block is narrower than 8 |
| 39580 | - // predicted translationally even when the luma warps. | 39912 | + // at any subsampled format (4:2:0 4x4, 4:2:2 4x8), so it is |
| 39913 | + // predicted translationally even when the luma warps; 4:4:4's | ||
| 39914 | + // 8x8 chroma warps with the luma. | ||
| 39581 | #[allow(clippy::absurd_extreme_comparisons)] | 39915 | #[allow(clippy::absurd_extreme_comparisons)] |
| 39582 | - if chroma_side >= 8 { | 39916 | + if chroma_w >= 8 { |
| 39583 | crate::warp::warp_affine( | 39917 | crate::warp::warp_affine( |
| 39584 | params, &sref_u.data, sref_u.true_width as i32, sref_u.true_height as i32, | 39918 | params, &sref_u.data, sref_u.true_width as i32, sref_u.true_height as i32, |
| 39585 | - sref_u.width as i32, &mut pred_u, cpx as i32, cpy as i32, chroma_side as i32, | 39919 | + sref_u.width as i32, &mut pred_u, cpx as i32, cpy as i32, chroma_w as i32, |
| 39586 | - chroma_side as i32, chroma_side as i32, ss_x(fctx) as i32, ss_y(fctx) as i32, fctx, | 39920 | + chroma_h as i32, chroma_w as i32, ss_x(fctx) as i32, ss_y(fctx) as i32, fctx, |
| 39587 | ); | 39921 | ); |
| 39588 | crate::warp::warp_affine( | 39922 | crate::warp::warp_affine( |
| 39589 | params, &sref_v.data, sref_v.true_width as i32, sref_v.true_height as i32, | 39923 | params, &sref_v.data, sref_v.true_width as i32, sref_v.true_height as i32, |
| 39590 | - sref_v.width as i32, &mut pred_v, cpx as i32, cpy as i32, chroma_side as i32, | 39924 | + sref_v.width as i32, &mut pred_v, cpx as i32, cpy as i32, chroma_w as i32, |
| 39591 | - chroma_side as i32, chroma_side as i32, ss_x(fctx) as i32, ss_y(fctx) as i32, fctx, | 39925 | + chroma_h as i32, chroma_w as i32, ss_x(fctx) as i32, ss_y(fctx) as i32, fctx, |
| 39592 | ); | 39926 | ); |
| 39593 | } | 39927 | } |
| 39594 | } | 39928 | } |
| @@ -39600,12 +39934,14 @@ fn decode_inter_block8( | |||
| 39600 | // Non-wedge interintra blend, mutually exclusive with OBMC (the | 39934 | // Non-wedge interintra blend, mutually exclusive with OBMC (the |
| 39601 | // motion_mode symbol is not read for an interintra block). | 39935 | // motion_mode symbol is not read for an interintra block). |
| 39602 | if let Some(ii) = interintra_mode { | 39936 | if let Some(ii) = interintra_mode { |
| 39603 | - interintra_blend(y, px, py, SIDE, SIDE, SIDE, ii, wedge_mask, &mut pred_y, fctx); | 39937 | + interintra_blend(y, px, py, SIDE, SIDE, SIDE, 0, 0, ii, wedge_mask, &mut pred_y, fctx); |
| 39604 | interintra_blend( | 39938 | interintra_blend( |
| 39605 | - u, cpx, cpy, chroma_side, chroma_side, chroma_side, ii, wedge_mask, &mut pred_u, fctx, | 39939 | + u, cpx, cpy, chroma_w, chroma_h, chroma_w, ss_x(fctx), ss_y(fctx), ii, wedge_mask, |
| 39940 | + &mut pred_u, fctx, | ||
| 39606 | ); | 39941 | ); |
| 39607 | interintra_blend( | 39942 | interintra_blend( |
| 39608 | - v, cpx, cpy, chroma_side, chroma_side, chroma_side, ii, wedge_mask, &mut pred_v, fctx, | 39943 | + v, cpx, cpy, chroma_w, chroma_h, chroma_w, ss_x(fctx), ss_y(fctx), ii, wedge_mask, |
| 39944 | + &mut pred_v, fctx, | ||
| 39609 | ); | 39945 | ); |
| 39610 | } | 39946 | } |
| 39611 | 39947 | ||
| @@ -39617,8 +39953,8 @@ fn decode_inter_block8( | |||
| 39617 | push_pred(fctx, build); | 39953 | push_pred(fctx, build); |
| 39618 | ( | 39954 | ( |
| 39619 | Pred::Cur { plane: 0, stride: SIDE, off: 0 }, | 39955 | Pred::Cur { plane: 0, stride: SIDE, off: 0 }, |
| 39620 | - Pred::Cur { plane: 1, stride: chroma_side, off: 0 }, | 39956 | + Pred::Cur { plane: 1, stride: chroma_w, off: 0 }, |
| 39621 | - Pred::Cur { plane: 2, stride: chroma_side, off: 0 }, | 39957 | + Pred::Cur { plane: 2, stride: chroma_w, off: 0 }, |
| 39622 | ) | 39958 | ) |
| 39623 | } else { | 39959 | } else { |
| 39624 | // The interintra predictor reads this block's own above/left | 39960 | // The interintra predictor reads this block's own above/left |
| @@ -39633,8 +39969,8 @@ fn decode_inter_block8( | |||
| 39633 | (pred_y, pred_u, pred_v) = (by, bu, bv); | 39969 | (pred_y, pred_u, pred_v) = (by, bu, bv); |
| 39634 | ( | 39970 | ( |
| 39635 | Pred::Inline(&pred_y, SIDE), | 39971 | Pred::Inline(&pred_y, SIDE), |
| 39636 | - Pred::Inline(&pred_u, chroma_side), | 39972 | + Pred::Inline(&pred_u, chroma_w), |
| 39637 | - Pred::Inline(&pred_v, chroma_side), | 39973 | + Pred::Inline(&pred_v, chroma_w), |
| 39638 | ) | 39974 | ) |
| 39639 | }; | 39975 | }; |
| 39640 | split8 = read_block_tx_size( | 39976 | split8 = read_block_tx_size( |
| @@ -39651,25 +39987,43 @@ fn decode_inter_block8( | |||
| 39651 | .is_some(); | 39987 | .is_some(); |
| 39652 | if skip { | 39988 | if skip { |
| 39653 | push_mc(0, px, py, SIDE, sy, &ZERO_RESIDUAL[..SIDE * SIDE], fctx); | 39989 | push_mc(0, px, py, SIDE, sy, &ZERO_RESIDUAL[..SIDE * SIDE], fctx); |
| 39654 | - push_mc(1, | 39990 | + // lane-av1-422sub8rect: the plane block is the (chroma_w, |
| 39991 | + // chroma_h) rect at 4:2:2 -- the recorded write is stride | ||
| 39992 | + // `chroma_w`, full `chroma_h` rows. | ||
| 39993 | + push_mc_rect(1, | ||
| 39655 | cpx, | 39994 | cpx, |
| 39656 | cpy, | 39995 | cpy, |
| 39657 | - chroma_side, | 39996 | + chroma_w, |
| 39997 | + chroma_w, | ||
| 39998 | + chroma_h, | ||
| 39658 | su, | 39999 | su, |
| 39659 | - &ZERO_RESIDUAL[..chroma_side * chroma_side], fctx, | 40000 | + &ZERO_RESIDUAL[..chroma_w * chroma_h], fctx, |
| 39660 | ); | 40001 | ); |
| 39661 | - push_mc(2, | 40002 | + push_mc_rect(2, |
| 39662 | cpx, | 40003 | cpx, |
| 39663 | cpy, | 40004 | cpy, |
| 39664 | - chroma_side, | 40005 | + chroma_w, |
| 40006 | + chroma_w, | ||
| 40007 | + chroma_h, | ||
| 39665 | sv, | 40008 | sv, |
| 39666 | - &ZERO_RESIDUAL[..chroma_side * chroma_side], fctx, | 40009 | + &ZERO_RESIDUAL[..chroma_w * chroma_h], fctx, |
| 39667 | ); | 40010 | ); |
| 39668 | luma_grid = Grid::Zero(SIDE * SIDE); | 40011 | luma_grid = Grid::Zero(SIDE * SIDE); |
| 39669 | - u_grid = Grid::Zero(chroma_side * chroma_side); | 40012 | + u_grid = Grid::Zero(chroma_w * chroma_h); |
| 39670 | - v_grid = Grid::Zero(chroma_side * chroma_side); | 40013 | + v_grid = Grid::Zero(chroma_w * chroma_h); |
| 39671 | } else { | 40014 | } else { |
| 39672 | let around = neighbours.around_mi(leaf_mi, 8); | 40015 | let around = neighbours.around_mi(leaf_mi, 8); |
| 40016 | + // lane-av1-422sub8rect: the 4:2:2 chroma unit is the TX_4X8 | ||
| 40017 | + // rect -- its `txb_skip_ctx` reads per chroma 4-px cell | ||
| 40018 | + // ([`Neighbours::around_mi_422_chroma`], the key-frame | ||
| 40019 | + // BLOCK_4X8 arm's own context walk), and the coefficients go | ||
| 40020 | + // through the inter rect reader with the inherited luma tx | ||
| 40021 | + // type. | ||
| 40022 | + let chroma_around = if chroma_422 { | ||
| 40023 | + neighbours.around_mi_422_chroma(leaf_mi, 8, 8) | ||
| 40024 | + } else { | ||
| 40025 | + around | ||
| 40026 | + }; | ||
| 39673 | let (grid8, luma_tx_type) = read_inter_luma8( | 40027 | let (grid8, luma_tx_type) = read_inter_luma8( |
| 39674 | dec, | 40028 | dec, |
| 39675 | cdfs, | 40029 | cdfs, |
| @@ -39687,42 +40041,82 @@ fn decode_inter_block8( | |||
| 39687 | split8, fctx, | 40041 | split8, fctx, |
| 39688 | )?; | 40042 | )?; |
| 39689 | luma_grid = grid8; | 40043 | luma_grid = grid8; |
| 39690 | - u_grid = read_inter_plane( | 40044 | + u_grid = if chroma_422 { |
| 39691 | - dec, | 40045 | + read_inter_plane_rect( |
| 39692 | - cdfs, | 40046 | + dec, |
| 39693 | - chroma_set, | 40047 | + cdfs, |
| 39694 | - chroma_scan, | 40048 | + chroma_set, |
| 39695 | - 1, | 40049 | + (chroma_w, chroma_h), |
| 39696 | - around[1], | 40050 | + chroma_w, |
| 39697 | - mode_for_tx, | 40051 | + 1, |
| 39698 | - u, | 40052 | + chroma_around[1], |
| 39699 | - cpx, | 40053 | + mode_for_tx, |
| 39700 | - cpy, | 40054 | + u, |
| 39701 | - chroma_side, | 40055 | + cpx, |
| 39702 | - base_q_idx, | 40056 | + cpy, |
| 39703 | - su, | 40057 | + su, |
| 39704 | - Some(luma_tx_type), | 40058 | + Some(luma_tx_type), |
| 39705 | - None, fctx, | 40059 | + None, fctx, |
| 39706 | - )? | 40060 | + )? |
| 39707 | - .0; | 40061 | + .0 |
| 39708 | - v_grid = read_inter_plane( | 40062 | + } else { |
| 39709 | - dec, | 40063 | + read_inter_plane( |
| 39710 | - cdfs, | 40064 | + dec, |
| 39711 | - chroma_set, | 40065 | + cdfs, |
| 39712 | - chroma_scan, | 40066 | + chroma_set, |
| 39713 | - 2, | 40067 | + chroma_scan, |
| 39714 | - around[2], | 40068 | + 1, |
| 39715 | - mode_for_tx, | 40069 | + chroma_around[1], |
| 39716 | - v, | 40070 | + mode_for_tx, |
| 39717 | - cpx, | 40071 | + u, |
| 39718 | - cpy, | 40072 | + cpx, |
| 39719 | - chroma_side, | 40073 | + cpy, |
| 39720 | - base_q_idx, | 40074 | + chroma_w, |
| 39721 | - sv, | 40075 | + base_q_idx, |
| 39722 | - Some(luma_tx_type), | 40076 | + su, |
| 39723 | - None, fctx, | 40077 | + Some(luma_tx_type), |
| 39724 | - )? | 40078 | + None, fctx, |
| 39725 | - .0; | 40079 | + )? |
| 40080 | + .0 | ||
| 40081 | + }; | ||
| 40082 | + v_grid = if chroma_422 { | ||
| 40083 | + read_inter_plane_rect( | ||
| 40084 | + dec, | ||
| 40085 | + cdfs, | ||
| 40086 | + chroma_set, | ||
| 40087 | + (chroma_w, chroma_h), | ||
| 40088 | + chroma_w, | ||
| 40089 | + 2, | ||
| 40090 | + chroma_around[2], | ||
| 40091 | + mode_for_tx, | ||
| 40092 | + v, | ||
| 40093 | + cpx, | ||
| 40094 | + cpy, | ||
| 40095 | + sv, | ||
| 40096 | + Some(luma_tx_type), | ||
| 40097 | + None, fctx, | ||
| 40098 | + )? | ||
| 40099 | + .0 | ||
| 40100 | + } else { | ||
| 40101 | + read_inter_plane( | ||
| 40102 | + dec, | ||
| 40103 | + cdfs, | ||
| 40104 | + chroma_set, | ||
| 40105 | + chroma_scan, | ||
| 40106 | + 2, | ||
| 40107 | + chroma_around[2], | ||
| 40108 | + mode_for_tx, | ||
| 40109 | + v, | ||
| 40110 | + cpx, | ||
| 40111 | + cpy, | ||
| 40112 | + chroma_w, | ||
| 40113 | + base_q_idx, | ||
| 40114 | + sv, | ||
| 40115 | + Some(luma_tx_type), | ||
| 40116 | + None, fctx, | ||
| 40117 | + )? | ||
| 40118 | + .0 | ||
| 40119 | + }; | ||
| 39726 | } | 40120 | } |
| 39727 | } else { | 40121 | } else { |
| 39728 | let mode = dec.symbol(&mut cdfs.y_mode[SIZE_GROUP_8]); | 40122 | let mode = dec.symbol(&mut cdfs.y_mode[SIZE_GROUP_8]); |
| @@ -39932,17 +40326,17 @@ fn decode_inter_block8( | |||
| 39932 | PaletteY { size: n, colors, map } | 40326 | PaletteY { size: n, colors, map } |
| 39933 | }); | 40327 | }); |
| 39934 | let palette_uv = palette_uv_pending.map(|(n, u_colors, v_colors)| { | 40328 | let palette_uv = palette_uv_pending.map(|(n, u_colors, v_colors)| { |
| 39935 | - // `av1_get_plane_block_size(BLOCK_8X8, 1, 1)` at the sequence's | 40329 | + // `av1_get_plane_block_size(BLOCK_8X8, ss)` at the sequence's own |
| 39936 | - // own subsampling: BLOCK_4X4 at 4:2:0, BLOCK_8X8 at 4:4:4 | 40330 | + // subsampling: BLOCK_4X4 at 4:2:0, BLOCK_8X8 at 4:4:4, and at |
| 39937 | - // (`chroma_side`, lane-av1-444). | 40331 | + // 4:2:2 the BLOCK_4X8 plane block (lane-av1-422sub8rect). |
| 39938 | let on = palette_onscreen_uv( | 40332 | let on = palette_onscreen_uv( |
| 39939 | (SIDE, SIDE), | 40333 | (SIDE, SIDE), |
| 39940 | palette_onscreen(rmi, cmi, SIDE, SIDE, fctx), | 40334 | palette_onscreen(rmi, cmi, SIDE, SIDE, fctx), |
| 39941 | - (chroma_side, chroma_side), | 40335 | + (chroma_w, chroma_h), |
| 39942 | (ss_x(fctx), ss_y(fctx)), | 40336 | (ss_x(fctx), ss_y(fctx)), |
| 39943 | ); | 40337 | ); |
| 39944 | let map = | 40338 | let map = |
| 39945 | - decode_color_index_map_wh(dec, cdfs, n, chroma_side, chroma_side, on, true); | 40339 | + decode_color_index_map_wh(dec, cdfs, n, chroma_w, chroma_h, on, true); |
| 39946 | hit!(PALETTE_UV_HITS); | 40340 | hit!(PALETTE_UV_HITS); |
| 39947 | hit!(INTRA_IN_INTER_PALETTE_UV_HITS); | 40341 | hit!(INTRA_IN_INTER_PALETTE_UV_HITS); |
| 39948 | hit_do! { | 40342 | hit_do! { |
| @@ -40113,14 +40507,18 @@ fn decode_inter_block8( | |||
| 40113 | if let Some((ub, _)) = &palette_uv_bufs { | 40507 | if let Some((ub, _)) = &palette_uv_bufs { |
| 40114 | set_palette_pred(ub.clone(), fctx); | 40508 | set_palette_pred(ub.clone(), fctx); |
| 40115 | } | 40509 | } |
| 40116 | - push_intra(1, | 40510 | + // lane-av1-422sub8rect: the plane block is the (chroma_w, |
| 40511 | + // chroma_h) rect at 4:2:2 -- the recorded prediction/write uses | ||
| 40512 | + // the rect push. | ||
| 40513 | + push_intra_rect(1, | ||
| 40117 | cpx, | 40514 | cpx, |
| 40118 | cpy, | 40515 | cpy, |
| 40119 | - chroma_side, | 40516 | + chroma_w, |
| 40517 | + chroma_h, | ||
| 40120 | uv_predict_mode, | 40518 | uv_predict_mode, |
| 40121 | angle_delta_uv, | 40519 | angle_delta_uv, |
| 40122 | reach, | 40520 | reach, |
| 40123 | - &ZERO_RESIDUAL[..chroma_side * chroma_side], | 40521 | + &ZERO_RESIDUAL[..chroma_w * chroma_h], |
| 40124 | alpha.zip(ac).map(|((au, _), ac)| (au, ac)), | 40522 | alpha.zip(ac).map(|((au, _), ac)| (au, ac)), |
| 40125 | None, | 40523 | None, |
| 40126 | smooth_neighbor_uv, fctx, | 40524 | smooth_neighbor_uv, fctx, |
| @@ -40128,21 +40526,22 @@ fn decode_inter_block8( | |||
| 40128 | if let Some((_, vb)) = &palette_uv_bufs { | 40526 | if let Some((_, vb)) = &palette_uv_bufs { |
| 40129 | set_palette_pred(vb.clone(), fctx); | 40527 | set_palette_pred(vb.clone(), fctx); |
| 40130 | } | 40528 | } |
| 40131 | - push_intra(2, | 40529 | + push_intra_rect(2, |
| 40132 | cpx, | 40530 | cpx, |
| 40133 | cpy, | 40531 | cpy, |
| 40134 | - chroma_side, | 40532 | + chroma_w, |
| 40533 | + chroma_h, | ||
| 40135 | uv_predict_mode, | 40534 | uv_predict_mode, |
| 40136 | angle_delta_uv, | 40535 | angle_delta_uv, |
| 40137 | reach, | 40536 | reach, |
| 40138 | - &ZERO_RESIDUAL[..chroma_side * chroma_side], | 40537 | + &ZERO_RESIDUAL[..chroma_w * chroma_h], |
| 40139 | alpha.zip(ac).map(|((_, av), ac)| (av, ac)), | 40538 | alpha.zip(ac).map(|((_, av), ac)| (av, ac)), |
| 40140 | None, | 40539 | None, |
| 40141 | smooth_neighbor_uv, fctx, | 40540 | smooth_neighbor_uv, fctx, |
| 40142 | ); | 40541 | ); |
| 40143 | luma_grid = Grid::Zero(SIDE * SIDE); | 40542 | luma_grid = Grid::Zero(SIDE * SIDE); |
| 40144 | - u_grid = Grid::Zero(chroma_side * chroma_side); | 40543 | + u_grid = Grid::Zero(chroma_w * chroma_h); |
| 40145 | - v_grid = Grid::Zero(chroma_side * chroma_side); | 40544 | + v_grid = Grid::Zero(chroma_w * chroma_h); |
| 40146 | } else { | 40545 | } else { |
| 40147 | let around = neighbours.around_mi(leaf_mi, 8); | 40546 | let around = neighbours.around_mi(leaf_mi, 8); |
| 40148 | luma_grid = if split8 { | 40547 | luma_grid = if split8 { |
| @@ -40186,56 +40585,89 @@ fn decode_inter_block8( | |||
| 40186 | )? | 40585 | )? |
| 40187 | }; | 40586 | }; |
| 40188 | let ac = alpha.map(|_| cfl_src(px, py, SIDE)); | 40587 | let ac = alpha.map(|_| cfl_src(px, py, SIDE)); |
| 40588 | + // lane-av1-422sub8rect: at 4:2:2 the plane block is the BLOCK_4X8 | ||
| 40589 | + // rect and the key-frame arm's own reader applies -- one | ||
| 40590 | + // TX_4X8 `ChromaRect8x4` unit per plane through | ||
| 40591 | + // [`read_rect_chroma_unit`] with the per-chroma-cell context | ||
| 40592 | + // walk ([`Neighbours::around_mi_422_chroma`], the | ||
| 40593 | + // lane-av1-422f model this leaf's key-frame twin proves | ||
| 40594 | + // byte-exact). 4:2:0/4:4:4 keep the square [`read_plane`] read. | ||
| 40595 | + let (chroma_around_u, chroma_around_v) = if chroma_422 { | ||
| 40596 | + let ca = neighbours.around_mi_422_chroma(leaf_mi, 8, 8); | ||
| 40597 | + (ca[1], ca[2]) | ||
| 40598 | + } else { | ||
| 40599 | + (around[1], around[2]) | ||
| 40600 | + }; | ||
| 40189 | if let Some((ub, _)) = &palette_uv_bufs { | 40601 | if let Some((ub, _)) = &palette_uv_bufs { |
| 40190 | set_palette_pred(ub.clone(), fctx); | 40602 | set_palette_pred(ub.clone(), fctx); |
| 40191 | } | 40603 | } |
| 40192 | - u_grid = read_plane( | 40604 | + u_grid = if chroma_422 { |
| 40193 | - dec, | 40605 | + read_rect_chroma_unit( |
| 40194 | - cdfs, | 40606 | + dec, cdfs, chroma_set, chroma_scan, chroma_w, chroma_h, 1, |
| 40195 | - chroma_set, | 40607 | + chroma_around_u, uv_predict_mode, angle_delta_uv, reach, u, |
| 40196 | - chroma_scan, | 40608 | + cpx, cpy, base_q_idx, None, |
| 40197 | - 1, | 40609 | + alpha.zip(ac).map(|((au, _), ac)| (au, ac)), |
| 40198 | - around[1], | 40610 | + smooth_neighbor_uv, fctx, |
| 40199 | - mode, | 40611 | + )? |
| 40200 | - uv_predict_mode, | 40612 | + } else { |
| 40201 | - angle_delta_uv, | 40613 | + read_plane( |
| 40202 | - reach, | 40614 | + dec, |
| 40203 | - u, | 40615 | + cdfs, |
| 40204 | - cpx, | 40616 | + chroma_set, |
| 40205 | - cpy, | 40617 | + chroma_scan, |
| 40206 | - chroma_side, | 40618 | + 1, |
| 40207 | - chroma_tx, | 40619 | + chroma_around_u, |
| 40208 | - base_q_idx, | 40620 | + mode, |
| 40209 | - alpha.zip(ac).map(|((au, _), ac)| (au, ac)), | 40621 | + uv_predict_mode, |
| 40210 | - None, | 40622 | + angle_delta_uv, |
| 40211 | - None, | 40623 | + reach, |
| 40212 | - smooth_neighbor_uv, fctx, | 40624 | + u, |
| 40213 | - )?; | 40625 | + cpx, |
| 40626 | + cpy, | ||
| 40627 | + chroma_w, | ||
| 40628 | + chroma_tx, | ||
| 40629 | + base_q_idx, | ||
| 40630 | + alpha.zip(ac).map(|((au, _), ac)| (au, ac)), | ||
| 40631 | + None, | ||
| 40632 | + None, | ||
| 40633 | + smooth_neighbor_uv, fctx, | ||
| 40634 | + )? | ||
| 40635 | + }; | ||
| 40214 | if let Some((_, vb)) = &palette_uv_bufs { | 40636 | if let Some((_, vb)) = &palette_uv_bufs { |
| 40215 | set_palette_pred(vb.clone(), fctx); | 40637 | set_palette_pred(vb.clone(), fctx); |
| 40216 | } | 40638 | } |
| 40217 | - v_grid = read_plane( | 40639 | + v_grid = if chroma_422 { |
| 40218 | - dec, | 40640 | + read_rect_chroma_unit( |
| 40219 | - cdfs, | 40641 | + dec, cdfs, chroma_set, chroma_scan, chroma_w, chroma_h, 2, |
| 40220 | - chroma_set, | 40642 | + chroma_around_v, uv_predict_mode, angle_delta_uv, reach, v, |
| 40221 | - chroma_scan, | 40643 | + cpx, cpy, base_q_idx, None, |
| 40222 | - 2, | 40644 | + alpha.zip(ac).map(|((_, av), ac)| (av, ac)), |
| 40223 | - around[2], | 40645 | + smooth_neighbor_uv, fctx, |
| 40224 | - mode, | 40646 | + )? |
| 40225 | - uv_predict_mode, | 40647 | + } else { |
| 40226 | - angle_delta_uv, | 40648 | + read_plane( |
| 40227 | - reach, | 40649 | + dec, |
| 40228 | - v, | 40650 | + cdfs, |
| 40229 | - cpx, | 40651 | + chroma_set, |
| 40230 | - cpy, | 40652 | + chroma_scan, |
| 40231 | - chroma_side, | 40653 | + 2, |
| 40232 | - chroma_tx, | 40654 | + chroma_around_v, |
| 40233 | - base_q_idx, | 40655 | + mode, |
| 40234 | - alpha.zip(ac).map(|((_, av), ac)| (av, ac)), | 40656 | + uv_predict_mode, |
| 40235 | - None, | 40657 | + angle_delta_uv, |
| 40236 | - None, | 40658 | + reach, |
| 40237 | - smooth_neighbor_uv, fctx, | 40659 | + v, |
| 40238 | - )?; | 40660 | + cpx, |
| 40661 | + cpy, | ||
| 40662 | + chroma_w, | ||
| 40663 | + chroma_tx, | ||
| 40664 | + base_q_idx, | ||
| 40665 | + alpha.zip(ac).map(|((_, av), ac)| (av, ac)), | ||
| 40666 | + None, | ||
| 40667 | + None, | ||
| 40668 | + smooth_neighbor_uv, fctx, | ||
| 40669 | + )? | ||
| 40670 | + }; | ||
| 40239 | } | 40671 | } |
| 40240 | } | 40672 | } |
| 40241 | // lane-txselect: a split leaf's plane-0 neighbour context is per 4x4 | 40673 | // lane-txselect: a split leaf's plane-0 neighbour context is per 4x4 |
crates/ec-av1/src/encode.rsmodified+1 -0
| @@ -6809,6 +6809,7 @@ fn obmc_prediction( | |||
| 6809 | &refpix, | 6809 | &refpix, |
| 6810 | Some(fctx.interp_filter.get()), | 6810 | Some(fctx.interp_filter.get()), |
| 6811 | frame_width, | 6811 | frame_width, |
| 6812 | + (crate::decode::ss_x(fctx), crate::decode::ss_y(fctx)), | ||
| 6812 | ) | 6813 | ) |
| 6813 | .ok()?; | 6814 | .ok()?; |
| 6814 | let mut pred = [ | 6815 | let mut pred = [ |
crates/ec-av1/src/mc.rsmodified+31 -14
| @@ -2142,8 +2142,11 @@ pub(crate) fn diffwtd_mask( | |||
| 2142 | /// (64-m)*pred1) >> 6` (a plain, unrounded shift, matching the C `>>` on | 2142 | /// (64-m)*pred1) >> 6` (a plain, unrounded shift, matching the C `>>` on |
| 2143 | /// `int32_t`) then one final [`round2`] by [`INTER_POST_ROUND`]. `mask` is | 2143 | /// `int32_t`) then one final [`round2`] by [`INTER_POST_ROUND`]. `mask` is |
| 2144 | /// always the LUMA-resolution mask (`mask_stride` == luma block width); | 2144 | /// always the LUMA-resolution mask (`mask_stride` == luma block width); |
| 2145 | -/// `subsampled` selects the 2x2-average chroma read (spec 7.11.3.14 / | 2145 | +/// `(subw, subh)` are the PLANE's own subsampling shifts and pick the mask |
| 2146 | -/// libaom's `subw == 1 && subh == 1` branch) vs. the direct luma read. | 2146 | +/// read exactly as aom_dsp/blend-a64-mask.c's four `subw`/`subh` branches do: |
| 2147 | +/// `(0, 0)` the direct luma sample, `(1, 1)` the 2x2 box average, | ||
| 2148 | +/// `(1, 0)`/`(0, 1)` the `AOM_BLEND_AVG` pair average on the subsampled axis | ||
| 2149 | +/// alone (4:2:2). | ||
| 2147 | #[allow(clippy::too_many_arguments)] | 2150 | #[allow(clippy::too_many_arguments)] |
| 2148 | pub(crate) fn blend_masked_compound( | 2151 | pub(crate) fn blend_masked_compound( |
| 2149 | pred0: &[i32], | 2152 | pred0: &[i32], |
| @@ -2152,7 +2155,8 @@ pub(crate) fn blend_masked_compound( | |||
| 2152 | mask_stride: usize, | 2155 | mask_stride: usize, |
| 2153 | w: usize, | 2156 | w: usize, |
| 2154 | h: usize, | 2157 | h: usize, |
| 2155 | - subsampled: bool, | 2158 | + subw: usize, |
| 2159 | + subh: usize, | ||
| 2156 | dst: &mut [u16], | 2160 | dst: &mut [u16], |
| 2157 | fctx: &crate::decode::FrameCtx, | 2161 | fctx: &crate::decode::FrameCtx, |
| 2158 | ) { | 2162 | ) { |
| @@ -2162,17 +2166,30 @@ pub(crate) fn blend_masked_compound( | |||
| 2162 | let post_round = INTER_POST_ROUND - round_delta(u32::from(crate::decode::bit_depth(fctx))); | 2166 | let post_round = INTER_POST_ROUND - round_delta(u32::from(crate::decode::bit_depth(fctx))); |
| 2163 | for i in 0..h { | 2167 | for i in 0..h { |
| 2164 | for j in 0..w { | 2168 | for j in 0..w { |
| 2165 | - let m = if subsampled { | 2169 | + let m: i32 = match (subw, subh) { |
| 2166 | - let idx = (2 * i) * mask_stride + 2 * j; | 2170 | + (0, 0) => i32::from(mask[i * mask_stride + j]), |
| 2167 | - round2( | 2171 | + (1, 1) => { |
| 2168 | - i32::from(mask[idx]) | 2172 | + let idx = (2 * i) * mask_stride + 2 * j; |
| 2169 | - + i32::from(mask[idx + 1]) | 2173 | + round2( |
| 2170 | - + i32::from(mask[idx + mask_stride]) | 2174 | + i32::from(mask[idx]) |
| 2171 | - + i32::from(mask[idx + mask_stride + 1]), | 2175 | + + i32::from(mask[idx + 1]) |
| 2172 | - 2, | 2176 | + + i32::from(mask[idx + mask_stride]) |
| 2173 | - ) | 2177 | + + i32::from(mask[idx + mask_stride + 1]), |
| 2174 | - } else { | 2178 | + 2, |
| 2175 | - i32::from(mask[i * mask_stride + j]) | 2179 | + ) |
| 2180 | + } | ||
| 2181 | + // aom_blend_a64_mask_c's `subw == 1 && subh == 0` branch: | ||
| 2182 | + // `AOM_BLEND_AVG(mask[2 * j], mask[2 * j + 1])` per row. | ||
| 2183 | + (1, 0) => { | ||
| 2184 | + let idx = i * mask_stride + 2 * j; | ||
| 2185 | + (i32::from(mask[idx]) + i32::from(mask[idx + 1]) + 1) >> 1 | ||
| 2186 | + } | ||
| 2187 | + // the `subw == 0 && subh == 1` branch: averaged down the | ||
| 2188 | + // columns instead. | ||
| 2189 | + (_sw, _sh) => { | ||
| 2190 | + let idx = (2 * i) * mask_stride + j; | ||
| 2191 | + (i32::from(mask[idx]) + i32::from(mask[idx + mask_stride]) + 1) >> 1 | ||
| 2192 | + } | ||
| 2176 | }; | 2193 | }; |
| 2177 | let res = (m * pred0[i * w + j] + (64 - m) * pred1[i * w + j]) >> 6; | 2194 | let res = (m * pred0[i * w + j] + (64 - m) * pred1[i * w + j]) >> 6; |
| 2178 | // `post_round` above: `INTER_POST_ROUND - round_delta` -- see | 2195 | // `post_round` above: `INTER_POST_ROUND - round_delta` -- see |
lanes/av1422sub8rect.report.mdadded+132 -0
| @@ -0,0 +1,132 @@ | |||
| 1 | +# lane-av1-422sub8rect — the sub-8x8 inter 4:2:2 chroma ported to its real | ||
| 2 | +# shapes (`decode_inter_block8`'s whole chroma half to the BLOCK_4X8 rect; | ||
| 3 | +# `decode_inter_sub8_split4`'s group unit replaced by the per-piece | ||
| 4 | +# odd-column chroma-reference model the oracle traces actually code); frame | ||
| 5 | +# 0 stays byte-exact at all four stages, the 4:2:0/4:4:4 identity holds by | ||
| 6 | +# ss-keying, and the inter-frame divergence is REMEASURED (reduced ~15% on | ||
| 7 | +# frames 1..10, exactness NOT claimed -- other 4:2:2 classes remain) | ||
| 8 | + | ||
| 9 | +## Outcome | ||
| 10 | + | ||
| 11 | +1. ROOT-CAUSE CONFIRMATION FIRST (pinned fixture `/tmp/t422.obu` sha256 | ||
| 12 | + `d3fa4beeb1309033e4a03f5ae5c431c8fa8386ba1ada088684710423c7938129`, | ||
| 13 | + parent-lane instruments in `/tmp/i422/`, local `EC_AV1_ALLOW_422_PROBE` | ||
| 14 | + bypass applied and reverted byte-identical after — `git diff` carries | ||
| 15 | + only decode.rs/mc.rs/encode.rs changes): the oracle's frame-1 first | ||
| 16 | + block (`AOMMB mi=(0,0) ... skip=0`) reads luma TX_8X8 then | ||
| 17 | + `plane=1 tx_size=5 mi_row=0 mi_col=0 rng=55168` — tx_size 5 IS TX_4X8, | ||
| 18 | + confirming the charter: the 8x8 inter leaf's chroma plane block is | ||
| 19 | + BLOCK_4X8, one TX_4X8 rect unit per plane (`ss_size_lookup[BLOCK_8X8][1][0]`), | ||
| 20 | + while ours read a TX_4X4 square. | ||
| 21 | +2. SPLIT4 MODEL CORRECTED AGAINST THE ORACLE, NOT THE CHARTER'S GUESS: the | ||
| 22 | + parent report assumed the split4 group codes ONE rect group unit; the | ||
| 23 | + traces prove otherwise. At ss (1,0) `is_chroma_reference` for a BLOCK_4X4 | ||
| 24 | + piece is `(mi_col & 0x01)` — ODD columns only (av1_common_int.h:1459) — | ||
| 25 | + and every non-skipped odd-column piece codes its OWN U then V TX_4X4 | ||
| 26 | + square unit right after its luma, anchored at the FLOORED chroma cell | ||
| 27 | + (`(mi_col & !1) * MI >> ss_x`, the lane-av1-422kf2 rule) with | ||
| 28 | + `around_mi_422_chroma`-style per-chroma-cell ctx (measured ctx 8 = | ||
| 29 | + above+left+7 at frame 1's mi(12,3)): | ||
| 30 | + - frame 0 key-frame groups (18,54) and (30,42): U+V read on BOTH | ||
| 31 | + odd-column leaves ((18,55)+(19,55), (30,43)+(31,43)); | ||
| 32 | + - frame 1 inter group at mi(12,2): U+V on leaf (12,3) ALONE — its | ||
| 33 | + bottom-right twin was skipped, so it codes nothing. | ||
| 34 | + The 4:2:0 shared group unit simply never exists at 4:2:2. | ||
| 35 | +3. PORT (all keyed on ss, 4:2:0/4:4:4 byte-identical by construction): | ||
| 36 | + - `decode_inter_block8` chroma half to per-axis shapes: `chroma_w/chroma_h`, | ||
| 37 | + `(TxbSet::ChromaRect8x4, SCAN_4X8)` at 4:2:2; inter coefficient reads | ||
| 38 | + through `read_inter_plane_rect` (offset-7 ctx — the unit IS the plane | ||
| 39 | + block — inherited luma tx type) with `around_mi_422_chroma`; MC | ||
| 40 | + prediction (single-ref, scaled, warp, compound-intermediate), the | ||
| 41 | + wedge-masked blend, interintra blend, OBMC pushes and skip pushes all | ||
| 42 | + (4, 8)-shaped; the intra-in-inter arm reads the key-frame arm's own | ||
| 43 | + rect reader (`read_rect_chroma_unit`, ctx offset None, CfL carried); | ||
| 44 | + palette UV map dims per axis. | ||
| 45 | + - `decode_inter_sub8_split4`: per-piece arm added after each inter | ||
| 46 | + piece's luma (odd column, ss 1,0): prediction as | ||
| 47 | + `build_inter_predictors_sub8x8` — left 2x4 half from the LEFT piece's | ||
| 48 | + own ref/mv/filters, right 2x4 half from this piece's; a mixed group | ||
| 49 | + (left piece intra/off-frame, `is_sub8x8_inter` false) predicts the | ||
| 50 | + whole 4x4 from this piece; skip pieces still predict but record zeros. | ||
| 51 | + Coefficients via square `TxbSet::Chroma4` reads at the floored anchor, | ||
| 52 | + per-unit `record_mi_chroma` (8x4 luma span). Intra pieces gate | ||
| 53 | + `has_chroma` on the piece's own column parity and route through | ||
| 54 | + [`sub8_leaf_chroma422`]; even-column intra pieces publish DC to the | ||
| 55 | + uv-mode map. The 4:2:0 group tail (build, read, band stamps, DC map | ||
| 56 | + stamp) is gated OFF at 4:2:2. | ||
| 57 | + - Shared helpers made ss-exact (4:2:0/4:4:4 reduce to the old behaviour): | ||
| 58 | + `blend_masked_compound`'s `subsampled: bool` → per-axis `(subw, subh)` | ||
| 59 | + mirroring aom_dsp/blend-a64-mask.c's four branches; `interintra_blend`'s | ||
| 60 | + wedge mask read likewise; `obmc_plan`/`obmc_run` take the plane ss — | ||
| 61 | + chroma extents are the luma rules `>> ss` (`av1_skip_u4x4_pred_in_obmc` | ||
| 62 | + keyed on the plane block, above-pass skip and left-pass blend extents), | ||
| 63 | + `TxParams::strided` sized `stride * h` (identical when h == stride, as | ||
| 64 | + every pre-existing caller has). The encoder's `obmc_plan` call passes | ||
| 65 | + the fctx ss. | ||
| 66 | + - STOP-NOTE (owning parent-lane surface, named not fixed): | ||
| 67 | + `decode_inter_block`'s 4:2:2 chroma is still the square-cut model; its | ||
| 68 | + chroma masked-blend keeps the pre-port direct mask read there (guarded | ||
| 69 | + by `ss_x == ss_y`), because its `chroma_side`-square buffers cannot be | ||
| 70 | + indexed by the subsampled-axis walks. Known-divergent, unchanged | ||
| 71 | + behaviour, named for the owning lane. | ||
| 72 | +4. MEASURED after the port (17-frame probe run under the reverted bypass; | ||
| 73 | + comparator: ours padded 256x160/128x160 u8 cropped vs the instrumented | ||
| 74 | + `$HOME/.cache/aom-oracle/build` aomdec): | ||
| 75 | + - frame 0: **byte-exact at PREFILT, POSTCDEF (and FINAL by the u16 | ||
| 76 | + comparator) on Y, U and V — 0 diffs everywhere**, so the rect read, | ||
| 77 | + the split4 per-piece model and every shared-helper change are exact on | ||
| 78 | + everything frame 0 exercises (including the split groups (18,54), | ||
| 79 | + (30,42) that motivated the per-piece model). | ||
| 80 | + - inter frames 1..10 decode and were measured: PREFILT diffs dropped | ||
| 81 | + ~15% vs the parent lane's ladder (e.g. frame 1: 30825/12624/12796 → | ||
| 82 | + 22248/11733/11974; frame 8: 35014/11020/12043 → 32855/11020/12043; | ||
| 83 | + per-frame values in `/tmp/i422/sub8rect/`). **Frame exactness is NOT | ||
| 84 | + claimed** — frames 1..10 remain divergent: the named sub-8 sites are | ||
| 85 | + fixed, but the stream carries further 4:2:2 classes the decoder still | ||
| 86 | + square-cuts or gaps (probe trace: `EC_RECTCHROMA_GAP luma=16x8 | ||
| 87 | + tx=16x8 chroma=8x8`, `luma=8x32 ... chroma=4x32`, i.e. `decode_inter_block`'s | ||
| 88 | + own 4:2:2 chroma half), so the entropy walk desyncs again after the | ||
| 89 | + first uncoded-for block. | ||
| 90 | + - frames 11..16 were not reached by the probe's frame accounting this | ||
| 91 | + round (11 dumped frames, decode exits 0 — the dump-index vs | ||
| 92 | + show-existing accounting needs the parent-lane harness's | ||
| 93 | + 1-frame-per-OBU walk); the ladder for 1..16 is the owning lane's | ||
| 94 | + re-measurement once the next class lands. | ||
| 95 | +5. Deferred items: (a) frames 11..16 ladder entries — unblock: rerun the | ||
| 96 | + parent-lane per-OBU cut harness (`/tmp/i422/cut_frames.py`) after the | ||
| 97 | + next class; (b) `decode_inter_sub8_rect2`'s 4:2:2 has_chroma gating (its | ||
| 98 | + inter strips pass `i == 1` where BLOCK_4X8 needs odd-column parity) — | ||
| 99 | + not one of this charter's named sites, unmeasured on the fixture so far. | ||
| 100 | + | ||
| 101 | +## Decision | ||
| 102 | + | ||
| 103 | +- The header refusal STAYS unconditional in `stream.rs`; the bypass was | ||
| 104 | + local-only, applied and reverted byte-identical (0 occurrences left; | ||
| 105 | + `stream::tests` green after the revert). | ||
| 106 | +- 4:2:0/4:4:4 untouched by construction (ss-keyed arms); the 4:2:0 | ||
| 107 | + group-tail SKIP arm untouched; `read_coeffs_rect` untouched. | ||
| 108 | + | ||
| 109 | +## Verification | ||
| 110 | + | ||
| 111 | +- `cargo check -p ec-av1` (target `~/.cache/cargo-target-av1422sub8rect`): | ||
| 112 | + 0 warnings, 0 errors. | ||
| 113 | +- `stream::tests::a_non_420_subsampled_sequence_header_is_refused_by_name`: | ||
| 114 | + 1 passed — the refusal fires after the bypass revert. | ||
| 115 | +- `stream::tests::a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_ | ||
| 116 | + whose_tx_split_decodes_pixel_exact` under `EC_AV1_REQUIRE_AOMENC=1` | ||
| 117 | + (oracle aomenc): 1 passed — the 4:2:0 inter path, including the | ||
| 118 | + shared-helper ss-ifications, stays pixel-exact. | ||
| 119 | +- Frame-0 stage dumps vs the instrumented aomdec: PREFILT/POSTCDEF | ||
| 120 | + Y=U=V=0 (POSTDEB comparator run this round used the wrong dump-env name; | ||
| 121 | + the post-deblock state is bracketed by the two exact stages). | ||
| 122 | +- Hit counter added: `CHROMA422_INTER_SUB8_HITS` (per-piece inter 4:2:2 | ||
| 123 | + chroma units) — reads non-zero on the fixture's frames 1+, so the new arm | ||
| 124 | + provably fires. | ||
| 125 | + | ||
| 126 | +## State | ||
| 127 | + | ||
| 128 | +- Commit on lane-av1-422sub8rect (no push): the sub-8 rect port + | ||
| 129 | + `TxParams::strided` sizing fix + shared ss-exact helpers + this report. | ||
| 130 | +- Probe instruments regenerated under `/tmp/i422/sub8rect/` (scratch, not | ||
| 131 | + committed); the oracle build's rungs already cover everything needed to | ||
| 132 | + re-measure after the next class. | ||