From patchwork Thu Nov 14 03:51:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: leozhang X-Patchwork-Id: 16253 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 8906E449C82 for ; Thu, 14 Nov 2019 05:51:43 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 58E5268A4CC; Thu, 14 Nov 2019 05:51:43 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smg-bj-02.qiyi.com (unknown [202.108.14.100]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6DFF9689824 for ; Thu, 14 Nov 2019 05:51:35 +0200 (EET) X-AuditID: ca6c0e64-24fff70000007a70-8e-5dcccf457070 Received: from mail.iqiyi.com (Unknown_Domain [10.11.69.97]) by smg-bj-02.qiyi.com (Qiyi mail Gateway) with SMTP id 46.86.31344.54FCCCD5; Thu, 14 Nov 2019 11:51:33 +0800 (HKT) From: leozhang To: Date: Thu, 14 Nov 2019 11:51:29 +0800 Message-ID: <1573703489-128899-1-git-send-email-leozhang@qiyi.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.13.40.213] X-ClientProxiedBy: BJ-CAS31.iqiyi.pps (10.11.50.86) To EXCH20.iqiyi.pps (10.16.148.50) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprMLMWRmVeSWpSXmKPExsXCxe2aqOt6/kyswZuVnBbfPp1hdmD0+LNo M0sAYxS3TVJiSVlwZnqevl0Cd8a/1ftYCv5yVzQ+eMfSwPiEs4uRk0NCwETi7qpFLF2MXBxC AhsZJfadmMUEkmATUJJYv2IqK4gtIiArsfrfFDYQW1jAV+JDVwcjiM0ioCrx4fJLFhCbV8BJ 4ubpNcwQQxUkpjx8zwwRF5Q4OfMJWA2zgITEwRcvwOJCAnIST3/9YoGpfzh1EjuEHSHx5dVK 1gmMvLOQtM9C0r6AkWkVo1BxbrpuUpaugZFeYWZlpl5yfu4mRmB4nMrhS9nBeHC+8yFGAQ5G JR5eA90zsUKsiWXFlbmHGCU4mJVEeDlbjsQK8aYkVlalFuXHF5XmpBYfYpTmYFES5y07B1Qt kJ5YkpqdmlqQWgSTZeLgBOnmkhIpTs1LSS1KLC3JiAeFbnwxMHilGhgXK+/1PPTdwl0oJWKr YFaz/6rp8YuTHuW6PH/zaL9WwLp01W2yrlumtL3pmLfXIWCXwMVP/a/6TrevejnV6fOpdbwf k6ISeQ50vVIwPLsi9gTHBY4T+/Y11B+Yc2Xeu/W7dFiVP8tm+7lrbg0yiLj62Gvm7D4xhdST F5p/eOSmXN7Rwne2ld9RiaU4I9FQi7moOBEAjU2ltyYCAAA= Subject: [FFmpeg-devel] [PATCH 1/2] avfilter/vf_bilateral: add seperate function to init lut 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Reviewed-by: Paul B Mahol Signed-off-by: leozhang --- libavfilter/vf_bilateral.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/libavfilter/vf_bilateral.c b/libavfilter/vf_bilateral.c index 3c9d800..36e53d2 100644 --- a/libavfilter/vf_bilateral.c +++ b/libavfilter/vf_bilateral.c @@ -91,19 +91,27 @@ static int query_formats(AVFilterContext *ctx) return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); } -static int config_input(AVFilterLink *inlink) +static int init_lut(BilateralContext *s) { - BilateralContext *s = inlink->dst->priv; - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); float inv_sigma_range; - s->depth = desc->comp[0].depth; inv_sigma_range = 1.0f / (s->sigmaR * ((1 << s->depth) - 1)); //compute a lookup table for (int i = 0; i < (1 << s->depth); i++) s->range_table[i] = expf(-i * inv_sigma_range); + return 0; +} + +static int config_input(AVFilterLink *inlink) +{ + BilateralContext *s = inlink->dst->priv; + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); + + s->depth = desc->comp[0].depth; + init_lut(s); + s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w); s->planewidth[0] = s->planewidth[3] = inlink->w; s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);