diff options
author | sr55 <[email protected]> | 2009-02-11 23:33:19 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2009-02-11 23:33:19 +0000 |
commit | 7556f1aa51659a9d5aa96e6f7b8e0e9dcf165248 (patch) | |
tree | d69d1f18b55931b8e8f2a20dbdc62a496018d753 /win/C#/frmMain | |
parent | bfd2a847978e4594236ff012ec69f5867c0e74d0 (diff) |
WinGui:
- Constant Quality Slider now QP/RF based.
- Nearest percentage is also shown for reference.
- Preset system also updated to handle new CP/RF values
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2146 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/frmMain')
-rw-r--r-- | win/C#/frmMain/PresetLoader.cs | 48 | ||||
-rw-r--r-- | win/C#/frmMain/QueryGenerator.cs | 33 |
2 files changed, 66 insertions, 15 deletions
diff --git a/win/C#/frmMain/PresetLoader.cs b/win/C#/frmMain/PresetLoader.cs index 1d7472358..c7b50366e 100644 --- a/win/C#/frmMain/PresetLoader.cs +++ b/win/C#/frmMain/PresetLoader.cs @@ -144,12 +144,12 @@ namespace Handbrake if (mainWindow.ctl_decomb.getDropValue == "Off")
mainWindow.ctl_deinterlace.setOption(presetQuery.DeInterlace);
- else
+ else
mainWindow.ctl_deinterlace.setOption("None"); // Don't want decomb and deinterlace on at the same time
mainWindow.ctl_denoise.setOption(presetQuery.DeNoise);
mainWindow.ctl_detelecine.setOption(presetQuery.DeTelecine);
-
+
if (presetQuery.DeBlock != 0)
{
mainWindow.slider_deblock.Value = presetQuery.DeBlock;
@@ -164,13 +164,45 @@ namespace Handbrake // Video Settings Tab
#region video
- mainWindow.text_bitrate.Text = presetQuery.AverageVideoBitrate;
- mainWindow.text_filesize.Text = presetQuery.VideoTargetSize;
- mainWindow.slider_videoQuality.Value = presetQuery.VideoQuality;
- if (mainWindow.slider_videoQuality.Value != 0)
+ if (presetQuery.AverageVideoBitrate != null)
+ {
+ mainWindow.radio_avgBitrate.Checked = true;
+ mainWindow.text_bitrate.Text = presetQuery.AverageVideoBitrate;
+ }
+ if (presetQuery.VideoTargetSize != null)
{
- int ql = presetQuery.VideoQuality;
- mainWindow.SliderValue.Text = ql + "%";
+ mainWindow.radio_targetFilesize.Checked = true;
+ mainWindow.text_filesize.Text = presetQuery.VideoTargetSize;
+ }
+
+ // Quality
+ if (presetQuery.VideoQuality != 0)
+ {
+ mainWindow.radio_cq.Checked = true;
+ if (presetQuery.VideoEncoder == "H.264 (x264)")
+ {
+ int value;
+ float presetValue, calculated, x264step;
+ float.TryParse(presetQuery.VideoQuality.ToString(), out presetValue);
+ float.TryParse(Properties.Settings.Default.x264cqstep, out x264step);
+
+ float x = 51 / x264step;
+
+ calculated = presetValue / x264step;
+ calculated = x - calculated;
+
+ //TODO: Handle cases where it can't parse a value due to the float being too lage.
+ // when used with .33 and .2 and 1.0 for example.
+ int.TryParse(calculated.ToString(), out value);
+
+ mainWindow.slider_videoQuality.Value = value;
+ }
+ else
+ {
+ int presetVal;
+ int.TryParse(presetQuery.VideoQuality.ToString(), out presetVal);
+ mainWindow.slider_videoQuality.Value = presetVal;
+ }
}
if (presetQuery.TwoPass)
diff --git a/win/C#/frmMain/QueryGenerator.cs b/win/C#/frmMain/QueryGenerator.cs index 738bb2503..4dabd2433 100644 --- a/win/C#/frmMain/QueryGenerator.cs +++ b/win/C#/frmMain/QueryGenerator.cs @@ -197,19 +197,38 @@ namespace Handbrake query += " -g ";
// Video Settings
- if (mainWindow.text_bitrate.Text != "")
+ if (mainWindow.radio_avgBitrate.Checked)
query += " -b " + mainWindow.text_bitrate.Text;
- if (mainWindow.text_filesize.Text != "")
+ if (mainWindow.radio_targetFilesize.Checked)
query += " -S " + mainWindow.text_filesize.Text;
// Video Quality Setting
- double videoQuality = mainWindow.slider_videoQuality.Value;
- if (videoQuality != 0)
+ if (mainWindow.radio_cq.Checked)
{
- videoQuality = videoQuality / 100;
- query += " -q " + videoQuality.ToString(new CultureInfo("en-US"));
- }
+ float value;
+ switch (mainWindow.drp_videoEncoder.Text)
+ {
+ case "MPEG-4 (FFmpeg)":
+ value = 31 - (mainWindow.slider_videoQuality.Value -1);
+ query += " -q " + value.ToString(new CultureInfo("en-US"));
+ break;
+ case "MPEG-4 (XviD)":
+ value = 31 - (mainWindow.slider_videoQuality.Value - 1);
+ query += " -q " + value.ToString(new CultureInfo("en-US"));
+ break;
+ case "H.264 (x264)":
+ float divided;
+ float.TryParse(Properties.Settings.Default.x264cqstep, out divided);
+ value = 51 - mainWindow.slider_videoQuality.Value * divided;
+ query += " -q " + value.ToString(new CultureInfo("en-US"));
+ break;
+ case "VP3 (Theora)":
+ value = mainWindow.slider_videoQuality.Value;
+ query += " -q " + value.ToString(new CultureInfo("en-US"));
+ break;
+ }
+ }
if (mainWindow.check_2PassEncode.Checked)
query += " -2 ";
|