[FFmpeg-devel] [PATCH] libavfilter/signature_lookup: fix jaccard distance

Michael Niedermayer michael at niedermayer.cc
Fri Jun 7 13:19:13 EEST 2024


On Sun, Jun 02, 2024 at 02:02:53PM +0200, Gerion Entrup wrote:
> Actually, the jaccard distance is defined as D = 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) =~ 0.14.
> 
> Reported-by: Sachin Tilloo <sachin.tilloo at gmail.com>
> Reviewed-by: Sachin Tilloo <sachin.tilloo at gmail.com>
> Tested-by: Sachin Tilloo <sachin.tilloo at gmail.com>
> ---
> Sorry, it should apply clean now.
> 
>  libavfilter/signature_lookup.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

will apply

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20240607/d78b660c/attachment.sig>


More information about the ffmpeg-devel mailing list