From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 49C8B454F5 for ; Thu, 31 Aug 2023 15:34:54 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B1D9168C7A6; Thu, 31 Aug 2023 18:34:52 +0300 (EEST) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4AC1D68C718 for ; Thu, 31 Aug 2023 18:34:46 +0300 (EEST) Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-3fee5ddc23eso9156095e9.1 for ; Thu, 31 Aug 2023 08:34:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693496085; x=1694100885; darn=ffmpeg.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=Ntz1evnmwcJaqRej3wwhdwGUcarLbKu1sPoulJ/23Nw=; b=ostdkQ/yQ5zQzanBKlM7iRTSNPhTqm5G1QW+kmf1+ePyf/OEh74aVG59uOaDLCo368 6jrl2OdjcaqwmWMIoaP2LPsGDMuSqHcANA5MEqa/hwr8WD84dDJHcILoK+V8SPXB+VXD iHrbkh1FUt6MHDnd58rhQgcstceFv4xlqluGAk5o5rKIz6tqmuetaQPPwVE4v+6nFU66 WzZeHXJbRBXuq+fV56IQqnzSYaJz7hdDhSMktIaQ8UJyzUNMzZd3AfG925el/+7cPip1 WYzyNCuQbEL9gzib3Kx09cbqTf3/41AEF2tOEPjwlVEFAQ6JeY4ibUmMI4lRFC5r5QxT Z2CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693496085; x=1694100885; h=user-agent:in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Ntz1evnmwcJaqRej3wwhdwGUcarLbKu1sPoulJ/23Nw=; b=IZ5Bve5sX2jBjuXHzPlTkCkqwOouTJjDWdrQiFHruKfRjng23KGRylJylIUcCn3s+P aghqNHTn1PCQ06kf2XeIdZ6UhvIaAsq1Qz3RBfO4Nx45BmvjWITrrachfdeTuVapmUHs 8mlsrEDBGOota8gOgkwd2GDEwKp3vZSF6TiVwWpjHQ06ZKbe/e0D4HGKjxfT7DsQG9VO z2ZQOt6ylDW49klLzx73VFPn1sb6XqkZT8Pkh4KHf5H6jzZptGodSi/8eC/yISOVHana z/aHpdt9qvxpDkDo5uVv/OtoVc+BjRZj+H/Az0X7JOjZDv5fkKvl21RHrDAmAmup0Hn7 4WyQ== X-Gm-Message-State: AOJu0Ywtzf9448ZWZrPjtaGwiBcAwMvDPWsyR8OtC2H5k3959/DmgyY3 Ek6IeD3iXSGQopkjpQ7u85xsO7kX+hs= X-Google-Smtp-Source: AGHT+IGDIPrthD0+iTRosNAE84/RjAD0DWme3C9xu6ODNS6rjhqV3tJLqSX+UMlWT8oX7D3NrZZDsQ== X-Received: by 2002:a05:600c:a397:b0:401:b0f2:88cc with SMTP id hn23-20020a05600ca39700b00401b0f288ccmr4399457wmb.41.1693496084928; Thu, 31 Aug 2023 08:34:44 -0700 (PDT) Received: from mariano ([82.84.194.139]) by smtp.gmail.com with ESMTPSA id p4-20020a7bcc84000000b003fee9cdf55esm2308170wma.14.2023.08.31.08.34.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Aug 2023 08:34:44 -0700 (PDT) Received: by mariano (Postfix, from userid 1000) id EB9E0BFCDA; Thu, 31 Aug 2023 17:34:42 +0200 (CEST) Date: Thu, 31 Aug 2023 17:34:42 +0200 From: Stefano Sabatini To: FFmpeg development discussions and patches Message-ID: Mail-Followup-To: FFmpeg development discussions and patches References: <20230826132145.159744-1-stefasab@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="OuY2C7DiiSc8AcMX" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.1.4 (2021-12-11) Subject: Re: [FFmpeg-devel] [PATCH 1/2] lsws, lavfi: use sws_get_gaussian_vec 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --OuY2C7DiiSc8AcMX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On date Saturday 2023-08-26 17:13:19 +0200, Andreas Rheinhardt wrote: > Stefano Sabatini: > > Use in place of deprecated sws_getGaussianVec. > > This patchset should have been sent as a reply to the patch actually > adding sws_get_gaussian_vec. Noted. > > --- > > libavfilter/vf_sab.c | 17 +++++++++++++---- > > libavfilter/vf_smartblur.c | 8 ++++---- > > libswscale/utils.c | 32 ++++++++++++++------------------ > > 3 files changed, 31 insertions(+), 26 deletions(-) > > [...] > > - if (!filter->lumH || !filter->lumV || !filter->chrH || !filter->chrV) > > - goto fail; > > +#define SET_FILTER_VECTOR(name_, standard_deviation_, quality_) \ > > + if (standard_deviation_ != 0.0) { \ > > + sws_get_gaussian_vec(&filter->name_, \ > > + standard_deviation_, quality_); \ > > + } else { \ > > + filter->name_ = sws_getIdentityVec(); \ > > + } \ > > + if (!filter->name_) \ > > + goto fail; \ > > + > > + SET_FILTER_VECTOR(lumH, lumaGBlur, 3.0); > > + SET_FILTER_VECTOR(lumV, lumaGBlur, 3.0); > > + SET_FILTER_VECTOR(chrH, chromaGBlur, 3.0); > > + SET_FILTER_VECTOR(chrV, chromaGBlur, 3.0); > > This will check lumaGBlur/chromaGBlur twice. Dropped the macro and updated. --OuY2C7DiiSc8AcMX Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0002-lsws-lavfi-use-sws_get_gaussian_vec.patch" >From 77eeaffc7d3f9e8cd2778f7c686f97d3a5f69ac1 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sat, 26 Aug 2023 15:08:55 +0200 Subject: [PATCH 2/4] lsws,lavfi: use sws_get_gaussian_vec Use in place of deprecated sws_getGaussianVec. --- libavfilter/vf_sab.c | 17 +++++++++++++---- libavfilter/vf_smartblur.c | 8 ++++---- libswscale/utils.c | 8 ++++---- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/libavfilter/vf_sab.c b/libavfilter/vf_sab.c index 5e0687c9a2..6ae00d3eeb 100644 --- a/libavfilter/vf_sab.c +++ b/libavfilter/vf_sab.c @@ -143,7 +143,7 @@ static int open_filter_param(FilterParam *f, int width, int height, unsigned int { SwsVector *vec; SwsFilter sws_f; - int i, x, y; + int ret, i, x, y; int linesize = FFALIGN(width, 8); f->pre_filter_buf = av_malloc(linesize * height); @@ -151,7 +151,10 @@ static int open_filter_param(FilterParam *f, int width, int height, unsigned int return AVERROR(ENOMEM); f->pre_filter_linesize = linesize; - vec = sws_getGaussianVec(f->pre_filter_radius, f->quality); + ret = sws_get_gaussian_vec(&vec, NULL, f->pre_filter_radius, f->quality); + if (ret < 0) + return ret; + sws_f.lumH = sws_f.lumV = vec; sws_f.chrH = sws_f.chrV = NULL; f->pre_filter_context = sws_getContext(width, height, AV_PIX_FMT_GRAY8, @@ -159,7 +162,10 @@ static int open_filter_param(FilterParam *f, int width, int height, unsigned int sws_flags, &sws_f, NULL, NULL); sws_freeVec(vec); - vec = sws_getGaussianVec(f->strength, 5.0); + ret = sws_get_gaussian_vec(&vec, NULL, f->strength, 5.0); + if (ret < 0) + return ret; + for (i = 0; i < COLOR_DIFF_COEFF_SIZE; i++) { double d; int index = i-COLOR_DIFF_COEFF_SIZE/2 + vec->length/2; @@ -171,7 +177,10 @@ static int open_filter_param(FilterParam *f, int width, int height, unsigned int } sws_freeVec(vec); - vec = sws_getGaussianVec(f->radius, f->quality); + ret = sws_get_gaussian_vec(&vec, NULL, f->radius, f->quality); + if (ret < 0) + return ret; + f->dist_width = vec->length; f->dist_linesize = FFALIGN(vec->length, 8); f->dist_coeff = av_malloc_array(f->dist_width, f->dist_linesize * sizeof(*f->dist_coeff)); diff --git a/libavfilter/vf_smartblur.c b/libavfilter/vf_smartblur.c index 85d8d502e1..13a4225990 100644 --- a/libavfilter/vf_smartblur.c +++ b/libavfilter/vf_smartblur.c @@ -126,11 +126,11 @@ static int alloc_sws_context(FilterParam *f, int width, int height, unsigned int { SwsVector *vec; SwsFilter sws_filter; + int ret; - vec = sws_getGaussianVec(f->radius, f->quality); - - if (!vec) - return AVERROR(EINVAL); + ret = sws_get_gaussian_vec(&vec, NULL, f->radius, f->quality); + if (ret < 0) + return ret; sws_scaleVec(vec, f->strength); vec->coeff[vec->length / 2] += 1.0 - f->strength; diff --git a/libswscale/utils.c b/libswscale/utils.c index e56df87d9f..5bdaf50392 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -2367,16 +2367,16 @@ SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur, return NULL; if (lumaGBlur != 0.0) { - filter->lumH = sws_getGaussianVec(lumaGBlur, 3.0); - filter->lumV = sws_getGaussianVec(lumaGBlur, 3.0); + sws_get_gaussian_vec(&filter->lumH, NULL, lumaGBlur, 3.0); + sws_get_gaussian_vec(&filter->lumV, NULL, lumaGBlur, 3.0); } else { filter->lumH = sws_getIdentityVec(); filter->lumV = sws_getIdentityVec(); } if (chromaGBlur != 0.0) { - filter->chrH = sws_getGaussianVec(chromaGBlur, 3.0); - filter->chrV = sws_getGaussianVec(chromaGBlur, 3.0); + sws_get_gaussian_vec(&filter->chrV, NULL, chromaGBlur, 3.0); + sws_get_gaussian_vec(&filter->chrV, NULL, chromaGBlur, 3.0); } else { filter->chrH = sws_getIdentityVec(); filter->chrV = sws_getIdentityVec(); -- 2.34.1 --OuY2C7DiiSc8AcMX Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". --OuY2C7DiiSc8AcMX--