Commit 00a30b7b authored by Sam Hocevar's avatar Sam Hocevar

* ./modules/video_filter/*.c: all filters now properly use i_visible_pitch

    instead of i_pitch for pixel access (Closes: #30).
parent b7529857
......@@ -2,7 +2,7 @@
* adjust.c : Contrast/Hue/Saturation/Brightness video plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: adjust.c,v 1.7 2003/01/09 16:26:14 sam Exp $
* $Id: adjust.c,v 1.8 2003/01/09 17:47:05 sam Exp $
*
* Authors: Simon Latapie <garf@via.ecp.fr>, Samuel Hocevar <sam@zoy.org>
*
......@@ -195,8 +195,8 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
int pi_luma[256];
picture_t *p_outpic;
uint8_t *p_in, *p_in_u, *p_in_v, *p_in_end, *p_line_end;
uint8_t *p_out, *p_out_u, *p_out_v;
uint8_t *p_in, *p_in_v, *p_in_end, *p_line_end;
uint8_t *p_out, *p_out_v;
double f_hue;
int32_t i_cont, i_lum;
......@@ -263,17 +263,18 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
}
p_in += p_pic->p[0].i_pitch - p_pic->p[0].i_visible_pitch;
p_out += p_outpic->p[0].i_pitch - p_outpic->p[0].i_visible_pitch;
}
/*
* Do the U and V planes
*/
p_in_u = p_pic->p[1].p_pixels;
p_in = p_pic->p[1].p_pixels;
p_in_v = p_pic->p[2].p_pixels;
p_in_end = p_in_u + p_pic->p[1].i_lines * p_pic->p[1].i_pitch - 8;
p_in_end = p_in + p_pic->p[1].i_lines * p_pic->p[1].i_pitch - 8;
p_out_u = p_outpic->p[1].p_pixels;
p_out = p_outpic->p[1].p_pixels;
p_out_v = p_outpic->p[2].p_pixels;
i_sin = sin(f_hue) * 256;
......@@ -285,19 +286,19 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
if ( i_sat > 256 )
{
#define WRITE_UV_CLIP() \
i_u = *p_in_u++ ; i_v = *p_in_v++ ; \
*p_out_u++ = clip( (( ((i_u * i_cos + i_v * i_sin - i_x) >> 8) \
i_u = *p_in++ ; i_v = *p_in_v++ ; \
*p_out++ = clip( (( ((i_u * i_cos + i_v * i_sin - i_x) >> 8) \
* i_sat) >> 8) + 128); \
*p_out_v++ = clip( (( ((i_v * i_cos - i_u * i_sin - i_y) >> 8) \
* i_sat) >> 8) + 128)
uint8_t i_u, i_v;
for( ; p_in_u < p_in_end ; )
for( ; p_in < p_in_end ; )
{
p_line_end = p_in_u + p_pic->p[1].i_visible_pitch - 8;
p_line_end = p_in + p_pic->p[1].i_visible_pitch - 8;
for( ; p_in_u < p_line_end ; )
for( ; p_in < p_line_end ; )
{
/* Do 8 pixels at a time */
WRITE_UV_CLIP(); WRITE_UV_CLIP();
......@@ -308,33 +309,33 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
p_line_end += 8;
for( ; p_in_u < p_line_end ; )
for( ; p_in < p_line_end ; )
{
WRITE_UV_CLIP();
}
p_in_u += p_pic->p[1].i_pitch - p_pic->p[1].i_visible_pitch;
p_in += p_pic->p[1].i_pitch - p_pic->p[1].i_visible_pitch;
p_in_v += p_pic->p[2].i_pitch - p_pic->p[2].i_visible_pitch;
p_out_u += p_pic->p[1].i_pitch - p_pic->p[1].i_visible_pitch;
p_out_v += p_pic->p[2].i_pitch - p_pic->p[2].i_visible_pitch;
p_out += p_outpic->p[1].i_pitch - p_outpic->p[1].i_visible_pitch;
p_out_v += p_outpic->p[2].i_pitch - p_outpic->p[2].i_visible_pitch;
}
}
else
{
#define WRITE_UV() \
i_u = *p_in_u++ ; i_v = *p_in_v++ ; \
*p_out_u++ = (( ((i_u * i_cos + i_v * i_sin - i_x) >> 8) \
i_u = *p_in++ ; i_v = *p_in_v++ ; \
*p_out++ = (( ((i_u * i_cos + i_v * i_sin - i_x) >> 8) \
* i_sat) >> 8) + 128; \
*p_out_v++ = (( ((i_v * i_cos - i_u * i_sin - i_y) >> 8) \
* i_sat) >> 8) + 128
uint8_t i_u, i_v;
for( ; p_in_u < p_in_end ; )
for( ; p_in < p_in_end ; )
{
p_line_end = p_in + p_pic->p[1].i_visible_pitch - 8;
for( ; p_in_u < p_line_end ; )
for( ; p_in < p_line_end ; )
{
/* Do 8 pixels at a time */
WRITE_UV(); WRITE_UV(); WRITE_UV(); WRITE_UV();
......@@ -343,15 +344,15 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
p_line_end += 8;
for( ; p_in_u < p_line_end ; )
for( ; p_in < p_line_end ; )
{
WRITE_UV();
}
p_in_u += p_pic->p[1].i_pitch - p_pic->p[1].i_visible_pitch;
p_in += p_pic->p[1].i_pitch - p_pic->p[1].i_visible_pitch;
p_in_v += p_pic->p[2].i_pitch - p_pic->p[2].i_visible_pitch;
p_out_u += p_pic->p[1].i_pitch - p_pic->p[1].i_visible_pitch;
p_out_v += p_pic->p[2].i_pitch - p_pic->p[2].i_visible_pitch;
p_out += p_outpic->p[1].i_pitch - p_outpic->p[1].i_visible_pitch;
p_out_v += p_outpic->p[2].i_pitch - p_outpic->p[2].i_visible_pitch;
}
}
......
......@@ -2,7 +2,7 @@
* clone.c : Clone video plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: clone.c,v 1.3 2002/11/28 17:35:00 sam Exp $
* $Id: clone.c,v 1.4 2003/01/09 17:47:05 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -10,7 +10,7 @@
* 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
......@@ -121,7 +121,7 @@ static int Init( vout_thread_t *p_vout )
{
int i_index, i_vout;
picture_t *p_pic;
I_OUTPUTPICTURES = 0;
/* Initialize the output structure */
......@@ -217,22 +217,30 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
{
u8 *p_in, *p_in_end, *p_out;
uint8_t *p_in, *p_in_end, *p_out;
int i_in_pitch = p_pic->p[i_plane].i_pitch;
const int i_out_pitch = p_outpic->p[i_plane].i_pitch;
const int i_copy_pitch = p_outpic->p[i_plane].i_visible_pitch;
p_in = p_pic->p[i_plane].p_pixels;
p_in_end = p_in + p_outpic->p[i_plane].i_lines
* p_pic->p[i_plane].i_pitch;
p_out = p_outpic->p[i_plane].p_pixels;
while( p_in < p_in_end )
if( i_in_pitch == i_copy_pitch
&& i_out_pitch == i_copy_pitch )
{
p_vout->p_vlc->pf_memcpy( p_out, p_in, i_in_pitch
* p_outpic->p[i_plane].i_lines );
}
else
{
p_vout->p_vlc->pf_memcpy( p_out, p_in, i_out_pitch );
p_in += i_in_pitch;
p_out += i_out_pitch;
p_in_end = p_in + i_in_pitch * p_outpic->p[i_plane].i_lines;
while( p_in < p_in_end )
{
p_vout->p_vlc->pf_memcpy( p_out, p_in, i_copy_pitch );
p_in += i_in_pitch;
p_out += i_out_pitch;
}
}
}
......
......@@ -2,7 +2,7 @@
* crop.c : Crop video plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: crop.c,v 1.5 2002/12/06 16:34:07 sam Exp $
* $Id: crop.c,v 1.6 2003/01/09 17:47:05 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -10,7 +10,7 @@
* 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
......@@ -98,7 +98,7 @@ static int Create( vlc_object_t *p_this )
if( p_vout->p_sys == NULL )
{
msg_Err( p_vout, "out of memory" );
return 1;
return VLC_ENOMEM;
}
p_vout->pf_init = Init;
......@@ -107,7 +107,7 @@ static int Create( vlc_object_t *p_this )
p_vout->pf_render = Render;
p_vout->pf_display = NULL;
return 0;
return VLC_SUCCESS;
}
/*****************************************************************************
......@@ -118,11 +118,11 @@ static int Init( vout_thread_t *p_vout )
int i_index;
char *psz_var;
picture_t *p_pic;
I_OUTPUTPICTURES = 0;
p_vout->p_sys->i_lastchange = 0;
p_vout->p_sys->b_changed = 0;
p_vout->p_sys->b_changed = VLC_FALSE;
/* Initialize the output structure */
p_vout->output.i_chroma = p_vout->render.i_chroma;
......@@ -238,12 +238,12 @@ static int Init( vout_thread_t *p_vout )
if( p_vout->p_sys->p_vout == NULL )
{
msg_Err( p_vout, "failed to create vout" );
return 0;
return VLC_EGENERIC;
}
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
return 0;
return VLC_SUCCESS;
}
/*****************************************************************************
......@@ -284,7 +284,7 @@ static int Manage( vout_thread_t *p_vout )
{
if( !p_vout->p_sys->b_changed )
{
return 0;
return VLC_SUCCESS;
}
vout_Destroy( p_vout->p_sys->p_vout );
......@@ -295,13 +295,13 @@ static int Manage( vout_thread_t *p_vout )
if( p_vout->p_sys->p_vout == NULL )
{
msg_Err( p_vout, "failed to create vout" );
return 1;
return VLC_EGENERIC;
}
p_vout->p_sys->b_changed = 0;
p_vout->p_sys->b_changed = VLC_FALSE;
p_vout->p_sys->i_lastchange = 0;
return 0;
return VLC_SUCCESS;
}
/*****************************************************************************
......@@ -339,9 +339,10 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
{
u8 *p_in, *p_out, *p_out_end;
uint8_t *p_in, *p_out, *p_out_end;
int i_in_pitch = p_pic->p[i_plane].i_pitch;
const int i_out_pitch = p_outpic->p[i_plane].i_pitch;
const int i_copy_pitch = p_outpic->p[i_plane].i_visible_pitch;
p_in = p_pic->p[i_plane].p_pixels
/* Skip the right amount of lines */
......@@ -355,7 +356,7 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
while( p_out < p_out_end )
{
p_vout->p_vlc->pf_memcpy( p_out, p_in, i_out_pitch );
p_vout->p_vlc->pf_memcpy( p_out, p_in, i_copy_pitch );
p_in += i_in_pitch;
p_out += i_out_pitch;
}
......@@ -365,18 +366,17 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
vout_DisplayPicture( p_vout->p_sys->p_vout, p_outpic );
/* The source image may still be in the cache ... parse it! */
if( !p_vout->p_sys->b_autocrop )
if( p_vout->p_sys->b_autocrop )
{
return;
UpdateStats( p_vout, p_pic );
}
UpdateStats( p_vout, p_pic );
}
static void UpdateStats( vout_thread_t *p_vout, picture_t *p_pic )
{
uint8_t *p_in = p_pic->p[0].p_pixels;
int i_pitch = p_pic->p[0].i_pitch;
int i_visible_pitch = p_pic->p[0].i_visible_pitch;
int i_lines = p_pic->p[0].i_lines;
int i_firstwhite = -1, i_lastwhite = -1, i;
......@@ -391,8 +391,8 @@ static void UpdateStats( vout_thread_t *p_vout, picture_t *p_pic )
const int i_col = i * i_pitch / i_lines;
if( p_in[i_col/2] > 40
&& p_in[i_pitch / 2] > 40
&& p_in[i_pitch/2 + i_col/2] > 40 )
&& p_in[i_visible_pitch/2] > 40
&& p_in[i_visible_pitch/2 + i_col/2] > 40 )
{
if( i_lastwhite == -1 )
{
......@@ -457,5 +457,6 @@ static void UpdateStats( vout_thread_t *p_vout, picture_t *p_pic )
* p_vout->output.i_height / p_vout->p_sys->i_height
* p_vout->p_sys->i_width / p_vout->output.i_width;
p_vout->p_sys->b_changed = 1;
p_vout->p_sys->b_changed = VLC_TRUE;
}
......@@ -2,7 +2,7 @@
* distort.c : Misc video effects plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: distort.c,v 1.4 2002/11/28 17:35:00 sam Exp $
* $Id: distort.c,v 1.5 2003/01/09 17:47:05 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -10,7 +10,7 @@
* 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
......@@ -99,7 +99,7 @@ static int Create( vlc_object_t *p_this )
if( p_vout->p_sys == NULL )
{
msg_Err( p_vout, "out of memory" );
return( 1 );
return VLC_ENOMEM;
}
p_vout->pf_init = Init;
......@@ -113,7 +113,7 @@ static int Create( vlc_object_t *p_this )
if( !(psz_method = psz_method_tmp = config_GetPsz( p_vout, "filter" )) )
{
msg_Err( p_vout, "configuration variable %s empty", "filter" );
return( 1 );
return VLC_EGENERIC;
}
while( *psz_method && *psz_method != ':' )
{
......@@ -141,7 +141,7 @@ static int Create( vlc_object_t *p_this )
p_vout->p_sys->i_mode = DISTORT_MODE_WAVE;
}
else {
if( !strcmp( psz_method, "wave" ) )
{
p_vout->p_sys->i_mode = DISTORT_MODE_WAVE;
......@@ -150,7 +150,6 @@ static int Create( vlc_object_t *p_this )
{
p_vout->p_sys->i_mode = DISTORT_MODE_RIPPLE;
}
else
{
msg_Err( p_vout, "no valid distort mode provided, "
......@@ -160,10 +159,10 @@ static int Create( vlc_object_t *p_this )
}
}
free( psz_method_tmp );
return( 0 );
return VLC_SUCCESS;
}
/*****************************************************************************
* Init: initialize Distort video thread output method
*****************************************************************************/
......@@ -192,7 +191,7 @@ static int Init( vout_thread_t *p_vout )
{
msg_Err( p_vout, "cannot open vout, aborting" );
return( 0 );
return VLC_EGENERIC;
}
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
......@@ -200,7 +199,7 @@ static int Init( vout_thread_t *p_vout )
p_vout->p_sys->f_angle = 0.0;
p_vout->p_sys->last_date = 0;
return( 0 );
return VLC_SUCCESS;
}
/*****************************************************************************
......@@ -290,8 +289,8 @@ static void DistortWave( vout_thread_t *p_vout, picture_t *p_inpic,
for( i_index = 0 ; i_index < p_inpic->i_planes ; i_index++ )
{
int i_line, i_num_lines, i_offset;
u8 black_pixel;
u8 *p_in, *p_out;
uint8_t black_pixel;
uint8_t *p_in, *p_out;
p_in = p_inpic->p[i_index].p_pixels;
p_out = p_outpic->p[i_index].p_pixels;
......@@ -304,7 +303,7 @@ static void DistortWave( vout_thread_t *p_vout, picture_t *p_inpic,
for( i_line = 0 ; i_line < i_num_lines ; i_line++ )
{
/* Calculate today's offset, don't go above 1/20th of the screen */
i_offset = (int)( (double)(p_inpic->p[i_index].i_pitch)
i_offset = (int)( (double)(p_inpic->p[i_index].i_visible_pitch)
* sin( f_angle + 10.0 * (double)i_line
/ (double)i_num_lines )
/ 20.0 );
......@@ -314,7 +313,7 @@ static void DistortWave( vout_thread_t *p_vout, picture_t *p_inpic,
if( i_offset < 0 )
{
p_vout->p_vlc->pf_memcpy( p_out, p_in - i_offset,
p_inpic->p[i_index].i_pitch + i_offset );
p_inpic->p[i_index].i_visible_pitch + i_offset );
p_in += p_inpic->p[i_index].i_pitch;
p_out += p_outpic->p[i_index].i_pitch;
memset( p_out + i_offset, black_pixel, -i_offset );
......@@ -322,7 +321,7 @@ static void DistortWave( vout_thread_t *p_vout, picture_t *p_inpic,
else
{
p_vout->p_vlc->pf_memcpy( p_out + i_offset, p_in,
p_inpic->p[i_index].i_pitch - i_offset );
p_inpic->p[i_index].i_visible_pitch - i_offset );
memset( p_out, black_pixel, i_offset );
p_in += p_inpic->p[i_index].i_pitch;
p_out += p_outpic->p[i_index].i_pitch;
......@@ -331,7 +330,7 @@ static void DistortWave( vout_thread_t *p_vout, picture_t *p_inpic,
else
{
p_vout->p_vlc->pf_memcpy( p_out, p_in,
p_inpic->p[i_index].i_pitch );
p_inpic->p[i_index].i_visible_pitch );
p_in += p_inpic->p[i_index].i_pitch;
p_out += p_outpic->p[i_index].i_pitch;
}
......@@ -357,8 +356,8 @@ static void DistortRipple( vout_thread_t *p_vout, picture_t *p_inpic,
for( i_index = 0 ; i_index < p_inpic->i_planes ; i_index++ )
{
int i_line, i_first_line, i_num_lines, i_offset;
u8 black_pixel;
u8 *p_in, *p_out;
uint8_t black_pixel;
uint8_t *p_in, *p_out;
black_pixel = ( i_index == Y_PLANE ) ? 0x00 : 0x80;
......@@ -369,11 +368,13 @@ static void DistortRipple( vout_thread_t *p_vout, picture_t *p_inpic,
p_in = p_inpic->p[i_index].p_pixels;
p_out = p_outpic->p[i_index].p_pixels;
p_vout->p_vlc->pf_memcpy( p_out, p_in,
i_first_line * p_inpic->p[i_index].i_pitch );
p_in += i_first_line * p_inpic->p[i_index].i_pitch;
p_out += i_first_line * p_outpic->p[i_index].i_pitch;
for( i_line = 0 ; i_line < i_first_line ; i_line++ )
{
p_vout->p_vlc->pf_memcpy( p_out, p_in,
p_inpic->p[i_index].i_visible_pitch );
p_in += p_inpic->p[i_index].i_pitch;
p_out += p_outpic->p[i_index].i_pitch;
}
/* Ok, we do 3 times the sin() calculation for each line. So what ? */
for( i_line = i_first_line ; i_line < i_num_lines ; i_line++ )
......@@ -392,7 +393,7 @@ static void DistortRipple( vout_thread_t *p_vout, picture_t *p_inpic,
if( i_offset < 0 )
{
p_vout->p_vlc->pf_memcpy( p_out, p_in - i_offset,
p_inpic->p[i_index].i_pitch + i_offset );
p_inpic->p[i_index].i_visible_pitch + i_offset );
p_in -= p_inpic->p[i_index].i_pitch;
p_out += p_outpic->p[i_index].i_pitch;
memset( p_out + i_offset, black_pixel, -i_offset );
......@@ -400,7 +401,7 @@ static void DistortRipple( vout_thread_t *p_vout, picture_t *p_inpic,
else
{
p_vout->p_vlc->pf_memcpy( p_out + i_offset, p_in,
p_inpic->p[i_index].i_pitch - i_offset );
p_inpic->p[i_index].i_visible_pitch - i_offset );
memset( p_out, black_pixel, i_offset );
p_in -= p_inpic->p[i_index].i_pitch;
p_out += p_outpic->p[i_index].i_pitch;
......@@ -409,7 +410,7 @@ static void DistortRipple( vout_thread_t *p_vout, picture_t *p_inpic,
else
{
p_vout->p_vlc->pf_memcpy( p_out, p_in,
p_inpic->p[i_index].i_pitch );
p_inpic->p[i_index].i_visible_pitch );
p_in -= p_inpic->p[i_index].i_pitch;
p_out += p_outpic->p[i_index].i_pitch;
}
......
......@@ -2,7 +2,7 @@
* invert.c : Invert video plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: invert.c,v 1.3 2002/11/28 17:35:00 sam Exp $
* $Id: invert.c,v 1.4 2003/01/09 17:47:05 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -10,7 +10,7 @@
* 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
......@@ -119,7 +119,7 @@ static int Init( vout_thread_t *p_vout )
return( 0 );
}
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
return( 0 );
......@@ -146,7 +146,7 @@ static void End( vout_thread_t *p_vout )
* Terminate an output method created by InvertCreateOutputMethod
*****************************************************************************/
static void Destroy( vlc_object_t *p_this )
{
{
vout_thread_t *p_vout = (vout_thread_t *)p_this;
vout_Destroy( p_vout->p_sys->p_vout );
......@@ -175,40 +175,49 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
return;
}
msleep( VOUT_OUTMEM_SLEEP );
}
}
vout_DatePicture( p_vout->p_sys->p_vout, p_outpic, p_pic->date );
vout_LinkPicture( p_vout->p_sys->p_vout, p_outpic );
for( i_index = 0 ; i_index < p_pic->i_planes ; i_index++ )
{
u8 *p_in, *p_in_end, *p_out;
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 - 64 + p_pic->p[i_index].i_lines
* p_pic->p[i_index].i_pitch;
p_in_end = p_in + p_pic->p[i_index].i_lines
* p_pic->p[i_index].i_pitch;
p_out = p_outpic->p[i_index].p_pixels;
for( ; p_in < p_in_end ; )
{
/* Do 64 pixels at a time */
*((u64*)p_out)++ = ~( *((u64*)p_in)++ );
*((u64*)p_out)++ = ~( *((u64*)p_in)++ );
*((u64*)p_out)++ = ~( *((u64*)p_in)++ );
*((u64*)p_out)++ = ~( *((u64*)p_in)++ );
*((u64*)p_out)++ = ~( *((u64*)p_in)++ );
*((u64*)p_out)++ = ~( *((u64*)p_in)++ );
*((u64*)p_out)++ = ~( *((u64*)p_in)++ );
*((u64*)p_out)++ = ~( *((u64*)p_in)++ );
}
p_in_end += 64;
for( ; p_in < p_in_end ; )
{
/* Do 1 pixel at a time */
*p_out++ = ~( *p_in++ );
p_line_end = p_in + p_pic->p[i_index].i_visible_pitch - 64;
for( ; p_in < 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_line_end += 64;
for( ; p_in < p_line_end ; )
{
*p_out++ = ~( *p_in++ );
}
p_in += p_pic->p[i_index].i_pitch
- p_pic->p[i_index].i_visible_pitch;
p_out += p_outpic->p[i_index].i_pitch
- p_outpic->p[i_index].i_visible_pitch;
}
}
......
......@@ -2,7 +2,7 @@
* motion_blur.c : motion blur filter for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: motionblur.c,v 1.4 2002/11/28 17:35:00 sam Exp $
* $Id: motionblur.c,v 1.5 2003/01/09 17:47:05 sam Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
......@@ -10,7 +10,7 @@
* 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
......@@ -83,7 +83,7 @@ struct vout_sys_t
* This function allocates and initializes a Deinterlace vout method.
*****************************************************************************/
static int Create( vlc_object_t *p_this )
{
{
vout_thread_t *p_vout = (vout_thread_t *)p_this;
/* Allocate structure */
......@@ -91,7 +91,7 @@ static int Create( vlc_object_t *p_this )
if( p_vout->p_sys == NULL )
{
msg_Err( p_vout, "out of memory" );
return 1;
return VLC_ENOMEM;
}
p_vout->pf_init = Init;
......@@ -105,7 +105,7 @@ static int Create( vlc_object_t *p_this )
p_vout->p_sys->last_date = 0;
p_vout->p_sys->p_lastpic = NULL;
return 0;
return VLC_SUCCESS;
}
/*****************************************************************************
......@@ -115,7 +115,7 @@ static int Init( vout_thread_t *p_vout )
{
int i_index;
picture_t *p_pic;
I_OUTPUTPICTURES = 0;
/* Initialize the output structure, full of directbuffers since we want
......@@ -133,7 +133,7 @@ static int Init( vout_thread_t *p_vout )
break;
default:
return 0; /* unknown chroma */
return VLC_EGENERIC; /* unknown chroma */
break;
}
......@@ -157,12 +157,12 @@ static int Init( vout_thread_t *p_vout )
{
msg_Err( p_vout, "cannot open vout, aborting" );
return 0;
return VLC_EGENERIC;
}
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
return 0;
return VLC_SUCCESS;
}
/*****************************************************************************
......@@ -214,7 +214,7 @@ static void Render ( vout_thread_t *p_vout, picture_t *p_pic )
msleep( VOUT_OUTMEM_SLEEP );
}
vout_DatePicture( p_vout, p_outpic, p_pic->date );
if ( p_vout->p_sys->p_lastpic == NULL )
{
/* Get a new picture */
......@@ -252,28 +252,44 @@ static void Render ( vout_thread_t *p_vout, picture_t *p_pic )
}
CopyPicture( p_vout, p_vout->p_sys->p_lastpic, p_outpic );
vout_DisplayPicture( p_vout->p_sys->p_vout, p_outpic );
}
static void CopyPicture( vout_thread_t *p_vout,
picture_t *p_dest, picture_t *p_source)
/* FIXME: this is a verbatim copy from src/video_output/vout_pictures.c */
/* XXX: the order is fucked up!! */
static void CopyPicture( vout_thread_t * p_vout,
picture_t *p_dest, picture_t *p_src )
{
int i_plane;
int i;
for( i_plane = 0 ; i_plane < p_dest->i_planes ; i_plane++ )
for( i = 0; i < p_src->i_planes ; i++ )
{
u8 *p_in, *p_out;
p_in = p_source->p[i_plane].p_pixels;
if( p_src->p[i].i_pitch == p_dest->p[i].i_pitch )
{
/* There are margins, but with the same width : perfect ! */
p_vout->p_vlc->pf_memcpy(
p_dest->p[i].p_pixels, p_src->p[i].p_pixels,
p_src->p[i].i_pitch * p_src->p[i].i_lines );
}
else
{
/* We need to proceed line by line */
uint8_t *p_in = p_src->p[i].p_pixels;
uint8_t *p_out = p_dest->p[i].p_pixels;
int i_line;
p_out = p_dest->p[i_plane].p_pixels;
p_vout->p_vlc->pf_memcpy( p_out, p_in,
p_dest->p[i_plane].i_pitch *
p_dest->p[i_plane].i_lines);
for( i_line = p_src->p[i].i_lines; i_line--; )
{
p_vout->p_vlc->pf_memcpy( p_out, p_in,
p_src->p[i].i_visible_pitch );
p_in += p_src->p[i].i_pitch;
p_out += p_dest->p[i].i_pitch;
}
}
}
}
/*****************************************************************************
* RenderBob: renders a bob picture
* RenderBlur: renders a blurred picture
*****************************************************************************/
static void RenderBlur( vout_thread_t *p_vout, picture_t *p_oldpic,
picture_t *p_newpic, picture_t *p_outpic )
......@@ -283,19 +299,31 @@ static void RenderBlur( vout_thread_t *p_vout, picture_t *p_oldpic,
int i_newfactor = 128 - p_vout->p_sys->i_factor;
for( i_plane = 0; i_plane < p_outpic->i_planes; i_plane++ )
{
u8 *p_old, *p_new, *p_out, *p_out_end;
uint8_t *p_old, *p_new, *p_out, *p_out_end, *p_out_line_end;
p_out = p_outpic->p[i_plane].p_pixels;
p_new = p_newpic->p[i_plane].p_pixels;
p_old = p_oldpic->p[i_plane].p_pixels;
p_out_end = p_out + p_outpic->p[i_plane].i_pitch *
p_outpic->p[i_plane].i_lines;
p_outpic->p[i_plane].i_lines;
while ( p_out < p_out_end )
{
*p_out++ = (((*p_old++) * i_oldfactor) +
((*p_new++) * i_newfactor)) >> 7;
// *p_out++ = (*p_old++ >> 1) + (*p_new++ >> 1);
p_out_line_end = p_out + p_outpic->p[i_plane].i_visible_pitch;
while ( p_out < p_out_line_end )
{
*p_out++ = (((*p_old++) * i_oldfactor) +
((*p_new++) * i_newfactor)) >> 7;
// *p_out++ = (*p_old++ >> 1) + (*p_new++ >> 1);
}
p_old += p_oldpic->p[i_plane].i_pitch
- p_oldpic->p[i_plane].i_visible_pitch;
p_new += p_newpic->p[i_plane].i_pitch
- p_newpic->p[i_plane].i_visible_pitch;
p_out += p_outpic->p[i_plane].i_pitch
- p_outpic->p[i_plane].i_visible_pitch;
}
}
}
......@@ -2,7 +2,7 @@
* transform.c : transform image plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: transform.c,v 1.5 2003/01/09 14:00:00 sam Exp $
* $Id: transform.c,v 1.6 2003/01/09 17:47:05 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -288,7 +288,6 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
break;
case TRANSFORM_MODE_180:
/* FIXME: we should use i_visible_pitch here */
for( i_index = 0 ; i_index < p_pic->i_planes ; i_index++ )
{
uint8_t *p_in = p_pic->p[i_index].p_pixels;
......@@ -299,7 +298,17 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
for( ; p_in < p_in_end ; )
{
*p_out++ = *(--p_in_end);
uint8_t *p_line_start = p_in - p_pic->p[i_index].i_pitch;
p_in_end -= p_pic->p[i_index].i_pitch
- p_pic->p[i_index].i_visible_pitch;
for( ; p_line_start < p_in_end ; )
{
*p_out++ = *(--p_in_end);
}
p_out += p_outpic->p[i_index].i_pitch
- p_outpic->p[i_index].i_visible_pitch;
}
}
break;
......
......@@ -2,7 +2,7 @@
* wall.c : Wall video plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: wall.c,v 1.4 2002/11/28 17:35:00 sam Exp $
* $Id: wall.c,v 1.5 2003/01/09 17:47:05 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -10,7 +10,7 @@
* 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
......@@ -106,7 +106,7 @@ static int Create( vlc_object_t *p_this )
if( p_vout->p_sys == NULL )
{
msg_Err( p_vout, "out of memory" );
return( 1 );
return VLC_ENOMEM;
}
p_vout->pf_init = Init;
......@@ -132,7 +132,7 @@ static int Create( vlc_object_t *p_this )
{
msg_Err( p_vout, "out of memory" );
free( p_vout->p_sys );
return( 1 );
return VLC_ENOMEM;
}
psz_method_tmp = psz_method = config_GetPsz( p_vout, "wall-active" );
......@@ -185,7 +185,7 @@ static int Create( vlc_object_t *p_this )
free( psz_method_tmp );
return( 0 );
return VLC_SUCCESS;
}
/*****************************************************************************
......@@ -195,7 +195,7 @@ static int Init( vout_thread_t *p_vout )
{
int i_index, i_row, i_col, i_width, i_height;
picture_t *p_pic;
I_OUTPUTPICTURES = 0;
/* Initialize the output structure */
......@@ -258,7 +258,7 @@ static int Init( vout_thread_t *p_vout )
msg_Err( p_vout, "failed to get %ix%i vout threads",
p_vout->p_sys->i_col, p_vout->p_sys->i_row );
RemoveAllVout( p_vout );
return 0;
return VLC_EGENERIC;
}
p_vout->p_sys->i_vout++;
......@@ -267,7 +267,7 @@ static int Init( vout_thread_t *p_vout )
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
return( 0 );
return VLC_SUCCESS;
}
/*****************************************************************************
......@@ -363,9 +363,10 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
{
u8 *p_in, *p_in_end, *p_out;
uint8_t *p_in, *p_in_end, *p_out;
int i_in_pitch = p_pic->p[i_plane].i_pitch;
int i_out_pitch = p_outpic->p[i_plane].i_pitch;
int i_copy_pitch = p_outpic->p[i_plane].i_visible_pitch;
p_in = p_pic->p[i_plane].p_pixels
+ pi_top_skip[i_plane] + pi_left_skip[i_plane];
......@@ -377,7 +378,7 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
while( p_in < p_in_end )
{
p_vout->p_vlc->pf_memcpy( p_out, p_in, i_out_pitch );
p_vout->p_vlc->pf_memcpy( p_out, p_in, i_copy_pitch );
p_in += i_in_pitch;
p_out += i_out_pitch;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment