X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fvideo_chroma%2Fyuy2_i422.c;h=11181dfa1574d1cad765ef226490e2bce8e735c5;hb=d3bd87aaf39384e888c4e06f7ecdf46e4efc41c1;hp=6ba16d66b0189ec29e3989ce516c9920e63acdec;hpb=cef7a5d4bc252197c51b291adab352b0b3226246;p=vlc diff --git a/modules/video_chroma/yuy2_i422.c b/modules/video_chroma/yuy2_i422.c index 6ba16d66b0..11181dfa15 100644 --- a/modules/video_chroma/yuy2_i422.c +++ b/modules/video_chroma/yuy2_i422.c @@ -1,32 +1,37 @@ /***************************************************************************** * yuy2_i422.c : Packed YUV 4:2:2 to Planar YUV conversion module for vlc ***************************************************************************** - * Copyright (C) 2007 the VideoLAN team + * Copyright (C) 2007 VLC authors and VideoLAN * $Id$ * * Authors: Antoine Cellerier * - * 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 + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 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. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser 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. + * You should have received a copy of the GNU Lesser 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 -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include #define SRC_FOURCC "YUY2,YUNV,YVYU,UYVY,UYNV,Y422,cyuv" #define DEST_FOURCC "I422" @@ -36,19 +41,23 @@ *****************************************************************************/ 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 * ); +static void YUY2_I422 ( filter_t *, picture_t *, picture_t * ); +static void YVYU_I422 ( filter_t *, picture_t *, picture_t * ); +static void UYVY_I422 ( filter_t *, picture_t *, picture_t * ); +static void cyuv_I422 ( filter_t *, picture_t *, picture_t * ); +static picture_t *YUY2_I422_Filter ( filter_t *, picture_t * ); +static picture_t *YVYU_I422_Filter ( filter_t *, picture_t * ); +static picture_t *UYVY_I422_Filter ( filter_t *, picture_t * ); +static picture_t *cyuv_I422_Filter ( filter_t *, picture_t * ); /***************************************************************************** * Module descriptor *****************************************************************************/ -vlc_module_begin(); - set_description( _("Conversions from " SRC_FOURCC " to " DEST_FOURCC) ); - set_capability( "chroma", 80 ); - set_callbacks( Activate, NULL ); -vlc_module_end(); +vlc_module_begin () + set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) ) + set_capability( "video filter2", 80 ) + set_callbacks( Activate, NULL ) +vlc_module_end () /***************************************************************************** * Activate: allocate a chroma function @@ -57,35 +66,37 @@ vlc_module_end(); *****************************************************************************/ static int Activate( vlc_object_t *p_this ) { - vout_thread_t *p_vout = (vout_thread_t *)p_this; + filter_t *p_filter = (filter_t *)p_this; - if( p_vout->render.i_width & 1 || p_vout->render.i_height & 1 ) + if( p_filter->fmt_in.video.i_width & 1 + || p_filter->fmt_in.video.i_height & 1 ) { return -1; } - switch( p_vout->output.i_chroma ) + if( p_filter->fmt_in.video.i_width != p_filter->fmt_out.video.i_width + || p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height ) + return -1; + + switch( p_filter->fmt_out.video.i_chroma ) { - case VLC_FOURCC('I','4','2','2'): - switch( p_vout->render.i_chroma ) + case VLC_CODEC_I422: + switch( p_filter->fmt_in.video.i_chroma ) { - case VLC_FOURCC('Y','U','Y','2'): - case VLC_FOURCC('Y','U','N','V'): - p_vout->chroma.pf_convert = YUY2_I422; + case VLC_CODEC_YUYV: + p_filter->pf_video_filter = YUY2_I422_Filter; break; - case VLC_FOURCC('Y','V','Y','U'): - p_vout->chroma.pf_convert = YVYU_I422; + case VLC_CODEC_YVYU: + p_filter->pf_video_filter = YVYU_I422_Filter; break; - case VLC_FOURCC('U','Y','V','Y'): - case VLC_FOURCC('U','Y','N','V'): - case VLC_FOURCC('Y','4','2','2'): - p_vout->chroma.pf_convert = UYVY_I422; + case VLC_CODEC_UYVY: + p_filter->pf_video_filter = UYVY_I422_Filter; break; - case VLC_FOURCC('c','y','u','v'): - p_vout->chroma.pf_convert = cyuv_I422; + case VLC_CODEC_CYUV: + p_filter->pf_video_filter = cyuv_I422_Filter; break; default: @@ -101,11 +112,16 @@ 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( vout_thread_t *p_vout, picture_t *p_source, - picture_t *p_dest ) +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; @@ -122,9 +138,9 @@ static void YUY2_I422( vout_thread_t *p_vout, picture_t *p_source, 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_y = p_filter->fmt_out.video.i_height ; i_y-- ; ) { - for( i_x = p_vout->output.i_width / 8 ; i_x-- ; ) + 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++; \ @@ -134,7 +150,7 @@ static void YUY2_I422( vout_thread_t *p_vout, picture_t *p_source, 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-- ; ) + 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 ); } @@ -148,8 +164,8 @@ static void YUY2_I422( vout_thread_t *p_vout, picture_t *p_source, /***************************************************************************** * 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 ) +static void YVYU_I422( filter_t *p_filter, picture_t *p_source, + picture_t *p_dest ) { uint8_t *p_line = p_source->p->p_pixels; @@ -166,9 +182,9 @@ static void YVYU_I422( vout_thread_t *p_vout, picture_t *p_source, 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_y = p_filter->fmt_out.video.i_height ; i_y-- ; ) { - for( i_x = p_vout->output.i_width / 8 ; i_x-- ; ) + for( i_x = p_filter->fmt_out.video.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++; \ @@ -178,7 +194,7 @@ static void YVYU_I422( vout_thread_t *p_vout, picture_t *p_source, 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-- ; ) + for( i_x = ( p_filter->fmt_out.video.i_width % 8 ) / 2; i_x-- ; ) { C_YVYU_YUV422( p_line, p_y, p_u, p_v ); } @@ -192,8 +208,8 @@ static void YVYU_I422( vout_thread_t *p_vout, picture_t *p_source, /***************************************************************************** * 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 ) +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; @@ -210,9 +226,9 @@ static void UYVY_I422( vout_thread_t *p_vout, picture_t *p_source, 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_y = p_filter->fmt_out.video.i_height ; i_y-- ; ) { - for( i_x = p_vout->output.i_width / 8 ; i_x-- ; ) + 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++; \ @@ -222,7 +238,7 @@ static void UYVY_I422( vout_thread_t *p_vout, picture_t *p_source, 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-- ; ) + 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 ); } @@ -237,8 +253,8 @@ static void UYVY_I422( vout_thread_t *p_vout, picture_t *p_source, * 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 ) +static void cyuv_I422( filter_t *p_filter, picture_t *p_source, + picture_t *p_dest ) { uint8_t *p_line = p_source->p->p_pixels; @@ -255,9 +271,9 @@ static void cyuv_I422( vout_thread_t *p_vout, picture_t *p_source, 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_y = p_filter->fmt_out.video.i_height ; i_y-- ; ) { - for( i_x = p_vout->output.i_width / 8 ; i_x-- ; ) + for( i_x = p_filter->fmt_out.video.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++; \ @@ -267,7 +283,7 @@ static void cyuv_I422( vout_thread_t *p_vout, picture_t *p_source, 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-- ; ) + for( i_x = ( p_filter->fmt_out.video.i_width % 8 ) / 2; i_x-- ; ) { C_cyuv_YUV422( p_line, p_y, p_u, p_v ); }