1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-21 21:33:54 +00:00

Added some words on trigonometric decoding.

Thomas Harte 2019-01-06 19:11:18 -05:00
parent 5067554a9e
commit ee95b600ea

@ -87,11 +87,46 @@ Being able to recover colour from the colour channels as above requires that the
### Separating Colour and Brightness
Various approaches are available, including:
* standard frequency filtering; and
* a comb filter.
* standard frequency filtering;
* a comb filter; and
* trigonmetric decoding.
#### Frequency Filtering
Applying a low-pass filter below the colour subcarrier frequency can be used to extract luminance information; that can be subtracted from the complete signal to leave the colour signal.
#### Comb Filter
The comb filter uses the observation that an entirely consistent colour signal of frequency n Mhz would add an opposite amount of signal at time (t + 1/2n) as at time t. Therefore the average of two samples can be used as brightness, and the difference between that and the source signal is colour.
#### Trigonometric Decode
The formula for composite encoding joins three independent variables as a function of phase; therefore the three can be derived given three separate samples plus knowledge of phase. Assuming that the three samples are placed so that they observe the same luminance and colour, e.g.:
s1 = y + q * sin(a) + r * cos(a)
s2 = y + q * sin(b) + r * cos(b)
s3 = y + q * sin(c) + r * cos(c)
=> s1 - s2 = (y + q * sin(a) + r * cos(a)) - (y + q * sin(b) + r * cos(b))
= q*( sin(a) - sin(b) ) + r*( cos(a) - cos(b) ) [1]
=> s2 - s3 = q*( sin(b) - sin(c) ) + r*( cos(b) - cos(c) ) [2]
[1] => s1 - s2 - r*( cos(a) - cos(b) ) = q*( sin(a) - sin(b) )
=> q = ( s1 - s2 - r*( cos(a) - cos(b) ) ) / ( sin(a) - sin(b) )
[2] => q = ( s2 - s3 - r*( cos(b) - cos(c) ) ) / ( sin(b) - sin(c) )
=> ( s1 - s2 - r*( cos(a) - cos(b) ) ) / ( sin(a) - sin(b) )
= ( s2 - s3 - r*( cos(b) - cos(c) ) ) / ( sin(b) - sin(c) )
=> ( sin(b) - sin(c) ) * ( s1 - s2 - r*( cos(a) - cos(b) ) )
= ( sin(a) - sin(b) ) * ( s2 - s3 - r*( cos(b) - cos(c) ) )
=> ( sin(b) - sin(c) ) * ( s1 - s2 ) - ( sin(a) - sin(b) ) * ( s2 - s3 )
= r * ( cos(a) - cos(b) ) * ( sin(b) - sin(c) ) - r * ( cos(b) - cos(c) ) * ( sin(a) - sin(b) )
=> r = ( ( sin(b) - sin(c) ) * ( s1 - s2 ) - ( sin(a) - sin(b) ) * ( s2 - s3 ) ) /
( cos(a) - cos(b) ) * ( sin(b) - sin(c) ) - ( cos(b) - cos(c) ) * ( sin(a) - sin(b) )
With the other colour component, q, being a variation on the same result and y being found by similar means.
## PAL
PAL is a development of NTSC that gives greater resilience to phase errors induced by indirect radio signal receipt. This was manifested in the equipment as NTSC sets needing a 'tint' control, with which the viewer would manually shift the whole colour palette to account for those errors. PAL sets had no such control, being resistant to those errors.