[vlc-commits] postproc: factor common code
Rémi Denis-Courmont
git at videolan.org
Thu Jul 24 18:12:07 CEST 2014
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Jul 24 19:11:01 2014 +0300| [cfad00bfa2932df04d4147d4449431f52b1d2852] | committer: Rémi Denis-Courmont
postproc: factor common code
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cfad00bfa2932df04d4147d4449431f52b1d2852
---
modules/video_filter/postproc.c | 42 ++++++++++++++++++---------------------
1 file changed, 19 insertions(+), 23 deletions(-)
diff --git a/modules/video_filter/postproc.c b/modules/video_filter/postproc.c
index 8ca5507..3ee8882 100644
--- a/modules/video_filter/postproc.c
+++ b/modules/video_filter/postproc.c
@@ -286,11 +286,6 @@ static picture_t *PostprocPict( filter_t *p_filter, picture_t *p_pic )
{
filter_sys_t *p_sys = p_filter->p_sys;
- const uint8_t *src[3];
- uint8_t *dst[3];
- int i_plane;
- int i_src_stride[3], i_dst_stride[3];
-
picture_t *p_outpic = filter_NewPicture( p_filter );
if( !p_outpic )
{
@@ -300,29 +295,30 @@ static picture_t *PostprocPict( filter_t *p_filter, picture_t *p_pic )
/* Lock to prevent issues if pp_mode is changed */
vlc_mutex_lock( &p_sys->lock );
- if( !p_sys->pp_mode )
+ if( p_sys->pp_mode != NULL )
{
- vlc_mutex_unlock( &p_sys->lock );
- picture_CopyPixels( p_outpic, p_pic );
- return CopyInfoAndRelease( p_outpic, p_pic );
- }
+ const uint8_t *src[3];
+ uint8_t *dst[3];
+ int i_src_stride[3], i_dst_stride[3];
+ for( int i_plane = 0; i_plane < p_pic->i_planes; i_plane++ )
+ {
+ src[i_plane] = p_pic->p[i_plane].p_pixels;
+ dst[i_plane] = p_outpic->p[i_plane].p_pixels;
- for( i_plane = 0; i_plane < p_pic->i_planes; i_plane++ )
- {
- src[i_plane] = p_pic->p[i_plane].p_pixels;
- dst[i_plane] = p_outpic->p[i_plane].p_pixels;
+ /* I'm not sure what happens if i_pitch != i_visible_pitch ...
+ * at least it shouldn't crash. */
+ i_src_stride[i_plane] = p_pic->p[i_plane].i_pitch;
+ i_dst_stride[i_plane] = p_outpic->p[i_plane].i_pitch;
+ }
- /* I'm not sure what happens if i_pitch != i_visible_pitch ...
- * at least it shouldn't crash. */
- i_src_stride[i_plane] = p_pic->p[i_plane].i_pitch;
- i_dst_stride[i_plane] = p_outpic->p[i_plane].i_pitch;
+ pp_postprocess( src, i_src_stride, dst, i_dst_stride,
+ p_filter->fmt_in.video.i_width,
+ p_filter->fmt_in.video.i_height, NULL, 0,
+ p_sys->pp_mode, p_sys->pp_context, 0 );
}
-
- pp_postprocess( src, i_src_stride, dst, i_dst_stride,
- p_filter->fmt_in.video.i_width,
- p_filter->fmt_in.video.i_height, NULL, 0,
- p_sys->pp_mode, p_sys->pp_context, 0 );
+ else
+ picture_CopyPixels( p_outpic, p_pic );
vlc_mutex_unlock( &p_sys->lock );
return CopyInfoAndRelease( p_outpic, p_pic );
More information about the vlc-commits
mailing list