[vlc-devel] [PATCH] Remove chroma conversions already handled by swscale
Rafaël Carré
rafael.carre at gmail.com
Mon Jun 28 23:01:40 CEST 2010
Require libswscale >= 0.5.0 in configure.ac
Remaining chromas unknown to libswscale:
- YVYU : Packed YUV 4:2:2, Y:V:Y:U
- IUYV : ?
- CYUV : 10-bit 4:2:2 Component YCbCr
- Y211 : Packed YUV 2:1:1, Y:U:Y:V
Should be possible to add to libswscale chroma converter:
- YUVA : Palettized RGB with palette element R:G:B
Briefly tested against a couple of movies, MMX and SSE2 modules still build
I made no speed comparison
Deleted files (the diff would be too big):
modules/mmx/i420_rgb_mmx.h
modules/video_chroma/
- grey_yuv.c
- i420_rgb.c
- i420_rgb.h
- i420_rgb16.c
- i420_rgb8.c
- i420_rgb_c.h
---
configure.ac | 8 +-
modules/mmx/Modules.am | 10 -
modules/sse2/Modules.am | 10 -
modules/video_chroma/Modules.am | 14 --
modules/video_chroma/i420_yuy2.c | 445 +-------------------------------------
modules/video_chroma/i422_i420.c | 46 +----
modules/video_chroma/i422_yuy2.c | 205 +-----------------
modules/video_chroma/i422_yuy2.h | 87 --------
modules/video_chroma/yuy2_i420.c | 152 +-------------
modules/video_chroma/yuy2_i422.c | 104 +---------
modules/video_filter/swscale.c | 19 +--
11 files changed, 16 insertions(+), 1084 deletions(-)
diff --git a/configure.ac b/configure.ac
index 1a428e7..90a4b69 100644
--- a/configure.ac
+++ b/configure.ac
@@ -227,7 +227,7 @@ case "${host_os}" in
LDFLAGS_save="${LDFLAGS_save} -Wl,-headerpad_max_install_names ${ARCH_flag}"; LDFLAGS="${LDFLAGS_save}"
VLC_ADD_LDFLAGS([mkv mp4 motion], [-Wl,-framework,IOKit,-framework,CoreFoundation])
VLC_ADD_LDFLAGS([libvlc vlc],[-Wl,-undefined,dynamic_lookup])
- VLC_ADD_LDFLAGS([avcodec avformat access_avio swscale postproc i420_rgb_mmx x264],[-Wl,-read_only_relocs,suppress])
+ VLC_ADD_LDFLAGS([avcodec avformat access_avio swscale postproc],[-Wl,-read_only_relocs,suppress])
VLC_ADD_CFLAGS([motion],[-fconstant-cfstrings])
VLC_ADD_LDFLAGS([libvlccore],[-Wl,-framework,CoreFoundation])
AC_ARG_ENABLE(macosx-defaults,
@@ -662,7 +662,7 @@ AC_CHECK_LIB(m,cos,[
VLC_ADD_LIBS([adjust wave ripple psychedelic gradient a52tofloat32 dtstofloat32 x264 goom visual panoramix rotate noise grain scene kate flac lua chorus_flanger],[-lm])
])
AC_CHECK_LIB(m,pow,[
- VLC_ADD_LIBS([avcodec avformat access_avio swscale postproc ffmpegaltivec i420_rgb faad twolame equalizer spatializer param_eq libvlccore freetype mod mpc dmo quicktime realvideo qt4],[-lm])
+ VLC_ADD_LIBS([avcodec avformat access_avio swscale postproc ffmpegaltivec faad twolame equalizer spatializer param_eq libvlccore freetype mod mpc dmo quicktime realvideo qt4],[-lm])
])
AC_CHECK_LIB(m,sqrt,[
VLC_ADD_LIBS([headphone_channel_mixer normvol audiobargraph_a speex mono colorthres extract ball],[-lm])
@@ -2791,7 +2791,7 @@ AC_ARG_ENABLE(swscale,
(default enabled)]))
if test "${enable_swscale}" != "no"
then
- PKG_CHECK_MODULES(SWSCALE,[libswscale],
+ PKG_CHECK_MODULES(SWSCALE, libswscale >= 0.5.0 ,
[
VLC_SAVE_FLAGS
CPPFLAGS="${CPPFLAGS} ${SWSCALE_CFLAGS}"
@@ -2802,7 +2802,7 @@ then
VLC_ADD_CFLAGS([swscale],[$SWSCALE_CFLAGS])
VLC_RESTORE_FLAGS
],[
- AC_MSG_ERROR([Could not find libswscale. Use --disable-swscale to ignore this error. Proper software scaling and some video chroma conversion will be missing.])
+ AC_MSG_ERROR([Could not find libswscale. Use --disable-swscale to ignore this error. Proper software scaling and video chroma conversion will be missing.])
])
fi
diff --git a/modules/mmx/Modules.am b/modules/mmx/Modules.am
index b2d4b11..d3a1f35 100644
--- a/modules/mmx/Modules.am
+++ b/modules/mmx/Modules.am
@@ -5,15 +5,6 @@ libmemcpymmx_plugin_la_CFLAGS = $(AM_CFLAGS)
libmemcpymmx_plugin_la_LIBADD = $(AM_LIBADD)
libmemcpymmx_plugin_la_DEPENDENCIES =
-libi420_rgb_mmx_plugin_la_SOURCES = \
- ../video_chroma/i420_rgb.c \
- ../video_chroma/i420_rgb.h \
- ../video_chroma/i420_rgb16.c \
- i420_rgb_mmx.h
-libi420_rgb_mmx_plugin_la_CFLAGS = $(AM_CFLAGS)
-libi420_rgb_mmx_plugin_la_LIBADD = $(AM_LIBADD)
-libi420_rgb_mmx_plugin_la_DEPENDENCIES =
-
libi420_yuy2_mmx_plugin_la_SOURCES = \
../video_chroma/i420_yuy2.c \
../video_chroma/i420_yuy2.h
@@ -30,7 +21,6 @@ libi422_yuy2_mmx_plugin_la_DEPENDENCIES =
libvlc_LTLIBRARIES += \
libmemcpymmx_plugin.la \
- libi420_rgb_mmx_plugin.la \
libi420_yuy2_mmx_plugin.la \
libi422_yuy2_mmx_plugin.la \
$(NULL)
diff --git a/modules/sse2/Modules.am b/modules/sse2/Modules.am
index 899634b..06be65b 100644
--- a/modules/sse2/Modules.am
+++ b/modules/sse2/Modules.am
@@ -1,14 +1,5 @@
AM_CFLAGS += $(SSE2_CFLAGS)
-libi420_rgb_sse2_plugin_la_SOURCES = \
- ../video_chroma/i420_rgb.c \
- ../video_chroma/i420_rgb.h \
- ../video_chroma/i420_rgb16.c \
- ../mmx/i420_rgb_mmx.h
-libi420_rgb_sse2_plugin_la_CFLAGS = $(AM_CFLAGS)
-libi420_rgb_sse2_plugin_la_LIBADD = $(AM_LIBADD)
-libi420_rgb_sse2_plugin_la_DEPENDENCIES =
-
libi420_yuy2_sse2_plugin_la_SOURCES = \
../video_chroma/i420_yuy2.c \
../video_chroma/i420_yuy2.h
@@ -24,7 +15,6 @@ libi422_yuy2_sse2_plugin_la_LIBADD = $(AM_LIBADD)
libi422_yuy2_sse2_plugin_la_DEPENDENCIES =
libvlc_LTLIBRARIES += \
- libi420_rgb_sse2_plugin.la \
libi420_yuy2_sse2_plugin.la \
libi422_yuy2_sse2_plugin.la \
$(NULL)
diff --git a/modules/video_chroma/Modules.am b/modules/video_chroma/Modules.am
index 32f965f..4553517 100644
--- a/modules/video_chroma/Modules.am
+++ b/modules/video_chroma/Modules.am
@@ -1,11 +1,3 @@
-SOURCES_i420_rgb = \
- i420_rgb.c \
- i420_rgb.h \
- i420_rgb8.c \
- i420_rgb16.c \
- i420_rgb_c.h \
- $(NULL)
-
SOURCES_i420_yuy2 = \
i420_yuy2.c \
i420_yuy2.h \
@@ -20,10 +12,6 @@ SOURCES_i422_i420 = \
i422_i420.c \
$(NULL)
-SOURCES_grey_yuv = \
- grey_yuv.c \
- $(NULL)
-
SOURCES_yuy2_i422 = \
yuy2_i422.c \
$(NULL)
@@ -33,11 +21,9 @@ SOURCES_yuy2_i420 = \
$(NULL)
libvlc_LTLIBRARIES += \
- libi420_rgb_plugin.la \
libi420_yuy2_plugin.la \
libi422_i420_plugin.la \
libi422_yuy2_plugin.la \
- libgrey_yuv_plugin.la \
libyuy2_i420_plugin.la \
libyuy2_i422_plugin.la \
$(NULL)
diff --git a/modules/video_chroma/i420_yuy2.c b/modules/video_chroma/i420_yuy2.c
index 57a7af6..880c3e9 100644
--- a/modules/video_chroma/i420_yuy2.c
+++ b/modules/video_chroma/i420_yuy2.c
@@ -43,13 +43,13 @@
#define SRC_FOURCC "I420,IYUV,YV12"
#if defined (MODULE_NAME_IS_i420_yuy2)
-# define DEST_FOURCC "YUY2,YUNV,YVYU,UYVY,UYNV,Y422,IUYV,cyuv,Y211"
+# define DEST_FOURCC "YUNV,YVYU,UYNV,Y422,IUYV,cyuv,Y211"
#elif defined (MODULE_NAME_IS_i420_yuy2_mmx)
-# define DEST_FOURCC "YUY2,YUNV,YVYU,UYVY,UYNV,Y422,IUYV,cyuv"
+# define DEST_FOURCC "YUNV,YVYU,UYNV,Y422,IUYV,cyuv"
#elif defined (MODULE_NAME_IS_i420_yuy2_sse2)
-# define DEST_FOURCC "YUY2,YUNV,YVYU,UYVY,UYNV,Y422,IUYV,cyuv"
+# define DEST_FOURCC "YUNV,YVYU,UYNV,Y422,IUYV,cyuv"
#elif defined (MODULE_NAME_IS_i420_yuy2_altivec)
-# define DEST_FOURCC "YUY2,YUNV,YVYU,UYVY,UYNV,Y422"
+# define DEST_FOURCC "YUNV,YVYU,UYNV,Y422"
#endif
/*****************************************************************************
@@ -57,12 +57,8 @@
*****************************************************************************/
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 * );
@@ -126,17 +122,9 @@ static int Activate( vlc_object_t *p_this )
case VLC_CODEC_I420:
switch( p_filter->fmt_out.video.i_chroma )
{
- case VLC_CODEC_YUYV:
- p_filter->pf_video_filter = I420_YUY2_Filter;
- break;
-
case VLC_CODEC_YVYU:
p_filter->pf_video_filter = I420_YVYU_Filter;
break;
-
- case VLC_CODEC_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 = I420_IUYV_Filter;
@@ -177,9 +165,7 @@ static inline unsigned long long read_cycles(void)
/* 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 )
VIDEO_FILTER_WRAPPER( I420_cyuv )
@@ -189,220 +175,6 @@ VIDEO_FILTER_WRAPPER( I420_Y211 )
#endif
/*****************************************************************************
- * I420_YUY2: planar YUV 4:2:0 to packed YUYV 4:2:2
- *****************************************************************************/
-static void I420_YUY2( filter_t *p_filter, picture_t *p_source,
- picture_t *p_dest )
-{
- uint8_t *p_line1, *p_line2 = p_dest->p->p_pixels;
- uint8_t *p_y1, *p_y2 = p_source->Y_PIXELS;
- uint8_t *p_u = p_source->U_PIXELS;
- uint8_t *p_v = p_source->V_PIXELS;
-
- int i_x, i_y;
-
-#if defined (MODULE_NAME_IS_i420_yuy2_altivec)
-#define VEC_NEXT_LINES( ) \
- p_line1 = p_line2; \
- p_line2 += p_dest->p->i_pitch; \
- p_y1 = p_y2; \
- p_y2 += p_source->p[Y_PLANE].i_pitch;
-
-#define VEC_LOAD_UV( ) \
- u_vec = vec_ld( 0, p_u ); p_u += 16; \
- v_vec = vec_ld( 0, p_v ); p_v += 16;
-
-#define VEC_MERGE( a ) \
- uv_vec = a( u_vec, v_vec ); \
- y_vec = vec_ld( 0, p_y1 ); p_y1 += 16; \
- vec_st( vec_mergeh( y_vec, uv_vec ), 0, p_line1 ); p_line1 += 16; \
- vec_st( vec_mergel( y_vec, uv_vec ), 0, p_line1 ); p_line1 += 16; \
- y_vec = vec_ld( 0, p_y2 ); p_y2 += 16; \
- vec_st( vec_mergeh( y_vec, uv_vec ), 0, p_line2 ); p_line2 += 16; \
- vec_st( vec_mergel( y_vec, uv_vec ), 0, p_line2 ); p_line2 += 16;
-
- vector unsigned char u_vec;
- vector unsigned char v_vec;
- vector unsigned char uv_vec;
- vector unsigned char y_vec;
-
- if( !( ( p_filter->fmt_in.video.i_width % 32 ) |
- ( p_filter->fmt_in.video.i_height % 2 ) ) )
- {
- /* Width is a multiple of 32, we take 2 lines at a time */
- for( i_y = p_filter->fmt_in.video.i_height / 2 ; i_y-- ; )
- {
- VEC_NEXT_LINES( );
- for( i_x = p_filter->fmt_in.video.i_width / 32 ; i_x-- ; )
- {
- VEC_LOAD_UV( );
- VEC_MERGE( vec_mergeh );
- VEC_MERGE( vec_mergel );
- }
- }
- }
- else if( !( ( p_filter->fmt_in.video.i_width % 16 ) |
- ( p_filter->fmt_in.video.i_height % 4 ) ) )
- {
- /* Width is only a multiple of 16, we take 4 lines at a time */
- for( i_y = p_filter->fmt_in.video.i_height / 4 ; i_y-- ; )
- {
- /* Line 1 and 2, pixels 0 to ( width - 16 ) */
- VEC_NEXT_LINES( );
- for( i_x = p_filter->fmt_in.video.i_width / 32 ; i_x-- ; )
- {
- VEC_LOAD_UV( );
- VEC_MERGE( vec_mergeh );
- VEC_MERGE( vec_mergel );
- }
-
- /* Line 1 and 2, pixels ( width - 16 ) to ( width ) */
- VEC_LOAD_UV( );
- VEC_MERGE( vec_mergeh );
-
- /* Line 3 and 4, pixels 0 to 16 */
- VEC_NEXT_LINES( );
- VEC_MERGE( vec_mergel );
-
- /* Line 3 and 4, pixels 16 to ( width ) */
- for( i_x = p_filter->fmt_in.video.i_width / 32 ; i_x-- ; )
- {
- VEC_LOAD_UV( );
- VEC_MERGE( vec_mergeh );
- VEC_MERGE( vec_mergel );
- }
- }
- }
- else
- {
- /* Crap, use the C version */
-#undef VEC_NEXT_LINES
-#undef VEC_LOAD_UV
-#undef VEC_MERGE
-#endif
-
- const int i_source_margin = p_source->p[0].i_pitch
- - p_source->p[0].i_visible_pitch;
- const int i_source_margin_c = p_source->p[1].i_pitch
- - p_source->p[1].i_visible_pitch;
- const int i_dest_margin = p_dest->p->i_pitch
- - p_dest->p->i_visible_pitch;
-
-#if !defined(MODULE_NAME_IS_i420_yuy2_sse2)
- for( i_y = p_filter->fmt_in.video.i_height / 2 ; i_y-- ; )
- {
- p_line1 = p_line2;
- p_line2 += p_dest->p->i_pitch;
-
- p_y1 = p_y2;
- p_y2 += p_source->p[Y_PLANE].i_pitch;
-
-#if !defined (MODULE_NAME_IS_i420_yuy2_mmx)
- for( i_x = p_filter->fmt_in.video.i_width / 8; i_x-- ; )
- {
- C_YUV420_YUYV( );
- C_YUV420_YUYV( );
- C_YUV420_YUYV( );
- C_YUV420_YUYV( );
- }
-#else
- for( i_x = p_filter->fmt_in.video.i_width / 8 ; i_x-- ; )
- {
- MMX_CALL( MMX_YUV420_YUYV );
- }
-#endif
- for( i_x = ( p_filter->fmt_in.video.i_width % 8 ) / 2; i_x-- ; )
- {
- C_YUV420_YUYV( );
- }
-
- p_y1 += i_source_margin;
- p_y2 += i_source_margin;
- p_u += i_source_margin_c;
- p_v += i_source_margin_c;
- p_line1 += i_dest_margin;
- p_line2 += i_dest_margin;
- }
-
-#if defined (MODULE_NAME_IS_i420_yuy2_mmx)
- /* re-enable FPU registers */
- MMX_END;
-#endif
-
-#if defined (MODULE_NAME_IS_i420_yuy2_altivec)
- }
-#endif
-
-#else // defined(MODULE_NAME_IS_i420_yuy2_sse2)
- /*
- ** SSE2 128 bits fetch/store instructions are faster
- ** if memory access is 16 bytes aligned
- */
-
- if( 0 == (15 & (p_source->p[Y_PLANE].i_pitch|p_dest->p->i_pitch|
- ((intptr_t)p_line2|(intptr_t)p_y2))) )
- {
- /* use faster SSE2 aligned fetch and store */
- for( i_y = p_filter->fmt_in.video.i_height / 2 ; i_y-- ; )
- {
- p_line1 = p_line2;
- p_line2 += p_dest->p->i_pitch;
-
- p_y1 = p_y2;
- p_y2 += p_source->p[Y_PLANE].i_pitch;
-
- for( i_x = p_filter->fmt_in.video.i_width / 16 ; i_x-- ; )
- {
- SSE2_CALL( SSE2_YUV420_YUYV_ALIGNED );
- }
- for( i_x = ( p_filter->fmt_in.video.i_width % 16 ) / 2; i_x-- ; )
- {
- C_YUV420_YUYV( );
- }
-
- p_y1 += i_source_margin;
- p_y2 += i_source_margin;
- p_u += i_source_margin_c;
- p_v += i_source_margin_c;
- p_line1 += i_dest_margin;
- p_line2 += i_dest_margin;
- }
- }
- else
- {
- /* use slower SSE2 unaligned fetch and store */
- for( i_y = p_filter->fmt_in.video.i_height / 2 ; i_y-- ; )
- {
- p_line1 = p_line2;
- p_line2 += p_dest->p->i_pitch;
-
- p_y1 = p_y2;
- p_y2 += p_source->p[Y_PLANE].i_pitch;
-
- for( i_x = p_filter->fmt_in.video.i_width / 16 ; i_x-- ; )
- {
- SSE2_CALL( SSE2_YUV420_YUYV_UNALIGNED );
- }
- for( i_x = ( p_filter->fmt_in.video.i_width % 16 ) / 2; i_x-- ; )
- {
- C_YUV420_YUYV( );
- }
-
- p_y1 += i_source_margin;
- p_y2 += i_source_margin;
- p_u += i_source_margin_c;
- p_v += i_source_margin_c;
- p_line1 += i_dest_margin;
- p_line2 += i_dest_margin;
- }
- }
- /* make sure all SSE2 stores are visible thereafter */
- SSE2_END;
-
-#endif // defined(MODULE_NAME_IS_i420_yuy2_sse2)
-}
-
-/*****************************************************************************
* I420_YVYU: planar YUV 4:2:0 to packed YVYU 4:2:2
*****************************************************************************/
static void I420_YVYU( filter_t *p_filter, picture_t *p_source,
@@ -611,215 +383,6 @@ static void I420_YVYU( filter_t *p_filter, picture_t *p_source,
#endif // defined(MODULE_NAME_IS_i420_yuy2_sse2)
}
-/*****************************************************************************
- * I420_UYVY: planar YUV 4:2:0 to packed UYVY 4:2:2
- *****************************************************************************/
-static void I420_UYVY( filter_t *p_filter, picture_t *p_source,
- picture_t *p_dest )
-{
- uint8_t *p_line1, *p_line2 = p_dest->p->p_pixels;
- uint8_t *p_y1, *p_y2 = p_source->Y_PIXELS;
- uint8_t *p_u = p_source->U_PIXELS;
- uint8_t *p_v = p_source->V_PIXELS;
-
- int i_x, i_y;
-
-#if defined (MODULE_NAME_IS_i420_yuy2_altivec)
-#define VEC_NEXT_LINES( ) \
- p_line1 = p_line2; \
- p_line2 += p_dest->p->i_pitch; \
- p_y1 = p_y2; \
- p_y2 += p_source->p[Y_PLANE].i_pitch;
-
-#define VEC_LOAD_UV( ) \
- u_vec = vec_ld( 0, p_u ); p_u += 16; \
- v_vec = vec_ld( 0, p_v ); p_v += 16;
-
-#define VEC_MERGE( a ) \
- uv_vec = a( u_vec, v_vec ); \
- y_vec = vec_ld( 0, p_y1 ); p_y1 += 16; \
- vec_st( vec_mergeh( uv_vec, y_vec ), 0, p_line1 ); p_line1 += 16; \
- vec_st( vec_mergel( uv_vec, y_vec ), 0, p_line1 ); p_line1 += 16; \
- y_vec = vec_ld( 0, p_y2 ); p_y2 += 16; \
- vec_st( vec_mergeh( uv_vec, y_vec ), 0, p_line2 ); p_line2 += 16; \
- vec_st( vec_mergel( uv_vec, y_vec ), 0, p_line2 ); p_line2 += 16;
-
- vector unsigned char u_vec;
- vector unsigned char v_vec;
- vector unsigned char uv_vec;
- vector unsigned char y_vec;
-
- if( !( ( p_filter->fmt_in.video.i_width % 32 ) |
- ( p_filter->fmt_in.video.i_height % 2 ) ) )
- {
- /* Width is a multiple of 32, we take 2 lines at a time */
- for( i_y = p_filter->fmt_in.video.i_height / 2 ; i_y-- ; )
- {
- VEC_NEXT_LINES( );
- for( i_x = p_filter->fmt_in.video.i_width / 32 ; i_x-- ; )
- {
- VEC_LOAD_UV( );
- VEC_MERGE( vec_mergeh );
- VEC_MERGE( vec_mergel );
- }
- }
- }
- else if( !( ( p_filter->fmt_in.video.i_width % 16 ) |
- ( p_filter->fmt_in.video.i_height % 4 ) ) )
- {
- /* Width is only a multiple of 16, we take 4 lines at a time */
- for( i_y = p_filter->fmt_in.video.i_height / 4 ; i_y-- ; )
- {
- /* Line 1 and 2, pixels 0 to ( width - 16 ) */
- VEC_NEXT_LINES( );
- for( i_x = p_filter->fmt_in.video.i_width / 32 ; i_x-- ; )
- {
- VEC_LOAD_UV( );
- VEC_MERGE( vec_mergeh );
- VEC_MERGE( vec_mergel );
- }
-
- /* Line 1 and 2, pixels ( width - 16 ) to ( width ) */
- VEC_LOAD_UV( );
- VEC_MERGE( vec_mergeh );
-
- /* Line 3 and 4, pixels 0 to 16 */
- VEC_NEXT_LINES( );
- VEC_MERGE( vec_mergel );
-
- /* Line 3 and 4, pixels 16 to ( width ) */
- for( i_x = p_filter->fmt_in.video.i_width / 32 ; i_x-- ; )
- {
- VEC_LOAD_UV( );
- VEC_MERGE( vec_mergeh );
- VEC_MERGE( vec_mergel );
- }
- }
- }
- else
- {
- /* Crap, use the C version */
-#undef VEC_NEXT_LINES
-#undef VEC_LOAD_UV
-#undef VEC_MERGE
-#endif
-
- const int i_source_margin = p_source->p[0].i_pitch
- - p_source->p[0].i_visible_pitch;
- const int i_source_margin_c = p_source->p[1].i_pitch
- - p_source->p[1].i_visible_pitch;
- const int i_dest_margin = p_dest->p->i_pitch
- - p_dest->p->i_visible_pitch;
-
-#if !defined(MODULE_NAME_IS_i420_yuy2_sse2)
- for( i_y = p_filter->fmt_in.video.i_height / 2 ; i_y-- ; )
- {
- p_line1 = p_line2;
- p_line2 += p_dest->p->i_pitch;
-
- p_y1 = p_y2;
- p_y2 += p_source->p[Y_PLANE].i_pitch;
-
- for( i_x = p_filter->fmt_in.video.i_width / 8 ; i_x-- ; )
- {
-#if !defined (MODULE_NAME_IS_i420_yuy2_mmx)
- C_YUV420_UYVY( );
- C_YUV420_UYVY( );
- C_YUV420_UYVY( );
- C_YUV420_UYVY( );
-#else
- MMX_CALL( MMX_YUV420_UYVY );
-#endif
- }
- for( i_x = ( p_filter->fmt_in.video.i_width % 8 ) / 2; i_x--; )
- {
- C_YUV420_UYVY( );
- }
-
- p_y1 += i_source_margin;
- p_y2 += i_source_margin;
- p_u += i_source_margin_c;
- p_v += i_source_margin_c;
- p_line1 += i_dest_margin;
- p_line2 += i_dest_margin;
- }
-
-#if defined (MODULE_NAME_IS_i420_yuy2_mmx)
- /* re-enable FPU registers */
- MMX_END;
-#endif
-
-#if defined (MODULE_NAME_IS_i420_yuy2_altivec)
- }
-#endif
-
-#else // defined(MODULE_NAME_IS_i420_yuy2_sse2)
- /*
- ** SSE2 128 bits fetch/store instructions are faster
- ** if memory access is 16 bytes aligned
- */
- if( 0 == (15 & (p_source->p[Y_PLANE].i_pitch|p_dest->p->i_pitch|
- ((intptr_t)p_line2|(intptr_t)p_y2))) )
- {
- /* use faster SSE2 aligned fetch and store */
- for( i_y = p_filter->fmt_in.video.i_height / 2 ; i_y-- ; )
- {
- p_line1 = p_line2;
- p_line2 += p_dest->p->i_pitch;
-
- p_y1 = p_y2;
- p_y2 += p_source->p[Y_PLANE].i_pitch;
-
- for( i_x = p_filter->fmt_in.video.i_width / 16 ; i_x-- ; )
- {
- SSE2_CALL( SSE2_YUV420_UYVY_ALIGNED );
- }
- for( i_x = ( p_filter->fmt_in.video.i_width % 16 ) / 2; i_x-- ; )
- {
- C_YUV420_UYVY( );
- }
-
- p_y1 += i_source_margin;
- p_y2 += i_source_margin;
- p_u += i_source_margin_c;
- p_v += i_source_margin_c;
- p_line1 += i_dest_margin;
- p_line2 += i_dest_margin;
- }
- }
- else
- {
- /* use slower SSE2 unaligned fetch and store */
- for( i_y = p_filter->fmt_in.video.i_height / 2 ; i_y-- ; )
- {
- p_line1 = p_line2;
- p_line2 += p_dest->p->i_pitch;
-
- p_y1 = p_y2;
- p_y2 += p_source->p[Y_PLANE].i_pitch;
-
- for( i_x = p_filter->fmt_in.video.i_width / 16 ; i_x-- ; )
- {
- SSE2_CALL( SSE2_YUV420_UYVY_UNALIGNED );
- }
- for( i_x = ( p_filter->fmt_in.video.i_width % 16 ) / 2; i_x-- ; )
- {
- C_YUV420_UYVY( );
- }
-
- p_y1 += i_source_margin;
- p_y2 += i_source_margin;
- p_u += i_source_margin_c;
- p_v += i_source_margin_c;
- p_line1 += i_dest_margin;
- p_line2 += i_dest_margin;
- }
- }
- /* make sure all SSE2 stores are visible thereafter */
- SSE2_END;
-#endif // defined(MODULE_NAME_IS_i420_yuy2_sse2)
-}
-
#if !defined (MODULE_NAME_IS_i420_yuy2_altivec)
/*****************************************************************************
* I420_IUYV: planar YUV 4:2:0 to interleaved packed UYVY 4:2:2
diff --git a/modules/video_chroma/i422_i420.c b/modules/video_chroma/i422_i420.c
index c929167..9efd85e 100644
--- a/modules/video_chroma/i422_i420.c
+++ b/modules/video_chroma/i422_i420.c
@@ -35,18 +35,14 @@
#include <vlc_filter.h>
#define SRC_FOURCC "I422,J422"
-#define DEST_FOURCC "I420,IYUV,J420,YV12,YUVA"
+#define DEST_FOURCC "YUVA"
/*****************************************************************************
* Local and extern prototypes.
*****************************************************************************/
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 * );
/*****************************************************************************
@@ -83,15 +79,6 @@ static int Activate( vlc_object_t *p_this )
case VLC_CODEC_J422:
switch( p_filter->fmt_out.video.i_chroma )
{
- case VLC_CODEC_I420:
- case VLC_CODEC_J420:
- p_filter->pf_video_filter = I422_I420_Filter;
- break;
-
- case VLC_CODEC_YV12:
- p_filter->pf_video_filter = I422_YV12_Filter;
- break;
-
case VLC_CODEC_YUVA:
p_filter->pf_video_filter = I422_YUVA_Filter;
break;
@@ -108,8 +95,6 @@ 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 )
/*****************************************************************************
@@ -142,35 +127,6 @@ static void I422_I420( filter_t *p_filter, picture_t *p_source,
}
/*****************************************************************************
- * I422_YV12: planar YUV 4:2:2 to planar YV12 4:2:0 Y:V:U
- *****************************************************************************/
-static void I422_YV12( filter_t *p_filter, picture_t *p_source,
- picture_t *p_dest )
-{
- uint16_t i_dpy = p_dest->p[Y_PLANE].i_pitch;
- uint16_t i_spy = p_source->p[Y_PLANE].i_pitch;
- uint16_t i_dpuv = p_dest->p[U_PLANE].i_pitch;
- uint16_t i_spuv = p_source->p[U_PLANE].i_pitch;
- uint16_t i_width = p_filter->fmt_in.video.i_width;
- uint16_t i_y = p_filter->fmt_in.video.i_height;
- uint8_t *p_dy = p_dest->Y_PIXELS + (i_y-1)*i_dpy;
- uint8_t *p_y = p_source->Y_PIXELS + (i_y-1)*i_spy;
- uint8_t *p_du = p_dest->V_PIXELS + (i_y/2-1)*i_dpuv; /* U and V are swapped */
- uint8_t *p_u = p_source->U_PIXELS + (i_y-1)*i_spuv;
- uint8_t *p_dv = p_dest->U_PIXELS + (i_y/2-1)*i_dpuv; /* U and V are swapped */
- uint8_t *p_v = p_source->V_PIXELS + (i_y-1)*i_spuv;
- i_y /= 2;
-
- for ( ; i_y--; )
- {
- vlc_memcpy(p_dy, p_y, i_width); p_dy -= i_dpy; p_y -= i_spy;
- vlc_memcpy(p_dy, p_y, i_width); p_dy -= i_dpy; p_y -= i_spy;
- vlc_memcpy(p_du, p_u, i_width/2); p_du -= i_dpuv; p_u -= 2*i_spuv;
- vlc_memcpy(p_dv, p_v, i_width/2); p_dv -= i_dpuv; p_v -= 2*i_spuv;
- }
-}
-
-/*****************************************************************************
* I422_YUVA: planar YUV 4:2:2 to planar YUVA 4:2:0:4 Y:U:V:A
*****************************************************************************/
static void I422_YUVA( filter_t *p_filter, picture_t *p_source,
diff --git a/modules/video_chroma/i422_yuy2.c b/modules/video_chroma/i422_yuy2.c
index fc426ff..32c8490 100644
--- a/modules/video_chroma/i422_yuy2.c
+++ b/modules/video_chroma/i422_yuy2.c
@@ -38,9 +38,9 @@
#define SRC_FOURCC "I422"
#if defined (MODULE_NAME_IS_i422_yuy2)
-# define DEST_FOURCC "YUY2,YUNV,YVYU,UYVY,UYNV,Y422,IUYV,cyuv,Y211"
+# define DEST_FOURCC "YVYU,IUYV,cyuv,Y211"
#else
-# define DEST_FOURCC "YUY2,YUNV,YVYU,UYVY,UYNV,Y422,IUYV,cyuv"
+# define DEST_FOURCC "YVYU,IUYV,cyuv"
#endif
/*****************************************************************************
@@ -48,14 +48,10 @@
*****************************************************************************/
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 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)
@@ -100,18 +96,11 @@ static int Activate( vlc_object_t *p_this )
case VLC_CODEC_I422:
switch( p_filter->fmt_out.video.i_chroma )
{
- case VLC_CODEC_YUYV:
- p_filter->pf_video_filter = I422_YUY2_Filter;
- break;
-
case VLC_CODEC_YVYU:
p_filter->pf_video_filter = I422_YVYU_Filter;
break;
- case VLC_CODEC_UYVY:
- p_filter->pf_video_filter = I422_UYVY_Filter;
- break;
-
+ case VLC_FOURCC('I','U','Y','V'):
p_filter->pf_video_filter = I422_IUYV_Filter;
break;
@@ -138,9 +127,7 @@ 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)
@@ -148,99 +135,6 @@ VIDEO_FILTER_WRAPPER( I422_Y211 )
#endif
/*****************************************************************************
- * I422_YUY2: planar YUV 4:2:2 to packed YUY2 4:2:2
- *****************************************************************************/
-static void I422_YUY2( filter_t *p_filter, picture_t *p_source,
- picture_t *p_dest )
-{
- uint8_t *p_line = p_dest->p->p_pixels;
- uint8_t *p_y = p_source->Y_PIXELS;
- uint8_t *p_u = p_source->U_PIXELS;
- uint8_t *p_v = p_source->V_PIXELS;
-
- int i_x, i_y;
-
- const int i_source_margin = p_source->p[0].i_pitch
- - p_source->p[0].i_visible_pitch;
- const int i_source_margin_c = p_source->p[1].i_pitch
- - p_source->p[1].i_visible_pitch;
- const int i_dest_margin = p_dest->p->i_pitch
- - p_dest->p->i_visible_pitch;
-
-#if defined (MODULE_NAME_IS_i422_yuy2_sse2)
-
- if( 0 == (15 & (p_source->p[Y_PLANE].i_pitch|p_dest->p->i_pitch|
- ((intptr_t)p_line|(intptr_t)p_y))) )
- {
- /* use faster SSE2 aligned fetch and store */
- for( i_y = p_filter->fmt_in.video.i_height ; i_y-- ; )
- {
- for( i_x = p_filter->fmt_in.video.i_width / 16 ; i_x-- ; )
- {
- SSE2_CALL( SSE2_YUV422_YUYV_ALIGNED );
- }
- for( i_x = ( p_filter->fmt_in.video.i_width % 16 ) / 2; i_x-- ; )
- {
- C_YUV422_YUYV( p_line, p_y, p_u, p_v );
- }
- p_y += i_source_margin;
- p_u += i_source_margin_c;
- p_v += i_source_margin_c;
- p_line += i_dest_margin;
- }
- }
- else {
- /* use slower SSE2 unaligned fetch and store */
- for( i_y = p_filter->fmt_in.video.i_height ; i_y-- ; )
- {
- for( i_x = p_filter->fmt_in.video.i_width / 16 ; i_x-- ; )
- {
- SSE2_CALL( SSE2_YUV422_YUYV_UNALIGNED );
- }
- for( i_x = ( p_filter->fmt_in.video.i_width % 16 ) / 2; i_x-- ; )
- {
- C_YUV422_YUYV( p_line, p_y, p_u, p_v );
- }
- p_y += i_source_margin;
- p_u += i_source_margin_c;
- p_v += i_source_margin_c;
- p_line += i_dest_margin;
- }
- }
- SSE2_END;
-
-#else
-
- for( i_y = p_filter->fmt_in.video.i_height ; i_y-- ; )
- {
- for( i_x = p_filter->fmt_in.video.i_width / 8 ; i_x-- ; )
- {
-#if defined (MODULE_NAME_IS_i422_yuy2)
- C_YUV422_YUYV( p_line, p_y, p_u, p_v );
- C_YUV422_YUYV( p_line, p_y, p_u, p_v );
- C_YUV422_YUYV( p_line, p_y, p_u, p_v );
- C_YUV422_YUYV( p_line, p_y, p_u, p_v );
-#elif defined (MODULE_NAME_IS_i422_yuy2_mmx)
- MMX_CALL( MMX_YUV422_YUYV );
-#endif
- }
- for( i_x = ( p_filter->fmt_in.video.i_width % 8 ) / 2; i_x-- ; )
- {
- C_YUV422_YUYV( p_line, p_y, p_u, p_v );
- }
- p_y += i_source_margin;
- p_u += i_source_margin_c;
- p_v += i_source_margin_c;
- p_line += i_dest_margin;
- }
-#if defined (MODULE_NAME_IS_i422_yuy2_mmx)
- MMX_END;
-#endif
-
-#endif
-}
-
-/*****************************************************************************
* I422_YVYU: planar YUV 4:2:2 to packed YVYU 4:2:2
*****************************************************************************/
static void I422_YVYU( filter_t *p_filter, picture_t *p_source,
@@ -334,99 +228,6 @@ static void I422_YVYU( filter_t *p_filter, picture_t *p_source,
}
/*****************************************************************************
- * I422_UYVY: planar YUV 4:2:2 to packed UYVY 4:2:2
- *****************************************************************************/
-static void I422_UYVY( filter_t *p_filter, picture_t *p_source,
- picture_t *p_dest )
-{
- uint8_t *p_line = p_dest->p->p_pixels;
- uint8_t *p_y = p_source->Y_PIXELS;
- uint8_t *p_u = p_source->U_PIXELS;
- uint8_t *p_v = p_source->V_PIXELS;
-
- int i_x, i_y;
-
- const int i_source_margin = p_source->p[0].i_pitch
- - p_source->p[0].i_visible_pitch;
- const int i_source_margin_c = p_source->p[1].i_pitch
- - p_source->p[1].i_visible_pitch;
- const int i_dest_margin = p_dest->p->i_pitch
- - p_dest->p->i_visible_pitch;
-
-#if defined (MODULE_NAME_IS_i422_yuy2_sse2)
-
- if( 0 == (15 & (p_source->p[Y_PLANE].i_pitch|p_dest->p->i_pitch|
- ((intptr_t)p_line|(intptr_t)p_y))) )
- {
- /* use faster SSE2 aligned fetch and store */
- for( i_y = p_filter->fmt_in.video.i_height ; i_y-- ; )
- {
- for( i_x = p_filter->fmt_in.video.i_width / 16 ; i_x-- ; )
- {
- SSE2_CALL( SSE2_YUV422_UYVY_ALIGNED );
- }
- for( i_x = ( p_filter->fmt_in.video.i_width % 16 ) / 2; i_x-- ; )
- {
- C_YUV422_UYVY( p_line, p_y, p_u, p_v );
- }
- p_y += i_source_margin;
- p_u += i_source_margin_c;
- p_v += i_source_margin_c;
- p_line += i_dest_margin;
- }
- }
- else {
- /* use slower SSE2 unaligned fetch and store */
- for( i_y = p_filter->fmt_in.video.i_height ; i_y-- ; )
- {
- for( i_x = p_filter->fmt_in.video.i_width / 16 ; i_x-- ; )
- {
- SSE2_CALL( SSE2_YUV422_UYVY_UNALIGNED );
- }
- for( i_x = ( p_filter->fmt_in.video.i_width % 16 ) / 2; i_x-- ; )
- {
- C_YUV422_UYVY( p_line, p_y, p_u, p_v );
- }
- p_y += i_source_margin;
- p_u += i_source_margin_c;
- p_v += i_source_margin_c;
- p_line += i_dest_margin;
- }
- }
- SSE2_END;
-
-#else
-
- for( i_y = p_filter->fmt_in.video.i_height ; i_y-- ; )
- {
- for( i_x = p_filter->fmt_in.video.i_width / 8 ; i_x-- ; )
- {
-#if defined (MODULE_NAME_IS_i422_yuy2)
- C_YUV422_UYVY( p_line, p_y, p_u, p_v );
- C_YUV422_UYVY( p_line, p_y, p_u, p_v );
- C_YUV422_UYVY( p_line, p_y, p_u, p_v );
- C_YUV422_UYVY( p_line, p_y, p_u, p_v );
-#elif defined (MODULE_NAME_IS_i422_yuy2_mmx)
- MMX_CALL( MMX_YUV422_UYVY );
-#endif
- }
- for( i_x = ( p_filter->fmt_in.video.i_width % 8 ) / 2; i_x-- ; )
- {
- C_YUV422_UYVY( p_line, p_y, p_u, p_v );
- }
- p_y += i_source_margin;
- p_u += i_source_margin_c;
- p_v += i_source_margin_c;
- p_line += i_dest_margin;
- }
-#if defined (MODULE_NAME_IS_i422_yuy2_mmx)
- MMX_END;
-#endif
-
-#endif
-}
-
-/*****************************************************************************
* I422_IUYV: planar YUV 4:2:2 to interleaved packed IUYV 4:2:2
*****************************************************************************/
static void I422_IUYV( filter_t *p_filter, picture_t *p_source,
diff --git a/modules/video_chroma/i422_yuy2.h b/modules/video_chroma/i422_yuy2.h
index 52ad7e4..d76714b 100644
--- a/modules/video_chroma/i422_yuy2.h
+++ b/modules/video_chroma/i422_yuy2.h
@@ -42,18 +42,6 @@
#define MMX_END __asm__ __volatile__ ( "emms" )
-#define MMX_YUV422_YUYV " \n\
-movq (%1), %%mm0 # Load 8 Y y7 y6 y5 y4 y3 y2 y1 y0 \n\
-movd (%2), %%mm1 # Load 4 Cb 00 00 00 00 u3 u2 u1 u0 \n\
-movd (%3), %%mm2 # Load 4 Cr 00 00 00 00 v3 v2 v1 v0 \n\
-punpcklbw %%mm2, %%mm1 # v3 u3 v2 u2 v1 u1 v0 u0 \n\
-movq %%mm0, %%mm2 # y7 y6 y5 y4 y3 y2 y1 y0 \n\
-punpcklbw %%mm1, %%mm2 # v1 y3 u1 y2 v0 y1 u0 y0 \n\
-movq %%mm2, (%0) # Store low YUYV \n\
-punpckhbw %%mm1, %%mm0 # v3 y7 u3 y6 v2 y5 u2 y4 \n\
-movq %%mm0, 8(%0) # Store high YUYV \n\
-"
-
#define MMX_YUV422_YVYU " \n\
movq (%1), %%mm0 # Load 8 Y y7 y6 y5 y4 y3 y2 y1 y0 \n\
movd (%2), %%mm2 # Load 4 Cb 00 00 00 00 u3 u2 u1 u0 \n\
@@ -97,17 +85,6 @@ movq %%mm1, 8(%0) # Store high UYVY \n\
#define MMX_END _mm_empty()
-#define MMX_YUV422_YUYV \
- mm0 = (__m64)*(uint64_t*)p_y; \
- mm1 = _mm_cvtsi32_si64(*(int*)p_u); \
- mm2 = _mm_cvtsi32_si64(*(int*)p_v); \
- mm1 = _mm_unpacklo_pi8(mm1, mm2); \
- mm2 = mm0; \
- mm2 = _mm_unpacklo_pi8(mm2, mm1); \
- *(uint64_t*)p_line = (uint64_t)mm2; \
- mm0 = _mm_unpackhi_pi8(mm0, mm1); \
- *(uint64_t*)(p_line+8) = (uint64_t)mm0;
-
#define MMX_YUV422_YVYU \
mm0 = (__m64)*(uint64_t*)p_y; \
mm2 = _mm_cvtsi32_si64(*(int*)p_u); \
@@ -119,17 +96,6 @@ movq %%mm1, 8(%0) # Store high UYVY \n\
mm0 = _mm_unpackhi_pi8(mm0, mm1); \
*(uint64_t*)(p_line+8) = (uint64_t)mm0;
-#define MMX_YUV422_UYVY \
- mm0 = (__m64)*(uint64_t*)p_y; \
- mm1 = _mm_cvtsi32_si64(*(int*)p_u); \
- mm2 = _mm_cvtsi32_si64(*(int*)p_v); \
- mm1 = _mm_unpacklo_pi8(mm1, mm2); \
- mm2 = mm1; \
- mm2 = _mm_unpacklo_pi8(mm2, mm0); \
- *(uint64_t*)p_line = (uint64_t)mm2; \
- mm1 = _mm_unpackhi_pi8(mm1, mm0); \
- *(uint64_t*)(p_line+8) = (uint64_t)mm1;
-
#endif
#elif defined( MODULE_NAME_IS_i422_yuy2_sse2 )
@@ -152,31 +118,6 @@ movq %%mm1, 8(%0) # Store high UYVY \n\
#define SSE2_END __asm__ __volatile__ ( "sfence" ::: "memory" )
-#define SSE2_YUV422_YUYV_ALIGNED " \n\
-movdqa (%1), %%xmm0 # Load 8 Y y7 y6 y5 y4 y3 y2 y1 y0 \n\
-movq (%2), %%xmm1 # Load 4 Cb 00 00 00 00 u3 u2 u1 u0 \n\
-movq (%3), %%xmm2 # Load 4 Cr 00 00 00 00 v3 v2 v1 v0 \n\
-punpcklbw %%xmm2, %%xmm1 # v3 u3 v2 u2 v1 u1 v0 u0 \n\
-movdqa %%xmm0, %%xmm2 # y7 y6 y5 y4 y3 y2 y1 y0 \n\
-punpcklbw %%xmm1, %%xmm2 # v1 y3 u1 y2 v0 y1 u0 y0 \n\
-movntdq %%xmm2, (%0) # Store low YUYV \n\
-punpckhbw %%xmm1, %%xmm0 # v3 y7 u3 y6 v2 y5 u2 y4 \n\
-movntdq %%xmm0, 16(%0) # Store high YUYV \n\
-"
-
-#define SSE2_YUV422_YUYV_UNALIGNED " \n\
-movdqu (%1), %%xmm0 # Load 8 Y y7 y6 y5 y4 y3 y2 y1 y0 \n\
-movq (%2), %%xmm1 # Load 4 Cb 00 00 00 00 u3 u2 u1 u0 \n\
-movq (%3), %%xmm2 # Load 4 Cr 00 00 00 00 v3 v2 v1 v0 \n\
-prefetchnta (%0) # Tell CPU not to cache output YUYV data \n\
-punpcklbw %%xmm2, %%xmm1 # v3 u3 v2 u2 v1 u1 v0 u0 \n\
-movdqa %%xmm0, %%xmm2 # y7 y6 y5 y4 y3 y2 y1 y0 \n\
-punpcklbw %%xmm1, %%xmm2 # v1 y3 u1 y2 v0 y1 u0 y0 \n\
-movdqu %%xmm2, (%0) # Store low YUYV \n\
-punpckhbw %%xmm1, %%xmm0 # v3 y7 u3 y6 v2 y5 u2 y4 \n\
-movdqu %%xmm0, 16(%0) # Store high YUYV \n\
-"
-
#define SSE2_YUV422_YVYU_ALIGNED " \n\
movdqa (%1), %%xmm0 # Load 8 Y y7 y6 y5 y4 y3 y2 y1 y0 \n\
movq (%2), %%xmm2 # Load 4 Cb 00 00 00 00 u3 u2 u1 u0 \n\
@@ -243,28 +184,6 @@ movdqu %%xmm1, 16(%0) # Store high UYVY \n\
#define SSE2_END _mm_sfence()
-#define SSE2_YUV422_YUYV_ALIGNED \
- xmm0 = _mm_load_si128((__m128i *)p_y); \
- xmm1 = _mm_loadl_epi64((__m128i *)p_u); \
- xmm2 = _mm_loadl_epi64((__m128i *)p_v); \
- xmm1 = _mm_unpacklo_epi8(xmm1, xmm2); \
- xmm2 = xmm0; \
- xmm2 = _mm_unpacklo_epi8(xmm2, xmm1); \
- _mm_stream_si128((__m128i*)(p_line), xmm2); \
- xmm0 = _mm_unpackhi_epi8(xmm0, xmm1); \
- _mm_stream_si128((__m128i*)(p_line+16), xmm0);
-
-#define SSE2_YUV422_YUYV_UNALIGNED \
- xmm0 = _mm_loadu_si128((__m128i *)p_y); \
- xmm1 = _mm_loadl_epi64((__m128i *)p_u); \
- xmm2 = _mm_loadl_epi64((__m128i *)p_v); \
- xmm1 = _mm_unpacklo_epi8(xmm1, xmm2); \
- xmm2 = xmm0; \
- xmm2 = _mm_unpacklo_epi8(xmm2, xmm1); \
- _mm_storeu_si128((__m128i*)(p_line), xmm2); \
- xmm0 = _mm_unpackhi_epi8(xmm0, xmm1); \
- _mm_storeu_si128((__m128i*)(p_line+16), xmm0);
-
#define SSE2_YUV422_YVYU_ALIGNED \
xmm0 = _mm_load_si128((__m128i *)p_y); \
xmm2 = _mm_loadl_epi64((__m128i *)p_u); \
@@ -313,12 +232,6 @@ movdqu %%xmm1, 16(%0) # Store high UYVY \n\
#endif
-#define C_YUV422_YUYV( p_line, p_y, p_u, p_v ) \
- *(p_line)++ = *(p_y)++; \
- *(p_line)++ = *(p_u)++; \
- *(p_line)++ = *(p_y)++; \
- *(p_line)++ = *(p_v)++; \
-
#define C_YUV422_YVYU( p_line, p_y, p_u, p_v ) \
*(p_line)++ = *(p_y)++; \
*(p_line)++ = *(p_v)++; \
diff --git a/modules/video_chroma/yuy2_i420.c b/modules/video_chroma/yuy2_i420.c
index d5aef11..a4f582b 100644
--- a/modules/video_chroma/yuy2_i420.c
+++ b/modules/video_chroma/yuy2_i420.c
@@ -33,7 +33,7 @@
#include <vlc_plugin.h>
#include <vlc_filter.h>
-#define SRC_FOURCC "YUY2,YUNV,YVYU,UYVY,UYNV,Y422,cyuv"
+#define SRC_FOURCC "YVYU,cyuv"
#define DEST_FOURCC "I420"
/*****************************************************************************
@@ -41,14 +41,10 @@
*****************************************************************************/
static int Activate ( vlc_object_t * );
-static void YUY2_I420 ( filter_t *, picture_t *, picture_t * );
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 * );
/*****************************************************************************
@@ -84,18 +80,10 @@ static int Activate( vlc_object_t *p_this )
case VLC_CODEC_I420:
switch( p_filter->fmt_in.video.i_chroma )
{
- case VLC_CODEC_YUYV:
- p_filter->pf_video_filter = YUY2_I420_Filter;
- break;
-
case VLC_CODEC_YVYU:
p_filter->pf_video_filter = YVYU_I420_Filter;
break;
- case VLC_CODEC_UYVY:
- p_filter->pf_video_filter = UYVY_I420_Filter;
- break;
-
case VLC_CODEC_CYUV:
p_filter->pf_video_filter = cyuv_I420_Filter;
break;
@@ -112,80 +100,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
- *****************************************************************************/
-static void YUY2_I420( filter_t *p_filter, picture_t *p_source,
- picture_t *p_dest )
-{
- uint8_t *p_line = p_source->p->p_pixels;
-
- uint8_t *p_y = p_dest->Y_PIXELS;
- uint8_t *p_u = p_dest->U_PIXELS;
- uint8_t *p_v = p_dest->V_PIXELS;
-
- int i_x, i_y;
-
- const int i_dest_margin = p_dest->p[0].i_pitch
- - p_dest->p[0].i_visible_pitch;
- const int i_dest_margin_c = p_dest->p[1].i_pitch
- - p_dest->p[1].i_visible_pitch;
- const int i_source_margin = p_source->p->i_pitch
- - p_source->p->i_visible_pitch;
-
- bool b_skip = false;
-
- for( i_y = p_filter->fmt_out.video.i_height ; i_y-- ; )
- {
- if( b_skip )
- {
- for( i_x = p_filter->fmt_out.video.i_width / 8 ; i_x-- ; )
- {
- #define C_YUYV_YUV422_skip( p_line, p_y, p_u, p_v ) \
- *p_y++ = *p_line++; p_line++; \
- *p_y++ = *p_line++; p_line++
- C_YUYV_YUV422_skip( p_line, p_y, p_u, p_v );
- C_YUYV_YUV422_skip( p_line, p_y, p_u, p_v );
- C_YUYV_YUV422_skip( p_line, p_y, p_u, p_v );
- C_YUYV_YUV422_skip( p_line, p_y, p_u, p_v );
- }
- for( i_x = ( p_filter->fmt_out.video.i_width % 8 ) / 2; i_x-- ; )
- {
- C_YUYV_YUV422_skip( p_line, p_y, p_u, p_v );
- }
- }
- else
- {
- for( i_x = p_filter->fmt_out.video.i_width / 8 ; i_x-- ; )
- {
- #define C_YUYV_YUV422( p_line, p_y, p_u, p_v ) \
- *p_y++ = *p_line++; *p_u++ = *p_line++; \
- *p_y++ = *p_line++; *p_v++ = *p_line++
- C_YUYV_YUV422( p_line, p_y, p_u, p_v );
- C_YUYV_YUV422( p_line, p_y, p_u, p_v );
- C_YUYV_YUV422( p_line, p_y, p_u, p_v );
- C_YUYV_YUV422( p_line, p_y, p_u, p_v );
- }
- for( i_x = ( p_filter->fmt_out.video.i_width % 8 ) / 2; i_x-- ; )
- {
- C_YUYV_YUV422( p_line, p_y, p_u, p_v );
- }
- }
- p_line += i_source_margin;
- p_y += i_dest_margin;
- p_u += i_dest_margin_c;
- p_v += i_dest_margin_c;
-
- b_skip = !b_skip;
- }
-}
-
-/*****************************************************************************
* YVYU_I420: packed YVYU 4:2:2 to planar YUV 4:2:0
*****************************************************************************/
static void YVYU_I420( filter_t *p_filter, picture_t *p_source,
@@ -254,74 +172,6 @@ static void YVYU_I420( filter_t *p_filter, picture_t *p_source,
}
/*****************************************************************************
- * UYVY_I420: packed UYVY 4:2:2 to planar YUV 4:2:0
- *****************************************************************************/
-static void UYVY_I420( filter_t *p_filter, picture_t *p_source,
- picture_t *p_dest )
-{
- uint8_t *p_line = p_source->p->p_pixels;
-
- uint8_t *p_y = p_dest->Y_PIXELS;
- uint8_t *p_u = p_dest->U_PIXELS;
- uint8_t *p_v = p_dest->V_PIXELS;
-
- int i_x, i_y;
-
- const int i_dest_margin = p_dest->p[0].i_pitch
- - p_dest->p[0].i_visible_pitch;
- const int i_dest_margin_c = p_dest->p[1].i_pitch
- - p_dest->p[1].i_visible_pitch;
- const int i_source_margin = p_source->p->i_pitch
- - p_source->p->i_visible_pitch;
-
- bool b_skip = false;
-
- for( i_y = p_filter->fmt_out.video.i_height ; i_y-- ; )
- {
- if( b_skip )
- {
- for( i_x = p_filter->fmt_out.video.i_width / 8 ; i_x-- ; )
- {
- #define C_UYVY_YUV422_skip( p_line, p_y, p_u, p_v ) \
- *p_u++ = *p_line++; p_line++; \
- *p_v++ = *p_line++; p_line++
- C_UYVY_YUV422_skip( p_line, p_y, p_u, p_v );
- C_UYVY_YUV422_skip( p_line, p_y, p_u, p_v );
- C_UYVY_YUV422_skip( p_line, p_y, p_u, p_v );
- C_UYVY_YUV422_skip( p_line, p_y, p_u, p_v );
- }
- for( i_x = ( p_filter->fmt_out.video.i_width % 8 ) / 2; i_x-- ; )
- {
- C_UYVY_YUV422_skip( p_line, p_y, p_u, p_v );
- }
- }
- else
- {
- for( i_x = p_filter->fmt_out.video.i_width / 8 ; i_x-- ; )
- {
- #define C_UYVY_YUV422( p_line, p_y, p_u, p_v ) \
- *p_u++ = *p_line++; *p_y++ = *p_line++; \
- *p_v++ = *p_line++; *p_y++ = *p_line++
- C_UYVY_YUV422( p_line, p_y, p_u, p_v );
- C_UYVY_YUV422( p_line, p_y, p_u, p_v );
- C_UYVY_YUV422( p_line, p_y, p_u, p_v );
- C_UYVY_YUV422( p_line, p_y, p_u, p_v );
- }
- for( i_x = ( p_filter->fmt_out.video.i_width % 8 ) / 2; i_x-- ; )
- {
- C_UYVY_YUV422( p_line, p_y, p_u, p_v );
- }
- }
- p_line += i_source_margin;
- p_y += i_dest_margin;
- p_u += i_dest_margin_c;
- p_v += i_dest_margin_c;
-
- b_skip = !b_skip;
- }
-}
-
-/*****************************************************************************
* cyuv_I420: upside-down packed UYVY 4:2:2 to planar YUV 4:2:0
* FIXME
*****************************************************************************/
diff --git a/modules/video_chroma/yuy2_i422.c b/modules/video_chroma/yuy2_i422.c
index bcd6b1c..22af389 100644
--- a/modules/video_chroma/yuy2_i422.c
+++ b/modules/video_chroma/yuy2_i422.c
@@ -33,7 +33,7 @@
#include <vlc_plugin.h>
#include <vlc_filter.h>
-#define SRC_FOURCC "YUY2,YUNV,YVYU,UYVY,UYNV,Y422,cyuv"
+#define SRC_FOURCC "YVYU,cyuv"
#define DEST_FOURCC "I422"
/*****************************************************************************
@@ -41,13 +41,9 @@
*****************************************************************************/
static int Activate ( vlc_object_t * );
-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 * );
/*****************************************************************************
@@ -83,18 +79,10 @@ static int Activate( vlc_object_t *p_this )
case VLC_CODEC_I422:
switch( p_filter->fmt_in.video.i_chroma )
{
- case VLC_CODEC_YUYV:
- p_filter->pf_video_filter = YUY2_I422_Filter;
- break;
-
case VLC_CODEC_YVYU:
p_filter->pf_video_filter = YVYU_I422_Filter;
break;
- case VLC_CODEC_UYVY:
- p_filter->pf_video_filter = UYVY_I422_Filter;
- break;
-
case VLC_CODEC_CYUV:
p_filter->pf_video_filter = cyuv_I422_Filter;
break;
@@ -112,56 +100,10 @@ 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
- *****************************************************************************/
-static void YUY2_I422( filter_t *p_filter, picture_t *p_source,
- picture_t *p_dest )
-{
- uint8_t *p_line = p_source->p->p_pixels;
-
- uint8_t *p_y = p_dest->Y_PIXELS;
- uint8_t *p_u = p_dest->U_PIXELS;
- uint8_t *p_v = p_dest->V_PIXELS;
-
- int i_x, i_y;
-
- const int i_dest_margin = p_dest->p[0].i_pitch
- - p_dest->p[0].i_visible_pitch;
- const int i_dest_margin_c = p_dest->p[1].i_pitch
- - p_dest->p[1].i_visible_pitch;
- const int i_source_margin = p_source->p->i_pitch
- - p_source->p->i_visible_pitch;
-
- for( i_y = p_filter->fmt_out.video.i_height ; i_y-- ; )
- {
- for( i_x = p_filter->fmt_out.video.i_width / 8 ; i_x-- ; )
- {
-#define C_YUYV_YUV422( p_line, p_y, p_u, p_v ) \
- *p_y++ = *p_line++; *p_u++ = *p_line++; \
- *p_y++ = *p_line++; *p_v++ = *p_line++
- C_YUYV_YUV422( p_line, p_y, p_u, p_v );
- C_YUYV_YUV422( p_line, p_y, p_u, p_v );
- C_YUYV_YUV422( p_line, p_y, p_u, p_v );
- C_YUYV_YUV422( p_line, p_y, p_u, p_v );
- }
- for( i_x = ( p_filter->fmt_out.video.i_width % 8 ) / 2; i_x-- ; )
- {
- C_YUYV_YUV422( p_line, p_y, p_u, p_v );
- }
- p_line += i_source_margin;
- p_y += i_dest_margin;
- p_u += i_dest_margin_c;
- p_v += i_dest_margin_c;
- }
-}
-
-/*****************************************************************************
* YVYU_I422: packed YVYU 4:2:2 to planar YUV 4:2:2
*****************************************************************************/
static void YVYU_I422( filter_t *p_filter, picture_t *p_source,
@@ -206,50 +148,6 @@ static void YVYU_I422( filter_t *p_filter, picture_t *p_source,
}
/*****************************************************************************
- * UYVY_I422: packed UYVY 4:2:2 to planar YUV 4:2:2
- *****************************************************************************/
-static void UYVY_I422( filter_t *p_filter, picture_t *p_source,
- picture_t *p_dest )
-{
- uint8_t *p_line = p_source->p->p_pixels;
-
- uint8_t *p_y = p_dest->Y_PIXELS;
- uint8_t *p_u = p_dest->U_PIXELS;
- uint8_t *p_v = p_dest->V_PIXELS;
-
- int i_x, i_y;
-
- const int i_dest_margin = p_dest->p[0].i_pitch
- - p_dest->p[0].i_visible_pitch;
- const int i_dest_margin_c = p_dest->p[1].i_pitch
- - p_dest->p[1].i_visible_pitch;
- const int i_source_margin = p_source->p->i_pitch
- - p_source->p->i_visible_pitch;
-
- for( i_y = p_filter->fmt_out.video.i_height ; i_y-- ; )
- {
- for( i_x = p_filter->fmt_out.video.i_width / 8 ; i_x-- ; )
- {
-#define C_UYVY_YUV422( p_line, p_y, p_u, p_v ) \
- *p_u++ = *p_line++; *p_y++ = *p_line++; \
- *p_v++ = *p_line++; *p_y++ = *p_line++
- C_UYVY_YUV422( p_line, p_y, p_u, p_v );
- C_UYVY_YUV422( p_line, p_y, p_u, p_v );
- C_UYVY_YUV422( p_line, p_y, p_u, p_v );
- C_UYVY_YUV422( p_line, p_y, p_u, p_v );
- }
- for( i_x = ( p_filter->fmt_out.video.i_width % 8 ) / 2; i_x-- ; )
- {
- C_UYVY_YUV422( p_line, p_y, p_u, p_v );
- }
- p_line += i_source_margin;
- p_y += i_dest_margin;
- p_u += i_dest_margin_c;
- p_v += i_dest_margin_c;
- }
-}
-
-/*****************************************************************************
* cyuv_I422: upside-down packed UYVY 4:2:2 to planar YUV 4:2:2
* FIXME
*****************************************************************************/
diff --git a/modules/video_filter/swscale.c b/modules/video_filter/swscale.c
index 8c1d879..1d8b64f 100644
--- a/modules/video_filter/swscale.c
+++ b/modules/video_filter/swscale.c
@@ -76,8 +76,6 @@ vlc_module_begin ()
change_integer_list( pi_mode_values, ppsz_mode_descriptions, NULL )
vlc_module_end ()
-/* Version checking */
-#if LIBSWSCALE_VERSION_INT >= ((0<<16)+(5<<8)+0)
/****************************************************************************
* Local prototypes
****************************************************************************/
@@ -241,10 +239,10 @@ static int GetSwsCpuMask(void)
if( i_cpu & CPU_CAPABILITY_MMX )
i_sws_cpu |= SWS_CPU_CAPS_MMX;
-#if (LIBSWSCALE_VERSION_INT >= ((0<<16)+(5<<8)+0))
+
if( i_cpu & CPU_CAPABILITY_MMXEXT )
i_sws_cpu |= SWS_CPU_CAPS_MMX2;
-#endif
+
if( i_cpu & CPU_CAPABILITY_3DNOW )
i_sws_cpu |= SWS_CPU_CAPS_3DNOW;
@@ -638,16 +636,3 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
picture_Release( p_pic );
return p_pic_dst;
}
-
-#else /* LIBSWSCALE_VERSION_INT >= ((0<<16)+(5<<8)+0) */
-
-int OpenScaler( vlc_object_t *p_this )
-{
- return VLC_EGENERIC;
-}
-
-void CloseScaler( vlc_object_t *p_this )
-{
-}
-
-#endif /* LIBSWSCALE_VERSION_INT >= ((0<<16)+(5<<8)+0) */
--
1.7.0.4
More information about the vlc-devel
mailing list