Use filter helpers.
authorLaurent Aimar <fenrir@videolan.org>
Sat, 19 Jul 2008 13:41:59 +0000 (15:41 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Sat, 19 Jul 2008 22:53:21 +0000 (00:53 +0200)
29 files changed:
modules/codec/avcodec/deinterlace.c
modules/video_filter/adjust.c
modules/video_filter/colorthres.c
modules/video_filter/croppadd.c
modules/video_filter/deinterlace.c
modules/video_filter/erase.c
modules/video_filter/extract.c
modules/video_filter/gaussianblur.c
modules/video_filter/gradient.c
modules/video_filter/grain.c
modules/video_filter/invert.c
modules/video_filter/logo.c
modules/video_filter/marq.c
modules/video_filter/mosaic.c
modules/video_filter/motionblur.c
modules/video_filter/motiondetect.c
modules/video_filter/noise.c
modules/video_filter/osdmenu.c
modules/video_filter/postproc.c
modules/video_filter/psychedelic.c
modules/video_filter/remoteosd.c
modules/video_filter/ripple.c
modules/video_filter/rotate.c
modules/video_filter/rss.c
modules/video_filter/rv32.c
modules/video_filter/scale.c
modules/video_filter/sharpen.c
modules/video_filter/swscale.c
modules/video_filter/wave.c

index f44289a..b297bbd 100644 (file)
@@ -122,9 +122,12 @@ static picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
     int i, i_res = -1;
 
     /* Request output picture */
-    p_pic_dst = p_filter->pf_vout_buffer_new( p_filter );
+    p_pic_dst = filter_NewPicture( p_filter );
     if( !p_pic_dst )
+    {
+        picture_Release( p_pic );
         return NULL;
+    }
 
     /* Prepare the AVPictures for the conversion */
     for( i = 0; i < p_pic->i_planes; i++ )
@@ -144,7 +147,8 @@ static picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
     if( i_res == -1 )
     {
         msg_Err( p_filter, "deinterlacing picture failed" );
-        p_filter->pf_vout_buffer_del( p_filter, p_pic_dst );
+        filter_DeletePicture( p_filter, p_pic_dst );
+        picture_Release( p_pic );
         return NULL;
     }
 
index b378192..a4bf4ef 100644 (file)
@@ -215,10 +215,9 @@ static picture_t *FilterPlanar( filter_t *p_filter, picture_t *p_pic )
 
     if( !p_pic ) return NULL;
 
-    p_outpic = p_filter->pf_vout_buffer_new( p_filter );
+    p_outpic = filter_NewPicture( p_filter );
     if( !p_outpic )
     {
-        msg_Warn( p_filter, "can't get output picture" );
         picture_Release( p_pic );
         return NULL;
     }
index 2a39318..a4e40a2 100644 (file)
@@ -162,10 +162,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
 
     if( !p_pic ) return NULL;
 
-    p_outpic = p_filter->pf_vout_buffer_new( p_filter );
+    p_outpic = filter_NewPicture( p_filter );
     if( !p_outpic )
     {
-        msg_Warn( p_filter, "can't get output picture" );
         picture_Release( p_pic );
         return NULL;
     }
index 3f17320..3f9f648 100644 (file)
@@ -215,10 +215,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
     if( !p_pic ) return NULL;
 
     /* Request output picture */
-    p_outpic = p_filter->pf_vout_buffer_new( p_filter );
+    p_outpic = filter_NewPicture( p_filter );
     if( !p_outpic )
     {
-        msg_Warn( p_filter, "can't get output picture" );
         picture_Release( p_pic );
         return NULL;
     }
index 9328491..4ec8333 100644 (file)
@@ -2106,12 +2106,9 @@ static picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
     picture_t *p_pic_dst;
 
     /* Request output picture */
-    p_pic_dst = p_filter->pf_vout_buffer_new( p_filter );
+    p_pic_dst = filter_NewPicture( p_filter );
     if( p_pic_dst == NULL )
-    {
-        msg_Warn( p_filter, "can't get output picture" );
-        return NULL;
-    }
+        return p_pic;
 
     switch( p_vout->p_sys->i_mode )
     {
index cde3a8a..33f507b 100644 (file)
@@ -202,10 +202,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
 
     if( !p_pic ) return NULL;
 
-    p_outpic = p_filter->pf_vout_buffer_new( p_filter );
+    p_outpic = filter_NewPicture( p_filter );
     if( !p_outpic )
     {
-        msg_Warn( p_filter, "can't get output picture" );
         picture_Release( p_pic );
         return NULL;
     }
index 7c78400..23716f0 100644 (file)
@@ -172,10 +172,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
 
     if( !p_pic ) return NULL;
 
-    p_outpic = p_filter->pf_vout_buffer_new( p_filter );
+    p_outpic = filter_NewPicture( p_filter );
     if( !p_outpic )
     {
-        msg_Warn( p_filter, "can't get output picture" );
         picture_Release( p_pic );
         return NULL;
     }
index 373857a..f0df010 100644 (file)
@@ -193,10 +193,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
 
     if( !p_pic ) return NULL;
 
-    p_outpic = p_filter->pf_vout_buffer_new( p_filter );
+    p_outpic = filter_NewPicture( p_filter );
     if( !p_outpic )
     {
-        msg_Warn( p_filter, "can't get output picture" );
         picture_Release( p_pic );
         return NULL;
     }
index ac10a35..f1c57cd 100644 (file)
@@ -233,10 +233,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
 
     if( !p_pic ) return NULL;
 
-    p_outpic = p_filter->pf_vout_buffer_new( p_filter );
+    p_outpic = filter_NewPicture( p_filter );
     if( !p_outpic )
     {
-        msg_Warn( p_filter, "can't get output picture" );
         picture_Release( p_pic );
         return NULL;
     }
index 8826628..e28b210 100644 (file)
@@ -106,10 +106,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
 
     if( !p_pic ) return NULL;
 
-    p_outpic = p_filter->pf_vout_buffer_new( p_filter );
+    p_outpic = filter_NewPicture( p_filter );
     if( !p_outpic )
     {
-        msg_Warn( p_filter, "can't get output picture" );
         picture_Release( p_pic );
         return NULL;
     }
index df1a168..1700c1d 100644 (file)
@@ -113,7 +113,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
 
     if( !p_pic ) return NULL;
 
-    p_outpic = p_filter->pf_vout_buffer_new( p_filter );
+    p_outpic = filter_NewPicture( p_filter );
     if( !p_outpic )
     {
         msg_Warn( p_filter, "can't get output picture" );
index 541fc19..f274dc2 100644 (file)
@@ -819,7 +819,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
     p_pic = p_logo->p_pic;
 
     /* Allocate the subpicture internal data. */
-    p_spu = p_filter->pf_sub_buffer_new( p_filter );
+    p_spu = filter_NewSubpicture( p_filter );
     if( !p_spu )
     {
         vlc_mutex_unlock( &p_logo_list->lock );
index 091cc87..a170b67 100644 (file)
@@ -276,7 +276,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
     if( p_sys->b_need_update == false )
         goto out;
 
-    p_spu = p_filter->pf_sub_buffer_new( p_filter );
+    p_spu = filter_NewSubpicture( p_filter );
     if( !p_spu )
         goto out;
 
index b62da83..379b25e 100644 (file)
@@ -448,11 +448,9 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
     subpicture_region_t *p_region_prev = NULL;
 
     /* Allocate the subpicture internal data. */
-    p_spu = p_filter->pf_sub_buffer_new( p_filter );
+    p_spu = filter_NewSubpicture( p_filter );
     if( !p_spu )
-    {
         return NULL;
-    }
 
     /* Initialize subpicture */
     p_spu->i_channel = 0;
index 42043ab..4b9bafe 100644 (file)
@@ -137,10 +137,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
 
     if( !p_pic ) return NULL;
 
-    p_outpic = p_filter->pf_vout_buffer_new( p_filter );
+    p_outpic = filter_NewPicture( p_filter );
     if( !p_outpic )
     {
-        msg_Warn( p_filter, "can't get output picture" );
         picture_Release( p_pic );
         return NULL;
     }
index 4b80c7a..d4783e2 100644 (file)
@@ -151,7 +151,6 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_inpic )
     uint8_t *p_oldpix;
     uint8_t *p_oldpix_u;
     uint8_t *p_oldpix_v;
-    uint8_t *p_outpix;
     uint32_t *p_buf;
     uint32_t *p_buf2;
 
@@ -180,22 +179,14 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_inpic )
     p_buf = p_sys->p_buf;
     p_buf2 = p_sys->p_buf2;
 
-    p_outpic = p_filter->pf_vout_buffer_new( p_filter );
+    p_outpic = filter_NewPicture( p_filter );
     if( !p_outpic )
     {
-        msg_Warn( p_filter, "can't get output picture" );
         picture_Release( p_inpic );
         return NULL;
     }
 
-    p_outpix = p_outpic->p[Y_PLANE].p_pixels;
-    vlc_memcpy( p_outpic->p[Y_PLANE].p_pixels, p_inpic->p[Y_PLANE].p_pixels,
-        p_inpic->p[Y_PLANE].i_pitch * p_inpic->p[Y_PLANE].i_visible_lines );
-    vlc_memcpy( p_outpic->p[U_PLANE].p_pixels, p_inpic->p[U_PLANE].p_pixels,
-        p_inpic->p[U_PLANE].i_pitch * p_inpic->p[U_PLANE].i_visible_lines );
-    vlc_memcpy( p_outpic->p[V_PLANE].p_pixels, p_inpic->p[V_PLANE].p_pixels,
-        p_inpic->p[V_PLANE].i_pitch * p_inpic->p[V_PLANE].i_visible_lines );
-
+    vout_CopyPicture( p_filter, p_outpic, p_inpic );
     vlc_mutex_lock( &p_filter->p_sys->lock );
 
     /**
@@ -293,33 +284,36 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_inpic )
      * Count final number of shapes
      * Draw rectangles (there can be more than 1 moving shape in 1 rectangle)
      */
+    uint8_t *p_outpix = p_outpic->p[Y_PLANE].p_pixels;
+    const int i_dst_pitch = p_outpic->p[Y_PLANE].i_pitch;
     j = 0;
     for( i = 1; i < last; i++ )
     {
         if( colors[i] == i && color_x_min[i] != -1 )
         {
-            if( ( color_y_max[i] - color_y_min[i] ) * ( color_x_max[i] - color_x_min[i] ) < 16 ) continue;
+            if( ( color_y_max[i] - color_y_min[i] ) * ( color_x_max[i] - color_x_min[i] ) < 16 )
+                continue;
             j++;
             int x, y;
             y = color_y_min[i];
             for( x = color_x_min[i]; x <= color_x_max[i]; x++ )
             {
-                p_outpix[y*i_src_pitch+x] = 0xff;
+                p_outpix[y*i_dst_pitch+x] = 0xff;
             }
             y = color_y_max[i];
             for( x = color_x_min[i]; x <= color_x_max[i]; x++ )
             {
-                p_outpix[y*i_src_pitch+x] = 0xff;
+                p_outpix[y*i_dst_pitch+x] = 0xff;
             }
             x = color_x_min[i];
             for( y = color_y_min[i]; y <= color_y_max[i]; y++ )
             {
-                p_outpix[y*i_src_pitch+x] = 0xff;
+                p_outpix[y*i_dst_pitch+x] = 0xff;
             }
             x = color_x_max[i];
             for( y = color_y_min[i]; y <= color_y_max[i]; y++ )
             {
-                p_outpix[y*i_src_pitch+x] = 0xff;
+                p_outpix[y*i_dst_pitch+x] = 0xff;
             }
         }
     }
@@ -395,10 +389,9 @@ static picture_t *FilterPacked( filter_t *p_filter, picture_t *p_inpic )
         return p_inpic;
     }
 
-    p_outpic = p_filter->pf_vout_buffer_new( p_filter );
+    p_outpic = filter_NewPicture( p_filter );
     if( !p_outpic )
     {
-        msg_Warn( p_filter, "can't get output picture" );
         picture_Release( p_inpic );
         return NULL;
     }
index 1c461bc..e61391e 100644 (file)
@@ -119,7 +119,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
 
     if( !p_pic ) return NULL;
 
-    p_outpic = p_filter->pf_vout_buffer_new( p_filter );
+    p_outpic = filter_NewPicture( p_filter );
     if( !p_outpic )
     {
         msg_Warn( p_filter, "can't get output picture" );
index 28818f3..58b5939 100644 (file)
@@ -462,8 +462,9 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t i_date )
         return NULL; /* we are too early, so wait */
 
     /* Allocate the subpicture internal data. */
-    p_spu = p_filter->pf_sub_buffer_new( p_filter );
-    if( !p_spu ) return NULL;
+    p_spu = filter_NewSubpicture( p_filter );
+    if( !p_spu )
+        return NULL;
 
     p_spu->b_ephemer = true;
     p_spu->b_fade = true;
index 83b3099..e05d773 100644 (file)
@@ -274,10 +274,9 @@ static picture_t *PostprocPict( filter_t *p_filter, picture_t *p_pic )
         return p_pic;
     }
 
-    picture_t *p_outpic = p_filter->pf_vout_buffer_new( p_filter );
+    picture_t *p_outpic = filter_NewPicture( p_filter );
     if( !p_outpic )
     {
-        msg_Warn( p_filter, "can't get output picture" );
         picture_Release( p_pic );
         vlc_mutex_unlock( &p_sys->lock );
         return NULL;
index 7a9540a..88a2e35 100644 (file)
@@ -142,10 +142,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
 
     if( !p_pic ) return NULL;
 
-    p_outpic = p_filter->pf_vout_buffer_new( p_filter );
+    p_outpic = filter_NewPicture( p_filter );
     if( !p_outpic )
     {
-        msg_Warn( p_filter, "can't get output picture" );
         picture_Release( p_pic );
         return NULL;
     }
index b7fbc78..34c86dc 100644 (file)
@@ -1134,7 +1134,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
     }
 
     /* Allocate the subpicture internal data. */
-    p_spu = p_filter->pf_sub_buffer_new( p_filter );
+    p_spu = filter_NewSubpicture( p_filter );
     if( !p_spu )
     {
         vlc_mutex_unlock( &p_sys->lock );
index eb9d2f5..6d9776f 100644 (file)
@@ -121,10 +121,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
 
     if( !p_pic ) return NULL;
 
-    p_outpic = p_filter->pf_vout_buffer_new( p_filter );
+    p_outpic = filter_NewPicture( p_filter );
     if( !p_outpic )
     {
-        msg_Warn( p_filter, "can't get output picture" );
         picture_Release( p_pic );
         return NULL;
     }
index 2fdf440..55b7c9f 100644 (file)
@@ -172,10 +172,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
 
     if( !p_pic ) return NULL;
 
-    p_outpic = p_filter->pf_vout_buffer_new( p_filter );
+    p_outpic = filter_NewPicture( p_filter );
     if( !p_outpic )
     {
-        msg_Warn( p_filter, "can't get output picture" );
         picture_Release( p_pic );
         return NULL;
     }
@@ -304,10 +303,9 @@ static picture_t *FilterPacked( filter_t *p_filter, picture_t *p_pic )
         return NULL;
     }
 
-    p_outpic = p_filter->pf_vout_buffer_new( p_filter );
+    p_outpic = filter_NewPicture( p_filter );
     if( !p_outpic )
     {
-        msg_Warn( p_filter, "can't get output picture" );
         picture_Release( p_pic );
         return NULL;
     }
index 6f4615a..0465a2c 100644 (file)
@@ -429,7 +429,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
         }
     }
 
-    p_spu = p_filter->pf_sub_buffer_new( p_filter );
+    p_spu = filter_NewSubpicture( p_filter );
     if( !p_spu )
     {
         vlc_mutex_unlock( &p_sys->lock );
index 89c1aa2..10c5699 100644 (file)
@@ -105,10 +105,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
     unsigned int j;
 
     /* Request output picture */
-    p_pic_dst = p_filter->pf_vout_buffer_new( p_filter );
+    p_pic_dst = filter_NewPicture( p_filter );
     if( !p_pic_dst )
     {
-        msg_Warn( p_filter, "can't get output picture" );
         picture_Release( p_pic );
         return NULL;
     }
index 01033b8..7aa4e98 100644 (file)
@@ -124,10 +124,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         return NULL;
 
     /* Request output picture */
-    p_pic_dst = p_filter->pf_vout_buffer_new( p_filter );
+    p_pic_dst = filter_NewPicture( p_filter );
     if( !p_pic_dst )
     {
-        msg_Warn( p_filter, "can't get output picture" );
         picture_Release( p_pic );
         return NULL;
     }
index e975466..c95e69b 100644 (file)
@@ -172,10 +172,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
     if( !p_filter ) return NULL;
     if( !p_filter->p_sys ) return NULL;
 
-    p_outpic = p_filter->pf_vout_buffer_new( p_filter );
+    p_outpic = filter_NewPicture( p_filter );
     if( !p_outpic )
     {
-        msg_Warn( p_filter, "can't get output picture" );
         picture_Release( p_pic );
         return NULL;
     }
index 5e0e8d0..ba7a981 100644 (file)
@@ -283,13 +283,17 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
     int i_nb_planes = p_pic->i_planes;
 
     /* Check if format properties changed */
-    if( CheckInit( p_filter ) != VLC_SUCCESS ) return NULL;
+    if( CheckInit( p_filter ) != VLC_SUCCESS )
+    {
+        picture_Release( p_pic );
+        return NULL;
+    }
 
     /* Request output picture */
-    p_pic_dst = p_filter->pf_vout_buffer_new( p_filter );
+    p_pic_dst = filter_NewPicture( p_filter );
     if( !p_pic_dst )
     {
-        msg_Warn( p_filter, "can't get output picture" );
+        picture_Release( p_pic );
         return NULL;
     }
 
index 0a154a0..03fb7c2 100644 (file)
@@ -122,10 +122,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
 
     if( !p_pic ) return NULL;
 
-    p_outpic = p_filter->pf_vout_buffer_new( p_filter );
+    p_outpic = filter_NewPicture( p_filter );
     if( !p_outpic )
     {
-        msg_Warn( p_filter, "can't get output picture" );
         picture_Release( p_pic );
         return NULL;
     }