diff options
author | David Conrad <david_conrad@apple.com> | 2022-06-08 01:05:12 +0300 |
---|---|---|
committer | David Conrad <david_conrad@apple.com> | 2022-09-15 03:28:22 +0300 |
commit | e202fa082b6699e60ec2806c067f34a82750b4fa (patch) | |
tree | c5f3278feef4c8f266031795ae8f76a2562c1a94 | |
parent | ee98592ba27aa0c958778eef998ed89a664e252d (diff) |
Fix rounding in the calculation of initialSubpelX
The spec divides err by two, rounding to 0, instead of >>1,
which rounds towards negative infinity
-rw-r--r-- | src/decode.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/decode.c b/src/decode.c index 8a1ef7c..126a39e 100644 --- a/src/decode.c +++ b/src/decode.c @@ -3483,7 +3483,7 @@ int dav1d_decode_frame(Dav1dFrameContext *const f) { static int get_upscale_x0(const int in_w, const int out_w, const int step) { const int err = out_w * step - (in_w << 14); - const int x0 = (-((out_w - in_w) << 13) + (out_w >> 1)) / out_w + 128 - (err >> 1); + const int x0 = (-((out_w - in_w) << 13) + (out_w >> 1)) / out_w + 128 - (err / 2); return x0 & 0x3fff; } |