VLC_ADD_PLUGINS([access_fake access_filter_timeshift access_filter_record access_filter_dump])
VLC_ADD_PLUGINS([gestures rc telnet hotkeys showintf marq podcast shout sap fake folder])
VLC_ADD_PLUGINS([rss mosaic wall motiondetect clone crop erase bluescreen alphamask gaussianblur])
- VLC_ADD_PLUGINS([i420_yuy2 i422_yuy2 i420_ymga i422_i420])
+ VLC_ADD_PLUGINS([i420_yuy2 i422_yuy2 i420_ymga i422_i420 yuy2_i422 yuy2_i420 chroma_chain])
VLC_ADD_PLUGINS([aout_file linear_resampler bandlimited_resampler])
VLC_ADD_PLUGINS([float32_mixer spdif_mixer simple_channel_mixer])
VLC_ADD_PLUGINS([dolby_surround_decoder headphone_channel_mixer normvol equalizer param_eq])
grey_yuv.c \
$(NULL)
+SOURCES_yuy2_i422 = \
+ yuy2_i422.c \
+ $(NULL)
+
+SOURCES_yuy2_i420 = \
+ yuy2_i420.c \
+ $(NULL)
+
+SOURCES_chroma_chain = \
+ chain.c \
+ $(NULL)
--- /dev/null
+/*****************************************************************************
+ * chain.c : chain multiple chroma modules as a last resort solution
+ *****************************************************************************
+ * Copyright (C) 2007 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Antoine Cellerier <dionoea at videolan dot org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+
+#include <vlc/vlc.h>
+#include <vlc_vout.h>
+
+/*****************************************************************************
+ * Local and extern prototypes.
+ *****************************************************************************/
+static int Activate ( vlc_object_t * );
+static void Destroy ( vlc_object_t * );
+static void Chain ( vout_thread_t *, picture_t *, picture_t * );
+
+/*****************************************************************************
+ * Module descriptor
+ *****************************************************************************/
+vlc_module_begin();
+ set_description( _("Chroma conversions using a chain of chroma conversion modules") );
+ set_capability( "chroma", 1 );
+ set_callbacks( Activate, Destroy );
+vlc_module_end();
+
+#define MAX_CHROMAS 2
+
+struct chroma_sys_t
+{
+ vlc_fourcc_t i_chroma;
+
+ vout_chroma_t chroma1;
+ vout_chroma_t chroma2;
+
+ picture_t *p_tmp;
+};
+
+static const vlc_fourcc_t pi_allowed_chromas[] = {
+ VLC_FOURCC('I','4','2','0'),
+ VLC_FOURCC('I','4','2','2'),
+ 0
+};
+
+/*****************************************************************************
+ * Activate: allocate a chroma function
+ *****************************************************************************
+ * This function allocates and initializes a chroma function
+ *****************************************************************************/
+static int Activate( vlc_object_t *p_this )
+{
+ static int hack = 0;
+ vout_thread_t *p_vout = (vout_thread_t *)p_this;
+
+ if( hack )
+ {
+ msg_Err( p_this, "Preventing chain chroma reccursion" );
+ return VLC_EGENERIC;
+ }
+
+ hack = 1;
+
+ chroma_sys_t *p_sys = (chroma_sys_t *)malloc( sizeof( chroma_sys_t ) );
+ if( !p_sys )
+ {
+ hack = 0;
+ return VLC_ENOMEM;
+ }
+ memset( p_sys, 0, sizeof( chroma_sys_t ) );
+
+ int i;
+ vlc_fourcc_t i_output_chroma = p_vout->output.i_chroma;
+ vlc_fourcc_t i_render_chroma = p_vout->render.i_chroma;
+
+ for( i = 0; pi_allowed_chromas[i]; i++ )
+ {
+ msg_Warn( p_vout, "Trying %4s as a chroma chain",
+ (const char *)&pi_allowed_chromas[i] );
+ p_vout->output.i_chroma = pi_allowed_chromas[i];
+ p_vout->chroma.p_module = module_Need( p_vout, "chroma", NULL, 0 );
+ p_vout->output.i_chroma = i_output_chroma;
+
+ if( !p_vout->chroma.p_module )
+ continue;
+
+ p_sys->chroma1 = p_vout->chroma;
+ memset( &p_vout->chroma, 0, sizeof( vout_chroma_t ) );
+
+ p_vout->render.i_chroma = pi_allowed_chromas[i];
+ p_vout->chroma.p_module = module_Need( p_vout, "chroma", NULL, 0 );
+ p_vout->render.i_chroma = i_render_chroma;
+
+ if( !p_vout->chroma.p_module )
+ {
+ p_vout->chroma = p_sys->chroma1;
+ module_Unneed( p_vout, p_vout->chroma.p_module );
+ continue;
+ }
+
+ p_sys->chroma2 = p_vout->chroma;
+ memset( &p_vout->chroma, 0, sizeof( vout_chroma_t ) );
+
+ p_sys->i_chroma = pi_allowed_chromas[i];
+ p_vout->chroma.pf_convert = Chain;
+ p_vout->chroma.p_sys = p_sys;
+ hack = 0;
+ return VLC_SUCCESS;
+ }
+
+ free( p_sys );
+ hack = 0;
+ return VLC_EGENERIC;
+}
+
+static void Destroy( vlc_object_t *p_this )
+{
+ vout_thread_t *p_vout = (vout_thread_t *)p_this;
+ vout_chroma_t chroma = p_vout->chroma;
+
+
+ p_vout->chroma = chroma.p_sys->chroma1;
+ module_Unneed( p_vout, p_vout->chroma.p_module );
+ p_vout->chroma = chroma.p_sys->chroma2;
+ module_Unneed( p_vout, p_vout->chroma.p_module );
+ p_vout->chroma = chroma;
+
+ if( chroma.p_sys->p_tmp )
+ {
+ free( chroma.p_sys->p_tmp->p_data_orig );
+ free( chroma.p_sys->p_tmp );
+ }
+ free( chroma.p_sys );
+}
+
+/*****************************************************************************
+ * Chain
+ *****************************************************************************/
+static void Chain( vout_thread_t *p_vout, picture_t *p_source,
+ picture_t *p_dest )
+{
+ chroma_sys_t *p_sys = p_vout->chroma.p_sys;
+
+ if( !p_sys->p_tmp )
+ {
+ picture_t *p_tmp = malloc( sizeof( picture_t ) );
+ vout_AllocatePicture( VLC_OBJECT( p_vout ), p_tmp,
+ p_sys->i_chroma,
+ p_source->p_heap->i_width,
+ p_source->p_heap->i_height,
+ p_source->p_heap->i_aspect );
+ if( !p_tmp )
+ return;
+ p_sys->p_tmp = p_tmp;
+ p_tmp->pf_release = NULL;
+ p_tmp->i_status = RESERVED_PICTURE;
+ p_tmp->p_sys = NULL;
+ }
+
+ p_sys->chroma1.pf_convert( p_vout, p_source, p_sys->p_tmp );
+ p_sys->chroma2.pf_convert( p_vout, p_sys->p_tmp, p_dest );
+}
--- /dev/null
+/*****************************************************************************
+ * yuy2_i420.c : Packed YUV 4:2:2 to Planar YUV conversion module for vlc
+ *****************************************************************************
+ * Copyright (C) 2007 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Antoine Cellerier <dionoea at videolan dot org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+
+#include <vlc/vlc.h>
+#include <vlc_vout.h>
+
+#define SRC_FOURCC "YUY2,YUNV,YVYU,UYVY,UYNV,Y422,cyuv"
+#define DEST_FOURCC "I420"
+
+/*****************************************************************************
+ * Local and extern prototypes.
+ *****************************************************************************/
+static int Activate ( vlc_object_t * );
+
+static void YUY2_I420 ( vout_thread_t *, picture_t *, picture_t * );
+static void YVYU_I420 ( vout_thread_t *, picture_t *, picture_t * );
+static void UYVY_I420 ( vout_thread_t *, picture_t *, picture_t * );
+static void cyuv_I420 ( vout_thread_t *, picture_t *, picture_t * );
+
+/*****************************************************************************
+ * Module descriptor
+ *****************************************************************************/
+vlc_module_begin();
+ set_description( _("Conversions from " SRC_FOURCC " to " DEST_FOURCC) );
+ set_capability( "chroma", 80 );
+ set_callbacks( Activate, NULL );
+vlc_module_end();
+
+/*****************************************************************************
+ * Activate: allocate a chroma function
+ *****************************************************************************
+ * This function allocates and initializes a chroma function
+ *****************************************************************************/
+static int Activate( vlc_object_t *p_this )
+{
+ vout_thread_t *p_vout = (vout_thread_t *)p_this;
+
+ if( p_vout->render.i_width & 1 || p_vout->render.i_height & 1 )
+ {
+ return -1;
+ }
+
+ switch( p_vout->output.i_chroma )
+ {
+ case VLC_FOURCC('I','4','2','0'):
+ switch( p_vout->render.i_chroma )
+ {
+ case VLC_FOURCC('Y','U','Y','2'):
+ case VLC_FOURCC('Y','U','N','V'):
+ p_vout->chroma.pf_convert = YUY2_I420;
+ break;
+
+ case VLC_FOURCC('Y','V','Y','U'):
+ p_vout->chroma.pf_convert = YVYU_I420;
+ break;
+
+ case VLC_FOURCC('U','Y','V','Y'):
+ case VLC_FOURCC('U','Y','N','V'):
+ case VLC_FOURCC('Y','4','2','2'):
+ p_vout->chroma.pf_convert = UYVY_I420;
+ break;
+
+ case VLC_FOURCC('c','y','u','v'):
+ p_vout->chroma.pf_convert = cyuv_I420;
+ break;
+
+ default:
+ return -1;
+ }
+ break;
+
+ default:
+ return -1;
+ }
+ return 0;
+}
+
+/* Following functions are local */
+
+/*****************************************************************************
+ * YUY2_I420: packed YUY2 4:2:2 to planar YUV 4:2:0
+ *****************************************************************************/
+static void YUY2_I420( vout_thread_t *p_vout, 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;
+
+ vlc_bool_t b_skip = VLC_FALSE;
+
+ for( i_y = p_vout->output.i_height ; i_y-- ; )
+ {
+ if( b_skip )
+ {
+ for( i_x = p_vout->output.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_vout->output.i_width % 8 ) / 2; i_x-- ; )
+ {
+ C_YUYV_YUV422_skip( p_line, p_y, p_u, p_v );
+ }
+ }
+ else
+ {
+ for( i_x = p_vout->output.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_vout->output.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( vout_thread_t *p_vout, 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;
+
+ vlc_bool_t b_skip = VLC_FALSE;
+
+ for( i_y = p_vout->output.i_height ; i_y-- ; )
+ {
+ if( b_skip )
+ {
+ for( i_x = p_vout->output.i_width / 8 ; i_x-- ; )
+ {
+ #define C_YVYU_YUV422_skip( p_line, p_y, p_u, p_v ) \
+ *p_y++ = *p_line++; p_line++; \
+ *p_y++ = *p_line++; p_line++
+ C_YVYU_YUV422_skip( p_line, p_y, p_u, p_v );
+ C_YVYU_YUV422_skip( p_line, p_y, p_u, p_v );
+ C_YVYU_YUV422_skip( p_line, p_y, p_u, p_v );
+ C_YVYU_YUV422_skip( p_line, p_y, p_u, p_v );
+ }
+ for( i_x = ( p_vout->output.i_width % 8 ) / 2; i_x-- ; )
+ {
+ C_YVYU_YUV422_skip( p_line, p_y, p_u, p_v );
+ }
+ }
+ else
+ {
+ for( i_x = p_vout->output.i_width / 8 ; i_x-- ; )
+ {
+ #define C_YVYU_YUV422( p_line, p_y, p_u, p_v ) \
+ *p_y++ = *p_line++; *p_v++ = *p_line++; \
+ *p_y++ = *p_line++; *p_u++ = *p_line++
+ C_YVYU_YUV422( p_line, p_y, p_u, p_v );
+ C_YVYU_YUV422( p_line, p_y, p_u, p_v );
+ C_YVYU_YUV422( p_line, p_y, p_u, p_v );
+ C_YVYU_YUV422( p_line, p_y, p_u, p_v );
+ }
+ for( i_x = ( p_vout->output.i_width % 8 ) / 2; i_x-- ; )
+ {
+ C_YVYU_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;
+ }
+}
+
+/*****************************************************************************
+ * UYVY_I420: packed UYVY 4:2:2 to planar YUV 4:2:0
+ *****************************************************************************/
+static void UYVY_I420( vout_thread_t *p_vout, 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;
+
+ vlc_bool_t b_skip = VLC_FALSE;
+
+ for( i_y = p_vout->output.i_height ; i_y-- ; )
+ {
+ if( b_skip )
+ {
+ for( i_x = p_vout->output.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_vout->output.i_width % 8 ) / 2; i_x-- ; )
+ {
+ C_UYVY_YUV422_skip( p_line, p_y, p_u, p_v );
+ }
+ }
+ else
+ {
+ for( i_x = p_vout->output.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_vout->output.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
+ *****************************************************************************/
+static void cyuv_I420( vout_thread_t *p_vout, 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;
+
+ vlc_bool_t b_skip = VLC_FALSE;
+
+ for( i_y = p_vout->output.i_height ; i_y-- ; )
+ {
+ if( b_skip )
+ {
+ for( i_x = p_vout->output.i_width / 8 ; i_x-- ; )
+ {
+ #define C_cyuv_YUV422_skip( p_line, p_y, p_u, p_v ) \
+ *p_y++ = *p_line++; p_line++; \
+ *p_y++ = *p_line++; p_line++
+ C_cyuv_YUV422_skip( p_line, p_y, p_u, p_v );
+ C_cyuv_YUV422_skip( p_line, p_y, p_u, p_v );
+ C_cyuv_YUV422_skip( p_line, p_y, p_u, p_v );
+ C_cyuv_YUV422_skip( p_line, p_y, p_u, p_v );
+ }
+ for( i_x = ( p_vout->output.i_width % 8 ) / 2; i_x-- ; )
+ {
+ C_cyuv_YUV422_skip( p_line, p_y, p_u, p_v );
+ }
+ }
+ else
+ {
+ for( i_x = p_vout->output.i_width / 8 ; i_x-- ; )
+ {
+ #define C_cyuv_YUV422( p_line, p_y, p_u, p_v ) \
+ *p_y++ = *p_line++; *p_v++ = *p_line++; \
+ *p_y++ = *p_line++; *p_u++ = *p_line++
+ C_cyuv_YUV422( p_line, p_y, p_u, p_v );
+ C_cyuv_YUV422( p_line, p_y, p_u, p_v );
+ C_cyuv_YUV422( p_line, p_y, p_u, p_v );
+ C_cyuv_YUV422( p_line, p_y, p_u, p_v );
+ }
+ for( i_x = ( p_vout->output.i_width % 8 ) / 2; i_x-- ; )
+ {
+ C_cyuv_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;
+ }
+}
--- /dev/null
+/*****************************************************************************
+ * yuy2_i422.c : Packed YUV 4:2:2 to Planar YUV conversion module for vlc
+ *****************************************************************************
+ * Copyright (C) 2007 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Antoine Cellerier <dionoea at videolan dot org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+
+#include <vlc/vlc.h>
+#include <vlc_vout.h>
+
+#define SRC_FOURCC "YUY2,YUNV,YVYU,UYVY,UYNV,Y422,cyuv"
+#define DEST_FOURCC "I422"
+
+/*****************************************************************************
+ * Local and extern prototypes.
+ *****************************************************************************/
+static int Activate ( vlc_object_t * );
+
+static void YUY2_I422 ( vout_thread_t *, picture_t *, picture_t * );
+static void YVYU_I422 ( vout_thread_t *, picture_t *, picture_t * );
+static void UYVY_I422 ( vout_thread_t *, picture_t *, picture_t * );
+static void cyuv_I422 ( vout_thread_t *, picture_t *, picture_t * );
+
+/*****************************************************************************
+ * Module descriptor
+ *****************************************************************************/
+vlc_module_begin();
+ set_description( _("Conversions from " SRC_FOURCC " to " DEST_FOURCC) );
+ set_capability( "chroma", 80 );
+ set_callbacks( Activate, NULL );
+vlc_module_end();
+
+/*****************************************************************************
+ * Activate: allocate a chroma function
+ *****************************************************************************
+ * This function allocates and initializes a chroma function
+ *****************************************************************************/
+static int Activate( vlc_object_t *p_this )
+{
+ vout_thread_t *p_vout = (vout_thread_t *)p_this;
+
+ if( p_vout->render.i_width & 1 || p_vout->render.i_height & 1 )
+ {
+ return -1;
+ }
+
+ switch( p_vout->output.i_chroma )
+ {
+ case VLC_FOURCC('I','4','2','2'):
+ switch( p_vout->render.i_chroma )
+ {
+ case VLC_FOURCC('Y','U','Y','2'):
+ case VLC_FOURCC('Y','U','N','V'):
+ p_vout->chroma.pf_convert = YUY2_I422;
+ break;
+
+ case VLC_FOURCC('Y','V','Y','U'):
+ p_vout->chroma.pf_convert = YVYU_I422;
+ break;
+
+ case VLC_FOURCC('U','Y','V','Y'):
+ case VLC_FOURCC('U','Y','N','V'):
+ case VLC_FOURCC('Y','4','2','2'):
+ p_vout->chroma.pf_convert = UYVY_I422;
+ break;
+
+ case VLC_FOURCC('c','y','u','v'):
+ p_vout->chroma.pf_convert = cyuv_I422;
+ break;
+
+ default:
+ return -1;
+ }
+ break;
+
+ default:
+ return -1;
+ }
+ return 0;
+}
+
+/* Following functions are local */
+
+/*****************************************************************************
+ * YUY2_I422: packed YUY2 4:2:2 to planar YUV 4:2:2
+ *****************************************************************************/
+static void YUY2_I422( vout_thread_t *p_vout, 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_vout->output.i_height ; i_y-- ; )
+ {
+ for( i_x = p_vout->output.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_vout->output.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( vout_thread_t *p_vout, 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_vout->output.i_height ; i_y-- ; )
+ {
+ for( i_x = p_vout->output.i_width / 8 ; i_x-- ; )
+ {
+#define C_YVYU_YUV422( p_line, p_y, p_u, p_v ) \
+ *p_y++ = *p_line++; *p_v++ = *p_line++; \
+ *p_y++ = *p_line++; *p_u++ = *p_line++
+ C_YVYU_YUV422( p_line, p_y, p_u, p_v );
+ C_YVYU_YUV422( p_line, p_y, p_u, p_v );
+ C_YVYU_YUV422( p_line, p_y, p_u, p_v );
+ C_YVYU_YUV422( p_line, p_y, p_u, p_v );
+ }
+ for( i_x = ( p_vout->output.i_width % 8 ) / 2; i_x-- ; )
+ {
+ C_YVYU_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;
+ }
+}
+
+/*****************************************************************************
+ * UYVY_I422: packed UYVY 4:2:2 to planar YUV 4:2:2
+ *****************************************************************************/
+static void UYVY_I422( vout_thread_t *p_vout, 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_vout->output.i_height ; i_y-- ; )
+ {
+ for( i_x = p_vout->output.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_vout->output.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
+ *****************************************************************************/
+static void cyuv_I422( vout_thread_t *p_vout, 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_vout->output.i_height ; i_y-- ; )
+ {
+ for( i_x = p_vout->output.i_width / 8 ; i_x-- ; )
+ {
+#define C_cyuv_YUV422( p_line, p_y, p_u, p_v ) \
+ *p_y++ = *p_line++; *p_v++ = *p_line++; \
+ *p_y++ = *p_line++; *p_u++ = *p_line++
+ C_cyuv_YUV422( p_line, p_y, p_u, p_v );
+ C_cyuv_YUV422( p_line, p_y, p_u, p_v );
+ C_cyuv_YUV422( p_line, p_y, p_u, p_v );
+ C_cyuv_YUV422( p_line, p_y, p_u, p_v );
+ }
+ for( i_x = ( p_vout->output.i_width % 8 ) / 2; i_x-- ; )
+ {
+ C_cyuv_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;
+ }
+}