Constant-length row copies on the whole-pel inter path
Browse files at this commit3a35e5fda4b730e38f9ec7c62360737d22ffda89Parent: 209d003- perf
- constant-length row copies on the whole-pel inter path
1 changed file +10 -1
- crates/ec-av1/src/mc.rs +10 -1
crates/ec-av1/src/mc.rsmodified+10 -1
| @@ -1063,7 +1063,16 @@ pub(crate) fn predict_with_filters_kern( | |||
| 1063 | // lane-perf2: an interior row is one contiguous copy. | 1063 | // lane-perf2: an interior row is one contiguous copy. |
| 1064 | if x0 >= 0 && x0 as usize + block_w <= true_width { | 1064 | if x0 >= 0 && x0 as usize + block_w <= true_width { |
| 1065 | if let Some(src) = reference.get(row_base + x0 as usize..row_base + x0 as usize + block_w) { | 1065 | if let Some(src) = reference.get(row_base + x0 as usize..row_base + x0 as usize + block_w) { |
| 1066 | - out.copy_from_slice(src); | 1066 | + // The common widths get a constant-length copy: at 8 |
| 1067 | + // samples a `memcpy` call costs more than the move it | ||
| 1068 | + // makes, and 8x8 is the most common inter block on real | ||
| 1069 | + // 4K content. | ||
| 1070 | + match block_w { | ||
| 1071 | + 4 => out[..4].copy_from_slice(&src[..4]), | ||
| 1072 | + 8 => out[..8].copy_from_slice(&src[..8]), | ||
| 1073 | + 16 => out[..16].copy_from_slice(&src[..16]), | ||
| 1074 | + _ => out.copy_from_slice(src), | ||
| 1075 | + } | ||
| 1067 | continue; | 1076 | continue; |
| 1068 | } | 1077 | } |
| 1069 | } | 1078 | } |