Becareful that it adds a delay of one frame, so it needs to be
flushed on discontinuity and it will return NULL one time.
static void RenderBlend ( filter_t *, picture_t *, picture_t * );
static void RenderLinear ( filter_t *, picture_t *, picture_t *, int );
static void RenderX ( picture_t *, picture_t * );
static void RenderBlend ( filter_t *, picture_t *, picture_t * );
static void RenderLinear ( filter_t *, picture_t *, picture_t *, int );
static void RenderX ( picture_t *, picture_t * );
-static void RenderYadif ( filter_t *, picture_t *, picture_t *, int, int );
+static int RenderYadif ( filter_t *, picture_t *, picture_t *, int, int );
static void MergeGeneric ( void *, const void *, const void *, size_t );
#if defined(CAN_COMPILE_C_ALTIVEC)
static void MergeGeneric ( void *, const void *, const void *, size_t );
#if defined(CAN_COMPILE_C_ALTIVEC)
/* yadif.h comes from vf_yadif.c of mplayer project */
#include "yadif.h"
/* yadif.h comes from vf_yadif.c of mplayer project */
#include "yadif.h"
-static void RenderYadif( filter_t *p_filter, picture_t *p_dst, picture_t *p_src, int i_order, int i_field )
+static int RenderYadif( filter_t *p_filter, picture_t *p_dst, picture_t *p_src, int i_order, int i_field )
{
filter_sys_t *p_sys = p_filter->p_sys;
{
filter_sys_t *p_sys = p_filter->p_sys;
/* */
p_dst->date = (p_next->date - p_cur->date) * i_order / 2 + p_cur->date;
/* */
p_dst->date = (p_next->date - p_cur->date) * i_order / 2 + p_cur->date;
+ return VLC_SUCCESS;
+ }
+ else if( !p_prev && !p_cur && p_next )
+ {
+ RenderX( p_dst, p_next );
+ return VLC_SUCCESS;
- /* Fallback to something simple
- * XXX it is wrong when we have 2 pictures, we should not output a picture */
- RenderX( p_dst, p_src );
+ picture_CopyProperties( p_pic_dst, p_pic );
+
switch( p_sys->i_mode )
{
case DEINTERLACE_DISCARD:
switch( p_sys->i_mode )
{
case DEINTERLACE_DISCARD:
break;
case DEINTERLACE_YADIF:
break;
case DEINTERLACE_YADIF:
- msg_Err( p_filter, "delaying frames is not supported yet" );
- //RenderYadif( p_vout, pp_outpic[0], p_pic, 0, 0 );
- picture_Release( p_pic_dst );
- picture_Release( p_pic );
- return NULL;
+ if( RenderYadif( p_filter, p_pic_dst, p_pic, 0, 0 ) )
+ {
+ picture_Release( p_pic_dst );
+ picture_Release( p_pic );
+ return NULL;
+ }
+ break;
case DEINTERLACE_YADIF2X:
msg_Err( p_filter, "doubling the frame rate is not supported yet" );
case DEINTERLACE_YADIF2X:
msg_Err( p_filter, "doubling the frame rate is not supported yet" );
- picture_CopyProperties( p_pic_dst, p_pic );
p_pic_dst->b_progressive = true;
picture_Release( p_pic );
return p_pic_dst;
}
p_pic_dst->b_progressive = true;
picture_Release( p_pic );
return p_pic_dst;
}
+static void Flush( filter_t *p_filter )
+{
+ filter_sys_t *p_sys = p_filter->p_sys;
+
+ for( int i = 0; i < HISTORY_SIZE; i++ )
+ {
+ if( p_sys->pp_history[i] )
+ picture_Release( p_sys->pp_history[i] );
+ p_sys->pp_history[i] = NULL;
+ }
+}
+
static int Mouse( filter_t *p_filter,
vlc_mouse_t *p_mouse, const vlc_mouse_t *p_old, const vlc_mouse_t *p_new )
{
static int Mouse( filter_t *p_filter,
vlc_mouse_t *p_mouse, const vlc_mouse_t *p_old, const vlc_mouse_t *p_new )
{
p_sys->i_mode = DEINTERLACE_BLEND;
p_sys->b_double_rate = false;
p_sys->b_half_height = true;
p_sys->i_mode = DEINTERLACE_BLEND;
p_sys->b_double_rate = false;
p_sys->b_half_height = true;
+ for( int i = 0; i < HISTORY_SIZE; i++ )
+ p_sys->pp_history[i] = NULL;
#if defined(CAN_COMPILE_C_ALTIVEC)
if( vlc_CPU() & CPU_CAPABILITY_ALTIVEC )
#if defined(CAN_COMPILE_C_ALTIVEC)
if( vlc_CPU() & CPU_CAPABILITY_ALTIVEC )
p_filter->fmt_out.video = fmt;
p_filter->fmt_out.i_codec = fmt.i_chroma;
p_filter->pf_video_filter = Deinterlace;
p_filter->fmt_out.video = fmt;
p_filter->fmt_out.i_codec = fmt.i_chroma;
p_filter->pf_video_filter = Deinterlace;
+ p_filter->pf_video_flush = Flush;
p_filter->pf_video_mouse = Mouse;
msg_Dbg( p_filter, "deinterlacing" );
p_filter->pf_video_mouse = Mouse;
msg_Dbg( p_filter, "deinterlacing" );
{
filter_t *p_filter = (filter_t*)p_this;
{
filter_t *p_filter = (filter_t*)p_this;
free( p_filter->p_sys );
}
free( p_filter->p_sys );
}