From: Joseph Tulou Date: Fri, 13 Feb 2009 13:59:02 +0000 (+0100) Subject: Corrects original width/height calculations to be consistent with other part of vlc... X-Git-Tag: 1.0.0-pre1~680 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=705148182b17c6a08a8edbb05940904a974e6a32;p=vlc Corrects original width/height calculations to be consistent with other part of vlc (patch 1/3) Signed-off-by: Laurent Aimar --- diff --git a/src/video_output/vout_pictures.c b/src/video_output/vout_pictures.c index 3275aac7d1..4072bf265e 100644 --- a/src/video_output/vout_pictures.c +++ b/src/video_output/vout_pictures.c @@ -473,17 +473,25 @@ void vout_PlacePicture( const vout_thread_t *p_vout, *pi_width = i_width; *pi_height = i_height; } - else if( i_zoom == ZOOM_FP_FACTOR ) /* original size */ - { - *pi_width = __MIN( i_width, p_vout->fmt_in.i_visible_width ); - *pi_height = __MIN( i_height, p_vout->fmt_in.i_visible_height ); - } else { - *pi_width = - p_vout->fmt_in.i_visible_width * i_zoom / ZOOM_FP_FACTOR; - *pi_height = - p_vout->fmt_in.i_visible_height * i_zoom / ZOOM_FP_FACTOR; + unsigned int i_original_width, i_original_height; + + if( p_vout->fmt_in.i_sar_num >= p_vout->fmt_in.i_sar_den ) + { + i_original_width = p_vout->fmt_in.i_visible_width * + p_vout->fmt_in.i_sar_num / p_vout->fmt_in.i_sar_den; + i_original_height = p_vout->fmt_in.i_visible_height; + } + else + { + i_original_width = p_vout->fmt_in.i_visible_width; + i_original_height = p_vout->fmt_in.i_visible_height * + p_vout->fmt_in.i_sar_den / p_vout->fmt_in.i_sar_num; + } + + *pi_width = i_original_width * i_zoom / ZOOM_FP_FACTOR ; + *pi_height = i_original_height * i_zoom / ZOOM_FP_FACTOR ; } int64_t i_scaled_width = p_vout->fmt_in.i_visible_width * (int64_t)p_vout->fmt_in.i_sar_num *