]> git.sesse.net Git - vlc/blobdiff - modules/video_chroma/i420_yuy2.c
Removes trailing spaces. Removes tabs.
[vlc] / modules / video_chroma / i420_yuy2.c
index 7fee0660d4946e6b063076c395fa44867f5110a1..3e5ee5571a161cf84cd8c26851148cd2fcf1cf00 100644 (file)
@@ -25,8 +25,6 @@
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <string.h>                                            /* strerror() */
-#include <stdlib.h>                                      /* malloc(), free() */
 
 #include <vlc/vlc.h>
 #include <vlc_vout.h>
@@ -158,8 +156,17 @@ static int Activate( vlc_object_t *p_this )
     return 0;
 }
 
-/* Following functions are local */
+#if 0
+static inline unsigned long long read_cycles(void)
+{
+    unsigned long long v;
+    __asm__ __volatile__("rdtsc" : "=A" (v): );
+
+    return v;
+}
+#endif
 
+/* Following functions are local */
 /*****************************************************************************
  * I420_YUY2: planar YUV 4:2:0 to packed YUYV 4:2:2
  *****************************************************************************/
@@ -297,7 +304,8 @@ static void I420_YUY2( vout_thread_t *p_vout, picture_t *p_source,
     }
 
 #if defined (MODULE_NAME_IS_i420_yuy2_mmx)
-    __asm__ __volatile__("emms" :: );
+    /* re-enable FPU registers */
+    MMX_END;
 #endif
 
 #if defined (MODULE_NAME_IS_i420_yuy2_altivec)
@@ -306,11 +314,12 @@ static void I420_YUY2( vout_thread_t *p_vout, picture_t *p_source,
 
 #else // defined(MODULE_NAME_IS_i420_yuy2_sse2)
     /*
-    ** SSE2 128 bytes fetch/store instructions are faster 
+    ** SSE2 128 bits fetch/store instructions are faster
     ** if memory access is 16 bytes aligned
     */
+
     if( 0 == (15 & (p_source->p[Y_PLANE].i_pitch|p_dest->p->i_pitch|
-        ((int)p_line2|(int)p_y2))) )
+        ((intptr_t)p_line2|(intptr_t)p_y2))) )
     {
         /* use faster SSE2 aligned fetch and store */
         for( i_y = p_vout->render.i_height / 2 ; i_y-- ; )
@@ -366,6 +375,9 @@ static void I420_YUY2( vout_thread_t *p_vout, picture_t *p_source,
             p_line2 += i_dest_margin;
         }
     }
+    /* make sure all SSE2 stores are visible thereafter */
+    SSE2_END;
+
 #endif // defined(MODULE_NAME_IS_i420_yuy2_sse2)
 }
 
@@ -489,6 +501,10 @@ static void I420_YVYU( vout_thread_t *p_vout, picture_t *p_source,
             MMX_CALL( MMX_YUV420_YVYU );
 #endif
         }
+        for( i_x = ( p_vout->render.i_width % 8 ) / 2; i_x-- ; )
+        {
+            C_YUV420_YVYU( );
+        }
 
         p_y1 += i_source_margin;
         p_y2 += i_source_margin;
@@ -499,7 +515,8 @@ static void I420_YVYU( vout_thread_t *p_vout, picture_t *p_source,
     }
 
 #if defined (MODULE_NAME_IS_i420_yuy2_mmx)
-    __asm__ __volatile__("emms" :: );
+    /* re-enable FPU registers */
+    MMX_END;
 #endif
 
 #if defined (MODULE_NAME_IS_i420_yuy2_altivec)
@@ -508,11 +525,11 @@ static void I420_YVYU( vout_thread_t *p_vout, picture_t *p_source,
 
 #else // defined(MODULE_NAME_IS_i420_yuy2_sse2)
     /*
-    ** SSE2 128 bytes fetch/store instructions are faster 
+    ** SSE2 128 bits fetch/store instructions are faster
     ** if memory access is 16 bytes aligned
     */
     if( 0 == (15 & (p_source->p[Y_PLANE].i_pitch|p_dest->p->i_pitch|
-        ((int)p_line2|(int)p_y2))) )
+        ((intptr_t)p_line2|(intptr_t)p_y2))) )
     {
         /* use faster SSE2 aligned fetch and store */
         for( i_y = p_vout->render.i_height / 2 ; i_y-- ; )
@@ -568,6 +585,8 @@ static void I420_YVYU( vout_thread_t *p_vout, picture_t *p_source,
             p_line2 += i_dest_margin;
         }
     }
+    /* make sure all SSE2 stores are visible thereafter */
+    SSE2_END;
 #endif // defined(MODULE_NAME_IS_i420_yuy2_sse2)
 }
 
@@ -705,7 +724,8 @@ static void I420_UYVY( vout_thread_t *p_vout, picture_t *p_source,
     }
 
 #if defined (MODULE_NAME_IS_i420_yuy2_mmx)
-    __asm__ __volatile__("emms" :: );
+    /* re-enable FPU registers */
+    MMX_END;
 #endif
 
 #if defined (MODULE_NAME_IS_i420_yuy2_altivec)
@@ -714,11 +734,11 @@ static void I420_UYVY( vout_thread_t *p_vout, picture_t *p_source,
 
 #else // defined(MODULE_NAME_IS_i420_yuy2_sse2)
     /*
-    ** SSE2 128 bytes fetch/store instructions are faster 
+    ** SSE2 128 bits fetch/store instructions are faster
     ** if memory access is 16 bytes aligned
     */
     if( 0 == (15 & (p_source->p[Y_PLANE].i_pitch|p_dest->p->i_pitch|
-        ((int)p_line2|(int)p_y2))) )
+        ((intptr_t)p_line2|(intptr_t)p_y2))) )
     {
         /* use faster SSE2 aligned fetch and store */
         for( i_y = p_vout->render.i_height / 2 ; i_y-- ; )
@@ -774,6 +794,8 @@ static void I420_UYVY( vout_thread_t *p_vout, picture_t *p_source,
             p_line2 += i_dest_margin;
         }
     }
+    /* make sure all SSE2 stores are visible thereafter */
+    SSE2_END;
 #endif // defined(MODULE_NAME_IS_i420_yuy2_sse2)
 }
 
@@ -832,6 +854,10 @@ static void I420_cyuv( vout_thread_t *p_vout, picture_t *p_source,
             MMX_CALL( MMX_YUV420_UYVY );
 #endif
         }
+        for( i_x = ( p_vout->render.i_width % 8 ) / 2; i_x-- ; )
+        {
+            C_YUV420_UYVY( );
+        }
 
         p_y1 += i_source_margin;
         p_y2 += i_source_margin;
@@ -842,16 +868,17 @@ static void I420_cyuv( vout_thread_t *p_vout, picture_t *p_source,
     }
 
 #if defined (MODULE_NAME_IS_i420_yuy2_mmx)
-    __asm__ __volatile__("emms" :: );
+    /* re-enable FPU registers */
+    MMX_END;
 #endif
 
 #else // defined(MODULE_NAME_IS_i420_yuy2_sse2)
     /*
-    ** SSE2 128 bytes fetch/store instructions are faster 
+    ** SSE2 128 bits fetch/store instructions are faster
     ** if memory access is 16 bytes aligned
     */
     if( 0 == (15 & (p_source->p[Y_PLANE].i_pitch|p_dest->p->i_pitch|
-        ((int)p_line2|(int)p_y2))) )
+        ((intptr_t)p_line2|(intptr_t)p_y2))) )
     {
         /* use faster SSE2 aligned fetch and store */
         for( i_y = p_vout->render.i_height / 2 ; i_y-- ; )
@@ -907,6 +934,8 @@ static void I420_cyuv( vout_thread_t *p_vout, picture_t *p_source,
             p_line2 += i_dest_margin;
         }
     }
+    /* make sure all SSE2 stores are visible thereafter */
+    SSE2_END;
 #endif // defined(MODULE_NAME_IS_i420_yuy2_sse2)
 }
 #endif // !defined (MODULE_NAME_IS_i420_yuy2_altivec)