video_chroma: added I420_ABGR32 support (mostly for opengl), some clean up as well
[vlc.git] / modules / video_chroma / i422_yuy2.c
index 5afb683..4bc4528 100644 (file)
@@ -5,6 +5,7 @@
  * $Id$
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
+ *          Damien Fouilleul <damienf@videolan.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -152,7 +153,7 @@ static void I422_YUY2( vout_thread_t *p_vout, picture_t *p_source,
 
     for( i_y = p_vout->render.i_height ; i_y-- ; )
     {
-       uint8_t *p_line = p_pixels;
+        uint8_t *p_line = p_pixels;
         for( i_x = p_vout->render.i_width / 8 ; i_x-- ; )
         {
 #if defined (MODULE_NAME_IS_i422_yuy2)
@@ -160,15 +161,17 @@ static void I422_YUY2( vout_thread_t *p_vout, picture_t *p_source,
             C_YUV422_YUYV( p_line, p_y, p_u, p_v );
             C_YUV422_YUYV( p_line, p_y, p_u, p_v );
             C_YUV422_YUYV( p_line, p_y, p_u, p_v );
-#else
-            __asm__( ".p2align 3" MMX_YUV422_YUYV
-                     : : "r" (p_line), "r" (p_y), "r" (p_u), "r" (p_v) ); 
-
-            p_line += 16; p_y += 8; p_u += 4; p_v += 4;
+#elif defined (MODULE_NAME_IS_i422_yuy2_mmx)
+            MMX_CALL( MMX_YUV422_YUYV );
 #endif
         }
-       p_pixels += i_pitch;
+        p_pixels += i_pitch;
     }
+#if defined (MODULE_NAME_IS_i422_yuy2_mmx)
+    MMX_END;
+#elif defined (MODULE_NAME_IS_i422_yuy2_sse2)
+    SSE2_END;
+#endif
 }
 
 /*****************************************************************************
@@ -187,7 +190,7 @@ static void I422_YVYU( vout_thread_t *p_vout, picture_t *p_source,
 
     for( i_y = p_vout->render.i_height ; i_y-- ; )
     {
-       uint8_t *p_line = p_pixels;
+        uint8_t *p_line = p_pixels;
         for( i_x = p_vout->render.i_width / 8 ; i_x-- ; )
         {
 #if defined (MODULE_NAME_IS_i422_yuy2)
@@ -195,15 +198,17 @@ static void I422_YVYU( vout_thread_t *p_vout, picture_t *p_source,
             C_YUV422_YVYU( p_line, p_y, p_u, p_v );
             C_YUV422_YVYU( p_line, p_y, p_u, p_v );
             C_YUV422_YVYU( p_line, p_y, p_u, p_v );
-#else
-            __asm__( ".p2align 3" MMX_YUV422_YVYU
-                     : : "r" (p_line), "r" (p_y), "r" (p_u), "r" (p_v) ); 
-
-            p_line += 16; p_y += 8; p_u += 4; p_v += 4;
+#elif defined (MODULE_NAME_IS_i422_yuy2_mmx)
+            MMX_CALL( MMX_YUV422_YVYU );
 #endif
         }
-       p_pixels += i_pitch;
+        p_pixels += i_pitch;
     }
+#if defined (MODULE_NAME_IS_i422_yuy2_mmx)
+    MMX_END;
+#elif defined (MODULE_NAME_IS_i422_yuy2_sse2)
+    SSE2_END;
+#endif
 }
 
 /*****************************************************************************
@@ -222,7 +227,7 @@ static void I422_UYVY( vout_thread_t *p_vout, picture_t *p_source,
 
     for( i_y = p_vout->render.i_height ; i_y-- ; )
     {
-       uint8_t *p_line = p_pixels;
+        uint8_t *p_line = p_pixels;
         for( i_x = p_vout->render.i_width / 8 ; i_x-- ; )
         {
 #if defined (MODULE_NAME_IS_i422_yuy2)
@@ -230,15 +235,17 @@ static void I422_UYVY( vout_thread_t *p_vout, picture_t *p_source,
             C_YUV422_UYVY( p_line, p_y, p_u, p_v );
             C_YUV422_UYVY( p_line, p_y, p_u, p_v );
             C_YUV422_UYVY( p_line, p_y, p_u, p_v );
-#else
-            __asm__( ".p2align 3" MMX_YUV422_UYVY
-                     : : "r" (p_line), "r" (p_y), "r" (p_u), "r" (p_v) ); 
-
-            p_line += 16; p_y += 8; p_u += 4; p_v += 4;
+#elif defined (MODULE_NAME_IS_i422_yuy2_mmx)
+            MMX_CALL( MMX_YUV422_UYVY );
 #endif
         }
-       p_pixels += i_pitch;
+        p_pixels += i_pitch;
     }
+#if defined (MODULE_NAME_IS_i422_yuy2_mmx)
+    MMX_END;
+#elif defined (MODULE_NAME_IS_i422_yuy2_sse2)
+    SSE2_END;
+#endif
 }
 
 /*****************************************************************************
@@ -275,14 +282,16 @@ static void I422_cyuv( vout_thread_t *p_vout, picture_t *p_source,
             C_YUV422_UYVY( p_line, p_y, p_u, p_v );
             C_YUV422_UYVY( p_line, p_y, p_u, p_v );
             C_YUV422_UYVY( p_line, p_y, p_u, p_v );
-#else
-            __asm__( ".p2align 3" MMX_YUV422_UYVY
-                     : : "r" (p_line), "r" (p_y), "r" (p_u), "r" (p_v) ); 
-
-            p_line += 16; p_y += 8; p_u += 4; p_v += 4;
+#elif defined (MODULE_NAME_IS_i422_yuy2_mmx)
+            MMX_CALL( MMX_YUV422_UYVY );
 #endif
         }
     }
+#if defined (MODULE_NAME_IS_i422_yuy2_mmx)
+    MMX_END;
+#elif defined (MODULE_NAME_IS_i422_yuy2_sse2)
+    SSE2_END;
+#endif
 }
 
 /*****************************************************************************