Skip to content

Commit

Permalink
Merge pull request #385 from atsampson/pypackage
Browse files Browse the repository at this point in the history
Make ld-decode into a Python package
  • Loading branch information
happycube committed Dec 26, 2019
2 parents 1111d14 + 1049f1c commit 65a8138
Show file tree
Hide file tree
Showing 22 changed files with 71 additions and 30 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
numpy
scipy

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

# Prerequisites
*.d
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ clean:
install:
cp ld-ldf-reader /usr/local/bin

deemp.h: filtermaker.py
python3 filtermaker.py > deemp.h
tools/library/filter/deemp.h: scripts/filtermaker
python3 scripts/filtermaker >$@

ld-ldf-reader: ld-ldf-reader.c
clang -o ld-ldf-reader ld-ldf-reader.c -Wno-deprecated-declarations -lavcodec -lavutil -lavformat -O2
Expand Down
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
5 changes: 2 additions & 3 deletions ld-cut.py → ld-cut
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
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
5 changes: 2 additions & 3 deletions ld-decode.py → ld-decode
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
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)
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.
7 changes: 2 additions & 5 deletions lddecode_core.py → lddecode/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,8 @@
import numpy.fft as npfft

#internal libraries
import commpy_filters

import fdls
import efm_pll
from lddutils import *
from lddecode import efm_pll
from lddecode.utils import *

try:
# If Anaconda's numpy is installed, mkl will use all threads for fft etc
Expand Down
File renamed without changes.
File renamed without changes.
0 fft8.py → lddecode/fft8.py
100755 → 100644
File renamed without changes.
2 changes: 0 additions & 2 deletions ld_utils.py → lddecode/plot_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
import scipy.signal as sps
import sys

import fdls as fdls
import matplotlib.pyplot as plt
import fft8 as fft8

pi = np.pi
tau = np.pi * 2
Expand Down
3 changes: 0 additions & 3 deletions lddutils.py → lddecode/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
import matplotlib
import matplotlib.pyplot as plt

#internal libraries which may or may not get used
import fdls

def todb(y, zero = False):
db = 20 * np.log10(np.abs(y))
if zero:
Expand Down
2 changes: 1 addition & 1 deletion scripts/decode-ralf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ralf includes a bit of extra data on each side - will be useful for seeking and limits later
python3 ld-decode.py ~/ralf_side1_6x_2018-10-09_21-41-14.lds ralf -s 7 -l 244 --NTSCJ --EFM
python3 ld-decode ~/ralf_side1_6x_2018-10-09_21-41-14.lds ralf -s 7 -l 244 --NTSCJ --EFM
#
# -I 0 sets ire to 0, HE-010 is a Japanese LD
ld-chroma-decoder --3d -l 245 ralf.tbc ralf.rgb
Expand Down
1 change: 1 addition & 0 deletions filtermaker.py → scripts/filtermaker
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
# RJS: Added amendments to work with refactored code 03-JAN-2018


Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion scripts/test-decode
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def run_ld_decode(args):

clean(args, ['.tbc', '.tbc.json', '.efm', '.pcm'])

cmd = [src_dir + '/ld-decode.py']
cmd = [src_dir + '/ld-decode']
cmd += ['--ignoreleadout']
if args.pal:
cmd += ['--pal']
Expand Down
37 changes: 37 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/python3

from distutils.core import setup

setup(
name='ld-decode',
version='7',

description='Software defined LaserDisc decoder',
url='https://github.com/happycube/ld-decode',
keywords=['video', 'LaserDisc'],
classifiers=[
'Environment :: Console',
'Environment :: X11 Applications :: Qt',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Programming Language :: C++',
'Programming Language :: Python :: 3',
'Topic :: Multimedia :: Video :: Capture',
],

packages=['lddecode'],
scripts=[
'cx-expander',
'ld-cut',
'ld-decode',
'scripts/ld-compress',
],

# These are just the minimal runtime dependencies for the Python scripts --
# see the documentation for the full list of dependencies.
provides=['lddecode'],
requires=[
'numba',
'numpy',
'scipy',
],
)
2 changes: 1 addition & 1 deletion tools/ld-chroma-decoder/comb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include "comb.h"

#include "../../deemp.h"
#include "deemp.h"

// Public methods -----------------------------------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion tools/ld-chroma-decoder/ld-chroma-decoder.pro
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ HEADERS += \
transformpal3d.h \
yiq.h \
yiqbuffer.h \
../../deemp.h \
../library/filter/deemp.h \
../library/filter/iirfilter.h \
../library/tbc/lddecodemetadata.h \
../library/tbc/sourcevideo.h \
Expand Down
File renamed without changes.
7 changes: 3 additions & 4 deletions tools/library/filter/testfilter/testfilter.pro
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ SOURCES += \
testfilter.cpp

HEADERS += \
../deemp.h \
../firfilter.h \
../iirfilter.h \
../../../../deemp.h
../iirfilter.h

INCLUDEPATH += \
.. \
../../../..
..

0 comments on commit 65a8138

Please sign in to comment.