2 using System.Windows.Forms;
\r
9 /// Reset all components to defaults and clears the x264 rtf box
\r
11 public void reset2Defaults(frmMain mainWindow)
\r
13 mainWindow.check_8x8DCT.CheckState = CheckState.Unchecked;
\r
14 mainWindow.check_Cabac.CheckState = CheckState.Checked;
\r
15 mainWindow.check_mixedReferences.CheckState = CheckState.Unchecked;
\r
16 mainWindow.check_noDCTDecimate.CheckState = CheckState.Unchecked;
\r
17 mainWindow.check_noFastPSkip.CheckState = CheckState.Unchecked;
\r
18 mainWindow.check_pyrmidalBFrames.CheckState = CheckState.Unchecked;
\r
19 mainWindow.check_weightedBFrames.CheckState = CheckState.Unchecked;
\r
20 mainWindow.drop_analysis.SelectedIndex = 0;
\r
21 mainWindow.drop_bFrames.SelectedIndex = 0;
\r
22 mainWindow.drop_deblockAlpha.SelectedIndex = 0;
\r
23 mainWindow.drop_deblockBeta.SelectedIndex = 0;
\r
24 mainWindow.drop_directPrediction.SelectedIndex = 0;
\r
25 mainWindow.drop_MotionEstimationMethod.SelectedIndex = 0;
\r
26 mainWindow.drop_MotionEstimationRange.SelectedIndex = 0;
\r
27 mainWindow.drop_refFrames.SelectedIndex = 0;
\r
28 mainWindow.drop_subpixelMotionEstimation.SelectedIndex = 0;
\r
29 mainWindow.drop_trellis.SelectedIndex = 0;
\r
30 mainWindow.slider_psyrd.Value = 0;
\r
31 mainWindow.slider_psytrellis.Value = 0;
\r
32 mainWindow.drop_adaptBFrames.SelectedIndex = 0;
\r
34 mainWindow.rtf_x264Query.Text = "";
\r
38 /// Update GUI componets from the current x264 rtf string
\r
40 public void X264_SetCurrentSettingsInPanel(frmMain mainWindow)
\r
42 /* Set widgets depending on the opt string in field */
\r
43 String thisOpt; // The separated option such as "bframes=3"
\r
44 String optName; // The option name such as "bframes"
\r
45 String optValue;// The option value such as "3"
\r
46 String[] currentOptsArray;
\r
48 //Set currentOptString to the contents of the text box.
\r
49 String currentOptString = mainWindow.rtf_x264Query.Text.Replace("\n", "");
\r
51 /*verify there is an opt string to process */
\r
52 if (currentOptString.Contains("="))
\r
54 /*Put individual options into an array based on the ":" separator for processing, result is "<opt>=<value>"*/
\r
55 currentOptsArray = currentOptString.Split(':');
\r
57 /*iterate through the array and get <opts> and <values*/
\r
59 int currentOptsArrayCount = currentOptsArray.Length;
\r
62 /*iterate through the array and get <opts> and <values*/
\r
63 for (loopcounter = 0; loopcounter < currentOptsArrayCount; loopcounter++)
\r
66 thisOpt = currentOptsArray[loopcounter];
\r
67 String[] splitOptRange = thisOpt.Split('=');
\r
69 if (thisOpt.Contains("="))
\r
71 optName = splitOptRange[0];
\r
72 optValue = splitOptRange[1];
\r
74 /*Run through the available widgets for x264 opts and set them, as you add widgets,
\r
75 they need to be added here. This should be moved to its own method probably*/
\r
77 /*bframes NSPopUpButton*/
\r
78 if (optName.Equals("bframes"))
\r
79 mainWindow.drop_bFrames.SelectedItem = optValue;
\r
81 /*ref NSPopUpButton*/
\r
82 else if (optName.Equals("ref"))
\r
83 mainWindow.drop_refFrames.SelectedItem = optValue;
\r
85 /*No Fast PSkip NSPopUpButton*/
\r
86 else if (optName.Equals("no-fast-pskip"))
\r
87 mainWindow.check_noFastPSkip.CheckState = CheckState.Checked;
\r
89 /*No Dict Decimate NSPopUpButton*/
\r
90 else if (optName.Equals("no-dct-decimate"))
\r
91 mainWindow.check_noDCTDecimate.CheckState = CheckState.Checked;
\r
93 /*Sub Me NSPopUpButton*/
\r
94 else if (optName.Equals("subq"))
\r
95 mainWindow.drop_subpixelMotionEstimation.SelectedItem = optValue;
\r
97 /*Trellis NSPopUpButton*/
\r
98 else if (optName.Equals("trellis"))
\r
99 mainWindow.drop_trellis.SelectedItem = optValue;
\r
101 /*Mixed Refs NSButton*/
\r
102 else if (optName.Equals("mixed-refs"))
\r
103 mainWindow.check_mixedReferences.CheckState = CheckState.Checked;
\r
105 /*Motion Estimation NSPopUpButton*/
\r
106 else if (optName.Equals("me"))
\r
108 if (optValue.Equals("dia"))
\r
109 mainWindow.drop_MotionEstimationMethod.SelectedItem = "Diamond";
\r
110 else if (optValue.Equals("hex"))
\r
111 mainWindow.drop_MotionEstimationMethod.SelectedItem = "Hexagon";
\r
112 else if (optValue.Equals("umh"))
\r
113 mainWindow.drop_MotionEstimationMethod.SelectedItem = "Uneven Multi-Hexagon";
\r
114 else if (optValue.Equals("esa"))
\r
115 mainWindow.drop_MotionEstimationMethod.SelectedItem = "Exhaustive";
\r
116 else if (optValue.Equals("tesa"))
\r
117 mainWindow.drop_MotionEstimationMethod.SelectedItem = "Transformed Exhaustive";
\r
120 /*ME Range NSPopUpButton*/
\r
121 else if (optName.Equals("merange"))
\r
122 mainWindow.drop_MotionEstimationRange.SelectedItem = optValue;
\r
124 else if (optName.Equals("b-adapt"))
\r
125 mainWindow.drop_adaptBFrames.SelectedItem = optValue;
\r
127 /*Weighted B-Frames NSPopUpButton*/
\r
128 else if (optName.Equals("weightb"))
\r
129 mainWindow.check_weightedBFrames.CheckState = CheckState.Checked;
\r
131 /*B Pyramid NSPopUpButton*/
\r
132 else if (optName.Equals("b-pyramid"))
\r
133 mainWindow.check_pyrmidalBFrames.CheckState = CheckState.Checked;
\r
135 /*Direct B-frame Prediction NSPopUpButton*/
\r
136 else if (optName.Equals("direct"))
\r
138 if (optValue == "auto")
\r
139 optValue = "Automatic";
\r
141 if (optValue != "")
\r
143 Char[] letters = optValue.ToCharArray();
\r
144 letters[0] = Char.ToUpper(letters[0]);
\r
145 optValue = new string(letters);
\r
148 mainWindow.drop_directPrediction.SelectedItem = optValue;
\r
151 /*Deblocking NSPopUpButtons*/
\r
152 else if (optName.Equals("deblock"))
\r
154 string[] splitDeblock = optValue.Split(',');
\r
155 string alphaDeblock = splitDeblock[0];
\r
156 string betaDeblock = splitDeblock[1];
\r
158 if (alphaDeblock.Equals("0") && betaDeblock.Replace("\n", "").Equals("0"))
\r
160 mainWindow.drop_deblockAlpha.SelectedItem = "Default (0)";
\r
161 mainWindow.drop_deblockBeta.SelectedItem = "Default (0)";
\r
165 if (!alphaDeblock.Equals("0"))
\r
166 mainWindow.drop_deblockAlpha.SelectedItem = alphaDeblock;
\r
168 mainWindow.drop_deblockAlpha.SelectedItem = "0";
\r
170 if (!betaDeblock.Replace("\n", "").Equals("0"))
\r
171 mainWindow.drop_deblockBeta.SelectedItem = betaDeblock.Replace("\n", "");
\r
173 mainWindow.drop_deblockBeta.SelectedItem = "0";
\r
176 /* Analysis NSPopUpButton */
\r
177 else if (optName.Equals("analyse"))
\r
180 if (optValue.Equals("p8x8,b8x8,i8x8,i4x4"))
\r
181 mainWindow.drop_analysis.SelectedItem = "Default (some)";
\r
182 if (optValue.Equals("none"))
\r
183 mainWindow.drop_analysis.SelectedItem = "None";
\r
184 if (optValue.Equals("all"))
\r
185 mainWindow.drop_analysis.SelectedItem = "All";
\r
187 /* 8x8 DCT NSButton */
\r
188 else if (optName.Equals("8x8dct"))
\r
189 mainWindow.check_8x8DCT.CheckState = CheckState.Checked;
\r
191 /* CABAC NSButton */
\r
192 else if (optName.Equals("cabac"))
\r
193 mainWindow.check_Cabac.CheckState = CheckState.Unchecked;
\r
195 /* Psy-RD and Psy-Trellis NSSliders */
\r
196 else if (optName.Equals("psy-rd"))
\r
198 string[] x = optValue.Split(',');
\r
200 double psyrd = 0, psytrellis = 0;
\r
202 double.TryParse(x[0], out psyrd);
\r
203 double.TryParse(x[1], out psytrellis);
\r
205 psyrd = psyrd * 10;
\r
206 psytrellis = psytrellis * 10;
\r
208 int.TryParse(psyrd.ToString(), out val);
\r
209 int.TryParse(psytrellis.ToString(), out val2);
\r
211 mainWindow.slider_psyrd.Value = val;
\r
212 mainWindow.slider_psytrellis.Value = val2;
\r
220 /// Iterate over every x264 option, standardize it, write the full string to the x264 rtf box
\r
222 public void X264_StandardizeOptString(frmMain mainWindow)
\r
224 /* Set widgets depending on the opt string in field */
\r
225 String thisOpt; // The separated option such as "bframes=3"
\r
226 String optName; // The option name such as "bframes"
\r
227 String optValue;// The option value such as "3"
\r
228 String changedOptString = "";
\r
229 String[] currentOptsArray;
\r
231 /*First, we get an opt string to process */
\r
232 String currentOptString = mainWindow.rtf_x264Query.Text;
\r
234 /*verify there is an opt string to process */
\r
235 if (currentOptString.Contains("="))
\r
237 /*Put individual options into an array based on the ":" separator for processing, result is "<opt>=<value>"*/
\r
238 currentOptsArray = currentOptString.Split(':');
\r
240 /*iterate through the array and get <opts> and <values*/
\r
241 //NSEnumerator * enumerator = [currentOptsArray objectEnumerator];
\r
243 int currentOptsArrayCount = currentOptsArray.Length;
\r
244 for (loopcounter = 0; loopcounter < currentOptsArrayCount; loopcounter++)
\r
246 thisOpt = currentOptsArray[loopcounter];
\r
247 if (currentOptsArray[currentOptsArrayCount - 1] == string.Empty)
\r
250 String[] splitOptRange = thisOpt.Split('=');
\r
253 if (thisOpt.Contains("="))
\r
255 optName = splitOptRange[0];
\r
256 optValue = splitOptRange[1];
\r
258 /* Standardize the names here depending on whats in the string */
\r
259 optName = X264_StandardizeOptNames(optName);
\r
260 thisOpt = optName + "=" + optValue;
\r
262 else // No value given so we use a default of "1"
\r
265 /* Standardize the names here depending on whats in the string */
\r
266 optName = X264_StandardizeOptNames(optName);
\r
267 thisOpt = optName + "=1";
\r
271 /* Construct New String for opts here */
\r
272 if (thisOpt == string.Empty)
\r
273 changedOptString = changedOptString + thisOpt;
\r
276 if (changedOptString == string.Empty)
\r
277 changedOptString = thisOpt;
\r
279 changedOptString = changedOptString + ":" + thisOpt;
\r
284 /* Change the option string to reflect the new standardized option string */
\r
285 if (changedOptString != "")
\r
286 mainWindow.rtf_x264Query.Text = changedOptString;
\r
289 * Take a single option and standardize it. Returns as a String
\r
290 * Input: String. - Single X264 Option. Name only
\r
291 * Output: String - Single X264 Option. Name only. Changed to standard format
\r
293 private string X264_StandardizeOptNames(String cleanOptNameString)
\r
295 String input = cleanOptNameString;
\r
297 if (input.Equals("ref") || input.Equals("frameref"))
\r
298 cleanOptNameString = "ref";
\r
300 /*No Fast PSkip nofast_pskip*/
\r
301 if (input.Equals("no-fast-pskip") || input.Equals("no_fast_pskip") || input.Equals("nofast_pskip"))
\r
302 cleanOptNameString = "no-fast-pskip";
\r
304 /*No Dict Decimate*/
\r
305 if (input.Equals("no-dct-decimate") || input.Equals("no_dct_decimate") || input.Equals("nodct_decimate"))
\r
306 cleanOptNameString = "no-dct-decimate";
\r
309 if (input.Equals("subme"))
\r
310 cleanOptNameString = "subq";
\r
313 if (input.Equals("me-range") || input.Equals("me_range"))
\r
314 cleanOptNameString = "merange";
\r
317 if (input.Equals("weight-b") || input.Equals("weight_b"))
\r
318 cleanOptNameString = "weightb";
\r
321 if (input.Equals("b_pyramid"))
\r
322 cleanOptNameString = "b-pyramid";
\r
324 /*Direct Prediction*/
\r
325 if (input.Equals("direct-pred") || input.Equals("direct_pred"))
\r
326 cleanOptNameString = "direct";
\r
329 if (input.Equals("filter"))
\r
330 cleanOptNameString = "deblock";
\r
333 if (input.Equals("partitions"))
\r
334 cleanOptNameString = "analyse";
\r
336 return cleanOptNameString;
\r
340 /// This function will update the X264 Query when one of the GUI widgets changes.
\r
342 public void on_x264_WidgetChange(string sender, frmMain mainWindow)
\r
344 animate(mainWindow, sender);
\r
345 String optNameToChange = sender;
\r
346 String currentOptString = mainWindow.rtf_x264Query.Text;
\r
348 /*First, we create a pattern to check for ":"optNameToChange"=" to modify the option if the name falls after
\r
349 the first character of the opt string (hence the ":") */
\r
350 String checkOptNameToChange = ":" + optNameToChange + "=";
\r
351 String checkOptNameToChangeBegin = optNameToChange + "=";
\r
353 // IF the current H264 Option String Contains Multiple Items or Just 1 Item
\r
354 if ((currentOptString.Contains(checkOptNameToChange)) || (currentOptString.StartsWith(checkOptNameToChangeBegin)))
\r
355 hasOptions(currentOptString, optNameToChange, mainWindow);
\r
356 else // IF there is no options in the rich text box!
\r
357 hasNoOptions(optNameToChange, mainWindow);
\r
360 * Used by on_x264_WidgetChange()
\r
361 ** hasOptions - Called when the current x264 option string contains multiple (or a single) item(s) in it seperated by :
\r
362 * it updates the current option that the widget corrosponds to, if it is already in thes string.
\r
363 ** hasNoOptions - Add's an option to the x264 query string.
\r
364 * Handles 2 cases. 1 Where rtf_x264Query.Text is empty, and one where there is an option with no value,
\r
365 * e.g no-fast-pskip
\r
367 private void hasOptions(string currentOptString, string optNameToChange, frmMain mainWindow)
\r
369 String thisOpt; // The separated option such as "bframes=3"
\r
370 String optName; // The option name such as "bframes"
\r
371 String[] currentOptsArray;
\r
373 /* Create new empty opt string*/
\r
374 String changedOptString = "";
\r
376 /*Put individual options into an array based on the ":" separator for processing, result is "<opt>=<value>"*/
\r
377 currentOptsArray = currentOptString.Split(':');
\r
379 /*iterate through the array and get <opts> and <values*/
\r
380 for (int loopcounter = 0; loopcounter < currentOptsArray.Length; loopcounter++)
\r
382 thisOpt = currentOptsArray[loopcounter];
\r
384 if (thisOpt.Contains("="))
\r
386 string[] splitOptRange = thisOpt.Split('=');
\r
388 optName = splitOptRange[0]; // e.g bframes
\r
391 * Run through the available widgets for x264 opts and set them, as you add widgets,
\r
392 * they need to be added here. This should be moved to its own method probably
\r
393 * If the optNameToChange is found, appropriately change the value or delete it if
\r
394 * "unspecified" is set.
\r
396 if (optName.Equals(optNameToChange))
\r
398 if (optNameToChange.Equals("deblock"))
\r
400 String da = mainWindow.drop_deblockAlpha.SelectedItem.ToString();
\r
401 String db = mainWindow.drop_deblockBeta.SelectedItem.ToString();
\r
403 if (((da.Contains("Default")) && (db.Contains("Default"))) || ((da.Contains("0")) && (db.Contains("0"))))
\r
405 mainWindow.drop_deblockBeta.SelectedItem = "Default (0)";
\r
406 mainWindow.drop_deblockAlpha.SelectedItem = "Default (0)";
\r
409 else if ((!da.Contains("Default")) && (db.Contains("Default")))
\r
411 mainWindow.drop_deblockBeta.SelectedItem = "0";
\r
412 thisOpt = "deblock=" + da + ",0";
\r
414 else if ((da.Contains("Default")) && (!db.Contains("Default")))
\r
416 mainWindow.drop_deblockAlpha.SelectedItem = "0";
\r
417 thisOpt = "deblock=0," + db;
\r
419 else if ((!da.Contains("Default")) && (!db.Contains("Default")))
\r
420 thisOpt = "deblock=" + da + "," + db;
\r
422 else if (optNameToChange.Equals("psy-rd"))
\r
424 if (mainWindow.slider_psyrd.Value == 10 && mainWindow.slider_psytrellis.Value == 0)
\r
428 double psyrd = mainWindow.slider_psyrd.Value * 0.1;
\r
429 double psytre = mainWindow.slider_psytrellis.Value * 0.1;
\r
434 rd = psyrd.ToString();
\r
439 rt = psytre.ToString();
\r
441 thisOpt = "psy-rd=" + rd + "," + rt;
\r
444 else if (optNameToChange.Equals("mixed-refs"))
\r
446 if (mainWindow.check_mixedReferences.CheckState == CheckState.Checked)
\r
447 thisOpt = "mixed-refs=1";
\r
451 else if (optNameToChange.Equals("weightb"))
\r
453 if (mainWindow.check_weightedBFrames.CheckState == CheckState.Checked)
\r
454 thisOpt = "weightb=1";
\r
458 else if (optNameToChange.Equals("b-pyramid"))
\r
460 if (mainWindow.check_pyrmidalBFrames.CheckState == CheckState.Checked)
\r
461 thisOpt = "b-pyramid=1";
\r
465 else if (optNameToChange.Equals("no-fast-pskip"))
\r
467 if (mainWindow.check_noFastPSkip.CheckState == CheckState.Checked)
\r
468 thisOpt = "no-fast-pskip=1";
\r
472 else if (optNameToChange.Equals("no-dct-decimate"))
\r
474 if (mainWindow.check_noDCTDecimate.CheckState == CheckState.Checked)
\r
475 thisOpt = "no-dct-decimate=1";
\r
479 else if (optNameToChange.Equals("8x8dct"))
\r
481 if (mainWindow.check_8x8DCT.CheckState == CheckState.Checked)
\r
482 thisOpt = "8x8dct=1";
\r
486 else if (optNameToChange.Equals("cabac"))
\r
488 if (mainWindow.check_Cabac.CheckState == CheckState.Checked)
\r
491 thisOpt = "cabac=0";
\r
493 else if (optNameToChange.Equals("me"))
\r
495 switch (mainWindow.drop_MotionEstimationMethod.SelectedIndex)
\r
498 thisOpt = "me=dia";
\r
502 thisOpt = "me=hex";
\r
506 thisOpt = "me=umh";
\r
510 thisOpt = "me=esa";
\r
514 thisOpt = "me=tesa";
\r
522 else if (optNameToChange.Equals("direct"))
\r
524 switch (mainWindow.drop_directPrediction.SelectedIndex)
\r
527 thisOpt = "direct=none";
\r
531 thisOpt = "direct=spatial";
\r
535 thisOpt = "direct=temporal";
\r
539 thisOpt = "direct=auto";
\r
547 else if (optNameToChange.Equals("analyse"))
\r
549 switch (mainWindow.drop_analysis.SelectedIndex)
\r
552 thisOpt = "analyse=none";
\r
556 thisOpt = "analyse=all";
\r
564 else if (optNameToChange.Equals("merange"))
\r
566 if (!mainWindow.drop_MotionEstimationRange.SelectedItem.ToString().Contains("Default"))
\r
567 thisOpt = "merange=" + mainWindow.drop_MotionEstimationRange.SelectedItem;
\r
571 else if (optNameToChange.Equals("b-adapt"))
\r
573 if (!mainWindow.drop_adaptBFrames.SelectedItem.ToString().Contains("Default"))
\r
574 thisOpt = "b-adapt=" + (mainWindow.drop_adaptBFrames.SelectedIndex - 1);
\r
578 else if (optNameToChange.Equals("ref"))
\r
580 if (!mainWindow.drop_refFrames.SelectedItem.ToString().Contains("Default"))
\r
581 thisOpt = "ref=" + mainWindow.drop_refFrames.SelectedItem;
\r
585 else if (optNameToChange.Equals("bframes"))
\r
587 String value = mainWindow.drop_bFrames.SelectedItem.ToString();
\r
588 if (!mainWindow.drop_bFrames.SelectedItem.ToString().Contains("Default"))
\r
589 thisOpt = "bframes=" + value;
\r
593 else if (optNameToChange.Equals("subq"))
\r
595 String value = mainWindow.drop_subpixelMotionEstimation.SelectedItem.ToString();
\r
596 if (!mainWindow.drop_subpixelMotionEstimation.SelectedItem.ToString().Contains("Default"))
\r
597 thisOpt = "subq=" + value;
\r
601 else if (optNameToChange.Equals("trellis"))
\r
603 String value = mainWindow.drop_trellis.SelectedItem.ToString();
\r
604 if (!mainWindow.drop_trellis.SelectedItem.ToString().Contains("Default"))
\r
605 thisOpt = "trellis=" + value;
\r
612 /* Construct New String for opts here */
\r
613 if (!thisOpt.Equals(""))
\r
615 if (changedOptString.Equals(""))
\r
616 changedOptString = thisOpt;
\r
618 changedOptString = changedOptString + ":" + thisOpt;
\r
622 /* Change the option string to reflect the new mod settings */
\r
623 mainWindow.rtf_x264Query.Text = changedOptString;
\r
625 private void hasNoOptions(string optNameToChange, frmMain mainWindow)
\r
628 if (mainWindow.rtf_x264Query.Text != "")
\r
631 string query = mainWindow.rtf_x264Query.Text;
\r
632 if (optNameToChange.Equals("me"))
\r
634 switch (mainWindow.drop_MotionEstimationMethod.SelectedIndex)
\r
637 query = query + colon + "me=dia";
\r
641 query = query + colon + "me=hex";
\r
645 query = query + colon + "me=umh";
\r
649 query = query + colon + "me=esa";
\r
653 query = query + colon + "me=tesa";
\r
660 else if (optNameToChange.Equals("direct"))
\r
662 switch (mainWindow.drop_directPrediction.SelectedIndex)
\r
665 query = query + colon + "direct=none";
\r
669 query = query + colon + "direct=spatial";
\r
673 query = query + colon + "direct=temporal";
\r
677 query = query + colon + "direct=auto";
\r
684 else if (optNameToChange.Equals("analyse"))
\r
686 switch (mainWindow.drop_analysis.SelectedIndex)
\r
689 query = query + colon + "analyse=none";
\r
693 query = query + colon + "analyse=all";
\r
700 else if (optNameToChange.Equals("merange"))
\r
702 int value = mainWindow.drop_MotionEstimationRange.SelectedIndex + 3;
\r
703 query = query + colon + "merange=" + value;
\r
705 else if (optNameToChange.Equals("b-adapt"))
\r
707 int value = mainWindow.drop_adaptBFrames.SelectedIndex -1;
\r
708 query = query + colon + "b-adapt=" + value;
\r
711 else if (optNameToChange.Equals("deblock"))
\r
713 String da = mainWindow.drop_deblockAlpha.SelectedItem.ToString();
\r
714 String db = mainWindow.drop_deblockBeta.Text;
\r
716 if (((da.Contains("Default")) && (db.Contains("Default"))) || ((da.Contains("0")) && (db.Contains("0"))))
\r
718 mainWindow.drop_deblockBeta.SelectedItem = "Default (0)";
\r
719 mainWindow.drop_deblockAlpha.SelectedItem = "Default (0)";
\r
723 if (db.Contains("Default"))
\r
726 if (da.Contains("Default"))
\r
729 query = query + colon + "deblock=" + da + "," + db;
\r
732 else if (optNameToChange.Equals("psy-rd"))
\r
734 if (mainWindow.slider_psyrd.Value == 10 && mainWindow.slider_psytrellis.Value == 0)
\r
738 double psyrd = mainWindow.slider_psyrd.Value * 0.1;
\r
739 double psytre = mainWindow.slider_psytrellis.Value * 0.1;
\r
744 rd = psyrd.ToString();
\r
749 rt = psytre.ToString();
\r
751 query += colon + "psy-rd=" + rd + "," + rt;
\r
754 else if (optNameToChange.Equals("mixed-refs"))
\r
756 if (mainWindow.check_mixedReferences.CheckState == CheckState.Checked)
\r
757 query = query + colon + "mixed-refs=1";
\r
759 else if (optNameToChange.Equals("weightb"))
\r
761 if (mainWindow.check_weightedBFrames.CheckState == CheckState.Checked)
\r
762 query = query + colon + "weightb=1";
\r
764 else if (optNameToChange.Equals("b-pyramid"))
\r
766 if (mainWindow.check_pyrmidalBFrames.CheckState == CheckState.Checked)
\r
767 query = query + colon + "b-pyramid=1";
\r
769 else if (optNameToChange.Equals("no-fast-pskip"))
\r
771 if (mainWindow.check_noFastPSkip.CheckState == CheckState.Checked)
\r
772 query = query + colon + "no-fast-pskip=1";
\r
774 else if (optNameToChange.Equals("no-dct-decimate"))
\r
776 if (mainWindow.check_noDCTDecimate.CheckState == CheckState.Checked)
\r
777 query = query + colon + "no-dct-decimate=1";
\r
779 else if (optNameToChange.Equals("8x8dct"))
\r
781 if (mainWindow.check_8x8DCT.CheckState == CheckState.Checked)
\r
782 query = query + colon + "8x8dct=1";
\r
784 else if (optNameToChange.Equals("cabac"))
\r
786 if (mainWindow.check_Cabac.CheckState != CheckState.Checked)
\r
787 query = query + colon + "cabac=0";
\r
789 else if (optNameToChange.Equals("ref"))
\r
791 if (!mainWindow.drop_refFrames.SelectedItem.ToString().Contains("Default"))
\r
792 query = query + colon + "ref=" + mainWindow.drop_refFrames.SelectedItem;
\r
794 else if (optNameToChange.Equals("bframes"))
\r
796 String value = mainWindow.drop_bFrames.SelectedItem.ToString();
\r
797 if (!mainWindow.drop_bFrames.SelectedItem.ToString().Contains("Default"))
\r
798 query = query + colon + "bframes=" + value;
\r
800 else if (optNameToChange.Equals("subq"))
\r
802 String value = mainWindow.drop_subpixelMotionEstimation.SelectedItem.ToString();
\r
803 if (!mainWindow.drop_subpixelMotionEstimation.SelectedItem.ToString().Contains("Default"))
\r
804 query = query + colon + "subq=" + value;
\r
806 else if (optNameToChange.Equals("trellis"))
\r
808 if (!mainWindow.drop_trellis.SelectedItem.ToString().Contains("Default"))
\r
809 query = query + colon + "trellis=" + mainWindow.drop_trellis.SelectedItem;
\r
812 mainWindow.rtf_x264Query.Text = query;
\r
814 private void animate(frmMain mainWindow, string sender)
\r
816 /* Lots of situations to cover.
\r
817 - B-frames (when 0 turn of b-frame specific stuff, when < 2 disable b-pyramid)
\r
818 - CABAC (when 0 turn off trellis)
\r
819 - analysis (if none, turn off 8x8dct)
\r
820 - refs (under 2, disable mixed-refs)
\r
822 if (mainWindow.drop_bFrames.SelectedIndex < 2)
\r
824 /* If the b-frame widget is at 0 or 1, the user has chosen
\r
825 not to use b-frames at all. So disable the options
\r
826 that can only be used when b-frames are enabled. */
\r
827 mainWindow.check_weightedBFrames.Visible = false;
\r
828 mainWindow.check_pyrmidalBFrames.Visible = false;
\r
829 mainWindow.drop_directPrediction.Visible = false;
\r
830 mainWindow.lbl_direct_prediction.Visible = false;
\r
832 mainWindow.check_weightedBFrames.CheckState = CheckState.Unchecked;
\r
833 mainWindow.check_pyrmidalBFrames.CheckState = CheckState.Unchecked;
\r
834 mainWindow.drop_directPrediction.SelectedIndex = 0;
\r
836 mainWindow.drop_adaptBFrames.Visible = false;
\r
837 mainWindow.lbl_adaptBFrames.Visible = false;
\r
838 mainWindow.drop_adaptBFrames.SelectedIndex = 0;
\r
840 else if (mainWindow.drop_bFrames.SelectedIndex == 2)
\r
842 /* Only 1 b-frame? Disable b-pyramid. */
\r
843 mainWindow.check_pyrmidalBFrames.Visible = false;
\r
844 mainWindow.check_pyrmidalBFrames.CheckState = CheckState.Unchecked;
\r
846 mainWindow.check_weightedBFrames.Visible = true;
\r
847 mainWindow.drop_directPrediction.Visible = true;
\r
848 mainWindow.lbl_direct_prediction.Visible = true;
\r
850 mainWindow.drop_adaptBFrames.Visible = true;
\r
851 mainWindow.lbl_adaptBFrames.Visible = true;
\r
855 mainWindow.check_weightedBFrames.Visible = true;
\r
856 mainWindow.check_pyrmidalBFrames.Visible = true;
\r
857 mainWindow.drop_directPrediction.Visible = true;
\r
858 mainWindow.lbl_direct_prediction.Visible = true;
\r
860 mainWindow.drop_adaptBFrames.Visible = true;
\r
861 mainWindow.lbl_adaptBFrames.Visible = true;
\r
864 if (mainWindow.check_Cabac.Checked == false)
\r
866 /* Without CABAC entropy coding, trellis doesn't run. */
\r
867 mainWindow.drop_trellis.Visible = false;
\r
868 mainWindow.drop_trellis.SelectedIndex = 0;
\r
869 mainWindow.lbl_trellis.Visible = false;
\r
873 mainWindow.drop_trellis.Visible = true;
\r
874 mainWindow.lbl_trellis.Visible = true;
\r
877 if (mainWindow.drop_analysis.SelectedIndex == 1)
\r
879 /* No analysis? Disable 8x8dct */
\r
880 mainWindow.check_8x8DCT.Visible = false;
\r
881 if (sender != "8x8dct")
\r
882 mainWindow.check_8x8DCT.CheckState = CheckState.Unchecked;
\r
885 mainWindow.check_8x8DCT.Visible = true;
\r
887 if (mainWindow.drop_refFrames.SelectedIndex < 3)
\r
889 mainWindow.check_mixedReferences.Visible = false;
\r
890 if (sender != "mixed-refs")
\r
891 mainWindow.check_mixedReferences.CheckState = CheckState.Unchecked;
\r
894 mainWindow.check_mixedReferences.Visible = true;
\r
896 if (mainWindow.drop_MotionEstimationMethod.SelectedIndex < 3)
\r
898 mainWindow.drop_MotionEstimationRange.Visible = false;
\r
899 mainWindow.lbl_merange.Visible = false;
\r
900 mainWindow.drop_MotionEstimationRange.SelectedIndex = 0;
\r
904 mainWindow.drop_MotionEstimationRange.Visible = true;
\r
905 mainWindow.lbl_merange.Visible = true;
\r
908 if (mainWindow.drop_subpixelMotionEstimation.SelectedIndex != 0 && mainWindow.drop_subpixelMotionEstimation.SelectedIndex < 7)
\r
910 mainWindow.slider_psyrd.Visible = false;
\r
911 mainWindow.slider_psyrd.Value = 10;
\r
912 mainWindow.lbl_psyrd.Visible = false;
\r
915 mainWindow.slider_psytrellis.Visible = false;
\r
916 mainWindow.slider_psytrellis.Value = 0;
\r
917 mainWindow.lbl_psytrellis.Visible = false;
\r
921 mainWindow.slider_psyrd.Visible = true;
\r
922 mainWindow.lbl_psyrd.Visible = true;
\r
924 if (mainWindow.drop_trellis.SelectedIndex >= 2 && mainWindow.check_Cabac.Checked && mainWindow.slider_psytrellis.Visible == false)
\r
926 mainWindow.slider_psytrellis.Visible = true;
\r
927 mainWindow.lbl_psytrellis.Visible = true;
\r
931 if (mainWindow.drop_trellis.SelectedIndex < 2)
\r
933 mainWindow.slider_psytrellis.Visible = false;
\r
934 mainWindow.slider_psytrellis.Value = 0;
\r
935 mainWindow.lbl_psytrellis.Visible = false;
\r
939 if ((mainWindow.drop_subpixelMotionEstimation.SelectedIndex == 0 || mainWindow.drop_subpixelMotionEstimation.SelectedIndex >= 7) && mainWindow.check_Cabac.Checked && mainWindow.slider_psytrellis.Visible == false)
\r
941 mainWindow.slider_psytrellis.Visible = true;
\r
942 mainWindow.lbl_psytrellis.Visible = true;
\r