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 2A3C940A9E for ; Thu, 3 Feb 2022 14:11:43 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6731768B05B; Thu, 3 Feb 2022 16:11:41 +0200 (EET) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E648C68AFA3 for ; Thu, 3 Feb 2022 16:11:34 +0200 (EET) Received: from localhost (213-47-68-29.cable.dynamic.surfer.at [213.47.68.29]) (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id B167BC0013 for ; Thu, 3 Feb 2022 14:11:33 +0000 (UTC) Date: Thu, 3 Feb 2022 15:11:30 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20220203141130.GP2829255@pb2> References: <20220110145836.3449558-1-alankelly@google.com> MIME-Version: 1.0 In-Reply-To: <20220110145836.3449558-1-alankelly@google.com> Subject: Re: [FFmpeg-devel] [PATCH 1/4] libswscale: Re-factor ff_shuffle_filter_coefficients. 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="===============1831846336101016966==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============1831846336101016966== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="QTy7iwP9KsECK1Yr" Content-Disposition: inline --QTy7iwP9KsECK1Yr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jan 10, 2022 at 03:58:33PM +0100, Alan Kelly wrote: > Make the code more readable, follow the style guide and propagate memory > allocation errors. Cosmetics and bugfixes should not be in the same patch > --- > libswscale/swscale_internal.h | 2 +- > libswscale/utils.c | 68 ++++++++++++++++++++--------------- > 2 files changed, 40 insertions(+), 30 deletions(-) >=20 > diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h > index 3a78d95ba6..26d28d42e6 100644 > --- a/libswscale/swscale_internal.h > +++ b/libswscale/swscale_internal.h > @@ -1144,5 +1144,5 @@ void ff_sws_slice_worker(void *priv, int jobnr, int= threadnr, > #define MAX_LINES_AHEAD 4 > =20 > //shuffle filter and filterPos for hyScale and hcScale filters in avx2 > -void ff_shuffle_filter_coefficients(SwsContext *c, int* filterPos, int f= ilterSize, int16_t *filter, int dstW); > +int ff_shuffle_filter_coefficients(SwsContext *c, int* filterPos, int fi= lterSize, int16_t *filter, int dstW); > #endif /* SWSCALE_SWSCALE_INTERNAL_H */ > diff --git a/libswscale/utils.c b/libswscale/utils.c > index c5ea8853d5..52f07e1661 100644 > --- a/libswscale/utils.c > +++ b/libswscale/utils.c > @@ -278,39 +278,47 @@ static const FormatEntry format_entries[] =3D { > [AV_PIX_FMT_P416LE] =3D { 1, 1 }, > }; > =20 > -void ff_shuffle_filter_coefficients(SwsContext *c, int *filterPos, int f= ilterSize, int16_t *filter, int dstW){ > +int ff_shuffle_filter_coefficients(SwsContext *c, int *filterPos, > + int filterSize, int16_t *filter, > + int dstW) > +{ > #if ARCH_X86_64 > - int i, j, k, l; > + int i =3D 0, j =3D 0, k =3D 0; why? they are set when used if iam not mistaken > int cpu_flags =3D av_get_cpu_flags(); > + if (!filter || dstW % 16 !=3D 0) return 0; please add \n also a comment what the dstW & 16 case exactly does and why [...] > int sws_isSupportedInput(enum AVPixelFormat pix_fmt) > @@ -1836,7 +1844,8 @@ av_cold int sws_init_context(SwsContext *c, SwsFilt= er *srcFilter, > get_local_pos(c, 0, 0, 0), > get_local_pos(c, 0, 0, 0))) < 0) > goto fail; > - ff_shuffle_filter_coefficients(c, c->hLumFilterPos, c->hLumF= ilterSize, c->hLumFilter, dstW); > + if ((ret =3D ff_shuffle_filter_coefficients(c, c->hLumFilter= Pos, c->hLumFilterSize, c->hLumFilter, dstW)) !=3D 0) > + goto nomem; This is confusing as ret is never used, also error codes are <0 thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Those who are best at talking, realize last or never when they are wrong. --QTy7iwP9KsECK1Yr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCYfvijwAKCRBhHseHBAsP q++DAKCHmyCcm+d+0lL3ycY0osjlfTE8bgCfQ/+en9V/0s+94OieWQPHMdEp8Po= =etec -----END PGP SIGNATURE----- --QTy7iwP9KsECK1Yr-- --===============1831846336101016966== 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". --===============1831846336101016966==--