Commit c6a9a4c5 authored by Laurent Aimar's avatar Laurent Aimar

Use the same algo for I420 and I422 way when deinterlacing using 'bob' mode.

The code used for I422 was a mix of bob (luma) and discard (chroma).
parent 67e3c15b
......@@ -72,8 +72,7 @@ void RenderDiscard( picture_t *p_outpic, picture_t *p_pic, int i_field )
* RenderBob: renders a BOB picture - simple copy
*****************************************************************************/
void RenderBob( filter_t *p_filter,
picture_t *p_outpic, picture_t *p_pic, int i_field )
void RenderBob( picture_t *p_outpic, picture_t *p_pic, int i_field )
{
int i_plane;
......@@ -87,91 +86,36 @@ void RenderBob( filter_t *p_filter,
p_out_end = p_out + p_outpic->p[i_plane].i_pitch
* p_outpic->p[i_plane].i_visible_lines;
switch( p_filter->fmt_in.video.i_chroma )
/* For BOTTOM field we need to add the first line */
if( i_field == 1 )
{
case VLC_CODEC_I420:
case VLC_CODEC_J420:
case VLC_CODEC_YV12:
/* For BOTTOM field we need to add the first line */
if( i_field == 1 )
{
vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
p_in += p_pic->p[i_plane].i_pitch;
p_out += p_outpic->p[i_plane].i_pitch;
}
p_out_end -= 2 * p_outpic->p[i_plane].i_pitch;
for( ; p_out < p_out_end ; )
{
vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
p_out += p_outpic->p[i_plane].i_pitch;
vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
p_in += 2 * p_pic->p[i_plane].i_pitch;
p_out += p_outpic->p[i_plane].i_pitch;
}
vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
/* For TOP field we need to add the last line */
if( i_field == 0 )
{
p_in += p_pic->p[i_plane].i_pitch;
p_out += p_outpic->p[i_plane].i_pitch;
vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
}
break;
case VLC_CODEC_I422:
case VLC_CODEC_J422:
/* For BOTTOM field we need to add the first line */
if( i_field == 1 )
{
vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
p_in += p_pic->p[i_plane].i_pitch;
p_out += p_outpic->p[i_plane].i_pitch;
}
p_out_end -= 2 * p_outpic->p[i_plane].i_pitch;
vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
p_in += p_pic->p[i_plane].i_pitch;
p_out += p_outpic->p[i_plane].i_pitch;
}
if( i_plane == Y_PLANE )
{
for( ; p_out < p_out_end ; )
{
vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
p_out_end -= 2 * p_outpic->p[i_plane].i_pitch;
p_out += p_outpic->p[i_plane].i_pitch;
for( ; p_out < p_out_end ; )
{
vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
p_out += p_outpic->p[i_plane].i_pitch;
p_in += 2 * p_pic->p[i_plane].i_pitch;
p_out += p_outpic->p[i_plane].i_pitch;
}
}
else
{
for( ; p_out < p_out_end ; )
{
vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
p_out += p_outpic->p[i_plane].i_pitch;
p_in += 2 * p_pic->p[i_plane].i_pitch;
}
}
p_in += 2 * p_pic->p[i_plane].i_pitch;
p_out += p_outpic->p[i_plane].i_pitch;
}
vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
/* For TOP field we need to add the last line */
if( i_field == 0 )
{
p_in += p_pic->p[i_plane].i_pitch;
p_out += p_outpic->p[i_plane].i_pitch;
vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
}
break;
/* For TOP field we need to add the last line */
if( i_field == 0 )
{
p_in += p_pic->p[i_plane].i_pitch;
p_out += p_outpic->p[i_plane].i_pitch;
vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
}
}
}
......
......@@ -59,15 +59,13 @@ void RenderDiscard( picture_t *p_outpic, picture_t *p_pic, int i_field );
*
* For a 1x (non-doubling) near-equivalent, see RenderDiscard().
*
* @param p_filter The filter instance. Must be non-NULL.
* @param p_outpic Output frame. Must be allocated by caller.
* @param p_pic Input frame. Must exist.
* @param i_field Render which field? 0 = top field, 1 = bottom field.
* @see RenderLinear()
* @see Deinterlace()
*/
void RenderBob( filter_t *p_filter,
picture_t *p_outpic, picture_t *p_pic, int i_field );
void RenderBob( picture_t *p_outpic, picture_t *p_pic, int i_field );
/**
* RenderLinear: Bob with linear interpolation.
......
......@@ -254,6 +254,7 @@ void GetOutputFormat( filter_t *p_filter,
case DEINTERLACE_PHOSPHOR:
case DEINTERLACE_IVTC:
case DEINTERLACE_DISCARD:
case DEINTERLACE_BOB:
p_dst->i_chroma = p_src->i_chroma;
break;
default:
......@@ -460,11 +461,11 @@ picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
break;
case DEINTERLACE_BOB:
RenderBob( p_filter, p_dst[0], p_pic, !b_top_field_first );
RenderBob( p_dst[0], p_pic, !b_top_field_first );
if( p_dst[1] )
RenderBob( p_filter, p_dst[1], p_pic, b_top_field_first );
RenderBob( p_dst[1], p_pic, b_top_field_first );
if( p_dst[2] )
RenderBob( p_filter, p_dst[2], p_pic, !b_top_field_first );
RenderBob( p_dst[2], p_pic, !b_top_field_first );
break;;
case DEINTERLACE_LINEAR:
......
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