ColorBars

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
(note AVS+ differences)
m (tweak appearance)
Line 11: Line 11:
 
{{FuncDefH4|ColorBars}}
 
{{FuncDefH4|ColorBars}}
 
{{FuncDef
 
{{FuncDef
|ColorBars ( [ int ''width'', int ''height'', string ''pixel_type'', bool ''staticframes'' ] ){{AvsPluscon}}
+
|ColorBars ( [ int ''width'', int ''height'', string ''pixel_type'', bool ''staticframes'' ] ) {{AvsPluscon}}
 
}}
 
}}
  
Line 28: Line 28:
  
 
:{{Par2|staticframes|bool|true}}
 
:{{Par2|staticframes|bool|true}}
::{{AvsPluscon}}If set to false, generate all frames. Default true (one static frame is served)
+
::{{AvsPluscon}} If set to false, generate all frames. Default true (one static frame is served)
  
  
Line 39: Line 39:
 
}}<br>
 
}}<br>
 
{{FuncDef
 
{{FuncDef
|ColorBarsHD ( [ int ''width'', int ''height'', string ''pixel_type'', bool ''staticframes'' ] ){{AvsPluscon}}
+
|ColorBarsHD ( [ int ''width'', int ''height'', string ''pixel_type'', bool ''staticframes'' ] ) {{AvsPluscon}}
 
}}
 
}}
  
Line 56: Line 56:
  
 
:{{Par2|staticframes|bool|true}}
 
:{{Par2|staticframes|bool|true}}
::{{AvsPluscon}}If set to false, generate all frames. Default true (one static frame is served)
+
::{{AvsPluscon}} If set to false, generate all frames. Default true (one static frame is served)
  
 
==== TV range ====
 
==== TV range ====
Line 400: Line 400:
  
 
==== High bit depth ====
 
==== High bit depth ====
{{AvsPluscon}}For higher bit depths, the values given above are scaled appropriately &ndash; for example:
+
{{AvsPluscon}} For higher bit depths, the values given above are scaled appropriately &ndash; for example:
 
:{| class="wikitable"
 
:{| class="wikitable"
 
|-
 
|-

Revision as of 11:10, 23 April 2017

Contents


SMPTE Color Bars-320x240.png

ColorBars

ColorBars ( [ int width, int height, string pixel_type ] )

ColorBars

ColorBars ( [ int width, int height, string pixel_type, bool staticframes ] ) AVS+

Produces a video clip containing SMPTE color bars (Rec. ITU-R BT.801-1) scaled to any image size.

By default, a 640×480, RGB32, TV range, 29.97 fps, 1 hour long clip is produced.

int  width = 640
int  height = 480
Set size of the returned clip.
string  pixel_type = "RGB32"
Set color format of the returned clip.
May be any of the following: "YUY2", "YV12", "YV24" (v2.60), or (default) "RGB32".
AVS+ "RGB32", "RGB64", "YUY2", or any planar RGB, 4:2:0 or 4:4:4 format.
bool  staticframes = true
AVS+ If set to false, generate all frames. Default true (one static frame is served)


SMPTE Color Bars16x9-320x180.png

ColorBarsHD

ColorBarsHD ( [ int width, int height, string pixel_type ] )
ColorBarsHD ( [ int width, int height, string pixel_type, bool staticframes ] ) AVS+

Added in v2.60, ColorBarsHD produces a video clip containing SMPTE color bars
(Rec. ITU-R BT.709 / arib std b28 v1.0) scaled to any image size.

By default, a 1288×720, YV24, TV range, 29.97 fps, 1 hour long clip is produced.

int  width = 1288
int  height = 720
Set size of the returned clip.
string  pixel_type = "YV24"
Set color format of the returned clip. Must be "YV24".
AVS+ "YV24" or other 4:4:4 format.
bool  staticframes = true
AVS+ If set to false, generate all frames. Default true (one static frame is served)

TV range

For both filters, in all color formats, luminance levels are TV range, where black=16
and white=235, within a total possible range of 0-255.

The table below show the TV-range values ColorBarsHD generates, and those same values as they should be after converting to full range.

Yfull = (Ytv-16)  × 255/(235-16) // (for R, G, B, Y)
Ufull = (Utv-128) × 255/(240-16) + 128 // (for U, V)
Ytv   = Yfull × (235-16)/255 + 16 // (for R, G, B, Y)
Utv   = (Ufull-128) × (240-16)/255 + 128 // (for U, V)
Color bar  TV range output (expanded to full range)
R G B Y U V R G B Y U V
75% White 180 180 180 180 128 128 191 191 191 191 128 128
75% Yellow 180 180 16 168 44 136 191 191 0 177 32 137
75% Cyan 16 180 180 145 147 44 0 191 191 150 149 32
75% Green 16 180 16 134 63 52 0 191 0 137 54 41
75% Magenta 180 16 180 63 193 204 191 0 191 55 201 214
75% Red 180 16 16 51 109 212 191 0 0 41 106 223
75% Bue 16 16 180 28 212 120 0 0 191 14 223 118

These colors are at "75%" of maximum, per common broadcast practice. You may occasionally see "100%" color bars.[1] They are rather useless, as you cannot detect gain or saturation that is too high on a signal that is already at maximum.

PLUGE

The lower part of the frame is called the PLUGE (also lowercase: "pluge") signal.
From left to right it consists of: -I, white, +Q, then a series of black and near-black bars: 0, -4, 0, +4 and 0 IRE relative to black.

Note 'IRE' is used here to mean 'percent luminance', on a scale from 0 (black) to 100 (white), ignoring the varying broadcast standards where black might be 0 IRE or 7.5 IRE depending on the country.

This section documents the ColorBars pluge only; ColorBarsHD's pluge is similar, but dispenses with -I and +Q

The table below show the TV-range values ColorBars generates, and those same values as they should be after converting to full range.

PLUGE Element  TV range output (expanded to full range)
R G B Y U V R G B Y U V
-I 0 58 98 16 158 95 -19 49 95 0 162 90
100% White 235 235 235 235 128 128 255 255 255 255 128 128
+Q 59 15 126 16 174 149 50 -1 128 0 180 151
Black 16 16 16 16 128 128 0 0 0 0 128 128
-4 IRE 7 7 7 7 128 128 -10 -10 -10 -10 128 128
Black 16 16 16 16 128 128 0 0 0 0 128 128
+4 IRE 25 25 25 25 128 128 10 10 10 10 128 128
Black 16 16 16 16 128 128 0 0 0 0 128 128
(negative values will be clipped to 0)

The -I and +Q bars are vestigial artifacts of NTSC analog TV and are not really used any more.

The -4, 0 and +4 IRE bars can be used to set your monitor brightness – assuming your playback chain expands TV range (16-235) to full-range (0-255) as shown in the images above. The -4 IRE and 0 IRE bars should have the same apparent brightness (they should be as dark as the monitor can display), and the +4 should be a little brighter. If you can see the -4 bar, your monitor brightness is set too high; if you cannot see the +4 bar, your monitor brightness is set too low.[2]

Note, the pluge signal goes out of 16-235 range in the -I and the -4 bars. These cannot be accurately converted to 0-255 range.

More information about the colorbars and the PLUGE can be found on the colorbars theory page.

High bit depth

AVS+ For higher bit depths, the values given above are scaled appropriately – for example:

Color 8-bit 10-bit 16-bit
Super-black 0   0   0  
Black 16   64   4096  
U, V null 128   512   32768  
White 235   940   60160  
Super-white 255   1023   65535  

Audio

For both filters, an audio tone is also generated. The tone is a 440Hz sine at 48KHz sample rate, 16 bit, stereo. The tone pulses in the right speaker, being turned on and off once every second. Level is 0 dBFS.

You can use Amplify to set a softer level (0dB can be a little deafening!)

ColorBarsHD
AmplifyDB(-20)

Broadcasting organizations usually specify an "alignment tone" accompanying colorbars at anywhere from -12 to -20 dBFS; if sending materials to another party, be sure to get their preferred alignment tone level. The exact level doesn't matter as long as all parties agree to it.

Miscellaneous

  • Note, that for example
ColorBars(pixel_type="YUY2")
...is equivalent to
ColorBars(pixel_type="RGB32")
ConvertToYUY2(matrix="PC.601")  
# "PC.601" / "PC.709" don't scale the luma range
  • When directly generating YUV format data, the color transitions are arranged to occur on a chroma-aligned boundary.

Changes

v2.60
  • Added pixel_type="YV24" to ColorBars.
  • Initial release of ColorBarsHD.
v2.56 Added pixel_type="YUY2"/"YV12".
Personal tools