aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/yadif_common.c
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2018-11-04 10:02:07 -0800
committerPhilip Langdale <philipl@overt.org>2018-11-14 17:41:01 -0800
commitfa74e4aef2103e27424d2cfae3f142149b6a3b36 (patch)
tree692223a83e3b850bd80788e2eb7baf5121a705ce /libavfilter/yadif_common.c
parent19d3d0c0570981ddc8a224f07d734ff75d76e234 (diff)
downloadffmpeg-fa74e4aef2103e27424d2cfae3f142149b6a3b36.tar.gz
avfilter/yadif_common: Add field type tracking to help bwdif
The bwdif filter can use common yadif frame management if we track when a field is the first or last field in a sequence. While this information is not used by yadif, the added benefit of removing the duplicated frame management logic makes it worth tracking this state in the common code.
Diffstat (limited to 'libavfilter/yadif_common.c')
-rw-r--r--libavfilter/yadif_common.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libavfilter/yadif_common.c b/libavfilter/yadif_common.c
index 19e8ac5281..a10cf7a17f 100644
--- a/libavfilter/yadif_common.c
+++ b/libavfilter/yadif_common.c
@@ -44,6 +44,8 @@ static int return_frame(AVFilterContext *ctx, int is_second)
av_frame_copy_props(yadif->out, yadif->cur);
yadif->out->interlaced_frame = 0;
+ if (yadif->current_field == YADIF_FIELD_BACK_END)
+ yadif->current_field = YADIF_FIELD_END;
}
yadif->filter(ctx, yadif->out, tff ^ !is_second, tff);
@@ -103,9 +105,12 @@ int ff_yadif_filter_frame(AVFilterLink *link, AVFrame *frame)
yadif->cur = yadif->next;
yadif->next = frame;
- if (!yadif->cur &&
- !(yadif->cur = av_frame_clone(yadif->next)))
- return AVERROR(ENOMEM);
+ if (!yadif->cur) {
+ yadif->cur = av_frame_clone(yadif->next);
+ if (!yadif->cur)
+ return AVERROR(ENOMEM);
+ yadif->current_field = YADIF_FIELD_END;
+ }
if (checkstride(yadif, yadif->next, yadif->cur)) {
av_log(ctx, AV_LOG_VERBOSE, "Reallocating frame due to differing stride\n");
@@ -173,6 +178,7 @@ int ff_yadif_request_frame(AVFilterLink *link)
if (!next)
return AVERROR(ENOMEM);
+ yadif->current_field = YADIF_FIELD_BACK_END;
next->pts = yadif->next->pts * 2 - yadif->cur->pts;
ff_yadif_filter_frame(ctx->inputs[0], next);