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.
This commit is contained in:
Niklas Haas 2016-04-17 13:07:14 +02:00
parent 32c10956e0
commit 3d4889e91e
1 changed files with 6 additions and 3 deletions

View File

@ -1711,9 +1711,12 @@ static void pass_scale_main(struct gl_video *p)
struct scaler_config scaler_conf = p->opts.scaler[SCALER_SCALE]; struct scaler_config scaler_conf = p->opts.scaler[SCALER_SCALE];
if (p->opts.scaler_resizes_only && !downscaling && !upscaling) { if (p->opts.scaler_resizes_only && !downscaling && !upscaling) {
scaler_conf.kernel.name = "bilinear"; scaler_conf.kernel.name = "bilinear";
// bilinear is going to be used, just remove all sub-pixel offsets. // For scaler-resizes-only, we round the texture offset to
p->texture_offset.t[0] = (int)p->texture_offset.t[0]; // the nearest round value in order to prevent ugly blurriness
p->texture_offset.t[1] = (int)p->texture_offset.t[1]; // (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) { if (downscaling && p->opts.scaler[SCALER_DSCALE].kernel.name) {
scaler_conf = p->opts.scaler[SCALER_DSCALE]; scaler_conf = p->opts.scaler[SCALER_DSCALE];