video: add rounding to aspect ratio calculations

Small errors are unavoidable, but truncation can cause anamorphic video
to be off by 1 or 2 pixels.
This commit is contained in:
wm4 2014-02-19 15:37:47 +01:00
parent 283139607c
commit 5d7cf6e508
1 changed files with 2 additions and 2 deletions

View File

@ -599,11 +599,11 @@ void vf_set_dar(int *d_w, int *d_h, int w, int h, double dar)
*d_w = w;
*d_h = h;
if (dar > 0.01) {
*d_w = h * dar;
*d_w = h * dar + 0.5;
// we don't like horizontal downscale
if (*d_w < w) {
*d_w = w;
*d_h = w / dar;
*d_h = w / dar + 0.5;
}
}
}