From patchwork Mon Jul 17 15:45:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 4344 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.1.76 with SMTP id 73csp307227vsb; Mon, 17 Jul 2017 08:46:47 -0700 (PDT) X-Received: by 10.28.206.12 with SMTP id e12mr5367047wmg.81.1500306407516; Mon, 17 Jul 2017 08:46:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500306407; cv=none; d=google.com; s=arc-20160816; b=eMY/gf1oHFFPJGcAiSVmV4qqrNco4TuLxx5K+wv4eQsZuoVGR/P8lZLkdwForZrWrs oVsa5YZt15cO6ou9rMBFYvrJHXejXLWhYTMnDmaB75zhZlo74+VZBf3eL/09ZjQ3HdzE IQ/pCOf6cUAnE3xEA8UPb5DHicD8KnIGdsDOV5ZK1urh1SL5yTwEmlI5ajjtIcZbYQQe KFF5mN4yfDtwTygjlG3QQeJmvPvNORztXDsqjJZ/c+DnJ8RywfsoSQodYp40zCB9IL9o 5v1ex9HWJd7G/lun02L58CF2Viva2FPqjbsfev/TXp3aFbDB8ioJqA2dKQ0CpBIOdW3i aJmQ== 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=UbC1ZkN0jJDmDL8ak2VMxeMLDaTjSbOG8Dg9LEx48Jo=; b=lwIWjqHqmL76P9pAmirEv/acnoz7fgYk9PK4jLgyy1TnRqtFseHLi2htY65sNJOiHK RIqj3aNZwt6JKqDdf8YiY4y5aQyvin0afMJ+YcT4jtxCgSekR/HE+Jhtf36WRTOOCRVJ omaf+0BOQ4f8e+uyITXEV1ScQcSZ3I3p/4bYVTHZj5ph/yS2UbUbtnWg1tPSnHuWHPkT 1/fZWNGyASKouuS9wNoDRozQnyKzyE2ji6i9n723PtrF72Fkq5jLQDXqn5Si3SzbSGbe ETtE5yDoT3+nEJnOrRL25TM58meYi13AWzdVBHCVzqO+8V+IJ/kJNZIPAHZcs6N8Fr5x eCiA== 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 h12si10017873wmg.71.2017.07.17.08.46.47; Mon, 17 Jul 2017 08:46:47 -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 9CA56689D4B; Mon, 17 Jul 2017 18:45:24 +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 7D009689D4B for ; Mon, 17 Jul 2017 18:45:17 +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 v6HFjNR7070493 for ; Mon, 17 Jul 2017 17:45:24 +0200 (CEST) Received: by phare.normalesup.org (Postfix, from userid 1001) id ECC63E00D0; Mon, 17 Jul 2017 17:45:23 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Mon, 17 Jul 2017 17:45:08 +0200 Message-Id: <20170717154509.28255-9-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:24 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 09/10] lavfi/vf_hysteresis: 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_hysteresis.c | 28 ++++++++++------------------ 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 27ceb339a4..441e07843f 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -208,7 +208,7 @@ OBJS-$(CONFIG_HWDOWNLOAD_FILTER) += vf_hwdownload.o OBJS-$(CONFIG_HWMAP_FILTER) += vf_hwmap.o OBJS-$(CONFIG_HWUPLOAD_CUDA_FILTER) += vf_hwupload_cuda.o OBJS-$(CONFIG_HWUPLOAD_FILTER) += vf_hwupload.o -OBJS-$(CONFIG_HYSTERESIS_FILTER) += vf_hysteresis.o framesync.o +OBJS-$(CONFIG_HYSTERESIS_FILTER) += vf_hysteresis.o framesync2.o OBJS-$(CONFIG_IDET_FILTER) += vf_idet.o OBJS-$(CONFIG_IL_FILTER) += vf_il.o OBJS-$(CONFIG_INFLATE_FILTER) += vf_neighbor.o diff --git a/libavfilter/vf_hysteresis.c b/libavfilter/vf_hysteresis.c index c0369b2066..c3b769b8a7 100644 --- a/libavfilter/vf_hysteresis.c +++ b/libavfilter/vf_hysteresis.c @@ -26,7 +26,7 @@ #include "formats.h" #include "internal.h" #include "video.h" -#include "framesync.h" +#include "framesync2.h" #define OFFSET(x) offsetof(HysteresisContext, x) #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM @@ -94,8 +94,8 @@ static int process_frame(FFFrameSync *fs) AVFrame *out, *base, *alt; int ret; - if ((ret = ff_framesync_get_frame(&s->fs, 0, &base, 0)) < 0 || - (ret = ff_framesync_get_frame(&s->fs, 1, &alt, 0)) < 0) + if ((ret = ff_framesync2_get_frame(&s->fs, 0, &base, 0)) < 0 || + (ret = ff_framesync2_get_frame(&s->fs, 1, &alt, 0)) < 0) return ret; if (ctx->is_disabled) { @@ -324,7 +324,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; @@ -339,26 +339,20 @@ 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) { - HysteresisContext *s = inlink->dst->priv; - return ff_framesync_filter_frame(&s->fs, inlink, buf); -} - -static int request_frame(AVFilterLink *outlink) -{ - HysteresisContext *s = outlink->src->priv; - return ff_framesync_request_frame(&s->fs, outlink); + HysteresisContext *s = ctx->priv; + return ff_framesync2_activate(&s->fs); } static av_cold void uninit(AVFilterContext *ctx) { HysteresisContext *s = ctx->priv; - ff_framesync_uninit(&s->fs); + ff_framesync2_uninit(&s->fs); av_freep(&s->map); av_freep(&s->xy); } @@ -367,13 +361,11 @@ static const AVFilterPad hysteresis_inputs[] = { { .name = "base", .type = AVMEDIA_TYPE_VIDEO, - .filter_frame = filter_frame, .config_props = config_input, }, { .name = "alt", .type = AVMEDIA_TYPE_VIDEO, - .filter_frame = filter_frame, }, { NULL } }; @@ -383,7 +375,6 @@ static const AVFilterPad hysteresis_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, - .request_frame = request_frame, }, { NULL } }; @@ -394,6 +385,7 @@ AVFilter ff_vf_hysteresis = { .priv_size = sizeof(HysteresisContext), .uninit = uninit, .query_formats = query_formats, + .activate = activate, .inputs = hysteresis_inputs, .outputs = hysteresis_outputs, .priv_class = &hysteresis_class,