View Full Version : Levels mapping for DV
neily
29th September 2004, 00:54
Hi,
I'm getting greatly confused whilst trying to process some DV footage, the ultimate target being DVD MPEG2. It seems that though the format is YUV 4:2:0, it is normal for the luminance range to be 16-255. Now, having played around with some codecs, in decompression there are 3 routes taken. Some decompress 16-235 to 0-255, some do 16-255 to 0-255, and some do 0-255 to 0-255.
These all look profoundly different. The first has washed out highlights, the second preserves the dynamic range, but darkens the output, and the third loses some of the dynamic range.
My 3 questions are:
1. What is the normal route for people to take?
2. Using ColorYUV, how do I do a simple Y remapping of 16-255 to 0-255 and 16-235?
3. Any chance of extending the levels option to include "DV" as well as "PC" and "TV" (i.e. 6 options rather than the current 2)?
zambelli
29th September 2004, 03:24
Are you sure your luminance range isn't 16-255 simply because your camera didn't register anything darker than Y=16? I don't think a 16-255 Y range is typical of DV in general; certainly not from my experience.
Unless you're planning on converting to RGB at any point in your editing (i.e. Premiere, TMPGEnc, VirtualDub filters), I think you should just keep your levels as is. However, if you're planning on converting to RGB, convert your levels "PC->TV" first. When you're done with your RGB work, convert back to "TV->PC" (or you can skip that step if your MPEG encoder knows how to expand lum range too).
Si
29th September 2004, 21:55
I was told some time ago (by people who said they knew) that although DV luminance should be 16-235, cameras exceed this range in practice when actually recording to tape.
Avisynth's native range is 16-235 and I believe DVD MPEG-2 is as well.
So if your clip is in YUV colourspace and ColourYUV is reporting xxx-yyy I'd suggest using:-
Levels(xxx,1,yyy,16,235,coring=false)
which should "normalise" it.
regards
Simon
zambelli
30th September 2004, 01:07
There is no right or wrong range for YUV. However, there is a broadcast standard out there called CCIR-601 which says 16 should be black and 235 should be white. According to Wikipedia, "In each 8-bit luminance sample, the value 16 is used for black and 235 for white, to allow for overshoot and undershoot. The values 0 and 255 are used for sync encoding." The idea is that no one should ever record or broadcast video with luma <16 and >235. I once heard that any TV station broadcasting outside this range risks getting shutdown by the FCC. Not sure if that's true or not. :)
However, apparently the standard isn't very well enforced among camera manufacturers (is it because most of them are in Japan? :)) because DV cams often use the full YUV luma range (both my MiniDV and D8 cams do this). There is nothing wrong with this, actually. However, most TVs can't or won't display superblack and superwhite values, so it's kind of pointless.
I disagree that 16-235 is the "native range" of Avisynth or any codec for that matter. Any codec operating in the YUV space can and will use the full luma range when needed. However, converting from RGB to YUV will always result in a 16-235 range unless there is additional luma expanding being done. This is just the nature of RGB - YUV conversions. There is nothing inherently "wrong" with that either.
Compressing luma to 16-235 is not a bad idea, but be aware that if you ever find a display device that uses the full luma range (maps its blackest level to Y=0), compressed clips will look washed out compared to full range clips. I think either range works just as well... as long as you stay consistent within the same video.
Video Dude
30th September 2004, 03:04
From the DV section, in the DV to DVD guide comment thread:
http://forum.doom9.org/showthread.php?postid=550039#post550039
Wilbert
30th September 2004, 09:36
I disagree that 16-235 is the "native range" of Avisynth or any codec for that matter. Any codec operating in the YUV space can and will use the full luma range when needed. However, converting from RGB to YUV will always result in a 16-235 range unless there is additional luma expanding being done. This is just the nature of RGB - YUV conversions. There is nothing inherently "wrong" with that either.
You are wrong here. Many codecs (XviD, DivX, ffvfw) assume 16-235 YUV. The values 0-16 and 235-255 will be clipped (ie rounded) to 16 and 235 during decoding (ie YUV -> RGB).
However, converting from RGB to YUV will always result in a 16-235 range unless there is additional luma expanding being done.
It's the other way around. Most codecs scale luma 0-255 -> 16-235 during the conversion.
There's are also codecs who keep the luma range (some of the dv/mjpeg codecs).
Compressing luma to 16-235 is not a bad idea, but be aware that if you ever find a display device that uses the full luma range (maps its blackest level to Y=0), compressed clips will look washed out compared to full range clips.
afaik, video should always be converted to RGB, regards of the display device.
Si
30th September 2004, 20:03
I disagree that 16-235 is the "native range" of Avisynth or any codec for that matter.
Well I believe you are wrong. A lot of Avisynth filters expect a luma range of 16-235 and quite a few actually clamp to that range. Y=16 to 235 is the way to bet in Avisynth - trust me -I'm a filter writer:)
Any codec operating in the YUV space can and will use the full luma range when needed
Could be true in most cases
However, converting from RGB to YUV will always result in a 16-235 range unless there is additional luma expanding being done. This is just the nature of RGB - YUV conversions.
I think something's being lost in translation here :)
regards
Simon
neily
1st October 2004, 00:27
Thanks for the replies. My original proposition of a 16-255 luminance range was based on the DV Faq (http://www.adamwilt.com/DV.html) and that I found for the Matrox VFW DV codec there are settings for mapping DV YUV to output RGB of 16-235 to 0-255 ('Standard'), 0-255 to 0-255 ('Extended') and 16-255 to 0-255 ('DV Compliant'). Compared to other DV codecs, at least you have the option. Others limit you to either the equivalents of the 'Standard' or 'Extended' options.
By having a look at the source code I did manage to suss how the parameters of ColorYUV work.
I certainly believe that my camcorder does record differentiated luminance > 235. How to handle it is not easy. What looks OK on my PC looks very different to my TV and to other people's TV's.
It is possible using the offset, contrast and gamma settings of ColorYUV to map 16/127/255 to 16/~127/235 and preserve the mean luminance, but I didn't want to mess around with the source levels too much.
Damn. I just wish I could decide on one method and get down to actually producing some DVD's for my family rather than just messing around.
hartford
1st October 2004, 01:21
For your consideration:
My video card has video-out. In the past, I've connected it to
a TV and played short, encoded clips through it to test settings.
Might be less stressful to get such a capable card :-/
zambelli
1st October 2004, 09:23
Originally posted by Wilbert
You are wrong here. Many codecs (XviD, DivX, ffvfw) assume 16-235 YUV. The values 0-16 and 235-255 will be clipped (ie rounded) to 16 and 235 during decoding (ie YUV -> RGB).
My point is simply that any codec that operates in YUV can store the full luma range, and if it supports YUV output, it can also output the full luma range. I'm not aware of any codec that completely ignores all luma values 0-16 and 235-255 while operating in YUV space.
Originally posted by Wilbert
It's the other way around. Most codecs scale luma 0-255 -> 16-235 during the conversion.
[/B]
Well, I was thinking of CCIR-601 and NTSC. According to the CCIR-601 (ITU-601) definition, in an 8-bit luminance sample black IS 16. In RGB world, black IS #000000.
Originally posted by Wilbert
afaik, video should always be converted to RGB, regards of the display device. [/B]
You're right. Display devices work in RGB. However, most video is transported to the TV in YUV form (s-video, component, etc.) so a YUV->RGB conversion is necessary before the video is actually displayed. During that last conversion, does the video's luma range get compressed or clipped? Sure, there is a standard, but do all display devices respect it?
Wilbert
1st October 2004, 10:06
My point is simply that any codec that operates in YUV can store the full luma range, and if it supports YUV output, it can also output the full luma range.
Yes, ok. I didn't imply otherwise (I hope).
Well, I was thinking of CCIR-601 and NTSC. According to the CCIR-601 (ITU-601) definition, in an 8-bit luminance sample black IS 16. In RGB world, black IS #000000.
Yes, I know. So, [16,235]->[0,255] (in YUV-RGB) is luma scaling right?
However, most video is transported to the TV in YUV form (s-video, component, etc.) so a YUV->RGB conversion is necessary before the video is actually displayed. During that last conversion, does the video's luma range get compressed or clipped
I'm not sure what you mean here. You are playing a YUV stream (which is encoded as [0,255] here) on your TV using the tv-out (so no YUV->RGB conversion). Your question is what happens to the luma range?
vinetu
3rd October 2004, 11:19
I'm not sure what you mean here.
I guess zambelli mean YUV->RGB convertion inside the display
device.
And one question in same direction:
Some of the projector models have 1000~2000:1 contrast ratio,
so how a DV footage will be displayed in that case (a conversion 235->1000?) ?
Regards
Wilbert
3rd October 2004, 23:11
And one question in same direction:
Some of the projector models have 1000~2000:1 contrast ratio,
so how a DV footage will be displayed in that case (a conversion 235->1000?) ?
I have no idea. Do you have a link to such a projector?
vinetu
9th October 2004, 22:57
Sorry for the delay!
Here are some links:
BenQ (http://www.techadvice.com/help/Products/P/projectors.asp)
PLUS Vision Corporation of America (http://www.projectorcentral.com/news_story_481.htm)
NEC - VSD (http://www.programmersparadise.com/Product.pasp?txtCatalog=Paradise&txtCategory=&txtProductID=ZHI+560359)
various (http://www.projectorpeople.com/hometheater/all-ht-projectors.asp?sort=price) - look at SONY Cineza VPL-HS51 (http://www.projectorpeople.com/hometheater/projdtls.asp?itemid=19029&itmname=Sony+Cineza+VPL%2DHS51)
Regards
Wilbert
9th October 2004, 23:15
I don't get it yet, but found the following link:
http://www.hometheatermag.com/frontprojectors/704dlp/index2.html
Believe it or not, contrast ratio is not the only thing you need to know about a projector. Like any measurement, it shouldn't be taken alone; in many cases, it shouldn't be taken at all. The human eye can, at best, discern a contrast ratio of a few hundred to one. So, even a display with a claimed 800:1 contrast ratio has more than enough contrast to appease the eye. There's more to it than that, but that's a discussion for another article.
So, what's with a contrast ratio of 2,000:1 or even 3,000:1? Well, it's misleading at best and a lie at worst. Unlike most product stats, there's no regulation for how a company measures a display's contrast ratio. One company could measure a full-white field versus a 0-IRE signal, while another company could use a 100-IRE window versus no signal at all. The American National Standards Institute (ANSI) has defined one relatively reasonable method that many manufacturers use, but it is by no means mandatory.
From this point on in our display reviews, we're going to cut though all of that and offer you a series of measurements consisting of contrast ratio, lowest and highest light level, and ANSI contrast all in one section. Don't worry, we'll still include the color-temperature and color-gamut graphs we've given you all along.
Decoding the New Measurements
For our reviews, we will define contrast ratio as the ratio of the light level produced by a 100-IRE full field divided by the light level produced by a 0-IRE full field. The number inside the black box is the total light output (in foot-lamberts) that the display produces when supplied with a 0-IRE signal from a DVD (see the measurement numbers in this feature). This represents the darkest the display will get when it's active and fed a signal; it should be as close to zero as possible. With projectors, we use a Da-Lite Da-Mat 1.0-gain screen that measures 87 by 49 inches (93 inches diagonal). If a display has good DC restoration, the measured black level will be similar to the black level the display produces when there's other video material on the screen.
example (see end of link): HT Labs Measures: InFocus 7205 DLP Projector
Using a full-field 100-IRE white (22.37 ft-L) and a full-field 0-IRE black (0.022 ft-L), the contrast ratio was 1,017:1. Using a 16-box checkerboard pattern (ANSI contrast), the contrast ratio was 355:1. The best contrast ratio was achieved in the high-power-lamp mode. This setting also created the brightest image (on an 87-inch-wide, 1.0-gain Da-Lite Da-Mat screen).
I don't really understand this. I have no idea what "foot-lamberts" means?
hartford
10th October 2004, 01:03
foot-lambert = foot candles/square meter
Foot candle:
The amount of illumination produced by a
standard candle at a distance of one foot.
candle:
the basic unit of luminous intensity adopted
under the System International d'Unites; equal
to 1/60 of the luminous intensity per square
centimeter of a black body radiating at the
temperature of 2,046 degrees Kelvin
I guess you'd call it a measure of luminous intensity.
vinetu
10th October 2004, 21:17
I've started thinking :0 now and the result is:
-There is no need to interpolate 235 gray levels in to 1000 inside the display device-
it's enough to amplify the video level (when you turn the contrast to MAX)
However the banding(on such a projectors) should be visible even more,I guess...
Regards
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.