]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/opencv_wrapper.c
Add includes guards to cdrom.h
[vlc] / modules / video_filter / opencv_wrapper.c
index dc992da60c16a72984353e210f8911ed77b997ba..0ca54a3b1f7e68d5e1c203f360797ae7194f060b 100644 (file)
@@ -1,25 +1,25 @@
 /*****************************************************************************
  * opencv_wrapper.c : OpenCV wrapper video filter
  *****************************************************************************
- * Copyright (C) 2006-2012 the VideoLAN team
+ * Copyright (C) 2006-2012 VLC authors and VideoLAN
  * Copyright (C) 2012 Edward Wang
  *
  * Authors: Dugal Harris <dugalh@protoclea.co.za>
  *          Edward Wang <edward.c.wang@compdigitec.com>
  *
- * 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 <vlc_vout.h>
 #include <vlc_modules.h>
 
-#include <math.h>
-#include <time.h>
-
 #include <vlc_filter.h>
 #include <vlc_image.h>
-#include <vlc_input.h>
 #include "filter_picture.h"
 
 #include <cxcore.h>
@@ -88,11 +84,11 @@ vlc_module_begin ()
     add_string( "opencv-chroma", "input",
                           N_("OpenCV filter chroma"),
                           N_("Chroma to convert picture to before sending it to the internal OpenCV filter"), false);
-        change_string_list( chroma_list, chroma_list_text, 0);
+        change_string_list( chroma_list, chroma_list_text )
     add_string( "opencv-output", "input",
                           N_("Wrapper filter output"),
                           N_("Determines what (if any) video is displayed by the wrapper filter"), false);
-        change_string_list( output_list, output_list_text, 0);
+        change_string_list( output_list, output_list_text )
     add_string( "opencv-filter-name", "none",
                           N_("OpenCV internal filter name"),
                           N_("Name of internal OpenCV plugin filter to use"), false);
@@ -155,7 +151,7 @@ struct filter_sys_t
 static int Create( vlc_object_t *p_this )
 {
     filter_t* p_filter = (filter_t*)p_this;
-    char *psz_chroma, *psz_output, *psz_verbosity;
+    char *psz_chroma, *psz_output;
 
     /* Allocate structure */
     p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
@@ -287,14 +283,12 @@ static void ReleaseImages( filter_t* p_filter )
 {
     filter_sys_t* p_sys = p_filter->p_sys;
 
-    if (p_sys->p_cv_image)
+    for( int i = 0; i < VOUT_MAX_PLANES; i++ )
     {
-        for( int i = 0; i < VOUT_MAX_PLANES; i++ )
+        if (p_sys->p_cv_image[i] != NULL)
         {
-            if (p_sys->p_cv_image[i]) {
-                cvReleaseImageHeader(&(p_sys->p_cv_image[i]));
-                p_sys->p_cv_image[i] = NULL;
-            }
+            cvReleaseImageHeader(&(p_sys->p_cv_image[i]));
+            p_sys->p_cv_image[i] = NULL;
         }
     }
     p_sys->i_cv_image_size = 0;
@@ -323,7 +317,6 @@ static void VlcPictureToIplImage( filter_t* p_filter, picture_t* p_in )
     // input video size
     CvSize sz = cvSize(abs(p_in->format.i_width), abs(p_in->format.i_height));
     video_format_t fmt_out;
-    double  duration;
     filter_sys_t* p_sys = p_filter->p_sys;
 
     memset( &fmt_out, 0, sizeof(video_format_t) );
@@ -342,7 +335,7 @@ static void VlcPictureToIplImage( filter_t* p_filter, picture_t* p_in )
             //rgb2 gives 3 separate planes, this gives 1 interleaved plane
             //rv24 gives is about 20% faster but gives r&b the wrong way round
             //and I can't think of an easy way to fix this
-            fmt_out.i_chroma = VLC_CODEC_RGB32;
+            fmt_out.i_chroma = VLC_CODEC_RGB24;
         }
         else if (p_sys->i_internal_chroma == GREY)
         {
@@ -426,7 +419,7 @@ static picture_t* Filter( filter_t* p_filter, picture_t* p_pic )
     VlcPictureToIplImage( p_filter, p_pic );
     // Pass the image (as a pointer to the first IplImage*) to the
     // internal OpenCV filter for processing.
-    p_filter->p_sys->p_opencv->pf_video_filter( p_filter->p_sys->p_opencv, &(p_filter->p_sys->p_cv_image[0]) );
+    p_filter->p_sys->p_opencv->pf_video_filter( p_filter->p_sys->p_opencv, (picture_t*)&(p_filter->p_sys->p_cv_image[0]) );
 
     if(p_filter->p_sys->i_wrapper_output == PROCESSED) {
         // Processed video