diff options
Diffstat (limited to 'win')
7 files changed, 101 insertions, 10 deletions
diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs b/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs index c55c8a927..65b81c509 100644 --- a/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs +++ b/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs @@ -409,6 +409,12 @@ namespace HandBrake.Interop.Interop.HbLib [DllImport("hb", EntryPoint = "hb_qsv_info_init", CallingConvention = CallingConvention.Cdecl)] public static extern int hb_qsv_info_init(); + [DllImport("hb", EntryPoint = "hb_vce_h264_available", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_vce_h264_available(); + + [DllImport("hb", EntryPoint = "hb_vce_h265_available", CallingConvention = CallingConvention.Cdecl)] + public static extern int hb_vce_h265_available(); + // hb_image_t* hb_get_preview2(hb_handle_t* h, int title_idx, int picture, hb_geometry_settings_t* geo, int deinterlace); [DllImport("hb", EntryPoint = "hb_get_preview2", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr hb_get_preview2(IntPtr hbHandle, int title_idx, int preview_idx, ref hb_geometry_settings_s geo, int deinterlace); diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/NativeConstants.cs b/win/CS/HandBrake.Interop/Interop/HbLib/NativeConstants.cs index aacec1bcf..dbf96aeda 100644 --- a/win/CS/HandBrake.Interop/Interop/HbLib/NativeConstants.cs +++ b/win/CS/HandBrake.Interop/Interop/HbLib/NativeConstants.cs @@ -51,6 +51,10 @@ namespace HandBrake.Interop.Interop.HbLib public const uint HB_VCODEC_QSV_H265_10BIT = 0x0000400; public const uint HB_VCODEC_QSV_MASK = 0x0000F00; + public const uint HB_VCODEC_FFMPEG_VCE_H264 = 0x00040000; + public const uint HB_VCODEC_FFMPEG_VCE_H265 = 0x00080000; + public const uint HB_VCODEC_FFMPEG_MASK = (0x00000F0 | HB_VCODEC_FFMPEG_VCE_H264 | HB_VCODEC_FFMPEG_VCE_H265); + // Encode state public const int HB_STATE_IDLE = 1; public const int HB_STATE_SCANNING = 2; diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/VideoEncoder.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/VideoEncoder.cs index 68c09d0d1..a5aded796 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/Encoding/VideoEncoder.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/VideoEncoder.cs @@ -28,6 +28,10 @@ namespace HandBrake.Interop.Interop.Model.Encoding [ShortName("qsv_h264")] QuickSync, + [DisplayName("H.264 (AMD VCE)")] + [ShortName("vce_h264")] + VceH264, + [DisplayName("MPEG-4")] [ShortName("mpeg4")] FFMpeg, @@ -60,6 +64,10 @@ namespace HandBrake.Interop.Interop.Model.Encoding [ShortName("qsv_h265_10bit")] QuickSyncH26510b, + [DisplayName("H.265 (AMD VCE)")] + [ShortName("vce_h265")] + VceH265, + [DisplayName("VP8")] [ShortName("VP8")] VP8, diff --git a/win/CS/HandBrake.Interop/Utilities/SystemInfo.cs b/win/CS/HandBrake.Interop/Utilities/SystemInfo.cs index af0c24724..a364c50ac 100644 --- a/win/CS/HandBrake.Interop/Utilities/SystemInfo.cs +++ b/win/CS/HandBrake.Interop/Utilities/SystemInfo.cs @@ -90,5 +90,37 @@ namespace HandBrake.Interop.Utilities } } } + + public static bool IsVceH264Available + { + get + { + try + { + return HBFunctions.hb_vce_h264_available() != 0; + } + catch (Exception) + { + // Silent failure. Typically this means the dll hasn't been built with --enable-qsv + return false; + } + } + } + + public static bool IsVceH265Available + { + get + { + try + { + return HBFunctions.hb_vce_h265_available() != 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 285b1a373..42ccf1c10 100644 --- a/win/CS/HandBrakeWPF/Converters/Video/VideoEncoderConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/Video/VideoEncoderConverter.cs @@ -91,6 +91,16 @@ namespace HandBrakeWPF.Converters.Video encoders.Remove(VideoEncoder.QuickSyncH26510b);
}
+ if (!SystemInfo.IsVceH264Available)
+ {
+ encoders.Remove(VideoEncoder.VceH264);
+ }
+
+ if (!SystemInfo.IsVceH265Available)
+ {
+ encoders.Remove(VideoEncoder.VceH265);
+ }
+
return EnumHelper<VideoEncoder>.GetEnumDisplayValuesSubset(encoders);
}
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs index 1ee4665de..8396a584f 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs @@ -295,7 +295,11 @@ namespace HandBrakeWPF.Services.Encode.Factories } } - if (job.VideoEncodeRateType == VideoEncodeRateType.ConstantQuality) video.Quality = job.Quality; + if (job.VideoEncodeRateType == VideoEncodeRateType.ConstantQuality) + { + video.Quality = job.Quality; + } + if (job.VideoEncodeRateType == VideoEncodeRateType.AverageBitrate) { video.Bitrate = job.VideoBitrate; @@ -306,7 +310,7 @@ namespace HandBrakeWPF.Services.Encode.Factories video.QSV.Decode = SystemInfo.IsQsvAvailable && configuration.EnableQuickSyncDecoding; // The use of the QSV decoder is configurable for non QSV encoders. - if (video.QSV.Decode && job.VideoEncoder != VideoEncoder.QuickSync && job.VideoEncoder != VideoEncoder.QuickSyncH265) + if (video.QSV.Decode && job.VideoEncoder != VideoEncoder.QuickSync && job.VideoEncoder != VideoEncoder.QuickSyncH265 && job.VideoEncoder != VideoEncoder.QuickSyncH26510b) { video.QSV.Decode = configuration.UseQSVDecodeForNonQSVEnc; } diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs index 18f07e06d..4bd5b777d 100644 --- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs @@ -347,6 +347,8 @@ namespace HandBrakeWPF.ViewModels break;
case VideoEncoder.QuickSync:
case VideoEncoder.QuickSyncH265:
+ case VideoEncoder.VceH264:
+ case VideoEncoder.VceH265:
rfValue = 51.0 - value;
rfValue = Math.Round(rfValue, 0);
this.Task.Quality = rfValue;
@@ -588,6 +590,7 @@ namespace HandBrakeWPF.ViewModels {
return this.displayOptimiseOptions;
}
+
set
{
this.displayOptimiseOptions = value;
@@ -605,6 +608,7 @@ namespace HandBrakeWPF.ViewModels {
return this.displayNonQsvControls;
}
+
set
{
if (value.Equals(this.displayNonQsvControls))
@@ -972,7 +976,8 @@ 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.QuickSyncH26510b)
+ || preset.Task.VideoEncoder == VideoEncoder.QuickSync || preset.Task.VideoEncoder == VideoEncoder.QuickSyncH265 || preset.Task.VideoEncoder == VideoEncoder.QuickSyncH26510b
+ || preset.Task.VideoEncoder == VideoEncoder.VceH264 || preset.Task.VideoEncoder == VideoEncoder.VceH265)
{
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();
@@ -1084,8 +1089,8 @@ namespace HandBrakeWPF.ViewModels if (this.Task.VideoEncoder == VideoEncoder.X264 || this.Task.VideoEncoder == VideoEncoder.X264_10
|| this.Task.VideoEncoder == VideoEncoder.X265 || this.Task.VideoEncoder == VideoEncoder.X265_10
|| 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.QuickSyncH265 || this.Task.VideoEncoder == VideoEncoder.QuickSyncH26510b
+ || this.Task.VideoEncoder == VideoEncoder.VceH264 || this.Task.VideoEncoder == VideoEncoder.VceH265)
{
if (!Equals(preset.Task.VideoPreset, this.Task.VideoPreset))
{
@@ -1176,6 +1181,8 @@ namespace HandBrakeWPF.ViewModels break;
case VideoEncoder.QuickSync:
case VideoEncoder.QuickSyncH265:
+ case VideoEncoder.VceH264:
+ case VideoEncoder.VceH265:
this.QualityMin = 0;
this.QualityMax = 51;
break;
@@ -1298,6 +1305,7 @@ namespace HandBrakeWPF.ViewModels int.TryParse(quality.Value.ToString(CultureInfo.InvariantCulture), out cq);
this.RF = 63 - cq;
}
+
break;
case VideoEncoder.X265:
case VideoEncoder.X265_10:
@@ -1307,10 +1315,15 @@ namespace HandBrakeWPF.ViewModels case VideoEncoder.QuickSync:
case VideoEncoder.QuickSyncH265:
case VideoEncoder.QuickSyncH26510b:
- if (this.SelectedVideoEncoder == VideoEncoder.QuickSync || this.SelectedVideoEncoder == VideoEncoder.QuickSyncH265)
+ case VideoEncoder.VceH264:
+ case VideoEncoder.VceH265:
+
+ if (this.SelectedVideoEncoder == VideoEncoder.QuickSync || this.SelectedVideoEncoder == VideoEncoder.QuickSyncH265 || this.SelectedVideoEncoder == VideoEncoder.QuickSyncH26510b
+ || this.SelectedVideoEncoder == VideoEncoder.VceH264 || this.SelectedVideoEncoder == VideoEncoder.VceH265)
{
cqStep = 1;
}
+
double multiplier = 1.0 / cqStep;
if (quality.HasValue)
{
@@ -1327,6 +1340,7 @@ namespace HandBrakeWPF.ViewModels {
this.RF = (int)quality.Value;
}
+
break;
}
}
@@ -1426,16 +1440,27 @@ namespace HandBrakeWPF.ViewModels this.SetQualitySliderBounds();
// Update control display
- this.UseAdvancedTab = selectedEncoder != VideoEncoder.QuickSync && selectedEncoder != VideoEncoder.QuickSyncH265 && selectedEncoder != VideoEncoder.QuickSyncH26510b && this.UseAdvancedTab;
+ this.UseAdvancedTab = selectedEncoder != VideoEncoder.QuickSync && selectedEncoder != VideoEncoder.QuickSyncH265 && selectedEncoder != VideoEncoder.QuickSyncH26510b
+ && selectedEncoder != VideoEncoder.VceH264 && selectedEncoder != VideoEncoder.VceH265 && 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.QuickSyncH26510b ||
+ this.SelectedVideoEncoder == VideoEncoder.VceH264 || this.SelectedVideoEncoder == VideoEncoder.VceH265 ||
this.SelectedVideoEncoder == VideoEncoder.VP8 || this.SelectedVideoEncoder == VideoEncoder.VP9;
+
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.SelectedVideoEncoder == VideoEncoder.QuickSyncH26510b;
+
+ this.DisplayTuneControls = this.SelectedVideoEncoder == VideoEncoder.X264 || this.SelectedVideoEncoder == VideoEncoder.X264_10 ||
+ this.SelectedVideoEncoder == VideoEncoder.X265 || this.SelectedVideoEncoder == VideoEncoder.X265_10 || this.SelectedVideoEncoder == VideoEncoder.X265_12;
+
+ this.DisplayLevelControl = this.SelectedVideoEncoder == VideoEncoder.X264 || this.SelectedVideoEncoder == VideoEncoder.X264_10 ||
+ this.SelectedVideoEncoder == VideoEncoder.QuickSync || this.SelectedVideoEncoder == VideoEncoder.QuickSyncH265 || this.SelectedVideoEncoder == VideoEncoder.QuickSyncH26510b ||
+ this.SelectedVideoEncoder == VideoEncoder.VceH264 || this.SelectedVideoEncoder == VideoEncoder.VceH265;
+
this.DisplayProfileControl = this.SelectedVideoEncoder == VideoEncoder.X264
|| this.SelectedVideoEncoder == VideoEncoder.X264_10
|| this.SelectedVideoEncoder == VideoEncoder.X265
@@ -1443,7 +1468,9 @@ namespace HandBrakeWPF.ViewModels || this.SelectedVideoEncoder == VideoEncoder.X265_12
|| this.SelectedVideoEncoder == VideoEncoder.QuickSync
|| this.SelectedVideoEncoder == VideoEncoder.QuickSyncH265
- || this.SelectedVideoEncoder == VideoEncoder.QuickSyncH26510b;
+ || this.SelectedVideoEncoder == VideoEncoder.QuickSyncH26510b
+ || this.SelectedVideoEncoder == VideoEncoder.VceH264
+ || this.SelectedVideoEncoder == VideoEncoder.VceH265;
// Refresh Display
this.NotifyOfPropertyChange(() => this.Rfqp);
|