Implement FpFindContain function

This commit is contained in:
Zoe Roux
2026-04-14 23:06:49 +02:00
parent 3874ff7238
commit 841212de52
+16 -1
View File
@@ -230,5 +230,20 @@ func FpFindOverlap(fp1 []uint32, fp2 []uint32) ([]Overlap, error) {
}
func FpFindContain(haystack []uint32, needle []uint32) (*Match, error) {
return nil, nil
offset := findBestOffset(haystack, needle)
if offset == nil || *offset < 0 || *offset+len(needle) < len(haystack) {
return nil, nil
}
corr := segmentCorrelation(haystack[*offset:*offset+len(needle)], needle)
if corr < MatchThreshold {
return nil, nil
}
accuracy := min(int(corr*100), 100)
return &Match{
Start: samplesToSec(*offset),
Duration: samplesToSec(len(needle)),
Accuracy: accuracy,
}, nil
}