Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pal rftbcfix #662

Merged
merged 3 commits into from
Oct 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lddecode/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1432,11 +1432,12 @@ def downscale_audio(
# The Field class contains common features used by NTSC and PAL
class Field:
def __init__(
self, rf, decode, audio_offset=0, keepraw=True, prevfield=None, initphase=False
self, rf, decode, audio_offset=0, keepraw=True, prevfield=None, initphase=False, readloc = 0
):
self.rawdata = decode["input"]
self.data = decode
self.initphase = initphase # used for seeking or first field
self.readloc = readloc

self.prevfield = prevfield

Expand Down Expand Up @@ -2494,15 +2495,13 @@ def rf_tbc(self, linelocs=None):
# Adjust for the demodulation/filtering delays
delay = self.rf.delays["video_white"]

# For output consistency reasons, linecount is set to 313 (i.e. 626 lines)
# in PAL mode. This needs to be corrected for RF TBC.
lc = self.linecount
if self.rf.system == "PAL" and not self.isFirstField:
lc = 312
# On PAL, always ignore self.lineoffset
startline = self.lineoffset if self.rf.system == 'NTSC' else 1
endline = startline + self.linecount

output = []

for l in range(self.lineoffset, self.lineoffset + lc):
for l in range(startline, endline):
scaled = scale(fdata, linelocs[l] - delay, linelocs[l + 1] - delay, linelen)
output.append(np.round(scaled).astype(np.int16))

Expand Down Expand Up @@ -3455,6 +3454,7 @@ def decodefield(self, initphase=False):
audio_offset=self.audio_offset,
prevfield=self.curfield,
initphase=initphase,
readloc = self.rawdecode['startloc']
)

try:
Expand Down