diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-11-27 10:49:45 +0400 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-11-28 11:50:19 +0400 |
commit | 565e4993c63f797e2d50ad2f1e8f62fdbe299666 (patch) | |
tree | bae5282b2ee875de4b01467f3cfaab54b0ab6ec0 /libavfilter/vf_yadif.c | |
parent | bb6c67bb36b136de10256f0999128df4a42f9ffc (diff) |
lavfi: merge start_frame/draw_slice/end_frame
Any alleged performance benefits gained from the split are purely
mythological and do not justify added code complexity.
Diffstat (limited to 'libavfilter/vf_yadif.c')
-rw-r--r-- | libavfilter/vf_yadif.c | 47 |
1 files changed, 7 insertions, 40 deletions
diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c index 1c605d942d..db9c71c973 100644 --- a/libavfilter/vf_yadif.c +++ b/libavfilter/vf_yadif.c @@ -202,19 +202,14 @@ static int return_frame(AVFilterContext *ctx, int is_second) } else { yadif->out->pts = AV_NOPTS_VALUE; } - ret = ff_start_frame(ctx->outputs[0], yadif->out); - if (ret < 0) - return ret; } - if ((ret = ff_draw_slice(ctx->outputs[0], 0, link->h, 1)) < 0 || - (ret = ff_end_frame(ctx->outputs[0])) < 0) - return ret; + ret = ff_filter_frame(ctx->outputs[0], yadif->out); yadif->frame_pending = (yadif->mode&1) && !is_second; - return 0; + return ret; } -static int start_frame(AVFilterLink *link, AVFilterBufferRef *picref) +static int filter_frame(AVFilterLink *link, AVFilterBufferRef *picref) { AVFilterContext *ctx = link->dst; YADIFContext *yadif = ctx->priv; @@ -227,7 +222,6 @@ static int start_frame(AVFilterLink *link, AVFilterBufferRef *picref) yadif->prev = yadif->cur; yadif->cur = yadif->next; yadif->next = picref; - link->cur_buf = NULL; if (!yadif->cur) return 0; @@ -240,7 +234,7 @@ static int start_frame(AVFilterLink *link, AVFilterBufferRef *picref) avfilter_unref_bufferp(&yadif->prev); if (yadif->out->pts != AV_NOPTS_VALUE) yadif->out->pts *= 2; - return ff_start_frame(ctx->outputs[0], yadif->out); + return ff_filter_frame(ctx->outputs[0], yadif->out); } if (!yadif->prev && @@ -258,26 +252,7 @@ static int start_frame(AVFilterLink *link, AVFilterBufferRef *picref) if (yadif->out->pts != AV_NOPTS_VALUE) yadif->out->pts *= 2; - return ff_start_frame(ctx->outputs[0], yadif->out); -} - -static int end_frame(AVFilterLink *link) -{ - AVFilterContext *ctx = link->dst; - YADIFContext *yadif = ctx->priv; - - if (!yadif->out) - return 0; - - if (yadif->auto_enable && !yadif->cur->video->interlaced) { - int ret = ff_draw_slice(ctx->outputs[0], 0, link->h, 1); - if (ret >= 0) - ret = ff_end_frame(ctx->outputs[0]); - return ret; - } - - return_frame(ctx, 0); - return 0; + return return_frame(ctx, 0); } static int request_frame(AVFilterLink *link) @@ -307,8 +282,7 @@ static int request_frame(AVFilterLink *link) next->pts = yadif->next->pts * 2 - yadif->cur->pts; - start_frame(link->src->inputs[0], next); - end_frame(link->src->inputs[0]); + filter_frame(link->src->inputs[0], next); yadif->eof = 1; } else if (ret < 0) { return ret; @@ -409,11 +383,6 @@ static av_cold int init(AVFilterContext *ctx, const char *args) return 0; } -static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) -{ - return 0; -} - static int config_props(AVFilterLink *link) { link->time_base.num = link->src->inputs[0]->time_base.num; @@ -428,10 +397,8 @@ static const AVFilterPad avfilter_vf_yadif_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .start_frame = start_frame, .get_video_buffer = get_video_buffer, - .draw_slice = null_draw_slice, - .end_frame = end_frame, + .filter_frame = filter_frame, }, { NULL } }; |