[vlc-devel] commit: We can do integer math ... as long as sizes are smaller than 2**16 we should be ok :) ( Antoine Cellerier )

git version control git at videolan.org
Wed Apr 2 22:52:00 CEST 2008


vlc | branch: master | Antoine Cellerier <dionoea at videolan.org> | Wed Apr  2 21:51:34 2008 +0200| [aa0572e5198d28364a8e49730df98843bd702441]

We can do integer math ... as long as sizes are smaller than 2**16 we should be ok :)

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

 src/video_output/vout_intf.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index ecee0b2..516c9e1 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -724,13 +724,11 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
 
     if( fmt_out.i_width == 0 && fmt_out.i_height > 0 )
     {
-        float f = (float)fmt_in.i_height / fmt_out.i_height;
-        fmt_out.i_width = fmt_in.i_width / f;
+        fmt_out.i_width = (fmt_in.i_width * fmt_out.i_height) / fmt_in.i_height;
     }
     else if( fmt_out.i_height == 0 && fmt_out.i_width > 0 )
     {
-        float f = (float)fmt_in.i_width / fmt_out.i_width;
-        fmt_out.i_height = fmt_in.i_height / f;
+        fmt_out.i_height = (fmt_in.i_height * fmt_out.i_width) / fmt_in.i_width;
     }
     else
     {




More information about the vlc-devel mailing list