]> git.sesse.net Git - x264/blob - gtk/x264_gtk_more.c
Update file headers throughout x264
[x264] / gtk / x264_gtk_more.c
1 /*****************************************************************************
2  * x264_gtk_more.c: h264 gtk encoder frontend
3  *****************************************************************************
4  * Copyright (C) 2006 Vincent Torri
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111, USA.
19  *****************************************************************************/
20
21 #include <gtk/gtk.h>
22
23 #include "x264_gtk_i18n.h"
24 #include "x264_gtk_private.h"
25
26
27 /* Callbacks */
28 static void x264_more_deblocking_filter (GtkToggleButton *button,
29                                      gpointer         user_data);
30 static void x264_more_cabac             (GtkToggleButton *button,
31                                      gpointer         user_data);
32 static void x264_more_mixed_ref         (GtkToggleButton *button,
33                                      gpointer         user_data);
34
35
36 GtkWidget *
37 x264_more_page (X264_Gui_Config *config)
38 {
39   GtkWidget     *vbox;
40   GtkWidget     *frame;
41   GtkWidget     *hbox;
42   GtkWidget     *table;
43   GtkWidget     *eb;
44   GtkWidget     *label;
45   GtkObject     *adj;
46   GtkRequisition size;
47   GtkRequisition size2;
48   GtkRequisition size3;
49   GtkRequisition size4;
50   GtkRequisition size5;
51   GtkTooltips   *tooltips;
52
53   tooltips = gtk_tooltips_new ();
54
55   label = gtk_entry_new_with_max_length (3);
56   gtk_widget_size_request (label, &size);
57   gtk_widget_destroy (GTK_WIDGET (label));
58
59   label = gtk_check_button_new_with_label (_("Deblocking Filter"));
60   gtk_widget_size_request (label, &size2);
61   gtk_widget_destroy (GTK_WIDGET (label));
62
63   label = gtk_label_new (_("Partition decision"));
64   gtk_widget_size_request (label, &size3);
65   gtk_widget_destroy (GTK_WIDGET (label));
66
67   label = gtk_label_new (_("Threshold"));
68   gtk_widget_size_request (label, &size5);
69   gtk_widget_destroy (GTK_WIDGET (label));
70
71   vbox = gtk_vbox_new (FALSE, 0);
72   gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
73
74   /* Motion Estimation */
75   frame = gtk_frame_new (_("Motion Estimation"));
76   gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 6);
77   gtk_widget_show (frame);
78
79   table = gtk_table_new (5, 3, TRUE);
80   gtk_table_set_row_spacings (GTK_TABLE (table), 6);
81   gtk_table_set_col_spacings (GTK_TABLE (table), 6);
82   gtk_container_set_border_width (GTK_CONTAINER (table), 6);
83   gtk_container_add (GTK_CONTAINER (frame), table);
84   gtk_widget_show (table);
85
86   eb = gtk_event_box_new ();
87   gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE);
88   gtk_tooltips_set_tip (tooltips, eb,
89                         _("Partition decision - description"),
90                         "");
91   gtk_table_attach_defaults (GTK_TABLE (table), eb,
92                              0, 1, 0, 1);
93   gtk_widget_show (eb);
94
95   label = gtk_label_new (_("Partition decision"));
96   gtk_widget_set_size_request (label, size2.width, size3.height);
97   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
98   gtk_container_add (GTK_CONTAINER (eb), label);
99   gtk_widget_show (label);
100
101   config->more.motion_estimation.partition_decision = gtk_combo_box_new_text ();
102   gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.motion_estimation.partition_decision),
103                              _("1 (Fastest)"));
104   gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.motion_estimation.partition_decision),
105                              "2");
106   gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.motion_estimation.partition_decision),
107                              "3");
108   gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.motion_estimation.partition_decision),
109                              "4");
110   gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.motion_estimation.partition_decision),
111                              _("5 (High quality)"));
112   gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.motion_estimation.partition_decision),
113                              _("6 (RDO)"));
114   gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.motion_estimation.partition_decision),
115                              _("6b (RDO on B frames)"));
116   gtk_table_attach_defaults (GTK_TABLE (table), config->more.motion_estimation.partition_decision,
117                              1, 3, 0, 1);
118   gtk_widget_show (config->more.motion_estimation.partition_decision);
119
120   eb = gtk_event_box_new ();
121   gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE);
122   gtk_tooltips_set_tip (tooltips, eb,
123                         _("Method - description"),
124                         "");
125   gtk_table_attach_defaults (GTK_TABLE (table), eb,
126                              0, 1, 1, 2);
127   gtk_widget_show (eb);
128
129   label = gtk_label_new (_("Method"));
130   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
131   gtk_container_add (GTK_CONTAINER (eb), label);
132   gtk_widget_show (label);
133
134   config->more.motion_estimation.method = gtk_combo_box_new_text ();
135   gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.motion_estimation.method),
136                              _("Diamond Search"));
137   gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.motion_estimation.method),
138                              _("Hexagonal Search"));
139   gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.motion_estimation.method),
140                              _("Uneven Multi-Hexagon"));
141   gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.motion_estimation.method),
142                              _("Exhaustive search"));
143   gtk_table_attach_defaults (GTK_TABLE (table), config->more.motion_estimation.method,
144                              1, 3, 1, 2);
145   gtk_widget_show (config->more.motion_estimation.method);
146
147   eb = gtk_event_box_new ();
148   gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE);
149   gtk_tooltips_set_tip (tooltips, eb,
150                         _("Range - description"),
151                         "");
152   gtk_table_attach_defaults (GTK_TABLE (table), eb,
153                              0, 1, 2, 3);
154   gtk_widget_show (eb);
155
156   label = gtk_label_new (_("Range"));
157   gtk_widget_size_request (label, &size4);
158   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
159   gtk_container_add (GTK_CONTAINER (eb), label);
160   gtk_widget_show (label);
161
162   config->more.motion_estimation.range = gtk_entry_new_with_max_length (3);
163   gtk_widget_set_size_request (config->more.motion_estimation.range,
164                                20, size.height);
165   gtk_table_attach_defaults (GTK_TABLE (table), config->more.motion_estimation.range,
166                              1, 2, 2, 3);
167   gtk_widget_show (config->more.motion_estimation.range);
168
169   config->more.motion_estimation.chroma_me = gtk_check_button_new_with_label (_("Chroma ME"));
170   gtk_tooltips_set_tip (tooltips, config->more.motion_estimation.chroma_me,
171                         _("Chroma ME - description"),
172                         "");
173   gtk_table_attach_defaults (GTK_TABLE (table), config->more.motion_estimation.chroma_me,
174                              2, 3, 2, 3);
175   gtk_widget_show (config->more.motion_estimation.chroma_me);
176
177   eb = gtk_event_box_new ();
178   gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE);
179   gtk_tooltips_set_tip (tooltips, eb,
180                         _("Max Ref. frames - description"),
181                         "");
182   gtk_table_attach_defaults (GTK_TABLE (table), eb,
183                              0, 1, 3, 4);
184   gtk_widget_show (eb);
185
186   label = gtk_label_new (_("Max Ref. frames"));
187   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
188   gtk_container_add (GTK_CONTAINER (eb), label);
189   gtk_widget_show (label);
190
191   config->more.motion_estimation.max_ref_frames = gtk_entry_new_with_max_length (3);
192   gtk_widget_set_size_request (config->more.motion_estimation.max_ref_frames,
193                                20, size.height);
194   gtk_table_attach_defaults (GTK_TABLE (table), config->more.motion_estimation.max_ref_frames,
195                              1, 2, 3, 4);
196   gtk_widget_show (config->more.motion_estimation.max_ref_frames);
197
198   config->more.motion_estimation.mixed_refs = gtk_check_button_new_with_label (_("Mixed Refs"));
199   gtk_tooltips_set_tip (tooltips, config->more.motion_estimation.mixed_refs,
200                         _("Mixed Refs - description"),
201                         "");
202   g_signal_connect (G_OBJECT (config->more.motion_estimation.mixed_refs),
203                     "toggled",
204                     G_CALLBACK (x264_more_mixed_ref), config);
205   gtk_table_attach_defaults (GTK_TABLE (table), config->more.motion_estimation.mixed_refs,
206                              2, 3, 3, 4);
207   gtk_widget_show (config->more.motion_estimation.mixed_refs);
208
209   config->more.motion_estimation.fast_pskip = gtk_check_button_new_with_label (_("Fast P skip"));
210   gtk_tooltips_set_tip (tooltips, config->more.motion_estimation.fast_pskip,
211                         _("Fast P skip - description"),
212                         "");
213   gtk_table_attach_defaults (GTK_TABLE (table), config->more.motion_estimation.fast_pskip,
214                              0, 1, 4, 5);
215   gtk_widget_show (config->more.motion_estimation.fast_pskip);
216
217   config->more.motion_estimation.dct_decimate = gtk_check_button_new_with_label (_("DCT decimate"));
218   gtk_tooltips_set_tip (tooltips, config->more.motion_estimation.dct_decimate,
219                         _("DCT decimate - description"),
220                         "");
221   gtk_table_attach_defaults (GTK_TABLE (table), config->more.motion_estimation.dct_decimate,
222                              1, 2, 4, 5);
223   gtk_widget_show (config->more.motion_estimation.dct_decimate);
224
225   /* Misc. Options */
226   frame = gtk_frame_new (_("Misc. Options"));
227   gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 6);
228   gtk_widget_show (frame);
229
230   table = gtk_table_new (5, 4, FALSE);
231   gtk_table_set_row_spacings (GTK_TABLE (table), 6);
232   gtk_table_set_col_spacings (GTK_TABLE (table), 6);
233   gtk_container_set_border_width (GTK_CONTAINER (table), 6);
234   gtk_container_add (GTK_CONTAINER (frame), table);
235   gtk_widget_show (table);
236
237   eb = gtk_event_box_new ();
238   gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE);
239   gtk_tooltips_set_tip (tooltips, eb,
240                         _("Sample Aspect Ratio - description"),
241                         "");
242   gtk_table_attach_defaults (GTK_TABLE (table), eb,
243                              0, 1, 0, 1);
244   gtk_widget_show (eb);
245
246   label = gtk_label_new (_("Sample Aspect Ratio"));
247   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
248   gtk_container_add (GTK_CONTAINER (eb), label);
249   gtk_widget_show (label);
250
251   hbox = gtk_hbox_new (TRUE, 6);
252   gtk_table_attach_defaults (GTK_TABLE (table), hbox,
253                              1, 2, 0, 1);
254   gtk_widget_show (hbox);
255
256   config->more.misc.sample_ar_x = gtk_entry_new_with_max_length (3);
257   gtk_widget_set_size_request (config->more.misc.sample_ar_x, 25, size.height);
258   gtk_box_pack_start (GTK_BOX (hbox), config->more.misc.sample_ar_x, FALSE, TRUE, 0);
259   gtk_widget_show (config->more.misc.sample_ar_x);
260
261   config->more.misc.sample_ar_y = gtk_entry_new_with_max_length (3);
262   gtk_widget_set_size_request (config->more.misc.sample_ar_y, 25, size.height);
263   gtk_box_pack_start (GTK_BOX (hbox), config->more.misc.sample_ar_y, FALSE, TRUE, 0);
264   gtk_widget_show (config->more.misc.sample_ar_y);
265
266   eb = gtk_event_box_new ();
267   gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE);
268   gtk_tooltips_set_tip (tooltips, eb,
269                         _("Threads - description"),
270                         "");
271   gtk_table_attach_defaults (GTK_TABLE (table), eb,
272                              2, 3, 0, 1);
273   gtk_widget_show (eb);
274
275   label = gtk_label_new (_("Threads"));
276   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
277   gtk_container_add (GTK_CONTAINER (eb), label);
278   gtk_widget_show (label);
279
280   adj = gtk_adjustment_new (1.0, 1.0, 4.0, 1.0, 1.0, 1.0);
281   config->more.misc.threads = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 1.0, 0);
282
283   gtk_widget_set_size_request (config->more.misc.threads, size5.width, size.height);
284   gtk_table_attach_defaults (GTK_TABLE (table),
285                              config->more.misc.threads,
286                              3, 4, 0, 1);
287   gtk_widget_show (config->more.misc.threads);
288
289   config->more.misc.cabac = gtk_check_button_new_with_label (_("CABAC"));
290   gtk_widget_set_size_request (config->more.misc.cabac, size5.width, size.height);
291   gtk_tooltips_set_tip (tooltips, config->more.misc.cabac,
292                         _("CABAC - description"),
293                         "");
294   g_signal_connect (G_OBJECT (config->more.misc.cabac),
295                     "toggled",
296                     G_CALLBACK (x264_more_cabac), config);
297   gtk_table_attach_defaults (GTK_TABLE (table), config->more.misc.cabac,
298                              0, 1, 1, 2);
299   gtk_widget_show (config->more.misc.cabac);
300
301   eb = gtk_event_box_new ();
302   gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE);
303   gtk_tooltips_set_tip (tooltips, eb,
304                         _("Trellis - description"),
305                         "");
306   gtk_table_attach_defaults (GTK_TABLE (table), eb,
307                              1, 2, 1, 2);
308   gtk_widget_show (eb);
309
310   label = gtk_label_new (_("Trellis"));
311   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
312   gtk_container_add (GTK_CONTAINER (eb), label);
313   gtk_widget_show (label);
314
315   config->more.misc.trellis = gtk_combo_box_new_text ();
316   gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.misc.trellis),
317                              _("Disabled"));
318   gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.misc.trellis),
319                              _("Enabled (once)"));
320   gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.misc.trellis),
321                              _("Enabled (mode decision)"));
322   gtk_table_attach_defaults (GTK_TABLE (table), config->more.misc.trellis,
323                              2, 4, 1, 2);
324   gtk_widget_show (config->more.misc.trellis);
325
326   eb = gtk_event_box_new ();
327   gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE);
328   gtk_tooltips_set_tip (tooltips, eb,
329                         _("Noise reduction - description"),
330                         "");
331   gtk_table_attach_defaults (GTK_TABLE (table), eb,
332                              0, 1, 2, 3);
333   gtk_widget_show (eb);
334
335   label = gtk_label_new (_("Noise reduction"));
336   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
337   gtk_container_add (GTK_CONTAINER (eb), label);
338   gtk_widget_show (label);
339
340   config->more.misc.noise_reduction = gtk_entry_new_with_max_length (3);
341   gtk_widget_set_size_request (config->more.misc.noise_reduction, size5.width, size.height);
342   gtk_table_attach_defaults (GTK_TABLE (table), config->more.misc.noise_reduction,
343                              1, 2, 2, 3);
344   gtk_widget_show (config->more.misc.noise_reduction);
345
346   config->more.misc.df.deblocking_filter = gtk_check_button_new_with_label (_("Deblocking Filter"));
347   gtk_tooltips_set_tip (tooltips, config->more.misc.df.deblocking_filter,
348                         _("Deblocking Filter - description"),
349                         "");
350   g_signal_connect (G_OBJECT (config->more.misc.df.deblocking_filter),
351                     "toggled",
352                     G_CALLBACK (x264_more_deblocking_filter), config);
353   gtk_table_attach_defaults (GTK_TABLE (table), config->more.misc.df.deblocking_filter,
354                              0, 1, 3, 4);
355   gtk_widget_show (config->more.misc.df.deblocking_filter);
356
357   eb = gtk_event_box_new ();
358   gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE);
359   gtk_tooltips_set_tip (tooltips, eb,
360                         _("Strength - description"),
361                         "");
362   gtk_table_attach_defaults (GTK_TABLE (table), eb,
363                              1, 2, 3, 4);
364   gtk_widget_show (eb);
365
366   label = gtk_label_new (_("Strength"));
367   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
368   gtk_widget_set_size_request (label, size5.width, size4.height);
369   gtk_container_add (GTK_CONTAINER (eb), label);
370   gtk_widget_show (label);
371
372   config->more.misc.df.strength = gtk_hscale_new_with_range (-6.0, 6.0, 1.0);
373   gtk_widget_size_request (config->more.misc.df.strength, &size4);
374   gtk_scale_set_digits (GTK_SCALE (config->more.misc.df.strength), 0);
375   gtk_scale_set_value_pos (GTK_SCALE (config->more.misc.df.strength), GTK_POS_RIGHT);
376   //  gtk_widget_set_size_request (config->more.misc.df.strength, size5.width, size4.height);
377   gtk_table_attach_defaults (GTK_TABLE (table), config->more.misc.df.strength,
378                              2, 4, 3, 4);
379   gtk_widget_show (config->more.misc.df.strength);
380
381   eb = gtk_event_box_new ();
382   gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE);
383   gtk_tooltips_set_tip (tooltips, eb,
384                         _("Threshold - description"),
385                         "");
386   gtk_table_attach_defaults (GTK_TABLE (table), eb,
387                              1, 2, 4, 5);
388   gtk_widget_show (eb);
389
390   label = gtk_label_new (_("Threshold"));
391   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
392   gtk_widget_set_size_request (label, size5.width, size4.height);
393   gtk_container_add (GTK_CONTAINER (eb), label);
394   gtk_widget_show (label);
395
396   config->more.misc.df.threshold = gtk_hscale_new_with_range (-6.0, 6.0, 1.0);
397   gtk_scale_set_digits (GTK_SCALE (config->more.misc.df.threshold), 0);
398   gtk_scale_set_value_pos (GTK_SCALE (config->more.misc.df.threshold), GTK_POS_RIGHT);
399   gtk_table_attach_defaults (GTK_TABLE (table), config->more.misc.df.threshold,
400                              2, 4, 4, 5);
401   gtk_widget_show (config->more.misc.df.threshold);
402
403   /* Debug */
404   frame = gtk_frame_new (_("Debug"));
405   gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 6);
406   gtk_widget_show (frame);
407
408   table = gtk_table_new (2, 2, TRUE);
409   gtk_table_set_row_spacings (GTK_TABLE (table), 6);
410   gtk_container_set_border_width (GTK_CONTAINER (table), 6);
411   gtk_container_add (GTK_CONTAINER (frame), table);
412   gtk_widget_show (table);
413
414   eb = gtk_event_box_new ();
415   gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE);
416   gtk_tooltips_set_tip (tooltips, eb,
417                         _("Log level - description"),
418                         "");
419   gtk_table_attach_defaults (GTK_TABLE (table), eb,
420                              0, 1, 0, 1);
421   gtk_widget_show (eb);
422
423   label = gtk_label_new (_("Log level"));
424   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
425   gtk_container_add (GTK_CONTAINER (eb), label);
426   gtk_widget_show (label);
427
428   config->more.debug.log_level = gtk_combo_box_new_text ();
429   gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.debug.log_level),
430                              _("None"));
431   gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.debug.log_level),
432                              _("Error"));
433   gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.debug.log_level),
434                              _("Warning"));
435   gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.debug.log_level),
436                              _("Info"));
437   gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.debug.log_level),
438                              _("Debug"));
439   gtk_table_attach_defaults (GTK_TABLE (table), config->more.debug.log_level,
440                              1, 2, 0, 1);
441   gtk_widget_show (config->more.debug.log_level);
442
443   eb = gtk_event_box_new ();
444   gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE);
445   gtk_tooltips_set_tip (tooltips, eb,
446                         _("FourCC - description"),
447                         "");
448   gtk_table_attach_defaults (GTK_TABLE (table), eb,
449                              0, 1, 1, 2);
450   gtk_widget_show (eb);
451
452   label = gtk_label_new ("FourCC");
453   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
454   gtk_container_add (GTK_CONTAINER (eb), label);
455   gtk_widget_show (label);
456
457   config->more.debug.fourcc = gtk_entry_new_with_max_length (4);
458   gtk_table_attach_defaults (GTK_TABLE (table),
459                              config->more.debug.fourcc,
460                              1, 2, 1, 2);
461   gtk_widget_set_sensitive (config->more.debug.fourcc, FALSE);
462   gtk_widget_show (config->more.debug.fourcc);
463
464
465
466   return vbox;
467 }
468
469 /* Callbacks */
470 static void
471 x264_more_deblocking_filter (GtkToggleButton *button,
472                          gpointer         user_data)
473 {
474   X264_Gui_Config *config;
475
476   config = (X264_Gui_Config *)user_data;
477
478   if (gtk_toggle_button_get_active (button)) {
479     gtk_widget_set_sensitive (config->more.misc.df.strength, TRUE);
480     gtk_widget_set_sensitive (config->more.misc.df.threshold, TRUE);
481   }
482   else {
483     gtk_widget_set_sensitive (config->more.misc.df.strength, FALSE);
484     gtk_widget_set_sensitive (config->more.misc.df.threshold, FALSE);
485   }
486 }
487
488 static void
489 x264_more_cabac (GtkToggleButton *button,
490              gpointer         user_data)
491 {
492   X264_Gui_Config *config;
493
494   config = (X264_Gui_Config *)user_data;
495
496   if (gtk_toggle_button_get_active (button))
497     gtk_widget_set_sensitive (config->more.misc.trellis, TRUE);
498   else
499     gtk_widget_set_sensitive (config->more.misc.trellis, FALSE);
500 }
501
502 static void
503 x264_more_mixed_ref (GtkToggleButton *button,
504                  gpointer         user_data)
505 {
506   X264_Gui_Config *config;
507
508   config = (X264_Gui_Config *)user_data;
509
510   if (gtk_toggle_button_get_active (button)) {
511     const gchar *text;
512     gint         val;
513
514     text = gtk_entry_get_text (GTK_ENTRY (config->more.motion_estimation.max_ref_frames));
515     val = (gint)g_ascii_strtoull (text, NULL, 10);
516     if (val < 2)
517       gtk_entry_set_text (GTK_ENTRY (config->more.motion_estimation.max_ref_frames), "2");
518   }
519 }