@ -203,6 +203,7 @@ static av_cold void uninit(AVFilterContext *ctx)
av_frame_free ( & tinterlace - > next ) ;
av_frame_free ( & tinterlace - > next ) ;
av_freep ( & tinterlace - > black_data [ 0 ] [ 0 ] ) ;
av_freep ( & tinterlace - > black_data [ 0 ] [ 0 ] ) ;
av_freep ( & tinterlace - > black_data [ 1 ] [ 0 ] ) ;
av_freep ( & tinterlace - > black_data [ 1 ] [ 0 ] ) ;
ff_ccfifo_freep ( & tinterlace - > cc_fifo ) ;
}
}
static int config_out_props ( AVFilterLink * outlink )
static int config_out_props ( AVFilterLink * outlink )
@ -291,6 +292,11 @@ static int config_out_props(AVFilterLink *outlink)
# endif
# endif
}
}
if ( ! ( tinterlace - > cc_fifo = ff_ccfifo_alloc ( outlink - > frame_rate , ctx ) ) ) {
av_log ( ctx , AV_LOG_ERROR , " Failure to setup CC FIFO queue \n " ) ;
return AVERROR ( ENOMEM ) ;
}
av_log ( ctx , AV_LOG_VERBOSE , " mode:%d filter:%s h:%d -> h:%d \n " , tinterlace - > mode ,
av_log ( ctx , AV_LOG_VERBOSE , " mode:%d filter:%s h:%d -> h:%d \n " , tinterlace - > mode ,
( tinterlace - > flags & TINTERLACE_FLAG_CVLPF ) ? " complex " :
( tinterlace - > flags & TINTERLACE_FLAG_CVLPF ) ? " complex " :
( tinterlace - > flags & TINTERLACE_FLAG_VLPF ) ? " linear " : " off " ,
( tinterlace - > flags & TINTERLACE_FLAG_VLPF ) ? " linear " : " off " ,
@ -375,6 +381,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
tinterlace - > cur = tinterlace - > next ;
tinterlace - > cur = tinterlace - > next ;
tinterlace - > next = picref ;
tinterlace - > next = picref ;
ff_ccfifo_extract ( tinterlace - > cc_fifo , picref ) ;
cur = tinterlace - > cur ;
cur = tinterlace - > cur ;
next = tinterlace - > next ;
next = tinterlace - > next ;
/* we need at least two frames */
/* we need at least two frames */
@ -456,6 +464,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
if ( ! out )
if ( ! out )
return AVERROR ( ENOMEM ) ;
return AVERROR ( ENOMEM ) ;
out - > pts / = 2 ; // adjust pts to new framerate
out - > pts / = 2 ; // adjust pts to new framerate
ff_ccfifo_inject ( tinterlace - > cc_fifo , out ) ;
ret = ff_filter_frame ( outlink , out ) ;
ret = ff_filter_frame ( outlink , out ) ;
return ret ;
return ret ;
}
}
@ -505,6 +514,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
out - > pts = cur - > pts * 2 ;
out - > pts = cur - > pts * 2 ;
out - > pts = av_rescale_q ( out - > pts , tinterlace - > preout_time_base , outlink - > time_base ) ;
out - > pts = av_rescale_q ( out - > pts , tinterlace - > preout_time_base , outlink - > time_base ) ;
ff_ccfifo_inject ( tinterlace - > cc_fifo , out ) ;
if ( ( ret = ff_filter_frame ( outlink , out ) ) < 0 )
if ( ( ret = ff_filter_frame ( outlink , out ) ) < 0 )
return ret ;
return ret ;
@ -549,6 +559,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
out - > pts = av_rescale_q ( out - > pts , tinterlace - > preout_time_base , outlink - > time_base ) ;
out - > pts = av_rescale_q ( out - > pts , tinterlace - > preout_time_base , outlink - > time_base ) ;
out - > duration = av_rescale_q ( 1 , av_inv_q ( outlink - > frame_rate ) , outlink - > time_base ) ;
out - > duration = av_rescale_q ( 1 , av_inv_q ( outlink - > frame_rate ) , outlink - > time_base ) ;
ff_ccfifo_inject ( tinterlace - > cc_fifo , out ) ;
ret = ff_filter_frame ( outlink , out ) ;
ret = ff_filter_frame ( outlink , out ) ;
return ret ;
return ret ;