Browse Source

try software decode for polaris

pull/2653/head
Jason Dove 8 months ago
parent
commit
cb2dbff490
No known key found for this signature in database
  1. 7
      ErsatzTV.FFmpeg/Capabilities/VaapiHardwareCapabilities.cs
  2. 18
      ErsatzTV.FFmpeg/Pipeline/VaapiPipelineBuilder.cs

7
ErsatzTV.FFmpeg/Capabilities/VaapiHardwareCapabilities.cs

@ -12,8 +12,6 @@ public class VaapiHardwareCapabilities(
{ {
public int EntrypointCount => profileEntrypoints.Count; public int EntrypointCount => profileEntrypoints.Count;
public string Generation => generation;
public FFmpegCapability CanDecode( public FFmpegCapability CanDecode(
string videoFormat, string videoFormat,
Option<string> videoProfile, Option<string> videoProfile,
@ -22,11 +20,16 @@ public class VaapiHardwareCapabilities(
{ {
int bitDepth = maybePixelFormat.Map(pf => pf.BitDepth).IfNone(8); int bitDepth = maybePixelFormat.Map(pf => pf.BitDepth).IfNone(8);
bool isPolaris = generation.Contains("polaris", StringComparison.OrdinalIgnoreCase);
bool isHardware = (videoFormat, videoProfile.IfNone(string.Empty).ToLowerInvariant()) switch bool isHardware = (videoFormat, videoProfile.IfNone(string.Empty).ToLowerInvariant()) switch
{ {
// no hardware decoding of 10-bit h264 // no hardware decoding of 10-bit h264
(VideoFormat.H264, _) when bitDepth == 10 => false, (VideoFormat.H264, _) when bitDepth == 10 => false,
// skip polaris hardware decoding 10-bit
(_, _) when bitDepth == 10 && isPolaris => false,
// no hardware decoding of h264 baseline profile // no hardware decoding of h264 baseline profile
(VideoFormat.H264, "baseline" or "66") => false, (VideoFormat.H264, "baseline" or "66") => false,

18
ErsatzTV.FFmpeg/Pipeline/VaapiPipelineBuilder.cs

@ -355,25 +355,7 @@ public class VaapiPipelineBuilder : SoftwarePipelineBuilder
if (currentState.FrameDataLocation == FrameDataLocation.Hardware) if (currentState.FrameDataLocation == FrameDataLocation.Hardware)
{ {
if (_hardwareCapabilities is VaapiHardwareCapabilities vaapiCapabilities &&
vaapiCapabilities.Generation.Contains("polaris", StringComparison.OrdinalIgnoreCase))
{
// don't try to download from 8-bit to 10-bit, or 10-bit to 8-bit
HardwareDownloadFilter hardwareDownload =
currentState.BitDepth == 8 && desiredPixelFormat.Map(pf => pf.BitDepth).IfNone(8) == 10 ||
currentState.BitDepth == 10 && desiredPixelFormat.Map(pf => pf.BitDepth).IfNone(10) == 8
? new HardwareDownloadFilter(currentState)
: new HardwareDownloadFilter(currentState with { PixelFormat = Some(format) });
currentState = hardwareDownload.NextState(currentState);
result.Add(hardwareDownload);
result.Add(new PixelFormatFilter(format));
}
else
{
result.Add(new VaapiFormatFilter(format)); result.Add(new VaapiFormatFilter(format));
}
} }
else else
{ {

Loading…
Cancel
Save