| 1 |
test_pat_* |
| 2 |
|
| 3 |
This is a set of test pattern generating Frei0r plugins. Mostly, I just |
| 4 |
gathered together a pile of C functions that I wrote over the years for |
| 5 |
testing other image processing stuff, but some I wrote anew (like the |
| 6 |
broadcast test card lookalikes). |
| 7 |
They are useful for measuring the effects of image processing, for |
| 8 |
display checking and adjustment, for reverse engineering of video |
| 9 |
effects, for debugging during development of video software, etc... |
| 10 |
|
| 11 |
|
| 12 |
Included are the following plugins: |
| 13 |
|
| 14 |
test_pat_B broadcast test card lookalikes |
| 15 |
test_pat_C color space cross sections |
| 16 |
test_pat_G geometry checking |
| 17 |
test_pat_I spatial impulse and step response checking |
| 18 |
test_pat_L levels and linearity checking |
| 19 |
test_pat_M motion response checking (*) |
| 20 |
test_pat_R resolution and spatial frequency response checking |
| 21 |
test_pat_T time domain response checking (*) |
| 22 |
|
| 23 |
(*) not yet finished (heck, not even started working on them :-) |
| 24 |
|
| 25 |
Each one of these can generate several different patterns, many of them |
| 26 |
adjustable through parameters. |
| 27 |
|
| 28 |
|
| 29 |
Written by Marko Cebokli, jun 2010, and released under GNU GPL |
| 30 |
|
| 31 |
|
| 32 |
RELEASE NOTES |
| 33 |
|
| 34 |
** jun 2010 |
| 35 |
Version 0.1 |
| 36 |
"pre-alpha" (throw it out and see what happens... :-) |
| 37 |
|
| 38 |
|
| 39 |
INTRODUCTION |
| 40 |
|
| 41 |
First question that comes to mind is, "why bother with this?" |
| 42 |
Would it not be simpler to just use PNG images and import them as |
| 43 |
slides? |
| 44 |
This is why: |
| 45 |
- First, in that case you would need a separate PNG for each video |
| 46 |
format - otherwise scaling would be done on import, introducing |
| 47 |
scaling artefacts. Test_pat plugins draw algorithmically, adapting |
| 48 |
the patterns to the chosen format. |
| 49 |
- Second, many of these plugins accept parameters, to change the |
| 50 |
features in the pattern, making them much more versatile than fixed |
| 51 |
slides. |
| 52 |
- Third, time domain and motion tests wouldn't be feasible at all |
| 53 |
with slides. |
| 54 |
|
| 55 |
|
| 56 |
PIXEL ASPECT RATIO |
| 57 |
|
| 58 |
Some of the plugins will attempt to draw exact circles and squares. |
| 59 |
To do this, they need to know the pixel aspect ratio. Since this info |
| 60 |
is not available directly to a Frei0r plugin, the user must set it |
| 61 |
manually. Seven options are offered: square pixels, five standard video |
| 62 |
pixel aspect ratios, and arbitrary manual adjustment. |
| 63 |
|
| 64 |
|
| 65 |
COLOR FORMAT |
| 66 |
|
| 67 |
For maximum portability, these plugins internally generate the patterns |
| 68 |
in floating point format, in the range [0...1], so most of the code is |
| 69 |
independent of the final color model, endianness and number of bits. |
| 70 |
The test_pat_G uses "char" with [0...255] range internally, since it |
| 71 |
only needs a few levels. |
| 72 |
Converting to the final format (in the case of Frei0r rgba8888) is |
| 73 |
done last, and is confined to a few functions (in most cases a single |
| 74 |
one), so adding other color models should be simple. |
| 75 |
|
| 76 |
|
| 77 |
LEVELS AND COLOR ACCURACY |
| 78 |
|
| 79 |
On the output of these plugins, they should be as accurate as the |
| 80 |
used color model allows - but note that the host application might |
| 81 |
convert to a different model, enforce DV legality (rec 601 levels), or |
| 82 |
chop the color gamut... |
| 83 |
|
| 84 |
|
| 85 |
ARTEFACTS |
| 86 |
|
| 87 |
The patterns are drawn algorithmically and should not contain artefacts. |
| 88 |
If you see any, they are probably caused because you are not viewing |
| 89 |
at exact 1:1 pixel scale (the image was scaled before display). |
| 90 |
Higher spatial frequencies can cause "moire" patterns, even when |
| 91 |
below the Nyquist limit. This is a normal consequence of the fact, |
| 92 |
that there is no anti-aliasing filter present between the monitor |
| 93 |
and your eyes. |
| 94 |
|
| 95 |
|
| 96 |
MEASUREMENT AND QUANTITATIVE ANALYSIS |
| 97 |
|
| 98 |
can be done by combining these generators with the "pr0be", |
| 99 |
"pr0file" and other measurement plugins. |
| 100 |
|
| 101 |
|
| 102 |
MULTIPLE CHOICE (list / enum) TYPE PARAMETERS |
| 103 |
|
| 104 |
Parameters of this type are not natively supported in the Frei0r |
| 105 |
specification, therefore they must be somehow implemented using |
| 106 |
a floating point argument. The Frei0r specification requires this |
| 107 |
to be in the [0...1] range. These plugins conform to that by dividing |
| 108 |
the [0...1] range into N subintervals (if there are N choices for this |
| 109 |
parameter), each corresponding to one of the choices. |
| 110 |
However, this is a bit clumsy for command line usage, so I have |
| 111 |
also mapped the integers 0...(N-1) to the same parameter choices. |
| 112 |
For example, if a parameter has five choices, 0.7 and 3 will both |
| 113 |
mean the fourth choice. |
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
****** DESCRIPTIONS OF EACH PLUGIN FOLLOW ****** |
| 119 |
|
| 120 |
|
| 121 |
*** THE "TEST_PAT_B" PLUGIN ("B" for Broadcasting) |
| 122 |
|
| 123 |
This one produces patterns similar to some popular broadcast test cards. |
| 124 |
Because those contain some specifically "analog" stuff, like the |
| 125 |
illegal phase color subcarrier in the PAL PM5544, or "infrablack" |
| 126 |
in the SMPTE color bars "pluge" group, they can not be |
| 127 |
100% emulated in a digital environment. Also, for most of them I did |
| 128 |
not have the original specification, so I more or less guessed the |
| 129 |
values with some help from Google... |
| 130 |
Therefore, I call them "lookalikes". |
| 131 |
|
| 132 |
Parameters: |
| 133 |
|
| 134 |
Type: selects among the available patterns |
| 135 |
Aspect type: square pixel, PAL, wPAL, NTSC, wNTSC, HDV, Manual |
| 136 |
Manual aspect: active when Aspect type is set to manual |
| 137 |
|
| 138 |
Available patterns: |
| 139 |
|
| 140 |
Pattern 0 100% PAL color bars |
| 141 |
Pattern 1 100% PAL color bars with red |
| 142 |
Pattern 2 95% BBC color bars (PAL) |
| 143 |
Pattern 3 75% EBU color bars |
| 144 |
Pattern 4 SMPTE color bars |
| 145 |
Pattern 5 Philips PM5544 |
| 146 |
Pattern 6 FuBK |
| 147 |
Pattern 7 Simplified FuBK |
| 148 |
|
| 149 |
|
| 150 |
*** THE "TEST_PAT_C" PLUGIN ("C" for Color) |
| 151 |
|
| 152 |
This plugin draws cross sections of various color spaces. I have |
| 153 |
written it mainly to test color keying, but other uses for it could |
| 154 |
probably be found. |
| 155 |
|
| 156 |
Parameters: |
| 157 |
|
| 158 |
Color space: |
| 159 |
Selects among four spaces: RGB, Y'PrPb, ABI and HCI |
| 160 |
|
| 161 |
Cross section: |
| 162 |
Selects between three possible cross sections, 12(3), 23(1), 31(2) |
| 163 |
NOTE: the numbers tell which two axes are represented in the 2D plane, |
| 164 |
(the first two numbers), and which axis is controlled by the "third |
| 165 |
axis value" slider (the third number in parentheses). For example, |
| 166 |
23(1) in RGB means that G will change along the horizontal axis, B |
| 167 |
along vertical, and R will be set by the "third axis value" slider. |
| 168 |
|
| 169 |
Third axis value: |
| 170 |
sets the value along the "third" axis, which cannot be accommodated |
| 171 |
on a 2D display. |
| 172 |
|
| 173 |
Fullscreen: |
| 174 |
extends the image across the full screen. Normally, it is drawn |
| 175 |
somewhat smaller, to avoid "bad" areas of CRT displays. |
| 176 |
|
| 177 |
NOTE: |
| 178 |
The strange shapes that appear on the display result from the edges |
| 179 |
of valid color in various spaces. (defined by RGB c [0...1]) |
| 180 |
|
| 181 |
|
| 182 |
*** THE "TEST_PAT_G" PLUGIN ("G" for Geometry) |
| 183 |
|
| 184 |
This one generates patterns for testing of the image geometry. |
| 185 |
|
| 186 |
Parameters: |
| 187 |
|
| 188 |
Type: selects among the possible patterns |
| 189 |
Size 1: size of major features |
| 190 |
Size 2: size of minor features |
| 191 |
Negative: just that |
| 192 |
Aspect type: square pixel, PAL, wPAL, NTSC, wNTSC, HDV, Manual |
| 193 |
Manual aspect: active when Aspect type is set to manual |
| 194 |
|
| 195 |
Available patterns: |
| 196 |
|
| 197 |
Pattern 0 checkerboard |
| 198 |
Pattern 1 checkerboard with gray rim |
| 199 |
Pattern 2 horizontal lines |
| 200 |
Pattern 3 vertical lines |
| 201 |
Pattern 4 rectangular grid |
| 202 |
Pattern 5 points (small squares) |
| 203 |
Pattern 6 bullseye (CAUTION: most displays aren't bullet proof!) |
| 204 |
These are similar to what old "analog" hardware test generators |
| 205 |
produced, for adjustment of CRT display geometry and convergence. |
| 206 |
|
| 207 |
Pattern 7 is useful to check if something is eating the borders of |
| 208 |
your video, and determine how much is missing. |
| 209 |
One would think that with digital flat panel displays, overscan is a |
| 210 |
thing of the past, but sadly, this is not the case. |
| 211 |
Especially camcorder viewfinders are prone to this! To test camcorders |
| 212 |
which do not support firewire input, make a tape with one that does. |
| 213 |
|
| 214 |
Pattern 8 is probably not of much general use... I made it while |
| 215 |
testing the "c0rners" plugin, to see where each corner ended, even |
| 216 |
with extreme distortion. |
| 217 |
|
| 218 |
Pattern 9 are "pixel rulers" useful for centering, etc. This only |
| 219 |
looks good on an 1:1 pixel scale display. |
| 220 |
|
| 221 |
Pattern 10 is a measurement grid, scaled in pixels, in a |
| 222 |
"computer graphics" type coordinate system (0,0 is upper left). |
| 223 |
This only looks good on an 1:1 pixel scale display, and is also an |
| 224 |
indicator of whether the image has been scaled. (Pattern 0, |
| 225 |
Size1=minimum is also good for such check) |
| 226 |
|
| 227 |
Pattern 11 |
| 228 |
Pattern 12 |
| 229 |
are the same patterns as 9 and 10, but with a transparent background. |
| 230 |
They can be used to measure positions and sizes of stuff in video. |
| 231 |
For example, I've used this to determine the position and size of |
| 232 |
logos, to use the mencoder's delogo filter. |
| 233 |
|
| 234 |
NOTE: Test_pat_G always draws things at integer pixel coordinates, |
| 235 |
to make the lines maximally sharp. This means that with non-square |
| 236 |
pixels, squares might not have exactly equal sides, and circles be a |
| 237 |
bit elliptic. Test_pat_G will do a best effort rounding in such cases. |
| 238 |
|
| 239 |
|
| 240 |
*** THE "TEST_PAT_I" PLUGIN ("I" for Impulse response) |
| 241 |
|
| 242 |
This one generates patterns for measuring the spatial impulse and |
| 243 |
step responses. |
| 244 |
|
| 245 |
Parameters: |
| 246 |
|
| 247 |
Type: selects among the possible patterns |
| 248 |
Channel: choices are: All(gray), R, G, B, R-Y, B-Y (601 and 709) |
| 249 |
Amplitude: amplitude of impulses and steps |
| 250 |
Width: width of impulse |
| 251 |
Tilt: angle of line (patterns 2,3,4 only) |
| 252 |
Negative: just that |
| 253 |
|
| 254 |
|
| 255 |
Available patterns: |
| 256 |
|
| 257 |
Pattern 0 square point impulse |
| 258 |
Pattern 1 raised cosine point impulse |
| 259 |
Pattern 2 square line impulse |
| 260 |
Pattern 3 raised cosine line impulse |
| 261 |
Pattern 4 step (raised cos) |
| 262 |
Pattern 5 step (linear ramp) |
| 263 |
|
| 264 |
These can be used to check code that does spatial convolution, like |
| 265 |
blurring and sharpening, etc. For example, with a single pixel square |
| 266 |
point, a convolution kernel can be directly read out with pr0be. |
| 267 |
|
| 268 |
|
| 269 |
*** THE "TEST_PAT_L" PLUGIN ("L" for Levels) |
| 270 |
|
| 271 |
This one produces patterns with defined "gray" levels in the chosen |
| 272 |
channel, for checking the amplitude transfer curves, gamma, etc. |
| 273 |
|
| 274 |
Parameters: |
| 275 |
|
| 276 |
Type: selects among the available patterns |
| 277 |
Channel: choices are: All(gray), R, G, B, R-Y, B-Y (601 and 709) |
| 278 |
|
| 279 |
Available patterns: |
| 280 |
|
| 281 |
Pattern 0 8 step gray scale 0.0 to 1.0 |
| 282 |
|
| 283 |
Pattern 1 is an 8 step gray scale with contrast squares. The steps are |
| 284 |
somewhat smaller than in pattern 0, the range is 0.0625...0.9375. |
| 285 |
The top row of square pairs differ by plus minus one percent from their |
| 286 |
backgrounds, the second 2%, then 5, 10 and 20%. In the left and right |
| 287 |
column, the 10 and 20% squares are truncated to black and white, |
| 288 |
respectively. Pattern 1 is mostly useful for a visual check of |
| 289 |
black and white "crushing". |
| 290 |
|
| 291 |
Pattern 2 is a continuous horizontal gradient from 0.0 to 1.0, flanked |
| 292 |
left and right with 50% gray. If you see stripes, your display (or |
| 293 |
something in the line between this plugin and your display) is cheating |
| 294 |
on the number of bits per pixel... |
| 295 |
|
| 296 |
Pattern 3 are 256 different levels arranged in a 16 x 16 matrix. This |
| 297 |
gives each level more area, to enable the use of spatially averaged |
| 298 |
pr0be for level measurement. Background is 50% gray. |
| 299 |
|
| 300 |
Pattern 4 are "contrast bands". The level difference between the |
| 301 |
vertically adjacent bands in each box is constant from left to right. |
| 302 |
In the top box it is 1%, then 2, 5, and 10%. This is a check of the |
| 303 |
"perceptual uniformity" of the video transfer curve. |
| 304 |
|
| 305 |
Pattern 5 is for gamma checking. It only works on a 1:1 pixel scale |
| 306 |
display, when the vertical gray (zebra) stripes show no artefacts. |
| 307 |
To determine the gamma of your display, step back, so that the zebra |
| 308 |
pattern is no more visible, and determine which of the gray patches |
| 309 |
seems of the most similar brightness as the zebra bars. |
| 310 |
For viewing video, the display gamma should be between cca 2.0 and 2.4, |
| 311 |
with lower values suitable for brighter, and higher values for dimmer |
| 312 |
viewing environments. |
| 313 |
The bars at left and right are for checking the black level and |
| 314 |
highlight crushing. The small squares are 1% steps from 1 to 10%. |
| 315 |
Especially the black level (the "brightness" control on the monitor) |
| 316 |
is important for correct gamma setting! The dimmer squares in the |
| 317 |
black bar should be just barely visible. (if the darkest two or three |
| 318 |
are not visible, it's not a catastrophe...) |
| 319 |
|
| 320 |
NOTE: Most test cards of this type use a constant step gamma scale. |
| 321 |
Because in that case, the grays for the higher gamma values are very |
| 322 |
similar (small differences), I have decided to do it a bit differently. |
| 323 |
Here, a constant gray level step scale is used, and the corresponding |
| 324 |
gamma values are calculated (therefore the non-round gamma values). |
| 325 |
I think this is more in sync with the usual goal of perceptual |
| 326 |
uniformity. |
| 327 |
|
| 328 |
Pattern 6 is just something that I wrote to help me with the development |
| 329 |
of an orthicon simulator. |
| 330 |
|
| 331 |
NOTE: If you see any color cast when output is to the "All" channel |
| 332 |
(default), it is a problem of your display. Either it is less than |
| 333 |
4 bit "true color", or a misaligned CRT, etc... |
| 334 |
|
| 335 |
|
| 336 |
*** THE "TEST_PAT_R" PLUGIN ("R" for resolution) |
| 337 |
|
| 338 |
This one generates patterns for resolution and spatial frequency |
| 339 |
response measurement. |
| 340 |
|
| 341 |
Parameters: |
| 342 |
|
| 343 |
Type: selects among the available patterns |
| 344 |
Channel: choices are: All(gray), R, G, B, R-Y, B-Y (601 and 709) |
| 345 |
Amplitude: amplitude (contrast) of the patterns |
| 346 |
Lin. p. swp.: OFF = linear frequency sweep ON = linear period sweep |
| 347 |
Freq1: Pattern 7 only: horizontal component of 2D frequency |
| 348 |
Freq2: Pattern 7 only: vertical component of 2D frequency |
| 349 |
Aspect type: square pixel, PAL, wPAL, NTSC, wNTSC, HDV, Manual |
| 350 |
Manual aspect: active when Aspect type is set to manual |
| 351 |
|
| 352 |
The pixel aspect ratio is only used to calculate the "Lines per |
| 353 |
picture height" labels on horizontal frequencies (vertical lines), |
| 354 |
and does not affect the pattern itself, which is specified in parts |
| 355 |
of the Nyquist frequency.. |
| 356 |
|
| 357 |
Available patterns: |
| 358 |
|
| 359 |
Pattern 0 vertical sweep of horizontal frequencies |
| 360 |
Pattern 1 horizontal sweep of horizontal frequencies |
| 361 |
Pattern 2 vertical sweep of vertical frequencies |
| 362 |
Pattern 3 horizontal sweep of vertical frequencies |
| 363 |
Pattern 4 radials ("Siemens star"), 0.7N cutoff |
| 364 |
Pattern 5 rings, radial sweep, high frequencies outside |
| 365 |
Pattern 6 rings, radial sweep, high frequencies nside |
| 366 |
Pattern 7 uniform 2D spatial frequency (Freq1, Freq2) |
| 367 |
Pattern 8 "Nyquist blocks" H,checkers,V, freqs of N and N/2 |
| 368 |
Pattern 9 Square wave bars at integer Nyquist fractions |
| 369 |
|
| 370 |
The sweep limit frequencies are always relative to the Nyquist |
| 371 |
frequency. This way the patterns automatically optimally adapt to |
| 372 |
frame size/resolution. Additional labels are provided in lines per |
| 373 |
picture height, LPPH. |
| 374 |
The sweeps go from 0.05 Nyquist to 0.7 Nyquist. The sweep function is |
| 375 |
either linear frequency, which gives more emphasis to the higher |
| 376 |
frequencies, or linear period, which emphasizes the lower frequencies. |
| 377 |
The 0.7 Nyquist cutoff was chosen because it corresponds to the most |
| 378 |
popular value of the Kell factor, 0.7. |
| 379 |
All patterns, except 8 and 9 which are square waves, are drawn as |
| 380 |
smooth phase sinewaves. |
| 381 |
|
| 382 |
NOTE: These patterns are very sensitive to scaling and interpolation, |
| 383 |
any warts there will be revealed in a drastic manner! Monitor |
| 384 |
windows in video software are often done in a "fast" way, so it may |
| 385 |
be necessary to do a final rendering, to see a fair result. |
| 386 |
|
| 387 |
|