Skip to content

About

BBC Test Card Restoration Project

Resources

Stars

33 stars

Watchers

1 watching

Forks

Latest commit

 

History

188 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BBC Test Card Restoration Project

This is a project dedicated to restoring/recreating test card images historically used by the BBC, as close to the originals as possible - so that they are both authentic and suitable for generation of actual test signals that retain properties of a proper engineering test (of broadcast quality when programmed into a professional test signal generator, or of hobbyist quality when displayed via consumer equipment like a DVD player or a Raspberry Pi).

The primary source for this project is an archive of the shutdown broadcast of BBC HD, recorded on March 26th, 2013, when various historical test cards have been shown. This project aims to both recover the original SD images from that HD broadcast as accurately as possible (this part is largely done), and manually edit them to further remove remaining artifacts (pending, on hold).

How to use this project

This repository does not contain actual test card images (aside from incomplete parts of Test Card F - at least for now), only scripts for processing data from the transport stream recording.

Prerequisites

To run the scripts, you will need:

  • A computer running Linux or macOS. Other Unix-like systems might work too, but have not been tested. Windows will not work natively. Use WSL or a virtual machine to run Linux if you're on Windows.
  • The following software:

For example, on Ubuntu 26.04 x86_64 (note: running on older versions may be problematic because VapourSynth requires very new dependencies), you can run the following commands to install all the prerequisites:

sudo dpkg --add-architecture i386
sudo apt update
sudo apt install curl git imagemagick libpython3.14 mesa-vulkan-drivers \
    python3-matplotlib python3-scipy python3-venv unzip wine32
# Vapoursynth will be installed in a Python virtualenv
python3 -m venv .venv --system-site-packages
. .venv/bin/activate
pip install vapoursynth-bestsource vapoursynth-descale vs-placebo
vapoursynth config

On macOS, install Homebrew first, and then run:

brew install \
    imagemagick molten-vk python-matplotlib scipy vapoursynth-bestsource \
    vapoursynth-descale wine-stable
xattr -cr '/Applications/Wine Stable.app'
python3 -m pip install --break-system-packages vs-placebo

# On Apple Silicon you'll also need to install Rosetta 2:
softwareupdate --install-rosetta --agree-to-license

Running

Downloading copyrighted sources

WARNING: The download.sh script runs code downloaded from the Internet without much care about security. If that concerns you, you might want to run it in an isolated environment or manually reproduce the steps instead.

Run:

./scripts/download.sh

This will download:

Regenerating the test cards

Run:

./scripts/generate.sh

Test card images will be created in the current directory.

Current state

Card State Sources Restoration details
Baird System test cards
Television Eye ✅ Finished [1] Resized to 30x70, Lanczos-filtered along the horizontal axis, cubic filtered along the vertical axis (note that the Baird system scans vertically). Edges cleaned up. Pixel values converted to linear light space.

Restorations fully scripted.

Circle and line ✅ Finished [1] Added borders to fill a 3:7 aspect ratio. Aligned so that the line lands cleanly on a pixel coordinate. Resized to 30x70, Lanczos-filtered along the horizontal axis, cubic filtered along the vertical axis (note that the Baird system scans vertically). Edges cleaned up. Pixel values converted to linear light space.

Restorations fully scripted.

405-line (Marconi System) test cards
Tuning signal ✅ Finished [1], [2] BBC HD shutdown source resized (Lanczos-filtered), aligned and leveled to match the higher-fidelity TVARK source - only the blanking from the BBC HD shutdown is used, the rest comes from TVARK.

Hybrid FFT/cubic resampling used along the horizontal axis to match the 8.748 MHz sampling rate. Gaussian filter resizing used along the vertical axis.

Note that being pre-war, the intended display aspect ratio is 5:4 rather than 4:3. This corresponds to the 702x378 area in the resulting file.

Restorations fully scripted.

Test Card A ✅ Finished [1] Resized using a Lanczos filter along the vertical axis, and using hybrid FFT/cubic resampling along the horizontal axis.

Restorations fully scripted.

Note that these test cards are clearly modern reproductions. Remaining evidence of the originals suggest that they differed slightly, e.g. with the fonts used.

Grating frequencies measured on Test Card A are 12.15% too high (e.g., 2.243 MHz instead of 2 MHz) and about 12.5% too high on Test Card B - except the 1 MHz grating on Test Card B, which is accurate. The rest of the cards match expected geometry.

Test Card B ✅ Finished [1]
Test Card C ✅ Finished [3] Resized using a Gaussian filter along the vertical axis, and using hybrid FFT/cubic resampling along the horizontal axis.

Restorations fully scripted.

Note that these test cards are modern reproductions. The BBC HD shutdown broadcast seems to have used lower-quality, recompressed versions of the same reproductions (with minor changes to the frequency gratings). R.T.Russell's generator software used FFT-style resampling along both axes and treated only 376 lines (instead of 378) as active for the 405-line system. Since the original test cards were optical, I decided not to replicate this behavior in pursuit of better quality.

Grating frequencies are 2.8% too low (e.g. 0.972 MHz instead of 1 MHz). The rest of the cards match expected geometry.

Unlike other 405-line test cards provided, these are not pre-blanked.

Test Card D ✅ Finished [3]
625-line ("PAL") test cards (4:3)
Test Card E ❌ Not available Work not planned for now.
Test Card F (optical) ✅ Finished [1]

Cross-referenced with various images from tvark.org

Resized using a Gaussian filter along the vertical axis, and using hybrid FFT/cubic resampling along the horizontal axis.

Color bars overlay partially remade to achieve a sharp cutoff. Top of the card image enhanced by copying the second-topmost line and reusing one line of the bottom arrow on the top.

White line on the very topmost line, visible in images from TVARK, remade.

Restorations fully scripted.

Grating frequencies are about 2.11% too high (e.g. 4.084 MHz instead of 4 MHz).

Test Card F (electronic) ✅⚠️ Minor known inaccuracies [1], [4]

Cross-referenced with the recording on 1986 BBC Domesday Project Laserdisc

Most of the card redrawn manually, by extrapolating from bits visible on Barney Wol's closeups whenever possible. Top colorbars, bottom arrow, parts of the non-defective diagonal gratings in the corners, the center photograph, the "F" letter and the BBC logo taken from the BBC HD shutdown broadcast. The white circular border around the photograph redrawn manually from scratch. Frequency gratings remade algorithmically.

This version preserves most of the known defects of the original BBC data. The delay between luminance and chrominance channels on the photograph is not recreated, though.

Unlike other 405-line test cards provided, this one is pre-blanked, in line with what is known about BBC's original data.

Recreation performed mostly as square-pixel data, corresponding to a sampling rate of 192/13 MHz (~14.77 MHz). Both an "original" image at this sampling rate, and a version rescaled to standard 13.5 MHz, are provided. The latter is created by hybrid FFT/cubic resampling along the horizontal axis.

Test Card G ✅⚠️ Minor known inaccuracies [5]

Cross-referenced with the description on the archived Pember's Ponderings website and a similar test card found on the Jason and the Argonauts Laserdisc

Data from PT8633 edited by remaking the circle mask in a more crude way, analogous to early Philips generators (PM5544/PM5534). Square wave, color bars and bottom color step lifted by 25 IRE. Frequency gratings remade. Anti-PAL signal limited to lines 48-79 and its chroma information extended onto lines 98-99, as well as to the far left.

Restorations fully scripted.

Known issues: phase of the frequency gratings not matched to the original - but note that the original generators were analogue and each known unit was calibrated slightly differently (also applies to other elements of the image). Most Test Card G transmissions did not feature the white-on-black reflection needle pulse - it can be trivially removed from the image if needed. Character generator text is not recreated.

Test Card J ⚠️ Inaccurate version only [1] Currently rendered by applying a "Debilinear descale" filter to a frame from the BBC HD shutdown broadcast. This approach results in numerous inaccuracies, especially along the vertical axis. The sub-black dot on the grayscale bars is also missing. This reproduction's quality may be sufficient for various non-testing applications, though.
525-line ("NTSC") test cards (4:3)
Test Card J (525 lines) ❌ Not available Work postponed for now.
625-line ("PAL") test cards (16:9 anamorphic widescreen)
Test Card F (widescreen) ✅ Finished [1], Reconstructed Test Card F (electronic) Remade by filling in the missing grid lines, along with fixes for the known defects, to the reconstructed image of Test Card F (electronic) described above. Recreation done mostly at square-pixel data, corresponding to a sampling rate of 256/13 MHz (~19.69 MHz). Resampled to standard 13.5 MHz using hybrid FFT/cubic resampling along the horizontal axis. Frequency gratings remade algorithmically.

"BBC Widescreen" logo taken from the BBC HD shutdown broadcast.

Restorations fully scripted.

Test Card W ⚠️ Inaccurate version only [1] Currently rendered by applying a "Debilinear descale" filter to a frame from the BBC HD shutdown broadcast. This approach results in numerous inaccuracies, especially along the vertical axis, and near the horizontal edges (as the HD broadcast did not preserve data beyond the active image width). The sub-black dot on the grayscale bars is also missing. This reproduction's quality may be sufficient for various non-testing applications, though.
High definition (1080-line) test cards
Test Card "X" ⚠️ Inaccurate version only [1] Currently taken directly from the BBC HD shutdown broadcast, with only luminance linearity precorrection. This version exhibits various compression and processing artifacts. The sub-black dot on the grayscale bars is also missing.

This reproduction's quality may be sufficient for various non-testing applications, though.

Note that this version noticeably differs from other renditions of this test card available on the Internet: the color bars and the green square above the photograph appear to be 80% colors instead of 100%. The frequency gratings also exhibit strange distortion, as if they've been resized, and the BBC HD logo is a different variant.

Also note: "Test Card X" is not an official designation for this card. It is nevertheless used, as it is commonly referred to as such.

Test Card 3D ⚠️ Inaccurate version only [1] Currently taken directly from the BBC HD shutdown broadcast, with only luminance linearity precorrection. All the notes written for Test Card "X" also apply to this one.

Note that this literally is Test Card "X" squashed to half its horizontal size and rendered twice, with an additional stereoscopic BBC logo in the corner.

Sources list

  1. BBC HD shutdown broadcast from March 26th, 2013, as captured in a transport stream recording found in the Lip-Sync issue thread on hummy.tv forums
  2. Pre-war tuning signal image found on tvark.org
  3. Richard T. Russell's recreations of test cards C and D, bundled with his Test Card Generator programming software package
  4. Closeup of defects in BBC data from Barney Wol's archived website
  5. Test patterns developed for the PTV PT5230 / PT8633 test pattern generator, as found in Karsten Hansen's PTV archive on GitHub

File format description

  • All resulting files are TIFF files with 64-bit floating-point depth per channel - RGB for color images.
  • For each channel, 0.0 corresponds to the black level, and 1.0 corresponds to the white (or full-brightness, full-saturation primary color) level. Values outside the [0..1] range are permitted, to represent values outside the video-style limited range (i.e., [16..235] for 8-bit encoding).
  • For color images, the color channels correspond to primaries as defined for the appropriate format (BT.601 for standard definition, BT.709 for high definition).
  • Baird system images encode linear light intensity, and are converted to that format during generation. All other images are gamma-corrected for CRTs - it is assumed that the sources were already at the correct gamma; no additional gamma correction is performed during processing (except for the blanking border of the Tuning signal to match the image from a different source).
  • ICC profiles are embedded in each file. These are BT.601 and BT.709 profiles. This ensures that the files will be displayed correctly on any color-managed display without any explicit processing (but will also hide any sub-black and super-white content). Gamma 2.4 is assumed for non-linear profiles, which means that the images will appear darkened compared to rendering them without color management.

Converting output files to video

The converty4m.py script can be used to convert the TIFF files into a Y4M video stream (encoded with 4:4:4 12-bit depth to maximize quality), which can then be easily converted into more common formats using tools such as FFmpeg.

Example for converting the Test Card G into 10 seconds of H.264 video (illustrating the use of multiple frames):

./scripts/converty4m.py TestCardG_AP1.tiff TestCardG_AP2.tiff --loop 125 |
ffmpeg -i - -vf colorspace=iall=bt601-6-625:all=bt601-6-625 -vcodec libx264 \
TestCardG.mp4

Example for converting the widescreen Test Card F variant into 10 seconds of DVD-spec video (illustrating the --aspect169 option):

./scripts/converty4m.py TestCardFWide.tiff --loop 250 --aspect169 |
ffmpeg -i - -vf colorspace=iall=bt601-6-625:all=bt601-6-625 -target pal-dvd \
TestCardFWide.vob

Example for converting the HD test card to 10 seconds of H.264 video (illustrating the different color space):

./scripts/converty4m.py TestCardX.tiff --loop 250 |
ffmpeg -i - -vf colorspace=iall=bt709:all=bt709 -vcodec libx264 TestCardX.mp4

Other notes

  • Luminance channel on the BBC shutdown broadcast images is precorrected prior to any other processing. The precorrection curves were created by taking the grayscale gradients in Test Cards W and "X" as reference.
  • Hybrid FFT/cubic resampling is a custom method in which the input signal is resampled twice: first using FFT resampling, and then using the cubic kernel (Catmull-Rom spline) interpolation. Result of the cubic resampling is used in parts of the signal with low amplitude (to avoid ripples), and results from FFT resampling are used in higher-amplitude regions (to faithfully preserve frequency gratings and similar signals). The amplitude threshold used in these scripts is set to 1/128th of the range between black and white levels (i.e., 0.78125 IRE).
  • Sampling rate of 8.748 MHz is used for 405-line images - this is exactly (405/625)×13.5 MHz, and has been chosen to make the horizontal scanning in the digital domain compatible with the 625-line system.

Other files that may be of interest

  • INFO.md - technical information about where to get the transport stream recording, what tests cards are in there, etc.
  • scripts/convertsigned.py - converts raw 16-bit files between unsigned (0..65535) and signed (-32768..32767) formats. The conversion is symmetrical, so it can be used either way. Signed data is handy for viewing the waveform... in audio editors, like Audacity. Might be convenient for visual inspection.
  • scripts/eqcurve601.py, scripts/eqcurve709.py - quick and dirty scripts for generating the precorrection curves used in extract.vpy. Note that they have been manually tweaked afterward.
  • scripts/extractld.py - processes *.tbc files created by ld-decode into image files, in a way that is optimized for extracting still images that are present for multiple frames.
    • NOTE: In previous revisions of this repository, the extractld.py script included some hardcoded tweaks to improve the quality of Test Card F image extracted from the 1986 BBC Domesday Community South disc. Those tweaks are no longer hardcoded. To achieve a result equivalent to the old version, run: scripts/extractld.py domesday.tbc domesday.tiff 3000 23 --black-level 16221 --white-level 53274 --deghost -4.5 0.1333333333333333 --u-scale 0.8333333333333333 --v-scale 0.875 --shift -12.027515649466466
  • scripts/generate_*.sh - alternate generate scripts that exclusively use the BBC HD shutdown stream as the source and perform only parts of the processing. May be appropriate for comparison and debugging.
  • scripts/plot.py - plots line data from image files, much like an oscilloscope.
  • sources/TestCardFElec_BarneyWol.xcf - XCF (GIMP) file containing features of the electronic version of Test Card F recovered from Barney Wol's archived website and arranged on a canvas that matches the output of my scripts when set to SCALE=3 (square pixels). These are said to come from BBC's original data, so can be used as reference.

Why?

BBC Test Cards are an important cultural artifact, recognized both inside and outside the United Kingdom. They are well known, and the image of Carole Hersee used in Test Card F and its successors is instantly recognizable by millions of people around the world.

However, most reproductions of those test cards that circulate over the Internet fall into one of the following categories:

  • Photographs of a TV screen
  • Low-quality videotape recordings from over-the-air analogue TV
  • Images that were shared by sources inside the BBC, but in low quality - this includes the famous GIF version of Test Card F, as well as images shared on some early hobbyist websites
  • Unofficial recreations made by various people, usually without any regard for engineering qualities - those are often pleasant to look at, but made and posted in wrong resolutions, have false colors etc.

Other famous test patterns such as the SMPTE color bars, the Philips circle pattern or the Telefunken FuBK test card, have long been documented in such detail that it is relatively easy to recreate them with a high degree of accuracy. The PTV archive repository (https://github.com/KarstenHervoeHansen/PTV) also contains the original data used to program the EPROMs of Philips/PTV pattern generators with several variants of the Philips circle and FuBK patterns, making pixel-perfect reproductions of those feasible.

None of that is true for the BBC patterns. However, the BBC HD shutdown broadcast provides a high-quality official source, that together with various other artifacts scattered over the Internet, may make it feasible to create versions of those patterns that are as definite as possible save for a release or leak of actual data used by the BBC.

Legal disclaimer

BBC test card images may be copyrighted, and some of their features, like the BBC logos and the Carole Hersee photograph, definitely are. The copyright owners seem to be OK with people who play with the test cards for non-commercial/hobbyist purposes, or reproduce them with appropriate context. But I am not a lawyer, and don't take any responsibility for possible consequences of unauthorized use.

Said copyright owners were listed on the famous GIF version of Test Card F as: © BBC, ITC & BREMA 1967. BBC is still active today. ITC, the Independent Television Commission, was a commercial broadcasting regulatory body replaced by Ofcom in 2003. BREMA, the British Radio Equipment Manufacturers' Association, through mergers with the Federation of the Electronics Industry in 2001 and the Computing Software and Services Association in 2002, formed Intellect, which then relaunched as techUK in 2013. Thus, the current copyright owners are most likely BBC, Ofcom and techUK.

All the code, text and information created by me as part of this repository, is free to use however you like, with or without attribution. Treat it as public domain, CC0 or WTFPL, whatever is the most convenient or legally appropriate for you.

About

BBC Test Card Restoration Project

Resources

Stars

33 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages