Commit 67e3c15b authored by Laurent Aimar's avatar Laurent Aimar

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

The code used for I422 was a mix of a simplified bob (luma) and discard (chroma).
parent 54ae9d11
...@@ -42,8 +42,7 @@ ...@@ -42,8 +42,7 @@
* RenderDiscard: only keep TOP or BOTTOM field, discard the other. * RenderDiscard: only keep TOP or BOTTOM field, discard the other.
*****************************************************************************/ *****************************************************************************/
void RenderDiscard( filter_t *p_filter, void RenderDiscard( picture_t *p_outpic, picture_t *p_pic, int i_field )
picture_t *p_outpic, picture_t *p_pic, int i_field )
{ {
int i_plane; int i_plane;
...@@ -51,7 +50,6 @@ void RenderDiscard( filter_t *p_filter, ...@@ -51,7 +50,6 @@ void RenderDiscard( filter_t *p_filter,
for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ ) for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
{ {
uint8_t *p_in, *p_out_end, *p_out; uint8_t *p_in, *p_out_end, *p_out;
int i_increment;
p_in = p_pic->p[i_plane].p_pixels p_in = p_pic->p[i_plane].p_pixels
+ i_field * p_pic->p[i_plane].i_pitch; + i_field * p_pic->p[i_plane].i_pitch;
...@@ -60,50 +58,12 @@ void RenderDiscard( filter_t *p_filter, ...@@ -60,50 +58,12 @@ void RenderDiscard( filter_t *p_filter,
p_out_end = p_out + p_outpic->p[i_plane].i_pitch p_out_end = p_out + p_outpic->p[i_plane].i_pitch
* p_outpic->p[i_plane].i_visible_lines; * p_outpic->p[i_plane].i_visible_lines;
switch( p_filter->fmt_in.video.i_chroma ) for( ; p_out < p_out_end ; )
{ {
case VLC_CODEC_I420: vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
case VLC_CODEC_J420:
case VLC_CODEC_YV12:
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;
p_in += 2 * p_pic->p[i_plane].i_pitch;
}
break;
case VLC_CODEC_I422:
case VLC_CODEC_J422:
i_increment = 2 * p_pic->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 += p_outpic->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 += i_increment;
}
}
else
{
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;
p_in += i_increment;
}
}
break;
default: p_out += p_outpic->p[i_plane].i_pitch;
break; p_in += 2 * p_pic->p[i_plane].i_pitch;
} }
} }
} }
......
...@@ -44,15 +44,13 @@ struct picture_t; ...@@ -44,15 +44,13 @@ struct picture_t;
* *
* For a 2x (framerate-doubling) near-equivalent, see RenderBob(). * For a 2x (framerate-doubling) near-equivalent, see RenderBob().
* *
* @param p_filter The filter instance. Must be non-NULL.
* @param p_outpic Output frame. Must be allocated by caller. * @param p_outpic Output frame. Must be allocated by caller.
* @param p_pic Input frame. Must exist. * @param p_pic Input frame. Must exist.
* @param i_field Keep which field? 0 = top field, 1 = bottom field. * @param i_field Keep which field? 0 = top field, 1 = bottom field.
* @see RenderBob() * @see RenderBob()
* @see Deinterlace() * @see Deinterlace()
*/ */
void RenderDiscard( filter_t *p_filter, void RenderDiscard( picture_t *p_outpic, picture_t *p_pic, int i_field );
picture_t *p_outpic, picture_t *p_pic, int i_field );
/** /**
* RenderBob: basic framerate doubler. * RenderBob: basic framerate doubler.
......
...@@ -135,8 +135,7 @@ static const char *const ppsz_filter_options[] = { ...@@ -135,8 +135,7 @@ static const char *const ppsz_filter_options[] = {
* SetFilterMethod: setup the deinterlace method to use. * SetFilterMethod: setup the deinterlace method to use.
*****************************************************************************/ *****************************************************************************/
void SetFilterMethod( filter_t *p_filter, const char *psz_method, void SetFilterMethod( filter_t *p_filter, const char *psz_method )
vlc_fourcc_t i_chroma )
{ {
filter_sys_t *p_sys = p_filter->p_sys; filter_sys_t *p_sys = p_filter->p_sys;
...@@ -202,12 +201,9 @@ void SetFilterMethod( filter_t *p_filter, const char *psz_method, ...@@ -202,12 +201,9 @@ void SetFilterMethod( filter_t *p_filter, const char *psz_method,
} }
else if( !strcmp( psz_method, "discard" ) ) else if( !strcmp( psz_method, "discard" ) )
{ {
const bool b_i422 = i_chroma == VLC_CODEC_I422 ||
i_chroma == VLC_CODEC_J422;
p_sys->i_mode = DEINTERLACE_DISCARD; p_sys->i_mode = DEINTERLACE_DISCARD;
p_sys->b_double_rate = false; p_sys->b_double_rate = false;
p_sys->b_half_height = !b_i422; p_sys->b_half_height = true;
p_sys->b_use_frame_history = false; p_sys->b_use_frame_history = false;
} }
else else
...@@ -257,6 +253,7 @@ void GetOutputFormat( filter_t *p_filter, ...@@ -257,6 +253,7 @@ void GetOutputFormat( filter_t *p_filter,
case DEINTERLACE_YADIF2X: case DEINTERLACE_YADIF2X:
case DEINTERLACE_PHOSPHOR: case DEINTERLACE_PHOSPHOR:
case DEINTERLACE_IVTC: case DEINTERLACE_IVTC:
case DEINTERLACE_DISCARD:
p_dst->i_chroma = p_src->i_chroma; p_dst->i_chroma = p_src->i_chroma;
break; break;
default: default:
...@@ -459,7 +456,7 @@ picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic ) ...@@ -459,7 +456,7 @@ picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
switch( p_sys->i_mode ) switch( p_sys->i_mode )
{ {
case DEINTERLACE_DISCARD: case DEINTERLACE_DISCARD:
RenderDiscard( p_filter, p_dst[0], p_pic, 0 ); RenderDiscard( p_dst[0], p_pic, 0 );
break; break;
case DEINTERLACE_BOB: case DEINTERLACE_BOB:
...@@ -700,7 +697,7 @@ int Open( vlc_object_t *p_this ) ...@@ -700,7 +697,7 @@ int Open( vlc_object_t *p_this )
p_filter->p_cfg ); p_filter->p_cfg );
char *psz_mode = var_GetNonEmptyString( p_filter, FILTER_CFG_PREFIX "mode" ); char *psz_mode = var_GetNonEmptyString( p_filter, FILTER_CFG_PREFIX "mode" );
SetFilterMethod( p_filter, psz_mode, p_filter->fmt_in.video.i_chroma ); SetFilterMethod( p_filter, psz_mode );
free( psz_mode ); free( psz_mode );
if( p_sys->i_mode == DEINTERLACE_PHOSPHOR ) if( p_sys->i_mode == DEINTERLACE_PHOSPHOR )
......
...@@ -130,11 +130,9 @@ struct filter_sys_t ...@@ -130,11 +130,9 @@ struct filter_sys_t
* *
* @param p_filter The filter instance. * @param p_filter The filter instance.
* @param psz_method Desired method. See mode_list for available choices. * @param psz_method Desired method. See mode_list for available choices.
* @param i_chroma Input chroma. Set this to p_filter->fmt_in.video.i_chroma.
* @see mode_list * @see mode_list
*/ */
void SetFilterMethod( filter_t *p_filter, const char *psz_method, void SetFilterMethod( filter_t *p_filter, const char *psz_method );
vlc_fourcc_t i_chroma );
/** /**
* Get the output video format of the chosen deinterlace method * Get the output video format of the chosen deinterlace method
......
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