Automatic HDR (and Dolby Vision: LLDV) / SDR signal detection and tone mapping control for HyperHDR
awawa-dev opened this issue · comments
Based on the empirical values in the stream returned by the grabbers, we can observe that the captured HDR signal has a quite reduced maximum brightness. For the RGB range [0-255] it is most often below 150-160 for HDR. Using this fact, we can implement automatic detection of the HDR / SDR signal by:
- allowing the user to configure the limit/threshold value above which we consider the signal to be SDR
- allowing the user to configure the switching time from SDR to HDR if the value does not exceed this threshold during this period (reason: dark scenes may generate a false signal, therefore the time interval is necessary)
- switching from HDR to SDR will occur immediately because we can immediately detect the value above the critical threshold.
The above mechanism will control turning on/off HyperHDR tone mapping.
To consider whether we scan each pixel or use a simple scanline (and its shape), which should be faster, although it has side effects.
This will be implemented first for USB grabbers and YUV/NV12 and probably MJPEG modes for Linux and Windows systems.
This could probably be extended with an external flatbuffer/protobuffer source, although at this stage it won't be my priority due to limited resources.
Due to differences in video stream handling and my limited resources, I do not currently foresee this functionality for macOS, at least for now.