Skip to content

Commit

Permalink
Merge pull request #457 from oyvindln/master
Browse files Browse the repository at this point in the history
Define the hsync tolerance in RFDecode class
  • Loading branch information
happycube committed Feb 7, 2020
2 parents 46851a7 + af8938d commit 7a2b24e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lddecode/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 7a2b24e

Please sign in to comment.