mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 11:34:57 +02:00
enhance workload when tone mapping with AMF
zscale filter is required.
This commit is contained in:
parent
db07510017
commit
2124bc2e18
1 changed files with 46 additions and 32 deletions
|
@ -858,6 +858,20 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
}
|
}
|
||||||
else if (string.Equals(videoEncoder, "h264_amf", StringComparison.OrdinalIgnoreCase)
|
else if (string.Equals(videoEncoder, "h264_amf", StringComparison.OrdinalIgnoreCase)
|
||||||
|| string.Equals(videoEncoder, "hevc_amf", StringComparison.OrdinalIgnoreCase))
|
|| string.Equals(videoEncoder, "hevc_amf", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
var videoStream = state.VideoStream;
|
||||||
|
var isColorDepth10 = IsColorDepth10(state);
|
||||||
|
|
||||||
|
if (isColorDepth10
|
||||||
|
&& _mediaEncoder.SupportsHwaccel("opencl")
|
||||||
|
&& encodingOptions.EnableTonemapping
|
||||||
|
&& !string.IsNullOrEmpty(videoStream.VideoRange)
|
||||||
|
&& videoStream.VideoRange.Contains("HDR", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
// Enhance quality and workload when tone mapping with AMF
|
||||||
|
param += "-quality quality -preanalysis true";
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
switch (encodingOptions.EncoderPreset)
|
switch (encodingOptions.EncoderPreset)
|
||||||
{
|
{
|
||||||
|
@ -884,6 +898,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (string.Equals(videoEncoder, "libvpx", StringComparison.OrdinalIgnoreCase)) // webm
|
else if (string.Equals(videoEncoder, "libvpx", StringComparison.OrdinalIgnoreCase)) // webm
|
||||||
{
|
{
|
||||||
// Values 0-3, 0 being highest quality but slower
|
// Values 0-3, 0 being highest quality but slower
|
||||||
|
@ -2123,19 +2138,18 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
if (isSwDecoder || isD3d11vaDecoder)
|
if (isSwDecoder || isD3d11vaDecoder)
|
||||||
{
|
{
|
||||||
isScalingInAdvance = true;
|
isScalingInAdvance = true;
|
||||||
// Add scaling filter before tonemapping filter for performance.
|
// Add zscale filter before tone mapping filter for performance.
|
||||||
filters.AddRange(
|
var (width, height) = GetFixedOutputSize(inputWidth, inputHeight, request.Width, request.Height, request.MaxWidth, request.MaxHeight);
|
||||||
GetScalingFilters(
|
if (width.HasValue && height.HasValue)
|
||||||
state,
|
{
|
||||||
inputWidth,
|
filters.Add(
|
||||||
inputHeight,
|
string.Format(
|
||||||
threeDFormat,
|
CultureInfo.InvariantCulture,
|
||||||
videoDecoder,
|
"zscale=s={0}x{1}",
|
||||||
outputVideoCodec,
|
width.Value,
|
||||||
request.Width,
|
height.Value));
|
||||||
request.Height,
|
}
|
||||||
request.MaxWidth,
|
|
||||||
request.MaxHeight));
|
|
||||||
// Convert to hardware pixel format p010 when using SW decoder.
|
// Convert to hardware pixel format p010 when using SW decoder.
|
||||||
filters.Add("format=p010");
|
filters.Add("format=p010");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue