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 7EA044AF41 for ; Fri, 24 May 2024 10:33:24 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 691C268D536; Fri, 24 May 2024 13:33:22 +0300 (EEST) Received: from flump.de (flump.de [185.163.118.210]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4DDB168D199 for ; Fri, 24 May 2024 13:33:15 +0300 (EEST) Received: from falbala.localnet (ip4d1692dd.dynamic.kabel-deutschland.de [77.22.146.221]) by flump.de (Postfix) with ESMTPSA id C4F4BECF8CE for ; Fri, 24 May 2024 12:33:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=flump.de; s=mail; t=1716546794; bh=tVzZ6iD2QO7YgHpZSlbERypaAWaztwbho6c1U19bSVg=; h=From:To:Subject:Date:In-Reply-To:References; b=3W5DOsid6nQTqe3DgvK1Y/8eG2oRhJzWCu/gGSa5l94BaOdCzoYXmBGrr1zd2errO cestSgpVN7ibywh2tYpXbBY/Rrfhnkgc4W/QDkCA4BVGZ56VPras8BHRvj35ut5aKl C/+NL2SansYU6fii1YObx+gmP15n2YQsjv2DAFvI= From: Gerion Entrup To: FFmpeg development discussions and patches Date: Fri, 24 May 2024 12:33:11 +0200 Message-ID: <2453178.Mh6RI2rZIc@falbala> In-Reply-To: <20240507174628.GF6420@pb2> References: <20240505223040.521838-1-gerion.entrup@flump.de> <20240507174628.GF6420@pb2> MIME-Version: 1.0 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="===============0884105670968167847==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============0884105670968167847== Content-Type: multipart/signed; boundary="nextPart3885112.R56niFO833"; micalg="pgp-sha256"; protocol="application/pgp-signature" --nextPart3885112.R56niFO833 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8"; protected-headers="v1" From: Gerion Entrup Date: Fri, 24 May 2024 12:33:11 +0200 Message-ID: <2453178.Mh6RI2rZIc@falbala> In-Reply-To: <20240507174628.GF6420@pb2> MIME-Version: 1.0 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(-) > > > > diff --git a/libavfilter/signature_lookup.c b/libavfilter/signature_lookup.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 = 0, cwthcount = 0; > > for (i = 0; i < 5; i++) { > > if ((jaccarddist = intersection_word(first->data[i], second->data[i])) > 0) { > > - jaccarddist /= union_word(first->data[i], second->data[i]); > > + jaccarddist /= FFMAX(union_word(first->data[i], second->data[i]), 1); > > } > > for which input data does this cause a division by 0 ? Sorry for the late answer. I missed your mail somehow. union_word counts the amount of one bits that are created when you are "or"ing the course signatures. So, when the underlying videos are so different that all bits of the created signatures are different, the "or"-operator will always return 0 and so also its sum (I have not tested this). Gerion --nextPart3885112.R56niFO833 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQGzBAABCAAdFiEEM/tVN9WpYYHnPZHxloeAdSYJHeoFAmZQbOcACgkQloeAdSYJ HerKnQv/euJTgLOriQMRaR+JxDWS94ZBxteQbrmLwGJ3/8v0JNrUNHJ7T3KPV0Zt 577kNbD5HYzrx0sS8ZeXQwhoL61BK+1xGJGmODsHtG1z3ZWDoJj6ooGc5JSTfLRJ lTgLnDpOmA14f8fWePn3fJV9H0R3xjkgX2Eha51MhxUHbyBg1z0VWTlYbiABFyZV BQwEzgciw9tquryeGWezB9ZF5wTesLfZxlh6DzrrKWYlqWktD63M1kSMWCK+BdrI ImPU237uMFaHIfDSLCZMUUNRP888jJPnDl1ZR41qxAsl31uDuPQqmaCVO7/1Jniv kfR2zEoBLScqwdtRzXIcFJnLrqRuzQUEe9pSW5Hl303TA6M0NzNuwEEDGy0YJdDG NIZNDNzrDzY0vu0cEKJDcsPX5iV7cQ3E4mOEA56Yttdbzcs8oFXcjSImSAXsdIU6 lGnRTVhbjkSzQkkgwmwdi4XU8A3jt9UMa+xRJTBqQ4z1QTffZDDGQpFOYneEliAu 2vxLmOif =qWOT -----END PGP SIGNATURE----- --nextPart3885112.R56niFO833-- --===============0884105670968167847== 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". --===============0884105670968167847==--