From 5d2c3cc85cae38c365ffdefa40054563d45b1506 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 5 Mar 2017 19:48:35 +0000 Subject: WinGui: Add support in the UI for QSV 10bit H.265 encoder. --- .../Interop/HbLib/NativeConstants.cs | 1 + .../Interop/Model/Encoding/VideoEncoder.cs | 12 ++++++++---- .../Utilities/SystemInfo.cs | 16 ++++++++++++++++ .../Converters/Video/VideoEncoderConverter.cs | 5 +++++ win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs | 20 ++++++++++++-------- 5 files changed, 42 insertions(+), 12 deletions(-) (limited to 'win') diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HbLib/NativeConstants.cs b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/NativeConstants.cs index 787bb7c72..bc593539f 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/HbLib/NativeConstants.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/NativeConstants.cs @@ -48,6 +48,7 @@ namespace HandBrake.ApplicationServices.Interop.HbLib // VideoEncoders public const uint HB_VCODEC_QSV_H264 = 0x0000100; public const uint HB_VCODEC_QSV_H265 = 0x0000200; + public const uint HB_VCODEC_QSV_H265_10BIT = 0x0000400; public const uint HB_VCODEC_QSV_MASK = 0x0000F00; // Encode state diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/VideoEncoder.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/VideoEncoder.cs index 5fd693bfb..077b9a642 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/VideoEncoder.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/VideoEncoder.cs @@ -30,10 +30,6 @@ namespace HandBrake.ApplicationServices.Interop.Model.Encoding [ShortName("qsv_h264")] QuickSync, - [Display(Name = "H.265 (Intel QSV)")] - [ShortName("qsv_h265")] - QuickSyncH265, - [Display(Name = "MPEG-4")] [ShortName("mpeg4")] FFMpeg, @@ -58,6 +54,14 @@ namespace HandBrake.ApplicationServices.Interop.Model.Encoding [ShortName("x265_10bit")] X265_10, + [Display(Name = "H.265 (Intel QSV)")] + [ShortName("qsv_h265")] + QuickSyncH265, + + [Display(Name = "H.265 10-bit (Intel QSV)")] + [ShortName("qsv_h265_10bit")] + QuickSyncH26510b, + [Display(Name = "VP8")] [ShortName("VP8")] VP8, diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs b/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs index 8ccf04462..8966b5a8f 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs @@ -74,5 +74,21 @@ namespace HandBrake.ApplicationServices.Utilities } } } + + public static bool IsQsvAvailableH26510bit + { + get + { + try + { + return (HBFunctions.hb_qsv_available() & NativeConstants.HB_VCODEC_QSV_H265_10BIT) != 0; + } + catch (Exception) + { + // Silent failure. Typically this means the dll hasn't been built with --enable-qsv + return false; + } + } + } } } diff --git a/win/CS/HandBrakeWPF/Converters/Video/VideoEncoderConverter.cs b/win/CS/HandBrakeWPF/Converters/Video/VideoEncoderConverter.cs index d0e7cf556..ca54837b6 100644 --- a/win/CS/HandBrakeWPF/Converters/Video/VideoEncoderConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/Video/VideoEncoderConverter.cs @@ -84,6 +84,11 @@ namespace HandBrakeWPF.Converters.Video if (!SystemInfo.IsQsvAvailableH265) { encoders.Remove(VideoEncoder.QuickSyncH265); + encoders.Remove(VideoEncoder.QuickSyncH26510b); + } + else if (!SystemInfo.IsQsvAvailableH26510bit) + { + encoders.Remove(VideoEncoder.QuickSyncH26510b); } return EnumHelper.GetEnumDisplayValuesSubset(encoders); diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs index d3da0f1c0..2b84f506a 100644 --- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs @@ -343,6 +343,7 @@ namespace HandBrakeWPF.ViewModels break; case VideoEncoder.QuickSync: case VideoEncoder.QuickSyncH265: + case VideoEncoder.QuickSyncH26510b: rfValue = 51.0 - value; rfValue = Math.Round(rfValue, 0); this.Task.Quality = rfValue; @@ -941,7 +942,7 @@ namespace HandBrakeWPF.ViewModels { if (preset.Task.VideoEncoder == VideoEncoder.X264 || preset.Task.VideoEncoder == VideoEncoder.X264_10 || preset.Task.VideoEncoder == VideoEncoder.X265 || preset.Task.VideoEncoder == VideoEncoder.X265_10 || preset.Task.VideoEncoder == VideoEncoder.X265_12 - || preset.Task.VideoEncoder == VideoEncoder.QuickSync || preset.Task.VideoEncoder == VideoEncoder.QuickSyncH265) + || preset.Task.VideoEncoder == VideoEncoder.QuickSync || preset.Task.VideoEncoder == VideoEncoder.QuickSyncH265 || preset.Task.VideoEncoder == VideoEncoder.QuickSyncH26510b) { this.VideoLevel = preset.Task.VideoLevel != null ? preset.Task.VideoLevel.Clone() : this.VideoLevels.FirstOrDefault(); this.VideoProfile = preset.Task.VideoProfile != null ? preset.Task.VideoProfile.Clone() : this.VideoProfiles.FirstOrDefault(); @@ -1042,6 +1043,7 @@ namespace HandBrakeWPF.ViewModels break; case VideoEncoder.QuickSync: case VideoEncoder.QuickSyncH265: + case VideoEncoder.QuickSyncH26510b: this.QualityMin = 0; this.QualityMax = 51; break; @@ -1169,6 +1171,7 @@ namespace HandBrakeWPF.ViewModels case VideoEncoder.X264_10: case VideoEncoder.QuickSync: case VideoEncoder.QuickSyncH265: + case VideoEncoder.QuickSyncH26510b: if (this.SelectedVideoEncoder == VideoEncoder.QuickSync || this.SelectedVideoEncoder == VideoEncoder.QuickSyncH265) { cqStep = 1; @@ -1288,31 +1291,32 @@ namespace HandBrakeWPF.ViewModels this.SetQualitySliderBounds(); // Update control display - this.UseAdvancedTab = selectedEncoder != VideoEncoder.QuickSync && selectedEncoder != VideoEncoder.QuickSyncH265 && this.UseAdvancedTab; + this.UseAdvancedTab = selectedEncoder != VideoEncoder.QuickSync && selectedEncoder != VideoEncoder.QuickSyncH265 && selectedEncoder != VideoEncoder.QuickSyncH26510b && this.UseAdvancedTab; this.DisplayOptimiseOptions = this.SelectedVideoEncoder == VideoEncoder.X264 || this.SelectedVideoEncoder == VideoEncoder.X264_10 || this.SelectedVideoEncoder == VideoEncoder.X265 || this.SelectedVideoEncoder == VideoEncoder.X265_10 || this.SelectedVideoEncoder == VideoEncoder.X265_12 || - this.SelectedVideoEncoder == VideoEncoder.QuickSync || this.SelectedVideoEncoder == VideoEncoder.QuickSyncH265 || + this.SelectedVideoEncoder == VideoEncoder.QuickSync || this.SelectedVideoEncoder == VideoEncoder.QuickSyncH265 || this.SelectedVideoEncoder == VideoEncoder.QuickSyncH26510b || this.SelectedVideoEncoder == VideoEncoder.VP8 || this.SelectedVideoEncoder == VideoEncoder.VP9; - this.DisplayNonQSVControls = this.SelectedVideoEncoder != VideoEncoder.QuickSync && this.SelectedVideoEncoder != VideoEncoder.QuickSyncH265; + this.DisplayNonQSVControls = this.SelectedVideoEncoder != VideoEncoder.QuickSync && this.SelectedVideoEncoder != VideoEncoder.QuickSyncH265 && this.SelectedVideoEncoder != VideoEncoder.QuickSyncH26510b; this.DisplayTurboFirstPass = selectedEncoder == VideoEncoder.X264 || selectedEncoder == VideoEncoder.X264_10 || selectedEncoder == VideoEncoder.X265 || selectedEncoder == VideoEncoder.X265_10 || selectedEncoder == VideoEncoder.X265_12; this.DisplayTuneControls = SelectedVideoEncoder == VideoEncoder.X264 || SelectedVideoEncoder == VideoEncoder.X264_10 || SelectedVideoEncoder == VideoEncoder.X265 || SelectedVideoEncoder == VideoEncoder.X265_10 || SelectedVideoEncoder == VideoEncoder.X265_12; - this.DisplayLevelControl = SelectedVideoEncoder == VideoEncoder.X264 || SelectedVideoEncoder == VideoEncoder.X264_10 || this.SelectedVideoEncoder == VideoEncoder.QuickSync || this.SelectedVideoEncoder == VideoEncoder.QuickSyncH265; + this.DisplayLevelControl = SelectedVideoEncoder == VideoEncoder.X264 || SelectedVideoEncoder == VideoEncoder.X264_10 || this.SelectedVideoEncoder == VideoEncoder.QuickSync || this.SelectedVideoEncoder == VideoEncoder.QuickSyncH265 || this.SelectedVideoEncoder == VideoEncoder.QuickSyncH26510b; this.DisplayProfileControl = this.SelectedVideoEncoder == VideoEncoder.X264 || this.SelectedVideoEncoder == VideoEncoder.X264_10 || this.SelectedVideoEncoder == VideoEncoder.X265 || this.SelectedVideoEncoder == VideoEncoder.X265_10 || this.SelectedVideoEncoder == VideoEncoder.X265_12 || this.SelectedVideoEncoder == VideoEncoder.QuickSync - || this.SelectedVideoEncoder == VideoEncoder.QuickSyncH265; - + || this.SelectedVideoEncoder == VideoEncoder.QuickSyncH265 + || this.SelectedVideoEncoder == VideoEncoder.QuickSyncH26510b; + // Refresh Display this.NotifyOfPropertyChange(() => this.Rfqp); this.NotifyOfPropertyChange(() => this.IsAdvancedTabOptionEnabled); this.NotifyOfPropertyChange(() => this.HighQualityLabel); // Handle some quicksync specific options. - if (selectedEncoder == VideoEncoder.QuickSync || selectedEncoder == VideoEncoder.QuickSyncH265) + if (selectedEncoder == VideoEncoder.QuickSync || selectedEncoder == VideoEncoder.QuickSyncH265 || selectedEncoder == VideoEncoder.QuickSyncH26510b) { this.IsConstantFramerate = true; this.TwoPass = false; -- cgit v1.2.3