Change video content scaling so that it either:
[dcpomatic.git] / hacks / pldec.py
1 #!/usr/bin/python
2
3 import numpy as np
4 import scipy.signal
5 import matplotlib.pylab as plt
6 import math
7
8 radians = np.pi * 16
9 points = 1024
10 cut = math.pow(10, -3 / 20.0)
11 print cut
12
13 t = np.linspace(0, radians, points)
14 inL = np.zeros((points,))
15 inC = np.sin(t)
16 inR = np.zeros((points,))
17 inS = np.zeros((points,))
18
19 # Encode
20 Lt = inL + inC * cut + np.imag(scipy.signal.hilbert(inS * cut))
21 Rt = inR + inC * cut - np.imag(scipy.signal.hilbert(inS * cut))
22
23 # Decode
24 outL = Lt
25 outR = Rt
26 outS = Lt - Rt
27
28 plt.plot(t, outL, label='L')
29 plt.plot(t, outR, label='R')
30 plt.plot(t, outS, label='S')
31 plt.legend()
32 plt.show()
33