mirror of
https://github.com/mpv-player/mpv
synced 2024-12-26 09:02:38 +00:00
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:
parent
283139607c
commit
5d7cf6e508
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user