• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

READMEH A D09-Dec-202014.3 KiB388286

test_pat_B.cH A D09-Dec-202025.4 KiB900665

test_pat_C.cH A D09-Dec-202014.3 KiB699560

test_pat_G.cH A D09-Dec-202020.4 KiB863648

test_pat_I.cH A D09-Dec-202013.3 KiB594442

test_pat_L.cH A D09-Dec-202016.5 KiB701508

test_pat_R.cH A D09-Dec-202026 KiB1,053817

README

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