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 AE4C346A08 for ; Fri, 1 Sep 2023 16:54:52 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 57CA968C713; Fri, 1 Sep 2023 19:54:48 +0300 (EEST) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9DD5568C59E for ; Fri, 1 Sep 2023 19:54:42 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id BFCF7E0002 for ; Fri, 1 Sep 2023 16:54:41 +0000 (UTC) Date: Fri, 1 Sep 2023 18:54:40 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20230901165440.GA7802@pb2> References: <20230826122328.95416-1-stefasab@gmail.com> MIME-Version: 1.0 In-Reply-To: X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH] lsws/swscale.h: introduce 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 Content-Type: multipart/mixed; boundary="===============4489100825127000181==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============4489100825127000181== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="CBNHasKRD8YkFhp6" Content-Disposition: inline --CBNHasKRD8YkFhp6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 31, 2023 at 07:16:20PM +0200, Stefano Sabatini wrote: > On date Thursday 2023-08-31 18:51:52 +0200, Andreas Rheinhardt wrote: > > Stefano Sabatini: > > > +int sws_get_gaussian_vec(SwsVector **vecp, > > > + AVClass *log_ctx, > > > + double standard_deviation, double quality); > > > =20 > >=20 > > Seriously? A pointer to an AVClass as log_ctx? It is actually AVClass** > > (the logcontext must have a pointer to an AVClass as its first member), > > but we always use NULL. >=20 > Sorry, sloppy editing on my side. >=20 > > Apart from that: I am not really convinced that the improvement is worth > > the hassle. >=20 > This is not a high-profile function (probably it's never used outside > lavfi) and provides an opportunity to move the API to the correct > direction. > doc/APIchanges | 3 +++ > libswscale/swscale.h | 27 ++++++++++++++++++++++++++- > libswscale/utils.c | 42 +++++++++++++++++++++++++++++++++-----= ---- > libswscale/version.h | 2 +- > libswscale/version_major.h | 4 ++++ > 5 files changed, 67 insertions(+), 11 deletions(-) > b91b721cea2752b28a51aaeab2a464b2699dfb49 0001-lsws-swscale.h-introduce-s= ws_get_gaussian_vec.patch > From 69c33f62e15de3d199d54187d38c0856418f0981 Mon Sep 17 00:00:00 2001 > From: Stefano Sabatini > Date: Sat, 26 Aug 2023 14:20:35 +0200 > Subject: [PATCH 1/2] lsws/swscale.h: introduce sws_get_gaussian_vec >=20 > Use in place of sws_getGaussianVec. >=20 > The new function enable better error handling, and provide better naming > for the variance variable, now named standard_deviation to reflect the > meaning of the parameter. > --- > doc/APIchanges | 3 +++ > libswscale/swscale.h | 27 +++++++++++++++++++++++- > libswscale/utils.c | 42 ++++++++++++++++++++++++++++++-------- > libswscale/version.h | 2 +- > libswscale/version_major.h | 4 ++++ > 5 files changed, 67 insertions(+), 11 deletions(-) >=20 > diff --git a/doc/APIchanges b/doc/APIchanges > index ad1efe708d..bad2d61027 100644 > --- a/doc/APIchanges > +++ b/doc/APIchanges > @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-= 02-09 > =20 > API changes, most recent first: > =20 > +2023-08-26 - xxxxxxxxxx - lsws 7.4.100 - swscale.h > + Introduce sws_get_gaussian_vec, use in place of sws_getGaussianVec. > + > 2023-08-18 - xxxxxxxxxx - lavu 58.17.100 - channel_layout.h > All AV_CHANNEL_LAYOUT_* macros are now compatible with C++ 17 and olde= r. > =20 > diff --git a/libswscale/swscale.h b/libswscale/swscale.h > index 9d4612aaf3..55f2fc4a48 100644 > --- a/libswscale/swscale.h > +++ b/libswscale/swscale.h > @@ -355,11 +355,36 @@ int sws_getColorspaceDetails(struct SwsContext *c, = int **inv_table, > */ > SwsVector *sws_allocVec(int length); > =20 > +#if FF_API_SWS_GET_GAUSSIAN_VEC > /** > - * Return a normalized Gaussian curve used to filter stuff > + * Return a normalized Gaussian curve used to filter stuff. > + * > * quality =3D 3 is high quality, lower is lower quality. > + * @deprecated use sws_get_gaussian_vector() > */ > +attribute_deprecated > SwsVector *sws_getGaussianVec(double variance, double quality); > +#endif > + > +/** > + * Compute and return a normalized Gaussian vector. > + * > + * @param vecp: pointer where the computed vector is put in case of > + * success > + * @param standard_deviation the standard deviation used to generate > + * the Gaussian vector, must be a non-negative value > + * @param quality the quality of the generated Gaussian vector, must > + * be a non-negative value. It affects the lenght of the generated > + * vector. A value equal to 3 corresponds to high quality. > + * @param log_ctx a pointer to an arbitrary struct of which the first > + * field is a pointer to an AVClass struct (used for av_log) > + * used for logging, can be NULL > + * > + * @return a negative error code on error, non negative otherwise > + */ > +int sws_get_gaussian_vec(SwsVector **vecp, > + double standard_deviation, double quality, > + void *log_ctx); which of the two do you consider better? First, here the central part we return is the vector SwsVector *gaus_vec =3D sws_getGaussianVec(NULL, 1, 2); SwsVector *temp_vec =3D sws_ConvolveVec(NULL, in_vec, gaus_vec); sws_averageVec(temp_vec, temp_vec, in_vec); av_free(gaus_vec); return temp_vec; // Error checking here happens by temp_vec being NULL in a= ll cases of error vs. Second, here the central part we return is the error code SwsVector *gaus_vec =3D NULL; SwsVector *temp_vec =3D NULL; int err =3D sws_getGaussianVec(&gaus_vec, 1, 2); if (err<0) goto fail; err =3D sws_ConvolveVec(&temp_vec, in_vec, gaus_vec); if (err<0) goto fail; err =3D sws_averageVec(&temp_vec, temp_vec, in_vec); if (err<0) goto fail; *ret_argument =3D temp_vec return 0; fail: av_free(gaus_vec) av_free(temp_vec) return ret; thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Complexity theory is the science of finding the exact solution to an approximation. Benchmarking OTOH is finding an approximation of the exact --CBNHasKRD8YkFhp6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZPIXTQAKCRBhHseHBAsP q8O9AJ9OALJ6fCHG07TX+Hmsy0XCtwmTgACdE51xepb6+AjTVpnBqg13VZHwiHU= =bgEA -----END PGP SIGNATURE----- --CBNHasKRD8YkFhp6-- --===============4489100825127000181== 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". --===============4489100825127000181==--