WebP/Lossy: Add a missing clamp() in TM_PRED
prediction
The spec has that clamp at the end of https://datatracker.ietf.org/doc/html/rfc6386#section-12.2: The exact algorithm is as follows: [...] b[r][c] = clamp255(L[r]+ A[c] - P); For the test images I'm looking at, it doesn't seem to make a dramatic difference, but omitting it in `B_TM_PRED` did make a dramatic difference, so add it. (Also, the spec demands it.)
This commit is contained in:
parent
40e1ec6cf9
commit
830a3a25dc
Notes:
sideshowbarker
2024-07-17 00:37:23 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/830a3a25dc Pull-request: https://github.com/SerenityOS/serenity/pull/19180 Reviewed-by: https://github.com/gmta ✅
1 changed files with 1 additions and 1 deletions
|
@ -924,7 +924,7 @@ void predict_macroblock(Span<i16> prediction, IntraMacroblockMode mode, int mb_x
|
|||
VERIFY(mode == TM_PRED);
|
||||
for (int y = 0; y < N; ++y)
|
||||
for (int x = 0; x < N; ++x)
|
||||
prediction[y * N + x] = left[y] + above[mb_x * N + x] - truemotion_corner;
|
||||
prediction[y * N + x] = clamp(left[y] + above[mb_x * N + x] - truemotion_corner, 0, 255);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue