X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fvideo_filter%2Finvert.c;h=3cb78c5d067ed7889db75aeccf8b8aee46f018f6;hb=9d9ffaff80f69c24767cb777c389d9aced500823;hp=67d3a390bfbcaf6456e2f27fc3ba8046653ad73f;hpb=976a25d5c9f1d3ecc622209dc9d8ed85952adc6a;p=vlc diff --git a/modules/video_filter/invert.c b/modules/video_filter/invert.c index 67d3a390bf..3cb78c5d06 100644 --- a/modules/video_filter/invert.c +++ b/modules/video_filter/invert.c @@ -2,7 +2,7 @@ * invert.c : Invert video plugin for vlc ***************************************************************************** * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN - * $Id: invert.c,v 1.6 2003/03/18 23:30:28 gbazin Exp $ + * $Id$ * * Authors: Samuel Hocevar * @@ -49,7 +49,10 @@ static int SendEvents( vlc_object_t *, char const *, * Module descriptor *****************************************************************************/ vlc_module_begin(); - set_description( _("invert video module") ); + set_description( _("Invert video filter") ); + set_shortname( N_("Color inversion" )); + set_category( CAT_VIDEO ); + set_subcategory( SUBCAT_VIDEO_VFILTER ); set_capability( "video filter", 0 ); add_shortcut( "invert" ); set_callbacks( Create, Destroy ); @@ -66,6 +69,14 @@ struct vout_sys_t vout_thread_t *p_vout; }; +/***************************************************************************** + * Control: control facility for the vout (forwards to child vout) + *****************************************************************************/ +static int Control( vout_thread_t *p_vout, int i_query, va_list args ) +{ + return vout_vaControl( p_vout->p_sys->p_vout, i_query, args ); +} + /***************************************************************************** * Create: allocates Invert video thread output method ***************************************************************************** @@ -88,6 +99,7 @@ static int Create( vlc_object_t *p_this ) p_vout->pf_manage = NULL; p_vout->pf_render = Render; p_vout->pf_display = NULL; + p_vout->pf_control = Control; return VLC_SUCCESS; } @@ -99,6 +111,7 @@ static int Init( vout_thread_t *p_vout ) { int i_index; picture_t *p_pic; + video_format_t fmt = {0}; I_OUTPUTPICTURES = 0; @@ -108,12 +121,18 @@ static int Init( vout_thread_t *p_vout ) p_vout->output.i_height = p_vout->render.i_height; p_vout->output.i_aspect = p_vout->render.i_aspect; + fmt.i_width = fmt.i_visible_width = p_vout->render.i_width; + fmt.i_height = fmt.i_visible_height = p_vout->render.i_height; + fmt.i_x_offset = fmt.i_y_offset = 0; + fmt.i_chroma = p_vout->render.i_chroma; + fmt.i_aspect = p_vout->render.i_aspect; + fmt.i_sar_num = p_vout->render.i_aspect * fmt.i_height / fmt.i_width; + fmt.i_sar_den = VOUT_ASPECT_FACTOR; + /* Try to open the real video output */ msg_Dbg( p_vout, "spawning the real video output" ); - p_vout->p_sys->p_vout = vout_Create( p_vout, - p_vout->render.i_width, p_vout->render.i_height, - p_vout->render.i_chroma, p_vout->render.i_aspect ); + p_vout->p_sys->p_vout = vout_Create( p_vout, &fmt ); /* Everything failed */ if( p_vout->p_sys->p_vout == NULL ) @@ -127,6 +146,8 @@ static int Init( vout_thread_t *p_vout ) ADD_CALLBACKS( p_vout->p_sys->p_vout, SendEvents ); + ADD_PARENT_CALLBACKS( SendEventsToChild ); + return VLC_SUCCESS; } @@ -154,9 +175,14 @@ static void Destroy( vlc_object_t *p_this ) { vout_thread_t *p_vout = (vout_thread_t *)p_this; - DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents ); - vlc_object_detach( p_vout->p_sys->p_vout ); - vout_Destroy( p_vout->p_sys->p_vout ); + if( p_vout->p_sys->p_vout ) + { + DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents ); + vlc_object_detach( p_vout->p_sys->p_vout ); + vout_Destroy( p_vout->p_sys->p_vout ); + } + + DEL_PARENT_CALLBACKS( SendEventsToChild ); free( p_vout->p_sys ); } @@ -192,28 +218,31 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic ) uint8_t *p_in, *p_in_end, *p_line_end, *p_out; p_in = p_pic->p[i_index].p_pixels; - p_in_end = p_in + p_pic->p[i_index].i_lines + p_in_end = p_in + p_pic->p[i_index].i_visible_lines * p_pic->p[i_index].i_pitch; p_out = p_outpic->p[i_index].p_pixels; for( ; p_in < p_in_end ; ) { + uint64_t *p_in64, *p_out64; + p_line_end = p_in + p_pic->p[i_index].i_visible_pitch - 64; - for( ; p_in < p_line_end ; ) + p_in64 = (uint64_t*)p_in; + p_out64 = (uint64_t*)p_out; + + for( ; (ptrdiff_t)p_in64 < (ptrdiff_t)p_line_end ; ) { /* Do 64 pixels at a time */ - *((uint64_t*)p_out)++ = ~( *((uint64_t*)p_in)++ ); - *((uint64_t*)p_out)++ = ~( *((uint64_t*)p_in)++ ); - *((uint64_t*)p_out)++ = ~( *((uint64_t*)p_in)++ ); - *((uint64_t*)p_out)++ = ~( *((uint64_t*)p_in)++ ); - *((uint64_t*)p_out)++ = ~( *((uint64_t*)p_in)++ ); - *((uint64_t*)p_out)++ = ~( *((uint64_t*)p_in)++ ); - *((uint64_t*)p_out)++ = ~( *((uint64_t*)p_in)++ ); - *((uint64_t*)p_out)++ = ~( *((uint64_t*)p_in)++ ); + *p_out64++ = ~*p_in64++; *p_out64++ = ~*p_in64++; + *p_out64++ = ~*p_in64++; *p_out64++ = ~*p_in64++; + *p_out64++ = ~*p_in64++; *p_out64++ = ~*p_in64++; + *p_out64++ = ~*p_in64++; *p_out64++ = ~*p_in64++; } + p_in = (uint8_t*)p_in64; + p_out = (uint8_t*)p_out64; p_line_end += 64; for( ; p_in < p_line_end ; ) @@ -244,3 +273,13 @@ static int SendEvents( vlc_object_t *p_this, char const *psz_var, return VLC_SUCCESS; } +/***************************************************************************** + * SendEventsToChild: forward events to the child/children vout + *****************************************************************************/ +static int SendEventsToChild( vlc_object_t *p_this, char const *psz_var, + vlc_value_t oldval, vlc_value_t newval, void *p_data ) +{ + vout_thread_t *p_vout = (vout_thread_t *)p_this; + var_Set( p_vout->p_sys->p_vout, psz_var, newval ); + return VLC_SUCCESS; +}