An all-zero inter residual reconstructs as a prediction copy
Browse files at this commitc5b674a94b8b3a1684d2cd0d052ed8c96cf53a2dParent: ba6ddd4- perf
- an all-zero inter residual reconstructs as a prediction copy
1 changed file +15 -0
- crates/ec-av1/src/decode.rs +15 -0
crates/ec-av1/src/decode.rsmodified+15 -0
| @@ -22226,6 +22226,21 @@ impl PlaneBuf<'_> { | |||
| 22226 | // three row bases are computed once per row instead of a | 22226 | // three row bases are computed once per row instead of a |
| 22227 | // multiply-add per sample (the samples themselves are unchanged). | 22227 | // multiply-add per sample (the samples themselves are unchanged). |
| 22228 | let max = crate::decode::sample_max(fctx); | 22228 | let max = crate::decode::sample_max(fctx); |
| 22229 | + // lane-recoparse: an all-zero residual (60% of the units) is a plain | ||
| 22230 | + // prediction copy -- the same arithmetic with `r == 0`, without | ||
| 22231 | + // reading `side * h` zeros out of [`ZERO_RESIDUAL`]. | ||
| 22232 | + if residual.is_empty() { | ||
| 22233 | + for row in 0..h { | ||
| 22234 | + let src = row * side; | ||
| 22235 | + let dst = (y + row) * self.width + x; | ||
| 22236 | + let pred = &prediction[src..src + w]; | ||
| 22237 | + let out = &mut self.data.to_mut()[dst..dst + w]; | ||
| 22238 | + for (o, &p) in out.iter_mut().zip(pred) { | ||
| 22239 | + *o = i32::from(p).clamp(0, max) as u16; | ||
| 22240 | + } | ||
| 22241 | + } | ||
| 22242 | + return; | ||
| 22243 | + } | ||
| 22229 | let residual = dense_residual(residual, side * h); | 22244 | let residual = dense_residual(residual, side * h); |
| 22230 | for row in 0..h { | 22245 | for row in 0..h { |
| 22231 | let src = row * side; | 22246 | let src = row * side; |