From patchwork Wed Aug 14 13:36:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 51014 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:a746:0:b0:489:2eb3:e4c4 with SMTP id f6csp923820vqm; Wed, 14 Aug 2024 06:46:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXN6zes4d2PHguq/x5JJC4taKCHy1Py7yDW0O75IzhAt7UwYyTUgby6EVFMUOKbH3qHUWgE6+FEIJKzSAlCsiuGCn/ycAtnaZWr/A== X-Google-Smtp-Source: AGHT+IEP2UwUbNxCe+FZnwr2s5ErgHRW6c/W/HCrkwTox7XzfaaAMS3wTBtCZqA5raGkpz+QYYhF X-Received: by 2002:a17:906:eece:b0:a80:a294:f8a with SMTP id a640c23a62f3a-a8366c25b0emr119810766b.1.1723643172544; Wed, 14 Aug 2024 06:46:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723643172; cv=none; d=google.com; s=arc-20160816; b=D1egnHNCalraL6RPmbvQ9kEl1kaoKCHjeEo7vibTxaD0b86+Imbk4cIxsa3JJsZsdT XKTjoeOpDKa7a7r17uZnTWAAw0Nv4a4DZ75GA7kFhv2Mwp/YbG9T+iLyt4P++EmZDgCt wNvm/rp6EzRTik5RWCAHCccQkcsZ+w5Lh348408ZUK/IOfbf1XIj+GexV4d6ktSgPipC KvLKnOfML9j+SUhLxNokBpOHRbAqNF+K8XT/5JZnrjuQLwiiXZPt9qIVop2u9qAAae7O a9zP7KaWOHsyfFIi2HUDaMnyKGPeuHk/gIxwY9Aj8BS//L9EZP+DZSt1pASluC2XJZlD GEHg== 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:date:to:from:message-id :dkim-signature:delivered-to; bh=ZODr1dBJo3eqZWuMsA9PixzQ4p0gWAuCpXW7RMxi17U=; fh=HnHYuZ9XgUo86ZRXTLWWmQxhslYEI9B9taZ5X1DLFfc=; b=AlpLhngYygQPEaQRnBKzRHbbOzT14sj5jGOCPFlB8quIQDiPMXk5M5curbJq26Ab02 2Z5hSmjtgDbFF46OSuoNXNvWMOIGjA7Oy5TbrH6jFo0NLdJZRTKloikow6If4V/mAKT3 ZJr6KXI0tk0PLIABOT4OaGuRWriKvu0bRycC5UcW/PPrikIrFo+6ac4xoTPkvzr97Rfr +4XVZ20pYXmimqpce8SVY/pqhwImCRYTq8kLA2bcP5vDarp4snIgGQPA+UEBwMctKxC9 jSOupEcmCX6UFAAtuZ3x0N6x+lu/CHRGnGko8wzITvC8zyRNG9eIqOx/0oancNkZ2vT4 b2dw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=NH9p8TVv; 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=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a80f414e988si219141766b.509.2024.08.14.06.46.12; Wed, 14 Aug 2024 06:46:12 -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=@foxmail.com header.s=s201512 header.b=NH9p8TVv; 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=NONE dis=NONE) header.from=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D5CE568DB56; Wed, 14 Aug 2024 16:37:41 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out203-205-221-231.mail.qq.com (out203-205-221-231.mail.qq.com [203.205.221.231]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8E04768DB03 for ; Wed, 14 Aug 2024 16:37:33 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1723642650; bh=51aU1CVu1GFI/KfzvnW5+TWbCzvmElpELjB+uUIQdpw=; h=From:To:Cc:Subject:Date; b=NH9p8TVvlG5TW8J6wvw4cayvLydXJFC7TTt24g99rMy58eUkBYrPFW2qB+KHja+LD SZHFDfIixmUrdlTKhhK3iVoXQmgxCCs41w2yS5r/spemDzXLep/+ViDF8TNgwH0Pcx lsma9VlYRfExzGTDekWwlb2g4SSoTjuBEAMRxHeQ= Received: from ZHILIZHAO-MB1.tencent.com ([113.108.77.52]) by newxmesmtplogicsvrszb9-0.qq.com (NewEsmtp) with SMTP id 90F3F0F9; Wed, 14 Aug 2024 21:36:15 +0800 X-QQ-mid: xmsmtpt1723642575tv6vy6d75 Message-ID: X-QQ-XMAILINFO: MVbvI5amSZ2YP8y6LqogsFmlbfT9RHms7X9LmliStBx8bRXpIc5mGx5bKGXj/q huuOY6mNrl8dBPX40GeVb1Q6YFRyJNwKyEgzj4kcfaM2jdvxOkawvMRo2eYmVKqGB/Mm75ogyc2c IK+GJaVYcz+hr6Ypj5TpvkRCkiLkxG80lpdLWnolrzHlUF7L5u4VW2lcoVCMTOBN3aqQJq6kU8fJ wmsM/VOYrkXDY5mXJknhXThP8XtoQQC9JeHxKyuoV4vS5Bn3xgaq+I/GDaLD95zTNBBaKwsLyVGW pZZXTUmuzJmNjRm8Ih2JDZqeJnY+8yw7Foi4fiHKP1RUu1wTjUQznbJZ0fSFg45ySL1XtJnglwZ8 MdZ/6jQiPbVeyTZBfKgcRRmmhiaKpFbSXPSvVJ/vMgD3YJlDzwFGSfpPfw4CLnwskKd9iQWq5Zf8 zQcO9FSLG3p8mmiwrbEasElbOknlJeqX3wrovgoIiDUwwwJY4SgMn7zkzvo3L2u6zCC5jtjaQOkK dETajqa5aer3M+H7jEw8S6JgH1w9BZwMGlO2qOxpoUqKmr6EEOQ7YKF6uJFKz7u7tVQL7gZqm3PF WTqSfpMYjtp6BzmhJN3prKuJgJI0MikRQYKA6Idu6gEG7MbVjALR65Jd6RfqYDDw1oyrZlZPNzn/ I8KqR/cyT6DdL6ix7RjipIJt96wqMHaI+t4a3nM4iUPaWgdtgDMSIailMKthmr22ZCzuIEglavJT K+BLlV4AbvqGKTceJmg1n4IMqgbfy9kM0TMpX8ojA15d/x+fDVGNQ9SSxG9PM33O1DCHmv6vFYw3 i/mwO+cdttUFaKZ+f96t0rYOf6lIeC7Stj3uPjK1oVuW7kIMKOimYCDCCIgNpcy3a9YdDiQwnTTt nY3eYVvLIf4YywBnAkgtudpXf/jvJ7leK5KOC3EabC/D91cs/oezxAlbIn9k4nqPRyT1M9kvDtzB 3zzbpNJzhqFo6SruA2pq0oEAfVMJFRMDYfDWYjjMxAGPmm830a/Xves5fD//uXFBQgAJdaO/Y= X-QQ-XMRINFO: OWPUhxQsoeAVDbp3OJHYyFg= From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Wed, 14 Aug 2024 21:36:14 +0800 X-OQ-MSGID: <20240814133614.96688-1-quinkblack@foxmail.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avfilter/vf_unsharp: Merge header into .c 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: Zhao Zhili Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: NRWUTP70TPci From: Zhao Zhili It was shared with opencl implementation. --- libavfilter/unsharp.h | 62 ---------------------------------------- libavfilter/vf_unsharp.c | 34 +++++++++++++++++++++- 2 files changed, 33 insertions(+), 63 deletions(-) delete mode 100644 libavfilter/unsharp.h diff --git a/libavfilter/unsharp.h b/libavfilter/unsharp.h deleted file mode 100644 index 0da6f05036..0000000000 --- a/libavfilter/unsharp.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2013 Wei Gao - * Copyright (C) 2013 Lenny Wang - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFILTER_UNSHARP_H -#define AVFILTER_UNSHARP_H - -#include "config.h" -#include "avfilter.h" - -#define MIN_MATRIX_SIZE 3 -#define MAX_MATRIX_SIZE 63 - - -typedef struct UnsharpFilterParam { - int msize_x; ///< matrix width - int msize_y; ///< matrix height - int amount; ///< effect amount - int steps_x; ///< horizontal step count - int steps_y; ///< vertical step count - int scalebits; ///< bits to shift pixel - int32_t halfscale; ///< amount to add to pixel - uint32_t *sr; ///< finite state machine storage within a row - uint32_t **sc; ///< finite state machine storage across rows -} UnsharpFilterParam; - -typedef struct UnsharpContext { - const AVClass *class; - int lmsize_x, lmsize_y, cmsize_x, cmsize_y; - int amsize_x, amsize_y; - float lamount, camount; - float aamount; - UnsharpFilterParam luma; ///< luma parameters (width, height, amount) - UnsharpFilterParam chroma; ///< chroma parameters (width, height, amount) - UnsharpFilterParam alpha; ///< alpha parameters (width, height, amount) - int hsub, vsub; - int nb_planes; - int bitdepth; - int bps; - int nb_threads; - int (* apply_unsharp)(AVFilterContext *ctx, AVFrame *in, AVFrame *out); - int (* unsharp_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs); -} UnsharpContext; - -#endif /* AVFILTER_UNSHARP_H */ diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c index 2705ac5270..01b5dae796 100644 --- a/libavfilter/vf_unsharp.c +++ b/libavfilter/vf_unsharp.c @@ -44,7 +44,39 @@ #include "libavutil/mem.h" #include "libavutil/opt.h" #include "libavutil/pixdesc.h" -#include "unsharp.h" + +#define MIN_MATRIX_SIZE 3 +#define MAX_MATRIX_SIZE 63 + +typedef struct UnsharpFilterParam { + int msize_x; ///< matrix width + int msize_y; ///< matrix height + int amount; ///< effect amount + int steps_x; ///< horizontal step count + int steps_y; ///< vertical step count + int scalebits; ///< bits to shift pixel + int32_t halfscale; ///< amount to add to pixel + uint32_t *sr; ///< finite state machine storage within a row + uint32_t **sc; ///< finite state machine storage across rows +} UnsharpFilterParam; + +typedef struct UnsharpContext { + const AVClass *class; + int lmsize_x, lmsize_y, cmsize_x, cmsize_y; + int amsize_x, amsize_y; + float lamount, camount; + float aamount; + UnsharpFilterParam luma; ///< luma parameters (width, height, amount) + UnsharpFilterParam chroma; ///< chroma parameters (width, height, amount) + UnsharpFilterParam alpha; ///< alpha parameters (width, height, amount) + int hsub, vsub; + int nb_planes; + int bitdepth; + int bps; + int nb_threads; + int (* apply_unsharp)(AVFilterContext *ctx, AVFrame *in, AVFrame *out); + int (* unsharp_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs); +} UnsharpContext; typedef struct TheadData { UnsharpFilterParam *fp;