From patchwork Mon Jul 17 15:45:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 4338 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.1.76 with SMTP id 73csp305853vsb; Mon, 17 Jul 2017 08:45:28 -0700 (PDT) X-Received: by 10.28.174.81 with SMTP id x78mr5139224wme.43.1500306328800; Mon, 17 Jul 2017 08:45:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500306328; cv=none; d=google.com; s=arc-20160816; b=W1zPJ1ahDp8PDb8RoNgZBhojcDrCdwsUgKCwXrCb1KDKH7A5V9WNQwoDTb26aLFCS8 2Ykj3Irs2C8PrtsbCrnlDalbnCLroaJapy4hLZ5cT0ML2G17R8jXOs+k48Tc0sveqfqi jHSYNUZLGgVeeUABDjDZ4DGN8tyKOuku4ClVlUvXs1dCeAJyQ1KdWaJMO4u6Syxu5PwQ oAUZZWk0+u0d184pJrBnE8gLshpPR2EVdkNNoquVIoPkBxJCEjQELq82MT+SBVDuu7G4 jtKAEa8B5JOYm4z8iU2KS7UV/s/Q2lhlIsugLn+Tu3HZxOAPiXJKIFwRgjnKARccvOIl t3kA== 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:message-id:date:to:from:delivered-to :arc-authentication-results; bh=bpqgVle0nOyfCS/YFeRa6+6NpXuy4x2aQvooE0HRPSc=; b=DsPHOqpp0QJe9DyAz4qkBBNR8a/EgkKZ6peE02egUOtE1npHGOpY918SmMc6YtrqxX hVbuJd9iC88PwB5MUbcG9tCwA3IuSlgAGuD1UTpCCaDF5LC+HTMPeIdnLPWpkFqfIWe5 s/pHusc+XG9wU/hmkZ4LQAYdDI0inacl9GlIsrDzkYf718udr0qfh9HLsD0s1DD72wq6 KfPFFEXMAmPEY6NcVeEdjft+qptCx3MFOWfe9SzWHO9iGRS2H+lcf6uajvOmO00WLm7u 7EPaFxvutFLpE0Yvc3w5rIAEVA/AGe7B0ErOyDbAMhaomDZXBH3c7nzlLDbxYoHVj6Dd o35A== 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 36si890055wrr.268.2017.07.17.08.45.28; Mon, 17 Jul 2017 08:45:28 -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 70A61689CE4; Mon, 17 Jul 2017 18:45:18 +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 E0C75689A1B for ; Mon, 17 Jul 2017 18:45:11 +0300 (EEST) Received: from phare.normalesup.org (archicubes.ens.fr [129.199.129.80]) by nef2.ens.fr (8.13.6/1.01.28121999) with ESMTP id v6HFjINo070436 for ; Mon, 17 Jul 2017 17:45:18 +0200 (CEST) Received: by phare.normalesup.org (Postfix, from userid 1001) id 39165E00D0; Mon, 17 Jul 2017 17:45:18 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Mon, 17 Jul 2017 17:45:00 +0200 Message-Id: <20170717154509.28255-1-george@nsup.org> X-Mailer: git-send-email 2.13.2 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:18 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 01/10] lavfi/vf_threshold: 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" Also fix missing dependency. Signed-off-by: Nicolas George --- libavfilter/Makefile | 2 +- libavfilter/vf_threshold.c | 34 ++++++++++++---------------------- 2 files changed, 13 insertions(+), 23 deletions(-) For all this series: the filter builds, FATE passes, but no further tests have been done. These are all the filters that use framesync directly except streamselect that will require a more careful look. TODO: dualinput. diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 6f8e7b5ae1..b34272830e 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -308,7 +308,7 @@ OBJS-$(CONFIG_SWAPRECT_FILTER) += vf_swaprect.o OBJS-$(CONFIG_SWAPUV_FILTER) += vf_swapuv.o OBJS-$(CONFIG_TBLEND_FILTER) += vf_blend.o dualinput.o framesync.o OBJS-$(CONFIG_TELECINE_FILTER) += vf_telecine.o -OBJS-$(CONFIG_THRESHOLD_FILTER) += vf_threshold.o +OBJS-$(CONFIG_THRESHOLD_FILTER) += vf_threshold.o framesync2.o OBJS-$(CONFIG_THUMBNAIL_FILTER) += vf_thumbnail.o OBJS-$(CONFIG_TILE_FILTER) += vf_tile.o OBJS-$(CONFIG_TINTERLACE_FILTER) += vf_tinterlace.o diff --git a/libavfilter/vf_threshold.c b/libavfilter/vf_threshold.c index 1cb4c9aab8..6a64f270fe 100644 --- a/libavfilter/vf_threshold.c +++ b/libavfilter/vf_threshold.c @@ -28,7 +28,7 @@ #include "libavutil/opt.h" #include "libavutil/pixdesc.h" #include "avfilter.h" -#include "framesync.h" +#include "framesync2.h" #include "internal.h" #include "video.h" @@ -96,10 +96,10 @@ static int process_frame(FFFrameSync *fs) AVFrame *out, *in, *threshold, *min, *max; int ret; - if ((ret = ff_framesync_get_frame(&s->fs, 0, &in, 0)) < 0 || - (ret = ff_framesync_get_frame(&s->fs, 1, &threshold, 0)) < 0 || - (ret = ff_framesync_get_frame(&s->fs, 2, &min, 0)) < 0 || - (ret = ff_framesync_get_frame(&s->fs, 3, &max, 0)) < 0) + if ((ret = ff_framesync2_get_frame(&s->fs, 0, &in, 0)) < 0 || + (ret = ff_framesync2_get_frame(&s->fs, 1, &threshold, 0)) < 0 || + (ret = ff_framesync2_get_frame(&s->fs, 2, &min, 0)) < 0 || + (ret = ff_framesync2_get_frame(&s->fs, 3, &max, 0)) < 0) return ret; if (ctx->is_disabled) { @@ -256,7 +256,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, 4)) < 0) + if ((ret = ff_framesync2_init(&s->fs, ctx, 4)) < 0) return ret; in = s->fs.in; @@ -279,49 +279,39 @@ 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) { - ThresholdContext *s = inlink->dst->priv; - return ff_framesync_filter_frame(&s->fs, inlink, buf); -} - -static int request_frame(AVFilterLink *outlink) -{ - ThresholdContext *s = outlink->src->priv; - return ff_framesync_request_frame(&s->fs, outlink); + ThresholdContext *s = ctx->priv; + return ff_framesync2_activate(&s->fs); } static av_cold void uninit(AVFilterContext *ctx) { ThresholdContext *s = ctx->priv; - ff_framesync_uninit(&s->fs); + ff_framesync2_uninit(&s->fs); } static const AVFilterPad inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .filter_frame = filter_frame, .config_props = config_input, }, { .name = "threshold", .type = AVMEDIA_TYPE_VIDEO, - .filter_frame = filter_frame, }, { .name = "min", .type = AVMEDIA_TYPE_VIDEO, - .filter_frame = filter_frame, }, { .name = "max", .type = AVMEDIA_TYPE_VIDEO, - .filter_frame = filter_frame, }, { NULL } }; @@ -331,7 +321,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, - .request_frame = request_frame, }, { NULL } }; @@ -343,6 +332,7 @@ AVFilter ff_vf_threshold = { .priv_class = &threshold_class, .uninit = uninit, .query_formats = query_formats, + .activate = activate, .inputs = inputs, .outputs = outputs, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL,