Chroma modules now exactly implement the "video filter2" capability.
authorAntoine Cellerier <dionoea@videolan.org>
Mon, 2 Jun 2008 14:25:25 +0000 (16:25 +0200)
committerAntoine Cellerier <dionoea@videolan.org>
Mon, 2 Jun 2008 16:44:03 +0000 (18:44 +0200)
13 files changed:
include/vlc_filter.h
modules/video_chroma/chain.c
modules/video_chroma/grey_yuv.c
modules/video_chroma/i420_rgb.c
modules/video_chroma/i420_rgb.h
modules/video_chroma/i420_ymga.c
modules/video_chroma/i420_yuy2.c
modules/video_chroma/i422_i420.c
modules/video_chroma/i422_yuy2.c
modules/video_chroma/yuy2_i420.c
modules/video_chroma/yuy2_i422.c
src/video_output/video_output.c
src/video_output/vout_pictures.c

index 533c151..a1afd34 100644 (file)
@@ -60,7 +60,6 @@ struct filter_t
     config_chain_t *    p_cfg;
 
     picture_t *         ( * pf_video_filter ) ( filter_t *, picture_t * );
-    void                ( * pf_video_filter_io ) ( filter_t *, picture_t *, picture_t * ); /* Used by video filters with a preallocated output buffer (ie chroma conversion modules) */
     block_t *           ( * pf_audio_filter ) ( filter_t *, block_t * );
     void                ( * pf_video_blend )  ( filter_t *, picture_t *,
                                                 picture_t *, picture_t *,
@@ -93,4 +92,37 @@ struct filter_t
     filter_owner_sys_t *p_owner;
 };
 
+
+/**
+ * Create a picture_t *(*)( filter_t *, picture_t * ) compatible wrapper
+ * using a void (*)( filter_t *, picture_t *, picture_t * ) function
+ *
+ * Currently used by the chroma video filters
+ */
+#define VIDEO_FILTER_WRAPPER( name )                                    \
+    static picture_t *name ## _Filter ( filter_t *p_filter,             \
+                                        picture_t *p_pic )              \
+    {                                                                   \
+        picture_t *p_outpic = p_filter->pf_vout_buffer_new( p_filter ); \
+        if( !p_outpic )                                                 \
+        {                                                               \
+            msg_Warn( p_filter, "can't get output picture" );           \
+            if( p_pic->pf_release )                                     \
+                p_pic->pf_release( p_pic );                             \
+            return NULL;                                                \
+        }                                                               \
+                                                                        \
+        name( p_filter, p_pic, p_outpic );                              \
+                                                                        \
+        p_outpic->date = p_pic->date;                                   \
+        p_outpic->b_force = p_pic->b_force;                             \
+        p_outpic->i_nb_fields = p_pic->i_nb_fields;                     \
+        p_outpic->b_progressive = p_pic->b_progressive;                 \
+        p_outpic->b_top_field_first = p_pic->b_top_field_first;         \
+                                                                        \
+        if( p_pic->pf_release )                                         \
+            p_pic->pf_release( p_pic );                                 \
+        return p_outpic;                                                \
+    }
+
 #endif /* _VLC_FILTER_H */
index 988dd0b..acbda70 100644 (file)
@@ -46,7 +46,7 @@ static void Chain    ( filter_t *, picture_t *, picture_t * );
  *****************************************************************************/
 vlc_module_begin();
     set_description( N_("Chroma conversions using a chain of chroma conversion modules") );
-    set_capability( "chroma", 1 );
+    set_capability( "video filter2", 1 );
     set_callbacks( Activate, Destroy );
 vlc_module_end();
 
index 4cfd11a..494cacd 100644 (file)
@@ -45,12 +45,15 @@ static int  Activate ( vlc_object_t * );
 static void GREY_I420( filter_t *, picture_t *, picture_t * );
 static void GREY_YUY2( filter_t *, picture_t *, picture_t * );
 
+static picture_t *GREY_I420_Filter( filter_t *, picture_t * );
+static picture_t *GREY_YUY2_Filter( filter_t *, picture_t * );
+
 /*****************************************************************************
  * Module descriptor.
  *****************************************************************************/
 vlc_module_begin();
     set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) );
-    set_capability( "chroma", 80 );
+    set_capability( "video filter2", 80 );
     set_callbacks( Activate, NULL );
 vlc_module_end();
 
@@ -77,10 +80,10 @@ static int Activate( vlc_object_t *p_this )
             switch( p_filter->fmt_out.video.i_chroma )
             {
                 case VLC_FOURCC('I','4','2','0'):
-                    p_filter->pf_video_filter_io = GREY_I420;
+                    p_filter->pf_video_filter = GREY_I420_Filter;
                     break;
                 case VLC_FOURCC('Y','U','Y','2'):
-                    p_filter->pf_video_filter_io = GREY_YUY2;
+                    p_filter->pf_video_filter = GREY_YUY2_Filter;
                     break;
                 default:
                     return -1;
@@ -94,6 +97,9 @@ static int Activate( vlc_object_t *p_this )
     return 0;
 }
 
+VIDEO_FILTER_WRAPPER( GREY_I420 )
+VIDEO_FILTER_WRAPPER( GREY_YUY2 )
+
 /* Following functions are local */
 
 /*****************************************************************************
index b948ea5..e84d248 100644 (file)
@@ -71,16 +71,16 @@ vlc_module_begin();
 #if defined (MODULE_NAME_IS_i420_rgb)
     set_description( N_("I420,IYUV,YV12 to "
                        "RGB2,RV15,RV16,RV24,RV32 conversions") );
-    set_capability( "chroma", 80 );
+    set_capability( "video filter2", 80 );
 #elif defined (MODULE_NAME_IS_i420_rgb_mmx)
     set_description( N_( "MMX I420,IYUV,YV12 to "
                         "RV15,RV16,RV24,RV32 conversions") );
-    set_capability( "chroma", 100 );
+    set_capability( "video filter2", 100 );
     add_requirement( MMX );
 #elif defined (MODULE_NAME_IS_i420_rgb_sse2)
     set_description( N_( "SSE2 I420,IYUV,YV12 to "
                         "RV15,RV16,RV24,RV32 conversions") );
-    set_capability( "chroma", 120 );
+    set_capability( "video filter2", 120 );
     add_requirement( SSE2 );
 #endif
     set_callbacks( Activate, Deactivate );
@@ -113,7 +113,7 @@ static int Activate( vlc_object_t *p_this )
             {
 #if defined (MODULE_NAME_IS_i420_rgb)
                 case VLC_FOURCC('R','G','B','2'):
-                    p_filter->pf_video_filter_io = I420_RGB8;
+                    p_filter->pf_video_filter = I420_RGB8_Filter;
                     break;
 #endif
                 case VLC_FOURCC('R','V','1','5'):
@@ -126,7 +126,7 @@ static int Activate( vlc_object_t *p_this )
                     {
                         /* R5G5B6 pixel format */
                         msg_Dbg(p_this, "RGB pixel format is R5G5B5");
-                        p_filter->pf_video_filter_io = I420_R5G5B5;
+                        p_filter->pf_video_filter = I420_R5G5B5_Filter;
                     }
                     else if( ( p_filter->fmt_out.video.i_rmask == 0xf800
                             && p_filter->fmt_out.video.i_gmask == 0x07e0
@@ -134,13 +134,13 @@ static int Activate( vlc_object_t *p_this )
                     {
                         /* R5G6B5 pixel format */
                         msg_Dbg(p_this, "RGB pixel format is R5G6B5");
-                        p_filter->pf_video_filter_io = I420_R5G6B5;
+                        p_filter->pf_video_filter = I420_R5G6B5_Filter;
                     }
                     else
                         return VLC_EGENERIC;
 #else
                     // generic C chroma converter */
-                    p_filter->pf_video_filter_io = I420_RGB16;
+                    p_filter->pf_video_filter = I420_RGB16_Filter;
 #endif
                     break;
 
@@ -158,7 +158,7 @@ static int Activate( vlc_object_t *p_this )
                     {
                         /* A8R8G8B8 pixel format */
                         msg_Dbg(p_this, "RGB pixel format is A8R8G8B8");
-                        p_filter->pf_video_filter_io = I420_A8R8G8B8;
+                        p_filter->pf_video_filter = I420_A8R8G8B8_Filter;
                     }
                     else if( p_filter->fmt_out.video.i_rmask == 0xff000000
                           && p_filter->fmt_out.video.i_gmask == 0x00ff0000
@@ -166,7 +166,7 @@ static int Activate( vlc_object_t *p_this )
                     {
                         /* R8G8B8A8 pixel format */
                         msg_Dbg(p_this, "RGB pixel format is R8G8B8A8");
-                        p_filter->pf_video_filter_io = I420_R8G8B8A8;
+                        p_filter->pf_video_filter = I420_R8G8B8A8_Filter;
                     }
                     else if( p_filter->fmt_out.video.i_rmask == 0x0000ff00
                           && p_filter->fmt_out.video.i_gmask == 0x00ff0000
@@ -174,7 +174,7 @@ static int Activate( vlc_object_t *p_this )
                     {
                         /* B8G8R8A8 pixel format */
                         msg_Dbg(p_this, "RGB pixel format is B8G8R8A8");
-                        p_filter->pf_video_filter_io = I420_B8G8R8A8;
+                        p_filter->pf_video_filter = I420_B8G8R8A8_Filter;
                     }
                     else if( p_filter->fmt_out.video.i_rmask == 0x000000ff
                           && p_filter->fmt_out.video.i_gmask == 0x0000ff00
@@ -182,13 +182,13 @@ static int Activate( vlc_object_t *p_this )
                     {
                         /* A8B8G8R8 pixel format */
                         msg_Dbg(p_this, "RGB pixel format is A8B8G8R8");
-                        p_filter->pf_video_filter_io = I420_A8B8G8R8;
+                        p_filter->pf_video_filter = I420_A8B8G8R8_Filter;
                     }
                     else
                         return VLC_EGENERIC;
 #else
                     /* generic C chroma converter */
-                    p_filter->pf_video_filter_io = I420_RGB32;
+                    p_filter->pf_video_filter = I420_RGB32_Filter;
 #endif
                     break;
 
@@ -294,6 +294,19 @@ static void Deactivate( vlc_object_t *p_this )
     free( p_filter->p_sys );
 }
 
+#if defined (MODULE_NAME_IS_i420_rgb)
+VIDEO_FILTER_WRAPPER( I420_RGB8 )
+VIDEO_FILTER_WRAPPER( I420_RGB16 )
+VIDEO_FILTER_WRAPPER( I420_RGB32 )
+#else
+VIDEO_FILTER_WRAPPER( I420_R5G5B5 )
+VIDEO_FILTER_WRAPPER( I420_R5G6B5 )
+VIDEO_FILTER_WRAPPER( I420_A8R8G8B8 )
+VIDEO_FILTER_WRAPPER( I420_R8G8B8A8 )
+VIDEO_FILTER_WRAPPER( I420_B8G8R8A8 )
+VIDEO_FILTER_WRAPPER( I420_A8B8G8R8 )
+#endif
+
 #if defined (MODULE_NAME_IS_i420_rgb)
 /*****************************************************************************
  * SetGammaTable: return intensity table transformed by gamma curve.
index 66171fb..260f63e 100644 (file)
@@ -60,6 +60,10 @@ void I420_RGB8         ( filter_t *, picture_t *, picture_t * );
 void I420_RGB16_dither ( filter_t *, picture_t *, picture_t * );
 void I420_RGB16        ( filter_t *, picture_t *, picture_t * );
 void I420_RGB32        ( filter_t *, picture_t *, picture_t * );
+static picture_t *I420_RGB8_Filter         ( filter_t *, picture_t * );
+static picture_t *I420_RGB16_dither_Filter ( filter_t *, picture_t * );
+static picture_t *I420_RGB16_Filter        ( filter_t *, picture_t * );
+static picture_t *I420_RGB32_Filter        ( filter_t *, picture_t * );
 #else // if defined(MODULE_NAME_IS_i420_rgb_mmx)
 void I420_R5G5B5       ( filter_t *, picture_t *, picture_t * );
 void I420_R5G6B5       ( filter_t *, picture_t *, picture_t * );
@@ -67,6 +71,12 @@ void I420_A8R8G8B8     ( filter_t *, picture_t *, picture_t * );
 void I420_R8G8B8A8     ( filter_t *, picture_t *, picture_t * );
 void I420_B8G8R8A8     ( filter_t *, picture_t *, picture_t * );
 void I420_A8B8G8R8     ( filter_t *, picture_t *, picture_t * );
+static picture_t *I420_R5G5B5_Filter       ( filter_t *, picture_t * );
+static picture_t *I420_R5G6B5_Filter       ( filter_t *, picture_t * );
+static picture_t *I420_A8R8G8B8_Filter     ( filter_t *, picture_t * );
+static picture_t *I420_R8G8B8A8_Filter     ( filter_t *, picture_t * );
+static picture_t *I420_B8G8R8A8_Filter     ( filter_t *, picture_t * );
+static picture_t *I420_A8B8G8R8_Filter     ( filter_t *, picture_t * );
 #endif
 
 /*****************************************************************************
index 48c58ab..63d09a8 100644 (file)
@@ -43,6 +43,7 @@
  *****************************************************************************/
 static int  Activate   ( vlc_object_t * );
 static void I420_YMGA  ( filter_t *, picture_t *, picture_t * );
+static picture_t *I420_YMGA_Filter( filter_t *, picture_t * );
 
 /*****************************************************************************
  * Module descriptor
@@ -50,10 +51,10 @@ static void I420_YMGA  ( filter_t *, picture_t *, picture_t * );
 vlc_module_begin();
 #if defined (MODULE_NAME_IS_i420_ymga)
     set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) );
-    set_capability( "chroma", 80 );
+    set_capability( "video filter2", 80 );
 #elif defined (MODULE_NAME_IS_i420_ymga_mmx)
     set_description( N_("MMX conversions from " SRC_FOURCC " to " DEST_FOURCC) );
-    set_capability( "chroma", 100 );
+    set_capability( "video filter2", 100 );
     add_requirement( MMX );
 #endif
     set_callbacks( Activate, NULL );
@@ -82,7 +83,7 @@ static int Activate( vlc_object_t *p_this )
             switch( p_filter->fmt_out.video.i_chroma )
             {
                 case VLC_FOURCC('Y','M','G','A'):
-                    p_filter->pf_video_filter_io = I420_YMGA;
+                    p_filter->pf_video_filter = I420_YMGA_Filter;
                     break;
 
                 default:
@@ -99,6 +100,8 @@ static int Activate( vlc_object_t *p_this )
 
 /* Following functions are local */
 
+VIDEO_FILTER_WRAPPER( I420_YMGA )
+
 /*****************************************************************************
  * I420_YMGA: planar YUV 4:2:0 to Matrox's planar/packed YUV 4:2:0
  *****************************************************************************/
index ad2258c..4aedfff 100644 (file)
@@ -61,12 +61,18 @@ static int  Activate ( vlc_object_t * );
 static void I420_YUY2           ( filter_t *, picture_t *, picture_t * );
 static void I420_YVYU           ( filter_t *, picture_t *, picture_t * );
 static void I420_UYVY           ( filter_t *, picture_t *, picture_t * );
+static picture_t *I420_YUY2_Filter    ( filter_t *, picture_t * );
+static picture_t *I420_YVYU_Filter    ( filter_t *, picture_t * );
+static picture_t *I420_UYVY_Filter    ( filter_t *, picture_t * );
 #if !defined (MODULE_NAME_IS_i420_yuy2_altivec)
 static void I420_IUYV           ( filter_t *, picture_t *, picture_t * );
 static void I420_cyuv           ( filter_t *, picture_t *, picture_t * );
+static picture_t *I420_IUYV_Filter    ( filter_t *, picture_t * );
+static picture_t *I420_cyuv_Filter    ( filter_t *, picture_t * );
 #endif
 #if defined (MODULE_NAME_IS_i420_yuy2)
 static void I420_Y211           ( filter_t *, picture_t *, picture_t * );
+static picture_t *I420_Y211_Filter    ( filter_t *, picture_t * );
 #endif
 
 #ifdef MODULE_NAME_IS_i420_yuy2_mmx
@@ -81,19 +87,19 @@ static const uint64_t i_80w   = 0x0000000080808080ULL;
 vlc_module_begin();
 #if defined (MODULE_NAME_IS_i420_yuy2)
     set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) );
-    set_capability( "chroma", 80 );
+    set_capability( "video filter2", 80 );
 #elif defined (MODULE_NAME_IS_i420_yuy2_mmx)
     set_description( N_("MMX conversions from " SRC_FOURCC " to " DEST_FOURCC) );
-    set_capability( "chroma", 100 );
+    set_capability( "video filter2", 100 );
     add_requirement( MMX );
 #elif defined (MODULE_NAME_IS_i420_yuy2_sse2)
     set_description( N_("SSE2 conversions from " SRC_FOURCC " to " DEST_FOURCC) );
-    set_capability( "chroma", 120 );
+    set_capability( "video filter2", 120 );
     add_requirement( SSE2 );
 #elif defined (MODULE_NAME_IS_i420_yuy2_altivec)
     set_description(
             _("AltiVec conversions from " SRC_FOURCC " to " DEST_FOURCC) );
-    set_capability( "chroma", 100 );
+    set_capability( "video filter2", 100 );
     add_requirement( ALTIVEC );
 #endif
     set_callbacks( Activate, NULL );
@@ -123,31 +129,31 @@ static int Activate( vlc_object_t *p_this )
             {
                 case VLC_FOURCC('Y','U','Y','2'):
                 case VLC_FOURCC('Y','U','N','V'):
-                    p_filter->pf_video_filter_io = I420_YUY2;
+                    p_filter->pf_video_filter = I420_YUY2_Filter;
                     break;
 
                 case VLC_FOURCC('Y','V','Y','U'):
-                    p_filter->pf_video_filter_io = I420_YVYU;
+                    p_filter->pf_video_filter = I420_YVYU_Filter;
                     break;
 
                 case VLC_FOURCC('U','Y','V','Y'):
                 case VLC_FOURCC('U','Y','N','V'):
                 case VLC_FOURCC('Y','4','2','2'):
-                    p_filter->pf_video_filter_io = I420_UYVY;
+                    p_filter->pf_video_filter = I420_UYVY_Filter;
                     break;
 #if !defined (MODULE_NAME_IS_i420_yuy2_altivec)
                 case VLC_FOURCC('I','U','Y','V'):
-                    p_filter->pf_video_filter_io = I420_IUYV;
+                    p_filter->pf_video_filter = I420_IUYV_Filter;
                     break;
 
                 case VLC_FOURCC('c','y','u','v'):
-                    p_filter->pf_video_filter_io = I420_cyuv;
+                    p_filter->pf_video_filter = I420_cyuv_Filter;
                     break;
 #endif
 
 #if defined (MODULE_NAME_IS_i420_yuy2)
                 case VLC_FOURCC('Y','2','1','1'):
-                    p_filter->pf_video_filter_io = I420_Y211;
+                    p_filter->pf_video_filter = I420_Y211_Filter;
                     break;
 #endif
 
@@ -174,6 +180,17 @@ static inline unsigned long long read_cycles(void)
 #endif
 
 /* Following functions are local */
+
+VIDEO_FILTER_WRAPPER( I420_YUY2 )
+VIDEO_FILTER_WRAPPER( I420_YVYU )
+VIDEO_FILTER_WRAPPER( I420_UYVY )
+#if !defined (MODULE_NAME_IS_i420_yuy2_altivec)
+VIDEO_FILTER_WRAPPER( I420_IUYV )
+#endif
+#if defined (MODULE_NAME_IS_i420_yuy2)
+VIDEO_FILTER_WRAPPER( I420_Y211 )
+#endif
+
 /*****************************************************************************
  * I420_YUY2: planar YUV 4:2:0 to packed YUYV 4:2:2
  *****************************************************************************/
index b5c122c..a318580 100644 (file)
@@ -46,13 +46,16 @@ static int  Activate ( vlc_object_t * );
 static void I422_I420( filter_t *, picture_t *, picture_t * );
 static void I422_YV12( filter_t *, picture_t *, picture_t * );
 static void I422_YUVA( filter_t *, picture_t *, picture_t * );
+static picture_t *I422_I420_Filter( filter_t *, picture_t * );
+static picture_t *I422_YV12_Filter( filter_t *, picture_t * );
+static picture_t *I422_YUVA_Filter( filter_t *, picture_t * );
 
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
 vlc_module_begin();
     set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) );
-    set_capability( "chroma", 60 );
+    set_capability( "video filter2", 60 );
     set_callbacks( Activate, NULL );
 vlc_module_end();
 
@@ -80,15 +83,15 @@ static int Activate( vlc_object_t *p_this )
                 case VLC_FOURCC('I','4','2','0'):
                 case VLC_FOURCC('I','Y','U','V'):
                 case VLC_FOURCC('J','4','2','0'):
-                    p_filter->pf_video_filter_io = I422_I420;
+                    p_filter->pf_video_filter = I422_I420_Filter;
                     break;
 
                 case VLC_FOURCC('Y','V','1','2'):
-                    p_filter->pf_video_filter_io = I422_YV12;
+                    p_filter->pf_video_filter = I422_YV12_Filter;
                     break;
 
                 case VLC_FOURCC('Y','U','V','A'):
-                    p_filter->pf_video_filter_io = I422_YUVA;
+                    p_filter->pf_video_filter = I422_YUVA_Filter;
                     break;
 
                 default:
@@ -103,6 +106,9 @@ static int Activate( vlc_object_t *p_this )
 }
 
 /* Following functions are local */
+VIDEO_FILTER_WRAPPER( I422_I420 )
+VIDEO_FILTER_WRAPPER( I422_YV12 )
+VIDEO_FILTER_WRAPPER( I422_YUVA )
 
 /*****************************************************************************
  * I422_I420: planar YUV 4:2:2 to planar I420 4:2:0 Y:U:V
index 058a010..528ec68 100644 (file)
  *****************************************************************************/
 static int  Activate ( vlc_object_t * );
 
-static void I422_YUY2           ( filter_t *, picture_t *, picture_t * );
-static void I422_YVYU           ( filter_t *, picture_t *, picture_t * );
-static void I422_UYVY           ( filter_t *, picture_t *, picture_t * );
-static void I422_IUYV           ( filter_t *, picture_t *, picture_t * );
-static void I422_cyuv           ( filter_t *, picture_t *, picture_t * );
+static void I422_YUY2               ( filter_t *, picture_t *, picture_t * );
+static void I422_YVYU               ( filter_t *, picture_t *, picture_t * );
+static void I422_UYVY               ( filter_t *, picture_t *, picture_t * );
+static void I422_IUYV               ( filter_t *, picture_t *, picture_t * );
+static void I422_cyuv               ( filter_t *, picture_t *, picture_t * );
+static picture_t *I422_YUY2_Filter  ( filter_t *, picture_t * );
+static picture_t *I422_YVYU_Filter  ( filter_t *, picture_t * );
+static picture_t *I422_UYVY_Filter  ( filter_t *, picture_t * );
+static picture_t *I422_IUYV_Filter  ( filter_t *, picture_t * );
+static picture_t *I422_cyuv_Filter  ( filter_t *, picture_t * );
 #if defined (MODULE_NAME_IS_i422_yuy2)
-static void I422_Y211           ( filter_t *, picture_t *, picture_t * );
-static void I422_Y211           ( filter_t *, picture_t *, picture_t * );
+static void I422_Y211               ( filter_t *, picture_t *, picture_t * );
+static picture_t *I422_Y211_Filter  ( filter_t *, picture_t * );
 #endif
 
 /*****************************************************************************
@@ -65,14 +70,14 @@ static void I422_Y211           ( filter_t *, picture_t *, picture_t * );
 vlc_module_begin();
 #if defined (MODULE_NAME_IS_i422_yuy2)
     set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) );
-    set_capability( "chroma", 80 );
+    set_capability( "video filter2", 80 );
 #elif defined (MODULE_NAME_IS_i422_yuy2_mmx)
     set_description( N_("MMX conversions from " SRC_FOURCC " to " DEST_FOURCC) );
-    set_capability( "chroma", 100 );
+    set_capability( "video filter2", 100 );
     add_requirement( MMX );
 #elif defined (MODULE_NAME_IS_i422_yuy2_sse2)
     set_description( N_("SSE2 conversions from " SRC_FOURCC " to " DEST_FOURCC) );
-    set_capability( "chroma", 120 );
+    set_capability( "video filter2", 120 );
     add_requirement( SSE2 );
 #endif
     set_callbacks( Activate, NULL );
@@ -100,30 +105,30 @@ static int Activate( vlc_object_t *p_this )
             {
                 case VLC_FOURCC('Y','U','Y','2'):
                 case VLC_FOURCC('Y','U','N','V'):
-                    p_filter->pf_video_filter_io = I422_YUY2;
+                    p_filter->pf_video_filter = I422_YUY2_Filter;
                     break;
 
                 case VLC_FOURCC('Y','V','Y','U'):
-                    p_filter->pf_video_filter_io = I422_YVYU;
+                    p_filter->pf_video_filter = I422_YVYU_Filter;
                     break;
 
                 case VLC_FOURCC('U','Y','V','Y'):
                 case VLC_FOURCC('U','Y','N','V'):
                 case VLC_FOURCC('Y','4','2','2'):
-                    p_filter->pf_video_filter_io = I422_UYVY;
+                    p_filter->pf_video_filter = I422_UYVY_Filter;
                     break;
 
                 case VLC_FOURCC('I','U','Y','V'):
-                    p_filter->pf_video_filter_io = I422_IUYV;
+                    p_filter->pf_video_filter = I422_IUYV_Filter;
                     break;
 
                 case VLC_FOURCC('c','y','u','v'):
-                    p_filter->pf_video_filter_io = I422_cyuv;
+                    p_filter->pf_video_filter = I422_cyuv_Filter;
                     break;
 
 #if defined (MODULE_NAME_IS_i422_yuy2)
                 case VLC_FOURCC('Y','2','1','1'):
-                    p_filter->pf_video_filter_io = I422_Y211;
+                    p_filter->pf_video_filter = I422_Y211_Filter;
                     break;
 #endif
 
@@ -140,6 +145,15 @@ static int Activate( vlc_object_t *p_this )
 
 /* Following functions are local */
 
+VIDEO_FILTER_WRAPPER( I422_YUY2 )
+VIDEO_FILTER_WRAPPER( I422_YVYU )
+VIDEO_FILTER_WRAPPER( I422_UYVY )
+VIDEO_FILTER_WRAPPER( I422_IUYV )
+VIDEO_FILTER_WRAPPER( I422_cyuv )
+#if defined (MODULE_NAME_IS_i422_yuy2)
+VIDEO_FILTER_WRAPPER( I422_Y211 )
+#endif
+
 /*****************************************************************************
  * I422_YUY2: planar YUV 4:2:2 to packed YUY2 4:2:2
  *****************************************************************************/
index b0902bc..f10274d 100644 (file)
@@ -47,12 +47,17 @@ static void YVYU_I420           ( filter_t *, picture_t *, picture_t * );
 static void UYVY_I420           ( filter_t *, picture_t *, picture_t * );
 static void cyuv_I420           ( filter_t *, picture_t *, picture_t * );
 
+static picture_t *YUY2_I420_Filter    ( filter_t *, picture_t * );
+static picture_t *YVYU_I420_Filter    ( filter_t *, picture_t * );
+static picture_t *UYVY_I420_Filter    ( filter_t *, picture_t * );
+static picture_t *cyuv_I420_Filter    ( filter_t *, picture_t * );
+
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
 vlc_module_begin();
     set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) );
-    set_capability( "chroma", 80 );
+    set_capability( "video filter2", 80 );
     set_callbacks( Activate, NULL );
 vlc_module_end();
 
@@ -78,21 +83,21 @@ static int Activate( vlc_object_t *p_this )
             {
                 case VLC_FOURCC('Y','U','Y','2'):
                 case VLC_FOURCC('Y','U','N','V'):
-                    p_filter->pf_video_filter_io = YUY2_I420;
+                    p_filter->pf_video_filter = YUY2_I420_Filter;
                     break;
 
                 case VLC_FOURCC('Y','V','Y','U'):
-                    p_filter->pf_video_filter_io = YVYU_I420;
+                    p_filter->pf_video_filter = YVYU_I420_Filter;
                     break;
 
                 case VLC_FOURCC('U','Y','V','Y'):
                 case VLC_FOURCC('U','Y','N','V'):
                 case VLC_FOURCC('Y','4','2','2'):
-                    p_filter->pf_video_filter_io = UYVY_I420;
+                    p_filter->pf_video_filter = UYVY_I420_Filter;
                     break;
 
                 case VLC_FOURCC('c','y','u','v'):
-                    p_filter->pf_video_filter_io = cyuv_I420;
+                    p_filter->pf_video_filter = cyuv_I420_Filter;
                     break;
 
                 default:
@@ -107,6 +112,10 @@ static int Activate( vlc_object_t *p_this )
 }
 
 /* Following functions are local */
+VIDEO_FILTER_WRAPPER( YUY2_I420 )
+VIDEO_FILTER_WRAPPER( YVYU_I420 )
+VIDEO_FILTER_WRAPPER( UYVY_I420 )
+VIDEO_FILTER_WRAPPER( cyuv_I420 )
 
 /*****************************************************************************
  * YUY2_I420: packed YUY2 4:2:2 to planar YUV 4:2:0
index b78c4be..131f09b 100644 (file)
@@ -46,13 +46,17 @@ static void YUY2_I422           ( filter_t *, picture_t *, picture_t * );
 static void YVYU_I422           ( filter_t *, picture_t *, picture_t * );
 static void UYVY_I422           ( filter_t *, picture_t *, picture_t * );
 static void cyuv_I422           ( filter_t *, picture_t *, picture_t * );
+static picture_t *YUY2_I422_Filter    ( filter_t *, picture_t * );
+static picture_t *YVYU_I422_Filter    ( filter_t *, picture_t * );
+static picture_t *UYVY_I422_Filter    ( filter_t *, picture_t * );
+static picture_t *cyuv_I422_Filter    ( filter_t *, picture_t * );
 
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
 vlc_module_begin();
     set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) );
-    set_capability( "chroma", 80 );
+    set_capability( "video filter2", 80 );
     set_callbacks( Activate, NULL );
 vlc_module_end();
 
@@ -78,21 +82,21 @@ static int Activate( vlc_object_t *p_this )
             {
                 case VLC_FOURCC('Y','U','Y','2'):
                 case VLC_FOURCC('Y','U','N','V'):
-                    p_filter->pf_video_filter_io = YUY2_I422;
+                    p_filter->pf_video_filter = YUY2_I422_Filter;
                     break;
 
                 case VLC_FOURCC('Y','V','Y','U'):
-                    p_filter->pf_video_filter_io = YVYU_I422;
+                    p_filter->pf_video_filter = YVYU_I422_Filter;
                     break;
 
                 case VLC_FOURCC('U','Y','V','Y'):
                 case VLC_FOURCC('U','Y','N','V'):
                 case VLC_FOURCC('Y','4','2','2'):
-                    p_filter->pf_video_filter_io = UYVY_I422;
+                    p_filter->pf_video_filter = UYVY_I422_Filter;
                     break;
 
                 case VLC_FOURCC('c','y','u','v'):
-                    p_filter->pf_video_filter_io = cyuv_I422;
+                    p_filter->pf_video_filter = cyuv_I422_Filter;
                     break;
 
                 default:
@@ -108,6 +112,11 @@ static int Activate( vlc_object_t *p_this )
 
 /* Following functions are local */
 
+VIDEO_FILTER_WRAPPER( YUY2_I422 )
+VIDEO_FILTER_WRAPPER( YVYU_I422 )
+VIDEO_FILTER_WRAPPER( UYVY_I422 )
+VIDEO_FILTER_WRAPPER( cyuv_I422 )
+
 /*****************************************************************************
  * YUY2_I422: packed YUY2 4:2:2 to planar YUV 4:2:2
  *****************************************************************************/
index bfe2547..2d46908 100644 (file)
@@ -514,6 +514,13 @@ static void vout_Destructor( vlc_object_t * p_this )
  * initialization. It returns 0 on success. Note that the thread's flag are not
  * modified inside this function.
  *****************************************************************************/
+static picture_t *get_pic( filter_t *p_filter )
+{
+    picture_t *p_pic = (picture_t *)p_filter->p_owner;
+    p_filter->p_owner = NULL;
+    return p_pic;
+}
+
 static int InitThread( vout_thread_t *p_vout )
 {
     int i, i_aspect_x, i_aspect_y;
@@ -672,9 +679,9 @@ static int InitThread( vout_thread_t *p_vout )
         p_chroma->fmt_out.video.i_lgshift = p_vout->output.i_lgshift;
         p_chroma->fmt_out.video.i_rbshift = p_vout->output.i_rbshift;
         p_chroma->fmt_out.video.i_lbshift = p_vout->output.i_lbshift;
-        msg_Err( p_vout, "HOLA! %4.4s\n", (char*)&p_chroma->fmt_in.video.i_chroma );
-        msg_Err( p_vout, "HOLA! %4.4s\n", (char*)&p_chroma->fmt_out.video.i_chroma );
-        p_chroma->p_module = module_Need( p_chroma, "chroma", NULL, 0 );
+        msg_Err( p_vout, "HOLA! %4.4s", (char*)&p_chroma->fmt_in.video.i_chroma );
+        msg_Err( p_vout, "HOLA! %4.4s", (char*)&p_chroma->fmt_out.video.i_chroma );
+        p_chroma->p_module = module_Need( p_chroma, "video filter2", NULL, 0 );
 
         if( p_chroma->p_module == NULL )
         {
@@ -687,6 +694,7 @@ static int InitThread( vout_thread_t *p_vout )
             vlc_mutex_unlock( &p_vout->change_lock );
             return VLC_EGENERIC;
         }
+        p_chroma->pf_vout_buffer_new = get_pic;
 
         msg_Dbg( p_vout, "indirect render, mapping "
                  "render pictures 0-%i to system pictures %i-%i",
index 4af04f2..62cc9b2 100644 (file)
@@ -378,7 +378,8 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
         }
 
         /* Convert image to the first direct buffer */
-        p_vout->p_chroma->pf_video_filter_io( p_vout->p_chroma, p_pic, p_tmp_pic );
+        p_vout->p_chroma->p_owner = (picture_t *)p_tmp_pic;
+        p_vout->p_chroma->pf_video_filter( p_vout->p_chroma, p_pic );
 
         /* Render subpictures on the first direct buffer */
         spu_RenderSubpictures( p_vout->p_spu, &p_vout->fmt_out, p_tmp_pic,
@@ -398,7 +399,8 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
                 return NULL;
 
         /* Convert image to the first direct buffer */
-        p_vout->p_chroma->pf_video_filter_io( p_vout->p_chroma, p_pic, &p_vout->p_picture[0] );
+        p_vout->p_chroma->p_owner = (picture_t *)&p_vout->p_picture[0];
+        p_vout->p_chroma->pf_video_filter( p_vout->p_chroma, p_pic );
 
         /* Render subpictures on the first direct buffer */
         spu_RenderSubpictures( p_vout->p_spu, &p_vout->fmt_out,