From patchwork Sun Jun 17 12:40:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shlomi Fish X-Patchwork-Id: 9432 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:11c:0:0:0:0:0 with SMTP id c28-v6csp2771097jad; Sun, 17 Jun 2018 05:40:35 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJwjkatn827+jI+IU/3CG/NAobSUo2+sJRuaiN8m5xH7cNsL3M3TUI9jrKZZjJ9GMvhpGSZ X-Received: by 2002:adf:c00b:: with SMTP id z11-v6mr6816393wre.268.1529239235432; Sun, 17 Jun 2018 05:40:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529239235; cv=none; d=google.com; s=arc-20160816; b=uQFuDdUB3AqvWKQYnTd+2XPaLOBfKxUn+6XLULvm37tlbSnYfLX9tlB/yv2IuSN6AL sIBXG0T9z6t4+6HQXGvO9IiSYWHB0nEhzEZ1ojD24IcFf1CnaR+wwiTIhLwP0adF/+dB C01hPWGR+KEVMxSDR6YJ8Dvr+xJLjPpevh62tgq/TMNEmPwlHHD1T0a/l1N5qNaG8Lo8 G5RrsnhSg/qUIyS+y2AFUoquCYSDcfjM5NHYOaxFMt32p+QAH0BD0Pfjcp12M95m0EYo oK4VKirbHFZ0YWrmZKHS9iqz+YlMGaiDaSJTEvGzubmplTEb5Ue1pWEeBgPZ/rVINuz9 miOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:to:from:date :delivered-to:arc-authentication-results; bh=pP158ZgoIn6yTxrFynkilHN64AzCTIZc+Xf/D3WNOts=; b=KVlqEh9yhw2ZFzF6d+boyP9OiIkOqb4UooIrH1yaCo6FmsGZKaiHMKPpdcxm/fjGU2 PWy5Z0I4UHnPXqNx8FNF3SSQet9pnGzeDqdMlb78w7qi2ME8Iq2THWLul9AmmJo4h9en bpAqIc9w9hCzqnEC+cWpo7F/3jtFw+7YrznWr9qqIRpik/JCvt5/QNBgA/3m9wglCdJL +u3Z5sLvAVnDJ116TeY/gqF2jv2UiZZfB3O8w1uMEjWJDkf5egNNGrdU8ZIrZwV9iaZb uCKfFEMHm+R2qLYLO+wNnF0rSkMWDDDlzgwz2z/Uo7tzdYnluDBhuO5cuQPhxLQWqR/L Ymvg== 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 j29-v6si7594492wre.308.2018.06.17.05.40.34; Sun, 17 Jun 2018 05:40:35 -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 C684F689FD5; Sun, 17 Jun 2018 15:39:40 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from gateway31.websitewelcome.com (gateway31.websitewelcome.com [192.185.143.36]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0A05F680578 for ; Sun, 17 Jun 2018 15:39:34 +0300 (EEST) Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway31.websitewelcome.com (Postfix) with ESMTP id 7BB3CA1C80 for ; Sun, 17 Jun 2018 07:40:24 -0500 (CDT) Received: from gator4065.hostgator.com ([192.185.4.76]) by cmsmtp with SMTP id UWymfowhaaSeyUWymfWWYj; Sun, 17 Jun 2018 07:40:24 -0500 X-Authority-Reason: nr=8 Received: from [77.127.25.161] (port=60294 helo=telaviv1.shlomifish.org) by gator4065.hostgator.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1fUWyl-000wz3-Lu; Sun, 17 Jun 2018 07:40:24 -0500 Received: from telaviv1.shlomifish.org (telaviv1.shlomifish.org [127.0.0.1]) by telaviv1.shlomifish.org (Postfix) with ESMTP id 8210326007C; Sun, 17 Jun 2018 15:40:20 +0300 (IDT) Date: Sun, 17 Jun 2018 15:40:19 +0300 From: Shlomi Fish To: Michael Niedermayer Message-ID: <20180617154019.40a1f8be@telaviv1.shlomifish.org> In-Reply-To: <20180617010527.GF4859@michaelspb> References: <20180612125320.3eb312fc@telaviv1.shlomifish.org> <20180617010527.GF4859@michaelspb> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-mageia-linux-gnu) MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4065.hostgator.com X-AntiAbuse: Original Domain - ffmpeg.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - shlomifish.org X-BWhitelist: no X-Source-IP: 77.127.25.161 X-Source-L: No X-Exim-ID: 1fUWyl-000wz3-Lu X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (telaviv1.shlomifish.org) [77.127.25.161]:60294 X-Source-Auth: shlomif@shlomifish.org X-Email-Count: 2 X-Source-Cap: c2hsb21pZjtzaGxvbWlmO2dhdG9yNDA2NS5ob3N0Z2F0b3IuY29t X-Local-Domain: yes Subject: Re: [FFmpeg-devel] Fw: [PATCH] Refactor two near-identical clauses. 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 Cc: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" On Sun, 17 Jun 2018 03:05:27 +0200 Michael Niedermayer wrote: > On Tue, Jun 12, 2018 at 12:53:20PM +0300, Shlomi Fish wrote: > > This message did not arrive to the list after three submissions. > > > > Begin forwarded message: > > > > Date: Tue, 12 Jun 2018 12:42:52 +0300 > > From: Shlomi Fish > > To: ffmpeg-devel@ffmpeg.org > > Cc: Shlomi Fish > > Subject: [PATCH] Refactor two near-identical clauses. > > > > > > Placed under the Expat licence . All tests pass. > > --- > > libavfilter/vf_weave.c | 33 ++++++++++++++------------------- > > 1 file changed, 14 insertions(+), 19 deletions(-) > > > > diff --git a/libavfilter/vf_weave.c b/libavfilter/vf_weave.c > > index 037f5d1cf2..be371201e1 100644 > > --- a/libavfilter/vf_weave.c > > +++ b/libavfilter/vf_weave.c > > @@ -23,6 +23,7 @@ > > #include "libavutil/pixdesc.h" > > #include "avfilter.h" > > #include "internal.h" > > +#include > > > > typedef struct WeaveContext { > > const AVClass *class; > > @@ -84,6 +85,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) > > AVFilterLink *outlink = ctx->outputs[0]; > > AVFrame *out; > > int i; > > + bool weave; > > + int field1, field2; > > > > if (!s->prev) { > > s->prev = in; > > @@ -98,26 +101,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame > > *in) } > > av_frame_copy_props(out, in); > > > > + weave = (s->double_weave && !(inlink->frame_count_out & 1)); > > + field1 = s->first_field * weave; > > + field2 = s->first_field * !weave; > > for (i = 0; i < s->nb_planes; i++) { > > - if (s->double_weave && !(inlink->frame_count_out & 1)) { > > - av_image_copy_plane(out->data[i] + out->linesize[i] * > > s->first_field, > > this seems to be corrupted by line breaks > Well, the git send-email email was silently dropped three times... See: http://www.shlomifish.org/Files/files/code/0001-Refactor-two-near-identical-clauses.patch also attached here. Email has sadly become unreliable. > [...] > From b6678799848297cd7079085035259baf6d8c54f0 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Fri, 25 May 2018 23:44:54 +0300 Subject: [PATCH] Refactor two near-identical clauses. Placed under the Expat licence . All tests pass. --- libavfilter/vf_weave.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/libavfilter/vf_weave.c b/libavfilter/vf_weave.c index 037f5d1cf2..be371201e1 100644 --- a/libavfilter/vf_weave.c +++ b/libavfilter/vf_weave.c @@ -23,6 +23,7 @@ #include "libavutil/pixdesc.h" #include "avfilter.h" #include "internal.h" +#include typedef struct WeaveContext { const AVClass *class; @@ -84,6 +85,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) AVFilterLink *outlink = ctx->outputs[0]; AVFrame *out; int i; + bool weave; + int field1, field2; if (!s->prev) { s->prev = in; @@ -98,26 +101,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } av_frame_copy_props(out, in); + weave = (s->double_weave && !(inlink->frame_count_out & 1)); + field1 = s->first_field * weave; + field2 = s->first_field * !weave; for (i = 0; i < s->nb_planes; i++) { - if (s->double_weave && !(inlink->frame_count_out & 1)) { - av_image_copy_plane(out->data[i] + out->linesize[i] * s->first_field, - out->linesize[i] * 2, - in->data[i], in->linesize[i], - s->linesize[i], s->planeheight[i]); - av_image_copy_plane(out->data[i] + out->linesize[i] * !s->first_field, - out->linesize[i] * 2, - s->prev->data[i], s->prev->linesize[i], - s->linesize[i], s->planeheight[i]); - } else { - av_image_copy_plane(out->data[i] + out->linesize[i] * !s->first_field, - out->linesize[i] * 2, - in->data[i], in->linesize[i], - s->linesize[i], s->planeheight[i]); - av_image_copy_plane(out->data[i] + out->linesize[i] * s->first_field, - out->linesize[i] * 2, - s->prev->data[i], s->prev->linesize[i], - s->linesize[i], s->planeheight[i]); - } + av_image_copy_plane(out->data[i] + out->linesize[i] * field1, + out->linesize[i] * 2, + in->data[i], in->linesize[i], + s->linesize[i], s->planeheight[i]); + av_image_copy_plane(out->data[i] + out->linesize[i] * field2, + out->linesize[i] * 2, + s->prev->data[i], s->prev->linesize[i], + s->linesize[i], s->planeheight[i]); } out->pts = s->double_weave ? s->prev->pts : in->pts / 2; -- 2.17.0