// -------------------------------------------------------------------------------------------------------------------- // // This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. // // // The advanced choices. // // -------------------------------------------------------------------------------------------------------------------- namespace HandBrakeWPF.Helpers { using System.Collections.Generic; using System.Globalization; using HandBrakeWPF.Model; /// /// The advanced choices. /// public static class AdvancedChoicesHelper { #region Constants and Fields /// /// The adaptive b frames. /// private static List adaptiveBFrames; /// /// The analysis. /// private static List analysis; /// /// The b frames. /// private static List bFrames; /// /// The deblocking strength. /// private static List deblockingStrength; /// /// The deblocking threshold. /// private static List deblockingThreshold; /// /// The direct prediction. /// private static List directPrediction; /// /// The motion estimation method. /// private static List motionEstimationMethod; /// /// The motion estimation range. /// private static List motionEstimationRange; /// /// The pyramidal b frames. /// private static List pyramidalBFrames; /// /// The reference frames. /// private static List referenceFrames; /// /// The subpixel motion estimation. /// private static List subpixelMotionEstimation; /// /// The trellis. /// private static List trellis; #endregion #region Constructors and Destructors /// /// Initializes static members of the class. /// static AdvancedChoicesHelper() { referenceFrames = CreateNumberList(0, 16, defaultNumber: 3); bFrames = CreateNumberList(0, 16, defaultNumber: 3); pyramidalBFrames = new List { new AdvancedChoice { Label = "Off", Value = "none" }, new AdvancedChoice { Label = "Normal (Default)", IsDefault = true }, new AdvancedChoice { Label = "Strict", Value = "strict" } }; adaptiveBFrames = new List { new AdvancedChoice { Label = "Off", Value = "0" }, new AdvancedChoice { Label = "Fast (Default)", Value = "1", IsDefault = true }, new AdvancedChoice { Label = "Optimal", Value = "2" } }; directPrediction = new List { 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 { 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 { 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 { new AdvancedChoice { Label = "Most (Default)", IsDefault = true }, new AdvancedChoice { Label = "None", Value = "none" }, new AdvancedChoice { Label = "Some", Value = "i4x4,i8x8", }, new AdvancedChoice { Label = "All", Value = "all" } }; trellis = new List { 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 /// /// Gets AdaptiveBFrames. /// public static List AdaptiveBFrames { get { return adaptiveBFrames; } } /// /// Gets Analysis. /// public static List Analysis { get { return analysis; } } /// /// Gets BFrames. /// public static List BFrames { get { return bFrames; } } /// /// Gets DeblockingStrength. /// public static List DeblockingStrength { get { return deblockingStrength; } } /// /// Gets DeblockingThreshold. /// public static List DeblockingThreshold { get { return deblockingThreshold; } } /// /// Gets DirectPrediction. /// public static List DirectPrediction { get { return directPrediction; } } /// /// Gets MotionEstimationMethod. /// public static List MotionEstimationMethod { get { return motionEstimationMethod; } } /// /// Gets MotionEstimationRange. /// public static List MotionEstimationRange { get { return motionEstimationRange; } } /// /// Gets PyramidalBFrames. /// public static List PyramidalBFrames { get { return pyramidalBFrames; } } /// /// Gets ReferenceFrames. /// public static List ReferenceFrames { get { return referenceFrames; } } /// /// Gets SubpixelMotionEstimation. /// public static List SubpixelMotionEstimation { get { return subpixelMotionEstimation; } } /// /// Gets Trellis. /// public static List Trellis { get { return trellis; } } #endregion #region Methods /// /// The add range. /// /// /// The list. /// /// /// The lower. /// /// /// The upper. /// /// /// The default number. /// private static void AddRange(List 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) }); } } } /// /// The create number list. /// /// /// The lower. /// /// /// The upper. /// /// /// The default number. /// /// /// List of Advanced Choices Options. /// private static List CreateNumberList(int lower, int upper, int defaultNumber) { var list = new List(); AddRange(list, lower, upper, defaultNumber); return list; } #endregion } }