From a36221dea7ea84943c9df195e360196179e94afb Mon Sep 17 00:00:00 2001 From: Johns Date: Tue, 10 Mar 2015 10:10:14 +0100 Subject: [PATCH] Fix bug: center cut-out didn't use cut off pixels. --- ChangeLog | 1 + video.c | 28 +++++++++++++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4a3bfc8..0d32f72 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ User johns Date: + Fix bug: center cut-out didn't use cut off pixels. Fix bug #2058: support for Make.plgcfg. Fix for compile with vdr 2.1.10, for older vdr versions. diff --git a/video.c b/video.c index 56cae36..288cb7b 100644 --- a/video.c +++ b/video.c @@ -632,27 +632,37 @@ static void VideoUpdateOutput(AVRational input_aspect_ratio, int input_width, // look which side must be cut if (*crop_width > video_width) { - *crop_height = input_height; + int tmp; + + *crop_height = input_height - VideoCutTopBottom[resolution] * 2; // adjust scaling - *crop_x = ((*crop_width - video_width) * input_width) - / (2 * video_width); + tmp = ((*crop_width - video_width) * input_width) / (2 * video_width); + // FIXME: round failure? + if (tmp > *crop_x) { + *crop_x = tmp; + } *crop_width = input_width - *crop_x * 2; - // FIXME: round failure? } else if (*crop_height > video_height) { - *crop_width = input_width; + int tmp; + + *crop_width = input_width - VideoCutLeftRight[resolution] * 2; // adjust scaling - *crop_y = ((*crop_height - video_height) * input_height) + tmp = ((*crop_height - video_height) * input_height) / (2 * video_height); - *crop_height = input_height - *crop_y * 2; // FIXME: round failure? + if (tmp > *crop_y) { + *crop_y = tmp; + } + *crop_height = input_height - *crop_y * 2; } else { - *crop_width = input_width; - *crop_height = input_height; + *crop_width = input_width - VideoCutLeftRight[resolution] * 2; + *crop_height = input_height - VideoCutTopBottom[resolution] * 2; } Debug(3, "video: aspect crop %dx%d%+d%+d\n", *crop_width, *crop_height, *crop_x, *crop_y); + return; } //----------------------------------------------------------------------------