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 32E264B272 for ; Fri, 31 May 2024 20:17:31 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4C2A268D5B4; Fri, 31 May 2024 23:17:29 +0300 (EEST) 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 A907468D56E for ; Fri, 31 May 2024 23:17:22 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 0089B40008 for ; Fri, 31 May 2024 20:17:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1717186642; 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=MImqH/1N6V5QeG+u1lf7jV9eXp1QWWR7NFOE9Ye+Bms=; b=W163uWZi/Yr4cgknste8uFTuAHsW75MLJyTwzrRNdR6QEcTDRLSRw65VsgVO6fXyIq3t1d 1CFFjd+HIFEUrV6J1XvGqDaXdieBqW51g3QrCgnKL5Bpo1kndTrm2wsYeu89O47pHqQg4t be7uGq+M6ugeVzJIXZOodQoqG0anXBi2re32fm0N2FnM1xyvEtC63rkqpe4bpDzVsujnni EjDTlmHqbyM1g1+F+Av/Pt8v6bPCex1QsaRf2OYpbHDxvYZuV2/rn1BFFHdV10KJhIrRps kHpBPJFOtGnJb1Vxmiq8IxRTnlpJn7qh3G/LS+lJbZsxIT49yd5afVjEd3d7wg== Date: Fri, 31 May 2024 22:17:21 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20240531201721.GO2821752@pb2> References: <20240529120607.517822-1-gerion.entrup@flump.de> MIME-Version: 1.0 In-Reply-To: <20240529120607.517822-1-gerion.entrup@flump.de> X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH] libavfilter/signature_lookup: fix jaccard distance 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="===============8632079227851903399==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============8632079227851903399== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="BQstn4t8nd6twlV3" Content-Disposition: inline --BQstn4t8nd6twlV3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 29, 2024 at 02:06:07PM +0200, Gerion Entrup wrote: > Actually, the jaccard distance is defined as D =3D 1 - intersect / union. > Additionally, the distance value is compared against a constant that > must be between 0 and 1, which is not the case here. Both facts together > has led to the fact, that the function always returned a matching course > signature. To leave the constant intact and to avoid floating point > computation, this commit multiplies with 1 << 16 making the constant > effectively 9000 / (1<<16) =3D~ 0.14. >=20 > Reported-by: Sachin Tilloo > Reviewed-by: Sachin Tilloo > Tested-by: Sachin Tilloo > --- > libavfilter/signature_lookup.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/libavfilter/signature_lookup.c b/libavfilter/signature_looku= p.c > index b39a3e225b..b90b63f3f2 100644 > --- a/libavfilter/signature_lookup.c > +++ b/libavfilter/signature_lookup.c > @@ -127,9 +127,10 @@ static int get_jaccarddist(SignatureContext *sc, Coa= rseSignature *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], second->d= ata[i])) > 0) { > + if ((jaccarddist =3D (1 << 16) * intersection_word(first->data[i= ], second->data[i])) > 0) { > jaccarddist /=3D FFMAX(union_word(first->data[i], second->da= ta[i]), 1); > } > + jaccarddist =3D (1 << 16) - jaccarddist; > if (jaccarddist >=3D sc->thworddist) { > if (++cwthcount > 2) { > /* more than half (5/2) of distances are too wide */ this seems not to apply, maybe iam missing something ? Applying: libavfilter/signature_lookup: fix jaccard distance Using index info to reconstruct a base tree... M libavfilter/signature_lookup.c Falling back to patching base and 3-way merge... Auto-merging libavfilter/signature_lookup.c CONFLICT (content): Merge conflict in libavfilter/signature_lookup.c error: Failed to merge in the changes. [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Homeopathy is like voting while filling the ballot out with transparent ink. Sometimes the outcome one wanted occurs. Rarely its worse than filling out a ballot properly. --BQstn4t8nd6twlV3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZlowUAAKCRBhHseHBAsP q9+/AJwLQeWpHQ84bynbMifdE5cRjeTomQCdFNGufDOI/+1zhWXzJhhO30V9kd4= =ew/T -----END PGP SIGNATURE----- --BQstn4t8nd6twlV3-- --===============8632079227851903399== 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". --===============8632079227851903399==--