]> git.sesse.net Git - vlc/blobdiff - modules/video_chroma/i420_yuy2.c
new (failing) test for media list player (ticket #1524)
[vlc] / modules / video_chroma / i420_yuy2.c
index 6901c7337ac9528bee1fd150c746b258fd95f892..00054548c2d45cc51d444fc50cd52898e40ab0d3 100644 (file)
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <string.h>                                            /* strerror() */
-#include <stdlib.h>                                      /* malloc(), free() */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
 
 #include <vlc/vlc.h>
 #include <vlc_vout.h>
@@ -306,7 +308,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)
@@ -315,12 +318,12 @@ static void I420_YUY2( vout_thread_t *p_vout, picture_t *p_source,
 
 #else // defined(MODULE_NAME_IS_i420_yuy2_sse2)
     /*
-    ** SSE2 128 bits 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-- ; )
@@ -376,6 +379,8 @@ 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)
 }
@@ -514,7 +519,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)
@@ -523,11 +529,11 @@ static void I420_YVYU( vout_thread_t *p_vout, picture_t *p_source,
 
 #else // defined(MODULE_NAME_IS_i420_yuy2_sse2)
     /*
-    ** SSE2 128 bits 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-- ; )
@@ -583,6 +589,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)
 }
 
@@ -720,7 +728,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)
@@ -729,11 +738,11 @@ static void I420_UYVY( vout_thread_t *p_vout, picture_t *p_source,
 
 #else // defined(MODULE_NAME_IS_i420_yuy2_sse2)
     /*
-    ** SSE2 128 bits 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-- ; )
@@ -789,6 +798,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)
 }
 
@@ -799,6 +810,7 @@ static void I420_UYVY( vout_thread_t *p_vout, picture_t *p_source,
 static void I420_IUYV( vout_thread_t *p_vout, picture_t *p_source,
                                               picture_t *p_dest )
 {
+    VLC_UNUSED(p_source); VLC_UNUSED(p_dest);
     /* FIXME: TODO ! */
     msg_Err( p_vout, "I420_IUYV unimplemented, please harass <sam@zoy.org>" );
 }
@@ -861,16 +873,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 bits 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-- ; )
@@ -926,6 +939,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)