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 ESMTPS id 1A9644E62F for ; Mon, 5 May 2025 17:07:59 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 63A4768A5E3; Mon, 5 May 2025 20:07:55 +0300 (EEST) Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 23F56687AA1 for ; Mon, 5 May 2025 20:07:48 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 466DA438E2 for ; Mon, 5 May 2025 17:07:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1746464867; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=u9TkG93JyOWdUDMX4/ap6hDennYENVZ1gRptu7pjM+E=; b=cVby9E4vIPmkbY2YJgz5+Fx/gji0LTsy66FCgstRGiUjrz7LqtRIc0JxOE3nonL4E77Uwj IEiD2PT27ksu/EP438y0f/UcUtzxRrMOzW1T/vOnxj+IOsNHFMiKbDcEJpaOz5W0K+jM7o jMuTDJLGhNhKyy6fiLA1s+UwmA7AqxU/P+86IncuG79fQPu7Q+H4SMMhV9hxym8pGozWZv +K6nPSYDRmWSgAO1q6bGQ/hLzbdpOJJeaOqTTC/qQvy0ilKpiksiJdd3njq3xZ9bfbROpr sY4FTRRXs1A6aXyyWrqtoxTN+W7YITAHuUKon0Bij7mjGZgoV1RqE5tcN8W81A== Date: Mon, 5 May 2025 19:07:46 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20250505170746.GD29660@pb2> References: <20250504153912.2944315-1-michael@niedermayer.cc> MIME-Version: 1.0 In-Reply-To: X-GND-State: clean X-GND-Score: -70 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvkeduieeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlhcuvffnffculdeftddmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfpihgvuggvrhhmrgihvghruceomhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtqeenucggtffrrghtthgvrhhnpeeigeektdejudffjefhteegjedtgeettefggedthfejgfevhfetgeekjedtvdfhveenucfkphepgedurdeiiedrieejrdduudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepgedurdeiiedrieejrdduudefpdhhvghloheplhhotggrlhhhohhsthdpmhgrihhlfhhrohhmpehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgdpnhgspghrtghpthhtohepuddprhgtphhtthhopehffhhmphgvghdquggvvhgvlhesfhhfmhhpvghgrdhorhhg X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH] libpostproc/tests: Factor ff_chksum() out 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="===============8532222568731754621==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============8532222568731754621== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="RYJh/3oyKhIjGcML" Content-Disposition: inline --RYJh/3oyKhIjGcML Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, May 05, 2025 at 02:50:35PM +0200, Andreas Rheinhardt wrote: > Michael Niedermayer: > > Signed-off-by: Michael Niedermayer > > --- > > libpostproc/Makefile | 6 ++++++ > > libpostproc/test_utils.c | 38 ++++++++++++++++++++++++++++++++++ > > libpostproc/test_utils.h | 27 ++++++++++++++++++++++++ > > libpostproc/tests/blocktest.c | 18 ++-------------- > > libpostproc/tests/stripetest.c | 18 ++-------------- > > libpostproc/tests/temptest.c | 18 ++-------------- > > 6 files changed, 77 insertions(+), 48 deletions(-) > > create mode 100644 libpostproc/test_utils.c > > create mode 100644 libpostproc/test_utils.h > >=20 > > diff --git a/libpostproc/Makefile b/libpostproc/Makefile > > index defd541e8bc..f75c9537944 100644 > > --- a/libpostproc/Makefile > > +++ b/libpostproc/Makefile > > @@ -9,9 +9,15 @@ HEADERS =3D postprocess.h \ > > OBJS =3D postprocess.o \ > > version.o \ > > =20 > > +TESTOBJS =3D test_utils.o \ > > + > > # Windows resource file > > SHLIBOBJS-$(HAVE_GNU_WINDRES) +=3D postprocres.o > > =20 > > TESTPROGS =3D blocktest \ > > stripetest \ > > temptest \ > > + > > +$(SUBDIR)tests/blocktest$(EXESUF): $(SUBDIR)test_utils.o > > +$(SUBDIR)tests/stripetest$(EXESUF): $(SUBDIR)test_utils.o > > +$(SUBDIR)tests/temptest$(EXESUF): $(SUBDIR)test_utils.o > > diff --git a/libpostproc/test_utils.c b/libpostproc/test_utils.c > > new file mode 100644 > > index 00000000000..bce0a112cce > > --- /dev/null > > +++ b/libpostproc/test_utils.c > > @@ -0,0 +1,38 @@ > > +/* > > + * Copyright (c) 2025 Michael Niedermayer > > + * > > + * This file is part of FFmpeg. > > + * > > + * FFmpeg is free software; you can redistribute it and/or > > + * modify it under the terms of the GNU Lesser General Public > > + * License as published by the Free Software Foundation; either > > + * version 2.1 of the License, or (at your option) any later version. > > + * > > + * FFmpeg is distributed in the hope that it will be useful, > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > > + * Lesser General Public License for more details. > > + * > > + * You should have received a copy of the GNU Lesser General Public > > + * License along with FFmpeg; if not, write to the Free Software > > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110= -1301 USA > > + */ > > + > > +#include "libavutil/frame.h" > > +#include "libavutil/adler32.h" > > +#include "libpostproc/test_utils.h" > > + > > +int64_t ff_chksum(AVFrame *f) > > +{ > > + AVAdler a =3D 123; > > + > > + for(int y=3D0; yheight; y++) { > > + a =3D av_adler32_update(a, &f->data[0][y*f->linesize[0]], f->w= idth); > > + } > > + for(int y=3D0; y<(f->height+1)/2; y++) { > > + a =3D av_adler32_update(a, &f->data[1][y*f->linesize[1]], (f->= width+1)/2); > > + a =3D av_adler32_update(a, &f->data[2][y*f->linesize[2]], (f->= width+1)/2); > > + } > > + > > + return a; > > +} > > diff --git a/libpostproc/test_utils.h b/libpostproc/test_utils.h > > new file mode 100644 > > index 00000000000..f79ec997a74 > > --- /dev/null > > +++ b/libpostproc/test_utils.h > > @@ -0,0 +1,27 @@ > > +/* > > + * Copyright (c) 2025 Michael Niedermayer > > + * > > + * This file is part of FFmpeg. > > + * > > + * FFmpeg is free software; you can redistribute it and/or > > + * modify it under the terms of the GNU Lesser General Public > > + * License as published by the Free Software Foundation; either > > + * version 2.1 of the License, or (at your option) any later version. > > + * > > + * FFmpeg is distributed in the hope that it will be useful, > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > > + * Lesser General Public License for more details. > > + * > > + * You should have received a copy of the GNU Lesser General Public > > + * License along with FFmpeg; if not, write to the Free Software > > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110= -1301 USA > > + */ > > + > > + > > +#ifndef POSTPROC_TEST_UTILS_H > > +#define POSTPROC_TEST_UTILS_H > > + > > +int64_t ff_chksum(AVFrame *f); > > + > > +#endif /* POSTPROC_TEST_UTILS_H */ > > diff --git a/libpostproc/tests/blocktest.c b/libpostproc/tests/blocktes= t.c > > index 5375d3c72b6..baba610c284 100644 > > --- a/libpostproc/tests/blocktest.c > > +++ b/libpostproc/tests/blocktest.c > > @@ -21,6 +21,7 @@ > > #include "libavutil/frame.h" > > #include "libavutil/adler32.h" > > #include "libpostproc/postprocess.h" > > +#include "libpostproc/test_utils.h" > > =20 > > typedef const uint8_t *cuint8; > > =20 > > @@ -39,21 +40,6 @@ static void blocks(AVFrame *frame, int blocksize, in= t mul) > > } > > } > > =20 > > -static int64_t chksum(AVFrame *f) > > -{ > > - AVAdler a =3D 123; > > - > > - for(int y=3D0; yheight; y++) { > > - a =3D av_adler32_update(a, &f->data[0][y*f->linesize[0]], f->w= idth); > > - } > > - for(int y=3D0; y<(f->height+1)/2; y++) { > > - a =3D av_adler32_update(a, &f->data[1][y*f->linesize[1]], (f->= width+1)/2); > > - a =3D av_adler32_update(a, &f->data[2][y*f->linesize[2]], (f->= width+1)/2); > > - } > > - > > - return a; > > -} > > - > > static int64_t test(int width, int height, const char * filter_string,= int blocksize, int flags, int pict_type, int quality) { > > AVFrame *in =3D av_frame_alloc(); > > AVFrame *out =3D av_frame_alloc(); > > @@ -90,7 +76,7 @@ static int64_t test(int width, int height, const char= * filter_string, int block > > width, height, qp, QP_STRIDE, > > mode, context, pict_type); > > =20 > > - ret =3D chksum(out); > > + ret =3D ff_chksum(out); > > end: > > av_frame_free(&in); > > av_frame_free(&out); > > diff --git a/libpostproc/tests/stripetest.c b/libpostproc/tests/stripet= est.c > > index be23934493f..ef92b22427a 100644 > > --- a/libpostproc/tests/stripetest.c > > +++ b/libpostproc/tests/stripetest.c > > @@ -21,6 +21,7 @@ > > #include "libavutil/frame.h" > > #include "libavutil/adler32.h" > > #include "libpostproc/postprocess.h" > > +#include "libpostproc/test_utils.h" > > =20 > > typedef const uint8_t *cuint8; > > =20 > > @@ -48,21 +49,6 @@ static void strips(AVFrame *frame, int mul) > > } > > } > > =20 > > -static int64_t chksum(AVFrame *f) > > -{ > > - AVAdler a =3D 123; > > - > > - for(int y=3D0; yheight; y++) { > > - a =3D av_adler32_update(a, &f->data[0][y*f->linesize[0]], f->w= idth); > > - } > > - for(int y=3D0; y<(f->height+1)/2; y++) { > > - a =3D av_adler32_update(a, &f->data[1][y*f->linesize[1]], (f->= width+1)/2); > > - a =3D av_adler32_update(a, &f->data[2][y*f->linesize[2]], (f->= width+1)/2); > > - } > > - > > - return a; > > -} > > - > > static int64_t test(int width, int height, const char *testname, int m= ul, int flags, int pict_type, int quality) { > > AVFrame *in =3D av_frame_alloc(); > > AVFrame *out =3D av_frame_alloc(); > > @@ -94,7 +80,7 @@ static int64_t test(int width, int height, const char= *testname, int mul, int fl > > width, height, NULL, 0, > > mode, context, pict_type); > > =20 > > - ret =3D chksum(out); > > + ret =3D ff_chksum(out); > > end: > > av_frame_free(&in); > > av_frame_free(&out); > > diff --git a/libpostproc/tests/temptest.c b/libpostproc/tests/temptest.c > > index 5396b0da44e..2ebd8fb1528 100644 > > --- a/libpostproc/tests/temptest.c > > +++ b/libpostproc/tests/temptest.c > > @@ -21,6 +21,7 @@ > > #include "libavutil/frame.h" > > #include "libavutil/adler32.h" > > #include "libpostproc/postprocess.h" > > +#include "libpostproc/test_utils.h" > > =20 > > typedef const uint8_t *cuint8; > > =20 > > @@ -41,21 +42,6 @@ static void stuff(AVFrame *frame, unsigned *state, i= nt mul) > > } > > } > > =20 > > -static int64_t chksum(AVFrame *f) > > -{ > > - AVAdler a =3D 123; > > - > > - for(int y=3D0; yheight; y++) { > > - a =3D av_adler32_update(a, &f->data[0][y*f->linesize[0]], f->w= idth); > > - } > > - for(int y=3D0; y<(f->height+1)/2; y++) { > > - a =3D av_adler32_update(a, &f->data[1][y*f->linesize[1]], (f->= width+1)/2); > > - a =3D av_adler32_update(a, &f->data[2][y*f->linesize[2]], (f->= width+1)/2); > > - } > > - > > - return a; > > -} > > - > > static int64_t test(int width, int height, const char *testname, int m= ul, int flags, int pict_type, int quality) { > > AVFrame *in =3D av_frame_alloc(); > > AVFrame *out =3D av_frame_alloc(); > > @@ -89,7 +75,7 @@ static int64_t test(int width, int height, const char= *testname, int mul, int fl > > width, height, NULL, 0, > > mode, context, pict_type); > > =20 > > - ret +=3D chksum(out); > > + ret +=3D ff_chksum(out); > > ret *=3D 1664525U; > > } > > end: >=20 > Why is this not in the tests subfolder? will apply with it moved to tests subfolder thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Homeopathy is like voting while filling the ballot out with transparent ink. Sometimes the outcome one wanted occurs. Rarely its worse than filling out a ballot properly. --RYJh/3oyKhIjGcML Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCaBjwVwAKCRBhHseHBAsP q8IRAKCafnvAAThh8btlzJSZw9H1NBZ4VACeINeun6cKzDmG/ms1HL6KRmJgJBo= =0lCp -----END PGP SIGNATURE----- --RYJh/3oyKhIjGcML-- --===============8532222568731754621== 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". --===============8532222568731754621==--