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

Rev7 #391

Merged
merged 35 commits into from
Dec 30, 2019
Merged

Rev7 #391

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
af61091
Correction to mistake in ld-decode Makefile
Dec 23, 2019
679ab8b
Add test-decode script for regression testing.
atsampson Dec 22, 2019
ff752ab
Add basic GitHub CI workflow.
atsampson Dec 22, 2019
915442d
Merge pull request #382 from atsampson/githubci
happycube Dec 23, 2019
0a583f7
Updated the rev7 readme
Dec 24, 2019
f7de3ab
Fix for #383 - ld-analyse now correctly displays early CLV timecodes
Dec 24, 2019
968e2c5
oops. this should make cx work.
happycube Dec 24, 2019
efb538c
Merge branch 'rev7' of github.com:happycube/ld-decode into rev7
happycube Dec 24, 2019
11fc168
fix #366, and add --start_fileloc option to (mostly) restart at the s…
happycube Dec 24, 2019
0c6aa5d
Fix #381
happycube Dec 24, 2019
18dd0f1
Update the .gitignore files.
atsampson Dec 25, 2019
84d9831
Move filtermaker and deemp.h out of the top level.
atsampson Dec 24, 2019
1049f1c
Make ld-decode into a Python package.
atsampson Dec 24, 2019
1111d14
Merge pull request #384 from atsampson/gitignore
happycube Dec 26, 2019
65a8138
Merge pull request #385 from atsampson/pypackage
happycube Dec 26, 2019
856f2c0
manually merge 1a1ce03
happycube Dec 26, 2019
3430e95
Don't install testfilter.
atsampson Dec 26, 2019
0a2a934
Configurable installation prefix for the tools.
atsampson Dec 26, 2019
e0c2787
Make the top-level Makefile build/install all of ld-decode.
atsampson Dec 26, 2019
e20a006
Merge pull request #387 from atsampson/topmakefile
Dec 27, 2019
438ec19
Minor bug fix to ld-process-efm to avoid errors decoding EFM data sec…
Dec 27, 2019
1c015f7
Removed QObject requirements from the TBC library + minor .pro file fix
Dec 28, 2019
ea8e0cc
fix karaoke disk with short front porch (1.25us instead of std 1.5) a…
happycube Dec 28, 2019
06cafbf
Merge branch 'rev7' of github.com:happycube/ld-decode into rev7
happycube Dec 28, 2019
8ff2cc1
squelch analogue bandpass on digital pal disks
happycube Dec 28, 2019
06e6c8f
on second thought, only do that if there's no analogue audio decoding
happycube Dec 28, 2019
2714150
ld-dropout-correct - added multi-source handling code - WIP
Dec 28, 2019
616a78b
experimental WibbleRemover(tm) for PAL/digital sound disks
happycube Dec 29, 2019
c124247
Merge branch 'rev7' of github.com:happycube/ld-decode into rev7
happycube Dec 29, 2019
a94c7da
ld-dropout-correct WIP - Modified thread-pool to accept QVectors as i…
Dec 29, 2019
f640a59
ld-dropout-correct WIP - Added VBI frame scanning and improved user i…
Dec 29, 2019
9b403be
ld-dropout-correct WIP - Added seq. frame to VBI mapping across avail…
Dec 29, 2019
713497d
Fill dummy fields correctly with black.
atsampson Dec 30, 2019
b5016ae
Construct dummy fields by resizing, rather than loading.
atsampson Dec 30, 2019
12b8944
Merge pull request #390 from atsampson/blackfields
Dec 30, 2019
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
78 changes: 78 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Tests

on:
push:
pull_request:
release:

jobs:
tests:
name: Build and test
runs-on: ubuntu-18.04
steps:

- uses: actions/checkout@v2

- uses: actions/checkout@v2
with:
repository: happycube/ld-decode-testdata
path: testdata

- name: Install dependencies
timeout-minutes: 10
run: |
sudo apt-get update
# This list is from: https://github.com/happycube/ld-decode/wiki/Installation
sudo apt-get install -y --no-install-recommends clang libopencv-dev libfann-dev python3-numpy python3-scipy python3-matplotlib git qt5-default libqwt-qt5-dev libfftw3-dev python3-tk python3-pandas python3-numba libavformat-dev libavcodec-dev libavutil-dev ffmpeg openssl pv

- name: Build
timeout-minutes: 15
run: make prefix=/usr

- name: Install
timeout-minutes: 5
run: make install prefix=/usr DESTDIR=/tmp/staging

- name: Run testfilter
timeout-minutes: 5
run: tools/library/filter/testfilter/testfilter

- name: Decode NTSC CAV
timeout-minutes: 10
run: |
scripts/test-decode \
--decoder mono --decoder ntsc2d --decoder ntsc3d \
--expect-frames 29 \
--expect-bpsnr 43.3 \
--expect-vbi 9151563,15925840,15925840 \
--expect-efm-samples 40572 \
testdata/ve-snw-cut.lds

- name: Decode NTSC CLV
timeout-minutes: 10
run: |
scripts/test-decode \
--expect-frames 4 \
--expect-bpsnr 37.6 \
--expect-vbi 9167913,15785241,15785241 \
testdata/issues/176/issue176.lds

- name: Decode PAL CAV
timeout-minutes: 10
run: |
scripts/test-decode --pal \
--decoder mono --decoder pal2d --decoder transform2d --decoder transform3d \
--expect-frames 4 \
--expect-bpsnr 40.6 \
--expect-vbi 9151527,16065688,16065688 \
--expect-efm-samples 5292 \
testdata/pal/jason-testpattern.lds

- name: Decode PAL CLV
timeout-minutes: 10
run: |
scripts/test-decode --pal --no-efm \
--expect-frames 9 \
--expect-bpsnr 31.8 \
--expect-vbi 0,8449774,8449774 \
testdata/pal/kagemusha-leadout-cbar.ldf
20 changes: 9 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
# Project executables generated by make
comb
comb-ntsc
comb-pal
cx
ntsc4
tbc-ntsc
tbc-pal
tbc-pal32
*.tbc
/ld-ldf-reader

# Odd Python stuff
numpy
scipy

# Some odd python thing
# Python build results
/MANIFEST
__pycache__
/build
/dist

# Prerequisites
*.d
Expand Down Expand Up @@ -53,7 +48,10 @@ __pycache__
*.out
*.app

# ld-decode data files
*.tbc
testout

# Profiling results
perf.data*
Benchfile*
/ld-ldf-reader
78 changes: 65 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,75 @@
# Makefile for the Software Decode of Laserdiscs project
### Top-level Makefile for ld-decode ###

# Note: Targets do not include auto-generated .h files, which means
# that make clean will not remove them.
TARGETS=cx ld-ldf-reader
# Prefix into which ld-decode will be installed.
# This must be set both at build and install time. If you're using a
# non-default directory here, make sure that Python knows to look in there for
# modules (e.g. by setting PYTHONPATH in your environment).
prefix ?= /usr/local

CFLAGS=-g -O2 -fno-omit-frame-pointer -march=native -Itools/library/filter
# Staging dir for building distribution packages.
# If you're building packages, it may make more sense to build the Python and
# Qt parts using your distribution's tools, rather than using this Makefile
# (but don't forget the helpers!).
DESTDIR =

all: $(TARGETS)
# Tools you might want to override
PYTHON3 ?= python3
QMAKE ?= qmake

clean:
rm -f $(TARGETS)
### Targets for users to invoke ###

install:
cp ld-ldf-reader /usr/local/bin
all: build-helpers build-python build-tools
install: install-helpers install-python install-tools
clean: clean-helpers clean-python clean-tools

deemp.h: filtermaker.py
python3 filtermaker.py > deemp.h
.PHONY: all build-helpers build-python build-tools
.PHONY: install install-helpers install-python install-tools
.PHONY: clean clean-helpers clean-python clean-tools

### Helper programs used by ld-decode ###

helpers = ld-ldf-reader

build-helpers: $(helpers)

ld-ldf-reader: ld-ldf-reader.c
clang -o ld-ldf-reader ld-ldf-reader.c -Wno-deprecated-declarations -lavcodec -lavutil -lavformat -O2
$(CC) -O2 -Wno-deprecated-declarations -o $@ $< -lavcodec -lavutil -lavformat

install-helpers:
install -d "$(DESTDIR)$(prefix)/bin"
install -m755 $(helpers) "$(DESTDIR)$(prefix)/bin"

clean-helpers:
rm -f $(helpers)

### Python modules and scripts ###

build-python:
$(PYTHON3) setup.py build

install-python:
if [ -z "$(DESTDIR)" ]; then \
$(PYTHON3) setup.py install --prefix="$(prefix)"; \
else \
$(PYTHON3) setup.py install --root="$(DESTDIR)" --prefix="$(prefix)"; \
fi

clean-python:
$(PYTHON3) setup.py clean -a

### Qt-based tools ###

build-tools:
cd tools && $(QMAKE) -recursive PREFIX="$(prefix)"
$(MAKE) -C tools

install-tools:
$(MAKE) -C tools install INSTALL_ROOT="$(DESTDIR)"

clean-tools:
$(MAKE) -C tools clean

### Generated files, not updated automatically ###

tools/library/filter/deemp.h: scripts/filtermaker
$(PYTHON3) scripts/filtermaker >$@
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
This is ld-decode rev6 - see https://github.com/happycube/ld-decode/wiki/Release-Highlights for more information.
# ld-decode - Revision 7
This is the GitHub repo for ld-decode revision 7. This is the development branch of the ld-decode project.

For more documentation check the wiki (here) on github:
Please note that, for general use, you should be using the master branch. Development branches can be updated at any time and may not work at all.

# Documentation
Documentation is available via the GitHub wiki. This includes installation and usage instructions. Start with the wiki if you have any questions. The wiki also includes details of the project's IRC channel and Facebook group. If you are intending on contributing, please join the IRC. For general questions use the Facebook group.

https://github.com/happycube/ld-decode/wiki

## *If in doubt - Read the Wiki!*

# Source code locations
The source is split roughly into three parts:

* ld-decode - The main python application responsible for decoding lds/ldf LaserDisc RF samples into tbc files (time-base corrected framed video)
* ld-decode-tools (under the tools/ directory) - The tool-chain for processing tbc files in various ways
* scripts (under the scripts/ directory) - Various scripts to assist with dev and decoding

5 changes: 2 additions & 3 deletions cx-expander.py → cx-expander
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!python3
#!/usr/bin/env python3

from datetime import datetime
import getopt
Expand All @@ -13,8 +13,7 @@
import scipy.signal as sps
import scipy.fftpack as fftpack

from lddutils import *
import lddecode_core as ldd
from lddecode.utils import *

'''

Expand Down
12 changes: 8 additions & 4 deletions ld-cut.py → ld-cut
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
import io
from io import BytesIO
import os
import signal
import sys
import argparse
import json
import traceback
import subprocess

from lddutils import *
import lddecode_core
from lddecode_core import *
from lddecode.core import *
from lddecode.utils import *

parser = argparse.ArgumentParser(description='Extracts a sample area from raw RF laserdisc captures')
parser.add_argument('infile', metavar='infile', type=str, help='source file')
Expand Down Expand Up @@ -54,8 +54,12 @@
makelds = True if outname[-3:] == 'lds' else False

system = 'PAL' if args.pal else 'NTSC'


# Wrap the LDdecode creation so that the signal handler is not taken by sub-threads,
# allowing SIGINT/control-C's to be handled cleanly
original_sigint_handler = signal.signal(signal.SIGINT, signal.SIG_IGN)
ldd = LDdecode(filename, None, loader, system=system, doDOD = False)
signal.signal(signal.SIGINT, original_sigint_handler)

if args.MTF is not None:
ldd.rf.mtf_mult = args.MTF
Expand Down
27 changes: 21 additions & 6 deletions ld-decode.py → ld-decode
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@
import io
from io import BytesIO
import os
import signal
import sys
import argparse
import json
import traceback

from lddutils import *
import lddecode_core
from lddecode_core import *
from lddecode.core import *
from lddecode.utils import *

options_epilog = """FREQ can be a bare number in MHz, or a number with one of the case-insensitive suffixes Hz, kHz, MHz, GHz, fSC (meaning NTSC) or fSCPAL."""
parser = argparse.ArgumentParser(description='Extracts audio and video from raw RF laserdisc captures', epilog=options_epilog)
parser.add_argument('infile', metavar='infile', type=str, help='source file')
parser.add_argument('outfile', metavar='outfile', type=str, help='base name for destination files')
parser.add_argument('-s', '--start', metavar='start', type=float, default=0, help='rough jump to frame n of capture (default is 0)')
parser.add_argument('--start_fileloc', metavar='start_fileloc', type=float, default=-1, help='jump to precise sample # in the file')
parser.add_argument('-S', '--seek', metavar='seek', type=int, default=-1, help='seek to frame n of capture')
#parser.add_argument('-E', '--end', metavar='end', type=int, default=-1, help='cutting: last frame')
parser.add_argument('-l', '--length', metavar='length', type=int, default = 110000, help='limit length to n frames')
Expand All @@ -35,6 +36,8 @@
parser.add_argument('--ignoreleadout', dest='ignoreleadout', action='store_true', default=False, help='continue decoding after lead-out seen')
parser.add_argument('--verboseVITS', dest='verboseVITS', action='store_true', default=False, help='Enable additional JSON fields')

parser.add_argument('--WibbleRemover', dest='WibbleRemover', action='store_true', default=False, help='PAL/digital sound: (try to) remove spurious ~8.5mhz signal')

parser.add_argument('-t', '--threads', metavar='threads', type=int, default=5, help='number of CPU threads to use')

parser.add_argument('-f', '--frequency', dest='inputfreq', metavar='FREQ', type=parse_frequency, default=None, help='RF sampling frequency in source file (default is 40MHz)')
Expand All @@ -54,16 +57,28 @@
print("ERROR: Can only be PAL or NTSC")
exit(1)

extra_options = {}
if args.WibbleRemover:
extra_options['WibbleRemover'] = True

try:
loader = make_loader(filename, args.inputfreq)
except ValueError as e:
print(e)
exit(1)

system = 'PAL' if args.pal else 'NTSC'

ldd = LDdecode(filename, outname, loader, analog_audio = 0 if args.daa else 44.100, digital_audio = not args.noefm, system=system, doDOD = not args.nodod, threads=args.threads)
ldd.roughseek(firstframe * 2)

# Wrap the LDdecode creation so that the signal handler is not taken by sub-threads,
# allowing SIGINT/control-C's to be handled cleanly
original_sigint_handler = signal.signal(signal.SIGINT, signal.SIG_IGN)
ldd = LDdecode(filename, outname, loader, analog_audio = 0 if args.daa else 44.100, digital_audio = not args.noefm, system=system, doDOD = not args.nodod, threads=args.threads, extra_options=extra_options)
signal.signal(signal.SIGINT, original_sigint_handler)

if args.start_fileloc != -1:
ldd.roughseek(args.start_fileloc, False)
else:
ldd.roughseek(firstframe * 2)

if system == 'NTSC' and not args.ntscj:
ldd.blackIRE = 7.5
Expand Down
12 changes: 12 additions & 0 deletions lddecode/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/python3
# Initialisation for the lddecode package.

__all__ = [
'commpy_filters',
'core',
'efm_pll',
'fdls',
'fft8',
'plot_utils',
'utils',
]
File renamed without changes.
Loading