ColorBars

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m (set your monitor brightness - make sidebar)
(add link to avs+ documentation)
 
(15 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
<div style="max-width:62em" >
 
<div style="max-width:62em" >
 +
 +
<div {{BlueBox2|40|0|3px solid purple}} >
 +
{{AvsPlusFullname}}<br>
 +
Up-to-date documentation: [https://avisynthplus.readthedocs.io/en/latest/avisynthdoc/corefilters/colorbars.html https://avisynthplus.readthedocs.io]
 +
</div>
 +
 +
 
__TOC__
 
__TOC__
  
Line 8: Line 15:
 
{{FuncDef
 
{{FuncDef
 
|ColorBars ( [ int ''width'', int ''height'', string ''pixel_type'' ] )
 
|ColorBars ( [ int ''width'', int ''height'', string ''pixel_type'' ] )
 +
}}<br>
 +
{{FuncDefH4|ColorBars}}
 +
{{FuncDef
 +
|ColorBars ( [ int ''width'', int ''height'', string ''pixel_type'', bool ''staticframes'' ] ) {{AvsPluscon}}
 
}}
 
}}
  
Line 21: Line 32:
 
::Set color format of the returned clip.
 
::Set color format of the returned clip.
 
::May be any of the following: "YUY2", "YV12", "YV24" (v2.60), or (default) "RGB32".
 
::May be any of the following: "YUY2", "YV12", "YV24" (v2.60), or (default) "RGB32".
 +
::{{AvsPluscon}} "RGB32", "RGB64", "YUY2", [[Avisynthplus_color_formats|or any planar RGB, 4:2:0 or 4:4:4 format]].
 +
 +
:{{Par2|staticframes|bool|true}}
 +
::{{AvsPluscon}} If set to false, generate all frames. Default true (one static frame is served)
 +
  
  
Line 28: Line 44:
 
{{FuncDef
 
{{FuncDef
 
|ColorBarsHD ( [ int ''width'', int ''height'', string ''pixel_type'' ] )
 
|ColorBarsHD ( [ int ''width'', int ''height'', string ''pixel_type'' ] )
 +
}}<br>
 +
{{FuncDef
 +
|ColorBarsHD ( [ int ''width'', int ''height'', string ''pixel_type'', bool ''staticframes'' ] ) {{AvsPluscon}}
 
}}
 
}}
  
 
Added in v2.60, '''ColorBarsHD''' produces a video clip containing SMPTE color bars <br>
 
Added in v2.60, '''ColorBarsHD''' produces a video clip containing SMPTE color bars <br>
(Rec. ITU-R BT.709 / [http://www.arib.or.jp/english/html/overview/img/arib_std-b28v1.0_e.pdf arib std b28 v1.0]) scaled to any image size.  
+
(Rec. ITU-R BT.709 / [https://www.arib.or.jp/english/html/overview/doc/6-STD-B28v1_0-E1.pdf arib std b28 v1.0]) scaled to any image size.  
  
 
By default, a 1288×720, [[YV24]], [[#TV range|TV range]], [[ShowFrameNumber#Drop-Frame_versus_Non-Drop-Frame_Time_Code|29.97 fps]], 1 hour long clip is produced.  
 
By default, a 1288×720, [[YV24]], [[#TV range|TV range]], [[ShowFrameNumber#Drop-Frame_versus_Non-Drop-Frame_Time_Code|29.97 fps]], 1 hour long clip is produced.  
Line 40: Line 59:
  
 
:{{Par2|pixel_type|string|"YV24"}}
 
:{{Par2|pixel_type|string|"YV24"}}
::Set color format of the returned clip. Must be "YV24".
+
::Set color format of the returned clip. Must be "YV24".  
 +
::{{AvsPluscon}} "YV24" or [[Avisynthplus_color_formats|other 4:4:4 format]].
 +
 
 +
:{{Par2|staticframes|bool|true}}
 +
::{{AvsPluscon}} If set to false, generate all frames. Default true (one static frame is served)
 +
 
 +
==== A note on notation ====
 +
This page adopts the ''ITU style'' when discussing video levels which might be represented at different bit depths:
 +
<div {{BoxWidthIndent|52|2}} >
 +
{{BoldColor|blue|100|“}} To avoid confusion between 8-bit and 10-bit representations, the eight most-significant bits are considered to be an ''integer'' part while the two additional bits, if present, are considered to be
 +
''fractional'' part.
 +
 
 +
For example, the bit pattern <code>10010001</code> would be expressed as 145<sub>d</sub>, <br>
 +
whereas the pattern <code>1001000101</code> would be expressed as 145.25<sub>d</sub>.{{BoldColor|blue|100|”}}<br>
 +
 
 +
<sup>[https://www.itu.int/rec/R-REC-BT.601-7-201103-I/en ITU-R BT.601-7 (page 4)]</sup>
 +
</div>
 +
 
 +
Video levels shown below with the subscript "d" are assumed to be scaled by 2^(''bit depth''-8). <br>
 +
For example, 235<sub>d</sub> at bit depth 10 becomes 235 × 2^(10-8) =  235 × 4 = 940.
 +
 
 +
:''see {{Deep_color}}''
 +
:''see [[Avisynthplus color formats]] '' {{AvsPluscon}}
  
 
==== TV range ====
 
==== TV range ====
For both filters, in all color formats, luminance levels are [[Luminance_levels#What_are_luminance_levels.3F|TV range]], where 0 [[Wikipedia:IRE_(unit)|IRE]] "black"=16<br>
+
For both filters, in all color formats, luminance levels are [[Luminance_levels#What_are_luminance_levels.3F|TV range]], where black=16<sub>d</sub><br>
and 100 IRE "white"=235, within a total possible range of 0-255.  
+
and white=235<sub>d</sub>, within a total possible range of 0-255<sub>d</sub>.  
  
The table below show the TV-range values '''ColorBars''' generates, and those same values as they should be after converting to full range.
+
The table below show the TV-range values '''ColorBarsHD''' generates, and those same values as they should be after converting to full range.
 +
:<tt>Y<sub>full</sub> = (Y<sub>tv</sub>-16<sub>d</sub>)&nbsp; × 255<sub>d</sub>/(235<sub>d</sub>-16<sub>d</sub>) // (for R, G, B, Y)</tt>
 +
:<tt>U<sub>full</sub> = (U<sub>tv</sub>-128<sub>d</sub>) × 255<sub>d</sub>/(240<sub>d</sub>-16<sub>d</sub>) + 128<sub>d</sub> // (for U, V)</tt>
 +
 
 +
:<tt>Y<sub>tv</sub>&nbsp;&nbsp; = Y<sub>full</sub> ×  (235<sub>d</sub>-16<sub>d</sub>)/255<sub>d</sub> + 16<sub>d</sub>  // (for R, G, B, Y)</tt>
 +
:<tt>U<sub>tv</sub>&nbsp;&nbsp; = (U<sub>full</sub>-128<sub>d</sub>) × (240<sub>d</sub>-16<sub>d</sub>)/255<sub>d</sub> + 128<sub>d</sub> // (for U, V)</tt>
  
 
:{| class="wikitable"
 
:{| class="wikitable"
Line 71: Line 117:
 
|-
 
|-
 
| '''75% White'''
 
| '''75% White'''
| style="text-align:right"| 180
+
| style="text-align:right"| 180<sub>d</sub>
| style="text-align:right"| 180
+
| style="text-align:right"| 180<sub>d</sub>
| style="text-align:right"| 180
+
| style="text-align:right"| 180<sub>d</sub>
 
| style="text-align:right"|  
 
| style="text-align:right"|  
| style="text-align:right"| 180
+
| style="text-align:right"| 180<sub>d</sub>
| style="text-align:right"| 128
+
| style="text-align:right"| 128<sub>d</sub>
| style="text-align:right"| 128
+
| style="text-align:right"| 128<sub>d</sub>
 
|
 
|
| style="text-align:right"| 191
+
| style="text-align:right"| 191<sub>d</sub>
| style="text-align:right"| 191
+
| style="text-align:right"| 191<sub>d</sub>
| style="text-align:right"| 191
+
| style="text-align:right"| 191<sub>d</sub>
 
| style="text-align:right"|  
 
| style="text-align:right"|  
| style="text-align:right"| 191
+
| style="text-align:right"|191<sub>d</sub>
| style="text-align:right"| 128
+
| style="text-align:right"|128<sub>d</sub>
| style="text-align:right"| 128
+
| style="text-align:right"|128<sub>d</sub>
 
|-
 
|-
 
| '''75% Yellow'''
 
| '''75% Yellow'''
| style="text-align:right"| 180
+
| style="text-align:right"| 180<sub>d</sub>
| style="text-align:right"| 180
+
| style="text-align:right"| 180<sub>d</sub>
| style="text-align:right"| 16
+
| style="text-align:right"| 16<sub>d</sub>
 
| style="text-align:right"|  
 
| style="text-align:right"|  
| style="text-align:right"| 162
+
| style="text-align:right"|168<sub>d</sub>
| style="text-align:right"| 44
+
| style="text-align:right"|44<sub>d</sub>
| style="text-align:right"| 142
+
| style="text-align:right"|136<sub>d</sub>
 
|
 
|
| style="text-align:right"| 191
+
| style="text-align:right"| 191<sub>d</sub>
| style="text-align:right"| 191
+
| style="text-align:right"| 191<sub>d</sub>
| style="text-align:right"| 0
+
| style="text-align:right"| 0<sub>d</sub>
 
| style="text-align:right"|  
 
| style="text-align:right"|  
| style="text-align:right"| 170
+
| style="text-align:right"|177<sub>d</sub>
| style="text-align:right"| 30
+
| style="text-align:right"|32<sub>d</sub>
| style="text-align:right"| 144
+
| style="text-align:right"|137<sub>d</sub>
 
|-
 
|-
 
| '''75% Cyan'''
 
| '''75% Cyan'''
| style="text-align:right"| 16
+
| style="text-align:right"| 16<sub>d</sub>
| style="text-align:right"| 180
+
| style="text-align:right"| 180<sub>d</sub>
| style="text-align:right"| 180
+
| style="text-align:right"| 180<sub>d</sub>
 
| style="text-align:right"|  
 
| style="text-align:right"|  
| style="text-align:right"| 131
+
| style="text-align:right"|145<sub>d</sub>
| style="text-align:right"| 156
+
| style="text-align:right"|147<sub>d</sub>
| style="text-align:right"| 44
+
| style="text-align:right"| 44<sub>d</sub>
 
|
 
|
| style="text-align:right"| 0
+
| style="text-align:right"| 0<sub>d</sub>
| style="text-align:right"| 191
+
| style="text-align:right"| 191<sub>d</sub>
| style="text-align:right"| 191
+
| style="text-align:right"| 191<sub>d</sub>
 
| style="text-align:right"|  
 
| style="text-align:right"|  
| style="text-align:right"| 134
+
| style="text-align:right"|150<sub>d</sub>
| style="text-align:right"| 161
+
| style="text-align:right"|149<sub>d</sub>
| style="text-align:right"| 30
+
| style="text-align:right"|32<sub>d</sub>
 
|-
 
|-
 
| '''75% Green'''
 
| '''75% Green'''
| style="text-align:right"| 16
+
| style="text-align:right"| 16<sub>d</sub>
| style="text-align:right"| 180
+
| style="text-align:right"| 180<sub>d</sub>
| style="text-align:right"| 16
+
| style="text-align:right"| 16<sub>d</sub>
 
| style="text-align:right"|  
 
| style="text-align:right"|  
| style="text-align:right"| 112
+
| style="text-align:right"|133<sub>d</sub>
| style="text-align:right"| 72
+
| style="text-align:right"|63<sub>d</sub>
| style="text-align:right"| 58
+
| style="text-align:right"|52<sub>d</sub>
 
|
 
|
| style="text-align:right"| 0
+
| style="text-align:right"| 0<sub>d</sub>
| style="text-align:right"| 191
+
| style="text-align:right"| 191<sub>d</sub>
| style="text-align:right"| 0
+
| style="text-align:right"| 0<sub>d</sub>
 
| style="text-align:right"|  
 
| style="text-align:right"|  
| style="text-align:right"| 112
+
| style="text-align:right"|136<sub>d</sub>
| style="text-align:right"| 63
+
| style="text-align:right"|54<sub>d</sub>
| style="text-align:right"| 46
+
| style="text-align:right"|41<sub>d</sub>
 
|-
 
|-
 
| '''75% Magenta'''
 
| '''75% Magenta'''
| style="text-align:right"| 180
+
| style="text-align:right"| 180<sub>d</sub>
| style="text-align:right"| 16
+
| style="text-align:right"| 16<sub>d</sub>
| style="text-align:right"| 180
+
| style="text-align:right"| 180<sub>d</sub>
 
| style="text-align:right"|  
 
| style="text-align:right"|  
| style="text-align:right"| 84
+
| style="text-align:right"|63<sub>d</sub>
| style="text-align:right"| 184
+
| style="text-align:right"|193<sub>d</sub>
| style="text-align:right"| 198
+
| style="text-align:right"|204<sub>d</sub>
 
|
 
|
| style="text-align:right"| 191
+
| style="text-align:right"| 191<sub>d</sub>
| style="text-align:right"| 0
+
| style="text-align:right"| 0<sub>d</sub>
| style="text-align:right"| 191
+
| style="text-align:right"| 191<sub>d</sub>
 
| style="text-align:right"|  
 
| style="text-align:right"|  
| style="text-align:right"| 79
+
| style="text-align:right"|55<sub>d</sub>
| style="text-align:right"| 193
+
| style="text-align:right"|201<sub>d</sub>
| style="text-align:right"| 210
+
| style="text-align:right"|214<sub>d</sub>
 
|-
 
|-
 
| '''75% Red'''
 
| '''75% Red'''
| style="text-align:right"| 180
+
| style="text-align:right"| 180<sub>d</sub>
| style="text-align:right"| 16
+
| style="text-align:right"| 16<sub>d</sub>
| style="text-align:right"| 16
+
| style="text-align:right"| 16<sub>d</sub>
 
| style="text-align:right"|  
 
| style="text-align:right"|  
| style="text-align:right"| 65
+
| style="text-align:right"|51<sub>d</sub>
| style="text-align:right"| 100
+
| style="text-align:right"|109<sub>d</sub>
| style="text-align:right"| 212
+
| style="text-align:right"| 212<sub>d</sub>
 
|
 
|
| style="text-align:right"| 191
+
| style="text-align:right"| 191<sub>d</sub>
| style="text-align:right"| 0
+
| style="text-align:right"| 0<sub>d</sub>
| style="text-align:right"| 0
+
| style="text-align:right"| 0<sub>d</sub>
 
| style="text-align:right"|  
 
| style="text-align:right"|  
| style="text-align:right"| 57
+
| style="text-align:right"|41<sub>d</sub>
| style="text-align:right"| 95
+
| style="text-align:right"|106<sub>d</sub>
| style="text-align:right"| 226
+
| style="text-align:right"|223<sub>d</sub>
 
|-
 
|-
| '''75% Bue'''
+
| '''75% Blue'''
| style="text-align:right"| 16
+
| style="text-align:right"| 16<sub>d</sub>
| style="text-align:right"| 16
+
| style="text-align:right"| 16<sub>d</sub>
| style="text-align:right"| 180
+
| style="text-align:right"| 180<sub>d</sub>
 
| style="text-align:right"|  
 
| style="text-align:right"|  
| style="text-align:right"| 35
+
| style="text-align:right"|28<sub>d</sub>
| style="text-align:right"| 212
+
| style="text-align:right"| 212<sub>d</sub>
| style="text-align:right"| 114
+
| style="text-align:right"|120<sub>d</sub>
 
|
 
|
| style="text-align:right"| 0
+
| style="text-align:right"| 0<sub>d</sub>
| style="text-align:right"| 0
+
| style="text-align:right"| 0<sub>d</sub>
| style="text-align:right"| 191
+
| style="text-align:right"| 191<sub>d</sub>
 
| style="text-align:right"|  
 
| style="text-align:right"|  
| style="text-align:right"| 22
+
| style="text-align:right"|14<sub>d</sub>
| style="text-align:right"| 226
+
| style="text-align:right"|223<sub>d</sub>
| style="text-align:right"| 112
+
| style="text-align:right"|118<sub>d</sub>
 
|}
 
|}
These colors are at "75%" of maximum, per common broadcast practice. <br>
+
<div {{NotaBeneWidthIndent|58|2}} >
You may occasionally see "100%" color bars.<sup>[http://trac.ffmpeg.org/wiki/FilteringGuide#multipleinputoverlayin2x2grid]</sup>  
+
These colors are at "75%" of maximum, per common broadcast practice. You may occasionally see "100%" color bars.<sup>[http://trac.ffmpeg.org/wiki/FilteringGuide#multipleinputoverlayin2x2grid]</sup> They are rather useless, as you cannot detect gain or saturation that is too high on a signal that is already at maximum.
 +
</div>
  
 
==== PLUGE ====
 
==== PLUGE ====
 
The lower part of the frame is called the [[Wikipedia:Picture_line-up_generation_equipment|PLUGE]] (also lowercase: "pluge") signal. <br>
 
The lower part of the frame is called the [[Wikipedia:Picture_line-up_generation_equipment|PLUGE]] (also lowercase: "pluge") signal. <br>
From left to right it consists of: [[Wikipedia:YIQ|-I]], white, [[Wikipedia:YIQ|+Q]], then a series of black and near-black bars: 0, -4, 0, +4 and 0 [[Wikipedia:IRE_(unit)|IRE]].  
+
From left to right it consists of: [[Wikipedia:YIQ|-I]], white, [[Wikipedia:YIQ|+Q]], then a series of black and near-black bars: 0, -4, 0, +4 and 0 [[Wikipedia:IRE_(unit)|IRE]] relative to black.  
 +
 
 +
<div {{NotaBeneWidthIndent|58|2}} >
 +
'''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.
 +
</div>
  
 
<div {{NotaBeneWidthIndent|54|2}} >
 
<div {{NotaBeneWidthIndent|54|2}} >
Line 225: Line 276:
 
|-
 
|-
 
| '''-I'''
 
| '''-I'''
| style="text-align:right"|0
+
| style="text-align:right"|0<sub>d</sub>
| style="text-align:right"|58
+
| style="text-align:right"|58<sub>d</sub>
| style="text-align:right"|98
+
| style="text-align:right"|98<sub>d</sub>
 
|
 
|
| style="text-align:right"|16
+
| style="text-align:right"|16<sub>d</sub>
| style="text-align:right"|158
+
| style="text-align:right"|158<sub>d</sub>
| style="text-align:right"|95
+
| style="text-align:right"|95<sub>d</sub>
 
|
 
|
| style="text-align:right"|-19
+
| style="text-align:right"|-19<sub>d</sub>
| style="text-align:right"|49
+
| style="text-align:right"|49<sub>d</sub>
| style="text-align:right"|95
+
| style="text-align:right"|95<sub>d</sub>
 
|
 
|
| style="text-align:right"|0
+
| style="text-align:right"|0<sub>d</sub>
| style="text-align:right"|168
+
| style="text-align:right"|162<sub>d</sub>
| style="text-align:right"|90
+
| style="text-align:right"|90<sub>d</sub>
 
|-
 
|-
 
| '''100% White'''
 
| '''100% White'''
| style="text-align:right"|235
+
| style="text-align:right"|235<sub>d</sub>
| style="text-align:right"|235
+
| style="text-align:right"|235<sub>d</sub>
| style="text-align:right"|235
+
| style="text-align:right"|235<sub>d</sub>
 
|
 
|
| style="text-align:right"|235
+
| style="text-align:right"|235<sub>d</sub>
| style="text-align:right"|128
+
| style="text-align:right"|128<sub>d</sub>
| style="text-align:right"|128
+
| style="text-align:right"|128<sub>d</sub>
 
|
 
|
| style="text-align:right"|255
+
| style="text-align:right"|255<sub>d</sub>
| style="text-align:right"|255
+
| style="text-align:right"|255<sub>d</sub>
| style="text-align:right"|255
+
| style="text-align:right"|255<sub>d</sub>
 
|
 
|
| style="text-align:right"|255
+
| style="text-align:right"|255<sub>d</sub>
| style="text-align:right"|128
+
| style="text-align:right"|128<sub>d</sub>
| style="text-align:right"|128
+
| style="text-align:right"|128<sub>d</sub>
 
|-
 
|-
 
| '''+Q'''
 
| '''+Q'''
| style="text-align:right"|59
+
| style="text-align:right"|59<sub>d</sub>
| style="text-align:right"|15
+
| style="text-align:right"|15<sub>d</sub>
| style="text-align:right"|126
+
| style="text-align:right"|126<sub>d</sub>
 
|
 
|
| style="text-align:right"|16
+
| style="text-align:right"|16<sub>d</sub>
| style="text-align:right"|174
+
| style="text-align:right"|174<sub>d</sub>
| style="text-align:right"|149
+
| style="text-align:right"|149<sub>d</sub>
 
|
 
|
| style="text-align:right"|50
+
| style="text-align:right"|50<sub>d</sub>
| style="text-align:right"|-1
+
| style="text-align:right"|-1<sub>d</sub>
| style="text-align:right"|128
+
| style="text-align:right"|128<sub>d</sub>
 
|
 
|
| style="text-align:right"|0
+
| style="text-align:right"|0<sub>d</sub>
| style="text-align:right"|182
+
| style="text-align:right"|180<sub>d</sub>
| style="text-align:right"|152
+
| style="text-align:right"|151<sub>d</sub>
 
|-
 
|-
| '''0 IRE''' (Black)
+
| Black
| style="text-align:right"|16
+
| style="text-align:right"|16<sub>d</sub>
| style="text-align:right"|16
+
| style="text-align:right"|16<sub>d</sub>
| style="text-align:right"|16
+
| style="text-align:right"|16<sub>d</sub>
 
|
 
|
| style="text-align:right"|16
+
| style="text-align:right"|16<sub>d</sub>
| style="text-align:right"|128
+
| style="text-align:right"|128<sub>d</sub>
| style="text-align:right"|128
+
| style="text-align:right"|128<sub>d</sub>
 
|
 
|
| style="text-align:right"|0
+
| style="text-align:right"|0<sub>d</sub>
| style="text-align:right"|0
+
| style="text-align:right"|0<sub>d</sub>
| style="text-align:right"|0
+
| style="text-align:right"|0<sub>d</sub>
 
|
 
|
| style="text-align:right"|0
+
| style="text-align:right"|0<sub>d</sub>
| style="text-align:right"|128
+
| style="text-align:right"|128<sub>d</sub>
| style="text-align:right"|128
+
| style="text-align:right"|128<sub>d</sub>
 
|-
 
|-
 
| '''-4 IRE'''
 
| '''-4 IRE'''
| style="text-align:right"|7
+
| style="text-align:right"|7<sub>d</sub>
| style="text-align:right"|7
+
| style="text-align:right"|7<sub>d</sub>
| style="text-align:right"|7
+
| style="text-align:right"|7<sub>d</sub>
 
|
 
|
| style="text-align:right"|7
+
| style="text-align:right"|7<sub>d</sub>
| style="text-align:right"|128
+
| style="text-align:right"|128<sub>d</sub>
| style="text-align:right"|128
+
| style="text-align:right"|128<sub>d</sub>
 
|
 
|
| style="text-align:right"|-10
+
| style="text-align:right"|-10<sub>d</sub>
| style="text-align:right"|-10
+
| style="text-align:right"|-10<sub>d</sub>
| style="text-align:right"|-10
+
| style="text-align:right"|-10<sub>d</sub>
 
|
 
|
| style="text-align:right"|-10
+
| style="text-align:right"|-10<sub>d</sub>
| style="text-align:right"|128
+
| style="text-align:right"|128<sub>d</sub>
| style="text-align:right"|128
+
| style="text-align:right"|128<sub>d</sub>
 
|-
 
|-
| '''0 IRE''' (Black)
+
| Black
| style="text-align:right"|16
+
| style="text-align:right"|16<sub>d</sub>
| style="text-align:right"|16
+
| style="text-align:right"|16<sub>d</sub>
| style="text-align:right"|16
+
| style="text-align:right"|16<sub>d</sub>
 
|
 
|
| style="text-align:right"|16
+
| style="text-align:right"|16<sub>d</sub>
| style="text-align:right"|128
+
| style="text-align:right"|128<sub>d</sub>
| style="text-align:right"|128
+
| style="text-align:right"|128<sub>d</sub>
 
|
 
|
| style="text-align:right"|0
+
| style="text-align:right"|0<sub>d</sub>
| style="text-align:right"|0
+
| style="text-align:right"|0<sub>d</sub>
| style="text-align:right"|0
+
| style="text-align:right"|0<sub>d</sub>
 
|
 
|
| style="text-align:right"|0
+
| style="text-align:right"|0<sub>d</sub>
| style="text-align:right"|128
+
| style="text-align:right"|128<sub>d</sub>
| style="text-align:right"|128
+
| style="text-align:right"|128<sub>d</sub>
 
|-
 
|-
 
| '''+4 IRE'''
 
| '''+4 IRE'''
| style="text-align:right"|25
+
| style="text-align:right"|25<sub>d</sub>
| style="text-align:right"|25
+
| style="text-align:right"|25<sub>d</sub>
| style="text-align:right"|25
+
| style="text-align:right"|25<sub>d</sub>
 
|
 
|
| style="text-align:right"|25
+
| style="text-align:right"|25<sub>d</sub>
| style="text-align:right"|128
+
| style="text-align:right"|128<sub>d</sub>
| style="text-align:right"|128
+
| style="text-align:right"|128<sub>d</sub>
 
|
 
|
| style="text-align:right"|10
+
| style="text-align:right"|10<sub>d</sub>
| style="text-align:right"|10
+
| style="text-align:right"|10<sub>d</sub>
| style="text-align:right"|10
+
| style="text-align:right"|10<sub>d</sub>
 
|
 
|
| style="text-align:right"|10
+
| style="text-align:right"|10<sub>d</sub>
| style="text-align:right"|128
+
| style="text-align:right"|128<sub>d</sub>
| style="text-align:right"|128
+
| style="text-align:right"|128<sub>d</sub>
 
|-
 
|-
| '''0 IRE''' (Black)
+
| Black
| style="text-align:right"|16
+
| style="text-align:right"|16<sub>d</sub>
| style="text-align:right"|16
+
| style="text-align:right"|16<sub>d</sub>
| style="text-align:right"|16
+
| style="text-align:right"|16<sub>d</sub>
 
|
 
|
| style="text-align:right"|16
+
| style="text-align:right"|16<sub>d</sub>
| style="text-align:right"|128
+
| style="text-align:right"|128<sub>d</sub>
| style="text-align:right"|128
+
| style="text-align:right"|128<sub>d</sub>
 
|
 
|
| style="text-align:right"|0
+
| style="text-align:right"|0<sub>d</sub>
| style="text-align:right"|0
+
| style="text-align:right"|0<sub>d</sub>
| style="text-align:right"|0
+
| style="text-align:right"|0<sub>d</sub>
 
|
 
|
| style="text-align:right"|0
+
| style="text-align:right"|0<sub>d</sub>
| style="text-align:right"|128
+
| style="text-align:right"|128<sub>d</sub>
| style="text-align:right"|128
+
| style="text-align:right"|128<sub>d</sub>
 
|-
 
|-
 
|style="text-align:right;line-height=70%" colspan="16"|''(negative values will be clipped to 0)''
 
|style="text-align:right;line-height=70%" colspan="16"|''(negative values will be clipped to 0)''
 
|}
 
|}
 
"100% White" could also be called "100 IRE White."
 
  
 
The -I and +Q bars are vestigial artifacts of NTSC analog TV and are not really used any more.
 
The -I and +Q bars are vestigial artifacts of NTSC analog TV and are not really used any more.
  
 
<div {{NotaBeneWidthIndent|58|2}} >
 
<div {{NotaBeneWidthIndent|58|2}} >
The -4, 0 and +4 IRE bars can be used to set your monitor brightness &ndash; ''assuming'' your playback chain expands [[Luminance_levels#What_are_luminance_levels.3F|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.<sup>[http://www.spearsandmunsil.com/portfolio/setting-the-brightness-control-2]</sup>
+
The -4, 0 and +4 IRE bars can be used to set your monitor brightness &ndash; ''assuming'' your playback chain expands [[Luminance_levels#What_are_luminance_levels.3F|TV range]] (16<sub>d</sub>-235<sub>d</sub>) to full-range (0-255<sub>d</sub>) 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.<sup>[http://www.spearsandmunsil.com/portfolio/setting-the-brightness-control-2]</sup>
 
</div>
 
</div>
  
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.
+
Note, the pluge signal goes out of 16-235<sub>d</sub> range in the -I and the -4 bars. These cannot be accurately converted to 0-255<sub>d</sub> range.
  
 
More information about the colorbars and the PLUGE can be found on the [[ColorBars_theory|colorbars theory]] page.
 
More information about the colorbars and the PLUGE can be found on the [[ColorBars_theory|colorbars theory]] page.
  
 
==== Audio ====
 
==== Audio ====
For both filters, an audio [[Tone|'''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 [[Wikipedia:DBFS|0 dBFS]].  
+
For both filters, an audio [[Tone|'''tone''']] is also generated. The tone is a 440Hz sine at 48KHz sample rate, 32 bit (Float), stereo. The tone pulses in the right speaker, being turned on and off once every second. Level is [[Wikipedia:DBFS|0 dBFS]].  
  
 
You can use [[Amplify]] to set a softer level (0dB can be a little deafening!)
 
You can use [[Amplify]] to set a softer level (0dB can be a little deafening!)

Latest revision as of 19:19, 17 September 2022

AviSynth+
Up-to-date documentation: https://avisynthplus.readthedocs.io


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)

[edit] A note on notation

This page adopts the ITU style when discussing video levels which might be represented at different bit depths:

To avoid confusion between 8-bit and 10-bit representations, the eight most-significant bits are considered to be an integer part while the two additional bits, if present, are considered to be fractional part.

For example, the bit pattern 10010001 would be expressed as 145d,
whereas the pattern 1001000101 would be expressed as 145.25d.

ITU-R BT.601-7 (page 4)

Video levels shown below with the subscript "d" are assumed to be scaled by 2^(bit depth-8).
For example, 235d at bit depth 10 becomes 235 × 2^(10-8) = 235 × 4 = 940.

see Deep Color
see Avisynthplus color formats AVS+

[edit] TV range

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

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-16d)  × 255d/(235d-16d) // (for R, G, B, Y)
Ufull = (Utv-128d) × 255d/(240d-16d) + 128d // (for U, V)
Ytv   = Yfull × (235d-16d)/255d + 16d // (for R, G, B, Y)
Utv   = (Ufull-128d) × (240d-16d)/255d + 128d // (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 180d 180d 180d 180d 128d 128d 191d 191d 191d 191d 128d 128d
75% Yellow 180d 180d 16d 168d 44d 136d 191d 191d 0d 177d 32d 137d
75% Cyan 16d 180d 180d 145d 147d 44d 0d 191d 191d 150d 149d 32d
75% Green 16d 180d 16d 133d 63d 52d 0d 191d 0d 136d 54d 41d
75% Magenta 180d 16d 180d 63d 193d 204d 191d 0d 191d 55d 201d 214d
75% Red 180d 16d 16d 51d 109d 212d 191d 0d 0d 41d 106d 223d
75% Blue 16d 16d 180d 28d 212d 120d 0d 0d 191d 14d 223d 118d

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.

[edit] 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 0d 58d 98d 16d 158d 95d -19d 49d 95d 0d 162d 90d
100% White 235d 235d 235d 235d 128d 128d 255d 255d 255d 255d 128d 128d
+Q 59d 15d 126d 16d 174d 149d 50d -1d 128d 0d 180d 151d
Black 16d 16d 16d 16d 128d 128d 0d 0d 0d 0d 128d 128d
-4 IRE 7d 7d 7d 7d 128d 128d -10d -10d -10d -10d 128d 128d
Black 16d 16d 16d 16d 128d 128d 0d 0d 0d 0d 128d 128d
+4 IRE 25d 25d 25d 25d 128d 128d 10d 10d 10d 10d 128d 128d
Black 16d 16d 16d 16d 128d 128d 0d 0d 0d 0d 128d 128d
(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 (16d-235d) to full-range (0-255d) 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-235d range in the -I and the -4 bars. These cannot be accurately converted to 0-255d range.

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

[edit] Audio

For both filters, an audio tone is also generated. The tone is a 440Hz sine at 48KHz sample rate, 32 bit (Float), 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.

[edit] 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.

[edit] Changes

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