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 779574789C for ; Fri, 24 May 2024 21:03:49 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9C4AA68D575; Sat, 25 May 2024 00:03:46 +0300 (EEST) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3263168CADF for ; Sat, 25 May 2024 00:03:39 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 5E0DB240003 for ; Fri, 24 May 2024 21:03:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1716584618; 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=dowoBSbfbQuvnOblnFecu9GPNLnfJL4CtFJF7u30ki0=; b=JbnoMBVh5YKk80vGUpFNzDipdYIltGwkvAXVBTMchAKkagU6qhZJLroJlzCMEvh60T9M2n LRd6jevyLKEeYdR8mQs3YMUZoCrI+HGIwdQOW2bDi1fE1UOc3J5+Fc9QHvXfy0zzug9GsW t/qEl9JkChQEBN79rsJ5uvtTfnK1jP8v+rNHO9zz/nVjaaqYQcpBZ5H9nn+eaFGHjgGLpB 89yVPI+iid4N/UTNdQxoygpS+iWJygpFjewO4p9we+l4y00VK+HTWDqYC4WkuzZpzu/pLT sQ3mTC07BU6OFCaR7hqGKjwsLLh3YXvN27U3E4mHuDbTlQWiB2F3bXkPWVNxqA== Date: Fri, 24 May 2024 23:03:37 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20240524210337.GB2821752@pb2> References: <20240505223040.521838-1-gerion.entrup@flump.de> <20240507174628.GF6420@pb2> <2453178.Mh6RI2rZIc@falbala> MIME-Version: 1.0 In-Reply-To: <2453178.Mh6RI2rZIc@falbala> X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH 1/2] libavfilter/signature_lookup: fix possible division by zero 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="===============8762536622576947383==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============8762536622576947383== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="X2rN3GNvz+yeh2G1" Content-Disposition: inline --X2rN3GNvz+yeh2G1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, May 24, 2024 at 12:33:11PM +0200, Gerion Entrup wrote: > Am Dienstag, 7. Mai 2024, 19:46:28 MESZ schrieb Michael Niedermayer: > > On Mon, May 06, 2024 at 12:30:39AM +0200, Gerion Entrup wrote: > > > --- > > > libavfilter/signature_lookup.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > >=20 > > > diff --git a/libavfilter/signature_lookup.c b/libavfilter/signature_l= ookup.c > > > index a0ca818a9b..b39a3e225b 100644 > > > --- a/libavfilter/signature_lookup.c > > > +++ b/libavfilter/signature_lookup.c > > > @@ -128,7 +128,7 @@ static int get_jaccarddist(SignatureContext *sc, = CoarseSignature *first, CoarseS > > > int jaccarddist, i, composdist =3D 0, cwthcount =3D 0; > > > for (i =3D 0; i < 5; i++) { > > > if ((jaccarddist =3D intersection_word(first->data[i], secon= d->data[i])) > 0) { > > > - jaccarddist /=3D union_word(first->data[i], second->data= [i]); > > > + jaccarddist /=3D FFMAX(union_word(first->data[i], second= ->data[i]), 1); > > > } > >=20 > > for which input data does this cause a division by 0 ? >=20 > Sorry for the late answer. I missed your mail somehow. > union_word counts the amount of one bits that are created when you are "o= r"ing > the course signatures. So, when the underlying videos are so different th= at all > bits of the created signatures are different, the "or"-operator will alwa= ys > return 0 and so also its sum (I have not tested this). the division only occurs if jaccarddist > 0 basically what iam asking is for which A and B do we have (A&B) !=3D 0 && (A|B) =3D=3D 0 or am i misreading the code ? thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Awnsering whenever a program halts or runs forever is On a turing machine, in general impossible (turings halting problem). On any real computer, always possible as a real computer has a finite number of states N, and will either halt in less than N cycles or never halt. --X2rN3GNvz+yeh2G1 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZlEApgAKCRBhHseHBAsP qypmAJ0UkGS2Z83DffrqWDEOriVDg0QerACePdTSBTQpfjKMzI+GVynXDaP1awY= =lnk4 -----END PGP SIGNATURE----- --X2rN3GNvz+yeh2G1-- --===============8762536622576947383== 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". --===============8762536622576947383==--