Commit 9ce72981 authored by Antoine Cellerier's avatar Antoine Cellerier

use pf_mem{set,cpy} when possible

parent 3fada58d
...@@ -169,14 +169,16 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) ...@@ -169,14 +169,16 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
p_out_v = p_outpic->p[V_PLANE].p_pixels; p_out_v = p_outpic->p[V_PLANE].p_pixels;
/* Create grayscale version of input */ /* Create grayscale version of input */
memcpy( p_out_y, p_in_y, p_pic->p[Y_PLANE].i_visible_lines p_filter->p_libvlc->
pf_memcpy( p_out_y, p_in_y, p_pic->p[Y_PLANE].i_visible_lines
* p_pic->p[Y_PLANE].i_pitch - 8 ); * p_pic->p[Y_PLANE].i_pitch - 8 );
memset( p_out_u, 0x80, p_pic->p[U_PLANE].i_visible_lines p_filter->p_libvlc->
pf_memset( p_out_u, 0x80, p_pic->p[U_PLANE].i_visible_lines
* p_pic->p[U_PLANE].i_pitch - 8 ); * p_pic->p[U_PLANE].i_pitch - 8 );
memset( p_out_v, 0x80, p_pic->p[U_PLANE].i_visible_lines p_filter->p_libvlc->
pf_memset( p_out_v, 0x80, p_pic->p[U_PLANE].i_visible_lines
* p_pic->p[U_PLANE].i_pitch - 8 ); * p_pic->p[U_PLANE].i_pitch - 8 );
/* /*
* Do the U and V planes * Do the U and V planes
*/ */
......
...@@ -501,7 +501,7 @@ static void FilterEdge( filter_t *p_filter, picture_t *p_inpic, ...@@ -501,7 +501,7 @@ static void FilterEdge( filter_t *p_filter, picture_t *p_inpic,
p_outpic->p[Y_PLANE].i_lines * p_outpic->p[Y_PLANE].i_pitch ); p_outpic->p[Y_PLANE].i_lines * p_outpic->p[Y_PLANE].i_pitch );
p_filter->p_libvlc->pf_memset( p_outpic->p[U_PLANE].p_pixels, 0x80, p_filter->p_libvlc->pf_memset( p_outpic->p[U_PLANE].p_pixels, 0x80,
p_outpic->p[U_PLANE].i_lines * p_outpic->p[U_PLANE].i_pitch ); p_outpic->p[U_PLANE].i_lines * p_outpic->p[U_PLANE].i_pitch );
memset( p_outpic->p[V_PLANE].p_pixels, 0x80, p_filter->p_libvlc->pf_memset( p_outpic->p[V_PLANE].p_pixels, 0x80,
p_outpic->p[V_PLANE].i_lines * p_outpic->p[V_PLANE].i_pitch ); p_outpic->p[V_PLANE].i_lines * p_outpic->p[V_PLANE].i_pitch );
} }
...@@ -658,7 +658,8 @@ static void FilterHough( filter_t *p_filter, picture_t *p_inpic, ...@@ -658,7 +658,8 @@ static void FilterHough( filter_t *p_filter, picture_t *p_inpic,
msg_Dbg(p_filter, "Precalculation done"); msg_Dbg(p_filter, "Precalculation done");
} }
memset( p_hough, 0, i_diag * i_nb_steps * sizeof(int) ); p_filter->p_libvlc->pf_memset( p_hough, 0,
i_diag * i_nb_steps * sizeof(int) );
p_filter->p_libvlc->pf_memcpy( p_filter->p_libvlc->pf_memcpy(
p_outpic->p[Y_PLANE].p_pixels, p_inpic->p[Y_PLANE].p_pixels, p_outpic->p[Y_PLANE].p_pixels, p_inpic->p[Y_PLANE].p_pixels,
......
...@@ -261,7 +261,8 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -261,7 +261,8 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
else else
{ {
#define copy( plane ) \ #define copy( plane ) \
memcpy( p_outpic->p[plane].p_pixels, p_pic->p[plane].p_pixels, \ p_vout->p_libvlc-> \
pf_memcpy( p_outpic->p[plane].p_pixels, p_pic->p[plane].p_pixels, \
p_outpic->p[plane].i_lines * p_outpic->p[plane].i_pitch ); p_outpic->p[plane].i_lines * p_outpic->p[plane].i_pitch );
copy( Y_PLANE ); copy( Y_PLANE );
copy( U_PLANE ); copy( U_PLANE );
...@@ -280,7 +281,8 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -280,7 +281,8 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
#define copyimage( plane ) \ #define copyimage( plane ) \
for( y=0; y<p_converted->p[plane].i_visible_lines; y++) \ for( y=0; y<p_converted->p[plane].i_visible_lines; y++) \
{ \ { \
memcpy( p_outpic->p[plane].p_pixels+y*p_outpic->p[plane].i_pitch, \ p_vout->p_libvlc->pf_memcpy( \
p_outpic->p[plane].p_pixels+y*p_outpic->p[plane].i_pitch, \
p_converted->p[plane].p_pixels+y*p_converted->p[plane].i_pitch, \ p_converted->p[plane].p_pixels+y*p_converted->p[plane].i_pitch, \
p_converted->p[plane].i_visible_pitch ); \ p_converted->p[plane].i_visible_pitch ); \
} }
...@@ -294,7 +296,7 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -294,7 +296,7 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
v_w = p_oyp->i_pitch*ZOOM_FACTOR/(VIS_ZOOM*o_zoom); v_w = p_oyp->i_pitch*ZOOM_FACTOR/(VIS_ZOOM*o_zoom);
v_h = (o_y+p_oyp->i_lines*ZOOM_FACTOR/o_zoom)/VIS_ZOOM; v_h = (o_y+p_oyp->i_lines*ZOOM_FACTOR/o_zoom)/VIS_ZOOM;
/* top line */ /* top line */
memset( p_oyp->p_pixels p_vout->p_libvlc->pf_memset( p_oyp->p_pixels
+ o_y/VIS_ZOOM*p_oyp->i_pitch + o_y/VIS_ZOOM*p_oyp->i_pitch
+ o_x/VIS_ZOOM, 0xff, v_w+1 ); + o_x/VIS_ZOOM, 0xff, v_w+1 );
...@@ -310,7 +312,7 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -310,7 +312,7 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
] = 0xff; ] = 0xff;
} }
/* bottom line */ /* bottom line */
memset( p_oyp->p_pixels p_vout->p_libvlc->pf_memset( p_oyp->p_pixels
+ v_h*p_oyp->i_pitch + v_h*p_oyp->i_pitch
+ o_x/VIS_ZOOM, 0xff, v_w+1 ); + o_x/VIS_ZOOM, 0xff, v_w+1 );
...@@ -353,7 +355,7 @@ o o X o o o X X X X X o o X X X X o o o X X X X X o o X X X o o o X X X o o X o ...@@ -353,7 +355,7 @@ o o X o o o X X X X X o o X X X X o o o X X X X X o o X X X o o o X X X o o X o
if( p_vout->p_sys->b_visible ) if( p_vout->p_sys->b_visible )
{ {
/* zoom gauge */ /* zoom gauge */
memset( p_oyp->p_pixels p_vout->p_libvlc->pf_memset( p_oyp->p_pixels
+ (v_h+9)*p_oyp->i_pitch, + (v_h+9)*p_oyp->i_pitch,
0xff, 41 ); 0xff, 41 );
for( y = v_h + 10; y < v_h + 90; y++ ) for( y = v_h + 10; y < v_h + 90; y++ )
...@@ -362,7 +364,7 @@ o o X o o o X X X X X o o X X X X o o o X X X X X o o X X X o o o X X X o o X o ...@@ -362,7 +364,7 @@ o o X o o o X X X X X o o X X X X o o o X X X X X o o X X X o o o X X X o o X o
width = (width*width)/160; width = (width*width)/160;
if( (80 - y + v_h)*10 < o_zoom ) if( (80 - y + v_h)*10 < o_zoom )
{ {
memset( p_oyp->p_pixels p_vout->p_libvlc->pf_memset( p_oyp->p_pixels
+ y*p_oyp->i_pitch, + y*p_oyp->i_pitch,
0xff, width ); 0xff, width );
} }
......
...@@ -699,7 +699,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date ) ...@@ -699,7 +699,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
} }
} }
/* Gaussian convolution to make it look cleaner */ /* Gaussian convolution to make it look cleaner */
memset( p_a, 0, 2 * i_pitch ); p_filter->p_libvlc->pf_memset( p_a, 0, 2 * i_pitch );
for( i = 2; i < i_lines - 2; i++ ) for( i = 2; i < i_lines - 2; i++ )
{ {
p_a[i*i_pitch] = 0x00; p_a[i*i_pitch] = 0x00;
......
...@@ -157,9 +157,11 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) ...@@ -157,9 +157,11 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
v = p_filter->p_sys->v; v = p_filter->p_sys->v;
for( y = 0; y<p_outpic->p[U_PLANE].i_lines; y++) for( y = 0; y<p_outpic->p[U_PLANE].i_lines; y++)
{ {
memset( p_outpic->p[U_PLANE].p_pixels+y*p_outpic->p[U_PLANE].i_pitch, p_filter->p_libvlc->pf_memset(
p_outpic->p[U_PLANE].p_pixels+y*p_outpic->p[U_PLANE].i_pitch,
u, p_outpic->p[U_PLANE].i_pitch ); u, p_outpic->p[U_PLANE].i_pitch );
memset( p_outpic->p[V_PLANE].p_pixels+y*p_outpic->p[V_PLANE].i_pitch, p_filter->p_libvlc->pf_memset(
p_outpic->p[V_PLANE].p_pixels+y*p_outpic->p[V_PLANE].i_pitch,
v, p_outpic->p[V_PLANE].i_pitch ); v, p_outpic->p[V_PLANE].i_pitch );
if( v == 0 && u != 0 ) if( v == 0 && u != 0 )
u --; u --;
......
...@@ -373,7 +373,8 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -373,7 +373,8 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
uint8_t color = ( i_plane == Y_PLANE ? 0x0 : 0x80 ); uint8_t color = ( i_plane == Y_PLANE ? 0x0 : 0x80 );
for( ; i_row < i_last_row; i_row++, i_orow++ ) for( ; i_row < i_last_row; i_row++, i_orow++ )
{ {
memset( p_out->p_pixels + i_row * i_pitch p_vout->p_libvlc->
pf_memset( p_out->p_pixels + i_row * i_pitch
+ i_col * i_pitch / i_cols, + i_col * i_pitch / i_cols,
color, i_pitch / i_cols ); color, i_pitch / i_cols );
} }
...@@ -382,7 +383,8 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -382,7 +383,8 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
{ {
for( ; i_row < i_last_row; i_row++, i_orow++ ) for( ; i_row < i_last_row; i_row++, i_orow++ )
{ {
memcpy( p_out->p_pixels + i_row * i_pitch p_vout->p_libvlc->
pf_memcpy( p_out->p_pixels + i_row * i_pitch
+ i_col * i_pitch / i_cols, + i_col * i_pitch / i_cols,
p_in->p_pixels + i_orow * i_pitch p_in->p_pixels + i_orow * i_pitch
+ i_ocol * i_pitch / i_cols, + i_ocol * i_pitch / i_cols,
...@@ -403,7 +405,8 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -403,7 +405,8 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
int i_last_row = i_row + 1; int i_last_row = i_row + 1;
i_row *= p_in->i_lines / i_rows; i_row *= p_in->i_lines / i_rows;
i_last_row *= p_in->i_lines / i_rows; i_last_row *= p_in->i_lines / i_rows;
memset( p_out->p_pixels + i_row * i_pitch p_vout->p_libvlc->
pf_memset( p_out->p_pixels + i_row * i_pitch
+ i_col * i_pitch / i_cols, + i_col * i_pitch / i_cols,
0xff, i_pitch / i_cols ); 0xff, i_pitch / i_cols );
for( ; i_row < i_last_row; i_row++ ) for( ; i_row < i_last_row; i_row++ )
...@@ -414,7 +417,8 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -414,7 +417,8 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
+ (i_col+1) * i_pitch / i_cols - 1 ] = 0xff; + (i_col+1) * i_pitch / i_cols - 1 ] = 0xff;
} }
i_row--; i_row--;
memset( p_out->p_pixels + i_row * i_pitch p_vout->p_libvlc->
pf_memset( p_out->p_pixels + i_row * i_pitch
+ i_col * i_pitch / i_cols, + i_col * i_pitch / i_cols,
0xff, i_pitch / i_cols ); 0xff, i_pitch / i_cols );
} }
......
...@@ -176,13 +176,15 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) ...@@ -176,13 +176,15 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
p_pic->p[i_index].i_visible_pitch + i_offset ); p_pic->p[i_index].i_visible_pitch + i_offset );
p_in -= p_pic->p[i_index].i_pitch; p_in -= p_pic->p[i_index].i_pitch;
p_out += p_outpic->p[i_index].i_pitch; p_out += p_outpic->p[i_index].i_pitch;
memset( p_out + i_offset, black_pixel, -i_offset ); p_filter->p_libvlc->pf_memset( p_out + i_offset,
black_pixel, -i_offset );
} }
else else
{ {
p_filter->p_libvlc->pf_memcpy( p_out + i_offset, p_in, p_filter->p_libvlc->pf_memcpy( p_out + i_offset, p_in,
p_pic->p[i_index].i_visible_pitch - i_offset ); p_pic->p[i_index].i_visible_pitch - i_offset );
memset( p_out, black_pixel, i_offset ); p_filter->p_libvlc->pf_memset( p_out, black_pixel,
i_offset );
p_in -= p_pic->p[i_index].i_pitch; p_in -= p_pic->p[i_index].i_pitch;
p_out += p_outpic->p[i_index].i_pitch; p_out += p_outpic->p[i_index].i_pitch;
} }
......
...@@ -164,13 +164,15 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) ...@@ -164,13 +164,15 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
p_pic->p[i_index].i_visible_pitch + i_offset ); p_pic->p[i_index].i_visible_pitch + i_offset );
p_in += p_pic->p[i_index].i_pitch; p_in += p_pic->p[i_index].i_pitch;
p_out += p_outpic->p[i_index].i_pitch; p_out += p_outpic->p[i_index].i_pitch;
memset( p_out + i_offset, black_pixel, -i_offset ); p_filter->p_libvlc->pf_memset( p_out + i_offset,
black_pixel, -i_offset );
} }
else else
{ {
p_filter->p_libvlc->pf_memcpy( p_out + i_offset, p_in, p_filter->p_libvlc->pf_memcpy( p_out + i_offset, p_in,
p_pic->p[i_index].i_visible_pitch - i_offset ); p_pic->p[i_index].i_visible_pitch - i_offset );
memset( p_out, black_pixel, i_offset ); p_filter->p_libvlc->pf_memset( p_out, black_pixel,
i_offset );
p_in += p_pic->p[i_index].i_pitch; p_in += p_pic->p[i_index].i_pitch;
p_out += p_outpic->p[i_index].i_pitch; p_out += p_outpic->p[i_index].i_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