Test Cards

MediaX includes a set of built-in test card generators for calibration and testing. These can be used programmatically via the C++ API or generated as PNG files using the testcard_generator tool.

Generating Test Cards

Build and run the test card generator:

cmake .. -DEXAMPLES=ON
make testcard_generator
./bin/testcard_generator <output_directory> [width] [height]

By default, cards are generated at 640x480 resolution into testcards/ in the build directory. Specify an output directory as the first argument, and optionally width and height:

./bin/testcard_generator ../images/testcards 1920 1080

Static Calibration Cards

EBU Colour Bars

EBU Colour Bars

Standard EBU colour bars — CreateColourBarEbuTestCard()

Colour Bars

Colour Bars

Standard colour bars — CreateColourBarTestCard()

Grey Scale Bars

Grey Scale Bars

Grey scale gradient bars — CreateGreyScaleBarTestCard()

Quad

Quad

Four-quadrant colour test card — CreateQuadTestCard()

Checkered

Checkered

Checkered pattern — CreateCheckeredTestCard()

White Noise

White Noise

Random white noise — CreateWhiteNoiseTestCard()

Solid Colours

Red Green Blue White Black

Solid colour fills — CreateSolidTestCard(r, g, b)

Professional Calibration Cards

SMPTE

SMPTE

SMPTE colour bars — CreateSmpteTestCard()

Zone Plate

Zone Plate

Zone plate resolution chart — CreateZonePlateTestCard()

Gradient

Gradient

Smooth gradient — CreateGradientTestCard()

Crosshatch

Crosshatch

Crosshatch alignment grid — CreateCrosshatchTestCard()

Animated Cards

These test cards produce animated sequences. A single representative frame is shown below. The cast-stream example lists them in a menu and casts the one you choose to a Chromecast, see Chromecast Casting.

Bouncing Ball

Bouncing Ball

Animated bouncing ball — CreateBouncingBallTestCard()

Rotating Cube

Rotating Cube

Animated rotating cube — CreateRotatingCubeTestCard()

Moving Sweep

Moving Sweep

Animated moving sweep — CreateMovingSweepTestCard()

Scrolling Text

Scrolling Text

Animated scrolling text — CreateScrollingTextTestCard()

Pulsing Circle

Pulsing Circle

Animated pulsing circle — CreatePulsingCircleTestCard()

Elite

Elite

The ships of the game Elite as solid, flat shaded 3D models spinning in front of a drifting star field — CreateEliteTestCard(). The 13 ships of the original game are shown in turn, each for 30 seconds, with the name at the bottom: Sidewinder, Viper, Mamba, Python, Cobra Mk III (bounty hunter), Thargoid, Cobra Mk III (trader), Coriolis station, missile, asteroid, cargo canister, Thargon and escape pod.

Set TestCardState::elite_seconds_per_ship to change the time each ship is shown, or TestCardState::elite_ship (0 to 12) to show one ship only. The models are original, drawn from the silhouettes of the ships; the Cobra Mk III follows the three view silhouette in the Elite Wiki.

Usage in Code

#include "rtp/rtp_utils.h"

// Allocate RGB24 buffer
std::vector<uint8_t> buffer(width * height * 3);
auto colourspace = mediax::rtp::ColourspaceType::kColourspaceRgb24;

// Generate a test card into the buffer
CreateColourBarEbuTestCard(buffer.data(), width, height, colourspace);
CreateSmpteTestCard(buffer.data(), width, height, colourspace);

// Animated cards carry their animation state from frame to frame. Create one
// state per stream and pass it to every frame
mediax::rtp::TestCardState state;
CreateBouncingBallTestCard(buffer.data(), width, height, colourspace, state);