From patchwork Mon Sep 25 17:53:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 43896 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:2a18:b0:15d:8365:d4b8 with SMTP id e24csp1396682pzh; Mon, 25 Sep 2023 10:52:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEqkC63iQij3PD21Fbj32f/qlkLns4OWlFnQdB+LVazdBaog87TopBS/NISlEU/cNwCQsph X-Received: by 2002:aa7:d818:0:b0:530:5308:6e5f with SMTP id v24-20020aa7d818000000b0053053086e5fmr6705057edq.1.1695664343483; Mon, 25 Sep 2023 10:52:23 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b2-20020aa7c902000000b00533ec6bc6a2si3642773edt.306.2023.09.25.10.52.22; Mon, 25 Sep 2023 10:52:23 -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=@outlook.com header.s=selector1 header.b="HKqZq79/"; arc=fail (body hash mismatch); 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=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 868EB68C97A; Mon, 25 Sep 2023 20:52:18 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2046.outbound.protection.outlook.com [40.92.89.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 64CDF68C97A for ; Mon, 25 Sep 2023 20:52:11 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eWwnUpxeaN56gRcIrq7kcBOXP7t1jm6lQKstiWF6pCkENcQUPivwJfQ2jW3n257eJFMvDX4OVuWkI7Y1EaNl5+bmlGPRkviH5aqdcntm7mtdFdbBNZzX70vPBnvWGx2pxZ9cyKLhh6DAiZMbWljAVBptSTbqkiLHsxDg3sRdWs5srA0vp3p2Dr4SLUg4O7h/pDbV80xrkZ6BrZsLYoT/RldC/Mf3FzzqNXxW9gWm1R8tEol1Dw7poclfIeGBBtilh8nUmeJmTN578kavFOG9ApIHJX3wilZn6fBMcmm5IgGfAntXN1lavTmTdsxexSjgjrxn911wLGVmwSjEl66EoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gfsVnCj/VPwwht37LJkTQN7PPRZBmMSxr1ALea5Zsmw=; b=Bp+8ZCZi6xPsKHB3qc2nvscWc/0RN3A4y3+VEfZk6NOdn435gvaP9dyrudoVuIZqJjrcP7dicxhL11aU1wNCsLyoSFrerryUKr+1XCRdjCVgPKFcaTNzPe+IN5645dyKA7CemK3RZTcro9IjvaV2FX+DcG6Po/P7ircgAs8vZkkFHkT7p7z283SBUk5Bakrfu0BHvfSqema+0u4TdO9/1iJIIYuJhTcbS5kBDxis93XXwcHBi/2SKMrXC8o/WImTAvnB9Q1sZweaob5I2D1SlPjgXJvOuxQSfniF+3kxIfM1lhT8XQDXjrQeDYm26fhp1XrDeoMzUkf6N6T0+lImyQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gfsVnCj/VPwwht37LJkTQN7PPRZBmMSxr1ALea5Zsmw=; b=HKqZq79/xAXD+5f9f+BzeAlyX7Gcb3bbW1w3PWuSMjYXAK4iDdeWRhUm5JVdLDPduqhidKXs/UR90tMd8jaO+gjij/E1+Glmo2zJD4q0Nnw2xrWLMN8XRC35IP6/s1eHtCTqx/gMXCCMMElg9hS9atVn02z/Z7EtqQnMBUiATNGAK3i3FtfrQ59QUve4C+va34p+kZQOckqHdRgkRambKgOfbOAtjloRCDwM6SpHw1BWKB6mikpNa4AvWt2/m+m8OvUNfb3nphN1ML2dZtM0r5YldOml34CNyMaIfIn20s2s0ZSq80QkySLtNblBicJxszNVRkaNkC3BORNoWPi+qg== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by DU2P250MB0128.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:271::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.28; Mon, 25 Sep 2023 17:52:09 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::5e01:aea5:d3a8:cafa]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::5e01:aea5:d3a8:cafa%3]) with mapi id 15.20.6792.026; Mon, 25 Sep 2023 17:52:08 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 25 Sep 2023 19:53:08 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 X-TMN: [gN1vFWlncfa8PJvXs305v5LxMI2h21gf] X-ClientProxiedBy: ZR0P278CA0207.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:6a::10) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20230925175316.2059732-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|DU2P250MB0128:EE_ X-MS-Office365-Filtering-Correlation-Id: ed8521da-8c9b-446f-c2e7-08dbbdf02361 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9jOiSqdOGMuyCKyVulwH4y1NX39MAeRSoOHWIG/tE3+cxOLdvHI+Gq8yZ8E1wZeS4c5FLLt8PnDhmv4qFDmhthAhAfsxLrX1ZvDMxMrxIL/mFNyO1TyRKU9IXyWEMTmfTPSJdo0K6BDqwaPyI1Oc+btnmO9hUQD/g/j2hjUkvBUvLqHPyZWJyu4xGOqQD+tJN1fDs3sAPQ7T86D4okl/54crPhtHIAqokocD9fThlp6z7wupDShfJ6yscl9djyoEsDodEUnx66cDxJ5BUgKIJXX7LxSe/yEEPwtKlYvYgmwTPRAhiXAl/azDl2frSZP6FccKwChK+XIBpuVLkuzzf6Mt29mPwb6fZCr8nNLy7i4KJMxOk651yv2JQIZ97YVK6Bt+wUfSj46pcBoPBNU6movxKBUHKN+Mu+8SV9KWDTyU0aHMrHIYBQHBekGkmj8cBykaPw4yPSolp+Y1cdcYowBcxT5nPLkONpfYRxyeZplwcSVOH8/tVO5eeFDK9eklM7nzKSsulTtl55CCM5vQjr0HRi8R3kAwYiBStpJxkAnxjob5PxJvLmVcgwY/ADH85oQvnXzNmZN7Kqogb8nWYu8ufPymwPl+IuLIpyhUzMBI4R63QpMKeeaGhsy+8SAh X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lme380syM4Oy2fAlXPprZvt/eN4IhqCd6sVBPNT21YdO3I3734P1jiJK/9P1DFIfwFZwKBvC6/B66qjcJr2HAwB4sbGkxNTexRk/W7jAL9JbVdSrTKz1LI2YRZdqRZ43Edm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EGCkww9xnBPvLSLK5w7Ii8KZNYPKwts7gkP6fo75W7ruFGI5hLMc+cx/rKhIirE1/u9 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ed8521da-8c9b-446f-c2e7-08dbbdf02361 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2023 17:52:08.9039 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2P250MB0128 Subject: [FFmpeg-devel] [PATCH 1/9] avfilter/bwdif: Add proper BWDIFDSPContext 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: afP12GaIs+Da This already avoids unnecessary indirectly included headers in the arch-specific vf_bwdif_init.c files; it is also in preparation for splitting the actual functions out of vf_bwdif.c. Signed-off-by: Andreas Rheinhardt --- libavfilter/aarch64/vf_bwdif_init_aarch64.c | 4 ++-- libavfilter/{bwdif.h => bwdifdsp.h} | 22 +++++++------------- libavfilter/vf_bwdif.c | 23 ++++++++++++++------- libavfilter/x86/vf_bwdif_init.c | 4 ++-- tests/checkasm/vf_bwdif.c | 5 ++--- 5 files changed, 29 insertions(+), 29 deletions(-) rename libavfilter/{bwdif.h => bwdifdsp.h} (85%) diff --git a/libavfilter/aarch64/vf_bwdif_init_aarch64.c b/libavfilter/aarch64/vf_bwdif_init_aarch64.c index f52bc4b9b4..2b8d212de6 100644 --- a/libavfilter/aarch64/vf_bwdif_init_aarch64.c +++ b/libavfilter/aarch64/vf_bwdif_init_aarch64.c @@ -21,7 +21,7 @@ */ #include "libavutil/common.h" -#include "libavfilter/bwdif.h" +#include "libavfilter/bwdifdsp.h" #include "libavutil/aarch64/cpu.h" void ff_bwdif_filter_edge_neon(void *dst1, void *prev1, void *cur1, void *next1, @@ -107,7 +107,7 @@ static void filter_intra_helper(void *dst1, void *cur1, int w, int prefs, int mr } void -ff_bwdif_init_aarch64(BWDIFContext *s, int bit_depth) +ff_bwdif_init_aarch64(BWDIFDSPContext *s, int bit_depth) { const int cpu_flags = av_get_cpu_flags(); diff --git a/libavfilter/bwdif.h b/libavfilter/bwdifdsp.h similarity index 85% rename from libavfilter/bwdif.h rename to libavfilter/bwdifdsp.h index 496cec72ef..1ff810719f 100644 --- a/libavfilter/bwdif.h +++ b/libavfilter/bwdifdsp.h @@ -16,16 +16,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVFILTER_BWDIF_H -#define AVFILTER_BWDIF_H - -#include "libavutil/pixdesc.h" -#include "avfilter.h" -#include "yadif.h" - -typedef struct BWDIFContext { - YADIFContext yadif; +#ifndef AVFILTER_BWDIFDSP_H +#define AVFILTER_BWDIFDSP_H +typedef struct BWDIFDSPContext { void (*filter_intra)(void *dst1, void *cur1, int w, int prefs, int mrefs, int prefs3, int mrefs3, int parity, int clip_max); void (*filter_line)(void *dst, void *prev, void *cur, void *next, @@ -38,11 +32,11 @@ typedef struct BWDIFContext { void (*filter_line3)(void *dst, int dstride, const void *prev, const void *cur, const void *next, int prefs, int w, int parity, int clip_max); -} BWDIFContext; +} BWDIFDSPContext; -void ff_bwdif_init_filter_line(BWDIFContext *bwdif, int bit_depth); -void ff_bwdif_init_x86(BWDIFContext *bwdif, int bit_depth); -void ff_bwdif_init_aarch64(BWDIFContext *bwdif, int bit_depth); +void ff_bwdif_init_filter_line(BWDIFDSPContext *bwdif, int bit_depth); +void ff_bwdif_init_x86(BWDIFDSPContext *bwdif, int bit_depth); +void ff_bwdif_init_aarch64(BWDIFDSPContext *bwdif, int bit_depth); void ff_bwdif_filter_edge_c(void *dst1, void *prev1, void *cur1, void *next1, int w, int prefs, int mrefs, int prefs2, int mrefs2, @@ -60,4 +54,4 @@ void ff_bwdif_filter_line3_c(void * dst1, int d_stride, const void * prev1, const void * cur1, const void * next1, int s_stride, int w, int parity, int clip_max); -#endif /* AVFILTER_BWDIF_H */ +#endif /* AVFILTER_BWDIFDSP_H */ diff --git a/libavfilter/vf_bwdif.c b/libavfilter/vf_bwdif.c index 6195e6cb64..282aef5698 100644 --- a/libavfilter/vf_bwdif.c +++ b/libavfilter/vf_bwdif.c @@ -32,8 +32,10 @@ #include "libavutil/opt.h" #include "libavutil/pixdesc.h" #include "avfilter.h" +#include "bwdifdsp.h" +#include "ccfifo.h" #include "internal.h" -#include "bwdif.h" +#include "yadif.h" /* * Filter coefficients coef_lf and coef_hf taken from BBC PH-2071 (Weston 3 Field Deinterlacer). @@ -45,6 +47,11 @@ static const uint16_t coef_lf[2] = { 4309, 213 }; static const uint16_t coef_hf[3] = { 5570, 3801, 1016 }; static const uint16_t coef_sp[2] = { 5077, 981 }; +typedef struct BWDIFContext { + YADIFContext yadif; + BWDIFDSPContext dsp; +} BWDIFContext; + typedef struct ThreadData { AVFrame *frame; int plane; @@ -261,25 +268,25 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) uint8_t *next = &yadif->next->data[td->plane][y * linesize]; uint8_t *dst = &td->frame->data[td->plane][y * td->frame->linesize[td->plane]]; if (yadif->current_field == YADIF_FIELD_END) { - s->filter_intra(dst, cur, td->w, (y + df) < td->h ? refs : -refs, + s->dsp.filter_intra(dst, cur, td->w, (y + df) < td->h ? refs : -refs, y > (df - 1) ? -refs : refs, (y + 3*df) < td->h ? 3 * refs : -refs, y > (3*df - 1) ? -3 * refs : refs, td->parity ^ td->tff, clip_max); } else if ((y < 4) || ((y + 5) > td->h)) { - s->filter_edge(dst, prev, cur, next, td->w, + s->dsp.filter_edge(dst, prev, cur, next, td->w, (y + df) < td->h ? refs : -refs, y > (df - 1) ? -refs : refs, refs << 1, -(refs << 1), td->parity ^ td->tff, clip_max, (y < 2) || ((y + 3) > td->h) ? 0 : 1); - } else if (s->filter_line3 && y + 2 < slice_end && y + 6 < td->h) { - s->filter_line3(dst, td->frame->linesize[td->plane], + } else if (s->dsp.filter_line3 && y + 2 < slice_end && y + 6 < td->h) { + s->dsp.filter_line3(dst, td->frame->linesize[td->plane], prev, cur, next, linesize, td->w, td->parity ^ td->tff, clip_max); y += 2; } else { - s->filter_line(dst, prev, cur, next, td->w, + s->dsp.filter_line(dst, prev, cur, next, td->w, refs, -refs, refs << 1, -(refs << 1), 3 * refs, -3 * refs, refs << 2, -(refs << 2), td->parity ^ td->tff, clip_max); @@ -382,12 +389,12 @@ static int config_props(AVFilterLink *link) yadif->csp = av_pix_fmt_desc_get(link->format); yadif->filter = filter; - ff_bwdif_init_filter_line(s, yadif->csp->comp[0].depth); + ff_bwdif_init_filter_line(&s->dsp, yadif->csp->comp[0].depth); return 0; } -av_cold void ff_bwdif_init_filter_line(BWDIFContext *s, int bit_depth) +av_cold void ff_bwdif_init_filter_line(BWDIFDSPContext *s, int bit_depth) { s->filter_line3 = 0; if (bit_depth > 8) { diff --git a/libavfilter/x86/vf_bwdif_init.c b/libavfilter/x86/vf_bwdif_init.c index 57f908a8ef..b1d1d6a91c 100644 --- a/libavfilter/x86/vf_bwdif_init.c +++ b/libavfilter/x86/vf_bwdif_init.c @@ -22,7 +22,7 @@ #include "libavutil/cpu.h" #include "libavutil/x86/asm.h" #include "libavutil/x86/cpu.h" -#include "libavfilter/bwdif.h" +#include "libavfilter/bwdifdsp.h" void ff_bwdif_filter_line_sse2(void *dst, void *prev, void *cur, void *next, int w, int prefs, int mrefs, int prefs2, @@ -50,7 +50,7 @@ void ff_bwdif_filter_line_12bit_avx2(void *dst, void *prev, void *cur, void *nex int mrefs2, int prefs3, int mrefs3, int prefs4, int mrefs4, int parity, int clip_max); -av_cold void ff_bwdif_init_x86(BWDIFContext *bwdif, int bit_depth) +av_cold void ff_bwdif_init_x86(BWDIFDSPContext *bwdif, int bit_depth) { int cpu_flags = av_get_cpu_flags(); diff --git a/tests/checkasm/vf_bwdif.c b/tests/checkasm/vf_bwdif.c index 3399cacdf7..fae61b62e4 100644 --- a/tests/checkasm/vf_bwdif.c +++ b/tests/checkasm/vf_bwdif.c @@ -18,8 +18,7 @@ #include #include "checkasm.h" -#include "libavcodec/internal.h" -#include "libavfilter/bwdif.h" +#include "libavfilter/bwdifdsp.h" #include "libavutil/mem_internal.h" #define WIDTH 256 @@ -72,7 +71,7 @@ void checkasm_check_vf_bwdif(void) { - BWDIFContext ctx_8, ctx_10; + BWDIFDSPContext ctx_8, ctx_10; ff_bwdif_init_filter_line(&ctx_8, 8); ff_bwdif_init_filter_line(&ctx_10, 10);