mirror of
https://github.com/smittix/intercept.git
synced 2026-04-25 07:10:00 -07:00
fix: Correct Scottie SSTV image slant by resyncing to mid-line sync pulse
Scottie modes place their horizontal sync pulse between the Blue and Red channels. The decoder was using a fixed offset to skip over it, so any SDR clock error accumulated line-by-line and produced a visible diagonal slant in the decoded image. Fix: search for the actual 1200 Hz sync pulse in a ±10% window around the expected position before decoding the Red channel, then align to the real pulse. This resets accumulated clock drift on every scanline, the same way Martin and Robot modes already handle their front-of-line sync. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -234,8 +234,23 @@ class SSTVImageDecoder:
|
||||
# Scottie: separator between G and B
|
||||
pos += self._porch_samples
|
||||
else:
|
||||
# Scottie: sync + porch between B and R
|
||||
pos += self._sync_samples + self._porch_samples
|
||||
# Scottie: sync + porch between B and R.
|
||||
# Search for the actual sync pulse to correct for
|
||||
# SDR clock drift — without this, any timing error
|
||||
# accumulates line-by-line producing a visible slant.
|
||||
search_margin = max(100, self._line_samples // 10)
|
||||
sync_search_start = max(0, pos - search_margin)
|
||||
sync_search_end = min(
|
||||
len(self._buffer),
|
||||
pos + self._sync_samples + search_margin,
|
||||
)
|
||||
sync_region = self._buffer[sync_search_start:sync_search_end]
|
||||
sync_found = self._find_sync(sync_region)
|
||||
if sync_found is not None:
|
||||
pos = (sync_search_start + sync_found
|
||||
+ self._sync_samples + self._porch_samples)
|
||||
else:
|
||||
pos += self._sync_samples + self._porch_samples
|
||||
elif self._separator_samples > 0:
|
||||
# Robot: separator + porch between channels
|
||||
pos += self._separator_samples
|
||||
|
||||
Reference in New Issue
Block a user