summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--win/CS/HandBrake.ApplicationServices/Factories/PlistPresetFactory.cs6
-rw-r--r--win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj1
-rw-r--r--win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs12
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs81
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs74
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs50
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs12
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj3
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/Denoise.cs6
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/DenoisePreset.cs37
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/DenoiseTune.cs34
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs10
-rw-r--r--win/CS/HandBrake.Server/HandBrake.Server.csproj1
-rw-r--r--win/CS/HandBrakeWPF/Converters/Filters/DenoisePresetConverter.cs86
-rw-r--r--win/CS/HandBrakeWPF/HandBrakeWPF.csproj2
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs97
-rw-r--r--win/CS/HandBrakeWPF/Views/FiltersView.xaml47
17 files changed, 496 insertions, 63 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Factories/PlistPresetFactory.cs b/win/CS/HandBrake.ApplicationServices/Factories/PlistPresetFactory.cs
index e6b59c31d..8f7e84e6c 100644
--- a/win/CS/HandBrake.ApplicationServices/Factories/PlistPresetFactory.cs
+++ b/win/CS/HandBrake.ApplicationServices/Factories/PlistPresetFactory.cs
@@ -161,6 +161,12 @@ namespace HandBrake.ApplicationServices.Factories
case "PictureDenoise":
preset.Task.Denoise = (Denoise)kvp.Value;
break;
+ case "DenoisePreset":
+ preset.Task.DenoisePreset = (DenoisePreset)kvp.Value; // TODO to be confirmed.
+ break;
+ case "DenoiseTune":
+ preset.Task.DenoiseTune = (DenoiseTune)kvp.Value; // TODO to be confirmed.
+ break;
case "PictureDenoiseCustom":
preset.Task.CustomDenoise = kvp.Value;
break;
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
index 39596c222..0f082f0f3 100644
--- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
+++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
@@ -35,6 +35,7 @@
<PlatformTarget>x64</PlatformTarget>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
+ <UseVSHostingProcess>true</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<PlatformTarget>x64</PlatformTarget>
diff --git a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs
index 6a519a382..be719701b 100644
--- a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs
+++ b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs
@@ -98,6 +98,8 @@ namespace HandBrake.ApplicationServices.Model
this.Decomb = task.Decomb;
this.Deinterlace = task.Deinterlace;
this.Denoise = task.Denoise;
+ this.DenoisePreset = task.DenoisePreset;
+ this.DenoiseTune = task.DenoiseTune;
this.Destination = task.Destination;
this.Detelecine = task.Detelecine;
this.DisplayWidth = task.DisplayWidth;
@@ -314,6 +316,16 @@ namespace HandBrake.ApplicationServices.Model
public Denoise Denoise { get; set; }
/// <summary>
+ /// Gets or sets the denoise preset.
+ /// </summary>
+ public DenoisePreset DenoisePreset { get; set; }
+
+ /// <summary>
+ /// Gets or sets the denoise tune.
+ /// </summary>
+ public DenoiseTune DenoiseTune { get; set; }
+
+ /// <summary>
/// Gets or sets CustomDenoise.
/// </summary>
public string CustomDenoise { get; set; }
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs
index 7448f4bc5..9c6713b30 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs
@@ -199,28 +199,67 @@ namespace HandBrake.ApplicationServices.Utilities
break;
}
- switch (parsed.Denoise)
+
+ if (parsed.Denoise == Denoise.hqdn3d)
{
- case Denoise.Off:
- AddEncodeElement(xmlWriter, "PictureDenoise", "integer", "0");
- AddEncodeElement(xmlWriter, "PictureDenoiseCustom", "string", string.Empty);
- break;
- case Denoise.Weak:
- AddEncodeElement(xmlWriter, "PictureDenoise", "integer", "2");
- AddEncodeElement(xmlWriter, "PictureDenoiseCustom", "string", string.Empty);
- break;
- case Denoise.Medium:
- AddEncodeElement(xmlWriter, "PictureDenoise", "integer", "3");
- AddEncodeElement(xmlWriter, "PictureDenoiseCustom", "string", string.Empty);
- break;
- case Denoise.Strong:
- AddEncodeElement(xmlWriter, "PictureDenoise", "integer", "4");
- AddEncodeElement(xmlWriter, "PictureDenoiseCustom", "string", string.Empty);
- break;
- case Denoise.Custom:
- AddEncodeElement(xmlWriter, "PictureDenoise", "integer", "1");
- AddEncodeElement(xmlWriter, "PictureDenoiseCustom", "string", parsed.CustomDenoise);
- break;
+ switch (parsed.DenoisePreset)
+ {
+ case DenoisePreset.Weak:
+ AddEncodeElement(xmlWriter, "PictureDenoise", "integer", "2");
+ AddEncodeElement(xmlWriter, "PictureDenoiseCustom", "string", string.Empty);
+ break;
+ case DenoisePreset.Medium:
+ AddEncodeElement(xmlWriter, "PictureDenoise", "integer", "3");
+ AddEncodeElement(xmlWriter, "PictureDenoiseCustom", "string", string.Empty);
+ break;
+ case DenoisePreset.Strong:
+ AddEncodeElement(xmlWriter, "PictureDenoise", "integer", "4");
+ AddEncodeElement(xmlWriter, "PictureDenoiseCustom", "string", string.Empty);
+ break;
+ case DenoisePreset.Custom:
+ AddEncodeElement(xmlWriter, "PictureDenoise", "integer", "1");
+ AddEncodeElement(xmlWriter, "PictureDenoiseCustom", "string", parsed.CustomDenoise);
+ break;
+ }
+ }
+
+ // These keys are still TBD. TODO Update these
+ if (parsed.Denoise == Denoise.NlMeans)
+ {
+ switch (parsed.DenoisePreset)
+ {
+ case DenoisePreset.Ultralight:
+ AddEncodeElement(xmlWriter, "DenoisePreset", "integer", "1");
+ break;
+ case DenoisePreset.Light:
+ AddEncodeElement(xmlWriter, "DenoisePreset", "integer", "2");
+ break;
+ case DenoisePreset.Medium:
+ AddEncodeElement(xmlWriter, "DenoisePreset", "integer", "3");
+ break;
+ case DenoisePreset.Strong:
+ AddEncodeElement(xmlWriter, "DenoisePreset", "integer", "4");
+ break;
+ }
+
+ switch (parsed.DenoiseTune)
+ {
+ case DenoiseTune.None:
+ AddEncodeElement(xmlWriter, "DenoiseTune", "integer", "0");
+ break;
+ case DenoiseTune.Animation:
+ AddEncodeElement(xmlWriter, "DenoiseTune", "integer", "1");
+ break;
+ case DenoiseTune.Film:
+ AddEncodeElement(xmlWriter, "DenoiseTune", "integer", "2");
+ break;
+ case DenoiseTune.Grain:
+ AddEncodeElement(xmlWriter, "DenoiseTune", "integer", "3");
+ break;
+ case DenoiseTune.HighMotion:
+ AddEncodeElement(xmlWriter, "DenoiseTune", "integer", "4");
+ break;
+ }
}
int detelecine = 0;
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs
index 8fe7cd3ac..046661058 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs
@@ -372,23 +372,65 @@ namespace HandBrake.ApplicationServices.Utilities
break;
}
- switch (task.Denoise) // Denoise
+ if (task.Denoise == Denoise.hqdn3d)
{
- case Denoise.Weak:
- query += " --denoise=\"weak\"";
- break;
- case Denoise.Medium:
- query += " --denoise=\"medium\"";
- break;
- case Denoise.Strong:
- query += " --denoise=\"strong\"";
- break;
- case Denoise.Custom:
- query += string.Format(" --denoise=\"{0}\"", task.CustomDenoise);
- break;
- default:
- query += string.Empty;
- break;
+ switch (task.DenoisePreset) // Denoise
+ {
+ case DenoisePreset.Weak:
+ query += " --denoise=\"weak\"";
+ break;
+ case DenoisePreset.Medium:
+ query += " --denoise=\"medium\"";
+ break;
+ case DenoisePreset.Strong:
+ query += " --denoise=\"strong\"";
+ break;
+ case DenoisePreset.Custom:
+ query += string.Format(" --denoise=\"{0}\"", task.CustomDenoise);
+ break;
+ }
+ }
+
+ // NL Means
+ if (task.Denoise == Denoise.NlMeans)
+ {
+ switch (task.DenoisePreset) // Denoise
+ {
+ case DenoisePreset.Light:
+ query += " --nlmeans=\"light\"";
+ break;
+ case DenoisePreset.Ultralight:
+ query += " --nlmeans=\"ultralight\"";
+ break;
+ case DenoisePreset.Medium:
+ query += " --nlmeans=\"medium\"";
+ break;
+ case DenoisePreset.Strong:
+ query += " --nlmeans=\"strong\"";
+ break;
+ default:
+ query += string.Empty;
+ break;
+ }
+
+ switch (task.DenoiseTune)
+ {
+ case DenoiseTune.Animation:
+ query += " --nlmeans-tune=\"animation\"";
+ break;
+ case DenoiseTune.Film:
+ query += " --nlmeans-tune=\"film\"";
+ break;
+ case DenoiseTune.Grain:
+ query += " --nlmeans-tune=\"grain\"";
+ break;
+ case DenoiseTune.HighMotion:
+ query += " --nlmeans-tune=\"highmotion\"";
+ break;
+ default:
+ query += string.Empty;
+ break;
+ }
}
if (task.Deblock > 4)
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs
index 2b39c74a5..b3619c7dd 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs
@@ -77,6 +77,8 @@ namespace HandBrake.ApplicationServices.Utilities
Match decombValue = Regex.Match(input, @" --decomb=([a-zA-Z0-9.:""\\]*)");
Match deinterlace = Regex.Match(input, @"--deinterlace=\""([a-zA-Z0-9.:]*)\""");
Match denoise = Regex.Match(input, @"--denoise=\""([a-zA-Z0-9.:]*)\""");
+ Match nlmeans = Regex.Match(input, @"--nlmeans=\""([a-zA-Z0-9.:]*)\""");
+ Match nlmeansTune = Regex.Match(input, @"--nlmeans-tune=\""([a-zA-Z0-9.:]*)\""");
Match deblock = Regex.Match(input, @"--deblock=([0-9:]*)");
Match detelecine = Regex.Match(input, @"--detelecine");
Match detelecineValue = Regex.Match(input, @" --detelecine=\""([a-zA-Z0-9.:]*)\""");
@@ -273,24 +275,64 @@ namespace HandBrake.ApplicationServices.Utilities
parsed.Denoise = Denoise.Off;
if (denoise.Success)
{
+ parsed.Denoise = Denoise.hqdn3d;
switch (denoise.ToString().Replace("--denoise=", string.Empty).Replace("\"", string.Empty))
{
case "weak":
- parsed.Denoise = Denoise.Weak;
+ parsed.DenoisePreset = DenoisePreset.Weak;
break;
case "medium":
- parsed.Denoise = Denoise.Medium;
+ parsed.DenoisePreset = DenoisePreset.Medium;
break;
case "strong":
- parsed.Denoise = Denoise.Strong;
+ parsed.DenoisePreset = DenoisePreset.Strong;
break;
default:
- parsed.Denoise = Denoise.Custom;
+ parsed.DenoisePreset = DenoisePreset.Custom;
parsed.CustomDenoise = denoise.ToString().Replace("--denoise=", string.Empty).Replace("\"", string.Empty);
break;
}
}
+ if (nlmeans.Success)
+ {
+ parsed.Denoise = Denoise.NlMeans;
+ switch (nlmeans.ToString().Replace("--nlmeans=", string.Empty).Replace("\"", string.Empty))
+ {
+ case "ultralight":
+ parsed.DenoisePreset = DenoisePreset.Ultralight;
+ break;
+ case "light":
+ parsed.DenoisePreset = DenoisePreset.Light;
+ break;
+ case "medium":
+ parsed.DenoisePreset = DenoisePreset.Medium;
+ break;
+ case "strong":
+ parsed.DenoisePreset = DenoisePreset.Strong;
+ break;
+ }
+
+ if (nlmeansTune.Success)
+ {
+ switch (nlmeansTune.ToString().Replace("--nlmeans-tune=", string.Empty).Replace("\"", string.Empty))
+ {
+ case "animation":
+ parsed.DenoiseTune = DenoiseTune.Animation;
+ break;
+ case "film":
+ parsed.DenoiseTune = DenoiseTune.Film;
+ break;
+ case "grain":
+ parsed.DenoiseTune = DenoiseTune.Grain;
+ break;
+ case "highmotion":
+ parsed.DenoiseTune = DenoiseTune.HighMotion;
+ break;
+ }
+ }
+ }
+
parsed.Deblock = 0;
if (deblock.Success)
{
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
index 597e8cbe7..0e484794c 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
@@ -1213,24 +1213,26 @@ namespace HandBrake.Interop
if (profile.Denoise != Denoise.Off)
{
string settings = null;
- switch (profile.Denoise)
+ switch (profile.DenoisePreset)
{
- case Denoise.Weak:
+ case DenoisePreset.Weak:
settings = "2:1:1:2:3:3";
break;
- case Denoise.Medium:
+ case DenoisePreset.Medium:
settings = "3:2:2:2:3:3";
break;
- case Denoise.Strong:
+ case DenoisePreset.Strong:
settings = "7:7:7:5:5:5";
break;
- case Denoise.Custom:
+ case DenoisePreset.Custom:
settings = profile.CustomDenoise;
break;
+ // TODO Add new Presets.
default:
break;
}
+ // TODO Add Tunes
this.AddFilter(filterList, (int)hb_filter_ids.HB_FILTER_DENOISE, settings, allocatedMemory);
}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj
index 720f64395..a1f1b076b 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj
@@ -50,6 +50,7 @@
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
+ <UseVSHostingProcess>true</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
@@ -173,6 +174,8 @@
<Compile Include="HbLib\NativeConstants.cs" />
<Compile Include="Interfaces\IHandBrakeInstance.cs" />
<Compile Include="Helpers\InteropUtilities.cs" />
+ <Compile Include="Model\Encoding\DenoisePreset.cs" />
+ <Compile Include="Model\Encoding\DenoiseTune.cs" />
<Compile Include="Model\Encoding\PictureRotation.cs" />
<Compile Include="Model\Encoding\x265\x265Preset.cs" />
<Compile Include="Model\Encoding\x265\x265Profile.cs" />
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/Denoise.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/Denoise.cs
index a2ab0f0a4..500547a24 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/Denoise.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/Denoise.cs
@@ -15,9 +15,7 @@ namespace HandBrake.Interop.Model.Encoding
public enum Denoise
{
Off = 0,
- Weak = 2,
- Medium = 3,
- Strong = 4,
- Custom = 1
+ hqdn3d = 1,
+ NlMeans = 2,
}
}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/DenoisePreset.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/DenoisePreset.cs
new file mode 100644
index 000000000..b26635052
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/DenoisePreset.cs
@@ -0,0 +1,37 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="DenoisePreset.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 DenoisePreset type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Model.Encoding
+{
+ using System.ComponentModel.DataAnnotations;
+
+ /// <summary>
+ /// The denoise preset.
+ /// </summary>
+ public enum DenoisePreset
+ {
+ [Display(Name = "Weak")]
+ Weak = 0,
+
+ [Display(Name = "Medium")]
+ Medium,
+
+ [Display(Name = "Strong")]
+ Strong,
+
+ [Display(Name = "Custom")]
+ Custom,
+
+ [Display(Name = "Ultralight")] // NLMeans only
+ Ultralight,
+
+ [Display(Name = "Light")] // NLMeans only
+ Light,
+ }
+}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/DenoiseTune.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/DenoiseTune.cs
new file mode 100644
index 000000000..35b5843a8
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/DenoiseTune.cs
@@ -0,0 +1,34 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="DenoiseTune.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 DenoiseTune type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Model.Encoding
+{
+ using System.ComponentModel.DataAnnotations;
+
+ /// <summary>
+ /// The denoise tune.
+ /// </summary>
+ public enum DenoiseTune
+ {
+ [Display(Name = "None")]
+ None = 0,
+
+ [Display(Name = "Film")]
+ Film,
+
+ [Display(Name = "Grain")]
+ Grain,
+
+ [Display(Name = "High Motion")]
+ HighMotion,
+
+ [Display(Name = "Animation")]
+ Animation,
+ }
+}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs
index 2dea5624b..834ef5576 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs
@@ -185,6 +185,16 @@ namespace HandBrake.Interop.Model.Encoding
public Denoise Denoise { get; set; }
/// <summary>
+ /// Gets or sets the denoise preset.
+ /// </summary>
+ public DenoisePreset DenoisePreset { get; set; }
+
+ /// <summary>
+ /// Gets or sets the denoise tune.
+ /// </summary>
+ public DenoiseTune DenoiseTune { get; set; }
+
+ /// <summary>
/// Gets or sets the custom denoise.
/// </summary>
public string CustomDenoise { get; set; }
diff --git a/win/CS/HandBrake.Server/HandBrake.Server.csproj b/win/CS/HandBrake.Server/HandBrake.Server.csproj
index 7e202d4c2..98f2548d5 100644
--- a/win/CS/HandBrake.Server/HandBrake.Server.csproj
+++ b/win/CS/HandBrake.Server/HandBrake.Server.csproj
@@ -36,6 +36,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<PlatformTarget>x64</PlatformTarget>
<OutputPath>bin\Debug\</OutputPath>
+ <UseVSHostingProcess>true</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<PlatformTarget>x64</PlatformTarget>
diff --git a/win/CS/HandBrakeWPF/Converters/Filters/DenoisePresetConverter.cs b/win/CS/HandBrakeWPF/Converters/Filters/DenoisePresetConverter.cs
new file mode 100644
index 000000000..bb0ec1b7e
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Converters/Filters/DenoisePresetConverter.cs
@@ -0,0 +1,86 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="DenoisePresetConverter.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 DenoisePresetConverter type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Converters.Filters
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Globalization;
+ using System.Linq;
+ using System.Windows.Data;
+
+ using HandBrake.Interop.Model.Encoding;
+
+ /// <summary>
+ /// The denoise preset converter.
+ /// </summary>
+ public class DenoisePresetConverter : IMultiValueConverter
+ {
+ /// <summary>
+ /// The convert.
+ /// </summary>
+ /// <param name="values">
+ /// The values.
+ /// </param>
+ /// <param name="targetType">
+ /// The target type.
+ /// </param>
+ /// <param name="parameter">
+ /// The parameter.
+ /// </param>
+ /// <param name="culture">
+ /// The culture.
+ /// </param>
+ /// <returns>
+ /// The <see cref="object"/>.
+ /// </returns>
+ public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (values.Any() && values.Count() == 2)
+ {
+ Denoise denoiseChoice = (Denoise)values[1];
+
+ if (denoiseChoice == Denoise.hqdn3d)
+ {
+ return new List<DenoisePreset> { DenoisePreset.Weak, DenoisePreset.Medium, DenoisePreset.Strong, DenoisePreset.Custom };
+ }
+
+ if (denoiseChoice == Denoise.NlMeans)
+ {
+ return new List<DenoisePreset> { DenoisePreset.Ultralight, DenoisePreset.Light, DenoisePreset.Medium, DenoisePreset.Strong };
+ }
+ }
+
+ return Enumerable.Empty<DenoisePreset>();
+ }
+
+ /// <summary>
+ /// The convert back. Not used
+ /// </summary>
+ /// <param name="value">
+ /// The value.
+ /// </param>
+ /// <param name="targetTypes">
+ /// The target types.
+ /// </param>
+ /// <param name="parameter">
+ /// The parameter.
+ /// </param>
+ /// <param name="culture">
+ /// The culture.
+ /// </param>
+ /// <returns>
+ /// The Nothing. Not used
+ /// </returns>
+ public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
index 64752b39d..dcd4a42bb 100644
--- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
+++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
@@ -62,6 +62,7 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
+ <UseVSHostingProcess>true</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\Release\</OutputPath>
@@ -149,6 +150,7 @@
<Compile Include="Constants.cs" />
<Compile Include="Controls\SplitButton\SplitMenuButton.cs" />
<Compile Include="Converters\Audio\AudioBehaviourConverter.cs" />
+ <Compile Include="Converters\Filters\DenoisePresetConverter.cs" />
<Compile Include="Converters\Subtitles\SubtitleBehaviourConverter.cs" />
<Compile Include="Converters\Video\ScalingConverter.cs" />
<Compile Include="Helpers\FileHelper.cs" />
diff --git a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs
index e5d825ba4..70921b23f 100644
--- a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs
@@ -10,12 +10,12 @@
namespace HandBrakeWPF.ViewModels
{
using System.Collections.Generic;
+ using System.Globalization;
using Caliburn.Micro;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Parsing;
- using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.ApplicationServices.Utilities;
using HandBrake.Interop.Model.Encoding;
@@ -145,7 +145,7 @@ namespace HandBrakeWPF.ViewModels
{
get
{
- return this.DeblockValue == 4 ? "Off" : this.DeblockValue.ToString();
+ return this.DeblockValue == 4 ? "Off" : this.DeblockValue.ToString(CultureInfo.InvariantCulture);
}
}
@@ -295,8 +295,13 @@ namespace HandBrakeWPF.ViewModels
this.NotifyOfPropertyChange(() => this.SelectedDenoise);
// Show / Hide the Custom Control
- this.ShowDenoiseCustom = this.CurrentTask.Denoise == Denoise.Custom;
+ this.ShowDenoiseCustom = this.CurrentTask.Denoise == Denoise.hqdn3d && this.CurrentTask.DenoisePreset == DenoisePreset.Custom;
this.NotifyOfPropertyChange(() => this.ShowDenoiseCustom);
+
+ this.SelectedDenoisePreset = this.CurrentTask.Denoise == Denoise.hqdn3d ? DenoisePreset.Weak : DenoisePreset.Ultralight; // Default so we don't have an invalid preset.
+
+ this.NotifyOfPropertyChange(() => this.ShowDenoiseOptions);
+ this.NotifyOfPropertyChange(() => this.ShowDenoiseTune);
}
}
@@ -378,6 +383,90 @@ namespace HandBrakeWPF.ViewModels
/// </summary>
public string DeinterlaceControlText { get; set; }
+ /// <summary>
+ /// Gets or sets the selected denoise tune.
+ /// </summary>
+ public DenoiseTune SelectedDenoiseTune
+ {
+ get
+ {
+ return this.CurrentTask.DenoiseTune;
+ }
+
+ set
+ {
+ this.CurrentTask.DenoiseTune = value;
+ this.NotifyOfPropertyChange(() => this.SelectedDenoiseTune);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the selected denoise preset.
+ /// </summary>
+ public DenoisePreset SelectedDenoisePreset
+ {
+ get
+ {
+ return this.CurrentTask.DenoisePreset;
+ }
+
+ set
+ {
+ this.CurrentTask.DenoisePreset = value;
+ this.NotifyOfPropertyChange(() => this.SelectedDenoisePreset);
+
+ // Show / Hide the Custom Control
+ this.ShowDenoiseCustom = this.CurrentTask.Denoise == Denoise.hqdn3d && this.CurrentTask.DenoisePreset == DenoisePreset.Custom;
+ this.NotifyOfPropertyChange(() => this.ShowDenoiseCustom);
+ this.NotifyOfPropertyChange(() => this.ShowDenoiseOptions);
+ this.NotifyOfPropertyChange(() => this.ShowDenoiseTune);
+ }
+ }
+
+ /// <summary>
+ /// Gets the denoise presets.
+ /// </summary>
+ public IEnumerable<DenoisePreset> DenoisePresets
+ {
+ get
+ {
+ return EnumHelper<DenoisePreset>.GetEnumList();
+ }
+ }
+
+ /// <summary>
+ /// Gets the denoise tunes.
+ /// </summary>
+ public IEnumerable<DenoiseTune> DenoiseTunes
+ {
+ get
+ {
+ return EnumHelper<DenoiseTune>.GetEnumList();
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether show denoise options.
+ /// </summary>
+ public bool ShowDenoiseOptions
+ {
+ get
+ {
+ return this.SelectedDenoise != Denoise.Off;
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether show denoise tune.
+ /// </summary>
+ public bool ShowDenoiseTune
+ {
+ get
+ {
+ return this.SelectedDenoise == Denoise.NlMeans;
+ }
+ }
+
#endregion
#region Implemented Interfaces
@@ -406,6 +495,8 @@ namespace HandBrakeWPF.ViewModels
this.SelectedDetelecine = preset.Task.Detelecine;
this.Grayscale = preset.Task.Grayscale;
this.DeblockValue = preset.Task.Deblock == 0 ? 4 : preset.Task.Deblock;
+ this.SelectedDenoisePreset = preset.Task.DenoisePreset;
+ this.SelectedDenoiseTune = preset.Task.DenoiseTune;
// Custom Values
this.CustomDecomb = preset.Task.CustomDecomb;
diff --git a/win/CS/HandBrakeWPF/Views/FiltersView.xaml b/win/CS/HandBrakeWPF/Views/FiltersView.xaml
index ed5993def..70488d5da 100644
--- a/win/CS/HandBrakeWPF/Views/FiltersView.xaml
+++ b/win/CS/HandBrakeWPF/Views/FiltersView.xaml
@@ -3,11 +3,14 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:Converters="clr-namespace:HandBrakeWPF.Converters" mc:Ignorable="d" >
+ xmlns:Converters="clr-namespace:HandBrakeWPF.Converters"
+ xmlns:filters="clr-namespace:HandBrakeWPF.Converters.Filters"
+ mc:Ignorable="d" >
<UserControl.Resources>
<Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
<Converters:EnumComboConverter x:Key="boolComboConverter" />
<Converters:InverseBooleanConverter x:Key="inverseBooleanConverter" />
+ <filters:DenoisePresetConverter x:Key="DenoisePresetConverter" />
</UserControl.Resources>
<Grid>
@@ -45,7 +48,7 @@
<ComboBox Width="120" Grid.Row="0" ItemsSource="{Binding DetelecineOptions, Converter={StaticResource boolComboConverter}}"
SelectedItem="{Binding SelectedDetelecine, Converter={StaticResource boolComboConverter}}" Grid.Column="1" Margin="0,0,0,10"
HorizontalAlignment="Left"/>
- <TextBox Width="120" Grid.Row="0" Grid.Column="2" Margin="0,0,0,10" Text="{Binding CustomDetelecine}"
+ <TextBox Width="120" Grid.Row="0" Grid.Column="2" Margin="0,0,0,10" Text="{Binding CustomDetelecine}" HorizontalAlignment="Left"
Visibility="{Binding ShowDetelecineCustom, Converter={StaticResource boolToVisConverter}}"/>
<TextBlock Text="{Binding DeinterlaceControlText}" Grid.Row="1" Grid.Column="0" Margin="0,0,0,10" VerticalAlignment="Top"/>
@@ -53,7 +56,7 @@
<StackPanel Orientation="Horizontal">
<RadioButton GroupName="Interlace" Content="Deinterlace" IsChecked="{Binding IsDeinterlaceMode}" />
<RadioButton GroupName="Interlace" Content="Decomb" Margin="10,0,0,0" IsChecked="{Binding IsDeinterlaceMode, Converter={StaticResource inverseBooleanConverter}}" />
- </StackPanel>
+ </StackPanel>
<ComboBox Width="120" ItemsSource="{Binding DecombOptions, Converter={StaticResource boolComboConverter}}" HorizontalAlignment="Left"
SelectedItem="{Binding SelectedDecomb, Converter={StaticResource boolComboConverter}}" Margin="0,0,0,10"
@@ -64,18 +67,42 @@
Visibility="{Binding IsDeinterlaceMode, Converter={StaticResource boolToVisConverter}}" />
</StackPanel>
- <TextBox Width="120" Grid.Row="1" Grid.Column="2" Text="{Binding CustomDecomb}" VerticalAlignment="Top"
+ <TextBox Width="120" Grid.Row="1" Grid.Column="2" Text="{Binding CustomDecomb}" VerticalAlignment="Top" HorizontalAlignment="Left"
Visibility="{Binding ShowDecombCustom, Converter={StaticResource boolToVisConverter}}" />
- <TextBox Width="120" Grid.Row="1" Grid.Column="2" Text="{Binding CustomDeinterlace}" VerticalAlignment="Top"
+ <TextBox Width="120" Grid.Row="1" Grid.Column="2" Text="{Binding CustomDeinterlace}" VerticalAlignment="Top" HorizontalAlignment="Left"
Visibility="{Binding ShowDeinterlaceCustom, Converter={StaticResource boolToVisConverter}}" />
<TextBlock Text="Denoise:" Grid.Row="3" Grid.Column="0" Margin="0,0,0,10"/>
<ComboBox Width="120" Grid.Row="3" ItemsSource="{Binding DenoiseOptions, Converter={StaticResource boolComboConverter}}"
- SelectedItem="{Binding SelectedDenoise, Converter={StaticResource boolComboConverter}}" Grid.Column="1" Margin="0,0,0,10"
- HorizontalAlignment="Left"/>
- <TextBox Width="120" Grid.Row="3" Grid.Column="2" Margin="0,0,0,10" Text="{Binding CustomDenoise}"
- Visibility="{Binding ShowDenoiseCustom, Converter={StaticResource boolToVisConverter}}" />
+ SelectedItem="{Binding SelectedDenoise, Converter={StaticResource boolComboConverter}}" Grid.Column="1"
+ HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0,0,0,10" />
+
+ <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Grid.Row="3" Grid.Column="2" Margin="0,0,0,10"
+ Visibility="{Binding ShowDenoiseOptions, Converter={StaticResource boolToVisConverter}}">
+ <TextBlock Text="Preset: " Margin="5,0,5,0" />
+ <ComboBox SelectedItem="{Binding SelectedDenoisePreset}"
+ MinWidth="100" HorizontalAlignment="Center" VerticalAlignment="Center">
+ <ComboBox.ItemsSource>
+ <MultiBinding Converter="{StaticResource DenoisePresetConverter}">
+ <Binding Path="DenoisePresets" />
+ <Binding Path="SelectedDenoise" />
+ </MultiBinding>
+ </ComboBox.ItemsSource>
+ </ComboBox>
+
+ <StackPanel Orientation="Horizontal" Visibility="{Binding ShowDenoiseTune, Converter={StaticResource boolToVisConverter}}">
+ <TextBlock Text="Tune: " Margin="5,0,5,0" />
+ <ComboBox ItemsSource="{Binding DenoiseTunes}" SelectedItem="{Binding SelectedDenoiseTune}" MinWidth="100"
+ Visibility="{Binding ShowDenoiseTunes, Converter={StaticResource boolToVisConverter}}" VerticalAlignment="Center" />
+ </StackPanel>
+
+ <StackPanel Orientation="Horizontal" Visibility="{Binding ShowDenoiseCustom, Converter={StaticResource boolToVisConverter}}">
+ <TextBlock Text="Custom: " Margin="5,0,5,0" />
+ <TextBox Width="120" Margin="0" Text="{Binding CustomDenoise}" VerticalAlignment="Center" />
+ </StackPanel>
+
+ </StackPanel>
<TextBlock Text="Deblock:" Grid.Row="4" Grid.Column="0" Margin="0,0,0,10"/>
<Slider Width="120" Value="{Binding DeblockValue}" TickPlacement="BottomRight" Minimum="4" Maximum="15" Grid.Row="4" Grid.Column="1" Margin="0,0,0,10"
@@ -86,6 +113,6 @@
</Grid>
</StackPanel>
-
+
</Grid>
</UserControl>