From patchwork Thu Jul 21 02:25:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Phlipot X-Patchwork-Id: 36878 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1649:b0:8b:613a:194d with SMTP id no9csp2771060pzb; Wed, 20 Jul 2022 19:26:14 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tioRz+SFNBFk7cp1kaI2BT9QDcQm2tGaEYLnzYxSnqanM182u3isO7f0CVIQEzLH3h3SGE X-Received: by 2002:a05:6402:5244:b0:43a:77b8:6bdf with SMTP id t4-20020a056402524400b0043a77b86bdfmr53580532edd.153.1658370373998; Wed, 20 Jul 2022 19:26:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658370373; cv=none; d=google.com; s=arc-20160816; b=XFJCEEYn8VJwJrPa0op5ftj0O8dW6odHMoCZS8pq/rQ3j5ro4IHqtM0t6qCwAgtOsg kDFLFe3ebdt1qAs5ypbWwDLdE4AHU1i8q1qEPcpKXKvdMVpdIJaMUsxLAsgKCE2kHXkB x1gy3DpGgCqNpuGrpBBJXqieISfk9q2UVgAtfJx1yS7Rzw/auMoyljiR5uGIQzEWdmTt c549KjkkosMgIIIUDf+7/HqIG8VZJ9f87DLdXhKrJiX7d4Hlk7cHgWFr40EoNCsJ+b6+ gmb7TdNj31t4PHtpTj3oeulm1Osf9MxjHVZbjHpvrWfqP8GHQ0hmvNRTsmrGJAsyI2ev PrPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding: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:date:to:from:dkim-signature:delivered-to; bh=STz3hiAuRAEdb9R5+nYk+N1MANoHAcZ4ttB7evb7UPQ=; b=YDjvYLbJz+B1DMHcgUIIs7mqlekVuexxnUBaGLqsiQ4FUtYDZfEJErS2cpJvl+F7Gm EpfmjpQSsvV0QM40HZpkLJwYN5gqNZVEd48IOYwfbuk/dQg7Qz8spof071/lwonY0EAg +L3y0ZEjObete1b5ZnG1k1p179tLpQb/UoIUzbdYLKoEfTa8xnicr+jYzG8VH9QXx36o 25fIc2ysFNvxr/9OQPT+Yi9iILnFIvfwwsntQGJmCXpzznbimiKVF8tC0v0f03hCppxn 5lk7u8NBkouTyp2XkpoGgrCygrt/yH5lXt3sZOgZyzX/IFYNgT3/U/JYECUv/BdIyiiH yxIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=Kk6sSOE5; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ht20-20020a170907609400b0072b7dab918csi1182032ejc.255.2022.07.20.19.26.13; Wed, 20 Jul 2022 19:26:13 -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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=Kk6sSOE5; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B2B9068B580; Thu, 21 Jul 2022 05:25:52 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C7E3168B4AF for ; Thu, 21 Jul 2022 05:25:43 +0300 (EEST) Received: by mail-pf1-f172.google.com with SMTP id d10so463199pfd.9 for ; Wed, 20 Jul 2022 19:25:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VT5Jq3nHG6f9ea/3i4Kb1djNuxPV6b/LWW/4zfLKLhc=; b=Kk6sSOE53LoTYeVFjd5RuC3j1/4IfoHEqnQzgjxReiU2UukNx89WiaLyakfO6alC5N xfa3xnRGRhb3GF6JFIPO1ldSnLSMCCXJGRk1SVGUMyW0rZtKS/jdg2trXhHo8cYvJLea j/DyYL6T3k0VCLrgDDKvKU6mlbwaFj/4+vwmYr7mb2vhjWSCO48vzJtwOsv3nqfG5QB5 iPGGeQycil4h85ts1SEafiikwNAxHLF6XAa6gfeV3Wxc99NrQXE2Qn9WCk53N7EwHX2O alKprzgf1BW7lTeEQ0i3ZBsnoEoDs6kP66RPoVRaGXJIQvpH/WfR1IAOdEyD94NbTmNg GDng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VT5Jq3nHG6f9ea/3i4Kb1djNuxPV6b/LWW/4zfLKLhc=; b=4FjChBje6POA/sNAmuKQyyRhkBD2BfA2oCodY3mxgrG71uFWMTRSTvCLPmqwYJTtLt 2ebcvgm2Bk9ZUzw65WOD4u2XFdnccGd+8BkmsqEnS20b1ASGl55JxIMA2hn1Gw/pDYXE TIGQzjj21C91hw+fUiJSNwbmie09mmZkqgJtCtnCeutSyzAuA8BGlXf9pKpdsWFeDfQd aoNZw3K1TKASkRxoBxmh2cohIB51m/3k2WatWon7qsK8jy/ykvnvNVNp47fsO283rSj6 cpvmwlmhzwE9W/Og4v/X4suGagYvHztmUX2bYaMgEOe10Z0l/mGsxB5TAC2PGcHlHYBy Yyng== X-Gm-Message-State: AJIora/3Tp4vzYsSIFg5sFeFnQsp3OtTFFugpQonDSeuEsuFFcqm1g9g tcU4637RCGWcuRbTrlSoYL8mL5ntgRGg4g== X-Received: by 2002:a05:6a00:1a94:b0:52b:21a0:afbc with SMTP id e20-20020a056a001a9400b0052b21a0afbcmr35880629pfv.13.1658370341799; Wed, 20 Jul 2022 19:25:41 -0700 (PDT) Received: from localhost.localdomain (23-121-159-29.lightspeed.sntcca.sbcglobal.net. [23.121.159.29]) by smtp.googlemail.com with ESMTPSA id j3-20020a62c503000000b005251c6fbd0csm340079pfg.29.2022.07.20.19.25.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 19:25:41 -0700 (PDT) From: Chris Phlipot To: ffmpeg-devel@ffmpeg.org Date: Wed, 20 Jul 2022 19:25:12 -0700 Message-Id: <20220721022514.1466331-3-cphlipot0@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220721022514.1466331-1-cphlipot0@gmail.com> References: <20220721022514.1466331-1-cphlipot0@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 3/5] avfilter/vf_yadif: reformat code to improve readability X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Chris Phlipot Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: MApOCmg906PT Reformat some of the code to improve readability and reduce code duplication. This change is intended to be purely cosmentic and shouldn't result in any functional changes. Signed-off-by: Chris Phlipot --- libavfilter/vf_yadif.c | 11 +++++------ libavfilter/yadif.h | 3 +-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c index 42f6246330..54109566be 100644 --- a/libavfilter/vf_yadif.c +++ b/libavfilter/vf_yadif.c @@ -211,16 +211,15 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) uint8_t *cur = &s->cur ->data[td->plane][y * refs]; uint8_t *next = &s->next->data[td->plane][y * refs]; uint8_t *dst = &td->frame->data[td->plane][y * td->frame->linesize[td->plane]]; + int prefs = y + 1 < td->h ? refs : -refs; + int mrefs = y ? -refs : refs; + int parity = td->parity ^ td->tff; int mode = y == 1 || y + 2 == td->h ? 2 : s->mode; s->filter_line(dst + pix_3, prev + pix_3, cur + pix_3, next + pix_3, td->w - edge, - y + 1 < td->h ? refs : -refs, - y ? -refs : refs, - td->parity ^ td->tff, mode); + prefs, mrefs, parity, mode); s->filter_edges(dst, prev, cur, next, td->w, - y + 1 < td->h ? refs : -refs, - y ? -refs : refs, - td->parity ^ td->tff, mode, s->req_align); + prefs, mrefs, parity, mode, s->req_align); } else { memcpy(&td->frame->data[td->plane][y * td->frame->linesize[td->plane]], &s->cur->data[td->plane][y * refs], td->w * df); diff --git a/libavfilter/yadif.h b/libavfilter/yadif.h index b81f2fc1d9..f271fe8304 100644 --- a/libavfilter/yadif.h +++ b/libavfilter/yadif.h @@ -67,8 +67,7 @@ typedef struct YADIFContext { * Required alignment for filter_line */ int req_align; - void (*filter_line)(void *dst, - void *prev, void *cur, void *next, + void (*filter_line)(void *dst, void *prev, void *cur, void *next, int w, int prefs, int mrefs, int parity, int mode); void (*filter_edges)(void *dst, void *prev, void *cur, void *next, int w, int prefs, int mrefs, int parity, int mode,