summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsr55 <[email protected]>2012-03-24 21:31:49 +0000
committersr55 <[email protected]>2012-03-24 21:31:49 +0000
commit654057c737c7b51f236bdc6f5100f24f3fc4f8be (patch)
treec3c42ba0c649bab1a3a393b7fcbb460b3352e5e6
parent71be55c4db11cd6e2f8ba2f2df25e030fa089644 (diff)
WinGui: (WPF) Port the Advanced Panel for x264 from VidCoder.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4536 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--win/CS/HandBrakeWPF/Converters/AdvancedVisibilityConverter.cs94
-rw-r--r--win/CS/HandBrakeWPF/Converters/BooleanToVisibilityConverter.cs5
-rw-r--r--win/CS/HandBrakeWPF/HandBrakeWPF.csproj20
-rw-r--r--win/CS/HandBrakeWPF/Helpers/AdvancedChoicesHelper.cs365
-rw-r--r--win/CS/HandBrakeWPF/Model/AdvancedChoice.cs32
-rw-r--r--win/CS/HandBrakeWPF/Properties/Resources.Designer.cs227
-rw-r--r--win/CS/HandBrakeWPF/Properties/Resources.resx129
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs1034
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs1
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs1
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs129
-rw-r--r--win/CS/HandBrakeWPF/Views/AdvancedView.xaml333
-rw-r--r--win/CS/HandBrakeWPF/Views/VideoView.xaml39
13 files changed, 2299 insertions, 110 deletions
diff --git a/win/CS/HandBrakeWPF/Converters/AdvancedVisibilityConverter.cs b/win/CS/HandBrakeWPF/Converters/AdvancedVisibilityConverter.cs
new file mode 100644
index 000000000..905d8798a
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Converters/AdvancedVisibilityConverter.cs
@@ -0,0 +1,94 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="AdvancedVisibilityConverter.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 AdvancedVisibilityConverter type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Converters
+{
+ using System;
+ using System.Globalization;
+ using System.Windows;
+ using System.Windows.Data;
+
+ /// <summary>
+ /// The advanced visibility converter.
+ /// </summary>
+ [Obsolete("This will be refactored out soon! Don't use.")]
+ public class AdvancedVisibilityConverter : IValueConverter
+ {
+ #region Implemented Interfaces
+
+ #region IValueConverter
+
+ /// <summary>
+ /// The convert.
+ /// </summary>
+ /// <param name="value">
+ /// The value.
+ /// </param>
+ /// <param name="targetType">
+ /// The target type.
+ /// </param>
+ /// <param name="parameter">
+ /// The parameter.
+ /// </param>
+ /// <param name="culture">
+ /// The culture.
+ /// </param>
+ /// <returns>
+ /// The convert.
+ /// </returns>
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ bool visibility = (bool)value;
+
+ // If we are given a parameter, reverse it
+ if (parameter != null)
+ {
+ visibility = !visibility;
+ }
+
+ return visibility ? Visibility.Visible : Visibility.Collapsed;
+ }
+
+ /// <summary>
+ /// The convert back.
+ /// </summary>
+ /// <param name="value">
+ /// The value.
+ /// </param>
+ /// <param name="targetType">
+ /// The target type.
+ /// </param>
+ /// <param name="parameter">
+ /// The parameter.
+ /// </param>
+ /// <param name="culture">
+ /// The culture.
+ /// </param>
+ /// <returns>
+ /// The convert back.
+ /// </returns>
+ public object ConvertBack(
+ object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ Visibility visibility = (Visibility)value;
+ bool result = visibility == Visibility.Visible;
+
+ if (parameter != null)
+ {
+ result = !result;
+ }
+
+ return result;
+ }
+
+ #endregion
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Converters/BooleanToVisibilityConverter.cs b/win/CS/HandBrakeWPF/Converters/BooleanToVisibilityConverter.cs
index 81e12ddc8..31da7ed74 100644
--- a/win/CS/HandBrakeWPF/Converters/BooleanToVisibilityConverter.cs
+++ b/win/CS/HandBrakeWPF/Converters/BooleanToVisibilityConverter.cs
@@ -42,6 +42,11 @@ namespace HandBrakeWPF.Converters
// Paramater is a boolean which inverts the output.
var param = System.Convert.ToBoolean(parameter, CultureInfo.InvariantCulture);
+ if (value == null)
+ {
+ return Visibility.Collapsed;
+ }
+
if (value is Boolean)
{
if (param)
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
index 3d8fb826f..94723903e 100644
--- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
+++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
@@ -15,6 +15,21 @@
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
@@ -95,16 +110,19 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
+ <Compile Include="Converters\AdvancedVisibilityConverter.cs" />
<Compile Include="Converters\BooleanConverter.cs" />
<Compile Include="Converters\BooleanToVisibilityConverter.cs" />
<Compile Include="Converters\QueueStatusToVisibilityConverter.cs" />
<Compile Include="Converters\EnumComboConverter.cs" />
<Compile Include="Converters\FullPathToFileNameConverter.cs" />
+ <Compile Include="Helpers\AdvancedChoicesHelper.cs" />
<Compile Include="Helpers\AutoNameHelper.cs" />
<Compile Include="Helpers\CliCheckHelper.cs" />
<Compile Include="Helpers\ListBoxHelper.cs" />
<Compile Include="Helpers\QueueRecoveryHelper.cs" />
<Compile Include="Helpers\UpdateCheckHelper.cs" />
+ <Compile Include="Model\AdvancedChoice.cs" />
<Compile Include="Services\ErrorService.cs" />
<Compile Include="Services\Interfaces\IJobContextService.cs" />
<Compile Include="Services\Interfaces\IErrorService.cs" />
@@ -212,7 +230,7 @@
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
- <Generator>ResXFileCodeGenerator</Generator>
+ <Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="app.config" />
diff --git a/win/CS/HandBrakeWPF/Helpers/AdvancedChoicesHelper.cs b/win/CS/HandBrakeWPF/Helpers/AdvancedChoicesHelper.cs
new file mode 100644
index 000000000..8c521d9e7
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Helpers/AdvancedChoicesHelper.cs
@@ -0,0 +1,365 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="AdvancedChoicesHelper.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>
+// The advanced choices.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Helpers
+{
+ using System.Collections.Generic;
+ using System.Globalization;
+
+ using HandBrakeWPF.Model;
+
+ /// <summary>
+ /// The advanced choices.
+ /// </summary>
+ public static class AdvancedChoicesHelper
+ {
+ #region Constants and Fields
+
+ /// <summary>
+ /// The adaptive b frames.
+ /// </summary>
+ private static List<AdvancedChoice> adaptiveBFrames;
+
+ /// <summary>
+ /// The analysis.
+ /// </summary>
+ private static List<AdvancedChoice> analysis;
+
+ /// <summary>
+ /// The b frames.
+ /// </summary>
+ private static List<AdvancedChoice> bFrames;
+
+ /// <summary>
+ /// The deblocking strength.
+ /// </summary>
+ private static List<AdvancedChoice> deblockingStrength;
+
+ /// <summary>
+ /// The deblocking threshold.
+ /// </summary>
+ private static List<AdvancedChoice> deblockingThreshold;
+
+ /// <summary>
+ /// The direct prediction.
+ /// </summary>
+ private static List<AdvancedChoice> directPrediction;
+
+ /// <summary>
+ /// The motion estimation method.
+ /// </summary>
+ private static List<AdvancedChoice> motionEstimationMethod;
+
+ /// <summary>
+ /// The motion estimation range.
+ /// </summary>
+ private static List<AdvancedChoice> motionEstimationRange;
+
+ /// <summary>
+ /// The pyramidal b frames.
+ /// </summary>
+ private static List<AdvancedChoice> pyramidalBFrames;
+
+ /// <summary>
+ /// The reference frames.
+ /// </summary>
+ private static List<AdvancedChoice> referenceFrames;
+
+ /// <summary>
+ /// The subpixel motion estimation.
+ /// </summary>
+ private static List<AdvancedChoice> subpixelMotionEstimation;
+
+ /// <summary>
+ /// The trellis.
+ /// </summary>
+ private static List<AdvancedChoice> trellis;
+
+ #endregion
+
+ #region Constructors and Destructors
+
+ /// <summary>
+ /// Initializes static members of the <see cref="AdvancedChoicesHelper"/> class.
+ /// </summary>
+ static AdvancedChoicesHelper()
+ {
+ referenceFrames = CreateNumberList(0, 16, defaultNumber: 3);
+ bFrames = CreateNumberList(0, 16, defaultNumber: 3);
+
+ pyramidalBFrames = new List<AdvancedChoice>
+ {
+ new AdvancedChoice { Label = "Off", Value = "none" },
+ new AdvancedChoice { Label = "Normal (Default)", IsDefault = true },
+ new AdvancedChoice { Label = "Strict", Value = "strict" }
+ };
+
+ adaptiveBFrames = new List<AdvancedChoice>
+ {
+ new AdvancedChoice { Label = "Off", Value = "0" },
+ new AdvancedChoice { Label = "Fast (Default)", Value = "1", IsDefault = true },
+ new AdvancedChoice { Label = "Optimal", Value = "2" }
+ };
+
+ directPrediction = new List<AdvancedChoice>
+ {
+ new AdvancedChoice { Label = "None", Value = "none" },
+ new AdvancedChoice { Label = "Spatial (Default)", Value = "spatial", IsDefault = true },
+ new AdvancedChoice { Label = "Temporal", Value = "temporal" },
+ new AdvancedChoice { Label = "Automatic", Value = "auto" }
+ };
+
+ motionEstimationMethod = new List<AdvancedChoice>
+ {
+ new AdvancedChoice { Label = "Diamond", Value = "dia" },
+ new AdvancedChoice { Label = "Hexagon (Default)", Value = "hex", IsDefault = true },
+ new AdvancedChoice { Label = "Uneven Multi-Hexagon", Value = "umh" },
+ new AdvancedChoice { Label = "Exhaustive", Value = "esa" },
+ new AdvancedChoice { Label = "Transformed Exhaustive", Value = "tesa" },
+ };
+
+ subpixelMotionEstimation = new List<AdvancedChoice>
+ {
+ new AdvancedChoice { Label = "0: SAD, no subpel (super fast!)", Value = "0" },
+ new AdvancedChoice { Label = "1: SAD, qpel", Value = "1" },
+ new AdvancedChoice { Label = "2: SATD, qpel", Value = "2" },
+ new AdvancedChoice { Label = "3: SATD, multi-qpel", Value = "3" },
+ new AdvancedChoice { Label = "4: SATD, qpel on all", Value = "4" },
+ new AdvancedChoice { Label = "5: SATD, multi-qpel on all", Value = "5" },
+ new AdvancedChoice { Label = "6: RD in I/P-frames", Value = "6" },
+ new AdvancedChoice { Label = "7: RD in all frames (Default)", Value = "7", IsDefault = true },
+ new AdvancedChoice { Label = "8: RD refine in I/P-frames", Value = "8" },
+ new AdvancedChoice { Label = "9: RD refine in all frames", Value = "9" },
+ new AdvancedChoice { Label = "10: QPRD in all frames", Value = "10" },
+ new AdvancedChoice { Label = "11: No early terminations in analysis", Value = "11" },
+ };
+
+ // subpixelMotionEstimation = CreateNumberList(0, 9, defaultNumber: 7);
+ motionEstimationRange = CreateNumberList(4, 64, defaultNumber: 16);
+
+ analysis = new List<AdvancedChoice>
+ {
+ new AdvancedChoice { Label = "None", Value = "none" },
+ new AdvancedChoice { Label = "Some (Default)", IsDefault = true },
+ new AdvancedChoice { Label = "All", Value = "all" }
+ };
+
+ trellis = new List<AdvancedChoice>
+ {
+ new AdvancedChoice { Label = "Off", Value = "0" },
+ new AdvancedChoice { Label = "Encode Only (Default)", Value = "1", IsDefault = true },
+ new AdvancedChoice { Label = "Always", Value = "2" }
+ };
+
+ deblockingStrength = CreateNumberList(-6, 6, defaultNumber: 0);
+ deblockingThreshold = CreateNumberList(-6, 6, defaultNumber: 0);
+ }
+
+ #endregion
+
+ #region Properties
+
+ /// <summary>
+ /// Gets AdaptiveBFrames.
+ /// </summary>
+ public static List<AdvancedChoice> AdaptiveBFrames
+ {
+ get
+ {
+ return adaptiveBFrames;
+ }
+ }
+
+ /// <summary>
+ /// Gets Analysis.
+ /// </summary>
+ public static List<AdvancedChoice> Analysis
+ {
+ get
+ {
+ return analysis;
+ }
+ }
+
+ /// <summary>
+ /// Gets BFrames.
+ /// </summary>
+ public static List<AdvancedChoice> BFrames
+ {
+ get
+ {
+ return bFrames;
+ }
+ }
+
+ /// <summary>
+ /// Gets DeblockingStrength.
+ /// </summary>
+ public static List<AdvancedChoice> DeblockingStrength
+ {
+ get
+ {
+ return deblockingStrength;
+ }
+ }
+
+ /// <summary>
+ /// Gets DeblockingThreshold.
+ /// </summary>
+ public static List<AdvancedChoice> DeblockingThreshold
+ {
+ get
+ {
+ return deblockingThreshold;
+ }
+ }
+
+ /// <summary>
+ /// Gets DirectPrediction.
+ /// </summary>
+ public static List<AdvancedChoice> DirectPrediction
+ {
+ get
+ {
+ return directPrediction;
+ }
+ }
+
+ /// <summary>
+ /// Gets MotionEstimationMethod.
+ /// </summary>
+ public static List<AdvancedChoice> MotionEstimationMethod
+ {
+ get
+ {
+ return motionEstimationMethod;
+ }
+ }
+
+ /// <summary>
+ /// Gets MotionEstimationRange.
+ /// </summary>
+ public static List<AdvancedChoice> MotionEstimationRange
+ {
+ get
+ {
+ return motionEstimationRange;
+ }
+ }
+
+ /// <summary>
+ /// Gets PyramidalBFrames.
+ /// </summary>
+ public static List<AdvancedChoice> PyramidalBFrames
+ {
+ get
+ {
+ return pyramidalBFrames;
+ }
+ }
+
+ /// <summary>
+ /// Gets ReferenceFrames.
+ /// </summary>
+ public static List<AdvancedChoice> ReferenceFrames
+ {
+ get
+ {
+ return referenceFrames;
+ }
+ }
+
+ /// <summary>
+ /// Gets SubpixelMotionEstimation.
+ /// </summary>
+ public static List<AdvancedChoice> SubpixelMotionEstimation
+ {
+ get
+ {
+ return subpixelMotionEstimation;
+ }
+ }
+
+ /// <summary>
+ /// Gets Trellis.
+ /// </summary>
+ public static List<AdvancedChoice> Trellis
+ {
+ get
+ {
+ return trellis;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ /// <summary>
+ /// The add range.
+ /// </summary>
+ /// <param name="list">
+ /// The list.
+ /// </param>
+ /// <param name="lower">
+ /// The lower.
+ /// </param>
+ /// <param name="upper">
+ /// The upper.
+ /// </param>
+ /// <param name="defaultNumber">
+ /// The default number.
+ /// </param>
+ private static void AddRange(List<AdvancedChoice> list, int lower, int upper, int defaultNumber)
+ {
+ for (int i = lower; i <= upper; i++)
+ {
+ if (i == defaultNumber)
+ {
+ list.Add(
+ new AdvancedChoice
+ {
+ IsDefault = true,
+ Label = i.ToString() + " (Default)",
+ Value = i.ToString(CultureInfo.InvariantCulture)
+ });
+ }
+ else
+ {
+ list.Add(
+ new AdvancedChoice { Label = i.ToString(), Value = i.ToString(CultureInfo.InvariantCulture) });
+ }
+ }
+ }
+
+ /// <summary>
+ /// The create number list.
+ /// </summary>
+ /// <param name="lower">
+ /// The lower.
+ /// </param>
+ /// <param name="upper">
+ /// The upper.
+ /// </param>
+ /// <param name="defaultNumber">
+ /// The default number.
+ /// </param>
+ /// <returns>
+ /// </returns>
+ private static List<AdvancedChoice> CreateNumberList(int lower, int upper, int defaultNumber)
+ {
+ var list = new List<AdvancedChoice>();
+ AddRange(list, lower, upper, defaultNumber);
+
+ return list;
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Model/AdvancedChoice.cs b/win/CS/HandBrakeWPF/Model/AdvancedChoice.cs
new file mode 100644
index 000000000..53c43f5c2
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Model/AdvancedChoice.cs
@@ -0,0 +1,32 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="AdvancedChoice.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 AdvancedChoice type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Model
+{
+ /// <summary>
+ /// Advanced Choce model for the Advanced Panel
+ /// </summary>
+ public class AdvancedChoice
+ {
+ /// <summary>
+ /// Gets or sets a value indicating whether the given choice is default.
+ /// </summary>
+ public bool IsDefault { get; set; }
+
+ /// <summary>
+ /// Gets or sets the UI label for the choice.
+ /// </summary>
+ public string Label { get; set; }
+
+ /// <summary>
+ /// Gets or sets the value on the options string for the choice.
+ /// </summary>
+ public string Value { get; set; }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
index 1a2ffcc81..10b0c5c43 100644
--- a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
+++ b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:4.0.30319.468
+// Runtime Version:4.0.30319.17020
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -22,7 +22,7 @@ namespace HandBrakeWPF.Properties {
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources {
+ public class Resources {
private static global::System.Resources.ResourceManager resourceMan;
@@ -36,7 +36,7 @@ namespace HandBrakeWPF.Properties {
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
+ public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HandBrakeWPF.Properties.Resources", typeof(Resources).Assembly);
@@ -51,7 +51,7 @@ namespace HandBrakeWPF.Properties {
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
+ public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
@@ -59,5 +59,224 @@ namespace HandBrakeWPF.Properties {
resourceCulture = value;
}
}
+
+ /// <summary>
+ /// Looks up a localized string similar to x264 has a variety of algorithms to decide when to use B-frames and how many to use.
+ ///
+ ///Fast mode takes roughly the same amount of time no matter how many B-frames you specify. However, while fast, its decisions are often suboptimal.
+ ///
+ ///Optimal mode gets slower as the maximum number of B-Frames increases, but makes much more accurate decisions, especially when used with B-pyramid..
+ /// </summary>
+ public static string Advanced_AdaptiveBFramesToolTip {
+ get {
+ return ResourceManager.GetString("Advanced_AdaptiveBFramesToolTip", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to H.264 allows for two different prediction modes, spatial and temporal, in B-frames.
+ ///
+ ///Spatial, the default, is almost always better, but temporal is sometimes useful too.
+ ///
+ ///x264 can, at the cost of a small amount of speed (and accordingly for a small compression gain), adaptively select which is better for each particular frame..
+ /// </summary>
+ public static string Advanced_AdaptiveDirectModeToolTip {
+ get {
+ return ResourceManager.GetString("Advanced_AdaptiveDirectModeToolTip", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Adaptive quantization controls how the encoder distributes bits across the frame.
+ ///Higher values take more bits away from edges and complex areas to improve areas with finer detail..
+ /// </summary>
+ public static string Advanced_AdaptiveQuantizationStrengthToolTip {
+ get {
+ return ResourceManager.GetString("Advanced_AdaptiveQuantizationStrengthToolTip", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Mode decision picks from a variety of options to make its decision: this option chooses what options those are.
+ ///Fewer partitions to check means faster encoding, at the cost of worse decisions, since the best option might have been one that was turned off..
+ /// </summary>
+ public static string Advanced_AnalysisToolTip {
+ get {
+ return ResourceManager.GetString("Advanced_AnalysisToolTip", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Sane values are ~2-5.
+ ///This specifies the maximum number of sequential B-frames that the encoder can use.
+ /// Large numbers generally won&apos;t help significantly unless Adaptive B-frames is set to Optimal.
+ ///Cel-animated source material and B-pyramid also significantly increase the usefulness of larger values.
+ ///Baseline profile, as required for iPods and similar devices, requires B-frames to be set to 0 (off)..
+ /// </summary>
+ public static string Advanced_BFramesToolTip {
+ get {
+ return ResourceManager.GetString("Advanced_BFramesToolTip", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to After the encoder has done its work, it has a bunch of data that needs to be compressed losslessly, similar to ZIP or RAR. H.264 provides two options for this: CAVLC and CABAC. CABAC decodes a lot slower but compresses significantly better (10-30%), especially at lower bitrates. If you&apos;re looking to minimize CPU requirements for video playback, disable this option. Baseline profile, as required for iPods and similar devices, requires CABAC to be disabled..
+ /// </summary>
+ public static string Advanced_CabacToolTip {
+ get {
+ return ResourceManager.GetString("Advanced_CabacToolTip", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to H.264 has a built-in deblocking filter that smooths out blocking artifacts after decoding each frame. This not only improves visual quality, but also helps compression significantly.
+ ///The deblocking filter takes a lot of CPU power, so if you&apos;re looking to minimize CPU requirements for video playback, disable it.
+ ///
+ ///The deblocking filter has two adjustable parameters, &quot;strength&quot; and &quot;threshold&quot;.
+ ///The former controls how strong (or weak) the deblocker is, while the latter controls how many (or few) edges [rest of string was truncated]&quot;;.
+ /// </summary>
+ public static string Advanced_DeblockingToolTip {
+ get {
+ return ResourceManager.GetString("Advanced_DeblockingToolTip", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The 8x8 transform is the single most useful feature of x264 in terms of compression-per-speed.
+ ///It improves compression by at least 5% at a very small speed cost and may provide an unusually high visual quality benefit compared to its compression gain.
+ ///However, it requires High Profile, which many devices may not support..
+ /// </summary>
+ public static string Advanced_EightByEightDctToolTip {
+ get {
+ return ResourceManager.GetString("Advanced_EightByEightDctToolTip", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Controls the motion estimation method. Motion estimation is how the encoder estimates how each block of pixels in a frame has moved.
+ ///A better motion search method improves compression at the cost of speed.
+ ///
+ ///Diamond: performs an extremely fast and simple search using a diamond pattern.
+ ///
+ ///Hexagon: performs a somewhat more effective but slightly slower search using a hexagon pattern.
+ ///
+ ///Uneven Multi-Hex: performs a very wide search using a variety of patterns, more accurately capturing complex motion.
+ /// /// [rest of string was truncated]&quot;;.
+ /// </summary>
+ public static string Advanced_MotionEstimationMethodToolTip {
+ get {
+ return ResourceManager.GetString("Advanced_MotionEstimationMethodToolTip", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to This is the distance x264 searches from its best guess at the motion of a block in order to try to find its actual motion.
+ ///Doesn&apos;t apply to Diamond or Hexagon search options.
+ ///The default is fine for most content, but extremely high motion video, especially at HD resolutions, may benefit from higher ranges, albeit at a high speed cost..
+ /// </summary>
+ public static string Advanced_MotionEstimationRangeToolTip {
+ get {
+ return ResourceManager.GetString("Advanced_MotionEstimationRangeToolTip", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to x264 normally zeroes out nearly-empty data blocks to save bits to be better used for some other purpose in the video.
+ ///However, this can sometimes have slight negative effects on retention of subtle grain and dither.
+ ///Don&apos;t touch this unless you&apos;re having banding issues or other such cases where you are having trouble keeping fine noise..
+ /// </summary>
+ public static string Advanced_NoDctDecimateToolTip {
+ get {
+ return ResourceManager.GetString("Advanced_NoDctDecimateToolTip", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Psychovisual Rate Distortion means x264 tries to retain detail, for better quality to the human eye,
+ ///as opposed to trying to maximize quality the way a computer understands it, through signal-to-noise ratios that have trouble telling apart fine detail and noise..
+ /// </summary>
+ public static string Advanced_PsychovisualRateDistortionToolTip {
+ get {
+ return ResourceManager.GetString("Advanced_PsychovisualRateDistortionToolTip", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Psychovisual Trellis tries to retain more sharpness and detail, but can cause artifacting.
+ ///It is considered experimental, which is why it&apos;s off by default. Good values are 0.1 to 0.2..
+ /// </summary>
+ public static string Advanced_PsychovisualTrellisToolTip {
+ get {
+ return ResourceManager.GetString("Advanced_PsychovisualTrellisToolTip", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to B-pyramid improves compression by creating a pyramidal structure (hence the name) of B-frames, allowing B-frames to
+ ///reference each other to improve compression.
+ ///
+ ///Requires Max B-frames greater than 1; optimal adaptive B-frames is strongly recommended for full compression benefit..
+ /// </summary>
+ public static string Advanced_PyramidalBFramesToolTip {
+ get {
+ return ResourceManager.GetString("Advanced_PyramidalBFramesToolTip", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Sane values are ~1-6.
+ ///
+ ///The more you add, the better the compression, but the slower the encode.
+ ///
+ ///Cel animation tends to benefit from more reference frames a lot more than film content.
+ ///
+ ///Note that many hardware devices have limitations on the number of supported reference frames, so if you&apos;re encoding for a handheld or standalone player, don&apos;t touch this unless you&apos;re absolutely sure you know what you&apos;re doing!.
+ /// </summary>
+ public static string Advanced_ReferenceFramesToolTip {
+ get {
+ return ResourceManager.GetString("Advanced_ReferenceFramesToolTip", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to This setting controls both subpixel-precision motion estimation and mode decision methods.
+ ///
+ ///Subpixel motion estimation is used for refining motion estimates beyond mere pixel accuracy, improving compression.
+ ///
+ ///Mode decision is the method used to choose how to encode each block of the frame: a very important decision.
+ ///
+ ///SAD is the fastest method, followed by SATD, RD, RD refinement, and the slowest, QPRD.
+ ///6 or higher is strongly recommended: Psy-RD, a very powerful psy optimization that helps retain det [rest of string was truncated]&quot;;.
+ /// </summary>
+ public static string Advanced_SubpixelMotionEstimationToolTip {
+ get {
+ return ResourceManager.GetString("Advanced_SubpixelMotionEstimationToolTip", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Trellis fine-tunes the rounding of transform coefficients to squeeze out 3-5% more compression at the cost of some speed.
+ ///&quot;Always&quot; uses trellis not only during the main encoding process, but also during analysis, which improves compression even more, albeit at great speed cost.
+ ///
+ ///Trellis costs more speed at higher bitrates..
+ /// </summary>
+ public static string Advanced_TrellisToolTip {
+ get {
+ return ResourceManager.GetString("Advanced_TrellisToolTip", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Performs extra analysis to decide upon weighting parameters for each frame.
+ ///This improves overall compression slightly and improves the quality of fades greatly.
+ ///Baseline profile, as required for iPods and similar devices, requires weighted P-frame prediction to be disabled.
+ ///Note that some devices and players, even those that support Main Profile,
+ ///may have problems with Weighted P-frame prediction: the Apple TV is completely incompatible with it, for example..
+ /// </summary>
+ public static string Advanced_WeightPToolTip {
+ get {
+ return ResourceManager.GetString("Advanced_WeightPToolTip", resourceCulture);
+ }
+ }
}
}
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.resx b/win/CS/HandBrakeWPF/Properties/Resources.resx
index ffecec851..a4b5f6259 100644
--- a/win/CS/HandBrakeWPF/Properties/Resources.resx
+++ b/win/CS/HandBrakeWPF/Properties/Resources.resx
@@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
- : System.Serialization.Formatters.Binary.BinaryFormatter
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@@ -60,6 +60,7 @@
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
@@ -68,9 +69,10 @@
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" />
+ <xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
@@ -85,9 +87,10 @@
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
@@ -109,9 +112,125 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
+ <data name="Advanced_AdaptiveBFramesToolTip" xml:space="preserve">
+ <value>x264 has a variety of algorithms to decide when to use B-frames and how many to use.
+
+Fast mode takes roughly the same amount of time no matter how many B-frames you specify. However, while fast, its decisions are often suboptimal.
+
+Optimal mode gets slower as the maximum number of B-Frames increases, but makes much more accurate decisions, especially when used with B-pyramid.</value>
+ </data>
+ <data name="Advanced_AdaptiveDirectModeToolTip" xml:space="preserve">
+ <value>H.264 allows for two different prediction modes, spatial and temporal, in B-frames.
+
+Spatial, the default, is almost always better, but temporal is sometimes useful too.
+
+x264 can, at the cost of a small amount of speed (and accordingly for a small compression gain), adaptively select which is better for each particular frame.</value>
+ </data>
+ <data name="Advanced_AdaptiveQuantizationStrengthToolTip" xml:space="preserve">
+ <value>Adaptive quantization controls how the encoder distributes bits across the frame.
+Higher values take more bits away from edges and complex areas to improve areas with finer detail.</value>
+ </data>
+ <data name="Advanced_AnalysisToolTip" xml:space="preserve">
+ <value>Mode decision picks from a variety of options to make its decision: this option chooses what options those are.
+Fewer partitions to check means faster encoding, at the cost of worse decisions, since the best option might have been one that was turned off.</value>
+ </data>
+ <data name="Advanced_BFramesToolTip" xml:space="preserve">
+ <value>Sane values are ~2-5.
+This specifies the maximum number of sequential B-frames that the encoder can use.
+ Large numbers generally won't help significantly unless Adaptive B-frames is set to Optimal.
+Cel-animated source material and B-pyramid also significantly increase the usefulness of larger values.
+Baseline profile, as required for iPods and similar devices, requires B-frames to be set to 0 (off).</value>
+ </data>
+ <data name="Advanced_CabacToolTip" xml:space="preserve">
+ <value>After the encoder has done its work, it has a bunch of data that needs to be compressed losslessly, similar to ZIP or RAR. H.264 provides two options for this: CAVLC and CABAC. CABAC decodes a lot slower but compresses significantly better (10-30%), especially at lower bitrates. If you're looking to minimize CPU requirements for video playback, disable this option. Baseline profile, as required for iPods and similar devices, requires CABAC to be disabled.</value>
+ </data>
+ <data name="Advanced_DeblockingToolTip" xml:space="preserve">
+ <value>H.264 has a built-in deblocking filter that smooths out blocking artifacts after decoding each frame. This not only improves visual quality, but also helps compression significantly.
+The deblocking filter takes a lot of CPU power, so if you're looking to minimize CPU requirements for video playback, disable it.
+
+The deblocking filter has two adjustable parameters, "strength" and "threshold".
+The former controls how strong (or weak) the deblocker is, while the latter controls how many (or few) edges it applies to.
+Lower values mean less deblocking, higher values mean more deblocking. The default is 0 (normal strength) for both parameters.</value>
+ </data>
+ <data name="Advanced_EightByEightDctToolTip" xml:space="preserve">
+ <value>The 8x8 transform is the single most useful feature of x264 in terms of compression-per-speed.
+It improves compression by at least 5% at a very small speed cost and may provide an unusually high visual quality benefit compared to its compression gain.
+However, it requires High Profile, which many devices may not support.</value>
+ </data>
+ <data name="Advanced_MotionEstimationMethodToolTip" xml:space="preserve">
+ <value>Controls the motion estimation method. Motion estimation is how the encoder estimates how each block of pixels in a frame has moved.
+A better motion search method improves compression at the cost of speed.
+
+Diamond: performs an extremely fast and simple search using a diamond pattern.
+
+Hexagon: performs a somewhat more effective but slightly slower search using a hexagon pattern.
+
+Uneven Multi-Hex: performs a very wide search using a variety of patterns, more accurately capturing complex motion.
+
+Exhaustive: performs a "dumb" search of every pixel in a wide area. Significantly slower for only a small compression gain.
+
+Transformed Exhaustive: Like exhaustive, but makes even more accurate decisions. Accordingly, somewhat slower, also for only a small improvement.</value>
+ </data>
+ <data name="Advanced_MotionEstimationRangeToolTip" xml:space="preserve">
+ <value>This is the distance x264 searches from its best guess at the motion of a block in order to try to find its actual motion.
+Doesn't apply to Diamond or Hexagon search options.
+The default is fine for most content, but extremely high motion video, especially at HD resolutions, may benefit from higher ranges, albeit at a high speed cost.</value>
+ </data>
+ <data name="Advanced_NoDctDecimateToolTip" xml:space="preserve">
+ <value>x264 normally zeroes out nearly-empty data blocks to save bits to be better used for some other purpose in the video.
+However, this can sometimes have slight negative effects on retention of subtle grain and dither.
+Don't touch this unless you're having banding issues or other such cases where you are having trouble keeping fine noise.</value>
+ </data>
+ <data name="Advanced_PsychovisualRateDistortionToolTip" xml:space="preserve">
+ <value>Psychovisual Rate Distortion means x264 tries to retain detail, for better quality to the human eye,
+as opposed to trying to maximize quality the way a computer understands it, through signal-to-noise ratios that have trouble telling apart fine detail and noise.</value>
+ </data>
+ <data name="Advanced_PsychovisualTrellisToolTip" xml:space="preserve">
+ <value>Psychovisual Trellis tries to retain more sharpness and detail, but can cause artifacting.
+It is considered experimental, which is why it's off by default. Good values are 0.1 to 0.2.</value>
+ </data>
+ <data name="Advanced_PyramidalBFramesToolTip" xml:space="preserve">
+ <value>B-pyramid improves compression by creating a pyramidal structure (hence the name) of B-frames, allowing B-frames to
+reference each other to improve compression.
+
+Requires Max B-frames greater than 1; optimal adaptive B-frames is strongly recommended for full compression benefit.</value>
+ </data>
+ <data name="Advanced_ReferenceFramesToolTip" xml:space="preserve">
+ <value>Sane values are ~1-6.
+
+The more you add, the better the compression, but the slower the encode.
+
+Cel animation tends to benefit from more reference frames a lot more than film content.
+
+Note that many hardware devices have limitations on the number of supported reference frames, so if you're encoding for a handheld or standalone player, don't touch this unless you're absolutely sure you know what you're doing!</value>
+ </data>
+ <data name="Advanced_SubpixelMotionEstimationToolTip" xml:space="preserve">
+ <value>This setting controls both subpixel-precision motion estimation and mode decision methods.
+
+Subpixel motion estimation is used for refining motion estimates beyond mere pixel accuracy, improving compression.
+
+Mode decision is the method used to choose how to encode each block of the frame: a very important decision.
+
+SAD is the fastest method, followed by SATD, RD, RD refinement, and the slowest, QPRD.
+6 or higher is strongly recommended: Psy-RD, a very powerful psy optimization that helps retain detail, requires RD.
+10, the most powerful and slowest option, requires trellis=2.</value>
+ </data>
+ <data name="Advanced_TrellisToolTip" xml:space="preserve">
+ <value>Trellis fine-tunes the rounding of transform coefficients to squeeze out 3-5% more compression at the cost of some speed.
+"Always" uses trellis not only during the main encoding process, but also during analysis, which improves compression even more, albeit at great speed cost.
+
+Trellis costs more speed at higher bitrates.</value>
+ </data>
+ <data name="Advanced_WeightPToolTip" xml:space="preserve">
+ <value>Performs extra analysis to decide upon weighting parameters for each frame.
+This improves overall compression slightly and improves the quality of fades greatly.
+Baseline profile, as required for iPods and similar devices, requires weighted P-frame prediction to be disabled.
+Note that some devices and players, even those that support Main Profile,
+may have problems with Weighted P-frame prediction: the Apple TV is completely incompatible with it, for example.</value>
+ </data>
</root> \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs
index cd1904cb3..0d65ff5be 100644
--- a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs
@@ -9,18 +9,21 @@
namespace HandBrakeWPF.ViewModels
{
+ using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
+ using System.Globalization;
+ using System.Linq;
using Caliburn.Micro;
- using HandBrake.ApplicationServices.Functions;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Parsing;
using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.Interop.Model.Encoding;
- using HandBrake.Interop.Model.Encoding.x264;
+ using HandBrakeWPF.Helpers;
+ using HandBrakeWPF.Model;
using HandBrakeWPF.ViewModels.Interfaces;
/// <summary>
@@ -32,9 +35,129 @@ namespace HandBrakeWPF.ViewModels
#region Constants and Fields
/// <summary>
- /// Backing field used to display / hide the x264 options
+ /// Backing field for displaying x264 options
/// </summary>
- private bool displayX264Options;
+ private bool? displayX264Options;
+
+ /// <summary>
+ /// The adaptive b frames.
+ /// </summary>
+ private AdvancedChoice adaptiveBFrames;
+
+ /// <summary>
+ /// The adaptive quantization strength.
+ /// </summary>
+ private double adaptiveQuantizationStrength;
+
+ /// <summary>
+ /// The analysis.
+ /// </summary>
+ private AdvancedChoice analysis;
+
+ /// <summary>
+ /// The b frames.
+ /// </summary>
+ private AdvancedChoice bFrames;
+
+ /// <summary>
+ /// The cabac entropy coding.
+ /// </summary>
+ private bool cabacEntropyCoding;
+
+ /// <summary>
+ /// The deblocking strength.
+ /// </summary>
+ private AdvancedChoice deblockingStrength;
+
+ /// <summary>
+ /// The deblocking threshold.
+ /// </summary>
+ private AdvancedChoice deblockingThreshold;
+
+ /// <summary>
+ /// The direct prediction.
+ /// </summary>
+ private AdvancedChoice directPrediction;
+
+ /// <summary>
+ /// The eight by eight dct.
+ /// </summary>
+ private bool eightByEightDct;
+
+ /// <summary>
+ /// The motion estimation method.
+ /// </summary>
+ private AdvancedChoice motionEstimationMethod;
+
+ /// <summary>
+ /// The motion estimation range.
+ /// </summary>
+ private AdvancedChoice motionEstimationRange;
+
+ /// <summary>
+ /// The no dct decimate.
+ /// </summary>
+ private bool noDctDecimate;
+
+ /// <summary>
+ /// The psychovisual rate distortion.
+ /// </summary>
+ private double psychovisualRateDistortion;
+
+ /// <summary>
+ /// The psychovisual trellis.
+ /// </summary>
+ private double psychovisualTrellis;
+
+ /// <summary>
+ /// The pyramidal b frames.
+ /// </summary>
+ private AdvancedChoice pyramidalBFrames;
+
+ /// <summary>
+ /// The reference frames.
+ /// </summary>
+ private AdvancedChoice referenceFrames;
+
+ /// <summary>
+ /// The subpixel motion estimation.
+ /// </summary>
+ private AdvancedChoice subpixelMotionEstimation;
+
+ /// <summary>
+ /// The trellis.
+ /// </summary>
+ private AdvancedChoice trellis;
+
+ /// <summary>
+ /// X264 options that have UI elements that correspond to them.
+ /// </summary>
+ private HashSet<string> uiOptions = new HashSet<string>
+ {
+ "ref",
+ "bframes",
+ "b-adapt",
+ "direct",
+ "weightp",
+ "b-pyramid",
+ "me",
+ "subme",
+ "subq",
+ "merange",
+ "analyse",
+ "8x8dct",
+ "cabac",
+ "trellis",
+ "aq-strength",
+ "psy-rd",
+ "no-dct-decimate",
+ "deblock"
+ };
+
+ /// <summary>
+ /// The weighted p frames.
+ /// </summary>
+ private bool weightedPFrames;
#endregion
@@ -52,112 +175,458 @@ namespace HandBrakeWPF.ViewModels
public AdvancedViewModel(IWindowManager windowManager, IUserSettingService userSettingService)
{
this.Task = new EncodeTask();
- X264Presets = EnumHelper<x264Preset>.GetEnumList();
- X264Profiles = EnumHelper<x264Profile>.GetEnumList();
- X264Tunes = EnumHelper<x264Tune>.GetEnumList();
+ this.UpdateUIFromAdvancedOptions();
}
#endregion
- #region Public Properties
+ #region Properties
/// <summary>
- /// Gets or sets Task.
+ /// Gets or sets a value indicating whether DisplayX264Options.
/// </summary>
- public EncodeTask Task { get; set; }
+ public bool? DisplayX264Options
+ {
+ get
+ {
+ return this.displayX264Options;
+ }
+ set
+ {
+ this.displayX264Options = value;
+ this.NotifyOfPropertyChange(() => this.DisplayX264Options);
+ }
+ }
/// <summary>
- /// Gets or sets State.
+ /// Gets or sets AdaptiveBFrames.
/// </summary>
- public string Query
+ public AdvancedChoice AdaptiveBFrames
+ {
+ get
+ {
+ return this.adaptiveBFrames;
+ }
+
+ set
+ {
+ this.adaptiveBFrames = value;
+ this.NotifyOfPropertyChange(() => this.AdaptiveBFrames);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets AdaptiveQuantizationStrength.
+ /// </summary>
+ public double AdaptiveQuantizationStrength
+ {
+ get
+ {
+ return this.adaptiveQuantizationStrength;
+ }
+
+ set
+ {
+ this.adaptiveQuantizationStrength = value;
+ this.NotifyOfPropertyChange(() => this.AdaptiveQuantizationStrength);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets AdvancedOptionsString.
+ /// </summary>
+ public string AdvancedOptionsString
{
get
{
return this.Task.AdvancedEncoderOptions;
}
+
set
{
this.Task.AdvancedEncoderOptions = value;
- this.NotifyOfPropertyChange(() => this.Query);
+ this.UpdateUIFromAdvancedOptions();
+ this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets Analysis.
+ /// </summary>
+ public AdvancedChoice Analysis
+ {
+ get
+ {
+ return this.analysis;
+ }
+
+ set
+ {
+ this.analysis = value;
+ this.NotifyOfPropertyChange(() => this.Analysis);
+ this.NotifyOfPropertyChange(() => this.EightByEightDctVisible);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether AutomaticChange.
+ /// </summary>
+ public bool AutomaticChange { get; set; }
+
+ /// <summary>
+ /// Gets or sets BFrames.
+ /// </summary>
+ public AdvancedChoice BFrames
+ {
+ get
+ {
+ return this.bFrames;
+ }
+
+ set
+ {
+ this.bFrames = value;
+ this.NotifyOfPropertyChange(() => this.BFrames);
+ this.NotifyOfPropertyChange(() => this.BFramesOptionsVisible);
+ this.NotifyOfPropertyChange(() => this.PyramidalBFramesVisible);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether BFramesOptionsVisible.
+ /// </summary>
+ public bool BFramesOptionsVisible
+ {
+ get
+ {
+ return this.BFrames.Value != "0";
}
}
/// <summary>
- /// Gets or sets X264Preset.
+ /// Gets or sets a value indicating whether CabacEntropyCoding.
/// </summary>
- public x264Preset X264Preset
+ public bool CabacEntropyCoding
{
get
{
- return this.Task.x264Preset;
+ return this.cabacEntropyCoding;
}
+
set
{
- this.Task.x264Preset = value;
- this.NotifyOfPropertyChange(() => this.X264Preset);
+ this.cabacEntropyCoding = value;
+ this.NotifyOfPropertyChange(() => this.CabacEntropyCoding);
+ this.NotifyOfPropertyChange(() => this.PsychovisualTrellisVisible);
+ this.UpdateOptionsString();
}
}
/// <summary>
- /// Gets or sets X264Profile.
+ /// Gets or sets DeblockingStrength.
/// </summary>
- public x264Profile X264Profile
+ public AdvancedChoice DeblockingStrength
{
get
{
- return this.Task.x264Profile;
+ return this.deblockingStrength;
}
+
set
{
- this.Task.x264Profile = value;
- this.NotifyOfPropertyChange(() => this.X264Profile);
+ this.deblockingStrength = value;
+ this.NotifyOfPropertyChange(() => this.DeblockingStrength);
+ this.UpdateOptionsString();
}
}
/// <summary>
- /// Gets or sets X264Tune.
+ /// Gets or sets DeblockingThreshold.
/// </summary>
- public x264Tune X264Tune
+ public AdvancedChoice DeblockingThreshold
{
get
{
- return this.Task.X264Tune;
+ return this.deblockingThreshold;
}
+
set
{
- this.Task.X264Tune = value;
- this.NotifyOfPropertyChange(() => this.X264Tune);
+ this.deblockingThreshold = value;
+ this.NotifyOfPropertyChange(() => this.DeblockingThreshold);
+ this.UpdateOptionsString();
}
}
/// <summary>
- /// Gets or sets X264Presets.
+ /// Gets or sets DirectPrediction.
/// </summary>
- public IEnumerable<x264Preset> X264Presets { get; set; }
+ public AdvancedChoice DirectPrediction
+ {
+ get
+ {
+ return this.directPrediction;
+ }
+
+ set
+ {
+ this.directPrediction = value;
+ this.NotifyOfPropertyChange(() => this.DirectPrediction);
+ this.UpdateOptionsString();
+ }
+ }
/// <summary>
- /// Gets or sets X264Profiles.
+ /// Gets or sets a value indicating whether EightByEightDct.
/// </summary>
- public IEnumerable<x264Profile> X264Profiles { get; set; }
+ public bool EightByEightDct
+ {
+ get
+ {
+ return this.eightByEightDct;
+ }
+
+ set
+ {
+ this.eightByEightDct = value;
+ this.NotifyOfPropertyChange(() => this.EightByEightDct);
+ this.UpdateOptionsString();
+ }
+ }
/// <summary>
- /// Gets or sets X264Tunes.
+ /// Gets a value indicating whether EightByEightDctVisible.
/// </summary>
- public IEnumerable<x264Tune> X264Tunes { get; set; }
+ public bool EightByEightDctVisible
+ {
+ get
+ {
+ return this.Analysis.Value != "none";
+ }
+ }
/// <summary>
- /// Gets or sets a value indicating whether DisplayX264Options.
+ /// Gets or sets MotionEstimationMethod.
/// </summary>
- public bool DisplayX264Options
+ public AdvancedChoice MotionEstimationMethod
{
get
{
- return this.displayX264Options;
+ return this.motionEstimationMethod;
}
+
set
{
- this.displayX264Options = value;
- this.NotifyOfPropertyChange(() => this.DisplayX264Options);
+ this.motionEstimationMethod = value;
+ this.NotifyOfPropertyChange(() => this.MotionEstimationMethod);
+ this.NotifyOfPropertyChange(() => this.MotionEstimationRangeVisible);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets MotionEstimationRange.
+ /// </summary>
+ public AdvancedChoice MotionEstimationRange
+ {
+ get
+ {
+ return this.motionEstimationRange;
+ }
+
+ set
+ {
+ this.motionEstimationRange = value;
+ this.NotifyOfPropertyChange(() => this.MotionEstimationRange);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether MotionEstimationRangeVisible.
+ /// </summary>
+ public bool MotionEstimationRangeVisible
+ {
+ get
+ {
+ string motionMethod = this.MotionEstimationMethod.Value;
+ return motionMethod == "umh" || motionMethod == "esa" || motionMethod == "tesa";
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether NoDctDecimate.
+ /// </summary>
+ public bool NoDctDecimate
+ {
+ get
+ {
+ return this.noDctDecimate;
+ }
+
+ set
+ {
+ this.noDctDecimate = value;
+ this.NotifyOfPropertyChange(() => this.NoDctDecimate);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets PsychovisualRateDistortion.
+ /// </summary>
+ public double PsychovisualRateDistortion
+ {
+ get
+ {
+ return this.psychovisualRateDistortion;
+ }
+
+ set
+ {
+ this.psychovisualRateDistortion = value;
+ this.NotifyOfPropertyChange(() => this.PsychovisualRateDistortion);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets PsychovisualTrellis.
+ /// </summary>
+ public double PsychovisualTrellis
+ {
+ get
+ {
+ return this.psychovisualTrellis;
+ }
+
+ set
+ {
+ this.psychovisualTrellis = value;
+ this.NotifyOfPropertyChange(() => this.PsychovisualTrellis);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether PsychovisualTrellisVisible.
+ /// </summary>
+ public bool PsychovisualTrellisVisible
+ {
+ get
+ {
+ return this.CabacEntropyCoding && this.Trellis.Value != "0";
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets PyramidalBFrames.
+ /// </summary>
+ public AdvancedChoice PyramidalBFrames
+ {
+ get
+ {
+ return this.pyramidalBFrames;
+ }
+
+ set
+ {
+ this.pyramidalBFrames = value;
+ this.NotifyOfPropertyChange(() => this.PyramidalBFrames);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether PyramidalBFramesVisible.
+ /// </summary>
+ public bool PyramidalBFramesVisible
+ {
+ get
+ {
+ return int.Parse(this.BFrames.Value) > 1;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets ReferenceFrames.
+ /// </summary>
+ public AdvancedChoice ReferenceFrames
+ {
+ get
+ {
+ return this.referenceFrames;
+ }
+
+ set
+ {
+ this.referenceFrames = value;
+ this.NotifyOfPropertyChange(() => this.ReferenceFrames);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets SubpixelMotionEstimation.
+ /// </summary>
+ public AdvancedChoice SubpixelMotionEstimation
+ {
+ get
+ {
+ return this.subpixelMotionEstimation;
+ }
+
+ set
+ {
+ this.subpixelMotionEstimation = value;
+ this.NotifyOfPropertyChange(() => this.SubpixelMotionEstimation);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets Task.
+ /// </summary>
+ public EncodeTask Task { get; set; }
+
+ /// <summary>
+ /// Gets or sets Trellis.
+ /// </summary>
+ public AdvancedChoice Trellis
+ {
+ get
+ {
+ return this.trellis;
+ }
+
+ set
+ {
+ this.trellis = value;
+ this.NotifyOfPropertyChange(() => this.Trellis);
+ this.NotifyOfPropertyChange(() => this.PsychovisualTrellisVisible);
+ this.UpdateOptionsString();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether WeightedPFrames.
+ /// </summary>
+ public bool WeightedPFrames
+ {
+ get
+ {
+ return this.weightedPFrames;
+ }
+
+ set
+ {
+ this.weightedPFrames = value;
+ this.NotifyOfPropertyChange(() => this.WeightedPFrames);
+ this.UpdateOptionsString();
}
}
@@ -166,56 +635,499 @@ namespace HandBrakeWPF.ViewModels
#region Public Methods
/// <summary>
- /// Setup this window for a new source
+ /// The notify all changed.
/// </summary>
- /// <param name="title">
- /// The title.
+ public void NotifyAllChanged()
+ {
+ this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);
+ }
+
+ /// <summary>
+ /// The update ui from advanced options.
+ /// </summary>
+ public void UpdateUIFromAdvancedOptions()
+ {
+ this.AutomaticChange = true;
+
+ // Reset UI to defaults, and re-apply options.
+ this.SetAdvancedToDefaults();
+
+ if (this.Task.AdvancedEncoderOptions == null)
+ {
+ this.AutomaticChange = false;
+ return;
+ }
+
+ // Check the updated options string. Update UI for any recognized options.
+ string[] newOptionsSegments = this.Task.AdvancedEncoderOptions.Split(':');
+ foreach (string newOptionsSegment in newOptionsSegments)
+ {
+ int equalsIndex = newOptionsSegment.IndexOf('=');
+ if (equalsIndex >= 0)
+ {
+ string optionName = newOptionsSegment.Substring(0, equalsIndex);
+ string optionValue = newOptionsSegment.Substring(equalsIndex + 1);
+
+ if (optionName != string.Empty && optionValue != string.Empty)
+ {
+ AdvancedChoice newChoice;
+ int parseInt;
+ double parseDouble;
+ string[] subParts;
+
+ switch (optionName)
+ {
+ case "ref":
+ if (int.TryParse(optionValue, out parseInt))
+ {
+ newChoice =
+ AdvancedChoicesHelper.ReferenceFrames.SingleOrDefault(
+ choice => choice.Value == parseInt.ToString(CultureInfo.InvariantCulture));
+ if (newChoice != null)
+ {
+ this.ReferenceFrames = newChoice;
+ }
+ }
+
+ break;
+ case "bframes":
+ if (int.TryParse(optionValue, out parseInt))
+ {
+ newChoice =
+ AdvancedChoicesHelper.BFrames.SingleOrDefault(
+ choice => choice.Value == parseInt.ToString(CultureInfo.InvariantCulture));
+ if (newChoice != null)
+ {
+ this.BFrames = newChoice;
+ }
+ }
+
+ break;
+ case "b-adapt":
+ newChoice =
+ AdvancedChoicesHelper.AdaptiveBFrames.SingleOrDefault(
+ choice => choice.Value == optionValue);
+ if (newChoice != null)
+ {
+ this.AdaptiveBFrames = newChoice;
+ }
+
+ break;
+ case "direct":
+ newChoice =
+ AdvancedChoicesHelper.DirectPrediction.SingleOrDefault(
+ choice => choice.Value == optionValue);
+ if (newChoice != null)
+ {
+ this.DirectPrediction = newChoice;
+ }
+
+ break;
+ case "weightp":
+ if (optionValue == "0")
+ {
+ this.WeightedPFrames = false;
+ }
+ else if (optionValue == "1")
+ {
+ this.WeightedPFrames = true;
+ }
+
+ break;
+ case "b-pyramid":
+ newChoice =
+ AdvancedChoicesHelper.PyramidalBFrames.SingleOrDefault(
+ choice => choice.Value == optionValue);
+ if (newChoice != null)
+ {
+ this.PyramidalBFrames = newChoice;
+ }
+
+ break;
+ case "me":
+ newChoice =
+ AdvancedChoicesHelper.MotionEstimationMethod.SingleOrDefault(
+ choice => choice.Value == optionValue);
+ if (newChoice != null)
+ {
+ this.MotionEstimationMethod = newChoice;
+ }
+
+ break;
+ case "subme":
+ case "subq":
+ if (int.TryParse(optionValue, out parseInt))
+ {
+ newChoice =
+ AdvancedChoicesHelper.SubpixelMotionEstimation.SingleOrDefault(
+ choice => choice.Value == parseInt.ToString(CultureInfo.InvariantCulture));
+ if (newChoice != null)
+ {
+ this.SubpixelMotionEstimation = newChoice;
+ }
+ }
+
+ break;
+ case "merange":
+ if (int.TryParse(optionValue, out parseInt))
+ {
+ newChoice =
+ AdvancedChoicesHelper.MotionEstimationRange.SingleOrDefault(
+ choice => choice.Value == parseInt.ToString(CultureInfo.InvariantCulture));
+ if (newChoice != null)
+ {
+ this.MotionEstimationRange = newChoice;
+ }
+ }
+
+ break;
+ case "analyse":
+ newChoice =
+ AdvancedChoicesHelper.Analysis.SingleOrDefault(
+ choice => choice.Value == optionValue);
+ if (newChoice != null)
+ {
+ this.Analysis = newChoice;
+ }
+
+ break;
+ case "8x8dct":
+ if (optionValue == "0")
+ {
+ this.EightByEightDct = false;
+ }
+ else if (optionValue == "1")
+ {
+ this.EightByEightDct = true;
+ }
+
+ break;
+ case "cabac":
+ if (optionValue == "0")
+ {
+ this.CabacEntropyCoding = false;
+ }
+ else if (optionValue == "1")
+ {
+ this.CabacEntropyCoding = true;
+ }
+
+ break;
+ case "trellis":
+ if (int.TryParse(optionValue, out parseInt))
+ {
+ newChoice =
+ AdvancedChoicesHelper.Trellis.SingleOrDefault(
+ choice => choice.Value == parseInt.ToString(CultureInfo.InvariantCulture));
+ if (newChoice != null)
+ {
+ this.Trellis = newChoice;
+ }
+ }
+
+ break;
+ case "aq-strength":
+ if (double.TryParse(optionValue, out parseDouble) && parseDouble >= 0.0 &&
+ parseDouble <= 2.0)
+ {
+ this.AdaptiveQuantizationStrength = Math.Round(parseDouble, 1);
+ }
+
+ break;
+ case "psy-rd":
+ subParts = optionValue.Split(',');
+ if (subParts.Length == 2)
+ {
+ double psyRD, psyTrellis;
+ if (double.TryParse(subParts[0], out psyRD) &&
+ double.TryParse(subParts[1], out psyTrellis))
+ {
+ if (psyRD >= 0.0 && psyRD <= 2.0 && psyTrellis >= 0.0 && psyTrellis <= 1.0)
+ {
+ this.PsychovisualRateDistortion = Math.Round(psyRD, 1);
+ this.PsychovisualTrellis = Math.Round(psyTrellis, 2);
+ }
+ }
+ }
+
+ break;
+ case "no-dct-decimate":
+ if (optionValue == "0")
+ {
+ this.NoDctDecimate = false;
+ }
+ else if (optionValue == "1")
+ {
+ this.NoDctDecimate = true;
+ }
+
+ break;
+ case "deblock":
+ subParts = optionValue.Split(',');
+ if (subParts.Length == 2)
+ {
+ int dbStrength, dbThreshold;
+ if (int.TryParse(subParts[0], out dbStrength) &&
+ int.TryParse(subParts[1], out dbThreshold))
+ {
+ newChoice =
+ AdvancedChoicesHelper.DeblockingStrength.SingleOrDefault(
+ choice => choice.Value == subParts[0]);
+ if (newChoice != null)
+ {
+ this.DeblockingStrength = newChoice;
+ }
+
+ newChoice =
+ AdvancedChoicesHelper.DeblockingThreshold.SingleOrDefault(
+ choice => choice.Value == subParts[1]);
+ if (newChoice != null)
+ {
+ this.DeblockingThreshold = newChoice;
+ }
+ }
+ }
+
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+
+ this.AutomaticChange = false;
+ }
+
+ #endregion
+
+ #region Implemented Interfaces
+
+ #region IAdvancedViewModel
+
+ /// <summary>
+ /// The set encoder.
+ /// </summary>
+ /// <param name="encoder">
+ /// The encoder.
/// </param>
+ public void SetEncoder(VideoEncoder encoder)
+ {
+ this.DisplayX264Options = encoder == VideoEncoder.X264;
+ if (encoder == VideoEncoder.Theora)
+ {
+ this.DisplayX264Options = null;
+ }
+ }
+
+ #endregion
+
+ #region ITabInterface
+
+ /// <summary>
+ /// Setup this tab for the specified preset.
+ /// </summary>
/// <param name="preset">
/// The preset.
/// </param>
/// <param name="task">
/// The task.
/// </param>
- public void SetSource(Title title, Preset preset, EncodeTask task)
+ public void SetPreset(Preset preset, EncodeTask task)
{
this.Task = task;
- this.NotifyOfPropertyChange(() => this.Task);
+ this.AdvancedOptionsString = preset.Task.AdvancedEncoderOptions;
}
/// <summary>
- /// Setup this tab for the specified preset.
+ /// Setup this window for a new source
/// </summary>
+ /// <param name="title">
+ /// The title.
+ /// </param>
/// <param name="preset">
/// The preset.
/// </param>
/// <param name="task">
/// The task.
/// </param>
- public void SetPreset(Preset preset, EncodeTask task)
+ public void SetSource(Title title, Preset preset, EncodeTask task)
{
this.Task = task;
- this.NotifyOfPropertyChange(() => this.Task);
- if (preset != null && preset.Task != null)
- {
- this.Query = preset.Task.AdvancedEncoderOptions;
- this.SetEncoder(preset.Task.VideoEncoder);
+ this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);
+ }
- this.X264Preset = preset.Task.x264Preset;
- this.X264Profile = preset.Task.x264Profile;
- this.X264Tune = preset.Task.X264Tune;
- }
+ #endregion
+
+ #endregion
+
+ #region Methods
+
+ /// <summary>
+ /// The set advanced to defaults.
+ /// </summary>
+ private void SetAdvancedToDefaults()
+ {
+ this.ReferenceFrames = AdvancedChoicesHelper.ReferenceFrames.SingleOrDefault(choice => choice.IsDefault);
+ this.BFrames = AdvancedChoicesHelper.BFrames.SingleOrDefault(choice => choice.IsDefault);
+ this.AdaptiveBFrames = AdvancedChoicesHelper.AdaptiveBFrames.SingleOrDefault(choice => choice.IsDefault);
+ this.DirectPrediction = AdvancedChoicesHelper.DirectPrediction.SingleOrDefault(choice => choice.IsDefault);
+ this.WeightedPFrames = true;
+ this.PyramidalBFrames = AdvancedChoicesHelper.PyramidalBFrames.SingleOrDefault(choice => choice.IsDefault);
+ this.MotionEstimationMethod =
+ AdvancedChoicesHelper.MotionEstimationMethod.SingleOrDefault(choice => choice.IsDefault);
+ this.SubpixelMotionEstimation =
+ AdvancedChoicesHelper.SubpixelMotionEstimation.SingleOrDefault(choice => choice.IsDefault);
+ this.MotionEstimationRange =
+ AdvancedChoicesHelper.MotionEstimationRange.SingleOrDefault(choice => choice.IsDefault);
+ this.Analysis = AdvancedChoicesHelper.Analysis.SingleOrDefault(choice => choice.IsDefault);
+ this.EightByEightDct = true;
+ this.CabacEntropyCoding = true;
+ this.Trellis = AdvancedChoicesHelper.Trellis.SingleOrDefault(choice => choice.IsDefault);
+ this.AdaptiveQuantizationStrength = 1.0;
+ this.PsychovisualRateDistortion = 1.0;
+ this.PsychovisualTrellis = 0.0;
+ this.DeblockingStrength =
+ AdvancedChoicesHelper.DeblockingStrength.SingleOrDefault(choice => choice.IsDefault);
+ this.DeblockingThreshold =
+ AdvancedChoicesHelper.DeblockingThreshold.SingleOrDefault(choice => choice.IsDefault);
+ this.NoDctDecimate = false;
}
/// <summary>
- /// Set the currently selected encoder.
+ /// Update the x264 options string from a UI change.
/// </summary>
- /// <param name="encoder">
- /// The Video Encoder.
- /// </param>
- public void SetEncoder(VideoEncoder encoder)
+ private void UpdateOptionsString()
{
- this.DisplayX264Options = encoder == VideoEncoder.X264;
+ if (this.AutomaticChange)
+ {
+ return;
+ }
+
+ List<string> newOptions = new List<string>();
+
+ // First add any parts of the options string that don't correspond to the UI
+ if (this.AdvancedOptionsString != null)
+ {
+ string[] existingSegments = this.AdvancedOptionsString.Split(':');
+ foreach (string existingSegment in existingSegments)
+ {
+ string optionName = existingSegment;
+ int equalsIndex = existingSegment.IndexOf('=');
+ if (equalsIndex >= 0)
+ {
+ optionName = existingSegment.Substring(0, existingSegment.IndexOf("="));
+ }
+
+ if (!this.uiOptions.Contains(optionName) && optionName != string.Empty)
+ {
+ newOptions.Add(existingSegment);
+ }
+ }
+ }
+
+ // Now add everything from the UI
+ if (!this.ReferenceFrames.IsDefault)
+ {
+ newOptions.Add("ref=" + this.ReferenceFrames.Value);
+ }
+
+ if (!this.BFrames.IsDefault)
+ {
+ newOptions.Add("bframes=" + this.BFrames.Value);
+ }
+
+ if (this.BFrames.Value != "0")
+ {
+ if (!this.AdaptiveBFrames.IsDefault)
+ {
+ newOptions.Add("b-adapt=" + this.AdaptiveBFrames.Value);
+ }
+
+ if (!this.DirectPrediction.IsDefault)
+ {
+ newOptions.Add("direct=" + this.DirectPrediction.Value);
+ }
+
+ if (this.BFrames.Value != "1" && !this.PyramidalBFrames.IsDefault)
+ {
+ newOptions.Add("b-pyramid=" + this.PyramidalBFrames.Value);
+ }
+ }
+
+ if (!this.WeightedPFrames)
+ {
+ newOptions.Add("weightp=0");
+ }
+
+ if (!this.MotionEstimationMethod.IsDefault)
+ {
+ newOptions.Add("me=" + this.MotionEstimationMethod.Value);
+ }
+
+ if (!this.SubpixelMotionEstimation.IsDefault)
+ {
+ newOptions.Add("subme=" + this.SubpixelMotionEstimation.Value);
+ }
+
+ string motionEstimation = this.MotionEstimationMethod.Value;
+ if ((motionEstimation == "umh" || motionEstimation == "esa" || motionEstimation == "tesa") &&
+ !this.MotionEstimationRange.IsDefault)
+ {
+ newOptions.Add("merange=" + this.MotionEstimationRange.Value);
+ }
+
+ if (!this.Analysis.IsDefault)
+ {
+ newOptions.Add("analyse=" + this.Analysis.Value);
+ }
+
+ if (this.Analysis.Value != "none" && !this.EightByEightDct)
+ {
+ newOptions.Add("8x8dct=0");
+ }
+
+ if (!this.CabacEntropyCoding)
+ {
+ newOptions.Add("cabac=0");
+ }
+
+ if (!this.Trellis.IsDefault)
+ {
+ newOptions.Add("trellis=" + this.Trellis.Value);
+ }
+
+ double psTrellis = 0.0;
+ if (this.CabacEntropyCoding && this.Trellis.Value != "0")
+ {
+ psTrellis = this.PsychovisualTrellis;
+ }
+
+ if (this.AdaptiveQuantizationStrength != 1.0)
+ {
+ newOptions.Add(
+ "aq-strength=" + this.AdaptiveQuantizationStrength.ToString("F1", CultureInfo.InvariantCulture));
+ }
+
+ if (this.PsychovisualRateDistortion != 1.0 || psTrellis > 0.0)
+ {
+ newOptions.Add(
+ "psy-rd=" + this.PsychovisualRateDistortion.ToString("F1", CultureInfo.InvariantCulture) + "," +
+ psTrellis.ToString("F2", CultureInfo.InvariantCulture));
+ }
+
+ if (this.NoDctDecimate)
+ {
+ newOptions.Add("no-dct-decimate=1");
+ }
+
+ if (!this.DeblockingStrength.IsDefault || !this.DeblockingThreshold.IsDefault)
+ {
+ newOptions.Add("deblock=" + this.DeblockingStrength.Value + "," + this.DeblockingThreshold.Value);
+ }
+
+ this.Task.AdvancedEncoderOptions = string.Join(":", newOptions);
+ this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);
}
#endregion
diff --git a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs
index 6a2e64ac8..634068142 100644
--- a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs
@@ -224,6 +224,7 @@ namespace HandBrakeWPF.ViewModels
public void SetPreset(Preset preset, EncodeTask task)
{
this.Task = task;
+ this.Task.IncludeChapterMarkers = preset.Task.IncludeChapterMarkers;
this.NotifyOfPropertyChange(() => this.Task);
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs
index 3be51ec05..a67bc293e 100644
--- a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs
@@ -227,6 +227,7 @@ namespace HandBrakeWPF.ViewModels
/// </param>
public void SetPreset(Preset preset, EncodeTask task)
{
+ // Note, We don't support Subtitles in presets yet.
this.Task = task;
this.NotifyOfPropertyChange(() => this.Task);
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs
index 358ebcbf5..7f7520dc4 100644
--- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs
@@ -22,6 +22,7 @@ namespace HandBrakeWPF.ViewModels
using HandBrake.ApplicationServices.Parsing;
using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.Interop.Model.Encoding;
+ using HandBrake.Interop.Model.Encoding.x264;
using HandBrakeWPF.ViewModels.Interfaces;
@@ -38,6 +39,11 @@ namespace HandBrakeWPF.ViewModels
private IUserSettingService userSettingService;
/// <summary>
+ /// Backing field used to display / hide the x264 options
+ /// </summary>
+ private bool displayX264Options;
+
+ /// <summary>
/// The quality max.
/// </summary>
private int qualityMax;
@@ -78,6 +84,10 @@ namespace HandBrakeWPF.ViewModels
this.QualityMax = 51;
this.IsConstantQuantity = true;
this.VideoEncoders = EnumHelper<VideoEncoder>.GetEnumList();
+
+ //X264Presets = EnumHelper<x264Preset>.GetEnumList();
+ //X264Profiles = EnumHelper<x264Profile>.GetEnumList();
+ //X264Tunes = EnumHelper<x264Tune>.GetEnumList();
}
#endregion
@@ -432,8 +442,127 @@ namespace HandBrakeWPF.ViewModels
this.Task.VideoBitrate = preset.Task.VideoBitrate;
this.NotifyOfPropertyChange(() => this.Task);
+
+ //if (preset != null && preset.Task != null)
+ //{
+ // this.Query = preset.Task.AdvancedEncoderOptions;
+ // this.SetEncoder(preset.Task.VideoEncoder);
+
+ // this.X264Preset = preset.Task.x264Preset;
+ // this.X264Profile = preset.Task.x264Profile;
+ // this.X264Tune = preset.Task.X264Tune;
+ //}
+
}
+ /// <summary>
+ /// Set the currently selected encoder.
+ /// </summary>
+ /// <param name="encoder">
+ /// The Video Encoder.
+ /// </param>
+ public void SetEncoder(VideoEncoder encoder)
+ {
+ //this.DisplayX264Options = encoder == VideoEncoder.X264;
+ }
+
+ #endregion
+
+ #region Advanced
+ ///// <summary>
+ ///// Gets or sets State.
+ ///// </summary>
+ //public string Query
+ //{
+ // get
+ // {
+ // return this.Task.AdvancedEncoderOptions;
+ // }
+ // set
+ // {
+ // this.Task.AdvancedEncoderOptions = value;
+ // this.NotifyOfPropertyChange(() => this.Query);
+ // }
+ //}
+
+ ///// <summary>
+ ///// Gets or sets X264Preset.
+ ///// </summary>
+ //public x264Preset X264Preset
+ //{
+ // get
+ // {
+ // return this.Task.x264Preset;
+ // }
+ // set
+ // {
+ // this.Task.x264Preset = value;
+ // this.NotifyOfPropertyChange(() => this.X264Preset);
+ // }
+ //}
+
+ ///// <summary>
+ ///// Gets or sets X264Profile.
+ ///// </summary>
+ //public x264Profile X264Profile
+ //{
+ // get
+ // {
+ // return this.Task.x264Profile;
+ // }
+ // set
+ // {
+ // this.Task.x264Profile = value;
+ // this.NotifyOfPropertyChange(() => this.X264Profile);
+ // }
+ //}
+
+ ///// <summary>
+ ///// Gets or sets X264Tune.
+ ///// </summary>
+ //public x264Tune X264Tune
+ //{
+ // get
+ // {
+ // return this.Task.X264Tune;
+ // }
+ // set
+ // {
+ // this.Task.X264Tune = value;
+ // this.NotifyOfPropertyChange(() => this.X264Tune);
+ // }
+ //}
+
+ ///// <summary>
+ ///// Gets or sets X264Presets.
+ ///// </summary>
+ //public IEnumerable<x264Preset> X264Presets { get; set; }
+
+ ///// <summary>
+ ///// Gets or sets X264Profiles.
+ ///// </summary>
+ //public IEnumerable<x264Profile> X264Profiles { get; set; }
+
+ ///// <summary>
+ ///// Gets or sets X264Tunes.
+ ///// </summary>
+ //public IEnumerable<x264Tune> X264Tunes { get; set; }
+
+ ///// <summary>
+ ///// Gets or sets a value indicating whether DisplayX264Options.
+ ///// </summary>
+ //public bool DisplayX264Options
+ //{
+ // get
+ // {
+ // return this.displayX264Options;
+ // }
+ // set
+ // {
+ // this.displayX264Options = value;
+ // this.NotifyOfPropertyChange(() => this.DisplayX264Options);
+ // }
+ //}
#endregion
}
} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Views/AdvancedView.xaml b/win/CS/HandBrakeWPF/Views/AdvancedView.xaml
index 3fad3c54b..4221a8e5d 100644
--- a/win/CS/HandBrakeWPF/Views/AdvancedView.xaml
+++ b/win/CS/HandBrakeWPF/Views/AdvancedView.xaml
@@ -1,61 +1,316 @@
<UserControl x:Class="HandBrakeWPF.Views.AdvancedView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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"
- d:DesignHeight="300" d:DesignWidth="300"
- x:Name="advancedView">
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:Converters="clr-namespace:HandBrakeWPF.Converters"
+ xmlns:Properties="clr-namespace:HandBrakeWPF.Properties" xmlns:Helpers="clr-namespace:HandBrakeWPF.Helpers"
+ mc:Ignorable="d" x:Name="advancedView">
<UserControl.Resources>
- <Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
- <Converters:EnumComboConverter x:Key="x264DisplayConverter" />
+ <Converters:AdvancedVisibilityConverter x:Key="VisibilityConverter" />
+ <Converters:BooleanToVisibilityConverter x:Key="BooleanVisibilityConverter" />
+ <Style x:Key="AdvancedLabel" TargetType="Label">
+ <Setter Property="HorizontalAlignment" Value="Right" />
+ </Style>
+
+ <Style x:Key="LongToolTipHolder" TargetType="FrameworkElement">
+ <Setter Property="ToolTipService.ShowDuration" Value="20000" />
+ </Style>
+
+ <Style x:Key="LongToolTip" TargetType="TextBlock">
+ <Setter Property="Width" Value="400" />
+ <Setter Property="TextWrapping" Value="Wrap" />
+ </Style>
</UserControl.Resources>
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
+ <StackPanel Orientation="Vertical">
- <TextBlock Text="Advanced" FontWeight="Bold" Margin="10,5,0,0" Grid.Row="0" ></TextBlock>
+ <!-- Other Encoders -->
+ <StackPanel Margin="10" Height="100" VerticalAlignment="Top"
+ Visibility="{Binding DisplayX264Options, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=true}">
+ <TextBlock Text="Advanced Query" Margin="0,0,0,5" FontWeight="Bold" VerticalAlignment="Center" />
+ <TextBox Text="{Binding AdvancedOptionsString}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="150" TextWrapping="Wrap" />
+ </StackPanel>
- <Grid Grid.Row="1" Margin="10,10,0,0" Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}">
+ <!-- X264 -->
+ <Grid Visibility="{Binding DisplayX264Options, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=false}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+
+ <!--Left Column -->
+ <StackPanel Orientation="Vertical" Grid.Column="0" Grid.Row="0">
+ <!-- Encoding -->
+ <StackPanel Orientation="Vertical" >
+ <TextBlock Text="Encoding: " FontWeight="Bold" Margin="10,5,0,0" Grid.Row="0" />
+ <Grid HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="110" />
+ <ColumnDefinition Width="100" />
+ </Grid.ColumnDefinitions>
+
+ <Label Content="Reference Frames:" Grid.Row="0" Grid.Column="0" Style="{StaticResource AdvancedLabel}" />
+ <ComboBox Grid.Row="0" Grid.Column="1" Height="22"
+ ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.ReferenceFrames}" DisplayMemberPath="Label"
+ SelectedItem="{Binding ReferenceFrames}" Style="{StaticResource LongToolTipHolder}">
+ <ComboBox.ToolTip>
+ <TextBlock Text="{x:Static Properties:Resources.Advanced_ReferenceFramesToolTip}" Style="{StaticResource LongToolTip}" />
+ </ComboBox.ToolTip>
+ </ComboBox>
+
+ <Label Content="Maximum B-Frames:" Grid.Row="1" Grid.Column="0" Style="{StaticResource AdvancedLabel}" />
+ <ComboBox Grid.Row="1" Grid.Column="1" Height="22"
+ ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.BFrames}" DisplayMemberPath="Label"
+ SelectedItem="{Binding BFrames}" Style="{StaticResource LongToolTipHolder}">
+ <ComboBox.ToolTip>
+ <TextBlock Text="{x:Static Properties:Resources.Advanced_BFramesToolTip}" Style="{StaticResource LongToolTip}" />
+ </ComboBox.ToolTip>
+ </ComboBox>
+
- <StackPanel Grid.Row="0" Orientation="Vertical" Margin="0,0,0,10">
+ <Label Content="CABAC:" Height="28" Grid.Row="4" Grid.Column="0" Style="{StaticResource AdvancedLabel}" />
+ <CheckBox Height="16" Grid.Row="4" Grid.Column="1" IsChecked="{Binding CabacEntropyCoding}" Style="{StaticResource LongToolTipHolder}">
+ <CheckBox.ToolTip>
+ <TextBlock Text="{x:Static Properties:Resources.Advanced_CabacToolTip}" Style="{StaticResource LongToolTip}" />
+ </CheckBox.ToolTip>
+ </CheckBox>
- <TextBlock Text="X264 Advanced Options:" Margin="0,0,0,5" FontWeight="Bold" VerticalAlignment="Center" />
-
- <StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0,0,0,10">
- <TextBlock Text="Preset:" VerticalAlignment="Center" />
- <ComboBox Width="100" Grid.Column="3" Margin="5,0,5,0" Height="22"
- ItemsSource="{Binding X264Presets, Converter={StaticResource x264DisplayConverter}}"
- SelectedItem="{Binding X264Preset, Converter={StaticResource x264DisplayConverter}}"/>
+ <Label Content="8x8 Transform:" Height="28" Grid.Row="5" Grid.Column="0"
+ Visibility="{Binding EightByEightDctVisible, Converter={StaticResource VisibilityConverter}}"
+ Style="{StaticResource AdvancedLabel}" />
+ <CheckBox Height="16" Grid.Row="5" Grid.Column="1" IsChecked="{Binding EightByEightDct}"
+ Visibility="{Binding EightByEightDctVisible, Converter={StaticResource VisibilityConverter}}"
+ Style="{StaticResource LongToolTipHolder}">
+ <CheckBox.ToolTip>
+ <TextBlock Text="{x:Static Properties:Resources.Advanced_EightByEightDctToolTip}" Style="{StaticResource LongToolTip}" />
+ </CheckBox.ToolTip>
+ </CheckBox>
- <TextBlock Text="Profile:" VerticalAlignment="Center" />
- <ComboBox Width="100" Grid.Column="3" Margin="5,0,5,0" Height="22"
- ItemsSource="{Binding X264Profiles, Converter={StaticResource x264DisplayConverter}}"
- SelectedItem="{Binding X264Profile, Converter={StaticResource x264DisplayConverter}}"/>
+ <Label Content="Weighted P-Frames:" Grid.Row="6" Grid.Column="0" Style="{StaticResource AdvancedLabel}" />
+ <CheckBox Grid.Row="6" Grid.Column="1" VerticalAlignment="Center" IsChecked="{Binding WeightedPFrames}" Style="{StaticResource LongToolTipHolder}">
+ <CheckBox.ToolTip>
+ <TextBlock Text="{x:Static Properties:Resources.Advanced_WeightPToolTip}" Style="{StaticResource LongToolTip}" />
+ </CheckBox.ToolTip>
+ </CheckBox>
+ <Label Content="Pyramidal B-Frames:" Grid.Row="7" Grid.Column="0"
+ Visibility="{Binding PyramidalBFramesVisible, Converter={StaticResource VisibilityConverter}}"
+ Style="{StaticResource AdvancedLabel}" />
+ <ComboBox Grid.Row="7" Grid.Column="1" Height="22" ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.PyramidalBFrames}" DisplayMemberPath="Label"
+ SelectedItem="{Binding PyramidalBFrames}"
+ Visibility="{Binding PyramidalBFramesVisible, Converter={StaticResource VisibilityConverter}}"
+ Style="{StaticResource LongToolTipHolder}">
+ <ComboBox.ToolTip>
+ <TextBlock Text="{x:Static Properties:Resources.Advanced_PyramidalBFramesToolTip}" Style="{StaticResource LongToolTip}" />
+ </ComboBox.ToolTip>
+ </ComboBox>
+ </Grid>
+ </StackPanel>
+
+ <!-- Psychvisual -->
+ <StackPanel Orientation="Vertical" >
+ <TextBlock Text="Psychvisual: " FontWeight="Bold" Margin="10,5,0,0" Grid.Row="0" />
+ <StackPanel Orientation="Horizontal">
+ <Label Content="No DCT-Decimate:" Width="110" HorizontalAlignment="Left" HorizontalContentAlignment="Right" VerticalAlignment="Center" />
+ <CheckBox VerticalAlignment="Center" HorizontalAlignment="Left" IsChecked="{Binding NoDctDecimate}"
+ Style="{StaticResource LongToolTipHolder}">
+ <CheckBox.ToolTip>
+ <TextBlock Text="{x:Static Properties:Resources.Advanced_NoDctDecimateToolTip}" Style="{StaticResource LongToolTip}" />
+ </CheckBox.ToolTip>
+ </CheckBox>
- <TextBlock Text="Tune:" VerticalAlignment="Center" />
- <ComboBox Width="100" Grid.Column="3" Margin="5,0,5,0" Height="22"
- ItemsSource="{Binding X264Tunes, Converter={StaticResource x264DisplayConverter}}"
- SelectedItem="{Binding X264Tune, Converter={StaticResource x264DisplayConverter}}"/>
+ </StackPanel>
</StackPanel>
+
</StackPanel>
- </Grid>
+ <!-- Analysis (Center Column)-->
+ <StackPanel Orientation="Vertical" Grid.Column="1" Grid.Row="0" >
+ <TextBlock Text="Analysis: " FontWeight="Bold" Margin="10,5,0,0" Grid.Row="0" />
+ <Grid HorizontalAlignment="Left" VerticalAlignment="Top">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition />
+ </Grid.ColumnDefinitions>
- <StackPanel Grid.Row="2" Margin="10" Height="100" VerticalAlignment="Top" >
- <TextBlock Text="Advanced Query" Margin="0,0,0,5" FontWeight="Bold" VerticalAlignment="Center" />
- <TextBox Text="{Binding Query}"
- VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="150" TextWrapping="Wrap" />
- </StackPanel>
+ <Label Content="Adaptive B-Frames:" Grid.Row="0" Grid.Column="0"
+ Visibility="{Binding BFramesOptionsVisible, Converter={StaticResource VisibilityConverter}}"
+ Style="{StaticResource AdvancedLabel}" />
+ <ComboBox Grid.Row="0" Grid.Column="1" Height="22" ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.AdaptiveBFrames}" DisplayMemberPath="Label"
+ SelectedItem="{Binding AdaptiveBFrames}" Visibility="{Binding BFramesOptionsVisible, Converter={StaticResource VisibilityConverter}}"
+ Style="{StaticResource LongToolTipHolder}" MaxWidth="120" Width="120">
+ <ComboBox.ToolTip>
+ <TextBlock Text="{x:Static Properties:Resources.Advanced_AdaptiveBFramesToolTip}" Style="{StaticResource LongToolTip}" />
+ </ComboBox.ToolTip>
+ </ComboBox>
+
+ <Label Content="Adaptive Direct Mode:" Grid.Row="1" Grid.Column="0"
+ Visibility="{Binding BFramesOptionsVisible, Converter={StaticResource VisibilityConverter}}"
+ Style="{StaticResource AdvancedLabel}" />
+ <ComboBox Grid.Row="1" Grid.Column="1" Height="22" MaxWidth="120" Width="120"
+ ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.DirectPrediction}" DisplayMemberPath="Label"
+ SelectedItem="{Binding DirectPrediction}"
+ Visibility="{Binding BFramesOptionsVisible, Converter={StaticResource VisibilityConverter}}"
+ Style="{StaticResource LongToolTipHolder}">
+ <ComboBox.ToolTip>
+ <TextBlock Text="{x:Static Properties:Resources.Advanced_AdaptiveDirectModeToolTip}" Style="{StaticResource LongToolTip}" />
+ </ComboBox.ToolTip>
+ </ComboBox>
+
+ <Label Content="Motion Estimation Method:" Grid.Row="2" Grid.Column="0" Style="{StaticResource AdvancedLabel}" />
+ <ComboBox Grid.Row="2" Grid.Column="1" Height="22" MaxWidth="120" Width="120"
+ ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.MotionEstimationMethod}" DisplayMemberPath="Label"
+ SelectedItem="{Binding MotionEstimationMethod}" Style="{StaticResource LongToolTipHolder}">
+ <ComboBox.ToolTip>
+ <TextBlock Text="{x:Static Properties:Resources.Advanced_MotionEstimationMethodToolTip}" Style="{StaticResource LongToolTip}" />
+ </ComboBox.ToolTip>
+ </ComboBox>
+
+ <Label Content="Subpixel Motion Estimation:" Grid.Row="3" Grid.Column="0" Style="{StaticResource AdvancedLabel}" />
+ <ComboBox Grid.Row="3" Grid.Column="1" Height="22" MaxWidth="120" Width="120"
+ ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.SubpixelMotionEstimation}" DisplayMemberPath="Label"
+ SelectedItem="{Binding SubpixelMotionEstimation}" Style="{StaticResource LongToolTipHolder}">
+ <ComboBox.ToolTip>
+ <TextBlock Text="{x:Static Properties:Resources.Advanced_SubpixelMotionEstimationToolTip}" Style="{StaticResource LongToolTip}" />
+ </ComboBox.ToolTip>
+ </ComboBox>
+
+ <Label Content="Motion Estimation Range:" Grid.Row="4" Grid.Column="0"
+ Visibility="{Binding MotionEstimationRangeVisible, Converter={StaticResource VisibilityConverter}}"
+ Style="{StaticResource AdvancedLabel}" />
+ <ComboBox Grid.Row="4" Grid.Column="1" Height="22" MaxWidth="120" Width="120"
+ ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.MotionEstimationRange}" DisplayMemberPath="Label"
+ SelectedItem="{Binding MotionEstimationRange}"
+ Visibility="{Binding MotionEstimationRangeVisible, Converter={StaticResource VisibilityConverter}}"
+ Style="{StaticResource LongToolTipHolder}">
+ <ComboBox.ToolTip>
+ <TextBlock Text="{x:Static Properties:Resources.Advanced_MotionEstimationRangeToolTip}" Style="{StaticResource LongToolTip}" />
+ </ComboBox.ToolTip>
+ </ComboBox>
+ </Grid>
+
+ <Grid Height="80" HorizontalAlignment="Left" VerticalAlignment="Top" Width="300">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition />
+ </Grid.ColumnDefinitions>
+
+ <Label Content="Adaptive Quantization Strength:" Grid.Row="0" Grid.Column="0" Style="{StaticResource AdvancedLabel}" />
+ <Slider Grid.Row="0" Grid.Column="1" Minimum="0.0" Maximum="2.0" TickPlacement="BottomRight"
+ TickFrequency="0.1" SmallChange="0.1" LargeChange="0.2" IsSnapToTickEnabled="True"
+ Value="{Binding AdaptiveQuantizationStrength}" Style="{StaticResource LongToolTipHolder}">
+ <Slider.ToolTip>
+ <TextBlock Text="{x:Static Properties:Resources.Advanced_AdaptiveQuantizationStrengthToolTip}" Style="{StaticResource LongToolTip}" />
+ </Slider.ToolTip>
+ </Slider>
+
+ <Label Content="Psychovisual Rate Distortion:" Grid.Row="1" Grid.Column="0" Style="{StaticResource AdvancedLabel}" />
+ <Slider Grid.Row="1" Grid.Column="1" Minimum="0.0" Maximum="2.0" TickPlacement="BottomRight"
+ TickFrequency="0.1" SmallChange="0.1" LargeChange="0.2" IsSnapToTickEnabled="True"
+ Value="{Binding PsychovisualRateDistortion}" Style="{StaticResource LongToolTipHolder}">
+ <Slider.ToolTip>
+ <TextBlock Text="{x:Static Properties:Resources.Advanced_PsychovisualRateDistortionToolTip}" Style="{StaticResource LongToolTip}" />
+ </Slider.ToolTip>
+ </Slider>
+
+ <Label Content="Psychovisual Trellis:" Grid.Row="2" Grid.Column="0" Style="{StaticResource AdvancedLabel}"
+ Visibility="{Binding PsychovisualTrellisVisible, Converter={StaticResource VisibilityConverter}}" />
+ <Slider Grid.Row="2" Grid.Column="1" Minimum="0.0" Maximum="1.0" TickPlacement="BottomRight"
+ TickFrequency="0.05" SmallChange="0.05" LargeChange="0.2" IsSnapToTickEnabled="True"
+ Value="{Binding PsychovisualTrellis}"
+ Visibility="{Binding PsychovisualTrellisVisible, Converter={StaticResource VisibilityConverter}}"
+ Style="{StaticResource LongToolTipHolder}">
+ <Slider.ToolTip>
+ <TextBlock Text="{x:Static Properties:Resources.Advanced_PsychovisualTrellisToolTip}" Style="{StaticResource LongToolTip}" />
+ </Slider.ToolTip>
+ </Slider>
+ </Grid>
+
+ </StackPanel>
+
+ <!-- Analysis (Right Column)-->
+ <StackPanel Orientation="Vertical" Grid.Column="2" Grid.Row="0">
+ <Grid Margin="0,20,0,0">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="100" />
+ </Grid.ColumnDefinitions>
+ <Label Content="Partition Type:" Height="28" HorizontalAlignment="Right" VerticalAlignment="Top" Grid.Column="0" />
+ <ComboBox Height="23" HorizontalAlignment="Right" VerticalAlignment="Top" Width="100" MaxWidth="100"
+ ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.Analysis}" DisplayMemberPath="Label" Grid.Column="1"
+ SelectedItem="{Binding Analysis}" Style="{StaticResource LongToolTipHolder}">
+ <ComboBox.ToolTip>
+ <TextBlock Text="{x:Static Properties:Resources.Advanced_AnalysisToolTip}" Style="{StaticResource LongToolTip}" />
+ </ComboBox.ToolTip>
+ </ComboBox>
+
+ <Label Content="Trellis:" Height="28" HorizontalAlignment="Right" VerticalAlignment="Top" Grid.Column="0" Grid.Row="1" />
+ <ComboBox Height="23" HorizontalAlignment="Right" VerticalAlignment="Top" Width="100" MaxWidth="100" Grid.Row="1"
+ ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.Trellis}" DisplayMemberPath="Label" Grid.Column="1"
+ SelectedItem="{Binding Trellis}" Style="{StaticResource LongToolTipHolder}">
+ <ComboBox.ToolTip>
+ <TextBlock Text="{x:Static Properties:Resources.Advanced_TrellisToolTip}" Style="{StaticResource LongToolTip}" />
+ </ComboBox.ToolTip>
+ </ComboBox>
+
+
+ <Label Content="Deblocking:" Height="28" HorizontalAlignment="Right" VerticalAlignment="Top" Grid.Column="0" Grid.Row="2" />
+ <ComboBox Height="23" HorizontalAlignment="Right" VerticalAlignment="Top" Width="100" MaxWidth="100"
+ ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.DeblockingStrength}" DisplayMemberPath="Label" Grid.Column="1" Grid.Row="2"
+ SelectedItem="{Binding DeblockingStrength}" Style="{StaticResource LongToolTipHolder}">
+ <ComboBox.ToolTip>
+ <TextBlock Text="{x:Static Properties:Resources.Advanced_DeblockingToolTip}" Style="{StaticResource LongToolTip}" />
+ </ComboBox.ToolTip>
+ </ComboBox>
+ <ComboBox Height="23" HorizontalAlignment="Right" VerticalAlignment="Top" Width="100" MaxWidth="100" Grid.Column="1" Grid.Row="3"
+ ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.DeblockingThreshold}" DisplayMemberPath="Label"
+ SelectedItem="{Binding DeblockingThreshold}" Style="{StaticResource LongToolTipHolder}">
+ <ComboBox.ToolTip>
+ <TextBlock Text="{x:Static Properties:Resources.Advanced_DeblockingToolTip}" Style="{StaticResource LongToolTip}" />
+ </ComboBox.ToolTip>
+ </ComboBox>
+ </Grid>
+ </StackPanel>
+
+ <!-- Query -->
+ <StackPanel Orientation="Vertical" Grid.Row="1" Grid.ColumnSpan="3" Margin="0,10,0,0" HorizontalAlignment="Stretch">
+ <TextBox Text="{Binding AdvancedOptionsString, UpdateSourceTrigger=PropertyChanged}" Height="35" MaxWidth="700"
+ HorizontalAlignment="Stretch" TextWrapping="Wrap" />
+ </StackPanel>
+ </Grid>
- </Grid>
-</UserControl>
+ </StackPanel>
+</UserControl> \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Views/VideoView.xaml b/win/CS/HandBrakeWPF/Views/VideoView.xaml
index ec6163b94..ea19b654a 100644
--- a/win/CS/HandBrakeWPF/Views/VideoView.xaml
+++ b/win/CS/HandBrakeWPF/Views/VideoView.xaml
@@ -73,6 +73,45 @@
</StackPanel>
+ <!--<Grid Grid.Row="1" Margin="10,10,0,0" Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
+
+ <StackPanel Grid.Row="0" Orientation="Vertical" Margin="0,0,0,10">
+
+ <TextBlock Text="X264 Advanced Options:" Margin="0,0,0,5" FontWeight="Bold" VerticalAlignment="Center" />
+
+ <StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0,0,0,10">
+ <TextBlock Text="Preset:" VerticalAlignment="Center" />
+ <ComboBox Width="100" Grid.Column="3" Margin="5,0,5,0" Height="22"
+ ItemsSource="{Binding X264Presets, Converter={StaticResource x264DisplayConverter}}"
+ SelectedItem="{Binding X264Preset, Converter={StaticResource x264DisplayConverter}}"/>
+
+ <TextBlock Text="Profile:" VerticalAlignment="Center" />
+ <ComboBox Width="100" Grid.Column="3" Margin="5,0,5,0" Height="22"
+ ItemsSource="{Binding X264Profiles, Converter={StaticResource x264DisplayConverter}}"
+ SelectedItem="{Binding X264Profile, Converter={StaticResource x264DisplayConverter}}"/>
+
+
+ <TextBlock Text="Tune:" VerticalAlignment="Center" />
+ <ComboBox Width="100" Grid.Column="3" Margin="5,0,5,0" Height="22"
+ ItemsSource="{Binding X264Tunes, Converter={StaticResource x264DisplayConverter}}"
+ SelectedItem="{Binding X264Tune, Converter={StaticResource x264DisplayConverter}}"/>
+ </StackPanel>
+ </StackPanel>
+
+ </Grid>
+
+ <StackPanel Grid.Row="2" Margin="10" Height="100" VerticalAlignment="Top" >
+ <TextBlock Text="Advanced Query" Margin="0,0,0,5" FontWeight="Bold" VerticalAlignment="Center" />
+ <TextBox Text="{Binding Query}"
+ VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="150" TextWrapping="Wrap" />
+ </StackPanel>-->
+
+
+
</Grid>
</Grid>