summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Haas <git@nand.wakku.to>2016-04-17 13:07:14 +0200
committerNiklas Haas <git@nand.wakku.to>2016-05-15 20:42:02 +0200
commit3d4889e91e7ae519e7fc44911974a52d1770e249 (patch)
tree9e0fba09d6d348322afaaea996eebc09180cee57
parent32c10956e0a2dbf920026ee549f84a7581e11d21 (diff)
downloadmpv-3d4889e91e7ae519e7fc44911974a52d1770e249.tar.bz2
mpv-3d4889e91e7ae519e7fc44911974a52d1770e249.tar.xz
vo_opengl: minor change to scaler_resizes_only
Instead of rounding down, we round to the nearest float. This reduces the maximum possible error introduced by this rounding operation. Also clarify the comment.
-rw-r--r--video/out/opengl/video.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c
index 30ac790fa9..ba48e2873b 100644
--- a/video/out/opengl/video.c
+++ b/video/out/opengl/video.c
@@ -1711,9 +1711,12 @@ static void pass_scale_main(struct gl_video *p)
struct scaler_config scaler_conf = p->opts.scaler[SCALER_SCALE];
if (p->opts.scaler_resizes_only && !downscaling && !upscaling) {
scaler_conf.kernel.name = "bilinear";
- // bilinear is going to be used, just remove all sub-pixel offsets.
- p->texture_offset.t[0] = (int)p->texture_offset.t[0];
- p->texture_offset.t[1] = (int)p->texture_offset.t[1];
+ // For scaler-resizes-only, we round the texture offset to
+ // the nearest round value in order to prevent ugly blurriness
+ // (in exchange for slightly shifting the image by up to half a
+ // subpixel)
+ p->texture_offset.t[0] = roundf(p->texture_offset.t[0]);
+ p->texture_offset.t[1] = roundf(p->texture_offset.t[1]);
}
if (downscaling && p->opts.scaler[SCALER_DSCALE].kernel.name) {
scaler_conf = p->opts.scaler[SCALER_DSCALE];