Signed-off-by: Michael Niedermayer <michaelni@gmx.at>tags/n2.0
@@ -701,49 +701,6 @@ static void do_audio_out(AVFormatContext *s, OutputStream *ost, | |||
} | |||
} | |||
#if FF_API_DEINTERLACE | |||
static void pre_process_video_frame(InputStream *ist, AVPicture *picture, void **bufp) | |||
{ | |||
AVCodecContext *dec; | |||
AVPicture *picture2; | |||
AVPicture picture_tmp; | |||
uint8_t *buf = 0; | |||
dec = ist->st->codec; | |||
/* deinterlace : must be done before any resize */ | |||
if (FF_API_DEINTERLACE && do_deinterlace) { | |||
int size; | |||
/* create temporary picture */ | |||
size = avpicture_get_size(dec->pix_fmt, dec->width, dec->height); | |||
if (size < 0) | |||
return; | |||
buf = av_malloc(size); | |||
if (!buf) | |||
return; | |||
picture2 = &picture_tmp; | |||
avpicture_fill(picture2, buf, dec->pix_fmt, dec->width, dec->height); | |||
if (avpicture_deinterlace(picture2, picture, | |||
dec->pix_fmt, dec->width, dec->height) < 0) { | |||
/* if error, do not deinterlace */ | |||
av_log(NULL, AV_LOG_WARNING, "Deinterlacing failed\n"); | |||
av_free(buf); | |||
buf = NULL; | |||
picture2 = picture; | |||
} | |||
} else { | |||
picture2 = picture; | |||
} | |||
if (picture != picture2) | |||
*picture = *picture2; | |||
*bufp = buf; | |||
} | |||
#endif | |||
static void do_subtitle_out(AVFormatContext *s, | |||
OutputStream *ost, | |||
InputStream *ist, | |||
@@ -1712,9 +1669,6 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output) | |||
} | |||
pkt->size = 0; | |||
#if FF_API_DEINTERLACE | |||
pre_process_video_frame(ist, (AVPicture *)decoded_frame, &buffer_to_free); | |||
#endif | |||
rate_emu_sleep(ist); | |||
@@ -604,6 +604,24 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, | |||
pad_idx = 0; | |||
} | |||
if (do_deinterlace) { | |||
AVFilterContext *yadif; | |||
snprintf(name, sizeof(name), "deinterlace input from stream %d:%d", | |||
ist->file_index, ist->st->index); | |||
if ((ret = avfilter_graph_create_filter(&yadif, | |||
avfilter_get_by_name("yadif"), | |||
name, "", NULL, | |||
fg->graph)) < 0) | |||
return ret; | |||
if ((ret = avfilter_link(yadif, 0, first_filter, pad_idx)) < 0) | |||
return ret; | |||
first_filter = yadif; | |||
pad_idx = 0; | |||
} | |||
if ((ret = avfilter_link(ifilter->filter, 0, first_filter, pad_idx)) < 0) | |||
return ret; | |||
return 0; | |||
@@ -2233,15 +2233,6 @@ static int opt_vsync(void *optctx, const char *opt, const char *arg) | |||
return 0; | |||
} | |||
#if FF_API_DEINTERLACE | |||
static int opt_deinterlace(void *optctx, const char *opt, const char *arg) | |||
{ | |||
av_log(NULL, AV_LOG_WARNING, "-%s is deprecated, use -filter:v yadif instead\n", opt); | |||
do_deinterlace = 1; | |||
return 0; | |||
} | |||
#endif | |||
static int opt_timecode(void *optctx, const char *opt, const char *arg) | |||
{ | |||
OptionsContext *o = optctx; | |||
@@ -2656,10 +2647,8 @@ const OptionDef options[] = { | |||
{ "passlogfile", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_EXPERT | OPT_SPEC | | |||
OPT_OUTPUT, { .off = OFFSET(passlogfiles) }, | |||
"select two pass log file name prefix", "prefix" }, | |||
#if FF_API_DEINTERLACE | |||
{ "deinterlace", OPT_VIDEO | OPT_EXPERT , { .func_arg = opt_deinterlace }, | |||
{ "deinterlace", OPT_VIDEO | OPT_BOOL | OPT_EXPERT, { &do_deinterlace }, | |||
"this option is deprecated, use the yadif filter instead" }, | |||
#endif | |||
{ "psnr", OPT_VIDEO | OPT_BOOL | OPT_EXPERT, { &do_psnr }, | |||
"calculate PSNR of compressed frames" }, | |||
{ "vstats", OPT_VIDEO | OPT_EXPERT , { &opt_vstats }, | |||