mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-05 21:37:10 -04:00
feat: add tone mapping for videotoolbox
Signed-off-by: gnattu <gnattuoc@me.com>
This commit is contained in:
parent
44cb9f5fdd
commit
c18ef13b3b
@ -272,7 +272,8 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||||||
var isNvdecDecoder = vidDecoder.Contains("cuda", StringComparison.OrdinalIgnoreCase);
|
var isNvdecDecoder = vidDecoder.Contains("cuda", StringComparison.OrdinalIgnoreCase);
|
||||||
var isVaapiDecoder = vidDecoder.Contains("vaapi", StringComparison.OrdinalIgnoreCase);
|
var isVaapiDecoder = vidDecoder.Contains("vaapi", StringComparison.OrdinalIgnoreCase);
|
||||||
var isD3d11vaDecoder = vidDecoder.Contains("d3d11va", StringComparison.OrdinalIgnoreCase);
|
var isD3d11vaDecoder = vidDecoder.Contains("d3d11va", StringComparison.OrdinalIgnoreCase);
|
||||||
return isSwDecoder || isNvdecDecoder || isVaapiDecoder || isD3d11vaDecoder;
|
var isVideoToolBoxDecoder = vidDecoder.Contains("videotoolbox", StringComparison.OrdinalIgnoreCase);
|
||||||
|
return isSwDecoder || isNvdecDecoder || isVaapiDecoder || isD3d11vaDecoder || isVideoToolBoxDecoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
return state.VideoStream.VideoRange == VideoRange.HDR
|
return state.VideoStream.VideoRange == VideoRange.HDR
|
||||||
@ -4988,6 +4989,8 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||||||
var noOverlay = swFilterChain.OverlayFilters.Count == 0;
|
var noOverlay = swFilterChain.OverlayFilters.Count == 0;
|
||||||
var supportsHwDeint = _mediaEncoder.SupportsFilter("yadif_videotoolbox");
|
var supportsHwDeint = _mediaEncoder.SupportsFilter("yadif_videotoolbox");
|
||||||
var supportsHwScale = _mediaEncoder.SupportsFilter("scale_vt");
|
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;
|
||||||
// fallback to software filters if we are using filters not supported by hardware yet.
|
// fallback to software filters if we are using filters not supported by hardware yet.
|
||||||
var useHardwareFilters = noOverlay && (!doDeintH2645 || supportsHwDeint);
|
var useHardwareFilters = noOverlay && (!doDeintH2645 || supportsHwDeint);
|
||||||
|
|
||||||
@ -5008,6 +5011,11 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||||||
if (supportsHwScale)
|
if (supportsHwScale)
|
||||||
{
|
{
|
||||||
var hwScaleFilter = GetHwScaleFilter("vt", "", inW, inH, reqW, reqH, reqMaxW, reqMaxH);
|
var hwScaleFilter = GetHwScaleFilter("vt", "", inW, inH, reqW, reqH, reqMaxW, reqMaxH);
|
||||||
|
if (useHwToneMapping)
|
||||||
|
{
|
||||||
|
hwScaleFilter = string.IsNullOrEmpty(hwScaleFilter) ? "scale_vt=0:0:bt709:bt709:bt709"
|
||||||
|
: string.Format(CultureInfo.InvariantCulture, hwScaleFilter, ":bt709:bt709:bt709");
|
||||||
|
}
|
||||||
newfilters.Add(hwScaleFilter);
|
newfilters.Add(hwScaleFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user