Log in

View Full Version : bug? colorbars wrong levels in yuy2


hanfrunz
5th April 2004, 22:34
Hello,
i just had a little time to work on my vectorscope-filter. I checked the internal ColorBars() function and it seems that the levels converted to yuy2 are not right! There are about 60% saturated, but it should be 75%. I cannot find the document, where the yuv-levels were defined, so maybe anyone could check that? If i use the internal colorbars of my dv-cam everything is in the markers...

hanfrunz

sh0dan
6th April 2004, 10:14
The colorbar values are very old - probably BenRG stuff. There is a comment:
// these values are taken from http://www.greatdv.com/video/smptebars3.htm

Could you supply some correct values? Perhaps YUV-values would be good?

trevlac
6th April 2004, 16:32
Here is a nice source for colorbar info.
http://www.video-demystified.com/mm/tutor/ch03.pdf

Page 18 specifies what YCbCr 75% intensity bars should be for 601 and 709. This does not include the pluge info, which is difficult because the RGB conversion clamping messes up the blacker than black. Of course this is an NTSC thing, so maybe few are concerned. The other parts (Q & I) are a bit useless.

Also, I found that Adam Wilt has bars that are fairly spot on.
http://www.adamwilt.com/ColorBars.html

You need a dv codec to decompress the avi.

I believe the built in bars are in RGB format where the nominal range runs from 16-235. The following would 'correct' them so they appear as 75%.

ColorBars(640,480)
ConvertToYUY2()
ColorYUV(levels="TV->PC")

You would of course loose the pluge (if you view them in PC RGB), and the conversions throw the bars off a bit.

Personally, I use a simple script to make my own:

black = BlankClip(width=80,height=240,length=300, color=$000000)
white = BlankClip(width=80,height=240,length=300, color=$BFBFBF)
yellow = BlankClip(width=80,height=240,length=300, color=$BFBF00)
cyan = BlankClip(width=80,height=240,length=300, color=$00BFBF)
green = BlankClip(width=80,height=240,length=300, color=$00BF00)
magenta = BlankClip(width=80,height=240,length=300, color=$BF00BF)
red = BlankClip(width=80,height=240,length=300, color=$BF0000)
blue = BlankClip(width=80,height=240,length=300, color=$0000BF)
set1 = StackHorizontal(black,white,yellow,cyan,green,magenta,red,blue)
set2 = StackHorizontal(black,blue,red, magenta,green, cyan, yellow,white)
stackVertical(set1,set2)

Steve56
31st May 2004, 01:03
@ trevlac:
I created a Color Bars script after your example. I made it a composition of a RGB0-255->YCbCr and a RGB16-235->YCbCr conversion. That made it possible to integrate the "pluge" as well.

Right after finishing I found out that:
ColorBars(640,480
ConvertToYUY2()
ColorYUV(levels="TV->PC")shows the same YUV values as my version. I take this as an indicator that the values are not so wrong. ;-) Anyways here is the Script, hope it can be of some use:
# SMPTE Color Bars for YCbCr Color Systems (PAL version)
#
# All pattern sizes are multiple of 2, so color interpolation between
# adjacent areas shouldn't occur (especially for DV 4:2:0 YUV video)
#
# First Row
# 75% Color Bars (RGB235 values)
white = BlankClip(width=104, height=384, length=300, color=$BFBFBF)
yellow = BlankClip(width=102, height=384, length=300, color=$BFBF00)
cyan = BlankClip(width=102, height=384, length=300, color=$00BFBF)
green = BlankClip(width=104, height=384, length=300, color=$00BF00)
magenta = BlankClip(width=102, height=384, length=300, color=$BF00BF)
red = BlankClip(width=102, height=384, length=300, color=$BF0000)
blue = BlankClip(width=104, height=384, length=300, color=$0000BF)

# Second Row
# Alternate 75% with Black Pattern (RGB235 values)
blue2 = BlankClip(width=104, height=48, length=300, color=$0000BF)
black2a = BlankClip(width=102, height=48, length=300, color=$000000)
magenta2 = BlankClip(width=102, height=48, length=300, color=$BF00BF)
black2b = BlankClip(width=104, height=48, length=300, color=$000000)
cyan2 = BlankClip(width=102, height=48, length=300, color=$00BFBF)
white2 = BlankClip(width=104, height=48, length=300, color=$BFBFBF)

# Third Row
# RGB255 -> RGB235 -> Y235 (RGB255 values)
whitemax = BlankClip(width=388, height=144, length=300, color=$FFFFFF)
darkgray = BlankClip(width=34, height=144, length=300, color=$090909)
black3a = BlankClip(width=194, height=144, length=300, color=$000000)
black3b = BlankClip(width=104, height=144, length=300, color=$000000)

# Arrange Patterns per Row
set1 = StackHorizontal(white, yellow, cyan, green, magenta, red, blue)
set2 = StackHorizontal(blue2, black2a, magenta2, black2b, cyan2, black2a, white2)
set3 = StackHorizontal(whitemax, black3a, darkgray, black3b)

# Stack 3 Rows
SMPTE = StackVertical(set1, set2, set3).ConvertToYUY2()

# Create Patterns which are below 16,16,16 in RGB16-235
I = BlankClip(width=130, height=144, length=300, color=$001D42) \
.ConvertToYUY2().ColorYUV(Levels="TV->PC")

Q = BlankClip(width=130, height=144, length=300, color=$2C005C) \
.ConvertToYUY2().ColorYUV(Levels="TV->PC")

superblack = BlankClip(width=34, height=144, length=300, color=$070707) \
.ConvertToYUY2().ColorYUV(Levels="TV->PC")

# Overlay below of 16,16,16 RGB16-235 Patterns
Overlay(SMPTE, I, x=0, y=432)
Overlay(Q, x=258, y=432)
Overlay(superblack, x=514, y=432)BTW, A nice AviSynth plugin to verify the values is ShowPixelValues!
Get it here: http://www.geocities.com/siwalters_uk/fnews.html

Steve56

trevlac
31st May 2004, 04:37
Good for you Steve. I'll give your script a try. :)