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 54D3C48DB7 for ; Sun, 26 May 2024 15:08:24 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 75C1C68D552; Sun, 26 May 2024 18:08:21 +0300 (EEST) Received: from flump.de (flump.de [185.163.118.210]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6635F68D2A7 for ; Sun, 26 May 2024 18:08:14 +0300 (EEST) Received: from falbala.localnet (ip4d1692dd.dynamic.kabel-deutschland.de [77.22.146.221]) by flump.de (Postfix) with ESMTPSA id 955B7EE1E71 for ; Sun, 26 May 2024 17:08:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=flump.de; s=mail; t=1716736093; bh=XBh4xy8gQ8ycoHpVhiez1AuOEUuAu+hehN689gK7oa8=; h=From:To:Subject:Date:In-Reply-To:References; b=tnb+e32gPao9iNRZIXIEw7H80852Oty4VL2OestRXoJwXci0nnzgY6dOMMI7KFR6S 3OYTh1JdLByrHoFL/K7farwS31XZ/gisAMTBtu8gHykg42j/YCzzBx9jcr80o6YjCK VxU1fBNag801A/JTMafOg9zNloPcIhFjUTlFuR2Q= From: Gerion Entrup To: FFmpeg development discussions and patches Date: Sun, 26 May 2024 17:08:09 +0200 Message-ID: <2121645.atdPhlSkOF@falbala> In-Reply-To: <20240524210337.GB2821752@pb2> References: <20240505223040.521838-1-gerion.entrup@flump.de> <2453178.Mh6RI2rZIc@falbala> <20240524210337.GB2821752@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="===============3672921661111683982==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============3672921661111683982== Content-Type: multipart/signed; boundary="nextPart46661978.fMDQidcC6G"; micalg="pgp-sha256"; protocol="application/pgp-signature" --nextPart46661978.fMDQidcC6G Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8"; protected-headers="v1" From: Gerion Entrup Date: Sun, 26 May 2024 17:08:09 +0200 Message-ID: <2121645.atdPhlSkOF@falbala> In-Reply-To: <20240524210337.GB2821752@pb2> MIME-Version: 1.0 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(-) > > > > > > > > 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). > > the division only occurs if jaccarddist > 0 > > basically what iam asking is for which A and B do we have > (A&B) != 0 && (A|B) == 0 > or am i misreading the code ? Hmm, valid point. Then, this patch should be unnecessary. Should I send 2/2 again without 1/2 then? Gerion --nextPart46661978.fMDQidcC6G 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/tVN9WpYYHnPZHxloeAdSYJHeoFAmZTUFkACgkQloeAdSYJ HeptQgv/YQTwXvmtJGwDaICSxh4TDA/L3kWvjP2t5jbyvJtl3m8Q0o/ZVF3nfoQp tzsbfsN8DJIpIq5sMBllBEHOralw0oeezryjJqUuLkjjVMCO8Tmzbms4i/8ttp7r SyxKAOkElGy2CC0oFdQvXWU+IFf++8vyXSoduaH5crR/qXnjCRAmBMkK2N1dIb4W D+970JNRJIdE2tKjeros0w7durkwlVGM6DHfO6od2LlNVIKB65SI7HaFDysLvY+e 72sshX1Um8UVvmjUSqL46gjknl6V943k90k2Z/pXcziVKzOa3h+TN3IxvpToT1Ma d1vu+gjcsxrL0S60pxGVvCQeVeLBRqjbrGoC8iZVuJceY3kSubeLzeDHW4I0+Mb8 R40K5TQuevLe332mlAOCxSL5CSeSdS+05N7TS4qA01+2jBxeWCpmJGiqjeRp4g4d ckYkFBsaTJYB8a4+OK6fBcuky4yeja4VDMfePR7OIvrpRaMU1uH6sR7XC0tDjBOm b2CLuXrz =QNa1 -----END PGP SIGNATURE----- --nextPart46661978.fMDQidcC6G-- --===============3672921661111683982== 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". --===============3672921661111683982==--