From 7e6ea02183293dce4862f795d7e3d1080570f9c2 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 13 Feb 2020 00:12:49 +0100 Subject: 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. --- video/zimg.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'video') 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; } -- cgit v1.2.3