oyvindln/vhs-decode

fallback_vsync causing crash

Stefan-Olt opened this issue · 1 comments

I noticed a crash when the option "fallback_vsync" is used, seems there is an undefined variable in the function get_line0_fallback:

ERROR - please paste the following into a bug report:
current sample: 109891462.94704068
arguments: Namespace(infile='/home/stefan/in.u8', outfile='/home/stefan/vhsdec', AGC=False, system='NTSC', start=0, start_fileloc=-1, length=99999999, inputfreq=None, cxadc=False, cxadc3=False, cxadc_tenbit=False, cxadc3_tenbit=False, threads=24, chroma_trap=False, sharpness=0, notch=None, notch_q=10.0, pal=True, ntsc=False, palm=False, ntscj=False, debug=True, dodod=False, umatic=False, tape_format='VHS', params_file=None, level_adjust=0.1, high_boost=None, disable_diff_demod=False, disable_dc_offset=True, enable_dc_offset=False, nldeemp=False, y_comb=0, cafc=False, track_phase=None, recheck_phase=True, disable_comb=False, debug_plot=None, sync_clip=False, disable_right_hsync=False, level_detect_divisor=1, no_resample=True, fallback_vsync=True, saved_levels=False, nodod=False, dod_threshold_p=None, dod_threshold_a=None, dod_hysteresis=1.25)
Exception: name 'offset' is not defined  Traceback:
  File "/usr/local/lib/python3.10/dist-packages/vhsdecode/main.py", line 385, in main
    f = vhsd.readfield()
  File "/usr/local/lib/python3.10/dist-packages/vhsdecode/process.py", line 241, in readfield
    f, offset = self.decodefield(initphase=initphase)
  File "/usr/local/lib/python3.10/dist-packages/lddecode/core.py", line 3633, in decodefield
    raise e
  File "/usr/local/lib/python3.10/dist-packages/lddecode/core.py", line 3629, in decodefield
    lpf_wrapper()
  File "/usr/local/lib/python3.10/dist-packages/lddecode/core.py", line 3032, in process
    super(FieldPAL, self).process()
  File "/usr/local/lib/python3.10/dist-packages/lddecode/core.py", line 1510, in process
    self.linelocs1, self.linebad, self.nextfieldoffset = self.compute_linelocs()
  File "/usr/local/lib/python3.10/dist-packages/vhsdecode/field.py", line 501, in compute_linelocs
    line0loc_t, lastlineloc_t, is_first_field_t = self._get_line0_fallback(
  File "/usr/local/lib/python3.10/dist-packages/vhsdecode/field.py", line 373, in _get_line0_fallback
    res = get_line0_fallback(
  File "/usr/local/lib/python3.10/dist-packages/vhsdecode/field.py", line 244, in get_line0_fallback
    long_pulses[3][PULSE_START] - offset
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/vhsdecode/main.py", line 385, in main
    f = vhsd.readfield()
  File "/usr/local/lib/python3.10/dist-packages/vhsdecode/process.py", line 241, in readfield
    f, offset = self.decodefield(initphase=initphase)
  File "/usr/local/lib/python3.10/dist-packages/lddecode/core.py", line 3633, in decodefield
    raise e
  File "/usr/local/lib/python3.10/dist-packages/lddecode/core.py", line 3629, in decodefield
    lpf_wrapper()
  File "/usr/local/lib/python3.10/dist-packages/lddecode/core.py", line 3032, in process
    super(FieldPAL, self).process()
  File "/usr/local/lib/python3.10/dist-packages/lddecode/core.py", line 1510, in process
    self.linelocs1, self.linebad, self.nextfieldoffset = self.compute_linelocs()
  File "/usr/local/lib/python3.10/dist-packages/vhsdecode/field.py", line 501, in compute_linelocs
    line0loc_t, lastlineloc_t, is_first_field_t = self._get_line0_fallback(
  File "/usr/local/lib/python3.10/dist-packages/vhsdecode/field.py", line 373, in _get_line0_fallback
    res = get_line0_fallback(
  File "/usr/local/lib/python3.10/dist-packages/vhsdecode/field.py", line 244, in get_line0_fallback
    long_pulses[3][PULSE_START] - offset
NameError: name 'offset' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/vhsdecode/process.py", line 212, in build_json
    black = jout["videoParameters"]["black16bIre"]
TypeError: 'NoneType' object is not subscriptable

I uploaded a sample where this occurs to a private folder on the drive

Removing that offset variable also seems to work, checking rn and It seems to work ok

UPDATE: It really works! Not sure if a good solution, but at least it works.