From patchwork Mon Jul 17 15:45:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 4346 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.1.76 with SMTP id 73csp307041vsb; Mon, 17 Jul 2017 08:46:37 -0700 (PDT) X-Received: by 10.28.142.138 with SMTP id q132mr5224258wmd.75.1500306391473; Mon, 17 Jul 2017 08:46:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500306389; cv=none; d=google.com; s=arc-20160816; b=nrl5u3f+CUNjPwH4H0fer6kFozlueQizMmZhKuw3oYwkKqByX8LvWwo6qS9UKa5F8e dHp4GaXQ7okBU+jVxMVWl9h2BNkH5bIaInOHNQIiFuqajWZyPnbuivTJUlou891ToU7R 5Z/2D0eBZdSN2nKAI3OjnIffL+k0SWpjW6+65EkQEpXSaa7AFPIcy4DBo7dyaoKQX7Io C84G6/cJfmH8SKnxbIARr78M/bNmUGK/Xe/QWx+5GU6TWsd+H/i6ktCiLCl+LF9z+Lu3 h220TWu08Mv19nzXEjJAlY5hOcbWJl5dPaWOTM6zPFb95tWxUaGqgRPm2k12XIu8+29u V/Dg== 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=8xAO1CZnhXdMQeZOmgCYGNMAFMcXt69vtziA+aEdt8g=; b=zwV59jnUf23dYFJ82Wl3/JdoJ0vxKQySqKYYOyKnb7f3s7psqyW8ITRYmvRpg2cxv/ TyKkI/i+iPtuM2N5NAMb2uZ1pxDzQoTT6o+412YcXHNQuTl7vQKY7/XHchwK0s0z1lce prlanRPLmk+9FEXB0DlIfi4G1l6v1Zp4S9LQT/67toE7L/Wj+FaQkPshql4YNhLq/bRG uK4BvLusCZEquVsCMvIRGjHQHFRczMY9YCmyWvXi7M5MCUR2FhQyic8CNzNPLLsHDrxx cyLCugps+LRiIyRqwKttA8kre2nLTi9EANPOQ19YbSqAgkuhrbJcgqzviNVhOu/DAZA2 sK/w== 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 l38si10195062wrl.334.2017.07.17.08.46.29; Mon, 17 Jul 2017 08:46:29 -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 E2903689D9C; Mon, 17 Jul 2017 18:45:23 +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 57A73688337 for ; Mon, 17 Jul 2017 18:45:16 +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 v6HFjM3b070483 for ; Mon, 17 Jul 2017 17:45:23 +0200 (CEST) Received: by phare.normalesup.org (Postfix, from userid 1001) id C39DCE00D0; Mon, 17 Jul 2017 17:45:22 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Mon, 17 Jul 2017 17:45:06 +0200 Message-Id: <20170717154509.28255-7-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:23 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 07/10] lavfi/vf_maskedclamp: 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_maskedclamp.c | 31 +++++++++++-------------------- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 16a7e87c04..18d42a7596 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -225,7 +225,7 @@ OBJS-$(CONFIG_LUT2_FILTER) += vf_lut2.o framesync.o OBJS-$(CONFIG_LUT3D_FILTER) += vf_lut3d.o OBJS-$(CONFIG_LUTRGB_FILTER) += vf_lut.o OBJS-$(CONFIG_LUTYUV_FILTER) += vf_lut.o -OBJS-$(CONFIG_MASKEDCLAMP_FILTER) += vf_maskedclamp.o framesync.o +OBJS-$(CONFIG_MASKEDCLAMP_FILTER) += vf_maskedclamp.o framesync2.o OBJS-$(CONFIG_MASKEDMERGE_FILTER) += vf_maskedmerge.o framesync2.o OBJS-$(CONFIG_MCDEINT_FILTER) += vf_mcdeint.o OBJS-$(CONFIG_MERGEPLANES_FILTER) += vf_mergeplanes.o framesync2.o diff --git a/libavfilter/vf_maskedclamp.c b/libavfilter/vf_maskedclamp.c index 25c1a73be0..5ad8aa7f66 100644 --- a/libavfilter/vf_maskedclamp.c +++ b/libavfilter/vf_maskedclamp.c @@ -25,7 +25,7 @@ #include "formats.h" #include "internal.h" #include "video.h" -#include "framesync.h" +#include "framesync2.h" #define OFFSET(x) offsetof(MaskedClampContext, x) #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM @@ -93,9 +93,9 @@ static int process_frame(FFFrameSync *fs) AVFrame *out, *base, *dark, *bright; int ret; - if ((ret = ff_framesync_get_frame(&s->fs, 0, &base, 0)) < 0 || - (ret = ff_framesync_get_frame(&s->fs, 1, &dark, 0)) < 0 || - (ret = ff_framesync_get_frame(&s->fs, 2, &bright, 0)) < 0) + if ((ret = ff_framesync2_get_frame(&s->fs, 0, &base, 0)) < 0 || + (ret = ff_framesync2_get_frame(&s->fs, 1, &dark, 0)) < 0 || + (ret = ff_framesync2_get_frame(&s->fs, 2, &bright, 0)) < 0) return ret; if (ctx->is_disabled) { @@ -265,7 +265,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, 3)) < 0) + if ((ret = ff_framesync2_init(&s->fs, ctx, 3)) < 0) return ret; in = s->fs.in; @@ -284,44 +284,35 @@ 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) { - MaskedClampContext *s = inlink->dst->priv; - return ff_framesync_filter_frame(&s->fs, inlink, buf); -} - -static int request_frame(AVFilterLink *outlink) -{ - MaskedClampContext *s = outlink->src->priv; - return ff_framesync_request_frame(&s->fs, outlink); + MaskedClampContext *s = ctx->priv; + return ff_framesync2_activate(&s->fs); } static av_cold void uninit(AVFilterContext *ctx) { MaskedClampContext *s = ctx->priv; - ff_framesync_uninit(&s->fs); + ff_framesync2_uninit(&s->fs); } static const AVFilterPad maskedclamp_inputs[] = { { .name = "base", .type = AVMEDIA_TYPE_VIDEO, - .filter_frame = filter_frame, .config_props = config_input, }, { .name = "dark", .type = AVMEDIA_TYPE_VIDEO, - .filter_frame = filter_frame, }, { .name = "bright", .type = AVMEDIA_TYPE_VIDEO, - .filter_frame = filter_frame, }, { NULL } }; @@ -331,7 +322,6 @@ static const AVFilterPad maskedclamp_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, - .request_frame = request_frame, }, { NULL } }; @@ -341,6 +331,7 @@ AVFilter ff_vf_maskedclamp = { .description = NULL_IF_CONFIG_SMALL("Clamp first stream with second stream and third stream."), .priv_size = sizeof(MaskedClampContext), .uninit = uninit, + .activate = activate, .query_formats = query_formats, .inputs = maskedclamp_inputs, .outputs = maskedclamp_outputs,