Commit 1eaa7b8c authored by Laurent Aimar's avatar Laurent Aimar

Fixed deinterlacing for i422.

Initial report/patch by Marian Durkovic.
parent 769bef87
......@@ -308,13 +308,14 @@ static void SetFilterMethod( vout_thread_t *p_vout, char *psz_method )
}
else
{
const bool b_i422 = p_vout->render.i_chroma == VLC_FOURCC('I','4','2','2');
if( strcmp( psz_method, "discard" ) )
msg_Err( p_vout, "no valid deinterlace mode provided, "
"using \"discard\"" );
p_vout->p_sys->i_mode = DEINTERLACE_DISCARD;
p_vout->p_sys->b_double_rate = false;
p_vout->p_sys->b_half_height = true;
p_vout->p_sys->b_half_height = !b_i422;
}
msg_Dbg( p_vout, "using %s deinterlace method", psz_method );
......@@ -384,22 +385,32 @@ static vout_thread_t *SpawnRealVout( vout_thread_t *p_vout )
msg_Dbg( p_vout, "spawning the real video output" );
fmt = p_vout->fmt_out;
if( p_vout->p_sys->b_half_height )
{
fmt.i_height /= 2; fmt.i_visible_height /= 2; fmt.i_y_offset /= 2;
fmt.i_sar_den *= 2;
}
switch( p_vout->render.i_chroma )
{
case VLC_FOURCC('I','4','2','0'):
case VLC_FOURCC('I','Y','U','V'):
case VLC_FOURCC('Y','V','1','2'):
if( p_vout->p_sys->b_half_height )
{
fmt.i_height /= 2; fmt.i_visible_height /= 2; fmt.i_y_offset /= 2;
fmt.i_sar_den *= 2;
}
p_real_vout = vout_Create( p_vout, &fmt );
break;
case VLC_FOURCC('I','4','2','2'):
switch( p_vout->p_sys->i_mode )
{
case DEINTERLACE_MEAN:
case DEINTERLACE_LINEAR:
case DEINTERLACE_X:
fmt.i_chroma = VLC_FOURCC('I','4','2','2');
break;
default:
fmt.i_chroma = VLC_FOURCC('I','4','2','0');
break;
}
p_real_vout = vout_Create( p_vout, &fmt );
break;
......@@ -1998,16 +2009,8 @@ static int SendEvents( vlc_object_t *p_this, char const *psz_var,
vout_thread_t *p_vout = (vout_thread_t *)_p_vout;
vlc_value_t sentval = newval;
if( !strcmp( psz_var, "mouse-y" ) )
{
switch( p_vout->p_sys->i_mode )
{
case DEINTERLACE_MEAN:
case DEINTERLACE_DISCARD:
if( !strcmp( psz_var, "mouse-y" ) && p_vout->p_sys->b_half_height )
sentval.i_int *= 2;
break;
}
}
var_Set( p_vout, psz_var, sentval );
......@@ -2023,53 +2026,19 @@ static int FilterCallback( vlc_object_t *p_this, char const *psz_cmd,
{
VLC_UNUSED(psz_cmd); VLC_UNUSED(p_data); VLC_UNUSED(oldval);
vout_thread_t * p_vout = (vout_thread_t *)p_this;
int i_old_mode = p_vout->p_sys->i_mode;
msg_Dbg( p_vout, "using %s deinterlace mode", newval.psz_string );
vlc_mutex_lock( &p_vout->p_sys->filter_lock );
const bool b_old_half_height = p_vout->p_sys->b_half_height;
SetFilterMethod( p_vout, newval.psz_string );
switch( p_vout->render.i_chroma )
{
case VLC_FOURCC('I','4','2','2'):
vlc_mutex_unlock( &p_vout->p_sys->filter_lock );
return VLC_SUCCESS;
break;
case VLC_FOURCC('I','4','2','0'):
case VLC_FOURCC('I','Y','U','V'):
case VLC_FOURCC('Y','V','1','2'):
switch( p_vout->p_sys->i_mode )
{
case DEINTERLACE_MEAN:
case DEINTERLACE_DISCARD:
if( ( i_old_mode == DEINTERLACE_MEAN )
|| ( i_old_mode == DEINTERLACE_DISCARD ) )
if( !b_old_half_height == !p_vout->p_sys->b_half_height )
{
vlc_mutex_unlock( &p_vout->p_sys->filter_lock );
return VLC_SUCCESS;
}
break;
case DEINTERLACE_BOB:
case DEINTERLACE_BLEND:
case DEINTERLACE_LINEAR:
if( ( i_old_mode == DEINTERLACE_BOB )
|| ( i_old_mode == DEINTERLACE_BLEND )
|| ( i_old_mode == DEINTERLACE_LINEAR ) )
{
vlc_mutex_unlock( &p_vout->p_sys->filter_lock );
return VLC_SUCCESS;
}
break;
}
break;
default:
break;
}
/* We need to kill the old vout */
if( p_vout->p_sys->p_vout )
......
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