]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/gradient.c
String removal
[vlc] / modules / video_filter / gradient.c
index fd3baa0551a1d22e23f12d2d13212e983fc1ff86..0c3d5158372eaa04d85b6c4204eb8aac65fb2ba9 100644 (file)
@@ -1,25 +1,25 @@
 /*****************************************************************************
  * gradient.c : Gradient and edge detection video effects plugin for vlc
  *****************************************************************************
- * Copyright (C) 2000-2008 the VideoLAN team
+ * Copyright (C) 2000-2008 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Antoine Cellerier <dionoea -at- videolan -dot- 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.
  *****************************************************************************/
 
 /*****************************************************************************
@@ -36,7 +36,7 @@
 #include <vlc_plugin.h>
 #include <vlc_sout.h>
 
-#include "vlc_filter.h"
+#include <vlc_filter.h>
 #include "filter_picture.h"
 
 enum { GRADIENT, EDGE, HOUGH };
@@ -70,6 +70,8 @@ static void FilterHough   ( filter_t *, picture_t *, picture_t * );
 #define CARTOON_LONGTEXT N_("Apply cartoon effect. It is only used by " \
     "\"gradient\" and \"edge\".")
 
+#define GRADIENT_HELP N_("Apply color gradient or edge detection effects")
+
 static const char *const mode_list[] = { "gradient", "edge", "hough" };
 static const char *const mode_list_text[] = { N_("Gradient"), N_("Edge"), N_("Hough") };
 
@@ -78,17 +80,18 @@ static const char *const mode_list_text[] = { N_("Gradient"), N_("Edge"), N_("Ho
 vlc_module_begin ()
     set_description( N_("Gradient video filter") )
     set_shortname( N_( "Gradient" ))
+    set_help(GRADIENT_HELP)
     set_capability( "video filter2", 0 )
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
 
-    add_string( FILTER_PREFIX "mode", "gradient", NULL,
+    add_string( FILTER_PREFIX "mode", "gradient",
                 MODE_TEXT, MODE_LONGTEXT, false )
-        change_string_list( mode_list, mode_list_text, 0 )
+        change_string_list( mode_list, mode_list_text )
 
-    add_integer_with_range( FILTER_PREFIX "type", 0, 0, 1, NULL,
+    add_integer_with_range( FILTER_PREFIX "type", 0, 0, 1,
                 GRADIENT_TEXT, GRADIENT_LONGTEXT, false )
-    add_bool( FILTER_PREFIX "cartoon", 1, NULL,
+    add_bool( FILTER_PREFIX "cartoon", true,
                 CARTOON_TEXT, CARTOON_LONGTEXT, false )
 
     add_shortcut( "gradient" )
@@ -138,7 +141,7 @@ static int Create( vlc_object_t *p_this )
             break;
 
         default:
-             msg_Err( p_filter, "Unsupported input chroma (%4s)",
+             msg_Err( p_filter, "Unsupported input chroma (%4.4s)",
                       (char*)&(p_filter->fmt_in.video.i_chroma) );
             return VLC_EGENERIC;
     }
@@ -357,18 +360,14 @@ static void FilterGradient( filter_t *p_filter, picture_t *p_inpic,
 
     if( p_filter->p_sys->b_cartoon )
     {
-        vlc_memcpy( p_outpic->p[U_PLANE].p_pixels,
-            p_inpic->p[U_PLANE].p_pixels,
-            p_outpic->p[U_PLANE].i_lines * p_outpic->p[U_PLANE].i_pitch );
-        vlc_memcpy( p_outpic->p[V_PLANE].p_pixels,
-            p_inpic->p[V_PLANE].p_pixels,
-            p_outpic->p[V_PLANE].i_lines * p_outpic->p[V_PLANE].i_pitch );
+        plane_CopyPixels( &p_outpic->p[U_PLANE], &p_inpic->p[U_PLANE] );
+        plane_CopyPixels( &p_outpic->p[V_PLANE], &p_inpic->p[V_PLANE] );
     }
     else
     {
-        vlc_memset( p_outpic->p[U_PLANE].p_pixels, 0x80,
+        memset( p_outpic->p[U_PLANE].p_pixels, 0x80,
             p_outpic->p[U_PLANE].i_lines * p_outpic->p[U_PLANE].i_pitch );
-        vlc_memset( p_outpic->p[V_PLANE].p_pixels, 0x80,
+        memset( p_outpic->p[V_PLANE].p_pixels, 0x80,
             p_outpic->p[V_PLANE].i_lines * p_outpic->p[V_PLANE].i_pitch );
     }
 
@@ -501,20 +500,16 @@ static void FilterEdge( filter_t *p_filter, picture_t *p_inpic,
 
     if( p_filter->p_sys->b_cartoon )
     {
-        vlc_memcpy( p_outpic->p[U_PLANE].p_pixels,
-            p_inpic->p[U_PLANE].p_pixels,
-            p_outpic->p[U_PLANE].i_lines * p_outpic->p[U_PLANE].i_pitch );
-        vlc_memcpy( p_outpic->p[V_PLANE].p_pixels,
-            p_inpic->p[V_PLANE].p_pixels,
-            p_outpic->p[V_PLANE].i_lines * p_outpic->p[V_PLANE].i_pitch );
+        plane_CopyPixels( &p_outpic->p[U_PLANE], &p_inpic->p[U_PLANE] );
+        plane_CopyPixels( &p_outpic->p[V_PLANE], &p_inpic->p[V_PLANE] );
     }
     else
     {
-        vlc_memset( p_outpic->p[Y_PLANE].p_pixels, 0xff,
+        memset( p_outpic->p[Y_PLANE].p_pixels, 0xff,
               p_outpic->p[Y_PLANE].i_lines * p_outpic->p[Y_PLANE].i_pitch );
-        vlc_memset( p_outpic->p[U_PLANE].p_pixels, 0x80,
+        memset( p_outpic->p[U_PLANE].p_pixels, 0x80,
             p_outpic->p[U_PLANE].i_lines * p_outpic->p[U_PLANE].i_pitch );
-        vlc_memset( p_outpic->p[V_PLANE].p_pixels, 0x80,
+        memset( p_outpic->p[V_PLANE].p_pixels, 0x80,
             p_outpic->p[V_PLANE].i_lines * p_outpic->p[V_PLANE].i_pitch );
     }
 
@@ -682,17 +677,11 @@ static void FilterHough( filter_t *p_filter, picture_t *p_inpic,
         msg_Dbg(p_filter, "Precalculation done");
     }
 
-    vlc_memset( p_hough, 0, i_diag * i_nb_steps * sizeof(int) );
-
-    vlc_memcpy(
-        p_outpic->p[Y_PLANE].p_pixels, p_inpic->p[Y_PLANE].p_pixels,
-        p_outpic->p[Y_PLANE].i_lines * p_outpic->p[Y_PLANE].i_pitch );
-    vlc_memcpy(
-        p_outpic->p[U_PLANE].p_pixels, p_inpic->p[U_PLANE].p_pixels,
-        p_outpic->p[U_PLANE].i_lines * p_outpic->p[U_PLANE].i_pitch );
-    vlc_memcpy(
-        p_outpic->p[V_PLANE].p_pixels, p_inpic->p[V_PLANE].p_pixels,
-        p_outpic->p[V_PLANE].i_lines * p_outpic->p[V_PLANE].i_pitch );
+    memset( p_hough, 0, i_diag * i_nb_steps * sizeof(int) );
+
+    plane_CopyPixels( &p_outpic->p[Y_PLANE], &p_inpic->p[Y_PLANE] );
+    plane_CopyPixels( &p_outpic->p[U_PLANE], &p_inpic->p[U_PLANE] );
+    plane_CopyPixels( &p_outpic->p[V_PLANE], &p_inpic->p[V_PLANE] );
 
     GaussianConvolution( p_inpic, p_smooth );