diff --git a/win/CS/HandBrakeWPF/Converters/Video/VideoOptionsTooltipConverter.cs b/win/CS/HandBrakeWPF/Converters/Video/VideoOptionsTooltipConverter.cs index 9d6fa2971163..343792bc5ea8 100644 --- a/win/CS/HandBrakeWPF/Converters/Video/VideoOptionsTooltipConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/Video/VideoOptionsTooltipConverter.cs @@ -13,6 +13,8 @@ namespace HandBrakeWPF.Converters.Video using System.Globalization; using System.Windows.Data; + using HandBrake.Interop.Interop; + using HandBrakeWPF.Utilities; using EncodeTask = HandBrakeWPF.Services.Encode.Model.EncodeTask; @@ -47,18 +49,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn EncodeTask task = value as EncodeTask; if (task != null) { - string rfqp = task.VideoEncoder == VideoEncoder.X264 || task.VideoEncoder == VideoEncoder.X264_10 || task.VideoEncoder == VideoEncoder.X265 - || task.VideoEncoder == VideoEncoder.X265_10 || task.VideoEncoder == VideoEncoder.X265_12 ? "RF" : "QP"; - - if (task.VideoEncoder == VideoEncoder.NvencH264 || task.VideoEncoder == VideoEncoder.NvencH265) - { - rfqp = "CQ"; - } - - if (task.VideoEncoder == VideoEncoder.MFH264 || task.VideoEncoder == VideoEncoder.MFH265) - { - rfqp = "CQ"; - } + string rfqp = HandBrakeEncoderHelpers.GetVideoQualityRateControlName(EnumHelper.GetShortName(task.VideoEncoder)); string quality = task.VideoEncodeRateType == VideoEncodeRateType.ConstantQuality ? string.Format("{0} {1}", task.Quality, rfqp) : string.Format("{0} {1}", task.VideoBitrate, " kbps"); string twoPass = null; diff --git a/win/CS/HandBrakeWPF/Model/Video/VideoEncoder.cs b/win/CS/HandBrakeWPF/Model/Video/VideoEncoder.cs index f9ffa16f6138..627588e1b25f 100644 --- a/win/CS/HandBrakeWPF/Model/Video/VideoEncoder.cs +++ b/win/CS/HandBrakeWPF/Model/Video/VideoEncoder.cs @@ -80,6 +80,10 @@ public enum VideoEncoder [ShortName("nvenc_h265")] NvencH265, + [DisplayName("H.265 10-bit (Nvidia NVEnc)")] + [ShortName("nvenc_h265_10bit")] + NvencH26510b, + [DisplayName("H.265 (MediaFoundation)")] [ShortName("mf_h265")] MFH265, diff --git a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs index e94d75cf29a5..9809257c4471 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs @@ -885,6 +885,11 @@ private bool IsPresetDisabled(Preset preset) return true; } + if (preset.Task.VideoEncoder == VideoEncoder.NvencH26510b && (!HandBrakeHardwareEncoderHelper.IsNVEncH265Available || !isNvencEnabled)) + { + return true; + } + if (preset.Task.VideoEncoder == VideoEncoder.MFH264 || preset.Task.VideoEncoder == VideoEncoder.MFH265) { if (RuntimeInformation.ProcessArchitecture != Architecture.Arm64) diff --git a/win/CS/HandBrakeWPF/Services/Queue/QueueResourceService.cs b/win/CS/HandBrakeWPF/Services/Queue/QueueResourceService.cs index 4485f161a87e..4e0326422072 100644 --- a/win/CS/HandBrakeWPF/Services/Queue/QueueResourceService.cs +++ b/win/CS/HandBrakeWPF/Services/Queue/QueueResourceService.cs @@ -117,6 +117,7 @@ public void Init() case VideoEncoder.NvencH264: case VideoEncoder.NvencH265: + case VideoEncoder.NvencH26510b: if (this.nvencInstances.Count < this.totalNvidiaInstances && this.TotalActiveInstances <= this.maxAllowedInstances) { Guid guid = Guid.NewGuid(); @@ -212,6 +213,7 @@ public void ReleaseToken(VideoEncoder encoder, Guid? unlockKey) break; case VideoEncoder.NvencH264: case VideoEncoder.NvencH265: + case VideoEncoder.NvencH26510b: if (this.nvencInstances.Contains(unlockKey.Value)) { this.nvencInstances.Remove(unlockKey.Value); diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs index 1dd647bb10bc..37d2ab340b0d 100644 --- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs @@ -240,27 +240,20 @@ public int RF case VideoEncoder.X265: case VideoEncoder.X265_10: case VideoEncoder.X265_12: - double cqStep = userSettingService.GetUserSetting(UserSettingConstants.X264Step); - double rfValue = 51.0 - (value * cqStep); - rfValue = Math.Round(rfValue, 2); - this.Task.Quality = rfValue; - break; case VideoEncoder.QuickSync: case VideoEncoder.QuickSyncH265: case VideoEncoder.VceH264: case VideoEncoder.VceH265: case VideoEncoder.NvencH264: case VideoEncoder.NvencH265: + case VideoEncoder.NvencH26510b: case VideoEncoder.MFH264: case VideoEncoder.MFH265: - rfValue = 51.0 - value; - rfValue = Math.Round(rfValue, 0); - this.Task.Quality = rfValue; - break; + double cqStep = userSettingService.GetUserSetting(UserSettingConstants.X264Step); + this.Task.Quality = Math.Round(51.0 - (value * cqStep), 2); + break; case VideoEncoder.QuickSyncH26510b: - rfValue = 63.0 - (value - 0); - rfValue = Math.Round(rfValue, 0); - this.Task.Quality = rfValue; + this.Task.Quality = Math.Round(63.0 - (value - 0), 0); break; case VideoEncoder.Theora: Task.Quality = value; @@ -790,7 +783,7 @@ public bool MatchesPreset(Preset preset) || this.Task.VideoEncoder == VideoEncoder.X265_12 || this.Task.VideoEncoder == VideoEncoder.QuickSync || this.Task.VideoEncoder == VideoEncoder.QuickSyncH265 || this.Task.VideoEncoder == VideoEncoder.QuickSyncH26510b || this.Task.VideoEncoder == VideoEncoder.VceH264 || this.Task.VideoEncoder == VideoEncoder.VceH265 - || this.Task.VideoEncoder == VideoEncoder.NvencH264 || this.Task.VideoEncoder == VideoEncoder.NvencH265 + || this.Task.VideoEncoder == VideoEncoder.NvencH264 || this.Task.VideoEncoder == VideoEncoder.NvencH265 || this.Task.VideoEncoder == VideoEncoder.NvencH26510b || this.Task.VideoEncoder == VideoEncoder.MFH264 || this.Task.VideoEncoder == VideoEncoder.MFH265) { if (!Equals(preset.Task.VideoPreset, this.Task.VideoPreset)) @@ -876,17 +869,6 @@ private void SetQualitySliderBounds() this.QualityMin = 1; this.QualityMax = 31; break; - case VideoEncoder.QuickSync: - case VideoEncoder.QuickSyncH265: - case VideoEncoder.VceH264: - case VideoEncoder.VceH265: - case VideoEncoder.NvencH264: - case VideoEncoder.NvencH265: - case VideoEncoder.MFH264: - case VideoEncoder.MFH265: - this.QualityMin = 0; - this.QualityMax = 51; - break; case VideoEncoder.QuickSyncH26510b: this.QualityMin = 0; this.QualityMax = 63; @@ -896,6 +878,15 @@ private void SetQualitySliderBounds() case VideoEncoder.X265: case VideoEncoder.X265_10: case VideoEncoder.X265_12: + case VideoEncoder.QuickSync: + case VideoEncoder.QuickSyncH265: + case VideoEncoder.VceH264: + case VideoEncoder.VceH265: + case VideoEncoder.NvencH264: + case VideoEncoder.NvencH265: + case VideoEncoder.NvencH26510b: + case VideoEncoder.MFH264: + case VideoEncoder.MFH265: this.QualityMin = 0; this.QualityMax = (int)(51 / userSettingService.GetUserSetting(UserSettingConstants.X264Step)); break; @@ -978,7 +969,7 @@ private void SetRF(double? quality) { VideoQualityLimits limits = HandBrakeEncoderHelpers.GetVideoQualityLimits(EnumHelper.GetShortName(this.SelectedVideoEncoder)); double cqStep = 1; - if (limits.Granularity != 1) + if (limits != null && limits.Granularity != 1) { cqStep = this.userSettingService.GetUserSetting(UserSettingConstants.X264Step); } @@ -1018,6 +1009,7 @@ private void SetRF(double? quality) case VideoEncoder.VceH265: case VideoEncoder.NvencH264: case VideoEncoder.NvencH265: + case VideoEncoder.NvencH26510b: case VideoEncoder.MFH264: case VideoEncoder.MFH265: double multiplier = 1.0 / cqStep; @@ -1177,7 +1169,7 @@ private int GetDefaultEncoderPreset(VideoEncoder selectedEncoder) int defaultPreset = (int)Math.Round((decimal)(this.VideoPresetMaxValue / 2), 0); // Override for NVEnc - if (selectedEncoder == VideoEncoder.NvencH264 || selectedEncoder == VideoEncoder.NvencH265) + if (selectedEncoder == VideoEncoder.NvencH264 || selectedEncoder == VideoEncoder.NvencH265 || selectedEncoder == VideoEncoder.NvencH26510b) { defaultPreset = this.VideoPresets.IndexOf(this.VideoPresets.FirstOrDefault(s => s.ShortName == "medium")); }