mirror of
https://github.com/mpv-player/mpv
synced 2025-04-20 14:16:36 +00:00
video: change --video-zoom behavior
Use the scaled video size (i.e. as shown on the window) as reference for zoom. This is the easiest way to fix different width/height scale factors as they happen when zooming video with a pixel aspect ratio other than 1:1. Also fix the unscaled mode, so that it 1. doesn't scale even with --video-zoom, and 2. doesn't scale by small amounts when the video is cropped by making the window smaller than the video.
This commit is contained in:
parent
ebf6d0004b
commit
37319ab644
@ -2667,6 +2667,10 @@ OPTIONS
|
|||||||
``--video-zoom`` option is set to a value other than ``1``, scaling is
|
``--video-zoom`` option is set to a value other than ``1``, scaling is
|
||||||
enabled, but the video isn't automatically scaled to the window size.)
|
enabled, but the video isn't automatically scaled to the window size.)
|
||||||
|
|
||||||
|
The video and monitor aspects aspect will be ignored. Aspect correction
|
||||||
|
would require to scale the video in the X or Y direction, but this option
|
||||||
|
disables scaling, disabling all aspect correction.
|
||||||
|
|
||||||
Note that the scaler algorithm may still be used, even if the video isn't
|
Note that the scaler algorithm may still be used, even if the video isn't
|
||||||
scaled. For example, this can influence chroma conversion.
|
scaled. For example, this can influence chroma conversion.
|
||||||
|
|
||||||
@ -2674,10 +2678,11 @@ OPTIONS
|
|||||||
|
|
||||||
``--video-zoom=<value>``
|
``--video-zoom=<value>``
|
||||||
Adjust the video display scale factor by the given value. The unit is in
|
Adjust the video display scale factor by the given value. The unit is in
|
||||||
fractions of original video size.
|
fractions of the (scaled) window video size.
|
||||||
|
|
||||||
For example, given a 1280x720 video, ``--video-zoom=-0.1`` would make the
|
For example, given a 1280x720 video shown in a 1280x720 window,
|
||||||
video by 128 pixels smaller in X direction, and 72 pixels in Y direction.
|
``--video-zoom=-0.1`` would make the video by 128 pixels smaller in
|
||||||
|
X direction, and 72 pixels in Y direction.
|
||||||
|
|
||||||
This option is disabled if the ``--no-keepaspect`` option is used.
|
This option is disabled if the ``--no-keepaspect`` option is used.
|
||||||
|
|
||||||
|
@ -508,10 +508,12 @@ static void src_dst_split_scaling(int src_size, int dst_size,
|
|||||||
int *dst_start, int *dst_end,
|
int *dst_start, int *dst_end,
|
||||||
int *osd_margin_a, int *osd_margin_b)
|
int *osd_margin_a, int *osd_margin_b)
|
||||||
{
|
{
|
||||||
if (unscaled)
|
if (unscaled) {
|
||||||
scaled_src_size = src_size;
|
scaled_src_size = src_size;
|
||||||
|
zoom = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
scaled_src_size += zoom * src_size;
|
scaled_src_size += zoom * scaled_src_size;
|
||||||
align = (align + 1) / 2;
|
align = (align + 1) / 2;
|
||||||
|
|
||||||
*src_start = 0;
|
*src_start = 0;
|
||||||
@ -537,7 +539,7 @@ static void src_dst_split_scaling(int src_size, int dst_size,
|
|||||||
*dst_end = dst_size;
|
*dst_end = dst_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unscaled && zoom == 1.0) {
|
if (unscaled) {
|
||||||
// Force unscaled by reducing the range for src or dst
|
// Force unscaled by reducing the range for src or dst
|
||||||
int src_s = *src_end - *src_start;
|
int src_s = *src_end - *src_start;
|
||||||
int dst_s = *dst_end - *dst_start;
|
int dst_s = *dst_end - *dst_start;
|
||||||
|
Loading…
Reference in New Issue
Block a user