Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se |
|
|||||||
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#21 | Link |
|
Moderator
![]() Join Date: Jan 2006
Location: Portland, OR
Posts: 5,132
|
Big picture, these values can be left at 0 for "undefined" and most HDR displays will do something pretty close to the right thing. It is a lot better to not specify a value at all than to specify a materially incorrect one.
There is a straightforward translation from Y' code values to nits. So as long as you have some way to measure the brightest pixel in Y', you could then convert that to nits for MaxCLL. MaxFALL is trickier, since the nits of the mean of the code values can be quite different than the mean of the nits of all the code values. So every pixel needs to get converted to nits and then mean of those determined, and then MaxFALL is the nits of the highest nit frame. I think that for content already in Y'CbCr, nits can be derived directly from Y'. However all the tools I know of convert to RGB and then calculate from there. That should be empirically tested before that shortcut gets used, but obviously calculating Y'->nits would be a lot faster than going Y'CbCb -> RGB -> luma -> nits. |
|
|
|
|
|
#22 | Link |
|
Registered User
Join Date: Dec 2017
Posts: 90
|
@benwaggoner
The SMPTE reference implementation works with RGB values, so I figure that's the way to go. You're absolutely right that the mean of the code values is not the same as the mean of the nits values; the mean I calculate in my code is a mean of the nits values according to the algorithm in the reference pseudo-code. Unless I have made a mistake in implementing it, it should give the correct results. Nowhere did I see references to using Y' code values. I presume Y' is a form of weighted average of the RGB values, whereas the reference implementation uses max(R,G,B) [aka the highest value channel] for the mean. So it would likely lead to different results again. I think specifying metadata is better than just passing 0 because then the display has to dynamically adjust to the frames it sees, which has a good chance to lead to flickering/suddenly changing brightness I think, though I could be wrong. |
|
|
|
|
|
#23 | Link |
|
Registered User
Join Date: Dec 2018
Posts: 21
|
In a YUV420 10bit encoded video (HDR10), doesn't the Y-component of the pixel already define the brightness of the pixel?
For example, there's a flashlight in a dark scene located at coordinates (x=1000,y=800) in a frame. Decoding this frame of that scene and getting the Y component of the pixel at those coordinates, gives you e.g. the value 643. Using 643 on the PQ EOTF equals 432.5cd/m2. Am I missing something? |
|
|
|
|
|
#24 | Link | |
|
Registered User
Join Date: Dec 2017
Posts: 90
|
Well the YUV data gets converted to RGB anyway for displaying. I think using YUV these days is mainly about saving bandwidth via color subsampling, but I could be wrong. I also think it's more of a pseudo-brightness that is roughly proportional to perceived brightness and not really a physical measure of brightness or anything.
This seems to be an example code for converting RGB to YUV (not sure which color matrix): Quote:
Let's take an RGB value of 0.5, 0.6, 0.8. The Y value would be 0.5093 (Edit: Yeah dunno what my brain was thinking here, I wasn't aware that the code was for an 8bit limited YUV range, just ignore this please). Whereas max(R,G,B) would be 0.8. The RGB mean would be ~0.63. The nits of the Y value would be 101.224 The nits of max(R,G,B) would be 1555.178 The nits of the RGB mean would be 323.845 So depending on what algorithm is used the results can differ quite a lot. max(R,G,B) is the official recommendation afaik. Edit: I made a little mistake there in the averaging the RGB mean, since I averaged the RGB values, not the nits values. That average would be (92+244+1555)/3 = ~630 Last edited by TomArrow; 4th January 2020 at 18:28. |
|
|
|
|
|
|
#25 | Link |
|
Registered Developer
Join Date: Mar 2010
Location: Hamburg/Germany
Posts: 10,406
|
Subsampling is of course one reason (technically one could come up with a RGB subsampling scheme, similar to how Bayer filter work in image sensors and LCD displays, if one really wanted to), but there is also significant compression efficiency advantages by decorrelating the color planes, reducing redundant coded data. Compressing RGB without such a scheme would use more bandwidth.
__________________
LAV Filters - open source ffmpeg based media splitter and decoders Last edited by nevcairiel; 4th January 2020 at 14:33. |
|
|
|
|
|
#26 | Link | |||
|
Registered User
Join Date: Dec 2018
Posts: 21
|
Quote:
As per your example numbers, for full color range: Code:
R = 0.5*1023 = 512 G = 0.6*1023 = 614 B = 0.8*1023 = 818 PQEOTF(818) = 2716 cd/m2 Y = 0.2627*R + 0.6780*G + 0.0593*B = 599 PQEOTF(599) = 270 cd/m2 I'm not saying you're wrong in the sense that you're not following the instructions. I just don't understand why they'd suggest doing it that way. Unless we're both misinterpreting what they mean by: Quote:
They also have this note which sort of supports my above point: Quote:
Last edited by suarsg; 4th January 2020 at 18:21. |
|||
|
|
|
|
|
#27 | Link |
|
Registered User
Join Date: Dec 2017
Posts: 90
|
Sorry, I wasn't aware about it being limited or not, I just took the code from some website I found at quick glance. I suppose that example was nonsense then, my bad.
Well, MaxCLL is supposed to be the brightest pixel, and a single RGB pixels strictly speaking consists of R,G and B pixels on a display, so it makes sense to simply take the brightest one because that one pixel (R,G or B) would indeed reach 10,000 nits if that was its value. It is indeed strange that they would use Max(R,G,B) for the MaxFALL measurement however since it's literally supposed to be an average value. Beats me why they do it that way. My original approach was to just average all the nits values of every single channel and since that made much more sense to me too, I left that in the plugin as alternate algorithm as mentioned earlier. |
|
|
|
|
|
#28 | Link | |
|
Registered User
Join Date: Dec 2018
Posts: 21
|
Quote:
I'd assume this is the same for SMPTE2084/HDR10. Anything else doesn't make sense in my opinion, but I'm not an expert. As a counter example: Let's think of a medium gray pixel with the values (128,128,128). If we were to apply your luminance to each pixel's channel, each channel would have the same luminance output. This however, would make your medium gray not gray but give it a very blue tint instead. Because the eye is much more sensitive to blue than to red or green. Another example: If (0,1023,0) was 10,000nits, that would mean (0,1023,1023) would now be 20,000 nits, since the blue-subpixel was dark before but is now also emitting 10,000nits luminance on top of the 10,000nits the green sub-pixel was emitting. The spec's max however is 10,000nits. So I don't see how anything other than (1023,1023,1023) can be 10,000nits. |
|
|
|
|
|
|
#29 | Link |
|
Registered User
Join Date: Dec 2017
Posts: 90
|
Hmm good point about the eye's sensitivity, but I presume the nits value is simply the physical measurement disregarding the human eye's sensitivity? That would certainly explain it in my mind.
Ultimately I think the physical limit will be imposed by how much energy the individual colored dot can output, not how bright it appears to the eye. Since even if the eye isn't very sensitive to blue color, it will still heat up the component just as much as a red pixel of similar intensity. Also the intensity wouldn't add up like you say I think, since nits is candela per square meter, so two pixels will have twice the candela but also twice the area, so it would still be 10,000 nits? |
|
|
|
|
|
#30 | Link | |
|
Registered User
Join Date: Dec 2018
Posts: 21
|
Quote:
That was a bad example on my part in regards to cd/m2. My example was about one and the same pixel though - adding a second light source (the blue pixel) - will increase brightness of that pixel. Just like your room gets brighter the more white pixels your display shows. |
|
|
|
|
|
|
#31 | Link |
|
Registered User
Join Date: Dec 2017
Posts: 90
|
Why would I misread something you write on purpose? The sheer paranoia! Yes, I'm after you and I only came to this forum specifically to piss you off. Everything I ever did in my life was specifically anchored around the final goal of going to a forum about video processing to purposely misread what YOU wrote. Finally I can rest in peace, having achieved my goal!
|
|
|
|
|
|
#32 | Link | ||
|
Registered User
Join Date: Dec 2017
Posts: 90
|
Aight, seems I misunderstood the measurement of luminance, but I think so did you.
Apparently the luminance/luminous intensity (cd) is already weighed by the human eye sensitivity: https://en.wikipedia.org/wiki/Luminous_intensity Quote:
The other way I misunderstood the nits measurement is in terms of the square meter. I thought it meant emitter area, but it means the area across which light output is measured. Quote:
![]() Which makes more sense, since one physical pixel operates independently from the neighboring ones, so why should they be (from a physical perspective) arbitrarily grouped? Wanted to think about one more angle, but my brain is falling asleep and I'm tired, will think about it more tomorrow. |
||
|
|
|
|
|
#36 | Link | |
|
Registered User
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,484
|
Quote:
In practice this is impossible but that does not mean HDR video would not prefer 4000 nits for all pure colors as well as white or that HDR displays must drive the green subpixel the same when at (1023,1023,1023) and (0,1023,0).
__________________
madVR options explained Last edited by Asmodian; 6th January 2020 at 08:46. |
|
|
|
|
|
|
#37 | Link | ||
|
Moderator
![]() Join Date: Jan 2006
Location: Portland, OR
Posts: 5,132
|
Quote:
Anyway, yes RGB 128, 128, 128 won't have any chroma. In 10-bit YUV it'd translate to (512,0,0). It's neutral in the sense that there is no chroma, but it's going to look quite white in PQ. The same values would be much more gray in 709. Quote:
Also, an RGB of 0, 512, 0 is going to be a lot brighter than one that's 0, 0, 512, as green is a much bigger portion of luma than blue. I might want to ruminate on this a bit more, but I think that the conversion to luma used to figure out MaxFALL and MaxCLL is the same used in converting to Y'CbCr, which is why actual brightness should be able to derived with reasonable accuracy from Y'. |
||
|
|
|
|
|
#38 | Link | |||
|
Registered User
Join Date: Dec 2018
Posts: 21
|
Quote:
Hence for BT2020 (the color space of HDR10!) we have: Code:
Y = 0.2627*R + 0.6780*G + 0.0593*B Not sure why you're bringing 4000nits or display tech into this as it doesn't really matter for the theory. Obviously there's no consumer display out there that can do these values without tone mapping and each display's tech is completely different on a sub-pixel level and how they themselves decide to derive its pixel's brightness from that sub-pixel structure is their own individual job to figure out. The important part is, if you have an RGB-tuple for a pixel, the pixel's brightness/luminance will not be based on the value of MAX(R,G,B) or AVG(R,G,B). My examples were there to demonstrate why it makes absolutely no sense. Quote:
Quote:
|
|||
|
|
|
|
|
#39 | Link | ||
|
Registered User
Join Date: Dec 2017
Posts: 90
|
Quote:
Be that as it may, do you mean the encoded Y value in a HDR PQ encoded video when you say Y' or a separately calculated brightness based on the RGB PQ data? If you mean the former, I just looked up some pdfs earlier today and I believe most deliverables these days actually do the RGB to YUV conversion for PQ *after* the transfer function is already applied, so reading that Y value and converting it to nits is a pretty invalid thing to do. I believe this problem is called "non-constant" vs "constant", where the latter is done from the linear RGB values and the former (the typical one apparently) is done from the already PQ-encoded RGB values. To demonstrate, I did a bit of math: Quote:
I suppose the answer is no. Gotta wrap my head around that. Hah! |
||
|
|
|
|
|
#40 | Link | |
|
Moderator
![]() Join Date: Jan 2006
Location: Portland, OR
Posts: 5,132
|
Quote:
Tone mapping is a complex and interesting field, and there is definitely not any one way to do it. Tradeoffs around how to optimally preserver brightness, hue, and saturation without banding involve a lot of proprietary alchemy by TV companies. |
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|