[vlc-devel] commit: Corrects original width/ height calculations to be consistent with other part of vlc (patch 1/3) ( Joseph Tulou )

git version control git at videolan.org
Sat Feb 14 15:39:27 CET 2009


vlc | branch: master | Joseph Tulou <brezhoneg1 at yahoo.fr> | Fri Feb 13 14:59:02 2009 +0100| [705148182b17c6a08a8edbb05940904a974e6a32] | committer: Laurent Aimar 

Corrects original width/height calculations to be consistent with other part of vlc (patch 1/3)

Signed-off-by: Laurent Aimar <fenrir at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=705148182b17c6a08a8edbb05940904a974e6a32
---

 src/video_output/vout_pictures.c |   26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/src/video_output/vout_pictures.c b/src/video_output/vout_pictures.c
index 3275aac..4072bf2 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 *




More information about the vlc-devel mailing list