From patchwork Mon Jul 17 15:45:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 4339 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.1.76 with SMTP id 73csp306218vsb; Mon, 17 Jul 2017 08:45:48 -0700 (PDT) X-Received: by 10.223.129.6 with SMTP id 6mr10985613wrm.23.1500306348360; Mon, 17 Jul 2017 08:45:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500306348; cv=none; d=google.com; s=arc-20160816; b=I1bVww4Qyp5GM6Ao6S5R4HuVvNRNhwHpI7vXpVBI3bPPeHtoS6bJPH4zFzCcZUD/DF HHOCcW5WeiLbWhpAFRvPjRIQufAvaT51mOPWtsCkiqxXjiHQGyjpmvwIgkBSo0yz1i1/ 9DmrrnLHOoZ0Fog4PGoQ+WMaw27tKsVpIZOAYT4T2/UM24GVca9RUueF2g+pLwiK4aNU k1YLXvdYwfJ1S4QJTDLb6ygKUSi5IW8ai3QxryUoX51hcR6uktqokGppAZHzh5W4QkHJ MmI3rDpTfGyF1GXknzhyRjl4q0wsQD0xUAVyf0WubadmeUIhFxR9bf9TqVgi0gLocZUM 3oRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to:arc-authentication-results; bh=c11DeKWrYd0MsXc1wRrigvLTsdu/rEqnit0chMOc8IY=; b=rrh9YyKP0qGZKcCIIQavhiYCDmqXxxiiVvfxLdUXHcplHw/QjGKVSHygSuS1tkuR7F TxyUDf66HjCDn+IHQguSSre2YjaupNhSJqpDmeUEH/dIB2+6PNa9zJQ5VwS1qT6c6FQU B+VV1eO0RrcgO6gyw1As88kbzbC3WMIqqsES2xF+5mf/t6TJvGTkYIjTw2IoM/LVryL3 x4Ue5uxS2tcgeBuQE2m7BPGByOdoqqXjDV3+Bqn4okm8pXRZuNIxqrs/F0katk6BkqcJ CHMpbmK9IeSgMX/ETSF4NYyT8HKhVMrjhJV1TtddCiCxispcacF0xq0JuRY/73FVD49b TzWg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id q23si3428443wrc.56.2017.07.17.08.45.47; Mon, 17 Jul 2017 08:45:48 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 53E79689D0F; Mon, 17 Jul 2017 18:45:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef2.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F05FA688279 for ; Mon, 17 Jul 2017 18:45:12 +0300 (EEST) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef2.ens.fr (8.13.6/1.01.28121999) with ESMTP id v6HFjJvk070456 for ; Mon, 17 Jul 2017 17:45:19 +0200 (CEST) Received: by phare.normalesup.org (Postfix, from userid 1001) id 66109E00D0; Mon, 17 Jul 2017 17:45:19 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Mon, 17 Jul 2017 17:45:02 +0200 Message-Id: <20170717154509.28255-3-george@nsup.org> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170717154509.28255-1-george@nsup.org> References: <20170717154509.28255-1-george@nsup.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef2.ens.fr [129.199.96.32]); Mon, 17 Jul 2017 17:45:19 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 03/10] lavfi/vf_premultiply: move to activate design. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Nicolas George --- libavfilter/Makefile | 2 +- libavfilter/vf_premultiply.c | 28 ++++++++++------------------ 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 7acf13b0aa..5acda236e6 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -256,7 +256,7 @@ OBJS-$(CONFIG_PIXDESCTEST_FILTER) += vf_pixdesctest.o OBJS-$(CONFIG_PIXSCOPE_FILTER) += vf_datascope.o OBJS-$(CONFIG_PP_FILTER) += vf_pp.o OBJS-$(CONFIG_PP7_FILTER) += vf_pp7.o -OBJS-$(CONFIG_PREMULTIPLY_FILTER) += vf_premultiply.o framesync.o +OBJS-$(CONFIG_PREMULTIPLY_FILTER) += vf_premultiply.o framesync2.o OBJS-$(CONFIG_PREWITT_FILTER) += vf_convolution.o OBJS-$(CONFIG_PSNR_FILTER) += vf_psnr.o dualinput.o framesync.o OBJS-$(CONFIG_PULLUP_FILTER) += vf_pullup.o diff --git a/libavfilter/vf_premultiply.c b/libavfilter/vf_premultiply.c index 8a5f9eac64..4bb850edd5 100644 --- a/libavfilter/vf_premultiply.c +++ b/libavfilter/vf_premultiply.c @@ -23,7 +23,7 @@ #include "libavutil/opt.h" #include "avfilter.h" #include "formats.h" -#include "framesync.h" +#include "framesync2.h" #include "internal.h" #include "video.h" @@ -207,8 +207,8 @@ static int process_frame(FFFrameSync *fs) AVFrame *out, *base, *alpha; int ret; - if ((ret = ff_framesync_get_frame(&s->fs, 0, &base, 0)) < 0 || - (ret = ff_framesync_get_frame(&s->fs, 1, &alpha, 0)) < 0) + if ((ret = ff_framesync2_get_frame(&s->fs, 0, &base, 0)) < 0 || + (ret = ff_framesync2_get_frame(&s->fs, 1, &alpha, 0)) < 0) return ret; if (ctx->is_disabled) { @@ -345,7 +345,7 @@ static int config_output(AVFilterLink *outlink) outlink->sample_aspect_ratio = base->sample_aspect_ratio; outlink->frame_rate = base->frame_rate; - if ((ret = ff_framesync_init(&s->fs, ctx, 2)) < 0) + if ((ret = ff_framesync2_init(&s->fs, ctx, 2)) < 0) return ret; in = s->fs.in; @@ -360,39 +360,31 @@ static int config_output(AVFilterLink *outlink) s->fs.opaque = s; s->fs.on_event = process_frame; - return ff_framesync_configure(&s->fs); + return ff_framesync2_configure(&s->fs); } -static int filter_frame(AVFilterLink *inlink, AVFrame *buf) +static int activate(AVFilterContext *ctx) { - PreMultiplyContext *s = inlink->dst->priv; - return ff_framesync_filter_frame(&s->fs, inlink, buf); -} - -static int request_frame(AVFilterLink *outlink) -{ - PreMultiplyContext *s = outlink->src->priv; - return ff_framesync_request_frame(&s->fs, outlink); + PreMultiplyContext *s = ctx->priv; + return ff_framesync2_activate(&s->fs); } static av_cold void uninit(AVFilterContext *ctx) { PreMultiplyContext *s = ctx->priv; - ff_framesync_uninit(&s->fs); + ff_framesync2_uninit(&s->fs); } static const AVFilterPad premultiply_inputs[] = { { .name = "main", .type = AVMEDIA_TYPE_VIDEO, - .filter_frame = filter_frame, .config_props = config_input, }, { .name = "alpha", .type = AVMEDIA_TYPE_VIDEO, - .filter_frame = filter_frame, }, { NULL } }; @@ -402,7 +394,6 @@ static const AVFilterPad premultiply_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, - .request_frame = request_frame, }, { NULL } }; @@ -413,6 +404,7 @@ AVFilter ff_vf_premultiply = { .priv_size = sizeof(PreMultiplyContext), .uninit = uninit, .query_formats = query_formats, + .activate = activate, .inputs = premultiply_inputs, .outputs = premultiply_outputs, .priv_class = &premultiply_class,