From 9d5da6a3aae928d7fd702d03ea8212f2db48dd5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20Ni=C3=9Fl?= Date: Sun, 18 Jul 2010 23:33:46 +0200 Subject: Fix input_vdr to use the best match when choosing zoom factors The current implementation chooses 4:3 when aspect is within +/- 0.0075 % of 4:3. Otherwise 16:9 is chosen. But there are some H.264 channels with almost 4:3 aspect and choosing 16:9 for them is worse. So the new implementation chooses the best match. --- src/vdr/input_vdr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/vdr/input_vdr.c b/src/vdr/input_vdr.c index 999f2e406..ac9a313bd 100644 --- a/src/vdr/input_vdr.c +++ b/src/vdr/input_vdr.c @@ -339,13 +339,16 @@ static void adjust_zoom(vdr_input_plugin_t *this) && this->image16_9_zoom_x && this->image16_9_zoom_y) { int ratio = (int)(10000 * this->frame_size.r + 0.5); + int matches4_3 = abs(ratio - 13333); + int matches16_9 = abs(ratio - 17778); + /* fprintf(stderr, "ratio: %d\n", ratio); */ - if (13332 <= ratio && ratio <= 13334) + if (matches4_3 < matches16_9) { xine_set_param(this->stream, XINE_PARAM_VO_ZOOM_X, this->image4_3_zoom_x); xine_set_param(this->stream, XINE_PARAM_VO_ZOOM_Y, this->image4_3_zoom_y); } - else /* if (17777 <= ratio && ratio <= 17779) */ + else { xine_set_param(this->stream, XINE_PARAM_VO_ZOOM_X, this->image16_9_zoom_x); xine_set_param(this->stream, XINE_PARAM_VO_ZOOM_Y, this->image16_9_zoom_y); -- cgit v1.2.3