instead of i_pitch for pixel access (Closes: #30).
* 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>
*
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;
}
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;
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();
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();
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;
}
}
* 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>
*
* 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
{
int i_index, i_vout;
picture_t *p_pic;
-
+
I_OUTPUTPICTURES = 0;
/* Initialize the output structure */
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;
+ }
}
}
* 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>
*
* 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
if( p_vout->p_sys == NULL )
{
msg_Err( p_vout, "out of memory" );
- return 1;
+ return VLC_ENOMEM;
}
p_vout->pf_init = Init;
p_vout->pf_render = Render;
p_vout->pf_display = NULL;
- return 0;
+ return VLC_SUCCESS;
}
/*****************************************************************************
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;
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;
}
/*****************************************************************************
{
if( !p_vout->p_sys->b_changed )
{
- return 0;
+ return VLC_SUCCESS;
}
vout_Destroy( p_vout->p_sys->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;
}
/*****************************************************************************
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 */
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;
}
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;
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 )
{
* 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;
}
+
* 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>
*
* 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
if( p_vout->p_sys == NULL )
{
msg_Err( p_vout, "out of memory" );
- return( 1 );
+ return VLC_ENOMEM;
}
p_vout->pf_init = Init;
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 != ':' )
{
p_vout->p_sys->i_mode = DISTORT_MODE_WAVE;
}
else {
-
+
if( !strcmp( psz_method, "wave" ) )
{
p_vout->p_sys->i_mode = DISTORT_MODE_WAVE;
{
p_vout->p_sys->i_mode = DISTORT_MODE_RIPPLE;
}
-
else
{
msg_Err( p_vout, "no valid distort mode provided, "
}
}
free( psz_method_tmp );
-
- return( 0 );
+
+ return VLC_SUCCESS;
}
-
+
/*****************************************************************************
* Init: initialize Distort video thread output method
*****************************************************************************/
{
msg_Err( p_vout, "cannot open vout, aborting" );
- return( 0 );
+ return VLC_EGENERIC;
}
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
p_vout->p_sys->f_angle = 0.0;
p_vout->p_sys->last_date = 0;
- return( 0 );
+ return VLC_SUCCESS;
}
/*****************************************************************************
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;
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 );
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 );
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;
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;
}
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;
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++ )
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 );
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;
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;
}
* 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>
*
* 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
return( 0 );
}
-
+
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
return( 0 );
* 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 );
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;
}
}
* 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>
*
* 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
* 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 */
if( p_vout->p_sys == NULL )
{
msg_Err( p_vout, "out of memory" );
- return 1;
+ return VLC_ENOMEM;
}
p_vout->pf_init = Init;
p_vout->p_sys->last_date = 0;
p_vout->p_sys->p_lastpic = NULL;
- return 0;
+ return VLC_SUCCESS;
}
/*****************************************************************************
{
int i_index;
picture_t *p_pic;
-
+
I_OUTPUTPICTURES = 0;
/* Initialize the output structure, full of directbuffers since we want
break;
default:
- return 0; /* unknown chroma */
+ return VLC_EGENERIC; /* unknown chroma */
break;
}
{
msg_Err( p_vout, "cannot open vout, aborting" );
- return 0;
+ return VLC_EGENERIC;
}
-
+
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
- return 0;
+ return VLC_SUCCESS;
}
/*****************************************************************************
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 */
}
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 )
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;
}
}
}
+
* 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>
*
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;
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;
* 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>
*
* 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
if( p_vout->p_sys == NULL )
{
msg_Err( p_vout, "out of memory" );
- return( 1 );
+ return VLC_ENOMEM;
}
p_vout->pf_init = Init;
{
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" );
free( psz_method_tmp );
- return( 0 );
+ return VLC_SUCCESS;
}
/*****************************************************************************
{
int i_index, i_row, i_col, i_width, i_height;
picture_t *p_pic;
-
+
I_OUTPUTPICTURES = 0;
/* Initialize the output structure */
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++;
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
- return( 0 );
+ return VLC_SUCCESS;
}
/*****************************************************************************
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];
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;
}