Skip to content

Commit f1a45dd

Browse files
author
JPVenson
committed
Readded windows specific QSV
1 parent 9800a19 commit f1a45dd

File tree

4 files changed

+4342
-191
lines changed

4 files changed

+4342
-191
lines changed

Jellyfin.HardwareVisualizer/Server/Database/Configuration/TestCaseArgumentConfig.cs

Lines changed: 60 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -5,74 +5,93 @@ namespace Jellyfin.HardwareVisualizer.Server.Database.Configuration;
55

66
public class TestCaseArgumentConfig : IEntityTypeConfiguration<TestCaseArgument>
77
{
8-
private class TestCaseGen
8+
private record TestCaseGen
99
{
10-
public string Template;
11-
public (Guid codec, string type)[] Source;
12-
public (Guid codec, string type)[] Target;
10+
public required string Template { get; set; }
11+
public (Guid codec, string type)[] Source { get; set; }
12+
public (Guid codec, string type)[] Target { get; set; }
1313
}
1414

1515
public void Configure(EntityTypeBuilder<TestCaseArgument> modelBuilder)
1616
{
17-
var generators = new Dictionary<(TestCaseArgumentDeviceType Device, Guid[] ffmpegGroup), TestCaseGen>()
17+
var cpuBase = new TestCaseGen()
1818
{
19-
{
20-
(TestCaseArgumentDeviceType.Cpu, [FfmpegVersionConfig.GenericLinuxVersionGroup, FfmpegVersionConfig.WindowsVersionGroup, FfmpegVersionConfig.MacVersionGroup]),
21-
new TestCaseGen(){
22-
Template = """-c:v {SOURCE} -i {video_file} -noautoscale -an -sn -vf "scale=trunc(min(max(iw\,ih*a)\,{scale})/2)*2:trunc(ow/a/2)*2,format=yuv420p" -c:v {TARGET} -preset veryfast -b:v {bitrate} -maxrate {bitrate} -f null - -benchmark""",
23-
Source = [
19+
Template = """-c:v {SOURCE} -i {video_file} -noautoscale -an -sn -vf "scale=trunc(min(max(iw\,ih*a)\,{scale})/2)*2:trunc(ow/a/2)*2,format=yuv420p" -c:v {TARGET} -preset veryfast -b:v {bitrate} -maxrate {bitrate} -f null - -benchmark""",
20+
Source = [
2421
(HardwareCodecConfig.h264CodecId, "h264"),
2522
(HardwareCodecConfig.hvecCodecId, "hevc"),
2623
(HardwareCodecConfig.av1CodecId, "dav1d"),
2724
],
28-
Target = [
25+
Target = [
2926
(HardwareCodecConfig.h264CodecId, "libx264"),
3027
(HardwareCodecConfig.hvecCodecId, "libx265"),
3128
(HardwareCodecConfig.av1CodecId, "svt-av1"),
3229
]
33-
}
34-
},
35-
{
36-
(TestCaseArgumentDeviceType.Nvidia, [FfmpegVersionConfig.GenericLinuxVersionGroup, FfmpegVersionConfig.WindowsVersionGroup]),
37-
new TestCaseGen(){
38-
Template = """-init_hw_device cuda=cu:{gpu} -hwaccel cuda -hwaccel_output_format cuda -c:v {SOURCE} -i {video_file} -noautoscale -an -sn -vf "scale_cuda=-1:{scale}:yuv420p" -c:v {TARGET} -preset p1 -b:v {bitrate} -maxrate {bitrate} -f null - -benchmark""",
39-
Source = [
30+
};
31+
32+
var nvidiaBase = new TestCaseGen()
33+
{
34+
Template = """-init_hw_device cuda=cu:{gpu} -hwaccel cuda -hwaccel_output_format cuda -c:v {SOURCE} -i {video_file} -noautoscale -an -sn -vf "scale_cuda=-1:{scale}:yuv420p" -c:v {TARGET} -preset p1 -b:v {bitrate} -maxrate {bitrate} -f null - -benchmark""",
35+
Source = [
4036
(HardwareCodecConfig.h264CodecId, "h264_cuvid"),
4137
(HardwareCodecConfig.hvecCodecId, "hevc_cuvid"),
4238
(HardwareCodecConfig.av1CodecId, "av1_cuvid"),
4339
],
44-
Target = [
40+
Target = [
4541
(HardwareCodecConfig.h264CodecId, "h264_nvenc"),
4642
(HardwareCodecConfig.hvecCodecId, "hevc_nvenc"),
4743
(HardwareCodecConfig.av1CodecId, "av1_nvenc"),
4844
]
49-
}
50-
},
51-
{
52-
(TestCaseArgumentDeviceType.Amd, [FfmpegVersionConfig.GenericLinuxVersionGroup]),
53-
new TestCaseGen(){
54-
Template = """-init_hw_device vaapi=va:/dev/dri/by-path/{gpu}-render -hwaccel vaapi -hwaccel_output_format vaapi -c:v {SOURCE} -i {video_file} -noautoscale -an -sn -vf "scale_vaapi=-1:{scale}:format=nv12" -c:v {TARGET} -b:v {bitrate} -maxrate {bitrate} -f null - -benchmark""",
55-
Source = [
45+
};
46+
47+
var amdBase = new TestCaseGen()
48+
{
49+
Template = """-init_hw_device vaapi=va:/dev/dri/by-path/{gpu}-render -hwaccel vaapi -hwaccel_output_format vaapi -c:v {SOURCE} -i {video_file} -noautoscale -an -sn -vf "scale_vaapi=-1:{scale}:format=nv12" -c:v {TARGET} -b:v {bitrate} -maxrate {bitrate} -f null - -benchmark""",
50+
Source = [
5651
(HardwareCodecConfig.h264CodecId, "h264"),
5752
(HardwareCodecConfig.hvecCodecId, "hevc"),
5853
(HardwareCodecConfig.av1CodecId, "dav1d"),
5954
],
60-
Target = [
55+
Target = [
6156
(HardwareCodecConfig.h264CodecId, "h264_vaapi"),
6257
(HardwareCodecConfig.hvecCodecId, "hevc_vaapi"),
6358
(HardwareCodecConfig.av1CodecId, "av1_vaapi"),
6459
]
65-
}
60+
};
61+
62+
var intelbase = new TestCaseGen()
63+
{
64+
Template = """-init_hw_device vaapi=va:/dev/dri/by-path/{gpu}-render -init_hw_device qsv=qs@va -hwaccel qsv -hwaccel_output_format qsv -c:v {SOURCE} -i {video_file} -noautoscale -an -sn -vf "scale_qsv=-1:{scale}:format=nv12" -c:v {TARGET} -preset veryfast -b:v {bitrate} -maxrate {bitrate} -f null - -benchmark""",
65+
Source = [
66+
(HardwareCodecConfig.h264CodecId, "h264_qsv"),
67+
(HardwareCodecConfig.hvecCodecId, "hevc_qsv"),
68+
(HardwareCodecConfig.av1CodecId, "av1_qsv"),
69+
],
70+
Target = [
71+
(HardwareCodecConfig.h264CodecId, "h264_qsv"),
72+
(HardwareCodecConfig.hvecCodecId, "hevc_qsv"),
73+
(HardwareCodecConfig.av1CodecId, "av1_qsv"),
74+
]
75+
};
76+
77+
var generators = new Dictionary<(TestCaseArgumentDeviceType Device, Guid[] ffmpegGroup), TestCaseGen>()
78+
{
79+
{
80+
(TestCaseArgumentDeviceType.Cpu, [FfmpegVersionConfig.GenericLinuxVersionGroup, FfmpegVersionConfig.WindowsVersionGroup, FfmpegVersionConfig.MacVersionGroup]),
81+
cpuBase
82+
},
83+
{
84+
(TestCaseArgumentDeviceType.Nvidia, [FfmpegVersionConfig.GenericLinuxVersionGroup, FfmpegVersionConfig.WindowsVersionGroup]),
85+
nvidiaBase
86+
},
87+
{
88+
(TestCaseArgumentDeviceType.Amd, [FfmpegVersionConfig.GenericLinuxVersionGroup]),
89+
amdBase
6690
},
6791
{
6892
(TestCaseArgumentDeviceType.Amd, [FfmpegVersionConfig.WindowsVersionGroup]),
69-
new TestCaseGen(){
93+
amdBase with {
7094
Template = """-init_hw_device d3d11va:{gpu} -hwaccel d3d11va -hwaccel_output_format d3d11 -c:v {SOURCE} -i {video_file} -noautoscale -an -sn -vf "scale=-1:{scale}:format=nv12" -c:v {TARGET} -b:v {bitrate} -maxrate {bitrate} -f null - -benchmark""",
71-
Source = [
72-
(HardwareCodecConfig.h264CodecId, "h264"),
73-
(HardwareCodecConfig.hvecCodecId, "hevc"),
74-
(HardwareCodecConfig.av1CodecId, "dav1d"),
75-
],
7695
Target = [
7796
(HardwareCodecConfig.h264CodecId, "h264_amf"),
7897
(HardwareCodecConfig.hvecCodecId, "hevc_amf"),
@@ -82,20 +101,14 @@ public void Configure(EntityTypeBuilder<TestCaseArgument> modelBuilder)
82101
},
83102
{
84103
(TestCaseArgumentDeviceType.Intel, [FfmpegVersionConfig.GenericLinuxVersionGroup]),
85-
new TestCaseGen(){
86-
Template = """-init_hw_device vaapi=va:/dev/dri/by-path/{gpu}-render -init_hw_device qsv=qs@va -hwaccel qsv -hwaccel_output_format qsv -c:v {SOURCE} -i {video_file} -noautoscale -an -sn -vf "scale_qsv=-1:{scale}:format=nv12" -c:v {TARGET} -preset veryfast -b:v {bitrate} -maxrate {bitrate} -f null - -benchmark""",
87-
Source = [
88-
(HardwareCodecConfig.h264CodecId, "h264_qsv"),
89-
(HardwareCodecConfig.hvecCodecId, "hevc_qsv"),
90-
(HardwareCodecConfig.av1CodecId, "av1_qsv"),
91-
],
92-
Target = [
93-
(HardwareCodecConfig.h264CodecId, "h264_qsv"),
94-
(HardwareCodecConfig.hvecCodecId, "hevc_qsv"),
95-
(HardwareCodecConfig.av1CodecId, "av1_qsv"),
96-
]
104+
intelbase
105+
},
106+
{
107+
(TestCaseArgumentDeviceType.Intel, [FfmpegVersionConfig.WindowsVersionGroup]),
108+
intelbase with {
109+
Template = """-init_hw_device d3d11va:{gpu} -hwaccel qsv -hwaccel_output_format qsv -c:v {SOURCE} -i {video_file} -noautoscale -an -sn -vf \"scale_qsv=-1:{scale}:format=nv12\" -c:v {TARGET} -preset veryfast -b:v {bitrate} -maxrate {bitrate} -f null - -benchmark""",
97110
}
98-
},
111+
},
99112
};
100113

101114
var testCases = new List<TestCaseArgument>();

0 commit comments

Comments
 (0)