diff options
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices/Utilities')
3 files changed, 164 insertions, 41 deletions
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)
{
|