# Absolute scaling of texture values for HDR (BT2100) videos

**URL:** <https://psychtoolbox.discourse.group/t/absolute-scaling-of-texture-values-for-hdr-bt2100-videos/5722>\
**Category:** Programming Help\
**Tags:** windows, linux\
**Created:** [June 5, 2025, 10:42am UTC](https://psychtoolbox.discourse.group/t/absolute-scaling-of-texture-values-for-hdr-bt2100-videos/5722 "2025-06-05T10:42:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mantiuk](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@mantiuk](https://psychtoolbox.discourse.group/u/mantiuk)\
**Post date:** [June 5, 2025, 10:42am UTC](https://psychtoolbox.discourse.group/t/absolute-scaling-of-texture-values-for-hdr-bt2100-videos/5722/1 "2025-06-05T10:42:02Z")

</div>

When reading frames from HDR video files (BT2100), the values in the textures seem to be in linear RGB BT.2020 colorspace, but absolute scaling of those values differs depending on how the corresponding Psychtoolbox window is opened. What is the scaling constant when Psychtoolbox window is opened **without** EnableHDR ?

Details:

I open Psychotoolbox window on an HDR display with the following options:

```auto
 PsychImaging('AddTask', 'General', 'EnableHDR', 'Nits', 'HDR10');
 PsychImaging('AddTask', 'General', 'FloatingPoint32Bit');
 PsychImaging('AddTask', 'General', 'NormalizedHighresColorRange');

```

or for a non-HDR display with only (I need to handle both cases):

```auto
 PsychImaging('AddTask', 'General', 'FloatingPoint32Bit');
 PsychImaging('AddTask', 'General', 'NormalizedHighresColorRange');

```

I open the video file:

```auto
async=0;
preloadSecs=1;
specialFlags1 = 2 + 16 + 32; % do not play audio + convert all video textures immediately into the RGB format + looping strategy
pixelFormat=11; % HDR10
maxNumberThreads=-1;
movieOptions=[];

[obj.movie, movieduration, new_fps, img_w, img_h, count, aspectRatio, hdrStaticMetaData]= Screen('OpenMovie', obj.win, fname, async, preloadSecs, specialFlags1, pixelFormat, maxNumberThreads, movieOptions); 

```

The videos are encoded as BT2100 with the PQ EOTF.

When I set `'EnableHDR', 'Nits', 'HDR10'` and open a window on an HDR-enabled display, `Screen('GetMovieImage', ...);` gives me frame that is scaled in absolute colorimetric values (from 0.005 to 10000), as expected.

But when I open a regular window on an SDR display, the values are normalized to a different range. For one video that had the peak linear color value of 10000, the maximum was 33.2099.

When reading a HDR video and with a non-HDR window open, how is the absolute scaling determined?

Can I disable such scaling and always obtain absolute linear RGB values?

'3.0.17 - Flavor: beta - Corresponds to SVN Revision 12153

---

<div class="post-metadata">

**Author:** ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)\
**Post date:** [June 6, 2025, 12:49pm UTC](https://psychtoolbox.discourse.group/t/absolute-scaling-of-texture-values-for-hdr-bt2100-videos/5722/2 "2025-06-06T12:49:16Z")

</div>

Look at the explanation for setting 11 for the optional `pixelFormat` parameter in `Screen('Openmovie', ...)` on how to use the same HDR/WCG movie decoding for an SDR window as would be used by default on a HDR window. That might do the trick. pixelFormat defaults to 4 for SDR windows, 11 for HDR windows, as explained in that help. 4 uses a different EOTF.

Then read the help of `Screen Hookfunction?` the section about `SetHDRScalingFactors` to see how pixelFormat 11 WCG/HDR movie content is mapped to framebuffer values. Lines 370 and following of `PsychHDR.m` will show you how this is set up by default for HDR-10 windows.

Greetings from the Spain vacation, lots of HDR content here right now.

---

<div class="post-metadata">

**Author:** ![mantiuk](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@mantiuk](https://psychtoolbox.discourse.group/u/mantiuk)\
**Post date:** [June 6, 2025, 2:17pm UTC](https://psychtoolbox.discourse.group/t/absolute-scaling-of-texture-values-for-hdr-bt2100-videos/5722/3 "2025-06-06T14:17:56Z")

</div>

Thank you. `SetHDRScalingFactors` was exactly what I had to change. I set `maxSDRToHDRScaleFactor` to 100000 and now the textures are scaled in absolute units.
