enhance workload when tone mapping with AMF

zscale filter is required.
pull/4171/head
Nyanmisaka 4 years ago committed by GitHub
parent db07510017
commit 2124bc2e18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -858,6 +858,20 @@ namespace MediaBrowser.Controller.MediaEncoding
}
else if (string.Equals(videoEncoder, "h264_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)
{
@ -884,6 +898,7 @@ namespace MediaBrowser.Controller.MediaEncoding
break;
}
}
}
else if (string.Equals(videoEncoder, "libvpx", StringComparison.OrdinalIgnoreCase)) // webm
{
// Values 0-3, 0 being highest quality but slower
@ -2123,19 +2138,18 @@ namespace MediaBrowser.Controller.MediaEncoding
if (isSwDecoder || isD3d11vaDecoder)
{
isScalingInAdvance = true;
// Add scaling filter before tonemapping filter for performance.
filters.AddRange(
GetScalingFilters(
state,
inputWidth,
inputHeight,
threeDFormat,
videoDecoder,
outputVideoCodec,
request.Width,
request.Height,
request.MaxWidth,
request.MaxHeight));
// Add zscale filter before tone mapping filter for performance.
var (width, height) = GetFixedOutputSize(inputWidth, inputHeight, request.Width, request.Height, request.MaxWidth, request.MaxHeight);
if (width.HasValue && height.HasValue)
{
filters.Add(
string.Format(
CultureInfo.InvariantCulture,
"zscale=s={0}x{1}",
width.Value,
height.Value));
}
// Convert to hardware pixel format p010 when using SW decoder.
filters.Add("format=p010");
}

Loading…
Cancel
Save