[vlc-commits] Fixed motiondetect packed YUV filter function.
Laurent Aimar
git at videolan.org
Sat Jan 7 01:29:56 CET 2012
vlc/vlc-1.2 | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Jan 7 00:35:15 2012 +0100| [0428f1424acbf1a9495bf4095b2be93f9a1942f9] | committer: Jean-Baptiste Kempf
Fixed motiondetect packed YUV filter function.
A filter shall not return an input buffer.
It closes #5748.
(cherry picked from commit 76821fb12d7e3a5cf6be62f023852c8091b09a69)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.2.git/?a=commit;h=0428f1424acbf1a9495bf4095b2be93f9a1942f9
---
modules/video_filter/motiondetect.c | 34 +++++++++++++++++++---------------
1 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/modules/video_filter/motiondetect.c b/modules/video_filter/motiondetect.c
index a7062cf..c19b0c6 100644
--- a/modules/video_filter/motiondetect.c
+++ b/modules/video_filter/motiondetect.c
@@ -277,40 +277,44 @@ static picture_t *FilterPacked( filter_t *p_filter, picture_t *p_inpic )
const video_format_t *p_fmt = &p_filter->fmt_in.video;
picture_t *p_outpic;
- const uint8_t *p_inpix = p_inpic->p[Y_PLANE].p_pixels;
- const int i_src_pitch = p_inpic->p[Y_PLANE].i_pitch;
-
uint8_t *p_oldpix = p_sys->p_old->p[Y_PLANE].p_pixels;
const int i_old_pitch = p_sys->p_old->p[Y_PLANE].i_pitch;
uint32_t *p_buf = p_sys->p_buf;
uint32_t *p_buf2= p_sys->p_buf2;
- int i_y_offset, i_u_offset, i_v_offset;
-
unsigned x, y;
- if( GetPackedYuvOffsets( p_fmt->i_chroma,
- &i_y_offset, &i_u_offset, &i_v_offset ) )
+ if( !p_inpic )
+ return NULL;
+
+ const uint8_t *p_inpix = p_inpic->p[Y_PLANE].p_pixels;
+ const int i_src_pitch = p_inpic->p[Y_PLANE].i_pitch;
+
+ p_outpic = filter_NewPicture( p_filter );
+ if( !p_outpic )
{
- msg_Warn( p_filter, "Unsupported input chroma (%4.4s)",
- (char*)&p_fmt->i_chroma );
- return p_inpic;
+ picture_Release( p_inpic );
+ return NULL;
}
+ picture_Copy( p_outpic, p_inpic );
if( !p_sys->b_old )
{
picture_Copy( p_sys->p_old, p_inpic );
+ picture_Release( p_inpic );
p_sys->b_old = true;
- return p_inpic;
+ return p_outpic;
}
- p_outpic = filter_NewPicture( p_filter );
- if( !p_outpic )
+ int i_y_offset, i_u_offset, i_v_offset;
+ if( GetPackedYuvOffsets( p_fmt->i_chroma,
+ &i_y_offset, &i_u_offset, &i_v_offset ) )
{
+ msg_Warn( p_filter, "Unsupported input chroma (%4.4s)",
+ (char*)&p_fmt->i_chroma );
picture_Release( p_inpic );
- return NULL;
+ return p_outpic;
}
- picture_Copy( p_outpic, p_inpic );
/* Substract all planes at once */
More information about the vlc-commits
mailing list