mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-05-28 01:52:27 -04:00
Implement FpFindContain function
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user