From af8938d49eeae17a4f9b915a1d9d420133c076d9 Mon Sep 17 00:00:00 2001 From: oyvindln Date: Thu, 6 Feb 2020 19:48:59 +0100 Subject: [PATCH] Define the hsync tolerance in RFDecode class as variable rather than magic number in code --- lddecode/core.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lddecode/core.py b/lddecode/core.py index f7664f8ad..604050a8a 100644 --- a/lddecode/core.py +++ b/lddecode/core.py @@ -331,6 +331,11 @@ def __init__(self, inputfreq = 40, system = 'NTSC', blocklen = 32*1024, decode_d linelen = self.freq_hz/(1000000.0/self.SysParams['line_period']) self.linelen = int(np.round(linelen)) + # How much horizontal sync position can deviate from previous/expected position + #and still be interpreted as a horizontal sync pulse. + # Too high tolerance may result in false positive sync pulses, too low may end up missing them. + # Tapes will need a wider tolerance than laserdiscs due to head switch etc. + self.hsync_tolerance = .4 self.decode_digital_audio = decode_digital_audio self.decode_analog_audio = decode_analog_audio @@ -1656,7 +1661,7 @@ def compute_linelocs(self): #print(p, lineloc, rlineloc, lineloc_distance) # only record if it's closer to the (probable) beginning of the line - if lineloc_distance > .4 or (rlineloc in linelocs_dict and lineloc_distance > linelocs_dist[rlineloc]): + if lineloc_distance > self.rf.hsync_tolerance or (rlineloc in linelocs_dict and lineloc_distance > linelocs_dist[rlineloc]): #print(rlineloc, p, 'reject') continue