]> git.sesse.net Git - vlc/commitdiff
Replaced ReduceHeight by GCD (vout).
authorLaurent Aimar <fenrir@videolan.org>
Sat, 25 Apr 2009 21:14:24 +0000 (23:14 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Sun, 26 Apr 2009 11:54:38 +0000 (13:54 +0200)
src/video_output/video_output.c

index 3024eeda93841ba0154240a637d18e8c05b9a800..5d48bca19e781cee16af3a69287723d89834d7c8 100644 (file)
@@ -1577,44 +1577,9 @@ static void ChromaDestroy( vout_thread_t *p_vout )
 }
 
 /* following functions are local */
-static int ReduceHeight( int i_ratio )
-{
-    int i_dummy = VOUT_ASPECT_FACTOR;
-    int i_pgcd  = 1;
-
-    if( !i_ratio )
-    {
-        return i_pgcd;
-    }
-
-    /* VOUT_ASPECT_FACTOR is (2^7 * 3^3 * 5^3), we just check for 2, 3 and 5 */
-    while( !(i_ratio & 1) && !(i_dummy & 1) )
-    {
-        i_ratio >>= 1;
-        i_dummy >>= 1;
-        i_pgcd  <<= 1;
-    }
-
-    while( !(i_ratio % 3) && !(i_dummy % 3) )
-    {
-        i_ratio /= 3;
-        i_dummy /= 3;
-        i_pgcd  *= 3;
-    }
-
-    while( !(i_ratio % 5) && !(i_dummy % 5) )
-    {
-        i_ratio /= 5;
-        i_dummy /= 5;
-        i_pgcd  *= 5;
-    }
-
-    return i_pgcd;
-}
-
 static void AspectRatio( int i_aspect, int *i_aspect_x, int *i_aspect_y )
 {
-    unsigned int i_pgcd = ReduceHeight( i_aspect );
+    const int i_pgcd = i_aspect ? GCD( i_aspect, VOUT_ASPECT_FACTOR ) : 1;
     *i_aspect_x = i_aspect / i_pgcd;
     *i_aspect_y = VOUT_ASPECT_FACTOR / i_pgcd;
 }