diff options
| author | gnattu <gnattuoc@me.com> | 2024-02-16 00:16:59 +0800 |
|---|---|---|
| committer | gnattu <gnattuoc@me.com> | 2024-02-16 00:16:59 +0800 |
| commit | 5c743f2b4d242b9b9ea438b2331439f58a92c447 (patch) | |
| tree | b2954c0cb70f54d6bf8a4bd80e29b8fdc7da35ed /MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs | |
| parent | cf3e3e2c3d3cb5255de6f8f261ee03ead9e1357f (diff) | |
feat: separate videotoolbox tone mapping option
Signed-off-by: gnattu <gnattuoc@me.com>
Diffstat (limited to 'MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs')
| -rw-r--r-- | MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index d23eb00fe..62799f01e 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -309,6 +309,18 @@ namespace MediaBrowser.Controller.MediaEncoding && state.VideoStream.VideoRangeType == VideoRangeType.HDR10; } + private bool IsVideoToolboxVppTonemapAvailable(EncodingJobInfo state, EncodingOptions options) + { + if (state.VideoStream is null + || !options.EnableVideoToolboxTonemapping + || GetVideoColorBitDepth(state) != 10) + { + return false; + } + return state.VideoStream.VideoRange == VideoRange.HDR + && state.VideoStream.VideoRangeType == VideoRangeType.HDR10; + } + /// <summary> /// Gets the name of the output video codec. /// </summary> @@ -4991,7 +5003,7 @@ namespace MediaBrowser.Controller.MediaEncoding var supportsHwDeint = _mediaEncoder.SupportsFilter("yadif_videotoolbox"); var supportsHwScale = _mediaEncoder.SupportsFilter("scale_vt"); // VideoToolbox is special. It does not use a separate tone mapping filter like others. Instead, it performs both tone mapping and scaling in a single filter. - var useHwToneMapping = IsHwTonemapAvailable(state, options) && supportsHwScale; + var useHwToneMapping = IsVideoToolboxVppTonemapAvailable(state, options) && supportsHwScale; // fallback to software filters if we are using filters not supported by hardware yet. var useHardwareFilters = noOverlay && (!doDeintH2645 || supportsHwDeint); |
