From d6f1581599b16c5e9b1286bb29388d73482e607a Mon Sep 17 00:00:00 2001 From: Chad Date: Sun, 5 Jan 2025 05:12:47 -0800 Subject: [PATCH 1/2] back off some frequencies, and automatically cover for missing levels later on --- lddecode/core.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/lddecode/core.py b/lddecode/core.py index 5b891c431..b3bd3aa55 100644 --- a/lddecode/core.py +++ b/lddecode/core.py @@ -39,8 +39,11 @@ # If not running Anaconda, we don't care that mkl doesn't exist. pass -# XXX: This is a hack so that logging is treated the same way in both this -# and ld-decode. Probably should just bring all logging in here... +# Uncomment (and add to) to get full traces of numpy warnings +#import warnings +#warnings.filterwarnings('error', "Mean of empty slice.") + +# This allows ld-decode to set up one logger for the entire program logger = None # If profiling is not enabled, make it a pass-through wrapper @@ -166,10 +169,10 @@ def calclinelen(SysParams, mult, mhz): "audio_notchorder": 2, "video_deemp": (120e-9, 320e-9), # This BPF is similar but not *quite* identical to what Pioneer did - "video_bpf_low": 3400000, + "video_bpf_low": 3700000, "video_bpf_high": 13800000, "video_bpf_order": 4, - # This can easily be pushed up to 4.5mhz or even a bit higher. + # This can easily be pushed up to 4.5mhz or even a bit higher on most disks. # A sharp 4.8-5.0 is probably the maximum before the audio carriers bleed into 0IRE. "video_lpf_freq": 4500000, # in mhz "video_lpf_order": 6, # butterworth filter order @@ -3567,7 +3570,14 @@ def detectLevels(self, field): sync_hzs.append(nb_median(field.data["video"]["demod_05"][lsa]) / adj) ire0_hzs.append(nb_median(field.data["video"]["demod_05"][lsb]) / adj) - return np.median(sync_hzs), np.median(ire0_hzs), np.mean(ire100_hzs) + # if any of the levels are missing, use the default levels + vsync_hz = self.rf.iretohz(self.rf.DecoderParams["vsync_ire"]) + + m_synchz = np.median(sync_hzs) if len(sync_hzs) else vsync_hz + m_ire0hz = np.median(ire0_hzs) if len(ire0_hzs) else self.rf.iretohz(0) + m_ire100hz = np.median(ire100_hzs) if len(ire100_hzs) else self.rf.iretohz(100) + + return m_synchz, m_ire0hz, m_ire100hz def AC3filter(self, rftbc): self.AC3Collector.add(rftbc) From 9a73d80e0c314e2a06ae8f0f1413c790a8e8d523 Mon Sep 17 00:00:00 2001 From: matt W10 Date: Tue, 7 Jan 2025 16:16:40 -0700 Subject: [PATCH 2/2] Bi-phase decoder will now differentiate between parse errors and black lines. If parse errors are known, it is possible to autofix them by studying the picture number cadence. --- tools/ld-process-vbi/biphasecode.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/ld-process-vbi/biphasecode.cpp b/tools/ld-process-vbi/biphasecode.cpp index 1868995e5..0558a1184 100644 --- a/tools/ld-process-vbi/biphasecode.cpp +++ b/tools/ld-process-vbi/biphasecode.cpp @@ -115,8 +115,16 @@ qint32 BiphaseCode::manchesterDecoder(const SourceVideo::Data &lineData, qint32 // We must have 24-bits if the decode was successful if (decodeCount != 24) { - if (decodeCount != 0) qDebug() << "BiphaseCode::manchesterDecoder(): Manchester decode failed! Got" << decodeCount << "bits, expected 24"; + result = 0; + + if (decodeCount != 0) { + qDebug() << "BiphaseCode::manchesterDecoder(): Manchester decode failed! Got" << decodeCount << "bits, expected 24"; + // -1 is a good choice to indicate a parse error because it does not conflict with 0 (black line) or >0 (successfully parsed data) + // differentiating between parse errors and black lines is useful because if parse errors are known, they can be autofixed by studying the surrounding picture number cadence + result = -1; + } + } return result;