From f41d036d45b7a14fd6213bd35898d318da42e4fc Mon Sep 17 00:00:00 2001 From: suxianbaozi <12qiushi@163.com> Date: Tue, 4 Mar 2014 16:44:35 +0800 Subject: [PATCH] fix #39 Make the two point for hash with little delta of time --- dejavu/fingerprint.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dejavu/fingerprint.py b/dejavu/fingerprint.py index ab5592d..e9d72f2 100755 --- a/dejavu/fingerprint.py +++ b/dejavu/fingerprint.py @@ -18,7 +18,7 @@ DEFAULT_FAN_VALUE = 15 DEFAULT_AMP_MIN = 10 PEAK_NEIGHBORHOOD_SIZE = 20 MIN_HASH_TIME_DELTA = 0 - +MAX_HASH_TIME_DELTA = 200 def fingerprint(channel_samples, Fs=DEFAULT_FS, wsize=DEFAULT_WINDOW_SIZE, @@ -108,7 +108,7 @@ def generate_hashes(peaks, fan_value=DEFAULT_FAN_VALUE): t_delta = t2 - t1 - if t_delta >= MIN_HASH_TIME_DELTA: + if t_delta >= MIN_HASH_TIME_DELTA and t_delta <= MAX_HASH_TIME_DELTA: h = hashlib.sha1( "%s|%s|%s" % (str(freq1), str(freq2), str(t_delta)) )