diff options
author | sr55 <[email protected]> | 2009-02-12 17:49:21 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2009-02-12 17:49:21 +0000 |
commit | fa7bba1748ac6d8c1021c9009d1d183877d4f9a1 (patch) | |
tree | 2ffd546eebd288bfd02fc49c0d4c53b0496f18aa /win/C# | |
parent | fb40b03f364b822f4e0e5033fa75dea30d734177 (diff) |
WinGui:
- Removes 0.33 from x264 granularity slider.
- Fixes some rounding issues
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2149 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#')
-rw-r--r-- | win/C#/frmMain.cs | 50 | ||||
-rw-r--r-- | win/C#/frmMain/PresetLoader.cs | 6 | ||||
-rw-r--r-- | win/C#/frmMain/QueryGenerator.cs | 7 | ||||
-rw-r--r-- | win/C#/frmOptions.Designer.cs | 81 |
4 files changed, 83 insertions, 61 deletions
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index c9224407d..eb2ced5c8 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -1064,15 +1064,31 @@ namespace Handbrake break;
case "H.264 (x264)":
slider_videoQuality.Minimum = 0;
- double tickFreq;
- double.TryParse(Properties.Settings.Default.x264cqstep, out tickFreq);
- tickFreq = 1/tickFreq;
- int freq;
- int.TryParse(Math.Round(tickFreq).ToString(), out freq);
- slider_videoQuality.Maximum = (51 * freq);
- slider_videoQuality.TickFrequency = 1;
slider_videoQuality.Value = 0;
+ slider_videoQuality.TickFrequency = 1;
SliderValue.Text = "0% RF: 51.00";
+ String step = Properties.Settings.Default.x264cqstep;
+ switch (step)
+ {
+ case "0.20":
+ slider_videoQuality.Maximum = 255;
+ break;
+ case "0.25":
+ slider_videoQuality.Maximum = 204;
+ break;
+ case "0.33":
+ slider_videoQuality.Maximum = 155;
+ break;
+ case "0.50":
+ slider_videoQuality.Maximum = 102;
+ break;
+ case "1.0":
+ slider_videoQuality.Maximum = 51;
+ break;
+ default:
+ slider_videoQuality.Maximum = 51;
+ break;
+ }
break;
case "VP3 (Theora)":
slider_videoQuality.Minimum = 0;
@@ -1082,16 +1098,15 @@ namespace Handbrake break;
}
}
-
private void slider_videoQuality_Scroll(object sender, EventArgs e)
{
switch (drp_videoEncoder.Text)
{
case "MPEG-4 (FFmpeg)":
- float rfValue = 31 - (slider_videoQuality.Value -1);
- float max = slider_videoQuality.Maximum;
- float min = slider_videoQuality.Minimum;
- float val = ((max - min) - (rfValue - min)) / (max - min);
+ double rfValue = 31 - (slider_videoQuality.Value - 1);
+ double max = slider_videoQuality.Maximum;
+ double min = slider_videoQuality.Minimum;
+ double val = ((max - min) - (rfValue - min)) / (max - min);
SliderValue.Text = Math.Round((val * 100), 2) + "% QP:" + (32 - slider_videoQuality.Value);
break;
case "MPEG-4 (XviD)":
@@ -1102,17 +1117,18 @@ namespace Handbrake SliderValue.Text = Math.Round((val * 100), 2) + "% QP:" + (32 - slider_videoQuality.Value);
break;
case "H.264 (x264)":
- float divided;
- float.TryParse(Properties.Settings.Default.x264cqstep, out divided);
- rfValue = 51 - slider_videoQuality.Value*divided;
+ double divided;
+ double.TryParse(Properties.Settings.Default.x264cqstep, out divided);
+ rfValue = 51.0 - slider_videoQuality.Value*divided;
max = slider_videoQuality.Maximum * divided;
min = slider_videoQuality.Minimum;
val = ((max - min) - (rfValue - min)) / (max - min);
- SliderValue.Text = Math.Round((val * 100), 2) + "% RF:" + (51 - slider_videoQuality.Value * divided);
+ rfValue = Math.Round(rfValue, 2);
+ SliderValue.Text = Math.Round((val * 100), 2) + "% RF:" + rfValue;
break;
case "VP3 (Theora)":
rfValue = slider_videoQuality.Value;
- float value = rfValue/63;
+ double value = rfValue / 63;
SliderValue.Text = Math.Round((value * 100), 2) + "% QP:" + slider_videoQuality.Value;
break;
}
diff --git a/win/C#/frmMain/PresetLoader.cs b/win/C#/frmMain/PresetLoader.cs index c7b50366e..7064b0c68 100644 --- a/win/C#/frmMain/PresetLoader.cs +++ b/win/C#/frmMain/PresetLoader.cs @@ -195,6 +195,12 @@ namespace Handbrake // when used with .33 and .2 and 1.0 for example.
int.TryParse(calculated.ToString(), out value);
+ if (value == 0)
+ {
+ double val = Math.Round(calculated, 0);
+ int.TryParse(val.ToString(), out value);
+ }
+
mainWindow.slider_videoQuality.Value = value;
}
else
diff --git a/win/C#/frmMain/QueryGenerator.cs b/win/C#/frmMain/QueryGenerator.cs index 4dabd2433..31ba53e6c 100644 --- a/win/C#/frmMain/QueryGenerator.cs +++ b/win/C#/frmMain/QueryGenerator.cs @@ -206,7 +206,7 @@ namespace Handbrake // Video Quality Setting
if (mainWindow.radio_cq.Checked)
{
- float value;
+ double value;
switch (mainWindow.drp_videoEncoder.Text)
{
case "MPEG-4 (FFmpeg)":
@@ -218,9 +218,10 @@ namespace Handbrake query += " -q " + value.ToString(new CultureInfo("en-US"));
break;
case "H.264 (x264)":
- float divided;
- float.TryParse(Properties.Settings.Default.x264cqstep, out divided);
+ double divided;
+ double.TryParse(Properties.Settings.Default.x264cqstep, out divided);
value = 51 - mainWindow.slider_videoQuality.Value * divided;
+ value = Math.Round(value, 2);
query += " -q " + value.ToString(new CultureInfo("en-US"));
break;
case "VP3 (Theora)":
diff --git a/win/C#/frmOptions.Designer.cs b/win/C#/frmOptions.Designer.cs index 7c13e91c6..fc6eecc25 100644 --- a/win/C#/frmOptions.Designer.cs +++ b/win/C#/frmOptions.Designer.cs @@ -74,6 +74,9 @@ namespace Handbrake this.drp_processors = new System.Windows.Forms.ComboBox();
this.Label4 = new System.Windows.Forms.Label();
this.tab_advanced = new System.Windows.Forms.TabPage();
+ this.label30 = new System.Windows.Forms.Label();
+ this.drop_x264step = new System.Windows.Forms.ComboBox();
+ this.label28 = new System.Windows.Forms.Label();
this.check_queryEditorTab = new System.Windows.Forms.CheckBox();
this.lbl_appcastUnstable = new System.Windows.Forms.Label();
this.check_mainMinimize = new System.Windows.Forms.CheckBox();
@@ -113,9 +116,6 @@ namespace Handbrake this.label26 = new System.Windows.Forms.Label();
this.label27 = new System.Windows.Forms.Label();
this.openFile_vlc = new System.Windows.Forms.OpenFileDialog();
- this.label28 = new System.Windows.Forms.Label();
- this.drop_x264step = new System.Windows.Forms.ComboBox();
- this.label30 = new System.Windows.Forms.Label();
this.tab_options.SuspendLayout();
this.tab_general.SuspendLayout();
this.tab_picture.SuspendLayout();
@@ -615,6 +615,43 @@ namespace Handbrake this.tab_advanced.Text = "Advanced / Other";
this.tab_advanced.UseVisualStyleBackColor = true;
//
+ // label30
+ //
+ this.label30.AutoSize = true;
+ this.label30.Location = new System.Drawing.Point(76, 142);
+ this.label30.Name = "label30";
+ this.label30.Size = new System.Drawing.Size(230, 13);
+ this.label30.TabIndex = 87;
+ this.label30.Text = "Constant Quality fractional granularity:\r\n";
+ //
+ // drop_x264step
+ //
+ this.drop_x264step.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.drop_x264step.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.drop_x264step.FormattingEnabled = true;
+ this.drop_x264step.Items.AddRange(new object[] {
+ "1.0",
+ "0.50",
+ "0.25",
+ "0.20"});
+ this.drop_x264step.Location = new System.Drawing.Point(312, 139);
+ this.drop_x264step.Name = "drop_x264step";
+ this.drop_x264step.Size = new System.Drawing.Size(111, 21);
+ this.drop_x264step.TabIndex = 86;
+ this.ToolTip.SetToolTip(this.drop_x264step, "The number of processor\'s / processor cores. Unless your having problems, leave o" +
+ "n Automatic.");
+ this.drop_x264step.SelectedIndexChanged += new System.EventHandler(this.x264step_SelectedIndexChanged);
+ //
+ // label28
+ //
+ this.label28.AutoSize = true;
+ this.label28.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label28.Location = new System.Drawing.Point(27, 142);
+ this.label28.Name = "label28";
+ this.label28.Size = new System.Drawing.Size(43, 13);
+ this.label28.TabIndex = 85;
+ this.label28.Text = "x264:";
+ //
// check_queryEditorTab
//
this.check_queryEditorTab.AutoSize = true;
@@ -1050,44 +1087,6 @@ namespace Handbrake this.openFile_vlc.DefaultExt = "exe";
this.openFile_vlc.Filter = "exe|*.exe";
//
- // label28
- //
- this.label28.AutoSize = true;
- this.label28.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label28.Location = new System.Drawing.Point(27, 142);
- this.label28.Name = "label28";
- this.label28.Size = new System.Drawing.Size(43, 13);
- this.label28.TabIndex = 85;
- this.label28.Text = "x264:";
- //
- // drop_x264step
- //
- this.drop_x264step.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.drop_x264step.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.drop_x264step.FormattingEnabled = true;
- this.drop_x264step.Items.AddRange(new object[] {
- "1.0",
- "0.50",
- "0.33",
- "0.25",
- "0.20"});
- this.drop_x264step.Location = new System.Drawing.Point(312, 139);
- this.drop_x264step.Name = "drop_x264step";
- this.drop_x264step.Size = new System.Drawing.Size(111, 21);
- this.drop_x264step.TabIndex = 86;
- this.ToolTip.SetToolTip(this.drop_x264step, "The number of processor\'s / processor cores. Unless your having problems, leave o" +
- "n Automatic.");
- this.drop_x264step.SelectedIndexChanged += new System.EventHandler(this.x264step_SelectedIndexChanged);
- //
- // label30
- //
- this.label30.AutoSize = true;
- this.label30.Location = new System.Drawing.Point(76, 142);
- this.label30.Name = "label30";
- this.label30.Size = new System.Drawing.Size(230, 13);
- this.label30.TabIndex = 87;
- this.label30.Text = "Constant Quality fractional granularity:\r\n";
- //
// frmOptions
//
this.ClientSize = new System.Drawing.Size(514, 375);
|