diff options
Diffstat (limited to 'win/CS')
11 files changed, 229 insertions, 26 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj index 60f7a7b9d..c6fddcfb7 100644 --- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj +++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj @@ -137,6 +137,7 @@ <Compile Include="Interop\Json\Encode\SubtitleTrack.cs" />
<Compile Include="Interop\Json\Encode\Video.cs" />
<Compile Include="Interop\Factories\AnamorphicFactory.cs" />
+ <Compile Include="Interop\Model\Encoding\CombDetect.cs" />
<Compile Include="Interop\Model\Encoding\DeinterlaceFilter.cs" />
<Compile Include="Interop\Model\Encoding\HBPresetTune.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HbLib/hb_filter_ids.cs b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/hb_filter_ids.cs index d4164ede6..76059fe8b 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/HbLib/hb_filter_ids.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/hb_filter_ids.cs @@ -9,23 +9,36 @@ namespace HandBrake.ApplicationServices.Interop.HbLib {
public enum hb_filter_ids
{
- HB_FILTER_QSV_PRE = 1, // for QSV - important to have before other filters
+ HB_FILTER_INVALID = 0,
+ // for QSV - important to have before other filters
+ HB_FILTER_FIRST = 1,
+ HB_FILTER_QSV_PRE = 1,
+
// First, filters that may change the framerate (drop or dup frames)
HB_FILTER_DETELECINE,
+ HB_FILTER_COMB_DETECT,
HB_FILTER_DECOMB,
HB_FILTER_DEINTERLACE,
HB_FILTER_VFR,
// Filters that must operate on the original source image are next
HB_FILTER_DEBLOCK,
- HB_FILTER_HQDN3D,
+ HB_FILTER_DENOISE,
+ HB_FILTER_HQDN3D = HB_FILTER_DENOISE,
HB_FILTER_NLMEANS,
HB_FILTER_RENDER_SUB,
HB_FILTER_CROP_SCALE,
- // Finally filters that don't care what order they are in,
- // except that they must be after the above filters
HB_FILTER_ROTATE,
HB_FILTER_GRAYSCALE,
- HB_FILTER_QSV_POST, // for QSV - important to have as a last one
- HB_FILTER_QSV, // default MSDK VPP filter
+ HB_FILTER_PAD,
+
+ // Finally filters that don't care what order they are in,
+ // except that they must be after the above filters
+ HB_FILTER_AVFILTER,
+
+ // for QSV - important to have as a last one
+ HB_FILTER_QSV_POST,
+ // default MSDK VPP filter
+ HB_FILTER_QSV,
+ HB_FILTER_LAST = HB_FILTER_QSV
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Presets/HBPreset.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Presets/HBPreset.cs index 260b55960..7e1e94697 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Presets/HBPreset.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Presets/HBPreset.cs @@ -127,6 +127,16 @@ namespace HandBrake.ApplicationServices.Interop.Json.Presets public string PictureDeinterlaceFilter { get; set; }
/// <summary>
+ /// Gets or sets the picture comb detect preset.
+ /// </summary>
+ public string PictureCombDetectPreset { get; set; }
+
+ /// <summary>
+ /// Gets or sets the picture comb detect custom.
+ /// </summary>
+ public string PictureCombDetectCustom { get; set; }
+
+ /// <summary>
/// Gets or sets the picture deinterlace preset.
/// </summary>
public string PictureDeinterlacePreset { get; set; }
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/CombDetect.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/CombDetect.cs new file mode 100644 index 000000000..d98d0d2ec --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/CombDetect.cs @@ -0,0 +1,34 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="CombDetect.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <summary> +// Defines the CombDetect type. +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrake.ApplicationServices.Interop.Model.Encoding +{ + using HandBrake.ApplicationServices.Attributes; + + /// <summary> + /// The CombDetect Type. + /// </summary> + public enum CombDetect + { + [ShortName("off")] + Off, + + [ShortName("custom")] + Custom, + + [ShortName("default")] + Default, + + [ShortName("permissive")] + LessSensitive, + + [ShortName("fast")] + Fast + } +} diff --git a/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs b/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs index b154c4dce..a25cd1100 100644 --- a/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs @@ -15,7 +15,6 @@ namespace HandBrakeWPF.Converters using System;
using HandBrake.ApplicationServices.Model;
- using HandBrake.ApplicationServices.Utilities;
using HandBrake.ApplicationServices.Interop.Model.Encoding;
using HandBrakeWPF.Services.Queue.Model;
@@ -95,6 +94,10 @@ namespace HandBrakeWPF.Converters {
return EnumHelper<DeinterlaceFilter>.GetEnumDisplayValues(typeof(DeinterlaceFilter));
}
+ if (value is IEnumerable<CombDetect>)
+ {
+ return EnumHelper<CombDetect>.GetEnumDisplayValues(typeof(CombDetect));
+ }
// Single Items
if (targetType == typeof(VideoEncoder) || value.GetType() == typeof(VideoEncoder))
@@ -145,6 +148,10 @@ namespace HandBrakeWPF.Converters {
return EnumHelper<DeinterlaceFilter>.GetDisplay((DeinterlaceFilter)value);
}
+ if (targetType == typeof(CombDetect) || value.GetType() == typeof(CombDetect))
+ {
+ return EnumHelper<CombDetect>.GetDisplay((CombDetect)value);
+ }
return null;
}
@@ -215,6 +222,10 @@ namespace HandBrakeWPF.Converters return EnumHelper<DeinterlaceFilter>.GetValue(value.ToString());
}
+ if (targetType == typeof(CombDetect) || value.GetType() == typeof(CombDetect))
+ {
+ return EnumHelper<CombDetect>.GetValue(value.ToString());
+ }
return null;
}
}
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs index 6304c4af3..5167e7218 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs @@ -435,6 +435,19 @@ namespace HandBrakeWPF.Services.Encode.Factories filter.FilterList.Add(filterItem); } + if (job.DeinterlaceFilter == DeinterlaceFilter.Decomb || job.DeinterlaceFilter == DeinterlaceFilter.Yadif) + { + if (job.CombDetect != CombDetect.Off) + { + IntPtr settingsPtr = HBFunctions.hb_generate_filter_settings_json((int)hb_filter_ids.HB_FILTER_COMB_DETECT, EnumHelper<CombDetect>.GetShortName(job.CombDetect), null, job.CustomCombDetect); + string unparsedJson = Marshal.PtrToStringAnsi(settingsPtr); + JToken settings = JObject.Parse(unparsedJson); + + Filter filterItem = new Filter { ID = (int)hb_filter_ids.HB_FILTER_COMB_DETECT, Settings = settings }; + filter.FilterList.Add(filterItem); + } + } + // Denoise if (job.Denoise != Denoise.Off) { diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs index 0ae588bc7..71af5cc0d 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs @@ -298,11 +298,21 @@ namespace HandBrakeWPF.Services.Encode.Model public Decomb Decomb { get; set; } /// <summary> + /// Gets or sets the comb detect. + /// </summary> + public CombDetect CombDetect { get; set; } + + /// <summary> /// Gets or sets CustomDecomb. /// </summary> public string CustomDecomb { get; set; } /// <summary> + /// Gets or sets the custom comb detect. + /// </summary> + public string CustomCombDetect { get; set; } + + /// <summary> /// Gets or sets Detelecine. /// </summary> public Detelecine Detelecine { get; set; } diff --git a/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs b/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs index a92a67adb..046e51d5b 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs @@ -173,9 +173,35 @@ namespace HandBrakeWPF.Services.Presets.Factories }
}
+ if (preset.Task.DeinterlaceFilter == DeinterlaceFilter.Yadif || preset.Task.DeinterlaceFilter == DeinterlaceFilter.Decomb)
+ {
+ switch (importedPreset.PictureCombDetectPreset)
+ {
+ case "off":
+ preset.Task.CombDetect = CombDetect.Off;
+ break;
+ case "custom":
+ preset.Task.CombDetect = CombDetect.Custom;
+ break;
+ case "default":
+ preset.Task.CombDetect = CombDetect.Default;
+ break;
+ case "permissive":
+ preset.Task.CombDetect = CombDetect.LessSensitive;
+ break;
+ case "fast":
+ preset.Task.CombDetect = CombDetect.Fast;
+ break;
+ default:
+ preset.Task.CombDetect = CombDetect.Off;
+ break;
+ }
+ }
+
preset.Task.CustomDeinterlace = importedPreset.PictureDetelecineCustom;
preset.Task.CustomDenoise = importedPreset.PictureDenoiseCustom;
preset.Task.CustomDetelecine = importedPreset.PictureDetelecineCustom;
+ preset.Task.CustomCombDetect = importedPreset.PictureCombDetectCustom;
switch (importedPreset.PictureDetelecine)
{
@@ -579,6 +605,8 @@ namespace HandBrakeWPF.Services.Presets.Factories preset.PictureDenoiseTune = EnumHelper<DenoiseTune>.GetShortName(export.Task.DenoiseTune);
preset.PictureDetelecine = EnumHelper<Detelecine>.GetShortName(export.Task.Detelecine);
preset.PictureDetelecineCustom = export.Task.CustomDetelecine;
+ preset.PictureCombDetectPreset = EnumHelper<CombDetect>.GetShortName(export.Task.CombDetect);
+ preset.PictureCombDetectCustom = export.Task.CustomCombDetect;
// Video
preset.VideoEncoder = EnumHelper<VideoEncoder>.GetShortName(export.Task.VideoEncoder);
diff --git a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs index 4dd88f6be..7cb50ac37 100644 --- a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs @@ -216,6 +216,17 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
+ /// Comb Detection Presets
+ /// </summary>
+ public IEnumerable<CombDetect> CombDetectPresets
+ {
+ get
+ {
+ return EnumHelper<CombDetect>.GetEnumList();
+ }
+ }
+
+ /// <summary>
/// Gets or sets a value indicating whether Grayscale.
/// </summary>
public bool Grayscale
@@ -256,6 +267,48 @@ namespace HandBrakeWPF.ViewModels }
}
+ public CombDetect SelectedCombDetectPreset
+ {
+ get
+ {
+ return this.CurrentTask.CombDetect;
+ }
+
+ set
+ {
+ this.CurrentTask.CombDetect = value;
+ this.NotifyOfPropertyChange(() => this.SelectedCombDetectPreset);
+
+ // Show / Hide the Custom Control
+ this.NotifyOfPropertyChange(() => this.ShowCombDetectCustom);
+ }
+ }
+
+ /// <summary>
+ /// Show the CombDetect Custom Box.
+ /// </summary>
+ public bool ShowCombDetectCustom
+ {
+ get
+ {
+ return this.SelectedCombDetectPreset == CombDetect.Custom;
+ }
+ }
+
+ public string CustomCombDetect
+ {
+ get
+ {
+ return this.CurrentTask.CustomCombDetect;
+ }
+
+ set
+ {
+ this.CurrentTask.CustomCombDetect = value;
+ this.NotifyOfPropertyChange(() => this.CustomCombDetect);
+ }
+ }
+
/// <summary>
/// Gets or sets SelectedDecomb.
/// </summary>
diff --git a/win/CS/HandBrakeWPF/Views/FiltersView.xaml b/win/CS/HandBrakeWPF/Views/FiltersView.xaml index 494adae51..d40567fcc 100644 --- a/win/CS/HandBrakeWPF/Views/FiltersView.xaml +++ b/win/CS/HandBrakeWPF/Views/FiltersView.xaml @@ -10,7 +10,6 @@ <UserControl.Resources>
<Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
<Converters:EnumComboConverter x:Key="boolComboConverter" />
- <Converters:InverseBooleanConverter x:Key="inverseBooleanConverter" />
<filters:DenoisePresetConverter x:Key="DenoisePresetConverter" />
</UserControl.Resources>
@@ -56,31 +55,58 @@ Visibility="{Binding ShowDetelecineCustom, Converter={StaticResource boolToVisConverter}}"/>
<!-- Deinterlace -->
- <TextBlock Text="{x:Static Properties:ResourcesUI.FiltersView_Deinterlace}" Grid.Row="1" Grid.Column="0" Margin="0,0,0,10" />
- <StackPanel Grid.Row="1" Grid.Column="1" >
+ <TextBlock Text="{x:Static Properties:ResourcesUI.FiltersView_Deinterlace}" VerticalAlignment="Center" Grid.Row="1" Grid.Column="0" Margin="0,0,0,10" />
+ <StackPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Margin="0,0,0,10">
<ComboBox Width="120" ItemsSource="{Binding DeinterlaceFilterOptions, Converter={StaticResource boolComboConverter}}" HorizontalAlignment="Left"
- SelectedItem="{Binding SelectedDeinterlaceFilter, Converter={StaticResource boolComboConverter}}" Margin="0,0,0,10" />
+ SelectedItem="{Binding SelectedDeinterlaceFilter, Converter={StaticResource boolComboConverter}}" />
</StackPanel>
- <StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="2">
- <TextBlock Text="Preset:" VerticalAlignment="Center" Margin="0,0,5,10" Visibility="{Binding IsDeinterlaceDecomb, Converter={StaticResource boolToVisConverter}}" />
- <ComboBox Width="120" ItemsSource="{Binding DecombOptions, Converter={StaticResource boolComboConverter}}" HorizontalAlignment="Left" VerticalAlignment="Center"
- SelectedItem="{Binding SelectedDecomb, Converter={StaticResource boolComboConverter}}"
- Visibility="{Binding IsDecombMode, Converter={StaticResource boolToVisConverter}}" Margin="0,0,0,10" />
+ <Grid Grid.Row="1" Grid.Column="2" Margin="0,0,0,10">
+ <Grid.RowDefinitions>
+ <RowDefinition />
+ <RowDefinition />
+ </Grid.RowDefinitions>
+
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition />
+ <ColumnDefinition Width="15"/>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition />
+ </Grid.ColumnDefinitions>
+
+
+ <TextBlock Text="Preset:" VerticalAlignment="Center" Margin="0,0,5,0" Grid.Column="0" Grid.Row="0" Visibility="{Binding IsDeinterlaceDecomb, Converter={StaticResource boolToVisConverter}}" />
+ <StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal">
+ <ComboBox Width="120" ItemsSource="{Binding DecombOptions, Converter={StaticResource boolComboConverter}}" HorizontalAlignment="Left" VerticalAlignment="Center"
+ SelectedItem="{Binding SelectedDecomb, Converter={StaticResource boolComboConverter}}"
+ Visibility="{Binding IsDecombMode, Converter={StaticResource boolToVisConverter}}" />
+
+ <ComboBox Width="120" ItemsSource="{Binding DeInterlaceOptions, Converter={StaticResource boolComboConverter}}" HorizontalAlignment="Left" VerticalAlignment="Center"
+ SelectedItem="{Binding SelectedDeInterlace, Converter={StaticResource boolComboConverter}}"
+ Visibility="{Binding IsDeinterlaceMode, Converter={StaticResource boolToVisConverter}}" />
+ </StackPanel>
- <ComboBox Width="120" ItemsSource="{Binding DeInterlaceOptions, Converter={StaticResource boolComboConverter}}" HorizontalAlignment="Left" VerticalAlignment="Center"
- SelectedItem="{Binding SelectedDeInterlace, Converter={StaticResource boolComboConverter}}"
- Visibility="{Binding IsDeinterlaceMode, Converter={StaticResource boolToVisConverter}}" Margin="0,0,0,10" />
+ <TextBlock Text="Custom:" VerticalAlignment="Center" Margin="0,0,5,0" Grid.Column="0" Grid.Row="1" Visibility="{Binding ShowDeinterlaceDecombCustom, Converter={StaticResource boolToVisConverter}}" />
+ <StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal">
+ <TextBox Width="120" Text="{Binding CustomDecomb, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" HorizontalAlignment="Left"
+ Visibility="{Binding ShowDecombCustom, Converter={StaticResource boolToVisConverter}}" Margin="0,5,0,0" MinHeight="22" />
- <TextBlock Text="Custom:" VerticalAlignment="Center" Margin="5,0,5,10" Visibility="{Binding ShowDeinterlaceDecombCustom, Converter={StaticResource boolToVisConverter}}" />
- <TextBox Width="120" Text="{Binding CustomDecomb, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" HorizontalAlignment="Left"
- Visibility="{Binding ShowDecombCustom, Converter={StaticResource boolToVisConverter}}" Margin="0,0,0,10" />
+ <TextBox Width="120" Text="{Binding CustomDeinterlace, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" HorizontalAlignment="Left"
+ Visibility="{Binding ShowDeinterlaceCustom, Converter={StaticResource boolToVisConverter}}" Margin="0,5,0,0" MinHeight="22" />
+ </StackPanel>
- <TextBox Width="120" Text="{Binding CustomDeinterlace, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" HorizontalAlignment="Left"
- Visibility="{Binding ShowDeinterlaceCustom, Converter={StaticResource boolToVisConverter}}" Margin="0,0,0,10" />
- </StackPanel>
+ <TextBlock Text="Interlace Detection:" VerticalAlignment="Center" Margin="0,0,5,0" Grid.Column="3" Grid.Row="0" Visibility="{Binding IsDeinterlaceDecomb, Converter={StaticResource boolToVisConverter}}" />
+ <TextBlock Text="Custom:" VerticalAlignment="Center" Margin="0,0,5,0" Grid.Column="3" Grid.Row="1" Visibility="{Binding ShowCombDetectCustom, Converter={StaticResource boolToVisConverter}}" />
+
+ <ComboBox Width="120" Grid.Row="0" Grid.Column="4" ItemsSource="{Binding CombDetectPresets, Converter={StaticResource boolComboConverter}}" HorizontalAlignment="Left" VerticalAlignment="Center"
+ SelectedItem="{Binding SelectedCombDetectPreset, Converter={StaticResource boolComboConverter}}"
+ Visibility="{Binding IsDeinterlaceDecomb, Converter={StaticResource boolToVisConverter}}"/>
+ <TextBox Width="120" Grid.Row="1" Grid.Column="4" Text="{Binding CustomCombDetect, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" HorizontalAlignment="Left"
+ Visibility="{Binding ShowCombDetectCustom, Converter={StaticResource boolToVisConverter}}" Margin="0,5,0,0" MinHeight="22" />
+ </Grid>
@@ -112,7 +138,7 @@ <StackPanel Orientation="Horizontal" Visibility="{Binding ShowDenoiseCustom, Converter={StaticResource boolToVisConverter}}">
<TextBlock Text="{x:Static Properties:ResourcesUI.FiltersView_Custom}" Margin="5,0,5,0" />
- <TextBox Width="120" Margin="0" Text="{Binding CustomDenoise, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" />
+ <TextBox Width="120" Margin="0" Text="{Binding CustomDenoise, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" MinHeight="22" />
</StackPanel>
</StackPanel>
diff --git a/win/CS/HandBrakeWPF/Views/Styles/Styles.xaml b/win/CS/HandBrakeWPF/Views/Styles/Styles.xaml index 247819000..3b4b0eeb9 100644 --- a/win/CS/HandBrakeWPF/Views/Styles/Styles.xaml +++ b/win/CS/HandBrakeWPF/Views/Styles/Styles.xaml @@ -13,6 +13,10 @@ <Style TargetType="{x:Type TextBlock}">
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
+
+ <Style TargetType="{x:Type TextBox}">
+ <Setter Property="VerticalContentAlignment" Value="Center"/>
+ </Style>
<Style TargetType="{x:Type Button}">
<Setter Property="MinHeight" Value="22"/>
|