Commit 218efb93 authored by Antoine Cellerier's avatar Antoine Cellerier

Chroma modules now exactly implement the "video filter2" capability.

parent a519cacc
...@@ -60,7 +60,6 @@ struct filter_t ...@@ -60,7 +60,6 @@ struct filter_t
config_chain_t * p_cfg; config_chain_t * p_cfg;
picture_t * ( * pf_video_filter ) ( filter_t *, picture_t * ); 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 * ); block_t * ( * pf_audio_filter ) ( filter_t *, block_t * );
void ( * pf_video_blend ) ( filter_t *, picture_t *, void ( * pf_video_blend ) ( filter_t *, picture_t *,
picture_t *, picture_t *, picture_t *, picture_t *,
...@@ -93,4 +92,37 @@ struct filter_t ...@@ -93,4 +92,37 @@ struct filter_t
filter_owner_sys_t *p_owner; 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 */ #endif /* _VLC_FILTER_H */
...@@ -46,7 +46,7 @@ static void Chain ( filter_t *, picture_t *, picture_t * ); ...@@ -46,7 +46,7 @@ static void Chain ( filter_t *, picture_t *, picture_t * );
*****************************************************************************/ *****************************************************************************/
vlc_module_begin(); vlc_module_begin();
set_description( N_("Chroma conversions using a chain of chroma conversion modules") ); 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 ); set_callbacks( Activate, Destroy );
vlc_module_end(); vlc_module_end();
......
...@@ -45,12 +45,15 @@ static int Activate ( vlc_object_t * ); ...@@ -45,12 +45,15 @@ static int Activate ( vlc_object_t * );
static void GREY_I420( filter_t *, picture_t *, picture_t * ); static void GREY_I420( filter_t *, picture_t *, picture_t * );
static void GREY_YUY2( 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. * Module descriptor.
*****************************************************************************/ *****************************************************************************/
vlc_module_begin(); vlc_module_begin();
set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) ); set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) );
set_capability( "chroma", 80 ); set_capability( "video filter2", 80 );
set_callbacks( Activate, NULL ); set_callbacks( Activate, NULL );
vlc_module_end(); vlc_module_end();
...@@ -77,10 +80,10 @@ static int Activate( vlc_object_t *p_this ) ...@@ -77,10 +80,10 @@ static int Activate( vlc_object_t *p_this )
switch( p_filter->fmt_out.video.i_chroma ) switch( p_filter->fmt_out.video.i_chroma )
{ {
case VLC_FOURCC('I','4','2','0'): case VLC_FOURCC('I','4','2','0'):
p_filter->pf_video_filter_io = GREY_I420; p_filter->pf_video_filter = GREY_I420_Filter;
break; break;
case VLC_FOURCC('Y','U','Y','2'): case VLC_FOURCC('Y','U','Y','2'):
p_filter->pf_video_filter_io = GREY_YUY2; p_filter->pf_video_filter = GREY_YUY2_Filter;
break; break;
default: default:
return -1; return -1;
...@@ -94,6 +97,9 @@ static int Activate( vlc_object_t *p_this ) ...@@ -94,6 +97,9 @@ static int Activate( vlc_object_t *p_this )
return 0; return 0;
} }
VIDEO_FILTER_WRAPPER( GREY_I420 )
VIDEO_FILTER_WRAPPER( GREY_YUY2 )
/* Following functions are local */ /* Following functions are local */
/***************************************************************************** /*****************************************************************************
......
...@@ -71,16 +71,16 @@ vlc_module_begin(); ...@@ -71,16 +71,16 @@ vlc_module_begin();
#if defined (MODULE_NAME_IS_i420_rgb) #if defined (MODULE_NAME_IS_i420_rgb)
set_description( N_("I420,IYUV,YV12 to " set_description( N_("I420,IYUV,YV12 to "
"RGB2,RV15,RV16,RV24,RV32 conversions") ); "RGB2,RV15,RV16,RV24,RV32 conversions") );
set_capability( "chroma", 80 ); set_capability( "video filter2", 80 );
#elif defined (MODULE_NAME_IS_i420_rgb_mmx) #elif defined (MODULE_NAME_IS_i420_rgb_mmx)
set_description( N_( "MMX I420,IYUV,YV12 to " set_description( N_( "MMX I420,IYUV,YV12 to "
"RV15,RV16,RV24,RV32 conversions") ); "RV15,RV16,RV24,RV32 conversions") );
set_capability( "chroma", 100 ); set_capability( "video filter2", 100 );
add_requirement( MMX ); add_requirement( MMX );
#elif defined (MODULE_NAME_IS_i420_rgb_sse2) #elif defined (MODULE_NAME_IS_i420_rgb_sse2)
set_description( N_( "SSE2 I420,IYUV,YV12 to " set_description( N_( "SSE2 I420,IYUV,YV12 to "
"RV15,RV16,RV24,RV32 conversions") ); "RV15,RV16,RV24,RV32 conversions") );
set_capability( "chroma", 120 ); set_capability( "video filter2", 120 );
add_requirement( SSE2 ); add_requirement( SSE2 );
#endif #endif
set_callbacks( Activate, Deactivate ); set_callbacks( Activate, Deactivate );
...@@ -113,7 +113,7 @@ static int Activate( vlc_object_t *p_this ) ...@@ -113,7 +113,7 @@ static int Activate( vlc_object_t *p_this )
{ {
#if defined (MODULE_NAME_IS_i420_rgb) #if defined (MODULE_NAME_IS_i420_rgb)
case VLC_FOURCC('R','G','B','2'): case VLC_FOURCC('R','G','B','2'):
p_filter->pf_video_filter_io = I420_RGB8; p_filter->pf_video_filter = I420_RGB8_Filter;
break; break;
#endif #endif
case VLC_FOURCC('R','V','1','5'): case VLC_FOURCC('R','V','1','5'):
...@@ -126,7 +126,7 @@ static int Activate( vlc_object_t *p_this ) ...@@ -126,7 +126,7 @@ static int Activate( vlc_object_t *p_this )
{ {
/* R5G5B6 pixel format */ /* R5G5B6 pixel format */
msg_Dbg(p_this, "RGB pixel format is R5G5B5"); 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 else if( ( p_filter->fmt_out.video.i_rmask == 0xf800
&& p_filter->fmt_out.video.i_gmask == 0x07e0 && p_filter->fmt_out.video.i_gmask == 0x07e0
...@@ -134,13 +134,13 @@ static int Activate( vlc_object_t *p_this ) ...@@ -134,13 +134,13 @@ static int Activate( vlc_object_t *p_this )
{ {
/* R5G6B5 pixel format */ /* R5G6B5 pixel format */
msg_Dbg(p_this, "RGB pixel format is R5G6B5"); 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 else
return VLC_EGENERIC; return VLC_EGENERIC;
#else #else
// generic C chroma converter */ // generic C chroma converter */
p_filter->pf_video_filter_io = I420_RGB16; p_filter->pf_video_filter = I420_RGB16_Filter;
#endif #endif
break; break;
...@@ -158,7 +158,7 @@ static int Activate( vlc_object_t *p_this ) ...@@ -158,7 +158,7 @@ static int Activate( vlc_object_t *p_this )
{ {
/* A8R8G8B8 pixel format */ /* A8R8G8B8 pixel format */
msg_Dbg(p_this, "RGB pixel format is A8R8G8B8"); 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 else if( p_filter->fmt_out.video.i_rmask == 0xff000000
&& p_filter->fmt_out.video.i_gmask == 0x00ff0000 && p_filter->fmt_out.video.i_gmask == 0x00ff0000
...@@ -166,7 +166,7 @@ static int Activate( vlc_object_t *p_this ) ...@@ -166,7 +166,7 @@ static int Activate( vlc_object_t *p_this )
{ {
/* R8G8B8A8 pixel format */ /* R8G8B8A8 pixel format */
msg_Dbg(p_this, "RGB pixel format is R8G8B8A8"); 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 else if( p_filter->fmt_out.video.i_rmask == 0x0000ff00
&& p_filter->fmt_out.video.i_gmask == 0x00ff0000 && p_filter->fmt_out.video.i_gmask == 0x00ff0000
...@@ -174,7 +174,7 @@ static int Activate( vlc_object_t *p_this ) ...@@ -174,7 +174,7 @@ static int Activate( vlc_object_t *p_this )
{ {
/* B8G8R8A8 pixel format */ /* B8G8R8A8 pixel format */
msg_Dbg(p_this, "RGB pixel format is B8G8R8A8"); 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 else if( p_filter->fmt_out.video.i_rmask == 0x000000ff
&& p_filter->fmt_out.video.i_gmask == 0x0000ff00 && p_filter->fmt_out.video.i_gmask == 0x0000ff00
...@@ -182,13 +182,13 @@ static int Activate( vlc_object_t *p_this ) ...@@ -182,13 +182,13 @@ static int Activate( vlc_object_t *p_this )
{ {
/* A8B8G8R8 pixel format */ /* A8B8G8R8 pixel format */
msg_Dbg(p_this, "RGB pixel format is A8B8G8R8"); 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 else
return VLC_EGENERIC; return VLC_EGENERIC;
#else #else
/* generic C chroma converter */ /* generic C chroma converter */
p_filter->pf_video_filter_io = I420_RGB32; p_filter->pf_video_filter = I420_RGB32_Filter;
#endif #endif
break; break;
...@@ -294,6 +294,19 @@ static void Deactivate( vlc_object_t *p_this ) ...@@ -294,6 +294,19 @@ static void Deactivate( vlc_object_t *p_this )
free( p_filter->p_sys ); 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) #if defined (MODULE_NAME_IS_i420_rgb)
/***************************************************************************** /*****************************************************************************
* SetGammaTable: return intensity table transformed by gamma curve. * SetGammaTable: return intensity table transformed by gamma curve.
......
...@@ -60,6 +60,10 @@ void I420_RGB8 ( filter_t *, picture_t *, picture_t * ); ...@@ -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_dither ( filter_t *, picture_t *, picture_t * );
void I420_RGB16 ( filter_t *, picture_t *, picture_t * ); void I420_RGB16 ( filter_t *, picture_t *, picture_t * );
void I420_RGB32 ( 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) #else // if defined(MODULE_NAME_IS_i420_rgb_mmx)
void I420_R5G5B5 ( filter_t *, picture_t *, picture_t * ); void I420_R5G5B5 ( filter_t *, picture_t *, picture_t * );
void I420_R5G6B5 ( 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 * ); ...@@ -67,6 +71,12 @@ void I420_A8R8G8B8 ( filter_t *, picture_t *, picture_t * );
void I420_R8G8B8A8 ( 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_B8G8R8A8 ( filter_t *, picture_t *, picture_t * );
void I420_A8B8G8R8 ( 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 #endif
/***************************************************************************** /*****************************************************************************
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
*****************************************************************************/ *****************************************************************************/
static int Activate ( vlc_object_t * ); static int Activate ( vlc_object_t * );
static void I420_YMGA ( filter_t *, picture_t *, picture_t * ); static void I420_YMGA ( filter_t *, picture_t *, picture_t * );
static picture_t *I420_YMGA_Filter( filter_t *, picture_t * );
/***************************************************************************** /*****************************************************************************
* Module descriptor * Module descriptor
...@@ -50,10 +51,10 @@ static void I420_YMGA ( filter_t *, picture_t *, picture_t * ); ...@@ -50,10 +51,10 @@ static void I420_YMGA ( filter_t *, picture_t *, picture_t * );
vlc_module_begin(); vlc_module_begin();
#if defined (MODULE_NAME_IS_i420_ymga) #if defined (MODULE_NAME_IS_i420_ymga)
set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) ); 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) #elif defined (MODULE_NAME_IS_i420_ymga_mmx)
set_description( N_("MMX conversions from " SRC_FOURCC " to " DEST_FOURCC) ); set_description( N_("MMX conversions from " SRC_FOURCC " to " DEST_FOURCC) );
set_capability( "chroma", 100 ); set_capability( "video filter2", 100 );
add_requirement( MMX ); add_requirement( MMX );
#endif #endif
set_callbacks( Activate, NULL ); set_callbacks( Activate, NULL );
...@@ -82,7 +83,7 @@ static int Activate( vlc_object_t *p_this ) ...@@ -82,7 +83,7 @@ static int Activate( vlc_object_t *p_this )
switch( p_filter->fmt_out.video.i_chroma ) switch( p_filter->fmt_out.video.i_chroma )
{ {
case VLC_FOURCC('Y','M','G','A'): case VLC_FOURCC('Y','M','G','A'):
p_filter->pf_video_filter_io = I420_YMGA; p_filter->pf_video_filter = I420_YMGA_Filter;
break; break;
default: default:
...@@ -99,6 +100,8 @@ static int Activate( vlc_object_t *p_this ) ...@@ -99,6 +100,8 @@ static int Activate( vlc_object_t *p_this )
/* Following functions are local */ /* 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 * I420_YMGA: planar YUV 4:2:0 to Matrox's planar/packed YUV 4:2:0
*****************************************************************************/ *****************************************************************************/
......
...@@ -61,12 +61,18 @@ static int Activate ( vlc_object_t * ); ...@@ -61,12 +61,18 @@ static int Activate ( vlc_object_t * );
static void I420_YUY2 ( filter_t *, picture_t *, picture_t * ); static void I420_YUY2 ( filter_t *, picture_t *, picture_t * );
static void I420_YVYU ( 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 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) #if !defined (MODULE_NAME_IS_i420_yuy2_altivec)
static void I420_IUYV ( filter_t *, picture_t *, picture_t * ); static void I420_IUYV ( filter_t *, picture_t *, picture_t * );
static void I420_cyuv ( 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 #endif
#if defined (MODULE_NAME_IS_i420_yuy2) #if defined (MODULE_NAME_IS_i420_yuy2)
static void I420_Y211 ( filter_t *, picture_t *, picture_t * ); static void I420_Y211 ( filter_t *, picture_t *, picture_t * );
static picture_t *I420_Y211_Filter ( filter_t *, picture_t * );
#endif #endif
#ifdef MODULE_NAME_IS_i420_yuy2_mmx #ifdef MODULE_NAME_IS_i420_yuy2_mmx
...@@ -81,19 +87,19 @@ static const uint64_t i_80w = 0x0000000080808080ULL; ...@@ -81,19 +87,19 @@ static const uint64_t i_80w = 0x0000000080808080ULL;
vlc_module_begin(); vlc_module_begin();
#if defined (MODULE_NAME_IS_i420_yuy2) #if defined (MODULE_NAME_IS_i420_yuy2)
set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) ); 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) #elif defined (MODULE_NAME_IS_i420_yuy2_mmx)
set_description( N_("MMX conversions from " SRC_FOURCC " to " DEST_FOURCC) ); set_description( N_("MMX conversions from " SRC_FOURCC " to " DEST_FOURCC) );
set_capability( "chroma", 100 ); set_capability( "video filter2", 100 );
add_requirement( MMX ); add_requirement( MMX );
#elif defined (MODULE_NAME_IS_i420_yuy2_sse2) #elif defined (MODULE_NAME_IS_i420_yuy2_sse2)
set_description( N_("SSE2 conversions from " SRC_FOURCC " to " DEST_FOURCC) ); set_description( N_("SSE2 conversions from " SRC_FOURCC " to " DEST_FOURCC) );
set_capability( "chroma", 120 ); set_capability( "video filter2", 120 );
add_requirement( SSE2 ); add_requirement( SSE2 );
#elif defined (MODULE_NAME_IS_i420_yuy2_altivec) #elif defined (MODULE_NAME_IS_i420_yuy2_altivec)
set_description( set_description(
_("AltiVec conversions from " SRC_FOURCC " to " DEST_FOURCC) ); _("AltiVec conversions from " SRC_FOURCC " to " DEST_FOURCC) );
set_capability( "chroma", 100 ); set_capability( "video filter2", 100 );
add_requirement( ALTIVEC ); add_requirement( ALTIVEC );
#endif #endif
set_callbacks( Activate, NULL ); set_callbacks( Activate, NULL );
...@@ -123,31 +129,31 @@ static int Activate( vlc_object_t *p_this ) ...@@ -123,31 +129,31 @@ static int Activate( vlc_object_t *p_this )
{ {
case VLC_FOURCC('Y','U','Y','2'): case VLC_FOURCC('Y','U','Y','2'):
case VLC_FOURCC('Y','U','N','V'): case VLC_FOURCC('Y','U','N','V'):
p_filter->pf_video_filter_io = I420_YUY2; p_filter->pf_video_filter = I420_YUY2_Filter;
break; break;
case VLC_FOURCC('Y','V','Y','U'): case VLC_FOURCC('Y','V','Y','U'):
p_filter->pf_video_filter_io = I420_YVYU; p_filter->pf_video_filter = I420_YVYU_Filter;
break; break;
case VLC_FOURCC('U','Y','V','Y'): case VLC_FOURCC('U','Y','V','Y'):
case VLC_FOURCC('U','Y','N','V'): case VLC_FOURCC('U','Y','N','V'):
case VLC_FOURCC('Y','4','2','2'): case VLC_FOURCC('Y','4','2','2'):
p_filter->pf_video_filter_io = I420_UYVY; p_filter->pf_video_filter = I420_UYVY_Filter;
break; break;
#if !defined (MODULE_NAME_IS_i420_yuy2_altivec) #if !defined (MODULE_NAME_IS_i420_yuy2_altivec)
case VLC_FOURCC('I','U','Y','V'): case VLC_FOURCC('I','U','Y','V'):
p_filter->pf_video_filter_io = I420_IUYV; p_filter->pf_video_filter = I420_IUYV_Filter;
break; break;
case VLC_FOURCC('c','y','u','v'): case VLC_FOURCC('c','y','u','v'):
p_filter->pf_video_filter_io = I420_cyuv; p_filter->pf_video_filter = I420_cyuv_Filter;
break; break;
#endif #endif
#if defined (MODULE_NAME_IS_i420_yuy2) #if defined (MODULE_NAME_IS_i420_yuy2)
case VLC_FOURCC('Y','2','1','1'): case VLC_FOURCC('Y','2','1','1'):
p_filter->pf_video_filter_io = I420_Y211; p_filter->pf_video_filter = I420_Y211_Filter;
break; break;
#endif #endif
...@@ -174,6 +180,17 @@ static inline unsigned long long read_cycles(void) ...@@ -174,6 +180,17 @@ static inline unsigned long long read_cycles(void)
#endif #endif
/* Following functions are local */ /* 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 * I420_YUY2: planar YUV 4:2:0 to packed YUYV 4:2:2
*****************************************************************************/ *****************************************************************************/
......
...@@ -46,13 +46,16 @@ static int Activate ( vlc_object_t * ); ...@@ -46,13 +46,16 @@ static int Activate ( vlc_object_t * );
static void I422_I420( filter_t *, picture_t *, picture_t * ); static void I422_I420( filter_t *, picture_t *, picture_t * );
static void I422_YV12( 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 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 * Module descriptor
*****************************************************************************/ *****************************************************************************/
vlc_module_begin(); vlc_module_begin();
set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) ); set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) );
set_capability( "chroma", 60 ); set_capability( "video filter2", 60 );
set_callbacks( Activate, NULL ); set_callbacks( Activate, NULL );
vlc_module_end(); vlc_module_end();
...@@ -80,15 +83,15 @@ static int Activate( vlc_object_t *p_this ) ...@@ -80,15 +83,15 @@ static int Activate( vlc_object_t *p_this )
case VLC_FOURCC('I','4','2','0'): case VLC_FOURCC('I','4','2','0'):
case VLC_FOURCC('I','Y','U','V'): case VLC_FOURCC('I','Y','U','V'):
case VLC_FOURCC('J','4','2','0'): case VLC_FOURCC('J','4','2','0'):
p_filter->pf_video_filter_io = I422_I420; p_filter->pf_video_filter = I422_I420_Filter;
break; break;
case VLC_FOURCC('Y','V','1','2'): case VLC_FOURCC('Y','V','1','2'):
p_filter->pf_video_filter_io = I422_YV12; p_filter->pf_video_filter = I422_YV12_Filter;
break; break;
case VLC_FOURCC('Y','U','V','A'): case VLC_FOURCC('Y','U','V','A'):
p_filter->pf_video_filter_io = I422_YUVA; p_filter->pf_video_filter = I422_YUVA_Filter;
break; break;
default: default:
...@@ -103,6 +106,9 @@ static int Activate( vlc_object_t *p_this ) ...@@ -103,6 +106,9 @@ static int Activate( vlc_object_t *p_this )
} }
/* Following functions are local */ /* 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 * I422_I420: planar YUV 4:2:2 to planar I420 4:2:0 Y:U:V
......
...@@ -54,9 +54,14 @@ static void I422_YVYU ( filter_t *, picture_t *, picture_t * ); ...@@ -54,9 +54,14 @@ static void I422_YVYU ( filter_t *, picture_t *, picture_t * );
static void I422_UYVY ( 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_IUYV ( filter_t *, picture_t *, picture_t * );
static void I422_cyuv ( 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) #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 #endif
/***************************************************************************** /*****************************************************************************
...@@ -65,14 +70,14 @@ static void I422_Y211 ( filter_t *, picture_t *, picture_t * ); ...@@ -65,14 +70,14 @@ static void I422_Y211 ( filter_t *, picture_t *, picture_t * );
vlc_module_begin(); vlc_module_begin();
#if defined (MODULE_NAME_IS_i422_yuy2) #if defined (MODULE_NAME_IS_i422_yuy2)
set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) ); 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) #elif defined (MODULE_NAME_IS_i422_yuy2_mmx)
set_description( N_("MMX conversions from " SRC_FOURCC " to " DEST_FOURCC) ); set_description( N_("MMX conversions from " SRC_FOURCC " to " DEST_FOURCC) );
set_capability( "chroma", 100 ); set_capability( "video filter2", 100 );
add_requirement( MMX ); add_requirement( MMX );
#elif defined (MODULE_NAME_IS_i422_yuy2_sse2) #elif defined (MODULE_NAME_IS_i422_yuy2_sse2)
set_description( N_("SSE2 conversions from " SRC_FOURCC " to " DEST_FOURCC) ); set_description( N_("SSE2 conversions from " SRC_FOURCC " to " DEST_FOURCC) );
set_capability( "chroma", 120 ); set_capability( "video filter2", 120 );
add_requirement( SSE2 ); add_requirement( SSE2 );
#endif #endif
set_callbacks( Activate, NULL ); set_callbacks( Activate, NULL );
...@@ -100,30 +105,30 @@ static int Activate( vlc_object_t *p_this ) ...@@ -100,30 +105,30 @@ static int Activate( vlc_object_t *p_this )
{ {
case VLC_FOURCC('Y','U','Y','2'): case VLC_FOURCC('Y','U','Y','2'):
case VLC_FOURCC('Y','U','N','V'): case VLC_FOURCC('Y','U','N','V'):
p_filter->pf_video_filter_io = I422_YUY2; p_filter->pf_video_filter = I422_YUY2_Filter;
break; break;
case VLC_FOURCC('Y','V','Y','U'): case VLC_FOURCC('Y','V','Y','U'):
p_filter->pf_video_filter_io = I422_YVYU; p_filter->pf_video_filter = I422_YVYU_Filter;
break; break;
case VLC_FOURCC('U','Y','V','Y'): case VLC_FOURCC('U','Y','V','Y'):
case VLC_FOURCC('U','Y','N','V'): case VLC_FOURCC('U','Y','N','V'):
case VLC_FOURCC('Y','4','2','2'): case VLC_FOURCC('Y','4','2','2'):
p_filter->pf_video_filter_io = I422_UYVY; p_filter->pf_video_filter = I422_UYVY_Filter;
break; break;
case VLC_FOURCC('I','U','Y','V'): case VLC_FOURCC('I','U','Y','V'):
p_filter->pf_video_filter_io = I422_IUYV; p_filter->pf_video_filter = I422_IUYV_Filter;
break; break;
case VLC_FOURCC('c','y','u','v'): case VLC_FOURCC('c','y','u','v'):
p_filter->pf_video_filter_io = I422_cyuv; p_filter->pf_video_filter = I422_cyuv_Filter;
break; break;
#if defined (MODULE_NAME_IS_i422_yuy2) #if defined (MODULE_NAME_IS_i422_yuy2)
case VLC_FOURCC('Y','2','1','1'): case VLC_FOURCC('Y','2','1','1'):
p_filter->pf_video_filter_io = I422_Y211; p_filter->pf_video_filter = I422_Y211_Filter;
break; break;
#endif #endif
...@@ -140,6 +145,15 @@ static int Activate( vlc_object_t *p_this ) ...@@ -140,6 +145,15 @@ static int Activate( vlc_object_t *p_this )
/* Following functions are local */ /* 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 * I422_YUY2: planar YUV 4:2:2 to packed YUY2 4:2:2
*****************************************************************************/ *****************************************************************************/
......
...@@ -47,12 +47,17 @@ static void YVYU_I420 ( filter_t *, picture_t *, picture_t * ); ...@@ -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 UYVY_I420 ( filter_t *, picture_t *, picture_t * );
static void cyuv_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 * Module descriptor
*****************************************************************************/ *****************************************************************************/
vlc_module_begin(); vlc_module_begin();
set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) ); set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) );
set_capability( "chroma", 80 ); set_capability( "video filter2", 80 );
set_callbacks( Activate, NULL ); set_callbacks( Activate, NULL );
vlc_module_end(); vlc_module_end();
...@@ -78,21 +83,21 @@ static int Activate( vlc_object_t *p_this ) ...@@ -78,21 +83,21 @@ static int Activate( vlc_object_t *p_this )
{ {
case VLC_FOURCC('Y','U','Y','2'): case VLC_FOURCC('Y','U','Y','2'):
case VLC_FOURCC('Y','U','N','V'): case VLC_FOURCC('Y','U','N','V'):
p_filter->pf_video_filter_io = YUY2_I420; p_filter->pf_video_filter = YUY2_I420_Filter;
break; break;
case VLC_FOURCC('Y','V','Y','U'): case VLC_FOURCC('Y','V','Y','U'):
p_filter->pf_video_filter_io = YVYU_I420; p_filter->pf_video_filter = YVYU_I420_Filter;
break; break;
case VLC_FOURCC('U','Y','V','Y'): case VLC_FOURCC('U','Y','V','Y'):
case VLC_FOURCC('U','Y','N','V'): case VLC_FOURCC('U','Y','N','V'):
case VLC_FOURCC('Y','4','2','2'): case VLC_FOURCC('Y','4','2','2'):
p_filter->pf_video_filter_io = UYVY_I420; p_filter->pf_video_filter = UYVY_I420_Filter;
break; break;
case VLC_FOURCC('c','y','u','v'): case VLC_FOURCC('c','y','u','v'):
p_filter->pf_video_filter_io = cyuv_I420; p_filter->pf_video_filter = cyuv_I420_Filter;
break; break;
default: default:
...@@ -107,6 +112,10 @@ static int Activate( vlc_object_t *p_this ) ...@@ -107,6 +112,10 @@ static int Activate( vlc_object_t *p_this )
} }
/* Following functions are local */ /* 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 * YUY2_I420: packed YUY2 4:2:2 to planar YUV 4:2:0
......
...@@ -46,13 +46,17 @@ static void YUY2_I422 ( filter_t *, picture_t *, picture_t * ); ...@@ -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 YVYU_I422 ( filter_t *, picture_t *, picture_t * );
static void UYVY_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 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 * Module descriptor
*****************************************************************************/ *****************************************************************************/
vlc_module_begin(); vlc_module_begin();
set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) ); set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) );
set_capability( "chroma", 80 ); set_capability( "video filter2", 80 );
set_callbacks( Activate, NULL ); set_callbacks( Activate, NULL );
vlc_module_end(); vlc_module_end();
...@@ -78,21 +82,21 @@ static int Activate( vlc_object_t *p_this ) ...@@ -78,21 +82,21 @@ static int Activate( vlc_object_t *p_this )
{ {
case VLC_FOURCC('Y','U','Y','2'): case VLC_FOURCC('Y','U','Y','2'):
case VLC_FOURCC('Y','U','N','V'): case VLC_FOURCC('Y','U','N','V'):
p_filter->pf_video_filter_io = YUY2_I422; p_filter->pf_video_filter = YUY2_I422_Filter;
break; break;
case VLC_FOURCC('Y','V','Y','U'): case VLC_FOURCC('Y','V','Y','U'):
p_filter->pf_video_filter_io = YVYU_I422; p_filter->pf_video_filter = YVYU_I422_Filter;
break; break;
case VLC_FOURCC('U','Y','V','Y'): case VLC_FOURCC('U','Y','V','Y'):
case VLC_FOURCC('U','Y','N','V'): case VLC_FOURCC('U','Y','N','V'):
case VLC_FOURCC('Y','4','2','2'): case VLC_FOURCC('Y','4','2','2'):
p_filter->pf_video_filter_io = UYVY_I422; p_filter->pf_video_filter = UYVY_I422_Filter;
break; break;
case VLC_FOURCC('c','y','u','v'): case VLC_FOURCC('c','y','u','v'):
p_filter->pf_video_filter_io = cyuv_I422; p_filter->pf_video_filter = cyuv_I422_Filter;
break; break;
default: default:
...@@ -108,6 +112,11 @@ static int Activate( vlc_object_t *p_this ) ...@@ -108,6 +112,11 @@ static int Activate( vlc_object_t *p_this )
/* Following functions are local */ /* 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 * YUY2_I422: packed YUY2 4:2:2 to planar YUV 4:2:2
*****************************************************************************/ *****************************************************************************/
......
...@@ -514,6 +514,13 @@ static void vout_Destructor( vlc_object_t * p_this ) ...@@ -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 * initialization. It returns 0 on success. Note that the thread's flag are not
* modified inside this function. * 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 ) static int InitThread( vout_thread_t *p_vout )
{ {
int i, i_aspect_x, i_aspect_y; int i, i_aspect_x, i_aspect_y;
...@@ -672,9 +679,9 @@ static int InitThread( vout_thread_t *p_vout ) ...@@ -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_lgshift = p_vout->output.i_lgshift;
p_chroma->fmt_out.video.i_rbshift = p_vout->output.i_rbshift; p_chroma->fmt_out.video.i_rbshift = p_vout->output.i_rbshift;
p_chroma->fmt_out.video.i_lbshift = p_vout->output.i_lbshift; 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", (char*)&p_chroma->fmt_in.video.i_chroma );
msg_Err( p_vout, "HOLA! %4.4s\n", (char*)&p_chroma->fmt_out.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, "chroma", NULL, 0 ); p_chroma->p_module = module_Need( p_chroma, "video filter2", NULL, 0 );
if( p_chroma->p_module == NULL ) if( p_chroma->p_module == NULL )
{ {
...@@ -687,6 +694,7 @@ static int InitThread( vout_thread_t *p_vout ) ...@@ -687,6 +694,7 @@ static int InitThread( vout_thread_t *p_vout )
vlc_mutex_unlock( &p_vout->change_lock ); vlc_mutex_unlock( &p_vout->change_lock );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
p_chroma->pf_vout_buffer_new = get_pic;
msg_Dbg( p_vout, "indirect render, mapping " msg_Dbg( p_vout, "indirect render, mapping "
"render pictures 0-%i to system pictures %i-%i", "render pictures 0-%i to system pictures %i-%i",
......
...@@ -378,7 +378,8 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -378,7 +378,8 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
} }
/* Convert image to the first direct buffer */ /* 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 */ /* Render subpictures on the first direct buffer */
spu_RenderSubpictures( p_vout->p_spu, &p_vout->fmt_out, p_tmp_pic, 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, ...@@ -398,7 +399,8 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
return NULL; return NULL;
/* Convert image to the first direct buffer */ /* 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 */ /* Render subpictures on the first direct buffer */
spu_RenderSubpictures( p_vout->p_spu, &p_vout->fmt_out, spu_RenderSubpictures( p_vout->p_spu, &p_vout->fmt_out,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment