From patchwork Fri Nov 15 08:33:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: leozhang X-Patchwork-Id: 16279 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 7D3F64472D0 for ; Fri, 15 Nov 2019 10:33:43 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5B9C168A212; Fri, 15 Nov 2019 10:33:43 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smg-sh-01.qiyi.com (unknown [101.227.12.172]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 364EF68988C for ; Fri, 15 Nov 2019 10:33:35 +0200 (EET) X-AuditID: 65e30cac-0cbff7000000205d-be-5dce62dc4c87 Received: from mail.iqiyi.com (Unknown_Domain [10.11.69.97]) by smg-sh-01.qiyi.com (Qiyi mail Gateway) with SMTP id C5.1F.08285.CD26ECD5; Fri, 15 Nov 2019 16:33:33 +0800 (HKT) From: leozhang To: Date: Fri, 15 Nov 2019 16:33:26 +0800 Message-ID: <1573806806-193238-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.215] X-ClientProxiedBy: BJ-CAS31.iqiyi.pps (10.11.50.86) To EXCH20.iqiyi.pps (10.16.148.50) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprELMWRmVeSWpSXmKPExsXCxe2aqHs36VyswbnHjBbfPp1hdmD0+LNo M0sAYxS3TVJiSVlwZnqevl0Cd8a/1ftYCv5yVzQ+eMfSwPiEs4uRk0NCwESip2cJaxcjF4eQ wEZGiecb17GAJNgElCTWr5jKCmKLCMhKrP43hQ3EFhYIkDg+YRcjiM0ioCqxf9slsHpeASeJ CUcus0MMVZCY8vA9M0RcUOLkzCdgNcwCEhIHX7wAiwsJyEk8/fULKM4BVv/vYTBEa4TEl1cr WScw8s5C0j0LSfcCRqZVjELFuem6xRm6BoZ6hZmVmXrJ+bmbGIHBkfqYZ80Oxmc7nA8xCnAw KvHwStw6GyvEmlhWXJl7iFGCg1lJhJez5UisEG9KYmVValF+fFFpTmrxIUZpDhYlcd7sc2di hQTSE0tSs1NTC1KLYLJMHJwg3VxSIsWpeSmpRYmlJRnxoMCNLwaGrlQDI4/yjcfdOx7ecg4N n9669pBZ8/ZixqRzjju5a8WmLPAvstsuGFfwl/d02LOdW+RfeUbxR+/4fNjL/teXAxOX5P0x s9nO82jCY4GkKI6+hgkiWkbzZ101/2tnKFTOyeje9v3HjVl6p+9+lODf0KXcMElc0H/5FV69 +hu8i5REt8zMMf/Yt9rHXomlOCPRUIu5qDgRACX9200lAgAA Subject: [FFmpeg-devel] [PATCH V2 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);