]> git.sesse.net Git - vlc/blobdiff - modules/video_chroma/i420_yuy2.c
Contribs: Update dvdnav to 5.0.1
[vlc] / modules / video_chroma / i420_yuy2.c
index 1d36b06f36a6930524d8f074a1ab2d80e4e6c519..5457f9572590d442088f498caf3f5fcd15798a25 100644 (file)
@@ -1,25 +1,25 @@
 /*****************************************************************************
  * i420_yuy2.c : YUV to YUV conversion module for vlc
  *****************************************************************************
- * Copyright (C) 2000, 2001 the VideoLAN team
+ * Copyright (C) 2000, 2001 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Damien Fouilleul <damien@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
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
 
 #if defined (MODULE_NAME_IS_i420_yuy2)
 #    define DEST_FOURCC "YUY2,YUNV,YVYU,UYVY,UYNV,Y422,IUYV,cyuv,Y211"
+#    define VLC_TARGET
 #elif defined (MODULE_NAME_IS_i420_yuy2_mmx)
 #    define DEST_FOURCC "YUY2,YUNV,YVYU,UYVY,UYNV,Y422,IUYV,cyuv"
+#    define VLC_TARGET VLC_MMX
 #elif defined (MODULE_NAME_IS_i420_yuy2_sse2)
 #    define DEST_FOURCC "YUY2,YUNV,YVYU,UYVY,UYNV,Y422,IUYV,cyuv"
+#    define VLC_TARGET VLC_SSE
 #elif defined (MODULE_NAME_IS_i420_yuy2_altivec)
 #    define DEST_FOURCC "YUY2,YUNV,YVYU,UYVY,UYNV,Y422"
+#    define VLC_TARGET
 #endif
 
 /*****************************************************************************
@@ -88,20 +92,20 @@ vlc_module_begin ()
 #if defined (MODULE_NAME_IS_i420_yuy2)
     set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) )
     set_capability( "video filter2", 80 )
-# define CPU_CAPABILITY 0
+# define vlc_CPU_capable() (true)
 #elif defined (MODULE_NAME_IS_i420_yuy2_mmx)
     set_description( N_("MMX conversions from " SRC_FOURCC " to " DEST_FOURCC) )
     set_capability( "video filter2", 160 )
-# define CPU_CAPABILITY CPU_CAPABILITY_MMX
+# define vlc_CPU_capable() vlc_CPU_MMX()
 #elif defined (MODULE_NAME_IS_i420_yuy2_sse2)
     set_description( N_("SSE2 conversions from " SRC_FOURCC " to " DEST_FOURCC) )
     set_capability( "video filter2", 250 )
-# define CPU_CAPABILITY CPU_CAPABILITY_SSE2
+# define vlc_CPU_capable() vlc_CPU_SSE2()
 #elif defined (MODULE_NAME_IS_i420_yuy2_altivec)
     set_description(
             _("AltiVec conversions from " SRC_FOURCC " to " DEST_FOURCC) );
     set_capability( "video filter2", 250 )
-# define CPU_CAPABILITY CPU_CAPABILITY_ALTIVEC
+# define vlc_CPU_capable() vlc_CPU_ALTIVEC()
 #endif
     set_callbacks( Activate, NULL )
 vlc_module_end ()
@@ -115,10 +119,8 @@ static int Activate( vlc_object_t *p_this )
 {
     filter_t *p_filter = (filter_t *)p_this;
 
-#if CPU_CAPABILITY
-    if( !(vlc_CPU() & CPU_CAPABILITY) )
+    if( !vlc_CPU_capable() )
         return VLC_EGENERIC;
-#endif
     if( p_filter->fmt_in.video.i_width & 1
      || p_filter->fmt_in.video.i_height & 1 )
     {
@@ -126,7 +128,8 @@ static int Activate( vlc_object_t *p_this )
     }
 
     if( p_filter->fmt_in.video.i_width != p_filter->fmt_out.video.i_width
-     || p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height )
+       || p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height
+       || p_filter->fmt_in.video.orientation != p_filter->fmt_out.video.orientation )
         return -1;
 
     switch( p_filter->fmt_in.video.i_chroma )
@@ -200,6 +203,7 @@ VIDEO_FILTER_WRAPPER( I420_Y211 )
 /*****************************************************************************
  * I420_YUY2: planar YUV 4:2:0 to packed YUYV 4:2:2
  *****************************************************************************/
+VLC_TARGET
 static void I420_YUY2( filter_t *p_filter, picture_t *p_source,
                                            picture_t *p_dest )
 {
@@ -417,6 +421,7 @@ static void I420_YUY2( filter_t *p_filter, picture_t *p_source,
 /*****************************************************************************
  * I420_YVYU: planar YUV 4:2:0 to packed YVYU 4:2:2
  *****************************************************************************/
+VLC_TARGET
 static void I420_YVYU( filter_t *p_filter, picture_t *p_source,
                                            picture_t *p_dest )
 {
@@ -626,6 +631,7 @@ static void I420_YVYU( filter_t *p_filter, picture_t *p_source,
 /*****************************************************************************
  * I420_UYVY: planar YUV 4:2:0 to packed UYVY 4:2:2
  *****************************************************************************/
+VLC_TARGET
 static void I420_UYVY( filter_t *p_filter, picture_t *p_source,
                                            picture_t *p_dest )
 {
@@ -847,6 +853,7 @@ static void I420_IUYV( filter_t *p_filter, picture_t *p_source,
 /*****************************************************************************
  * I420_cyuv: planar YUV 4:2:0 to upside-down packed UYVY 4:2:2
  *****************************************************************************/
+VLC_TARGET
 static void I420_cyuv( filter_t *p_filter, picture_t *p_source,
                                            picture_t *p_dest )
 {