summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-02-13 00:12:49 +0100
committerwm4 <wm4@nowhere>2020-02-13 01:26:51 +0100
commit7e6ea02183293dce4862f795d7e3d1080570f9c2 (patch)
treef1cf7d200b6531673e4bd3ee25f75eaad90be78a
parentffd89f5ff48d9b91b6d62129b2baec607aca441a (diff)
downloadmpv-7e6ea02183293dce4862f795d7e3d1080570f9c2.tar.bz2
mpv-7e6ea02183293dce4862f795d7e3d1080570f9c2.tar.xz
zimg: fix previous odd sizes commit
Obviously, we don't want to lose fractions, and the zimg active_region fields in fact have the type double. The integer division was wrong. Also, always set active_region.width/height. It appears zimg behavior does not change if they're set to the normal integer values, so the extra check to not set them in this case was worthless.
-rw-r--r--video/zimg.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/video/zimg.c b/video/zimg.c
index f902374b14..8127e87b9d 100644
--- a/video/zimg.c
+++ b/video/zimg.c
@@ -752,10 +752,8 @@ static bool setup_format(zimg_image_format *zfmt, struct mp_zimg_repack *r,
if (!r->pack && ctx) {
// Relies on ctx->zimg_dst being initialized first.
struct mp_zimg_repack *dst = ctx->zimg_dst;
- if (r->real_w != fmt.w || dst->real_w != dst->fmt.w)
- zfmt->active_region.width = dst->real_w * (uint64_t)fmt.w / dst->fmt.w;
- if (r->real_h != fmt.h || dst->real_h != dst->fmt.h)
- zfmt->active_region.height = dst->real_h * (uint64_t)fmt.h / dst->fmt.h;
+ zfmt->active_region.width = dst->real_w * (double)fmt.w / dst->fmt.w;
+ zfmt->active_region.height = dst->real_h * (double)fmt.h / dst->fmt.h;
}