Inter reconstruction adds a row at a time
Browse files at this commit180e07916e8cae5a55842335c3742db2bdc45d30Parent: 8567ed5- perf
- inter reconstruction adds a row at a time
1 changed file +12 -4
- crates/ec-av1/src/decode.rs +12 -4
crates/ec-av1/src/decode.rsmodified+12 -4
| @@ -19223,11 +19223,19 @@ impl PlaneBuf { | |||
| 19223 | // 768..832). libaom reconstructs those rows into the frame buffer's | 19223 | // 768..832). libaom reconstructs those rows into the frame buffer's |
| 19224 | // border; nothing reads them back, so they are simply dropped here. | 19224 | // border; nothing reads them back, so they are simply dropped here. |
| 19225 | let (h, w) = (h.min(self.height.saturating_sub(y)), w.min(self.width.saturating_sub(x))); | 19225 | let (h, w) = (h.min(self.height.saturating_sub(y)), w.min(self.width.saturating_sub(x))); |
| 19226 | + // lane-perf4: one row of each operand at a time. `side` is the | ||
| 19227 | + // prediction/residual stride and `self.width` the plane's, so the | ||
| 19228 | + // three row bases are computed once per row instead of a | ||
| 19229 | + // multiply-add per sample (the samples themselves are unchanged). | ||
| 19230 | + let max = crate::decode::sample_max(); | ||
| 19226 | for row in 0..h { | 19231 | for row in 0..h { |
| 19227 | - for col in 0..w { | 19232 | + let src = row * side; |
| 19228 | - let sample = (i32::from(prediction[row * side + col]) + residual[row * side + col]) | 19233 | + let dst = (y + row) * self.width + x; |
| 19229 | - .clamp(0, crate::decode::sample_max()) as u16; | 19234 | + let pred = &prediction[src..src + w]; |
| 19230 | - self.data[(y + row) * self.width + x + col] = sample; | 19235 | + let res = &residual[src..src + w]; |
| 19236 | + let out = &mut self.data[dst..dst + w]; | ||
| 19237 | + for ((o, &p), &r) in out.iter_mut().zip(pred).zip(res) { | ||
| 19238 | + *o = (i32::from(p) + r).clamp(0, max) as u16; | ||
| 19231 | } | 19239 | } |
| 19232 | } | 19240 | } |
| 19233 | } | 19241 | } |