diff options
author | Niklas Haas <git@nand.wakku.to> | 2016-04-17 13:07:14 +0200 |
---|---|---|
committer | Niklas Haas <git@nand.wakku.to> | 2016-05-15 20:42:02 +0200 |
commit | 3d4889e91e7ae519e7fc44911974a52d1770e249 (patch) | |
tree | 9e0fba09d6d348322afaaea996eebc09180cee57 /video/out/opengl/video.c | |
parent | 32c10956e0a2dbf920026ee549f84a7581e11d21 (diff) |
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.
Diffstat (limited to 'video/out/opengl/video.c')
-rw-r--r-- | video/out/opengl/video.c | 9 |
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]; |