oyvindln / vhs-decode

Software defined VHS decoder - Fork (maybe temporary) of the ld-decode Laserdisc rf decoder
GNU General Public License v3.0
1.1k stars 43 forks source link

Crash in valid_pulses_to_linelocs #169

Open philpem opened 1 week ago

philpem commented 1 week ago

Checklist

Bug Description

When processing video input, since the fix for #167, processing crashes with a traceback. An incomplete TBC file is saved.

Steps to Reproduce

  1. Process recorded CVBS data from CXADC, attached.

badger.zip

Expected Behaviour

Complete TBC file produced.

Actual Behaviour

CVBS-Decode crashes, producing the following traceback:

$ cvbs-decode --overwrite --pal -A --cxadc badger.u8 badger

Missing data at the end of field, possibly dropped samples skipping a little.               
File Frame 11: CAV Pulldown/Telecine Frame                                                  
At field #23, Field phaseID sequence mismatch (8->4) (player may be paused)                 
File Frame 14: CAV Pulldown/Telecine Frame                                      
At field #28, Field phaseID sequence mismatch (8->5) (player may be paused)                 
Exception in thread Thread-70 (decodefield):                                                
Traceback (most recent call last):                                                          
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner                   
    self.run()                     
  File "/usr/lib/python3.10/threading.py", line 953, in run                                 
    self._target(*self._args, **self._kwargs)                                                                                                                                             File "/home/philpem/.local/pipx/venvs/vhs-decode/lib/python3.10/site-packages/lddecode/core.py", line 3674, in decodefield                                                            
    raise e                                                                                 
  File "/home/philpem/.local/pipx/venvs/vhs-decode/lib/python3.10/site-packages/lddecode/core.py", line 3670, in decodefield                                                            
    lpf_wrapper()       
  File "/home/philpem/.local/pipx/venvs/vhs-decode/lib/python3.10/site-packages/lddecode/core.py", line 3055, in process                                                                
    super(FieldPAL, self).process()
  File "/home/philpem/.local/pipx/venvs/vhs-decode/lib/python3.10/site-packages/lddecode/core.py", line 1491, in process                                                                
    self.linelocs1, self.linebad, self.nextfieldoffset = self.compute_linelocs()            
  File "/home/philpem/.local/pipx/venvs/vhs-decode/lib/python3.10/site-packages/cvbsdecode/process.py", line 69, in compute_linelocs                                                    
    linelocs_dict, _ = sync.valid_pulses_to_linelocs(                                       
  File "vhsdecode/sync.pyx", line 146, in vhsdecode.sync.valid_pulses_to_linelocs           
TypeError: an integer is required
saving JSON and exiting 
Exception in thread Thread-71 (decodefield):
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner                   
    self.run()                                                                                                                                                                          
  File "/usr/lib/python3.10/threading.py", line 953, in run                                 
    self._target(*self._args, **self._kwargs)                                               
  File "/home/philpem/.local/pipx/venvs/vhs-decode/lib/python3.10/site-packages/lddecode/core.py", line 3674, in decodefield                                                            
    raise e                                                                                                                                                                             
  File "/home/philpem/.local/pipx/venvs/vhs-decode/lib/python3.10/site-packages/lddecode/core.py", line 3670, in decodefield                                                            
    lpf_wrapper()                                                                           
  File "/home/philpem/.local/pipx/venvs/vhs-decode/lib/python3.10/site-packages/lddecode/core.py", line 3055, in process                                                                
    super(FieldPAL, self).process()                                                                                                                                                       File "/home/philpem/.local/pipx/venvs/vhs-decode/lib/python3.10/site-packages/lddecode/core.py", line 1491, in process                                                                
    self.linelocs1, self.linebad, self.nextfieldoffset = self.compute_linelocs()            
  File "/home/philpem/.local/pipx/venvs/vhs-decode/lib/python3.10/site-packages/cvbsdecode/process.py", line 69, in compute_linelocs                                                    
    linelocs_dict, _ = sync.valid_pulses_to_linelocs(                                                                                                                                   
  File "vhsdecode/sync.pyx", line 146, in vhsdecode.sync.valid_pulses_to_linelocs           
TypeError: an integer is required

Environment

philpem commented 1 week ago

I chucked a print() in here, and the specific issue is that lastlineloc is None, which causes the crash.

oyvindln commented 5 days ago

THink 4b3d2eb should fix it