forge
Explore
Log in

Don't you dare go Hollow

MC hoists the interior row test and fuses whole-pel-horizontal blocks onto the reference

Browse files at this commit

37ae4978c00d819f8187d5544ea74f4641a88f26Ahmet Kaan GümüşParent: e27b2d5
  • perf
    • MC hoists the interior row test and fuses whole-pel-horizontal blocks onto the reference
Show full message
perf(av1): MC hoists the interior row test and fuses whole-pel-horizontal blocks onto the reference

The unscaled horizontal pass tested the vertical clamp, the interior
window, the slice bounds, the tap narrowing and the SIMD level once per
row; when the whole footprint is inside the reference -- the common case
-- every one of those has the same answer for all rows, so the test is
hoisted and the loop is a walk of the stride.

A whole-pel horizontal position makes the horizontal pass the identity
tap, whose intermediate is exactly `s << 4`, so the vertical pass is the
same 8-tap sum taken straight off the reference rows with the taps
scaled by 16. Both the single and the compound kernel now take that
path for interior blocks, which drops the intermediate entirely; the
vertical kernels gained a source-stride parameter to read it.

Byte-exact: all four gate streams hash to their references.
crates/ec-av1/src/mc.rsmodified+157 -42
@@ -421,13 +421,14 @@ mod simd {
421421 pub unsafe fn vpass_avx2(
422422 intermediate: &[i16],
423423 block_w: usize,
424+ src_stride: usize,
424425 row: usize,
425426 taps: &[i32; 8],
426427 acc: &mut [i32],
427428 ) {
428- debug_assert!(intermediate.len() >= (row + 8) * block_w && acc.len() >= block_w);
429+ debug_assert!(intermediate.len() >= (row + 7) * src_stride + block_w && acc.len() >= block_w);
429430 let tp = tap_pairs(&taps16(taps));
430- let ip = intermediate.as_ptr().add(row * block_w);
431+ let ip = intermediate.as_ptr().add(row * src_stride);
431432 let ap = acc.as_mut_ptr();
432433 let mut c = 0usize;
433434 while c + 16 <= block_w {
@@ -441,8 +442,8 @@ mod simd {
441442 continue;
442443 }
443444 let tv = _mm256_set1_epi32(tp[k]);
444- let a = _mm256_loadu_si256(ip.add(2 * k * block_w + c).cast());
445- let b = _mm256_loadu_si256(ip.add((2 * k + 1) * block_w + c).cast());
445+ let a = _mm256_loadu_si256(ip.add(2 * k * src_stride + c).cast());
446+ let b = _mm256_loadu_si256(ip.add((2 * k + 1) * src_stride + c).cast());
446447 lo = _mm256_add_epi32(lo, _mm256_madd_epi16(_mm256_unpacklo_epi16(a, b), tv));
447448 hi = _mm256_add_epi32(hi, _mm256_madd_epi16(_mm256_unpackhi_epi16(a, b), tv));
448449 }
@@ -450,7 +451,7 @@ mod simd {
450451 _mm256_storeu_si256(ap.add(c + 8).cast(), _mm256_permute2x128_si256(lo, hi, 0x31));
451452 c += 16;
452453 }
453- vpass_tail_sse(ip, block_w, &tp, taps, ap, c);
454+ vpass_tail_sse(ip, block_w, src_stride, &tp, taps, ap, c);
454455 }
455456
456457 /// [`vpass_avx2`]'s 8- and 4-column steps, 128-bit: every AV1 block width
@@ -464,6 +465,7 @@ mod simd {
464465 unsafe fn vpass_tail_sse(
465466 ip: *const i16,
466467 block_w: usize,
468+ src_stride: usize,
467469 tp: &[i32; 4],
468470 taps: &[i32; 8],
469471 ap: *mut i32,
@@ -477,8 +479,8 @@ mod simd {
477479 continue;
478480 }
479481 let tv = _mm_set1_epi32(tp[k]);
480- let a = _mm_loadu_si128(ip.add(2 * k * block_w + c).cast());
481- let b = _mm_loadu_si128(ip.add((2 * k + 1) * block_w + c).cast());
482+ let a = _mm_loadu_si128(ip.add(2 * k * src_stride + c).cast());
483+ let b = _mm_loadu_si128(ip.add((2 * k + 1) * src_stride + c).cast());
482484 lo = _mm_add_epi32(lo, _mm_madd_epi16(_mm_unpacklo_epi16(a, b), tv));
483485 hi = _mm_add_epi32(hi, _mm_madd_epi16(_mm_unpackhi_epi16(a, b), tv));
484486 }
@@ -493,8 +495,8 @@ mod simd {
493495 continue;
494496 }
495497 let tv = _mm_set1_epi32(tp[k]);
496- let a = _mm_loadl_epi64(ip.add(2 * k * block_w + c).cast());
497- let b = _mm_loadl_epi64(ip.add((2 * k + 1) * block_w + c).cast());
498+ let a = _mm_loadl_epi64(ip.add(2 * k * src_stride + c).cast());
499+ let b = _mm_loadl_epi64(ip.add((2 * k + 1) * src_stride + c).cast());
498500 lo = _mm_add_epi32(lo, _mm_madd_epi16(_mm_unpacklo_epi16(a, b), tv));
499501 }
500502 _mm_storeu_si128(ap.add(c).cast(), lo);
@@ -506,7 +508,7 @@ mod simd {
506508 while c < block_w {
507509 let mut sum = 0i32;
508510 for (t, &tap) in taps.iter().enumerate() {
509- sum += tap * i32::from(*ip.add(t * block_w + c));
511+ sum += tap * i32::from(*ip.add(t * src_stride + c));
510512 }
511513 *ap.add(c) = sum;
512514 c += 1;
@@ -526,14 +528,15 @@ mod simd {
526528 pub unsafe fn vpass_row_u16_avx2(
527529 intermediate: &[i16],
528530 block_w: usize,
531+ src_stride: usize,
529532 row: usize,
530533 taps: &[i32; 8],
531534 max: i32,
532535 dst: &mut [u16],
533536 ) {
534- debug_assert!(intermediate.len() >= (row + 8) * block_w && dst.len() >= block_w);
537+ debug_assert!(intermediate.len() >= row * src_stride + 7 * src_stride + block_w && dst.len() >= block_w);
535538 let tp = tap_pairs(&taps16(taps));
536- let ip = intermediate.as_ptr().add(row * block_w);
539+ let ip = intermediate.as_ptr().add(row * src_stride);
537540 let dp = dst.as_mut_ptr();
538541 let rnd = _mm256_set1_epi32(1 << (INTER_ROUND_1 - 1));
539542 let mx = _mm256_set1_epi16(max as i16);
@@ -546,8 +549,8 @@ mod simd {
546549 continue;
547550 }
548551 let tv = _mm256_set1_epi32(tp[k]);
549- let a = _mm256_loadu_si256(ip.add(2 * k * block_w + c).cast());
550- let b = _mm256_loadu_si256(ip.add((2 * k + 1) * block_w + c).cast());
552+ let a = _mm256_loadu_si256(ip.add(2 * k * src_stride + c).cast());
553+ let b = _mm256_loadu_si256(ip.add((2 * k + 1) * src_stride + c).cast());
551554 lo = _mm256_add_epi32(lo, _mm256_madd_epi16(_mm256_unpacklo_epi16(a, b), tv));
552555 hi = _mm256_add_epi32(hi, _mm256_madd_epi16(_mm256_unpackhi_epi16(a, b), tv));
553556 }
@@ -559,7 +562,7 @@ mod simd {
559562 _mm256_storeu_si256(dp.add(c).cast(), v);
560563 c += 16;
561564 }
562- vpass_u16_tail_sse(ip, block_w, &tp, taps, max, dp, c);
565+ vpass_u16_tail_sse(ip, block_w, src_stride, &tp, taps, max, dp, c);
563566 }
564567
565568 /// [`vpass_row_u16_avx2`]'s 8- and 4-column steps (SSE4.1 for
@@ -571,6 +574,7 @@ mod simd {
571574 unsafe fn vpass_u16_tail_sse(
572575 ip: *const i16,
573576 block_w: usize,
577+ src_stride: usize,
574578 tp: &[i32; 4],
575579 taps: &[i32; 8],
576580 max: i32,
@@ -588,7 +592,7 @@ mod simd {
588592 continue;
589593 }
590594 let tv = _mm_set1_epi32(tp[k]);
591- let (pa, pb) = (ip.add(2 * k * block_w + c), ip.add((2 * k + 1) * block_w + c));
595+ let (pa, pb) = (ip.add(2 * k * src_stride + c), ip.add((2 * k + 1) * src_stride + c));
592596 let (a, b) = if wide {
593597 (_mm_loadu_si128(pa.cast()), _mm_loadu_si128(pb.cast()))
594598 } else {
@@ -614,7 +618,7 @@ mod simd {
614618 while c < block_w {
615619 let mut sum = 0i32;
616620 for (t, &tap) in taps.iter().enumerate() {
617- sum += tap * i32::from(*ip.add(t * block_w + c));
621+ sum += tap * i32::from(*ip.add(t * src_stride + c));
618622 }
619623 *dp.add(c) = round2(sum, INTER_ROUND_1).clamp(0, max) as u16;
620624 c += 1;
@@ -629,15 +633,16 @@ mod simd {
629633 pub unsafe fn vpass_row_u16_sse41(
630634 intermediate: &[i16],
631635 block_w: usize,
636+ src_stride: usize,
632637 row: usize,
633638 taps: &[i32; 8],
634639 max: i32,
635640 dst: &mut [u16],
636641 ) {
637- debug_assert!(intermediate.len() >= (row + 8) * block_w && dst.len() >= block_w);
642+ debug_assert!(intermediate.len() >= row * src_stride + 7 * src_stride + block_w && dst.len() >= block_w);
638643 let tp = tap_pairs(&taps16(taps));
639644 vpass_u16_tail_sse(
640- intermediate.as_ptr().add(row * block_w), block_w, &tp, taps, max,
645+ intermediate.as_ptr().add(row * src_stride), block_w, src_stride, &tp, taps, max,
641646 dst.as_mut_ptr(), 0,
642647 );
643648 }
@@ -649,13 +654,14 @@ mod simd {
649654 pub unsafe fn vpass_sse41(
650655 intermediate: &[i16],
651656 block_w: usize,
657+ src_stride: usize,
652658 row: usize,
653659 taps: &[i32; 8],
654660 acc: &mut [i32],
655661 ) {
656- debug_assert!(intermediate.len() >= (row + 8) * block_w && acc.len() >= block_w);
662+ debug_assert!(intermediate.len() >= (row + 7) * src_stride + block_w && acc.len() >= block_w);
657663 let tp = tap_pairs(&taps16(taps));
658- vpass_tail_sse(intermediate.as_ptr().add(row * block_w), block_w, &tp, taps, acc.as_mut_ptr(), 0);
664+ vpass_tail_sse(intermediate.as_ptr().add(row * src_stride), block_w, src_stride, &tp, taps, acc.as_mut_ptr(), 0);
659665 }
660666
661667 /// Horizontal pass, SSE2: [`hpass_avx2`]'s scheme at 8 outputs per
@@ -758,6 +764,38 @@ fn horizontal_pass_unscaled(
758764 // InterRound0) == 16 * s` exactly, so a whole-pel horizontal position
759765 // needs no filter at all -- one widened row read.
760766 let identity = taps[3] == 128 && taps.iter().enumerate().all(|(i, &t)| i == 3 || t == 0);
767+ // lane-mc2: when the whole `rows x (block_w+7)` footprint lies inside the
768+ // reference -- the overwhelmingly common case -- every per-row test in
769+ // the general loop below (the vertical clamp, the horizontal interior
770+ // test, the slice bounds check, the tap narrowing and the SIMD dispatch)
771+ // has the same answer for every row, so it is hoisted out and the loop
772+ // becomes a walk of `stride`. Same sums, same order.
773+ let start = x0 - 3;
774+ let y_top = y0 - 3;
775+ if !identity
776+ && start >= 0
777+ && y_top >= 0
778+ && start as usize + block_w + 7 <= true_width
779+ && y_top as usize + rows <= true_height
780+ {
781+ let base = y_top as usize * stride + start as usize;
782+ let span = block_w + 7;
783+ if base + (rows - 1) * stride + span <= reference.len() {
784+ let t16 = [
785+ taps[0] as i16, taps[1] as i16, taps[2] as i16, taps[3] as i16,
786+ taps[4] as i16, taps[5] as i16, taps[6] as i16, taps[7] as i16,
787+ ];
788+ for r in 0..rows {
789+ let s = base + r * stride;
790+ hpass_contig(
791+ &reference[s..s + span],
792+ &t16,
793+ &mut intermediate[r * block_w..(r + 1) * block_w],
794+ );
795+ }
796+ return;
797+ }
798+ }
761799 for r in 0..rows {
762800 let y = (y0 - 3 + r as i32).clamp(0, true_height as i32 - 1) as usize;
763801 let out = &mut intermediate[r * block_w..(r + 1) * block_w];
@@ -788,7 +826,7 @@ fn horizontal_pass_unscaled(
788826 /// eight slots. `acc` is left holding the unrounded sums.
789827 #[inline]
790828 #[allow(unsafe_code)]
791-pub(crate) fn vpass_row(intermediate: &[i16], block_w: usize, row: usize, taps: &[i32; 8], acc: &mut [i32]) {
829+pub(crate) fn vpass_row(intermediate: &[i16], block_w: usize, src_stride: usize, row: usize, taps: &[i32; 8], acc: &mut [i32]) {
792830 #[cfg(target_arch = "x86_64")]
793831 {
794832 match simd_level() {
@@ -797,17 +835,17 @@ pub(crate) fn vpass_row(intermediate: &[i16], block_w: usize, row: usize, taps:
797835 // + block_w]` for t in 0..8 and writes `acc[..block_w]`, which
798836 // the debug asserts pin.
799837 SimdLevel::Avx2 => {
800- unsafe { simd::vpass_avx2(intermediate, block_w, row, taps, acc) };
838+ unsafe { simd::vpass_avx2(intermediate, block_w, src_stride, row, taps, acc) };
801839 return;
802840 }
803841 SimdLevel::Sse41 => {
804- unsafe { simd::vpass_sse41(intermediate, block_w, row, taps, acc) };
842+ unsafe { simd::vpass_sse41(intermediate, block_w, src_stride, row, taps, acc) };
805843 return;
806844 }
807845 SimdLevel::Scalar => {}
808846 }
809847 }
810- vpass_row_scalar(intermediate, block_w, row, taps, acc);
848+ vpass_row_scalar(intermediate, block_w, src_stride, row, taps, acc);
811849 }
812850
813851 /// lane-mc: [`vpass_row`] with the output rounding fused in, for the two
@@ -819,6 +857,7 @@ pub(crate) fn vpass_row(intermediate: &[i16], block_w: usize, row: usize, taps:
819857 fn vpass_row_u16(
820858 intermediate: &[i16],
821859 block_w: usize,
860+ src_stride: usize,
822861 row: usize,
823862 taps: &[i32; 8],
824863 max: i32,
@@ -832,23 +871,24 @@ fn vpass_row_u16(
832871 // + block_w]` for t in 0..8 and writes `dst[..block_w]`, which
833872 // the debug asserts pin.
834873 SimdLevel::Avx2 => {
835- unsafe { simd::vpass_row_u16_avx2(intermediate, block_w, row, taps, max, dst) };
874+ unsafe { simd::vpass_row_u16_avx2(intermediate, block_w, src_stride, row, taps, max, dst) };
836875 return;
837876 }
838877 SimdLevel::Sse41 => {
839- unsafe { simd::vpass_row_u16_sse41(intermediate, block_w, row, taps, max, dst) };
878+ unsafe { simd::vpass_row_u16_sse41(intermediate, block_w, src_stride, row, taps, max, dst) };
840879 return;
841880 }
842881 SimdLevel::Scalar => {}
843882 }
844883 }
845- vpass_row_u16_scalar(intermediate, block_w, row, taps, max, dst);
884+ vpass_row_u16_scalar(intermediate, block_w, src_stride, row, taps, max, dst);
846885 }
847886
848887 /// The scalar reference for [`vpass_row_u16`].
849888 fn vpass_row_u16_scalar(
850889 intermediate: &[i16],
851890 block_w: usize,
891+ src_stride: usize,
852892 row: usize,
853893 taps: &[i32; 8],
854894 max: i32,
@@ -857,20 +897,20 @@ fn vpass_row_u16_scalar(
857897 for (c, d) in dst[..block_w].iter_mut().enumerate() {
858898 let mut sum = 0i32;
859899 for (t, &tap) in taps.iter().enumerate() {
860- sum += tap * i32::from(intermediate[(row + t) * block_w + c]);
900+ sum += tap * i32::from(intermediate[(row + t) * src_stride + c]);
861901 }
862902 *d = round2(sum, INTER_ROUND_1).clamp(0, max) as u16;
863903 }
864904 }
865905
866906 /// The scalar reference for [`vpass_row`] (lane-perf2's tap-major loop).
867-fn vpass_row_scalar(intermediate: &[i16], block_w: usize, row: usize, taps: &[i32; 8], acc: &mut [i32]) {
907+fn vpass_row_scalar(intermediate: &[i16], block_w: usize, src_stride: usize, row: usize, taps: &[i32; 8], acc: &mut [i32]) {
868908 acc[..block_w].fill(0);
869909 for (t, &tap) in taps.iter().enumerate() {
870910 if tap == 0 {
871911 continue;
872912 }
873- let base = (row + t) * block_w;
913+ let base = (row + t) * src_stride;
874914 for (a, &s) in acc[..block_w].iter_mut().zip(&intermediate[base..base + block_w]) {
875915 *a += tap * i32::from(s);
876916 }
@@ -1108,6 +1148,46 @@ pub(crate) fn predict_with_filters_kern(
11081148 // block's own first row where the pass would have put the 4th.
11091149 let rows = if yfrac == 0 { block_h } else { block_h + 7 };
11101150 let max = crate::decode::sample_max(fctx);
1151+ // lane-mc2: a whole-pel horizontal position makes the horizontal pass the
1152+ // identity tap, whose output is `s << 4` (`Round2(128 * s, InterRound0)`
1153+ // with the tap 128). The vertical pass then computes
1154+ // `Round2(sum(tap * (s << 4)), InterRound1)`, which is the same 8-tap sum
1155+ // taken straight off the reference rows with every tap scaled by 16 --
1156+ // bit-identical, and it skips materialising `block_h + 7` intermediate
1157+ // rows. Interior blocks only; an edge block still needs the clamped read.
1158+ if xfrac != 0 || yfrac == 0 {
1159+ // fall through to the two-pass path
1160+ } else {
1161+ let top = y0 - 3;
1162+ if top >= 0
1163+ && x0 >= 0
1164+ && x0 as usize + block_w <= true_width
1165+ && top as usize + block_h + 7 <= true_height
1166+ {
1167+ let base = top as usize * stride + x0 as usize;
1168+ if base + (block_h + 6) * stride + block_w <= reference.len() {
1169+ let mut v16 = [0i32; 8];
1170+ for (o, &t) in v16.iter_mut().zip(v_filter.iter()) {
1171+ *o = t * 16;
1172+ }
1173+ // SAFETY: samples are below `2^15` at every supported bit
1174+ // depth, so the same bytes read as `i16` are the same values;
1175+ // the length is unchanged.
1176+ #[allow(unsafe_code)]
1177+ let src: &[i16] =
1178+ unsafe { std::slice::from_raw_parts(reference.as_ptr().cast::<i16>(), reference.len()) };
1179+ for row in 0..block_h {
1180+ vpass_row_u16(
1181+ &src[base..], block_w, stride, row, &v16, max,
1182+ &mut dst[row * block_w..(row + 1) * block_w],
1183+ );
1184+ }
1185+ #[cfg(test)]
1186+ crate::encode::stage_add(1, stage_t.elapsed());
1187+ return;
1188+ }
1189+ }
1190+ }
11111191 with_scratch(rows, block_w, |intermediate, _acc| {
11121192 horizontal_pass_unscaled(
11131193 reference, stride, true_width, true_height, x0,
@@ -1122,7 +1202,7 @@ pub(crate) fn predict_with_filters_kern(
11221202 }
11231203 for row in 0..block_h {
11241204 vpass_row_u16(
1125- intermediate, block_w, row, v_filter, max,
1205+ intermediate, block_w, block_w, row, v_filter, max,
11261206 &mut dst[row * block_w..(row + 1) * block_w],
11271207 );
11281208 }
@@ -1412,7 +1492,7 @@ pub(crate) fn predict_scaled_kern(
14121492 }
14131493 for row in 0..block_h {
14141494 vpass_row_u16(
1415- intermediate, block_w, row, v_filter, max,
1495+ intermediate, block_w, block_w, row, v_filter, max,
14161496 &mut dst[row * block_w..(row + 1) * block_w],
14171497 );
14181498 }
@@ -1546,6 +1626,41 @@ pub fn predict_compound_intermediate_kern(
15461626 };
15471627
15481628 let rows = if yfrac == 0 { block_h } else { block_h + 7 };
1629+ // lane-mc2: the unscaled whole-pel horizontal position is the identity
1630+ // tap, whose intermediate is `s << 4`, so the vertical pass is the same
1631+ // 8-tap sum taken straight off the reference rows with the taps scaled by
1632+ // 16 (see `predict_with_filters_kern`). Interior blocks only.
1633+ let x0 = x_q4.div_euclid(16);
1634+ if x_scale_fp == REF_NO_SCALE && x_q4.rem_euclid(16) == 0 && yfrac != 0 && block_w <= 128 {
1635+ let top = y0 - 3;
1636+ if top >= 0
1637+ && x0 >= 0
1638+ && x0 as usize + block_w <= true_width
1639+ && top as usize + block_h + 7 <= true_height
1640+ {
1641+ let base = top as usize * stride + x0 as usize;
1642+ if base + (block_h + 6) * stride + block_w <= reference.len() {
1643+ let mut v16 = [0i32; 8];
1644+ for (o, &t) in v16.iter_mut().zip(v_filter.iter()) {
1645+ *o = t * 16;
1646+ }
1647+ // SAFETY: samples are below `2^15` at every supported bit
1648+ // depth, so the same bytes read as `i16` are the same values.
1649+ #[allow(unsafe_code)]
1650+ let src: &[i16] =
1651+ unsafe { std::slice::from_raw_parts(reference.as_ptr().cast::<i16>(), reference.len()) };
1652+ let mut accbuf = [0i32; 128];
1653+ let acc = &mut accbuf[..block_w];
1654+ for row in 0..block_h {
1655+ vpass_row(&src[base..], block_w, stride, row, &v16, acc);
1656+ for (d, &a) in dst[row * block_w..(row + 1) * block_w].iter_mut().zip(acc.iter()) {
1657+ *d = round2(a, INTER_ROUND_1_COMPOUND);
1658+ }
1659+ }
1660+ return;
1661+ }
1662+ }
1663+ }
15491664 with_scratch(rows, block_w, |intermediate, acc| {
15501665 horizontal_pass(
15511666 reference, stride, true_width, true_height, x_q4,
@@ -1560,7 +1675,7 @@ pub fn predict_compound_intermediate_kern(
15601675 return;
15611676 }
15621677 for row in 0..block_h {
1563- vpass_row(intermediate, block_w, row, v_filter, acc);
1678+ vpass_row(intermediate, block_w, block_w, row, v_filter, acc);
15641679 for (d, &a) in dst[row * block_w..(row + 1) * block_w].iter_mut().zip(acc.iter()) {
15651680 *d = round2(a, INTER_ROUND_1_COMPOUND);
15661681 }
@@ -2213,20 +2328,20 @@ mod tests {
22132328 .collect();
22142329 for row in [0usize, 1, 4] {
22152330 let mut want = vec![0i32; w];
2216- super::vpass_row_scalar(&inter, w, row, taps, &mut want);
2331+ super::vpass_row_scalar(&inter, w, w, row, taps, &mut want);
22172332 let mut got = vec![0i32; w];
2218- super::vpass_row(&inter, w, row, taps, &mut got);
2333+ super::vpass_row(&inter, w, w, row, taps, &mut got);
22192334 assert_eq!(got, want, "dispatch w={w} frac={frac} row={row}");
22202335 #[cfg(target_arch = "x86_64")]
22212336 {
22222337 if std::arch::is_x86_feature_detected!("sse4.1") {
22232338 let mut sse = vec![0i32; w];
2224- unsafe { super::simd::vpass_sse41(&inter, w, row, taps, &mut sse) };
2339+ unsafe { super::simd::vpass_sse41(&inter, w, w, row, taps, &mut sse) };
22252340 assert_eq!(sse, want, "sse4.1 w={w} frac={frac} row={row}");
22262341 }
22272342 if std::arch::is_x86_feature_detected!("avx2") {
22282343 let mut avx = vec![0i32; w];
2229- unsafe { super::simd::vpass_avx2(&inter, w, row, taps, &mut avx) };
2344+ unsafe { super::simd::vpass_avx2(&inter, w, w, row, taps, &mut avx) };
22302345 assert_eq!(avx, want, "avx2 w={w} frac={frac} row={row}");
22312346 }
22322347 }
@@ -2236,7 +2351,7 @@ mod tests {
22362351 // `round2(_, InterRound1).clamp(0, max)`.
22372352 for max in [255i32, 1023] {
22382353 let mut want_u16 = vec![0u16; w];
2239- super::vpass_row_u16_scalar(&inter, w, row, taps, max, &mut want_u16);
2354+ super::vpass_row_u16_scalar(&inter, w, w, row, taps, max, &mut want_u16);
22402355 for (d, &a) in want_u16.iter().zip(want.iter()) {
22412356 assert_eq!(
22422357 i32::from(*d),
@@ -2245,18 +2360,18 @@ mod tests {
22452360 );
22462361 }
22472362 let mut got_u16 = vec![0u16; w];
2248- super::vpass_row_u16(&inter, w, row, taps, max, &mut got_u16);
2363+ super::vpass_row_u16(&inter, w, w, row, taps, max, &mut got_u16);
22492364 assert_eq!(got_u16, want_u16, "fused w={w} frac={frac} row={row} max={max}");
22502365 #[cfg(target_arch = "x86_64")]
22512366 {
22522367 if std::arch::is_x86_feature_detected!("sse4.1") {
22532368 let mut sse = vec![0u16; w];
2254- unsafe { super::simd::vpass_row_u16_sse41(&inter, w, row, taps, max, &mut sse) };
2369+ unsafe { super::simd::vpass_row_u16_sse41(&inter, w, w, row, taps, max, &mut sse) };
22552370 assert_eq!(sse, want_u16, "fused sse4.1 w={w} max={max}");
22562371 }
22572372 if std::arch::is_x86_feature_detected!("avx2") {
22582373 let mut avx = vec![0u16; w];
2259- unsafe { super::simd::vpass_row_u16_avx2(&inter, w, row, taps, max, &mut avx) };
2374+ unsafe { super::simd::vpass_row_u16_avx2(&inter, w, w, row, taps, max, &mut avx) };
22602375 assert_eq!(avx, want_u16, "fused avx2 w={w} max={max}");
22612376 }
22622377 }
crates/ec-av1/src/restoration.rsmodified+1 -1
@@ -642,7 +642,7 @@ fn apply_wiener_stripe(
642642 acc.clear();
643643 acc.resize(w, 0i32);
644644 for r in 0..h {
645- crate::mc::vpass_row(&inter, w, r, &taps, &mut acc);
645+ crate::mc::vpass_row(&inter, w, w, r, &taps, &mut acc);
646646 let dst = &mut out[(v_start + r) * stride + h_start..][..w];
647647 for (o, &a) in dst.iter_mut().zip(acc.iter()) {
648648 *o = round2(i64::from(a), 11).clamp(0, smax) as u16;