Skip to content

Commit

Permalink
Fix #713 by sanity checking VSYNC IRE detection
Browse files Browse the repository at this point in the history
  • Loading branch information
happycube committed Dec 21, 2022
1 parent 734336b commit f9a778e
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions lddecode/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3665,13 +3665,21 @@ def readfield(self, initphase=False):
acceptable_diff = 2 if self.fields_written else 0.5

if max((whitediff, ire0_diff, sync_ire_diff)) > acceptable_diff:
redo = True

self.rf.DecoderParams["ire0"] = ire0_hz
# Note that vsync_ire is a negative number, so (sync_hz - ire0_hz) is correct
self.rf.DecoderParams["hz_ire"] = (ire100_hz - ire0_hz) / 100
self.rf.DecoderParams["vsync_ire"] = (sync_hz - ire0_hz) / self.rf.DecoderParams["hz_ire"]
#print(self.rf.DecoderParams["ire0"], self.rf.DecoderParams["hz_ire"], self.rf.DecoderParams["vsync_ire"])
hz_ire = (ire100_hz - ire0_hz) / 100
vsync_ire = (sync_hz - ire0_hz) / hz_ire

if vsync_ire > -20:
logger.warning(
"At field #{0}, Auto-level detection malfunction (vsync IRE computed at {1}, nominal ~= -40), possible disk skipping".format(
len(self.fieldinfo), np.round(vsync_ire, 2)
))
else:
redo = True

self.rf.DecoderParams["ire0"] = ire0_hz
# Note that vsync_ire is a negative number, so (sync_hz - ire0_hz) is correct
self.rf.DecoderParams["hz_ire"] = hz_ire
self.rf.DecoderParams["vsync_ire"] = vsync_ire

if adjusted is False and redo is True:
self.demodcache.flush_demod()
Expand Down

0 comments on commit f9a778e

Please sign in to comment.