•
• 1
• 17
• 18
• 19(current)
• 20
• 21
• 509
•
Kodi DSPlayer – DirectShow Player for Windows
Part II: HDR to SDR Gamma Compression

Topics Covered:
• What is HDR to SDR Tone Mapping;
• Fundamentals of PQ HDR Video;
• Dynamic Range Compression;
• Mapping of PQ to Display Brightness;
• HDR to SDR Tone Mapping Explained.

What is HDR to SDR Tone Mapping?

HDR to SDR tone mapping is a method of mapping PQ (Perceptual Quantizer) HDR source values to match a pure power SDR gamma curve. This is accomplished by using the SDR gamma luminance scale to create PQ HDR luminance values. If any SDR values are missing, dithering is added to offset the difference between the two luminance scales that leads to correct PQ EOTF tracking for any pre-determined gamma value (e.g., pure power 2.20, 2.30, 2.40, etc.). So HDR to SDR does not involve any loss of the original HDR signal, only a change in tone curve or gamma.

When done correctly, HDR to SDR tone mapping produces 1:1 PQ EOTF tracking for any scenes within the brightness capabilities of the display. If the brightness levels of any HDR source or scene rise above the available display peak nits, the SDR gamma curve rescales all PQ source values to fit the brightness of the SDR display curve.

The flexible nature of the SDR gamma curve allows absolute PQ curves brighter than the calibrated SDR display peak nits to be compressed to fit any calibrated peak nits. SDR gamma relies on scene-referred luminance and not display-referred luminance; displayed luminance in SDR is gamma is expressed as a ratio of the source mastering display rather than prescribe that the display produce an exact amount of luminance for each on-screen pixel. So HDR to SDR tone mapping takes any scenes brighter than the calibrated display nits and rescales them linearly with gamma compression to match the identical contrast ratio of the original source values with a lower average brightness for each value. This means the dynamic range of bright HDR sources is compressed in HDR to SDR tone mapping by using the relative SDR gamma scale to remap the average brightness of all source values so that the entire HDR scene is represented within a narrower display range.

The wholesale remapping of HDR to SDR tone mapping makes it both an absolute and relative representation of HDR videos. Scenes within the display nits can be represented with the identical PQ luminance as the director intended. But scenes mastered above the display peak nits are resized with the SDR gamma scale to have a relative representation of each HDR scene at a lower peak brightness.

This dynamic contrast scaling of HDR to SDR tone mapping is ideal for displays that have to constantly adjust the balance between maximizing displayed brightness and compressing high dynamic range by compressing contrast. PQ HDR videos can be mastered at nits levels from 0 nits to 10,000 nits with frame peaks that vary throughout the runtime. For a display such as a projector that simply cannot produce the highest nit levels in PQ HDR videos, there is a constant need to adjust the ratio of contrast and brightness, so bright HDR scenes are not clipped and dimmer HDR scenes are not crushed. The scalable nature of HDR to SDR tone mapping helps to maintain this balance by using the flexible SDR gamma scale as a dynamic contrast slider that can adjust the Average Picture Level (APL) in fine amounts to get just the right amount of contrast and brightness for each scene — with the added ability to adjust the global contrast of the presentation to your liking. This takes the inflexible and rigid nature of the PQ EOTF and remaps it for displays that need frequent and significant adjustments to the PQ curve to handle the varying high dynamic range of HDR content.

Fundamentals of PQ HDR Video

PQ HDR video looks at the video range as having two distinct ranges that can be utilized during content mastering: one range that uses the standard video range you are accustomed to and another extended range that is reserved for very bright detail. These bright details are used to light scenes with improved contrast and create a better sense of a natural and realistically lit world.

HDR Video Ranges:

Lower Range (0-100 nits):

Known as normal diffuse or SDR reference white.

The majority of an HDR image is located here.

Upper Range (100-10,000 nits):

Known as the HDR specular highlights.

These are hot spots in the image used to convey bright detail.

These bright details are meant for specular elements in the image that have a brightness level far above other image elements. This could include specular reflections and light sources with natural peaks as high as 10,000 nits that require greater mastered brightness to convey their depth, shape and texture as well as imply the relative brightness of these specular highlights compared to surrounding objects.

Example of "HDR hot spots" in a heatmap applied to HDR video games.
HDR specular highlights are shown in Orange, Red and Purple:

You would see a similar effect if a heatmap was applied to the color gamut: Most colors would fit within the BT.709 color space, while some highly-saturated colors would extend into DCI-P3.

Dynamic Range Compression

HDR specular highlights must be compressed when the end display has a peak brightness that is less than the source peak brightness. Compression of the fixed PQ luminance scale above 100 nits is handled by a roll-off curve that lowers the distance between each PQ step. After compression is applied, the brightest pixels in the source become mapped to the peak white output of the target display.

If a display clips the highlights, they will all be mapped to white and blown out without visible detail. So it is desirable to start the roll-off low enough on the PQ curve to retain all highlight detail at the expense of making everything above the roll-off point darker. Or trade-off some highlight detail for greater brightness.

Displays with a low peak brightness that is only marginally above SDR reference white (0-100 nits — such as most HDR projectors) will typically lower the brightness of reference white to provide space to represent the specular highlights. Tone mapping of reference white in HDR videos is generally not recommended because the majority of the source levels are mastered here.

If reference white must be compressed by the display, it is at least desirable to retain the visible space between each PQ value to avoid flattening large portions of the image. The amount 0-100 nits should be lowered in brightness depends on the source peak brightness and the contrast desired for each movie or each movie scene.

The shape of the roll-off curve is determined by a tone mapping operator (TMO) that uses an S-curve to create different levels of compression that preserve various features in the image. Tone mapping curves simply cannot preserve all image detail, so those deemed most visually important are given priority.

Tone mapping compression starts at a static knee point on the PQ curve:

The placement of the knee point where the roll-off point starts is not standardized across all tone mapping operators. BT.2390 used by madVR chooses the knee point based on a formula that uses several input values as described in Report BT.2390 (largely, inputting the target display peak brightness and comparing it to the measured scene or frame peak brightness to determine how early the roll-off must begin to compress each scene peak to fit the target display).

Display Target Nits — Adjusting Dynamic Range Compression

The brightness of the image in HDR to SDR tone mapping is defined by the display target nits that describes the peak nits or peak luminance (cd/m2) of the original PQ source curve. This value tells you how much dynamic range is captured by the SDR gamma curve from the HDR source input. That source curve could be a tone mapped HDR source or scene compressed to a specific nits levels with a BT.2390 tone mapping curve, or the display target nits might represent the entire uncompressed HDR movie scene.

For example, if the display target nits was 100 nits and the display was also calibrated to 100 peak nits, this means the display could represent the dynamic range of any scene mastered to 100 PQ nits, but those HDR scenes with brightness levels above 100 nits would be rolled-off and largely clipped at the top of the display range.

Source Footage vs. 100 nits Display Target Nits:

If instead the display target nits was increased to say 500 nits, more of the source dynamic range could be captured within the display range to preserve more of the high contrast of the original scene without clipping the highlights.

Source Footage vs. 500 nits Display Target Nits:

These 500 PQ nits are compressed to 100 real display nits by compressing the entire display range at a 5:1 ratio, which leads to an increase in contrast and a darkening of the overall image, but adds space at the top of the range for a more gradual roll-off of the bright specular highlights.

Increase contrast (high display target nits) and you sacrifice some brightness — The midtones of the image are compressed to add contrast between the highlights and midtones. Decrease contrast (low display target nits) and you raise brightness — The bulk of compression is applied to the specular highlights with greater brightness allocated to the shadows and midtones.

The display target nits can then be thought of as a dynamic range slider that defines the aggressiveness of the display gamma compression:

Low display target nits:

Brighter Images with Lower Contrast = Lower Perceived Dynamic Range.

High display target nits:

Darker Images with Higher Contrast = Higher Perceived Dynamic Range.

Changes to the display target nits impact the Average Picture Level (APL) — The average brightness of the displayed video levels.

PQ to SDR Gamma Display Mapping — Displayed Luminance

When PQ is converted to SDR gamma, the brightness of each displayed value is determined by a combination of the display target nits and real display peak nits of the target display.

Because the display target nits defines the dynamic range captured by the tone mapping curve, the relative SDR gamma scale will always preserve the original contrast ratio of any display target nits at a ratio of display target nits/real display peak nits. This occurs through linear gamma compression at the display panel that stretches or compresses the source values to fit the calibrated peak nits of the SDR picture mode.

For example,

display target nits = real display peak nits

This is a 1:1 compression ratio. No additional source compression happens at the display panel.

PQ source values follow the original PQ EOTF — the HDR source luminance is faithfully represented at a 1:1 ratio.

display target nits > real display peak nits

The display target nits is rescaled at the display panel by the relative SDR gamma curve at a compression ratio equal to display target nits/real display peak nits

Example: Linear Gamma Rescaling of 100 display target nits, 200 display target nits, 300 display target nits and 400 display target nits at 100 actual display nits:

100 display target nits / 100 real display nits = 1:1 display gamma compression ratio;
200 display target nits / 100 real display nits = 2:1 display gamma compression ratio;
300 display target nits / 100 real display nits = 3:1 display gamma compression ratio;
400 display target nits / 100 real display nits = 4:1 display compression ratio.

These ratios mean the brightness of each PQ value will be neutral2x darker, 3x darker or 4x darker when displayed. This has the following impact on the APL:

100 display target nits / 100 real display nits (1:1) = 100 nits reference white;
200 display target nits / 100 real display nits (2:1) = 50 nits reference white;
300 display target nits / 100 real display nits (3:1) = 33 nits reference white;
400 display target nits / 100 real display nits (4:1) = 25 nits reference white.

Lowering reference white in each scene creates contrast between the specular highlights and reference white that is necessary to accurately represent the many bright specular highlights found in HDR movies without clipping them on dimmer displays. For instance, if a movie scene contained highlight information with a mastered peak of 1,000 nits and the display could only produce 100 nits, reference white might be lowered to 50 nits in order to place the brighter specular highlights at 100 nits. This would provide just enough contrast between 100 nits and 50 nits to more faithfully represent the intended contrast of the scene.

As the majority of HDR video is mastered within 0-100 nits, this contrast enhancement has the effect of slightly darkening the overall image. How much compression is required to create the desired HDR effect depends on the mastered peak brightness of each scene in the movie: Higher contrast compression is necessary for very bright scenes, moderate contrast compression is necessary for mid-bright scenes and low contrast compression is suitable for dimmer scenes.

So how are these brightness values communicated by madVR to the end display?

Well, since SDR gamma is relative to brightness of the end display, madVR can assume each PQ value will be rescaled by the end display based on its known SDR peak brightness. The SDR gamma scale assumes every display is 100 nits, but this input can be expanded or compressed linearly by the display. When the calibrated brightness of the display can be assumed, tone mapping can then use the SDR gamma luminance scale as a standard PQ scale that sends luminance values that are equal to what each PQ value will be at the displayed brightness.

Example #1: PQ Values Sent to SDR Display Calibrated to 100 peak nits:

50 nits pixel sent to 100 display nits = 1/2 the total display luminance curve.

Example #2: PQ Values Sent to SDR Display Calibrated to 200 peak nits:

50 nits pixel sent to 200 display nits = 1/4 of the total display luminance curve.

In Example #1, madVR sends an RGB value that is 1/2 of the SDR gamma scale. In Example #2, an RGB value that is 1/4 of the SDR gamma scale is sent to the display.

The luminance scale used by HDR to SDR tone mapping is intended to mirror a true PQ HDR mastering monitor that clips at 100 peak nits, 200 peak nits, 300 peak nits, 400 peak nits, etc. As the target display brightness increases closer to 10,000 nits, RGB values sent by madVR will align closer and closer to a true 10,000 nits reference PQ mastering monitor. For example, R100, G100, B100 eventually equals exactly 0.306 PQ nits rather than a fixed ratio of the SDR display nits.

If display target nits = real display peak nits, each PQ value is displayed at the exact desired brightness.

If display target nits > real display peak nits, each PQ value is rendered by the display at lower brightness than originally calculated.

This difference in target nits and display nits has the net effect of shifting all RGB values downwards on the gamma curve. A 50 nits value is displayed at 50 nits at 200 display target nits on a true 200 nits display, but it is only (2:1) 25 nits on a 100 nits display, and (4:1) 12.5 nits on a true 50 nits display. If the display target nits is raised high enough above the actual display nits, black crush will occur in places where the visible steps near black become too low in luminance and too close together to show any visible difference between each value. This will make the entire image very dark!

Rescaling HDR source levels towards black at higher display target nits with the SDR gamma curve is not ideal for maintaining high APLs, but it offers the unique advantage of being able to dynamically tailor displayed contrast to match each movie scene. Each scene in a movie will have a unique frame peak brightness and it may only be necessary to sacrifice some brightness for better contrast if the scene has a high dynamic range that is well above the available display nits.

Contrast adjustments of this nature improve tone mapping flexibility for low peak brightness displays such as projectors that must constantly strike a balance between presenting extended HDR contrast and maintaining a bright and viewable image, all within a very narrow range of available projected brightness.

HDR to SDR Tone Mapping Explained in Images

To compress the PQ HDR luminance scale to fit within the target display brightness, the tone curve must flatten portions of the original PQ scale until the brightest source values are lowered to match the peak white of the target display. PQ values represent fixed luminance and compressing this scale means values at the top of the scale must be stacked on top of the ones below. Lowering the distance between each PQ step has the effect of clipping some detail in the most compressed areas of the roll-off curve where many pixels become mapped to the same PQ value.

Segments of the Absolute 10-bit PQ Luminance Scale up to 1,000 nits:

PQ Value: 0 - Output Luminance: 0 nits
PQ Value: 100 - Output Luminance: 0.306 nits
PQ Value: 200 - Output Luminance: 2.258 nits
PQ Value: 300 - Output Luminance: 9.211 nits
PQ Value: 400 - Output Luminance: 29.386 nits
PQ Value: 500 - Output Luminance: 82.382 nits
PQ Value: 600 - Output Luminance: 214.612 nits
PQ Value: 700 - Output Luminance: 536.845 nits
PQ Value: 769 - Output Luminance: 998.932 nits

Source

You can think of a tone mapping compression like falling blocks in the game Tetris. The lower the display target nits, the lower tone mapping must shift the entire image downwards.

If you made the PQ steps perfectly linear, where each step was evenly spaced out with equal increases luminance, tone mapping a 1,000 nit source with a standard BT.2390 roll-off to a display capable of 214 actual nits might look something like this:

Tone mapping to 214 real display nits:

You can see the roll-off starts at 100 nits with the remaining space allocated to mapping the brighter source values. Above the knee point, values are adjusted downwards creating some overlap as some source values become the same value. In reality, it is more likely the source values will become increasingly closer to each other rather than the same value (e.g., from five steps difference to two steps difference), but overlapping PQ values will occur when the display is limited in visible brightness steps.

So what happens if the target nits is 214 nits, but the end display is only capable of 100 nits? Well, the same tone curve is applied, but the entire is image is rescaled by the relative SDR gamma curve. The result is each visible step becomes smaller and closer together and the overall image is dimmed.

214 real display nits rescaled to 100 actual nits:

You can see the individual steps of the larger target are maintained 1:1 at a lower brightness, but the difference in luminance between those steps has been reduced by the rescaling of the SDR gamma curve (each step becomes 2.14x darker). The whole image has been shrunk down to a lower brightness by the gamma curve to maintain the original 1:1 contrast ratio of the larger display target nits at a 2.14x lower luminance.

Displaying 214 PQ nits at 100 actual display nits lowers reference white from 100 nits to 47 nits. This creates additional space at the top of the range for a more gradual roll-off of the specular highlights that should lead to less visible highlight clipping. However, the display rescaling is now less accurate in mapping the absolute luminance of the original PQ source values. Contrast is improved compared to 100 display target nits, but the resulting image uses altered proportions (steps) and displays a visibly lower APL.

*The actual representation of brightness by the SDR gamma curve is not perfectly linear. So this example is only hypothetical.

The accordion-like compression of the gamma curve permits very small adjustments between the source luminance steps that are more difficult when using the original fixed PQ EOTF. This rescaling occurs while still maintaining some visible distance between each source value.

The placement of the fixed knee point where the roll-off begins is determined by the measured frame peak. Increases to the frame peak nits necessitates a lower roll-off point on the tone curve to accommodate the larger number of source values between reference white (100 nits) and the display target nits to provide a more gentle roll-off of the specular highlights that prevents the highlights from being clipped. As the display target nits increases, the knee point is moved up on the tone curve to alleviate compression of 0-100 nits and use the increased space above 100 nits for the highlight roll-off.

Minimum Display Target Nits Where the BT.2390 Knee Point is Placed at Exactly 100 nits:

Frame Peak: 100 nits -> Target Nits: 100 nits
Frame Peak: 200 nits -> Target Nits: 126 nits
Frame Peak: 300 nits -> Target Nits: 144 nits
Frame Peak: 400 nits -> Target Nits: 158 nits
Frame Peak: 500 nits -> Target Nits: 170 nits
Frame Peak: 600 nits -> Target Nits: 180 nits
Frame Peak: 700 nits -> Target Nits: 190 nits
Frame Peak: 800 nits -> Target Nits: 198 nits
Frame Peak: 900 nits -> Target Nits: 206 nits
Frame Peak: 1000 nits -> Target Nits: 214 nits
Frame Peak: 2000 nits -> Target Nits: 270 nits
Frame Peak: 3000 nits -> Target Nits: 310 nits
Frame Peak: 4000 nits -> Target Nits: 343 nits
Frame Peak: 10000 nits -> Target Nits: 479 nits

HDR to SDR Gamma Compression (Continues Below...)
and this isnt even the release build , just wait what well get once aracnoz gets his hands dirty with madvr and kodis codebase , itll be even more epicness to come , not to mention x64 kodi being in talks over at the dev thread to make dsplayer even better , then get madvr x64 and all the x64 builds of the other filters up and running properly , reclock being the only one thats still in need of x64 goodness , im sure some guys already pmd its dev , these are great times indeed
HDR to SDR Gamma Compression (Continued...)

What Does Changing the Target Nits Look Like in Action?

I can show you some examples of what changing the display target nits looks like visually in terms of changing the shape of the highlight roll-off and how it alters the contrast of the image.

The sample display is an LED monitor set to SDR output that reaches a peak of approximately 175 real display peak nits.

Note: highlight recovery strength set to high

Avengers - Infinity War: 824 nits frame peak

500 target nits

275 target nits

Here, you can see both the difference in display luminance mapping and the space allocated to the highlight roll-off. The frame is paused so you can clearly see the detail of the bright starburst. A target of 500 display nits visibly lowers the APL of the image, particularly the background elements, but the more gradual roll-off provided by the larger target nits creates additional space to better render the fine detail of the starburst.

At 275 nits, the visible luminance steps are a little too close together at the peak of the roll-off, and as result, some clipping occurs at the display peak where portions of the rays of light lose texture detail, even washing out some of the facial detail of the character in the background.

2001 - A Space Odyssey: 1320 nits frame peak

500 target nits

175 target nits

The second example shows some lost texture detail in a very bright specular reflection. At first glance, the clipping of detail caused by the tone mapping roll-off is more subtle in this example. The frame peaks at 1320 nits, which is far brighter than either of the targets used. If you look at the reflection on the top and bottom of the astronaut's helmet, you can see that it becomes more reflective at 500 nits, like someone applied a buffing cloth to the surface of the helmet. The added depth and contrast provided by the higher target nits allows the small specular reflections to appear more three-dimensional so they appear brighter than the rest of the helmet.

The other hint of clipping caused by tone mapping compression is the bright green hallway light in the background that is blown out at 175 nits and restored at 500 nits.

Mission Impossible - Ghost Protocol: 914 nits frame peak

450 target nits

175 target nits

The third example shows how changing the display target nits can help to shift the image from a flat SDR presentation to more of a high dynamic range presentation. This scene in a dimly-lit garage features a single light source (a beam of bright sunlight) focused on a small portion of the image that peaks at 914 nits. The 1:1 representation of this scene at 175 nits with a neutral reference white makes the scene appear somewhat lifeless and SDR due to some obvious clipping of the specular highlights and the lack of contrast between the bright sunbeams and reference white. This makes the "bad guy" look somewhat less menacing and thoughtful.

Increasing the display target nits to 500 nits provides some noticeable improvement in the visible detail of the background elements, especially the foreign text on the crate in the back of the frame and the cardboard box placed to the left of the crate. But the higher target nits also noticeabley changes the contrast of the image similar to how changing the exposure on a camera is used to capture additional dynamic range.

The 2.86:1 ratio of display target nits to real display peak nits lowers reference white from 100 nits to approximately 35 nits, which causes some shadows to creep in on the face of the bad guy that are likely not inherent to the source footage. But the perceived increase in dynamic range better recreates the intended contrast of the scene by tightly focusing the rays of sunlight on the nearby canvas with less clipping and adding some contrast between the sunbeams and dimly-lit garage. This makes the bad guy appear a little more menacing and better uses the specular highlights as the director intended them to be used.

What Happens If the Source Has a Low Dynamic Range?

Blade Runner 2049: 116 nits frame peak

175 target nits

425 target nits

The intent of the target display value is to preserve HDR contrast. If the source happens to have a low dynamic range, this contrast can be unnecessary and will only serve to create a dark image.

Blade Runner 2049 is a classic example of an HDR movie with a low dynamic range. The majority of the presentation stays well under 200 nits. Here, high target nits simply cause the image to lose its vibrancy and colorfulness with no gain in true contrast. In this example, 425 target nits at 175 actual display nits appears as a mismatch in gamma that leaves the presentation looking dull and dark.

Closely mapping the target nits to the display will better preserve the brightness and color vibrancy of the source. You don't ever want to set this value below the peak brightness of your display because the image will be mapped with incorrect brightness and end up too bright and washed out.

This example also highlights how color accuracy can be distorted by using a high target nits. Tone mapping is designed to desaturate all colors as they lose luminance. The greater the mismatch between the target brightness and actual display brightness, the more oversaturated and dark color tones will appear, as all colors are displayed at a darker luminance than calculated by the tone mapping algorithm.

Summary

Because HDR content is about high dynamic range, it makes the most sense to preserve the HDR contrast of the source as much as possible. Sources with a lower dynamic range can use lower target nits to maintain the source brightness without having a negative impact on perceived contrast or detail. However, sources with a higher dynamic range require a choice between lowering the brightness of the source to represent its high contrast at a lower displayed brightness, or more accurately mapping the source brightness at the expense of clipping some bright detail through range compression.

madVR makes this decision intelligently by changing the display target nits to match the dynamic range of each movie scene. This alters the display target nits as the movie plays to always provide the ideal display target nits for each detected scene change. This eliminates the compromise of catering a curve to a low or high dynamic range by always selecting a display target nits that keeps the display curve in the "sweet spot" where no scene is ever compressed to the point of becoming too dark or too bright where not enough specular highlight detail is retained.

Part III: Dynamic Display Target Nits
Thank you to everyone involed in Kodi DSPlayer - great job !

Only thing I'm missing is possibility to select playlist while playing from Blu-ray structure - is there a chance that in the future such feature might be available ?
I am having issues with the latest build (2015-04-10), when I start a video Kodi freezes. Reverting back to the 2015-04-03 build allows playback again. Are there any new dependencies with the latest build?

On an unrelated note, is anyone else experiencing the mouse cursor on top of the video window? After every video is started the mouse cursor is shown dead center on the screen on top of the video window, when playback ends it returns to dead center on the Kodi interface. I am using MadVR to do the display rate switching. I was hoping the latest build would fix this issue.
Part III: Dynamic Display Target Nits

Note: Part I of Introduction to HDR to SDR Tone Mapping covers some fundamental issues in tone mapping for projectors. Part II offers a detailed technical definition of the display target nits and HDR to SDR tone mapping.

Topics Covered:
• What is a dynamic display target nits;
• How much dynamic range should be compressed;
• The FALL Algo and scene-based display target nits;
• Histogram-Shaped Tone Mapping;
• HDR to SDR display target nits waveforms with DaVinci Resolve.

What Is a Dynamic Display Target Nits?

The dynamic target nits option changes the display target nits for each detected movie scene in an HDR10 video. These changes in display target nits alter the amount of dynamic range captured by the tone curve for each movie scene with nits levels mastered above the display real display peak nits entered in madVR.

Changes to the display target nits resemble a change in displayed gamma: e.g., gamma 2.20, 2.25, 2.30, 2.35, 2.40, 2.45, etc., with the dynamic display target nits simply selecting the best "gamma curve" for each movie scene that provides the ideal amount of dynamic range compression to prevent the image from appearing too dim or too bright (clipped in the highlights).

The display target nits is adjusted on a scene-by-scene basis based on detected changes to madVR's real-time brightness histogram that looks for visible changes in average and peak pixel luminance. A movie scene is not described on the basis of having a distinct beginning and end, but as having a visible change in Average Picture Level (APL) that signals that a noticeable change in the composition of the image has occurred. By this definition, scene changes can be frequent. For instance, a muzzle flash from a gun would not be considered a scene change, but a conversation between two people that starts in front of a bright window and moves continuously into another room would be considered a visible change in APL that could benefit from a change in display target nits.

Changes to the display target nits occur regularly and in small increments to keep scene and corresponding APL changes smooth and largely invisible to the viewer. This prevents brightness pumping artifacts caused by frame-by-frame adjustments to the tone curve by not reacting to sudden camera cuts or large increases or decreases in peak or average brightness.

How Much Dynamic Range Should Be Compressed?

Determining the ideal display target nits for each movie scene requires some upfront understanding of the display limits. There is only so much dynamic range from the HDR source video that you can fit into a display with less peak brightness. If a display is asked to render one pixel at 1 nit and another at 1,000 nits, it must balance a contrast ratio of 1,000:1 between the brightest and dimmest objects in the scene. If the display can only produce 100 peak nits, it can at most create a native contrast ratio of 100:1 between a pixel mastered at 1 nit and the display limit of 100 peak nits. In order to replicate the native 1,000:1 contrast ratio on a 100 peak nits display, that 1 nit pixel must be rendered 10x darker (1,000 peak nits / 100 actual display nits) than originally mastered along with most other pixels between 0-100 nits that make up the majority of the image. At 10x compression, that 1,000 nit scene would likely appear very dark on a 100 nits display and necessitate using a much lower compression ratio to fit the scene to the display.

So while it might be desirable to compress 1,000 scene nits of dynamic range into a 100 nit display range (1,000 display target nits at 100 real display peak nits), it will quickly become apparent that the display lacks the necessary contrast to make this work for most movie scenes. Remember, image tones can only be redistributed by a tone curve within the available display range and not manufactured, so you only have so much contrast to work with for any display. The greater the disparity between the available display peak nits and the source peak nits, the more certain image tones will have be prioritized over others to prevent the entire image from appearing too dim from more linear display compression.

Because the display target nits is in fact scaled linearly by the display gamma curve at a ratio of display target nits / real display peak nits, the brightness of the entire image will decrease linearly with increases to the display target nits. The majority of a PQ HDR video is mastered within the bottom third of the PQ EOTF curve (or display gamma curve) where reference white is rendered, meaning linear gamma compression from high display target nits / real display peak nits compression ratios will cause the image to darken quite quickly as the display runs out of available brightness. The lower the peak nits of the target display, the faster the image will fade to black as the display struggles to create the necessary contrast.

Peak Luminance of PQ Reference White at Various Display Target Nits at 100 real display peak nits:

Mission Impossible: Ghost Protocol (1,089 frame peak nits)

100 display target nits (1:1) 100 nits reference white:

200 display target nits (2:1) 50 nits reference white:

300 display target nits (3:1) 33 nits reference white:

400 display target nits (4:1) 25 nits reference white:

500 display target nits (5:1) 20 nits reference white:

1,000 display target nits (10:1) 10 nits reference white:

The FALL Algo and Scene-Based Display Target Nits

The ideal display target nits for a given movie scene would take into account the available contrast of the end display and find a balance between preserving the source APL (preserving as much of the mastered brightness levels as possible) and adequately compressing the dynamic range of each scene (preserving the mastered HDR contrast without clipping the specular highlights).

Some discretion is required in this decision, as any display with less peak brightness than the source mastering monitor will have to give up some amount of brightness in order to replicate the higher contrast of the brighter mastering display and the perfect balance of brightness vs. contrast enhancement for each scene is often in the eye of the beholder. So the ideal HDR tone mapping solution for dimmer HDR displays would permit some type of user adjustment to the balance of brightness preservation and adding HDR contrast.

madVR tackles the delicate balance of brightness vs. contrast by calculating what the Average Picture Level of the image will be at the end display after tone mapping and display gamma compression are applied. This uses the real display peak nits provided to madVR as the target display range with the goal of never allowing any bright HDR scene to be compressed below a certain level of the target display range.

The original brightness of each movie scene is determined based on its Average Picture Level that is described in static HDR10 metadata as the Maximum Frame Average Light Level, or MaxFALL, which madVR expands by calculating a FALL value for each video frame (the frame FALL). Because display Gamma Compression is applied linearly to the entire gamma curve, it makes most sense to know the APL of each scene before it is compressed to determine how much of the original scene APL can be lost before the starts to become too dim at the end display.

The frame FALL is defined by madVR as the average peak nits of all pixels in one frame — the midpoint brightness of all pixels in each video frame. A frame FALL is assigned to each scene by averaging the peak luminance of all pixels in the first frame of the scene. This is done using a real-time luminance and hue brightness histograms.

The real-time luminance and hue histograms measure the peak luminance of each incoming PQ source value and group all pixels into columns that define the mastered nits and relative positioning of each pixel within the image (e.g., shadow, midtone or highlight). From left-to-right on the histogram, pixel luminance is distributed across the lower shadows, middle midtones and upper highlights with the highest hills on the right side of the histogram representing the scene peak nits and the average luminance of all pixels in the histogram becoming the calculated frame FALL.

madVR OSD - Luminance & Hue Brightness Histograms:

The frame FALL of any scene tells you two important things: it tells you how far above black the scene is mastered and how much of the image is likely mastered above 100 nits as specular highlights.

Knowing the average brightness of each movie scene relative the available real display peak nits of the end display gives you an estimate of much headroom you have above the black level of the target display to lineary (or gamma) compress the dynamic range of the scene before visible near detail black is lost. This provides madVR with the ability to choose a gamma compression ratio that moves each scene back into the available display range without ever moving too much of the image into the darkest nits levels.

The frame FALL also offers some indication of where most brightness levels are distributed within the scene. High frame FALLs generally have large portions of the image mastered as specular highlight detail above 100 nits. These brighter HDR scenes require that much higher display target nits are used to adequately move the highlights far enough within the smaller display range to avoid mapping too many pixels near the display peak limit. This most often creates obvious display clipping where large numbers of pixels become grouped together near peak white causing visible losses of detail and color saturation from blown out highlight detail.

Low frame FALLs, on the other hand, tend to have smaller specular highlights that make up a small fraction of the overall frame. These less bright HDR scenes can be compressed with lower display target nits that sacrifice some specular highlight detail that often goes unnoticed anyways, but spares these scenes from becoming too dark by limiting tone compression for the majority of the image.

Examples of Typical HDR10 Movie Scene FALLs:

Low FALL: 0-10 nits (MI Ghost Protocol):

Average FALL: 10-25 nits (MI Ghost Protocol):

High FALL: > 25 nits (MI Ghost Protocol):

How the FALL Algo Works:

Scenes are assigned a display target nits using a general formula that takes into account both the frame peak of the scene to determine if dynamic range compression is required and a frame FALL value that is used to judge the amount of dynamic range compression that can be applied. These changes to the display target nits occur whenever a scene change is determined to have occured based on the dynamic hue and luminance histograms.

If the scene peak nits is equal to or less than the real display peak nits entered in madVR, the display target nits will match the real display nits and all source values are sent without tone mapping. If the nits level of a scene rises above the real display peak nits, the display target nits will increase above the real display peak nits to better compress any source values that are mastered above the available light output of the display.

Increases to the real display peak nits are applied based on the frame FALL of the scene. The frame FALL of each scene is added to the real display peak nits and then multiplied by an adjustable multiplier to determine the final display target nits for the scene. As the scene APL increases, the display target nits will also increase linearly to ensure high scene APLs are matched to higher levels of dynamic range compression.

If the calibrated peak nits of the target display is 150 nits or less, scenes that require dynamic range compression will use a default 150 display target nits as a base value. This fixed 150 display nits ensures the calculated display target nits for each scene remains consistently high enough to provide enough dynamic range compression for displays that lack the necessary peak brightness to compress bright HDR scenes back into the the upper end of the display range without excessive range clipping.

FALL Algo Formula:

Max(150 nits, real display peak nits) + [2 x scene FALL x (dynamic tuning multiplier)] = final display target nits

The display target nits moves linearly with changes to the scene FALL.

Scene Peak Nits <= real display peak nits: display target nits = real display peak nits

When a scene can be rendered accurately by a display, no compression is applied. Scenes with brightness levels below the real display peak nits are rendered with 1:1 PQ EOTF tracking and that represents the source luminance as it was originally intended.

Scene Peak Nits > real display peak nits: display target nits > real display peak nits

Low frame FALL:

When a scene with a peak nits above the real display peak nits has low frame FALL, only a small increase is made to the display target nits to reflect the low black floor of the scene and the small amount of mastered specular highlights. Some clipping of the specular highlights in permitted to protect the majority of the scene from unwanted tone compression.

High frame FALL:

When a scene with a peak nits above the real display peak nits has high frame FALL, a much larger increase is made to the display target nits to reflect the high black floor of the scene and the larger amount of specular highlight detail mastered above 100 nits. More aggressive dynamic range compression is applied to move the scene levels far enough into display range with enough headroom to prevent high scene APLs from clipping at the display peak and washing out large portions of the image.

Below is an example of how the FALL algo impacts the frame FALL after tone mapping when applied to scenes with varying FALL values. As you can see, any increase to the scene FALL results in linear increases to the display target nits. Yet, brighter scenes still end up with higher FALL values after tone mapping than less bright scenes and all frame FALLs after compression become closer in average brightness — the average brightness levels of the entire video are compressed to a narrower display range.

Example of Applying Different Display Target Nits to Various Scene FALLs:

Scene Peak: 100 nits, frame FALL: 2 nits
100 display target nits / 100 real display peak nits (1:1 compression) = 2 nits frame FALL after tone mapping

Scene Peak: 500 nits, frame FALL: 8 nits
166 display target nits / 100 real display peak nits (1.66:1 compression) = 5 nits frame FALL after tone mapping

Scene Peak: 1,000 nits, frame FALL: 16 nits
182 display target nits / 100 real display peak nits (1.82:1 compression) = 9 nits frame FALL after tone mapping

Scene Peak: 1,000 nits, frame FALL: 30 nits
210 display target nits / 100 real display peak nits (2.1:1 compression) = 14 nits frame FALL after tone mapping

Scene Peak: 1,500 nits, frame FALL: 60 nits
270 display target nits / 100 real display peak nits (2.7:1 compression) = 22 nits frame FALL after tone mapping

The original FALL values for each scene in this example range from 2 nits - 60 nits (58 nits). After applying the dynamic display target nits to the source values of all scenes, the scene FALLs are compressed to within 20 nits (2 nits - 22 nits).

The compressed dynamic range of all scenes now more accurately reflects the smaller dynamic range of the end display. The result is a similar APL for each scene with small and smooth changes in display target nits that blend together as scene changes occur. Keeping the display curve in the "sweet spot" where average brightness remains consistent from scene-to-scene also provides the secondary benefit of hiding display target nits changes that might otherwise result in visible brightness pumping artifacts.

Histogram-Shaped Tone Mapping — Local Tone Mapping

The display target nits value provides a simple method to handle the variable dynamic range of HDR videos by providing means to dynamically scale scene contrast as the video plays. However, this form of tone mapping uses global curves with linear tone compression that are designed to preserve global contrast and the average brightness of each reference scene.

The problem with this global approach to tone mapping when applied to the typical movie scene is that most movies are not color graded to have equal or consistent amounts of content rendered in the shadows, midtones and highlights. Each scene will have its own display curve that will inevitably lead to disproportionate losses of fine detail in certain areas of the image and reductions in local contrast as certain image areas end up compressed more than others.

For instance, a scene may have a high measured frame FALL, but have almost equal amounts of content mastered as specular highlights and shadow detail. Use of high display target nits for these mixed-brightness scenes will linearly compress both the specular highlights and shadows at the same time, which will create desirable compression for the bright specular highlights, but this aggressive gamma compression will also lead to visible losses of near black detail.

Similarly, a scene with a high peak brightness but an average frame FALL may have most of the image rendered in the shadows and midtones with smaller specular highlights that occupy a limited amount of the screen space. This would lead to the selection of a low to moderate display target nits for the scene that would result in a significant loss of contrast from the original scene as the low display target nits must forcibly compresses the highlights in order to preserve the majority of the scene APL.

To restore some of the local details and local contrast typically lost in HDR tone mapping, madVR applies uses local tone mapping to further optimize the gamma curve. Local tone mapping enhances local contrast and better preserves local details by reducing tone compression for areas of the image that have the most visible pixels and enhancing the contrast of these areas compared to any nearby objects.

madVR calls its approach to local tone mapping Histogram-Shaped Tone Mapping (HSTM). HSTM uses the real-time pixel luminance histogram to prioritize tone compression for areas of the image that have the highest pixel distribution. Because luminance histograms report the distribution of pixels concentrated at a certain luminance and tone (shadow, midtone or highlight), a large number of pixels mapped to the same mastered luminance will create a large hill in the histogram.

Hills that are above the midpoint of the histogram have the most visible pixels and are compressed less to restore some lost brightness, detail and color volume. Hills that are below the midpoint of the histogram chart are compressed more to appear darker and less colorful to offset the expansion of the larger hills on the gamma curve.

Curve expansion and compression from HSTM changes the shape of the gamma curve and will vary from scene-to-scene depending on the unique pixel distribution of each scene. Bright HDR scenes see improvements in contrast through local contrast enhancement. Mixed-brightness and dim HDR scenes see improvements in near black shadow detail through local contrast recovery. The end result is that any of the shadows, midtones or highlights are boosted by HSTM depending on where the bulk of the pixel luminance is distributed in each scene.

What Is Histogram-Shaped Tone Mapping?
*To be added at a later date.

Spears & Munsil UHD HDR Benchmark 10,000 nits MaxCLL (HSTM Off):

Spears & Munsil UHD HDR Benchmark 10,000 nits MaxCLL (HSTM On):

Summary of Primary Pixel Shaders Tone Mapping Image Processing Steps:

1. FALL Algo:

The ideal display target nits is calculated for each scene change as detected by the real-time luminance and hue histograms.

2. PQ BT.2390 Tone Mapping Curve:

madVR calculates a compressed display curve for the scene that matches the selected display target nits by applying a PQ BT.2390 tone mapping curve to roll-off the frame peak nits so the brightest pixels in the scene are mapped to the display target nits.

3. Histogram-Shaped Tone Mapping:

The compressed PQ BT.2390 gamma curve is then optimized using the pixel luminance histogram to improve local detail preservation and enhance contrast. Histogram hills above the midpoint of the graph with the highest concentration of pixels with similar mastered luminance are expanded to be brighter and more colorful, and pixel distributions below the midpoint of the histogram with low concentrations of similar mastered pixels are further compressed to be darker than more visible areas. Depending on the distribution of pixel luminance in each scene, these HSTM adjustments will either lead to improved HDR contrast (local contrast enhancement) or a restoration of detail in the shadows and midtones (local contrast recovery).

4. Recalculate Final Display FALL:

The final HSTM processing result is rescaled in displayed FALL to have the same average on-screen brightness (APL) as the selected display target nits before HSTM tone mapping was applied.

Dynamic Display Target Nits (Continues Below...)
(2015-04-17, 21:33)Warner306 Wrote:
(2015-04-17, 16:46)Jdiesel Wrote: I am having issues with the latest build (2015-04-10), when I start a video Kodi freezes. Reverting back to the 2015-04-03 build allows playback again. Are there any new dependencies with the latest build?

On an unrelated note, is anyone else experiencing the mouse cursor on top of the video window? After every video is started the mouse cursor is shown dead center on the screen on top of the video window, when playback ends it returns to dead center on the Kodi interface. I am using MadVR to do the display rate switching. I was hoping the latest build would fix this issue.

Do not use madVR to do the display mode switching. You will encounter freezing and other issues depending on your hardware. The easiest way to do this is to disable the radio button under display modes. I also find lip-sync is better when Kodi does the refresh rate switching. aracnoz has mentioned display mode switching is not as reliable as it should be. But it won't be fixed for some time. For now, you should let Kodi handle this task.

I am not seeing the mouse cursor. This cursor will only appear if the mouse was used minutes before the video is started. Otherwise, it should be invisible. Kodi is best controlled with a remote, so perhaps your keymap could be improved to limit your use of a mouse. Almost any command or window can be mapped directly to a remote key. The ghost mouse is not a mistake; Kodi is designed to be used with a remote. The cursor is a reminder the mouse is still active.

I will try letting Kodi handle the refresh rate switching. As for the mouse cursor, I don't use a mouse to control Kodi and mouse and touch screen support is disabled in the settings. The only mouse attached to the HTPC is a trackpad on my wireless keyboard that is turned off except when I need to mess around behind the scenes. It is almost as if the video window loses focus when the refresh rate is switched similar to what happens when you click on a second monitor and then move the mouse cursor back over the video window. I have a feeling that these two issues are linked and switching to Kodi's refresh rate switching may solve things.
Is someone trying to create an all-in-one installer like lav megamix or the kawaii codec pack?
This would be really awesome!
Dynamic Display Target Nits (Continued...)

HDR to SDR Display Target Nits Waveforms with DaVinci Resolve

To provide some visual examples of what occurs to the distribution of pixel luminance on the display curve after before and after HDR to SDR tone mapping is applied, some movie scenes will be plotted as waveform graphs using popular color grading software DaVinci Resolve. A considerable amount of the HDR10 (as well as HDR10+ and Dolby Vision) content available today is color graded with DaVinci Resolve Studio software. Resolve is available for purchase as a complete video mastering and color grading editing suite or can be downloaded for free as a stripped-down version offering the most basic functionality.

A video waveform graph is a visual representation of pixel luminance in a single video frame based on mastered PQ values. All pixels in each frame are graphed as a 2D representation that plots the luminance of each pixel (as indicted by its mastered PQ code value) relative to its precise position within the frame. These waveforms plots produce a continuous wave shape that provides a quick visual reference of the overall brightness of each frame along with some indication of the relative PQ luminance and positioning of the shadows, midtones and highlights within each frame. Video waveforms are used when color grading to allow the colorist to easily visualize where pixel luminance is distributed within a given frame and to control the mastered brightness of the video by observing changes to mastered code values, or bits, as the image tone controls are adjusted within the editor.

DaVinci Resolve provides labeled HDR waveforms in the scopes panel for the active video frame in the editor window. The HDR scopes separate each pixel in each frame into its individual red, green and blue color channels along with its corresponding PQ luminance on the PQ (Perceptual Quantizer) source scale. A typical HDR waveform from Resolve is shown below with labels indicating the luminance of notable 10-bit PQ values on the graph.

DaVinci Resolve Waveform Legend (10-bit PQ Values):

The sample display used has a real display peak nits of 100 nits (a typical calibrated peak luminance for an HDR front projector).

Three test scenes from the Avengers: Infinity War UHD Blu-ray are used as the sample scenes to produce waveform graphs by importing a single frame from each scene into DaVinci Resolve. HDR waveforms were produced by using lossless SDR BT.709 PNG screenshots from MPC-BE that were imported into the Resolve Timeline. Because an SDR screenshot is used in these examples, some precision is lost in the conversion back to ST.2084 PQ HDR values. For example, if the two waveforms are layered on top of each other, it is possible to see very slight differences in pixel distributions beyond those caused by converting from ST.2084 PQ to BT.709 SDR gamma. However, the minor differences between the before and after luminance waveforms are slight enough to consider the sample waveforms to be accurate representations of the HDR to SDR tone mapping curve applied by madVR.

Scene #1

real display peak nits: 100 nits (dynamic tuning: 100)

measured frame 100 nits, tone map 111 nits
frame FALL 1.759 nits
HDR -> SDR using shaders, BT.2390 (100nits), no hue shift

Note: To see the measured frame FALL (1.759 nits) and selected display target nits (100nits) for each video frame in the madVR OSD during playback, create a blank folder named "ShowHdrMode" and place it in the madVR installation folder.

Frame Peak 100 nits:

Tone Mapping — Before & After:

Frame Peak and Reference White — Before & After:

The first frame has a frame peak of 100 nits with a low frame FALL of 1.759 nits.

Because the scene peak in this case is 100 nits and the assumed peak luminance of the target display (or its real display peak nits) is also 100 nits, no tone mapping is required for this scene. The display is capable of rendering all source values 1:1, so the input and output HDR waveforms are unchanged from the mastered PQ values.

In this case, it doesn't matter that the original mastering display has a stated peak brightness of 1,000 nits and the end display is only capable of 100 peak nits. The dynamic display target nits acknowledges that the scene is within the display's capabilities and selects 100 display target nits to present the scene as it was originally mastered.

Many scenes in HDR videos with low frame peaks tend to also have low frame FALLs with low mastered source levels. So avoiding display target nits values optimized for brighter HDR scenes is typically necessary to preserve the prominent shadow detail that is often present in these low frame FALL scenes.

Compressing Brighter HDR Scenes by Increasing the Display Target Nits

The next two examples see mastered brightness levels rise well above 100 nits. In these cases, tone mapping becomes necessary in order to lower the brightness of source levels mastered brighter than the available light output of the target display.

The display target nits is increased above the real display peak nits of 100 nits when the measured frame (nits level) is higher than the real display peak nits entered in madVR.

Raising the display target nits above the actual display peak nits creates some additional headroom at the top of the display range to better render the specular highlights without clipping. This increase to the display target nits has the effect of lowering the Average Picture Level (APL) to increase displayed contrast. This better creates the illusion of a high dynamic range images at much lower levels of peak brightness.

The amount the display target nits is increased above the real display peak nits (which is 100 nits in this case) depends on the measured frame FALL as reported by the dynamic luminance and hue histograms.

The higher the frame FALL, the higher the display target nits and the more dynamic range compression is applied. The lower the frame FALL, the more gradual the increase in display target nits to avoid pushing large amounts of the image down towards black that would otherwise have low and mid FALL scene appear overly dark and compressed.

Scene #2

measured frame 1073 nits, tone map 1073 nits
frame FALL 10.614 nits
HDR -> SDR using shaders, BT.2390 (211nits), no hue shift

Frame Peak 1,073 nits:

Tone Mapping — Before & After:

Frame Peak and Reference White — Before & After:

The second frame has a frame peak of 1,073 nits with an average frame FALL of 10.614 nits.

With the frame peak now above the available display peak nits of 100 nits, the display target nits is raised to 211 nits. This adds additional contrast at a 2.11:1 ratio:

211 display target nits / 100 real display peak nits = 2.11:1 Display Gamma Compression Ratio

If you look at the before and after waveforms, this 2.11:1 contrast enhancements helps to alleviate some of the stress placed on the specular highlights in the frame when the scene is compressed to the 100 nits real display peak. In this case, the specular focus of the scene is the glowing, blue Tesseract cube in the hands of Ebony Maw that is represented directly in the middle of the waveform and peaks at 1,073 PQ nits.

Compressing only 211 display target nits of the original 1,073 scene nits does lead to some loss of the brightest details in the Tesseract. You can observe this clipping of detail in the waveform by looking at the change in waveform shape that occurs in the center of the graph. The top level of the original (Before) waveform becomes noticeably flatter when aggressively compressed to the 100 nits real display peak (After) waveform. If you look closely at the glowing cube, you will notice that some detail is indeed slightly blown out towards the center of the Tesseract.

Any specular highlight clipping caused by tone mapping is considered a trade-off to prevent the bulk of the scene from being compressed by an unnecessarily high display target nits. Despite having a steep frame peak of 1,073 nits, the frame FALL of scene this is actually average at 10.614 nits. The dynamic display target nits chooses a value that compresses the scene enough to add some much needed contrast between the compressed frame peak (100 nits) and reference white (47.39 nits) to come closer to the original 10.73:1 ratio of between the original 1.073 nits frame peak and reference white without making the overall scene darker than Scene #1 (which has a very limited frame FALL of 1.759 nits).

The chosen display target nits of 211 nits lowers the frame FALL from 10.614 nits to 5.010 nits:

10.614 nits Original frame FALL / 2.11:1 Display Gamma Compression Ratio = 5.010 nits Tone Mapped frame FALL

This is 2.11:1 gamma compression ratio provides a good balance of brightness and contrast to better represent the high contrast of this scene without pushing too much of the source levels into the lowest part of the display range.

Extreme Example — Too Much Dynamic Range Compression

Extreme cases are a way to show how the display target nits can erode shadow detail when the target is a mismatch for the scene. This most often occurs when a scene has an extreme combination of a high frame FALL with high levels of specular highlight detail matched with large patches of near black shadow detail. These mixed brightness scenes cause the FALL Algo to select a high display target nits for the scene.

This scene from Black Hawk Down is a good example of an obvious display target nits / scene FALL mismatch. A very bright patch of sky detail is matched with a dark helicopter interior that leads to the selection of an aggressive 1,500 display target nits to compress the highlights in the scene.

Black Hawk Down Helicopter Interior (Extensive Shadow Detail Loss):
Black Hawk Down 1500 display target nits
Black Hawk Down 1500 display target nits with shadow detail recovery

This frame clearly shows the limitations of capturing all scenes with a simple display target nits value. At 1,500 display target nits, compression on a 100 true nits display would be 15:1 (1500 display target nits / 100 real display peak nits = 15:1 gamma compression ratio). If two nearby pixels were encoded at 0.1 nits and 0.2 nits (a difference of 0.1 nits), a display target nits of 1,500 nits would compress these two pixels to 0.006 nits and 0.01 nits (a difference of only 0.007 nits). This would erase any visible difference between the two pixels resulting in near black crush. To counter this, madVR includes some protection for shadow detail loss by reversing some of this compression with the final Histogram-Based tone adjustments and a shadow detail recovery filter that is activated for bright HDR scenes.

Scene #3

measured frame 850 nits, tone map 850 nits
frame FALL 240.890 nits
HDR -> SDR using shaders, BT.2390 (809nits), no hue shift

Frame Peak 850 nits:

Tone Mapping — Before & After:

Frame Peak and Reference White — Before & After:

The third frame has a frame peak of 850 nits with a high frame FALL of 240.890 nits.

The very high frame FALL of this frame means most the source levels are above 100 nits and a large amount of range compression will be necessary to move the entire waveform back into the display range without losing large amounts of highlight detail at the top of the display curve.

A high gamma compression ratio is used for this frame by using a display target nits of 809 nits. This increases displayed contrast at a 8.09:1 ratio:

809 display target nits / 100 real display peak nits = 8.09:1 Display Gamma Compression Ratio

The 8.09:1 compression ratio means the image will be rendered 8.09x darker by the display than mastered. While this would make most scenes uncomfortably dark, 809 display target nits when applied to this scene is barely able to maintain the uniform level of bright highlight detail present in the scene.

If you look at the after waveform, you'll notice the large, flat shape of the original HDR waveform is almost entirely preserved by the 809 display target nits. The shapes of the top of the before and after waveforms are almost identical. This means no detail is lost to clipping, and despite the 8.09:1 display gamma compression ratio and lowering reference white to a mere 12.36 nits, the entire waveform for the scene still remains well above the bottom black floor.

Tone mapping lowers the frame FALL from 240.890 nits to 29.776 nits:

240.890 nits Original frame FALL / 8.09:1 Display Gamma Compression Ratio = 29.776 nits Tone Mapped frame FALL

While this drop in frame FALL means the scene has been dimmed significantly by tone mapping, the frame FALL after tone mapping manages to stay higher than Scene #1 (1.759 nits) and Scene #2 (5.010 nits). So Scene #3 will see a visible lowering of gamma, but the scene will still appear appropriately brighter than less bright scenes with lower frame FALLs.

Extreme Example —  Too Little Dynamic Range Compression

Occasionally, scenes or movies will feature very high frame FALL values that can demonstrate how much detail is lost to range clipping. One such example is the outdoor-shot The Meg that features consistent scenes with mastered frame FALLs greater than 1,000 nits where even moderate display target nits such as 500 nits will fail to avoid widespread losses of highlight detail that wash out detail from the image.

For example, this oceanic scene from The Meg necessitates using a display target nits of greater than 2,000 nits to adequately compress the highlights in the scene and retain the fine detail in the sky, ocean and characters in the foreground. Lower display target nits present this scene as a hazy mess pushing contrast to the extreme and losing visible texture detail everywhere to blown out highlights in various parts of the image.

The Meg Bright Outdoor Scene (Excessive Highlight Loss):
The Meg 500 display target nits
The Meg 3000 display target nits

*Screenshots courtesy of NEO-XP.

Movies like The Meg that are primarily based around outdoor-lit shots with copious amounts of bright sunlight are not common. But any scene with a high frame FALL requires a high display target nits to keep texture detail from disappearing from the scene.

Summary of the Results of Tone Mapping

The figures below summarize the different amounts of dynamic range compression applied by each display target nits. As the scene frame FALL increases, so too does the amount of tone compression applied by the gamma curve through increases to the display target nits.

Scene #1:

FALL Before: 1.759 nits
FALL After: 1.759 nits

Frame Peak: 100 nits
Display Target Nits: 100 nits
Reference White: 100 nits

Scene #2:

FALL Before: 10.614 nits
FALL After: 5.010 nits

Frame Peak: 1,073 nits
Display Target Nits: 211 nits
Reference White: 47.39 nits

Scene #3:

FALL Before: 240.890 nits
FALL After: 29.776 nits

Frame Peak: 850 nits
Display Target Nits: 809 nits
Reference White: 12.36 nits

While each scene is mapped to a lower brightness than originally encoded, the frame FALL after tone mapping remains higher for brighter scenes than less bright scenes and all scenes are compressed to be closer in average brightness. This keeps contrast consistent throughout the presentation and helps to hide changes to the display target nits as scene changes occur.

A dynamic display target nits offers finer control over the use of contrast to ensure every scene in a movie has similar perceived brightness and contrast that is appropriate for the scene's brightness and contrast. If the real display peak nits entered in madVR is an accurate estimate of the actual display peak nits, brightness at the end display should always remain in the "sweet spot" of the display curve where no scene is ever too bright or too dark relative to the peak nits of the display.
I still can't get any build besides the 20150403 build to play. I've tried multiple on my gaming PC and it hangs when starting a video as well. Also tried doing a fresh install of the base Kodi and then the DSPlayer build. MPC-HC still plays all MadVR video fine. Is any logging that I can so? The Kodi log doesn't show anything that I can see.

Code:
18:01:59 T:7220  NOTICE: Thread BackgroundLoader start, auto delete: false 18:02:00 T:4828  NOTICE: Thread JobWorker start, auto delete: true 18:02:04 T:7916  NOTICE: CDSPlayer::OpenFile - DSPlayer: Opening: smb://192.168.1.4/storage/storage10/Movies/1080p.BluRay.DTS.mkv 18:02:04 T:7916  NOTICE: CDSPlayer::OpenFileInternal - DSPlayer: Opening: smb://192.168.1.4/storage/storage10/Movies/1080p.BluRay.DTS.x264.mkv 18:02:04 T:9032  NOTICE: Thread CDSPlayer thread start, auto delete: false 18:02:04 T:9032  NOTICE: CDSPlayer::Process - Creating DS Graph 18:02:04 T:9032  NOTICE: Loading filter core factory settings from special://profile/dsplayer/filtersconfig.xml (filters configuration). 18:02:04 T:9032  NOTICE: Loading filter core factory settings from special://xbmc/system/players/dsplayer/filtersconfig.xml (filters configuration). 18:02:04 T:9032  NOTICE: Loading filter core factory settings from special://profile/dsplayer/mediasconfig.xml (medias configuration). 18:02:04 T:9032  NOTICE: Loading filter core factory settings from special://xbmc/system/players/dsplayer/mediasconfig.xml (medias configuration). 18:02:04 T:9032  NOTICE: Successfully loaded rules 18:02:04 T:9032  NOTICE: CFGLoader::InsertAudioRenderer Successfully added "" to the graph [code]
[/quote]
(2015-04-21, 02:04)Jdiesel Wrote: I still can't get any build besides the 20150403 build to play. I've tried multiple on my gaming PC and it hangs when starting a video as well. Also tried doing a fresh install of the base Kodi and then the DSPlayer build. MPC-HC still plays all MadVR video fine. Is any logging that I can so? The Kodi log doesn't show anything that I can see.

Code:
18:01:59 T:7220  NOTICE: Thread BackgroundLoader start, auto delete: false 18:02:00 T:4828  NOTICE: Thread JobWorker start, auto delete: true 18:02:04 T:7916  NOTICE: CDSPlayer::OpenFile - DSPlayer: Opening: smb://192.168.1.4/storage/storage10/Movies/1080p.BluRay.DTS.mkv 18:02:04 T:7916  NOTICE: CDSPlayer::OpenFileInternal - DSPlayer: Opening: smb://192.168.1.4/storage/storage10/Movies/1080p.BluRay.DTS.x264.mkv 18:02:04 T:9032  NOTICE: Thread CDSPlayer thread start, auto delete: false 18:02:04 T:9032  NOTICE: CDSPlayer::Process - Creating DS Graph 18:02:04 T:9032  NOTICE: Loading filter core factory settings from special://profile/dsplayer/filtersconfig.xml (filters configuration). 18:02:04 T:9032  NOTICE: Loading filter core factory settings from special://xbmc/system/players/dsplayer/filtersconfig.xml (filters configuration). 18:02:04 T:9032  NOTICE: Loading filter core factory settings from special://profile/dsplayer/mediasconfig.xml (medias configuration). 18:02:04 T:9032  NOTICE: Loading filter core factory settings from special://xbmc/system/players/dsplayer/mediasconfig.xml (medias configuration). 18:02:04 T:9032  NOTICE: Successfully loaded rules 18:02:04 T:9032  NOTICE: CFGLoader::InsertAudioRenderer Successfully added "" to the graph [code]

Have you tried the build dated 0417? It includes further improvements to video start-up.

The display modes field in madVR should be left blank and Kodi should be left to handle refresh rate switching. I know this was mentioned before, but freezing problems have been encountered due to this issue.

I'm sure you've already tried the following Troubleshooting Tips, but I'll post the link again:

1966608 (post).

Lastly, are you sure you are using the 32-bit versions of each filter? DSPlayer is an x86 application.
There is a PDB file on the first page. When debugging, it is advised to place the PDB file in the same folder as the Kodi.exe (executable).

You should post your complete log file via Pastebin.

You might also have to provide a madVR crash report. This report is reproduced by pressing CTRL+ALT+SHIFT+BREAK when the system is frozen. The report will appear on the desktop.

On my Logitech keyboard, Break/Pause is initialized by pressing FN + P. So a madVR crash report is created by pressing CTRL+ALT+SHIFT+FN+P.
video\audio seems to be out of sync when resuming files with subtitles enabled.

with them disabled it works fine.

Also whats with the gui lag? i haven't changed any settings yet and i'm just using my system directshow stuff but theres like 3-5 seconds of lag everytime i start\end a video.
I am facing issue with Lav Splitter and/or Kodi DSPlayer, I don't know, and maybe someone would have some clue :

- it sometimes play the wrong audio track (depnding on the movie) : "eng" when I did selected "fre" in LAV Splitter

- forced subtitles are not displayed inside Kodi DSPlayer BUT are correctly displayed when I play the same movie inside MPC-HC

I don't know if it is a revelant info or not but I use Kodi in portable mode (-p switch) and use a MySQL centralized database.

Thanks
(2015-04-21, 13:10)Shogunreaper Wrote: video\audio seems to be out of sync when resuming files with subtitles enabled.

with them disabled it works fine.

Also whats with the gui lag? i haven't changed any settings yet and i'm just using my system directshow stuff but theres like 3-5 seconds of lag everytime i start\end a video.

The lag is due to the way madVR renders frames in advance. This can't be fixed with the current implementation of DSPlayer. A new madVR version addressing this issue would likely be required.
•
• 1
• 17
• 18
• 19(current)
• 20
• 21
• 509
•