INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: JRVR: Gamma processing question  (Read 1124 times)

bogdanbz

  • World Citizen
  • ***
  • Posts: 181
JRVR: Gamma processing question
« on: July 09, 2022, 11:40:41 am »

I have a question regarding the gamma processing option for JRVR.

I have the TV configured to use gamma 2.2, because it's as close as possible to a PC display monitor this way, but I would like video to be rendered using 2.4 gamma instead. It's an OLED TV, so using absolute gamma functions like this is ok.

When I selected Gamma processing = gamma 2.4 in JRVR, I noticed the image becoming brighter, which was the opposite of what I was expecting (a conversion from the sRGB gamma used for SDR PC content to gamma 2.4). What is the meaning of the gamma processing values available in JRVR, how are they applied? And are these options ignored (as I hope the yare) for HDR material displayed in HDR10 mode?
Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10723
Re: JRVR: Gamma processing question
« Reply #1 on: July 09, 2022, 11:55:35 am »

Gamma processing indicates the gamma of your screen - so higher values becoming brighter is expected, as the screen is supposedly "darker", so both combined would result in a neutral image again.

And yes, these values are not used in HDR10 output mode, since instead of gamma the image is PQ encoded.
Logged
~ nevcairiel
~ Author of LAV Filters

bogdanbz

  • World Citizen
  • ***
  • Posts: 181
Re: JRVR: Gamma processing question
« Reply #2 on: July 09, 2022, 12:38:45 pm »

Ok, thank you for your reply!

So, if I set Gamma processing = gamma 2.2, I get the overall gamma used for video to be 2.4 in my case. Is that right?
Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10723
Re: JRVR: Gamma processing question
« Reply #3 on: July 09, 2022, 12:48:12 pm »

Sounds about right, as the origin gamma of the SDR videos is assumed to be BT.1886 - its not quite 2.4, but close enough.
Logged
~ nevcairiel
~ Author of LAV Filters

bogdanbz

  • World Citizen
  • ***
  • Posts: 181
Re: JRVR: Gamma processing question
« Reply #4 on: July 09, 2022, 01:10:55 pm »

I don't think it works right though, as changing Gamma processing to gamma to 2.2, gets me a significantly brighter image in the dark tones than with Gamma processing = disabled (which seems to be identical to Gamma processing = sRGB; having sRGB identical to gamma processing disabled is the only thing that is as I expect it to be, as that's the standard encoding of SDR material on a PC). I thought that sRGB and gamma 2.2 were almost identical, except for sRGB making the image brighter in the dark tones?

It feels as if I have to set Gamma processing to 1.8 if I want to have my TV at gamma 2.2, in order for the overall video gamma to be 2.4?

Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10723
Re: JRVR: Gamma processing question
« Reply #5 on: July 09, 2022, 01:13:00 pm »

Do you have an ICC profile loaded that might get into the mix? With an ICC profile you probably should stick to "disabled" and let it figure out the gamma from the profile.
I can not see a substantial difference here when using either disabled, 2.2 or sRGB, it does get brighter with 2.4 though.
Logged
~ nevcairiel
~ Author of LAV Filters

bogdanbz

  • World Citizen
  • ***
  • Posts: 181
Re: JRVR: Gamma processing question
« Reply #6 on: July 09, 2022, 01:17:17 pm »

No, I don't have any ICC profile, and the Calibration method is set to disabled:

Later edit: added Windows Color Management dialog screenshot, to show I have no color profile active.
Logged

bogdanbz

  • World Citizen
  • ***
  • Posts: 181
Re: JRVR: Gamma processing question
« Reply #7 on: July 09, 2022, 01:20:05 pm »

Assuming my current TV gamma setting is 2.2, then

If I switch JRVR Gamma processing from disabled -> gamma 2.2, then the image gets brighter, which means the video gamma as perceived by me has, in fact, changed towards 2.
If I switch JRVR Gamma processing from disabled -> sRGB: image stays the same.
If I switch JRVR Gamma processing from disabled -> gamma 1.8, then the picture gets darker, which means the video gamma as perceived by me has, in fact, changed towards 2.4.

Later edit, screenshots with visible changes for various Gamma processing options applied (anime to the rescue!). I added numbers in front of the filename, so that if you save the image files in a folder and browse between them you will notice the image getting brighter and brighter, except for "disabled" and "sRGB" which are identical. Gallery is here: https://postimg.cc/gallery/gxxgtSd





Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10723
Re: JRVR: Gamma processing question
« Reply #8 on: July 09, 2022, 01:39:16 pm »

SDR videos are treated as BT.1886 with a typical LCD contrast ratio of 1:1000 (this is pretty much standard) - unless they signal otherwise.
BT.1886 is a 2.4 gamma curve with black compensation, which gives it an overall response below even 2.2 pure power - although the shape of the curve is different, of course.

sRGB is similar in that it also has that linear segment near blacks, which is probably why it looks pretty close.
2.2 would look a bit brighter on dark scenes that still (partially) fall into the areas that differ in the curves, and pretty similar in brighter scenes.

At the end of the day, if you have no meter to measure the gamma response with a calibration video, I would probably leave it on disabled, or use whatever looks actually best on real content. Your display being set to 2.2 but you wanting video to be displayed with a different gamma complicates things, as thats not really an intended scenario. A 3DLUT could do the precise conversion, or if 1.8 looks good enough to you, that could work.

Personally, I find that even though my OLED TV can produce details near black, its not necessarily beneficial to use it extensively, as its still harder to make out, unless you have perfect light control in the room.
Logged
~ nevcairiel
~ Author of LAV Filters

bogdanbz

  • World Citizen
  • ***
  • Posts: 181
Re: JRVR: Gamma processing question
« Reply #9 on: July 09, 2022, 01:54:42 pm »

I edited my post above with screenshots that show how the image gets brighter and brighter while changing the JRVR Gamma processing from 1.8 -> disabled == sRGB -> 2.2 -> 2.4.

If the intent was for the user to just set Gamma Processing to the gamma value of his display, and then he will see the video as if his display was configured to BT.1886 or gamma 2.4, then that's not what's happening.

Gamma processing seems to be a transform applied to the in-memory sRGB values. When setting gamma processing to 2.4 for instance, what happens is that the image is made brighter (despite the fact that gamma 2.4 should give a darker image than sRGB), as if applying an inverse transform from 2.4 to sRGB.
Logged

bogdanbz

  • World Citizen
  • ***
  • Posts: 181
Re: JRVR: Gamma processing question
« Reply #10 on: July 09, 2022, 02:10:26 pm »

2.2 would look a bit brighter on dark scenes that still (partially) fall into the areas that differ in the curves, and pretty similar in brighter scenes.
That's not correct, it's actually the opposite, I think. sRGB will make dark tones appear brighter than gamma 2.2. That linear segment near black is above the 2.2 gamma curve, not below if I remember this right. It was intended to be this way, btw, because PC displays are supposed to be used in brighter ambient light conditions than TVs were.
Logged

bogdanbz

  • World Citizen
  • ***
  • Posts: 181
Re: JRVR: Gamma processing question
« Reply #11 on: July 09, 2022, 02:25:56 pm »

I'll add one more detail: I imagine JRVR is making use of the DirectX VideoProcessor for hardware accelerated decoding and deinterlacing. I know that its output is a buffer with sRGB encoded values (well, encoded with the sRGB inverse function, since sRGB is a EOTF, not a OETF).

I don't know what the VideoProcessor does, but it could be that its output is already gamma processed so that when displayed on a typical PC display monitor (which typically uses gamma 2.2 as its EOTF instead of sRGB, because that's how things settled in time - everybody ignores that sRGB is an EOTF) the video will appear as if it is viewed on a display with a BT.1886 gamma instead of on a display with 2.2 gamma. Or, it may not do any gamma processing, and what you see on a PC display monitor is a video viewed as on a 2.2 gamma display, and what you see on a TV display (which is configured to use BT.1886 as EOTF) is a video displayed as on a BT.1886 display. :)

 
Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10723
Re: JRVR: Gamma processing question
« Reply #12 on: July 09, 2022, 02:59:01 pm »

That's not correct, it's actually the opposite, I think. sRGB will make dark tones appear brighter than gamma 2.2.

Yes, it would, however, that is true if you are talking about the screen. The video renderer applies it in inverse to make the video signal match the processing of the screen. Which is why 2.4 looks brighter, even though calibrating a screen to 2.4 would make it darker (and both combined be neutral). Thats why the gamma option feels backwards, because it is. It does the inverse of what your screen would do, 2.4 gets darker on the screen, so the image it gets delivered is brighter.

Gamma in the video renderer here is not about changing the image, its about spending bits on the parts that matter. Hence doing the inverse of the screen behavior, so the image stays neutral.
If you have a screen that supports various gamma curves, swaping it between them and changing JRVR accordingly should hopefully produce a relatively consistent image. Of course without a meter determining that in the analog world is always a bit tricky, as I myself can barely tell the difference if I can't swap between them very quickly. (and my stupid gaming screen supports 1.9, 2.2, and 2.5, who picked those, the other screens have no options, cba to check the TV right now)

Note that sRGB practically never applies to video. You might have a PC screen calibrated to it, but the video you are playing is not mastered to sRGB, and its never used internally unless specifically instructed to as the output gamma encoding.
There is no "in-memory" sRGB values, internally between steps its either left as-is or converted to linear light as needed. Its decoded to linear light with the source transform, eg. BT.1886, and re-encoded to gamma light either with the same, or with whatever you configured as an override.

"disabled" is in most cases equal to BT.1886. sRGB might just look similar due to a similar gamma response. You can actually see the entire conversion disappear from the OSD when its set to either disabled or BT.1886

I'll add one more detail: I imagine JRVR is making use of the DirectX VideoProcessor for hardware accelerated decoding and deinterlacing. I know that its output is a buffer with sRGB encoded values (well, encoded with the sRGB inverse function, since sRGB is a EOTF, not a OETF).
 

The video processor works in YCbCr and only performs deinterlacing, it does not take or output RGB. No further processing is enabled, and its also only used at all on interlaced videos.
It does quite certainly not re-interpret the gamma of the video, because its not even told the gamma. If anything it would just pass it through because it has no basis to know the input and output would be different, or would be supposed to be.

If you disable hardware video decoding, then no DirectX video functions are even touched at all, and I'm also quite confident that the decoder has no impact on the image even if its used, that would've been noticed in years of using hardware decoding. There is plenty of pixel-peeping people using LAV Filters etc.

If the intent was for the user to just set Gamma Processing to the gamma value of his display, and then he will see the video as if his display was configured to BT.1886 or gamma 2.4, then that's not what's happening.

The intent is for the user to not touch that value, and if they want to adapt the reproduction to their screen, measure it with a meter and produce a ICC profile, since basically no screen has a perfect gamma response.
Without measuring the final response, all you can do is set it to feel. How can you be sure its not close to look like its supposed to?

What the setting does is encode the linear light using that gamma function. Setting it to the same that the screen will use to decode it results in you getting the same linear RGB that the image contained originally, which is most commonly needed if your screen is not using the same gamma function as the video - which might be most often true for PC screens, as TVs are typically going to use BT.1886, or perhaps 2.4 (which on an OLED would be close to equal to BT.1886 due to the infinite contrast)

So yes, what that option is supposed to do is make the image look like you are watching it on a BT.1886 screen with a typical 1000:1 contrast ratio (which is much closer to 2.2 then 2.4). Its not designed to change the image, just adapt it to your screen (hence the calibration section). This might not entirely match an OLED however, as even if it uses BT.1886 it would probably plug its own contrast in there, which if truely infinite is just 2.4, and not quite what SDR mastering is typically targeting.

--

One bit of confusion might come from the naming of the option, especially if you used eg. madVR before. This JRVR option basically corresponds to "the display is calibrated to the following transfer / gamma" in the madVR settings, except that JRVR will actually re-shape the gamma of the video to match that, something madVR does not do. madVR has a separate "gamma processing" option which does what you want, eg. adjust the gamma in such a way that it emulates the desired gamma curve on your screen, which is not an option we currently have. You can try to cheat it by settings the gamma processing to a "wrong" value, or do it with an ICC profile or a 3DLUT.

Our default behavior matches madVR fwiw, that is not touching gamma at all, and just sending it to the display as it was in the original video - which is what "disabled" gives you.
It was actually originally named "display gamma" or something like that, but to discourage actually setting it without really understanding it, I renamed it and introduced the "disabled" option, so that gamma is passed through, which in most cases is the best option, as thats what people expect to happen.
Logged
~ nevcairiel
~ Author of LAV Filters

bogdanbz

  • World Citizen
  • ***
  • Posts: 181
Re: JRVR: Gamma processing question
« Reply #13 on: July 10, 2022, 04:22:34 am »

Thank you for the detailed explanation. Now I understand why the results are not at all the expected ones.

Unfortunately, I must say that this "Gamma processing" option is not doing what you hoped it was doing (you can verify this by plotting the result you get after the transforms you do vs the standard EOTF functions the displays do), and neither the different thing that I hoped it was doing.

There are two other things that worry me:

1. You speak of SDR content as having BT.1886 as the source transform, which is wrong. SDR content has the REC.709 OETF as the source transform, not the inverse of any EOTFs and therefore not the inverse of the EOTF called BT.1886.

2. You speak of going to linear-light by using the BT.1886 transform. That will move you to linear light, but in display referred space, which is what you don't want to do for any kind of math processing due to errors it introduces. When doing processing in linear light space, what you want to do, is to do it in scene/camera referred space. In case of SDR video encoded content, this means applying the inverse of the BT.709 OETF to go back to a camera CIE XYZ color space with Rec.709 primaries. That's the space where linear light processing is (well, was* ...) being done. You can check this out in different video editing suites intended for the movie industry or in the ACES workflows. My web search skills must be pretty weak as I can only find this manual for Autodesk ShotGrid (see 7.5.8 Rec. 709 Transfer to Linear Color Space Conversion).

(*) These days people are trying to move away from having separate SDR and HDR workflows. They want to do all their processing on the same material, in the same space, and then just apply a transform from this to map to Rec709 for SDR content delivery, and another transform to map to BT2020 for HDR10 delivery, or a different one for DV delivery. That's what ACES workflows help with, instead of working in a linear space with Rec709 primaries, or a linear space with BT2020 primaries in computer graphics, you work in the ACEScg linear space that makes use of different primaries (called AP1), that allow for a wider gamut than Rec709 though not quite matching the BT2020 gamut. And for storage you may use the ACES2065-1 color space which encompasses any color a human can see.

I promise I will write a longer post to explain all these. I just worked till 2am in the morning many nights the past week, and next week looks like more of the same, so I'm really tired and lack the will to do much effort outside work hours right now.

Quote
Our default behavior matches madVR fwiw, that is not touching gamma at all, and just sending it to the display as it was in the original video - which is what "disabled" gives you.

The default behavior is then very good, as it lets you apply the EOTF on the display device, by changing it in the display device settings. I was just hoping to be able to let the display use one EOTF suitable for general PC content, while having only video shown to me using a darker 2.4 gamma EOTF as it's intended for video content display in a dark environment.
Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10723
Re: JRVR: Gamma processing question
« Reply #14 on: July 10, 2022, 07:54:28 am »

Using display-referred light is an intentional decision, as it normalizes the space to the intended use: display.

It's best to think of the video renderer as a virtual display. It's not a video editing or mastering suite, it's supposed to approximate a virtual mastering display, and therefor it uses the EOTF and processes the image in display-space, like a display would. This creates consistency with display-referred formats like PQ, as well as avoiding problems with the implied OOTF of some combinations, as well as letting us actually "convert" between different EOTFs - eg. BT.709 SDR content is intended to use BT.1886 EOTF, but if your display does not use it (as many PC displays would) and uses a 2.2 pure power curve instead, the black point would be wrong, unless you let JRVR do BT.1886 and re-encode it with 2.2
Logged
~ nevcairiel
~ Author of LAV Filters

bogdanbz

  • World Citizen
  • ***
  • Posts: 181
Re: JRVR: Gamma processing question
« Reply #15 on: July 10, 2022, 10:48:56 am »

When you are doing processing in display space, then you are running into all kinds of issues you would not have if you would do processing in screen space. The most obvious is that you are now limited to device space, with clipping of anything that would be outside this space. Linear light processing is not accurate anyway, it's not accurate in display space and it's not accurate in screen space either. Only spectral processing is accurate. Doing it in display space is only increasing the errors.

Quote
letting us actually "convert" between different EOTFs - eg. BT.709 SDR content is intended to use BT.1886 EOTF, but if your display does not use it (as many PC displays would) and uses a 2.2 pure power curve instead, the black point would be wrong, unless you let JRVR do BT.1886 and re-encode it with 2.2
And you get what if you encode with a random gamma function the output of applying a BT1886 transform to Rec 709 video content? I keep telling that what you get is not what you think you get. Plotting these functions and comparing them to a standard EOTF should make it obvious that you don't get to emulate any of the standard EOTFs on a display with a different EOTF this way. Not to mention the posterization in the black and bright tones (aka the visible banding) that you get from using the output of BT.1886 as your input.
Logged
Pages: [1]   Go Up