Log in

View Full Version : A question about Levels and Histogram


taudule
5th January 2004, 11:12
Hello everyone and happy new year.

Can someone enlighten me about this :

For codec testing purpose, With PainshotPro, i build a bmp image with four squares, one pure black (0,0,0), one light black(16,16,16), one pure white(255,255,255), and one near white(235,235,235).
Then, with premiere, i build a 1 second avi using HUFYUV codec, with the option "Convert to YUY2" of HUFYUV checked.

Then i open the avi with this script :

AviSource("FourSquares.avi", pixel_type="YUY2")
ColorYuv(analyze=true)
ConvertToYV12()
Histogram("luma")

This is what i get:
http://odeon.hosteur.com/PbLevels.jpg

If you pick colors with some graphic tool, black is 0,0,0, white is 253,253,253.

Why then ColorYuv() and Histogram() tell that it's 16 and 235 ?

O.

mf
5th January 2004, 11:38
Something's probably been converting to TV range :). I heard ColorYUV can undo this.

sh0dan
5th January 2004, 11:39
Search for CCIR 601.

CCIR 601 luma scale is 16->235, with the outside values being "superblack"/"superwhite".

The brown areas in the histogram show the invalid areas.

Furthermore don't expect a RGB->YUV->RGB conversion to be exact. This is why conversions aren't recommended.

taudule
5th January 2004, 12:02
Thank you for your quick reply.

I Searched "CCIR 601", found that link :
http://www.fourcc.org/fccyvrgb.php
I made an excel sheet with the formulas,
and understood...

Still there's a question : who does the second conversion here (YUV -> RGB) ?
It is done only for display purpose, am i right ?

O.

sh0dan
5th January 2004, 12:48
ColorYUV and Histogram operates in YUV colorspace. The values they display are YUV and not RGB.

The YUV is converted by a codec (probably DivX, XviD or ffvfw) - look in Vdub, File/File Information - this will display the decompressor.



btw - the link you supplied attempts to install some Dialer.

taudule
5th January 2004, 13:25
Sorry for the bad link. Should be OK now.
O.