Commit 0428f142 authored by Laurent Aimar's avatar Laurent Aimar Committed by Jean-Baptiste Kempf

Fixed motiondetect packed YUV filter function.

A filter shall not return an input buffer.
It closes #5748.
(cherry picked from commit 76821fb1)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 06867781
...@@ -277,40 +277,44 @@ static picture_t *FilterPacked( filter_t *p_filter, picture_t *p_inpic ) ...@@ -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; const video_format_t *p_fmt = &p_filter->fmt_in.video;
picture_t *p_outpic; 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; 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; 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_buf = p_sys->p_buf;
uint32_t *p_buf2= p_sys->p_buf2; uint32_t *p_buf2= p_sys->p_buf2;
int i_y_offset, i_u_offset, i_v_offset;
unsigned x, y; unsigned x, y;
if( GetPackedYuvOffsets( p_fmt->i_chroma, if( !p_inpic )
&i_y_offset, &i_u_offset, &i_v_offset ) ) 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)", picture_Release( p_inpic );
(char*)&p_fmt->i_chroma ); return NULL;
return p_inpic;
} }
picture_Copy( p_outpic, p_inpic );
if( !p_sys->b_old ) if( !p_sys->b_old )
{ {
picture_Copy( p_sys->p_old, p_inpic ); picture_Copy( p_sys->p_old, p_inpic );
picture_Release( p_inpic );
p_sys->b_old = true; p_sys->b_old = true;
return p_inpic; return p_outpic;
} }
p_outpic = filter_NewPicture( p_filter ); int i_y_offset, i_u_offset, i_v_offset;
if( !p_outpic ) 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 ); picture_Release( p_inpic );
return NULL; return p_outpic;
} }
picture_Copy( p_outpic, p_inpic );
/* Substract all planes at once */ /* Substract all planes at once */
......
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