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 EBC9348C6E for ; Tue, 23 Jan 2024 20:09:50 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A294968CF3E; Tue, 23 Jan 2024 22:09:47 +0200 (EET) 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 4352668C14E for ; Tue, 23 Jan 2024 22:09:41 +0200 (EET) Received: by mail.gandi.net (Postfix) with ESMTPSA id 6D60F40008 for ; Tue, 23 Jan 2024 20:09:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1706040580; 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=J26o377W1vXCHOLVshZj5KJJOc19RlTEZJzYk5NhRW4=; b=W9mEbJtPDaRvCVntdG8iavmo5sNCPRFXAN1+ijqSvSwgEnS+UZtNB/4woBLZXwKF+xXOhW 7+aknxHvzoOo3xmwbfwa+tF76OBt8s+RDvpzrHQJicy2kTR9kMdYwjcNPWHlvgOLo4VXTI QEJ8rw1rb9zkP8accovoVQDJgmUmobC2HD0RBtQIFkD7Hgf5wLPTrmsuqaZbe812Ot1n9F D9MT1HZ365JBZvcQVV/nvtyidEKy/e5pET0Ps4UIPWyEovU/3g3RJQ+NZ7pTbX6Qq+MM9r qOeYh9JNHNZSjLdAwPTuww7oLvT6Z3D+a1SXqbdpLmf02CD6zDPXdbgOa8k40A== Date: Tue, 23 Jan 2024 21:09:39 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20240123200939.GE6420@pb2> References: <20231211164227.163BB4115B0@natalya.videolan.org> <20240123190704.GL1833374@pb2> <31822ef5-bd90-48be-84e4-c379a1672757@gmail.com> <20240123193332.GB6420@pb2> <3a290126-abc2-4c63-9913-a2a40b5abb6f@gmail.com> <20240123194933.GC6420@pb2> MIME-Version: 1.0 In-Reply-To: X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [FFmpeg-cvslog] checkasm: test for abs_pow34 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="===============1961476161996108258==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============1961476161996108258== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ZnpN70eih+TtwZsO" Content-Disposition: inline --ZnpN70eih+TtwZsO Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 23, 2024 at 04:52:07PM -0300, James Almer wrote: > On 1/23/2024 4:49 PM, Michael Niedermayer wrote: > > On Tue, Jan 23, 2024 at 04:40:46PM -0300, James Almer wrote: > > > On 1/23/2024 4:33 PM, Michael Niedermayer wrote: > > > > On Tue, Jan 23, 2024 at 04:17:22PM -0300, James Almer wrote: > > > > > On 1/23/2024 4:07 PM, Michael Niedermayer wrote: > > > > > > On Mon, Dec 11, 2023 at 04:42:26PM +0000, sunyuechi wrote: > > > > > > > ffmpeg | branch: master | sunyuechi |= Tue Nov 28 14:08:12 2023 +0800| [1c3620b2bbe73db9239fcf605e8f535b58f03b86]= | committer: R=E9mi Denis-Courmont > > > > > > >=20 > > > > > > > checkasm: test for abs_pow34 > > > > > > >=20 > > > > > > > Signed-off-by: R=E9mi Denis-Courmont > > > > > > >=20 > > > > > > > > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=3Dcommit;h= =3D1c3620b2bbe73db9239fcf605e8f535b58f03b86 > > > > > > > --- > > > > > > >=20 > > > > > > > tests/checkasm/Makefile | 1 + > > > > > > > tests/checkasm/aacencdsp.c | 70 +++++++++++++++++++++++++= +++++++++++++++++++++ > > > > > > > tests/checkasm/checkasm.c | 3 ++ > > > > > > > tests/checkasm/checkasm.h | 1 + > > > > > > > tests/fate/checkasm.mak | 3 +- > > > > > > > 5 files changed, 77 insertions(+), 1 deletion(-) > > > > > > [...] > > > > > > > +static void test_abs_pow34(AACEncContext *s) { > > > > > > > +#define BUF_SIZE 1024 > > > > > > > + LOCAL_ALIGNED_32(float, in, [BUF_SIZE]); > > > > > > > + > > > > > > > + declare_func(void, float *, const float *, int); > > > > > > > + > > > > > > > + randomize_float(in, BUF_SIZE); > > > > > > > + > > > > > > > + if (check_func(s->abs_pow34, "abs_pow34")) { > > > > > > > + LOCAL_ALIGNED_32(float, out, [BUF_SIZE]); > > > > > > > + LOCAL_ALIGNED_32(float, out2, [BUF_SIZE]); > > > > > > > + > > > > > > > + call_ref(out, in, BUF_SIZE); > > > > > > > + call_new(out2, in, BUF_SIZE); > > > > > > > + > > > > > > > + if (memcmp(out, out2, BUF_SIZE * sizeof(float)) !=3D= 0) > > > > > > > + fail(); > > > > > >=20 > > > > > > This is wrong if one of the functions is implemented in C > > > > > > C does not specify float to give bitexact results. Any equality= check with > > > > > > float thats expected to end in a reproduceable outcome is gener= ally wrong > > > > >=20 > > > > > Yes, that's why float_near_abs_eps_array() or float_near_ulp_arra= y() should > > > > > be used. > > > > >=20 > > > > > >=20 > > > > > > it also fails in practice > > > > > >=20 > > > > > > TEST checkasm-aacencdsp > > > > > > Test checkasm-aacencdsp failed. Look at tests/data/fate/checkas= m-aacencdsp.err for details. > > > > > > src/tests/Makefile:308: recipe for target 'fate-checkasm-aacenc= dsp' failed > > > > > > make: *** [fate-checkasm-aacencdsp] Error 1 > > > > > >=20 > > > > > > checkasm: using random seed 2523748868 > > > > > > SSE: > > > > > > abs_pow34_sse (aacencdsp.c:55) > > > > > > - aacencdsp.abs_pow34 [FAILED] > > > > > > checkasm: 1 of 1 tests have failed > > > > > > threads=3D1 > > > > > >=20 > > > > > > thats on plain simple x86-32 > > > > >=20 > > > > > Can you check if the following passes for x86-32? > > > > >=20 > > > > > > diff --git a/tests/checkasm/aacencdsp.c b/tests/checkasm/aacenc= dsp.c > > > > > > index 684c775862..7cc8a01158 100644 > > > > > > --- a/tests/checkasm/aacencdsp.c > > > > > > +++ b/tests/checkasm/aacencdsp.c > > > > > > @@ -19,6 +19,7 @@ > > > > > > */ > > > > > >=20 > > > > > > #include > > > > > > +#include > > > > > >=20 > > > > > > #include "libavutil/mem.h" > > > > > > #include "libavutil/mem_internal.h" > > > > > > @@ -51,7 +52,7 @@ static void test_abs_pow34(AACEncContext *s) { > > > > > > call_ref(out, in, BUF_SIZE); > > > > > > call_new(out2, in, BUF_SIZE); > > > > > >=20 > > > > > > - if (memcmp(out, out2, BUF_SIZE * sizeof(float)) !=3D 0) > > > > > > + if (!float_near_abs_eps_array(out, out2, FLT_EPSILON, = BUF_SIZE)) > > > > > > fail(); > > > > > >=20 > > > > > > bench_new(out, in, BUF_SIZE); > > > > >=20 > > > > > That target tends to be pretty picky about the epsilon value beca= use of the > > > > > 80 bits precision for floats. > > > >=20 > > > >=20 > > > > with float.h > > > >=20 > > > > float_near_abs_eps_array > > > >=20 > > > > Test checkasm-aacencdsp failed. Look at tests/data/fate/checkasm-aa= cencdsp.err for details. > > > > checkasm: using random seed 4097080137 > > > > test failed comparing 5.68635 with 5.68635 (abs diff=3D4.76837e-07 = with EPS=3D1.19209e-07) > > > > SSE: > > > > abs_pow34_sse (aacencdsp.c:56) > > > > - aacencdsp.abs_pow34 [FAILED] > > > > checkasm: 1 of 1 tests have failed > > > > threads=3D1 > > > > src/tests/Makefile:317: recipe for target 'fate-checkasm-aacencdsp'= failed > > > > make: *** [fate-checkasm-aacencdsp] Error 1 > > > >=20 > > > > if (!float_near_abs_eps_array(out, out2, FLT_EPSILON*10, BUF_SIZE)) > > > > works but feels wrong > > > >=20 > > > > this works too (only tested 100x on only x86-32 yet) > > > > if (!float_near_ulp_array(out, out2, 1, BUF_SIZE)) > > > >=20 > > > > thx > > >=20 > > > 1 is excessive. Some tests use an epsilon value like 0.005, so > > > FLT_EPSILON*10 is IMO fine. Or we could hardcode something like 0.000= 005 > > > instead if it passes. > >=20 > > 1 ULP is the smallest that works > > tested 100x on mips, arm, mingw32 now too > >=20 > > epsilon anything is IMHO wrong but iam happy to hear an argument why > > absolute is better than relative here (which is the difference bascially > > IIUC) > >=20 > > absolute is bad as the difference in what can be represented is relative > > to the values size and so a absolute check will inevitably be very loose > > on small values or will fail on large ones >=20 > My bad, didn't notice you suggested float_near_ulp_array() instead of > float_near_abs_eps_array(), and thought you were suggesting an epsilon of > 1.0 >=20 > Should be ok then. will apply thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope --ZnpN70eih+TtwZsO Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZbAdAwAKCRBhHseHBAsP qxiFAJ9QWQljCNeoWS8oF/QyLl6ExwNCNgCgmImK+dOVY26mJ0YqBfOJIzfkvBk= =HwxZ -----END PGP SIGNATURE----- --ZnpN70eih+TtwZsO-- --===============1961476161996108258== 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". --===============1961476161996108258==--