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 5ECF8408ED for ; Sun, 26 May 2024 17:26:33 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DE9C668D4F6; Sun, 26 May 2024 20:26:30 +0300 (EEST) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7C2F068D2FB for ; Sun, 26 May 2024 20:26:24 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id CB59DE0004 for ; Sun, 26 May 2024 17:26:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1716744384; 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=9gzEOIYI9fLiKh7b9e0CMzJ6kqPMZ055gpdeVGR2sFk=; b=Y2F6CBui4LF7jKgH3dWB1tALEmlXqYRdofOGzGHzdB7cqVcX9R6wpcsmiPCOUcwZvxFBPi PFG/FR9eUnV9zFuhG/KotHz6+kV8pHJmt0Hp6tRjiqnMDSK5JfN2sG/NCCsvHh8G8pUR05 sgc53lh9XrmEojTkkpHGi7wN07p4k6bFJgXUK07E0VVd2iwGv32xmrcxnLsWvRCJ4ehyO+ b1+Ilh5g0HiPpeoxsXuNjyXUGiUhLpLY/l0X578Q9I3aHW9ybEZbGwPByftQNI9yydSCGB lyATYkn2dn9+8WRXkfo7EXxGVJYU852Mt80q11UP7BDkZ8rlh1w7CHYNY5zTvw== Date: Sun, 26 May 2024 19:26:22 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20240526172622.GI2821752@pb2> References: <20240505223040.521838-1-gerion.entrup@flump.de> <2453178.Mh6RI2rZIc@falbala> <20240524210337.GB2821752@pb2> <2121645.atdPhlSkOF@falbala> MIME-Version: 1.0 In-Reply-To: <2121645.atdPhlSkOF@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="===============2926972814379027209==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============2926972814379027209== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="U5yJ31ax00IavOwq" Content-Disposition: inline --U5yJ31ax00IavOwq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, May 26, 2024 at 05:08:09PM +0200, Gerion Entrup wrote: > Am Freitag, 24. Mai 2024, 23:03:37 MESZ schrieb Michael Niedermayer: > > 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/signatu= re_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 =3D 0, cwthcount =3D 0; > > > > > for (i =3D 0; i < 5; i++) { > > > > > if ((jaccarddist =3D intersection_word(first->data[i], s= econd->data[i])) > 0) { > > > > > - jaccarddist /=3D union_word(first->data[i], second->= data[i]); > > > > > + jaccarddist /=3D FFMAX(union_word(first->data[i], se= cond->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 ar= e "or"ing > > > the course signatures. So, when the underlying videos are so differen= t 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). > >=20 > > the division only occurs if jaccarddist > 0 > >=20 > > 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 ? >=20 > Hmm, valid point. Then, this patch should be unnecessary. > Should I send 2/2 again without 1/2 then? I didnt compare the code to the specification but if its a bugfix then yes of course thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB During times of universal deceit, telling the truth becomes a revolutionary act. -- George Orwell --U5yJ31ax00IavOwq Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZlNwuAAKCRBhHseHBAsP q3NxAJ9RpVAQP6SNdAdEz0ALKRpD/ZWY1wCgg1lhac9XLHJu+GVo3RjlmBhQF2g= =FYRU -----END PGP SIGNATURE----- --U5yJ31ax00IavOwq-- --===============2926972814379027209== 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". --===============2926972814379027209==--