The production of Doctor Who moved to HD with the making of Planet of the Dead, the second of five special episodes (the "Specials") that saw the end of David Tennant's tenure as our favourite Time Lord. Inevitably this led to the first Blu-ray release in Doctor Who history.
Unfortunately 2entertain, the company behind the release, made a money-saving decision to only master one set of discs for release all around the world, which meant (for largely historical reasons) converting the episodes from their original PAL frame rate (exactly 50Hz) to the NTSC frame rate (approximately 59.94Hz).
Both PAL and NTSC (or in this case, their digital HD equivalents) utilise interlacing - each frame consists of two fields, comprised of the odd and even lines respectively. PAL uses 25 frames (50 fields) a second, while NTSC uses - almost - 30 frames (60 fields) a second. These two fields may be captured from a single moment in time, in which case you get a "film-look" to your video, and is how films and most modern drama is broadcast, or they can be separated in time, in which case you get the so-called "soap opera" look. The difference between the two is probably most familiar to you from classic episodes of Doctor Who when the action moved from inside the studio (shot with video cameras) to a location (shot on film).
If you think of the invididual images from a video as letters of the alphabet, a Doctor Who episode is natively broadcast (or placed on DVD) in the following manner:
Broadcast frame (25 per second) | 0 | 1 | 2 | 3 | 4 | 5 | 6 | ... |
---|---|---|---|---|---|---|---|---|
Top (even) field | A | B | C | D | E | F | G | ... |
Bottom (odd) field | A | B | C | D | E | F | G | ... |
... | a' | b' | c' | d' | e' | f' | g' | ... |
... | A | B | C | D | D | E | F | ... |
... | A | B | C | D | E | F | F | ... |
... | a' | b' | c' | d' | e' | f' | g' | ... |
... | A | B | C | C | D | E | F | ... |
... | A | B | C | D | E | F | F | ... |
To undo this I wrote an AviSynth filter which begin by calculating the inverse of the above - i.e., for every NTSC frame on the Blu-ray, it calculates which PAL frames it contains. From this, a table was built linking each PAL frame to at least 2, and at most 3, NTSC frames. For example, taking the second sub-pattern above:
... | a' | b' | c' | d' | e' | f' | g' | ... |
... | A | B | C | C | D | E | F | ... |
... | A | B | C | D | E | F | F | ... |
Top | Bottom | Top | Bottom | |
A | a' | a' | ||
B | b' | b' | ||
C | c' | c' | d' | |
D | d' | e' | ||
E | e' | f' | ||
F | f' | g' | g' |
Unfortunately 2entertain made a second error during encoding. In each of the "mixed" interlaced NTSC frames (those where the two capital letters differ), only the luminance (brightness) information is separated between the even and odd lines as it should be. The colour information (chrominance, or chroma) for both PAL frames has been blended together into the NTSC frame, which results in the following sort of nastiness:
Let's take another look at that pattern:
... | a' | b' | c' | d' | e' | f' | g' | ... |
... | A | B | C | C | D | E | F | ... |
... | A | B | C | D | E | F | F | ... |
It can be seen that restoring the chroma for frames C and F won't be a problem - each has one NTSC frame fully associated with it, in this case c' and g', and both contain full chroma information. Restoring D and E poses more of a problem - NTSC frames d', e' and f' all have averaged chroma of their constituent PAL frames. But as just noted, we do have a clean version of the chroma from one of those PAL frames - so this can be subtracted from the blended chroma, leaving just the remaining chroma:
There is some loss of accuracy, but as the human brain is not as sensitive to the chroma information as it is to the luma information, this goes unnoticed. With the first sub-pattern we looked at:
... | a' | b' | c' | d' | e' | f' | g' | ... |
... | A | B | C | D | D | E | F | ... |
... | A | B | C | D | E | F | F | ... |
...the missing chroma can be calculated in two different ways, as the clean neighbours are closer:
So an average of these can be taken.
After all that, a few problems still remain:
The conversion of Planet of the Dead took a different approach altogether. In this case fields weren't simply repeated - they were instead blended, naively, to create "in-between frames" to pad out the sequence, so it looks even blurrier than the rest of the episodes. A typical section may look something like this:
... | a' | b' | c' | d' | e' | f' | g' | ... |
... | A | B | B+C | C+D | D+E | E | F | ... |
... | A+B | B+C | C | D | D+E | E+F | F+G | ... |
with one or two blended frames between each clean one. While no PAL frame is fully represented (with both clean even and clean odd fields), there appears to always be at least one clean field for each. After running the video through a deinterlacer to intelligently create full frames from each field, the Avisynth filter srestore can do a pretty good job of "blindly" working out which are the unmixed frames, but for a more accurate restoration there is another source of information we can refer to - the PAL DVD of the same episode. This has all the clean frames, albeit at SD resolution, so with another video filter a comparison can be made between the two, and the matching frames can be extracted from the NTSC video.
So, all fixed? Not quite. Like the other Specials, Planet of the Dead has a blended chroma problem. The difference is that it isn't always a 50/50 mix:
You can see a ghost image of the light in the upper right, at the same position it was at in the previous frame (in other cases, the next frame). Once again the DVD comes to the rescue, since this has clean chroma that we can compare the Blu-ray video to. By calculating a number of test "unblends" of the form:
and comparing each of these in turn to the original frame's DVD chroma, a "least difference" result can be identified and the chroma can be restored: