]> git.sesse.net Git - vlc/blobdiff - modules/video_chroma/i420_rgb16.c
dtv: fix ISDB-S tuning
[vlc] / modules / video_chroma / i420_rgb16.c
index 3f0c6734f5d3a20d09399c397a27a860edc1ce45..de3cbed9f8b191461ff776da6b0cb6305e007492 100644 (file)
@@ -1,25 +1,25 @@
 /*****************************************************************************
  * i420_rgb16.c : YUV to bitmap RGB conversion module for vlc
  *****************************************************************************
- * Copyright (C) 2000 the VideoLAN team
+ * Copyright (C) 2000 VLC authors and VideoLAN
  * $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
- * 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.
  *****************************************************************************/
 
 /*****************************************************************************
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
 #include <vlc_filter.h>
-#include <vlc_vout.h>
+#include <vlc_cpu.h>
 
 #include "i420_rgb.h"
 #if defined (MODULE_NAME_IS_i420_rgb)
 #   include "i420_rgb_c.h"
+#   define VLC_TARGET
 #elif defined (MODULE_NAME_IS_i420_rgb_mmx)
-#   include "i420_rgb_mmx.h"
+#   include "../mmx/i420_rgb_mmx.h"
+#   define VLC_TARGET VLC_MMX
 #elif defined (MODULE_NAME_IS_i420_rgb_sse2)
-#   include "i420_rgb_mmx.h"
+#   include "../sse2/i420_rgb_sse2.h"
+#   define VLC_TARGET VLC_SSE
 #endif
 
 static void SetOffset( int, int, int, int, bool *,
@@ -109,15 +112,7 @@ void I420_RGB16_dither( filter_t *p_filter, picture_t *p_src,
     }
 
     i_right_margin = p_dest->p->i_pitch - p_dest->p->i_visible_pitch;
-
-    if( p_filter->fmt_in.video.i_width & 7 )
-    {
-        i_rewind = 8 - ( p_filter->fmt_in.video.i_width & 7 );
-    }
-    else
-    {
-        i_rewind = 0;
-    }
+    i_rewind = (-p_filter->fmt_in.video.i_width) & 7;
 
     /* Rule: when a picture of size (x1,y1) with aspect ratio r1 is rendered
      * on a picture of size (x2,y2) with aspect ratio r2, if x1 grows to x1'
@@ -211,8 +206,7 @@ void I420_RGB16_dither( filter_t *p_filter, picture_t *p_src,
 
 #if defined (MODULE_NAME_IS_i420_rgb)
 
-void I420_RGB16( filter_t *p_filter, picture_t *p_src,
-                                         picture_t *p_dest )
+void I420_RGB16( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
 {
     /* We got this one from the old arguments */
     uint16_t *p_pic = (uint16_t*)p_dest->p->p_pixels;
@@ -248,15 +242,7 @@ void I420_RGB16( filter_t *p_filter, picture_t *p_src,
                                  - p_src->p[1].i_visible_pitch;
 
     i_right_margin = p_dest->p->i_pitch - p_dest->p->i_visible_pitch;
-
-    if( p_filter->fmt_in.video.i_width & 7 )
-    {
-        i_rewind = 8 - ( p_filter->fmt_in.video.i_width & 7 );
-    }
-    else
-    {
-        i_rewind = 0;
-    }
+    i_rewind = (-p_filter->fmt_in.video.i_width) & 7;
 
     /* Rule: when a picture of size (x1,y1) with aspect ratio r1 is rendered
      * on a picture of size (x2,y2) with aspect ratio r2, if x1 grows to x1'
@@ -314,8 +300,8 @@ void I420_RGB16( filter_t *p_filter, picture_t *p_src,
 
 #else // ! defined (MODULE_NAME_IS_i420_rgb)
 
-void I420_R5G5B5( filter_t *p_filter, picture_t *p_src,
-                                          picture_t *p_dest )
+VLC_TARGET
+void I420_R5G5B5( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
 {
     /* We got this one from the old arguments */
     uint16_t *p_pic = (uint16_t*)p_dest->p->p_pixels;
@@ -367,14 +353,7 @@ void I420_R5G5B5( filter_t *p_filter, picture_t *p_src,
 
 #if defined (MODULE_NAME_IS_i420_rgb_sse2)
 
-    if( p_filter->fmt_in.video.i_width & 15 )
-    {
-        i_rewind = 16 - ( p_filter->fmt_in.video.i_width & 15 );
-    }
-    else
-    {
-        i_rewind = 0;
-    }
+    i_rewind = (-p_filter->fmt_in.video.i_width) & 15;
 
     /*
     ** SSE2 128 bits fetch/store instructions are faster
@@ -494,14 +473,7 @@ void I420_R5G5B5( filter_t *p_filter, picture_t *p_src,
 
 #else // defined (MODULE_NAME_IS_i420_rgb_mmx)
 
-    if( p_filter->fmt_in.video.i_width & 7 )
-    {
-        i_rewind = 8 - ( p_filter->fmt_in.video.i_width & 7 );
-    }
-    else
-    {
-        i_rewind = 0;
-    }
+    i_rewind = (-p_filter->fmt_in.video.i_width) & 7;
 
     for( i_y = 0; i_y < p_filter->fmt_in.video.i_height; i_y++ )
     {
@@ -558,8 +530,8 @@ void I420_R5G5B5( filter_t *p_filter, picture_t *p_src,
 #endif
 }
 
-void I420_R5G6B5( filter_t *p_filter, picture_t *p_src,
-                                          picture_t *p_dest )
+VLC_TARGET
+void I420_R5G6B5( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
 {
     /* We got this one from the old arguments */
     uint16_t *p_pic = (uint16_t*)p_dest->p->p_pixels;
@@ -611,14 +583,7 @@ void I420_R5G6B5( filter_t *p_filter, picture_t *p_src,
 
 #if defined (MODULE_NAME_IS_i420_rgb_sse2)
 
-    if( p_filter->fmt_in.video.i_width & 15 )
-    {
-        i_rewind = 16 - ( p_filter->fmt_in.video.i_width & 15 );
-    }
-    else
-    {
-        i_rewind = 0;
-    }
+    i_rewind = (-p_filter->fmt_in.video.i_width) & 15;
 
     /*
     ** SSE2 128 bits fetch/store instructions are faster
@@ -738,14 +703,7 @@ void I420_R5G6B5( filter_t *p_filter, picture_t *p_src,
 
 #else // defined (MODULE_NAME_IS_i420_rgb_mmx)
 
-    if( p_filter->fmt_in.video.i_width & 7 )
-    {
-        i_rewind = 8 - ( p_filter->fmt_in.video.i_width & 7 );
-    }
-    else
-    {
-        i_rewind = 0;
-    }
+    i_rewind = (-p_filter->fmt_in.video.i_width) & 7;
 
     for( i_y = 0; i_y < p_filter->fmt_in.video.i_height; i_y++ )
     {
@@ -817,8 +775,7 @@ void I420_R5G6B5( filter_t *p_filter, picture_t *p_src,
 
 #if defined (MODULE_NAME_IS_i420_rgb)
 
-void I420_RGB32( filter_t *p_filter, picture_t *p_src,
-                                         picture_t *p_dest )
+void I420_RGB32( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
 {
     /* We got this one from the old arguments */
     uint32_t *p_pic = (uint32_t*)p_dest->p->p_pixels;
@@ -854,15 +811,7 @@ void I420_RGB32( filter_t *p_filter, picture_t *p_src,
                                  - p_src->p[1].i_visible_pitch;
 
     i_right_margin = p_dest->p->i_pitch - p_dest->p->i_visible_pitch;
-
-    if( p_filter->fmt_in.video.i_width & 7 )
-    {
-        i_rewind = 8 - ( p_filter->fmt_in.video.i_width & 7 );
-    }
-    else
-    {
-        i_rewind = 0;
-    }
+    i_rewind = (-p_filter->fmt_in.video.i_width) & 7;
 
     /* Rule: when a picture of size (x1,y1) with aspect ratio r1 is rendered
      * on a picture of size (x2,y2) with aspect ratio r2, if x1 grows to x1'
@@ -919,6 +868,7 @@ void I420_RGB32( filter_t *p_filter, picture_t *p_src,
 
 #else // defined (MODULE_NAME_IS_i420_rgb_mmx) || defined (MODULE_NAME_IS_i420_rgb_sse2)
 
+VLC_TARGET
 void I420_A8R8G8B8( filter_t *p_filter, picture_t *p_src,
                                             picture_t *p_dest )
 {
@@ -970,14 +920,7 @@ void I420_A8R8G8B8( filter_t *p_filter, picture_t *p_src,
 
 #if defined (MODULE_NAME_IS_i420_rgb_sse2)
 
-    if( p_filter->fmt_in.video.i_width & 15 )
-    {
-        i_rewind = 16 - ( p_filter->fmt_in.video.i_width & 15 );
-    }
-    else
-    {
-        i_rewind = 0;
-    }
+    i_rewind = (-p_filter->fmt_in.video.i_width) & 15;
 
     /*
     ** SSE2 128 bits fetch/store instructions are faster
@@ -1097,14 +1040,7 @@ void I420_A8R8G8B8( filter_t *p_filter, picture_t *p_src,
 
 #else // defined (MODULE_NAME_IS_i420_rgb_mmx)
 
-    if( p_filter->fmt_in.video.i_width & 7 )
-    {
-        i_rewind = 8 - ( p_filter->fmt_in.video.i_width & 7 );
-    }
-    else
-    {
-        i_rewind = 0;
-    }
+    i_rewind = (-p_filter->fmt_in.video.i_width) & 7;
 
     for( i_y = 0; i_y < p_filter->fmt_in.video.i_height; i_y++ )
     {
@@ -1161,8 +1097,8 @@ void I420_A8R8G8B8( filter_t *p_filter, picture_t *p_src,
 #endif
 }
 
-void I420_R8G8B8A8( filter_t *p_filter, picture_t *p_src,
-                                            picture_t *p_dest )
+VLC_TARGET
+void I420_R8G8B8A8( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
 {
     /* We got this one from the old arguments */
     uint32_t *p_pic = (uint32_t*)p_dest->p->p_pixels;
@@ -1212,14 +1148,7 @@ void I420_R8G8B8A8( filter_t *p_filter, picture_t *p_src,
 
 #if defined (MODULE_NAME_IS_i420_rgb_sse2)
 
-    if( p_filter->fmt_in.video.i_width & 15 )
-    {
-        i_rewind = 16 - ( p_filter->fmt_in.video.i_width & 15 );
-    }
-    else
-    {
-        i_rewind = 0;
-    }
+    i_rewind = (-p_filter->fmt_in.video.i_width) & 15;
 
     /*
     ** SSE2 128 bits fetch/store instructions are faster
@@ -1339,14 +1268,7 @@ void I420_R8G8B8A8( filter_t *p_filter, picture_t *p_src,
 
 #else // defined (MODULE_NAME_IS_i420_rgb_mmx)
 
-    if( p_filter->fmt_in.video.i_width & 7 )
-    {
-        i_rewind = 8 - ( p_filter->fmt_in.video.i_width & 7 );
-    }
-    else
-    {
-        i_rewind = 0;
-    }
+    i_rewind = (-p_filter->fmt_in.video.i_width) & 7;
 
     for( i_y = 0; i_y < p_filter->fmt_in.video.i_height; i_y++ )
     {
@@ -1403,8 +1325,8 @@ void I420_R8G8B8A8( filter_t *p_filter, picture_t *p_src,
 #endif
 }
 
-void I420_B8G8R8A8( filter_t *p_filter, picture_t *p_src,
-                                            picture_t *p_dest )
+VLC_TARGET
+void I420_B8G8R8A8( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
 {
     /* We got this one from the old arguments */
     uint32_t *p_pic = (uint32_t*)p_dest->p->p_pixels;
@@ -1454,14 +1376,7 @@ void I420_B8G8R8A8( filter_t *p_filter, picture_t *p_src,
 
 #if defined (MODULE_NAME_IS_i420_rgb_sse2)
 
-    if( p_filter->fmt_in.video.i_width & 15 )
-    {
-        i_rewind = 16 - ( p_filter->fmt_in.video.i_width & 15 );
-    }
-    else
-    {
-        i_rewind = 0;
-    }
+    i_rewind = (-p_filter->fmt_in.video.i_width) & 15;
 
     /*
     ** SSE2 128 bits fetch/store instructions are faster
@@ -1578,14 +1493,7 @@ void I420_B8G8R8A8( filter_t *p_filter, picture_t *p_src,
 
 #else
 
-    if( p_filter->fmt_in.video.i_width & 7 )
-    {
-        i_rewind = 8 - ( p_filter->fmt_in.video.i_width & 7 );
-    }
-    else
-    {
-        i_rewind = 0;
-    }
+    i_rewind = (-p_filter->fmt_in.video.i_width) & 7;
 
     for( i_y = 0; i_y < p_filter->fmt_in.video.i_height; i_y++ )
     {
@@ -1642,8 +1550,8 @@ void I420_B8G8R8A8( filter_t *p_filter, picture_t *p_src,
 #endif
 }
 
-void I420_A8B8G8R8( filter_t *p_filter, picture_t *p_src,
-                                            picture_t *p_dest )
+VLC_TARGET
+void I420_A8B8G8R8( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
 {
     /* We got this one from the old arguments */
     uint32_t *p_pic = (uint32_t*)p_dest->p->p_pixels;
@@ -1693,14 +1601,7 @@ void I420_A8B8G8R8( filter_t *p_filter, picture_t *p_src,
 
 #if defined (MODULE_NAME_IS_i420_rgb_sse2)
 
-    if( p_filter->fmt_in.video.i_width & 15 )
-    {
-        i_rewind = 16 - ( p_filter->fmt_in.video.i_width & 15 );
-    }
-    else
-    {
-        i_rewind = 0;
-    }
+    i_rewind = (-p_filter->fmt_in.video.i_width) & 15;
 
     /*
     ** SSE2 128 bits fetch/store instructions are faster
@@ -1817,14 +1718,7 @@ void I420_A8B8G8R8( filter_t *p_filter, picture_t *p_src,
 
 #else
 
-    if( p_filter->fmt_in.video.i_width & 7 )
-    {
-        i_rewind = 8 - ( p_filter->fmt_in.video.i_width & 7 );
-    }
-    else
-    {
-        i_rewind = 0;
-    }
+    i_rewind = (-p_filter->fmt_in.video.i_width) & 7;
 
     for( i_y = 0; i_y < p_filter->fmt_in.video.i_height; i_y++ )
     {