Skip to content

Commit

Permalink
don't do partial cache flushes
Browse files Browse the repository at this point in the history
  • Loading branch information
happycube committed Feb 1, 2025
1 parent ba3eb4f commit e648c8e
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions lddecode/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,11 +549,17 @@ def computevideofilters(self):

# additional filters: 0.5mhz and color burst
# Using an FIR filter here to get a known delay

F0_5 = sps.firwin(65, [0.5 / self.freq_half], pass_zero=True)
SF["F05_offset"] = 32 # Reduced because filtfft is half-strength on FIR
F0_5_fft = filtfft((F0_5, [1.0]), self.blocklen)
SF["FVideo05"] = SF["Fvideo_lpf"] * SF["Fdeemp"] * F0_5_fft

Fburst = sps.firwin(65, self.notchrange(SP["fsc_mhz"], 0.1), pass_zero=False)
SF["F05_offset"] = 32 # Reduced because filtfft is half-strength on FIR
SF["Fburst"] = filtfft((Fburst, [1.0]), self.blocklen)
SF["FVideoBurst"] = SF["Fvideo_lpf"] * SF["Fdeemp"] * SF["Fburst"]

SF["Fburst"] = filtfft(
sps.butter(1, self.notchrange(SP["fsc_mhz"], 0.1), "bandpass"),
self.blocklen,
Expand Down Expand Up @@ -1094,7 +1100,7 @@ def doread(self, blocknums, MTF, redo=False, prefetch=False):

with self.lock:
if redo:
for b in self.flush_demod(blocknums):
for b in self.flush_demod():
queuelist.append(b)

for b in blocknums:
Expand Down Expand Up @@ -1148,14 +1154,11 @@ def doread(self, blocknums, MTF, redo=False, prefetch=False):
self.q_out_event.clear()
return None if reached_end else need_blocks

def flush_demod(self, blocknums):
def flush_demod(self):
""" Flush all demodulation data. This is called by the field class after calibration (i.e. MTF) is determined to be off """
blocks_toredo = []

for k in self.blocks.keys():
if k not in blocknums:
continue

self.blocks[k]['MTF'] = -1
self.blocks[k]['request'] = -1
self.blocks[k]['waiting'] = False
Expand Down Expand Up @@ -2862,7 +2865,7 @@ def compute_line_bursts(self, linelocs, _line, prev_phaseadjust=0):
return None, None

burstarea = burstarea - nb_mean(burstarea)
threshold = 5 * self.rf.DecoderParams["hz_ire"]
threshold = rms(burstarea)

burstarea_demod = self.data["video"]["demod"][s + bstart : s + bend]
burstarea_demod = burstarea_demod - nb_mean(burstarea_demod)
Expand Down Expand Up @@ -3652,7 +3655,7 @@ def decodefield(self, start, mtf_level, prevfield=None, initphase=False, redo=Fa
if rawdecode is None:
# logger.info("Failed to demodulate data")
return None, None

f = self.FieldClass(
self.rf,
rawdecode,
Expand Down

0 comments on commit e648c8e

Please sign in to comment.