summaryrefslogtreecommitdiffstats
path: root/gtk/src
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2017-05-26 14:16:18 -0700
committerJohn Stebbins <[email protected]>2017-05-30 11:20:42 -0700
commit66a364099807593f50226c811dc3345ed4d5371a (patch)
tree576fbb8e7bfecf1432d7c5db408c504f65ae56d6 /gtk/src
parent2b0cbe69a83848fb0b8012ed858fa3ab402889e3 (diff)
LinGui: Add UI support for BradleyS' sharpen filters
Diffstat (limited to 'gtk/src')
-rw-r--r--gtk/src/callbacks.c14
-rw-r--r--gtk/src/ghb.m4138
-rw-r--r--gtk/src/hb-backend.c59
-rw-r--r--gtk/src/makedeps.py9
4 files changed, 218 insertions, 2 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index 4cddf663d..c195a2584 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -2191,6 +2191,20 @@ denoise_filter_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
}
G_MODULE_EXPORT void
+sharpen_filter_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
+{
+ ghb_widget_to_setting(ud->settings, widget);
+ ghb_check_dependency(ud, widget, NULL);
+ ghb_clear_presets_selection(ud);
+ ghb_live_reset(ud);
+ ghb_update_ui_combo_box(ud, "PictureSharpenPreset", NULL, FALSE);
+ ghb_update_ui_combo_box(ud, "PictureSharpenTune", NULL, FALSE);
+ ghb_ui_update(ud, "PictureSharpenPreset",
+ ghb_dict_get(ud->settings, "PictureSharpenPreset"));
+ ghb_ui_update(ud, "PictureSharpenTune", ghb_string_value("none"));
+}
+
+G_MODULE_EXPORT void
title_angle_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
ghb_widget_to_setting(ud->settings, widget);
diff --git a/gtk/src/ghb.m4 b/gtk/src/ghb.m4
index 5895743dc..1f3d279c2 100644
--- a/gtk/src/ghb.m4
+++ b/gtk/src/ghb.m4
@@ -3310,6 +3310,140 @@ ifelse(eval(gtk_version < 312), 1, filter_output([
filter_output([
</child>
<child>
+ <object class="GtkGrid" id="SharpenTable">
+ <property name="row-spacing">2</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="column_spacing">5</property>
+ <property name="halign">start</property>
+ <property name="valign">start</property>
+ <child>
+ <object class="GtkLabel" id="PictureSharpenFilterel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Sharpen Filter:</property>
+ </object>
+ <packing>
+ <property name="top_attach">0</property>
+ <property name="left_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="PictureSharpenFilter">
+ <property name="valign">GTK_ALIGN_CENTER</property>
+ <property name="width_request">100</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="tooltip_text" translatable="yes">Sharpen filtering enhances edges and other
+high frequency components in the video.</property>
+ <signal name="changed" handler="sharpen_filter_changed_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="top_attach">0</property>
+ <property name="left_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="PictureSharpenPresetLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Sharpen Preset:</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="left_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="PictureSharpenPreset">
+ <property name="valign">GTK_ALIGN_CENTER</property>
+ <property name="width_request">100</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="tooltip_text" translatable="yes">Sharpen filtering enhances edges and other
+high frequency components in the video.</property>
+ <signal name="changed" handler="setting_widget_changed_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="left_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="PictureSharpenTuneLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Sharpen Tune:</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="left_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="PictureSharpenTune">
+ <property name="valign">GTK_ALIGN_CENTER</property>
+ <property name="width_request">100</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="tooltip_text" translatable="yes">Sharpen filtering enhances edges and other
+high frequency components in the video.</property>
+ <signal name="changed" handler="setting_widget_changed_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="left_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="PictureSharpenCustom">
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">Custom denoise filter string format
+
+SpatialLuma:SpatialChroma:TemporalLuma:TemporalChroma</property>
+ <property name="width_chars">8</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <signal name="changed" handler="setting_widget_changed_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="left_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+])dnl
+ifelse(eval(gtk_version < 312), 1, filter_output([
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="left_attach">2</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+]))dnl
+filter_output([
+ </child>
+ <child>
<object class="GtkGrid" id="table16">
<property name="row-spacing">2</property>
<property name="visible">True</property>
@@ -3353,7 +3487,7 @@ filter_output([
ifelse(eval(gtk_version < 312), 1, filter_output([
<packing>
<property name="top_attach">1</property>
- <property name="left_attach">2</property>
+ <property name="left_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -3377,7 +3511,7 @@ filter_output([
ifelse(eval(gtk_version < 312), 1, filter_output([
<packing>
<property name="top_attach">1</property>
- <property name="left_attach">3</property>
+ <property name="left_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index 38e22eca7..ec819895c 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -220,6 +220,18 @@ combo_opts_t denoise_opts =
d_denoise_opts
};
+static options_map_t d_sharpen_opts[] =
+{
+ {N_("Off"), "off", HB_FILTER_INVALID},
+ {N_("Unsharp"), "unsharp", HB_FILTER_UNSHARP},
+ {N_("Lapsharp"), "lapsharp", HB_FILTER_LAPSHARP },
+};
+combo_opts_t sharpen_opts =
+{
+ sizeof(d_sharpen_opts)/sizeof(options_map_t),
+ d_sharpen_opts
+};
+
static options_map_t d_rotate_opts[] =
{
{N_("Off"), "disable=1", 0},
@@ -367,6 +379,18 @@ static filter_opts_t nlmeans_tune_opts =
.preset = FALSE
};
+static filter_opts_t sharpen_preset_opts =
+{
+ .filter_id = HB_FILTER_UNSHARP,
+ .preset = TRUE
+};
+
+static filter_opts_t sharpen_tune_opts =
+{
+ .filter_id = HB_FILTER_UNSHARP,
+ .preset = FALSE
+};
+
#if 0
static filter_opts_t hqdn3d_preset_opts =
{
@@ -439,6 +463,8 @@ static void deint_opts_set(signal_user_data_t *ud, const gchar *name,
void *vopts, const void* data);
static void denoise_opts_set(signal_user_data_t *ud, const gchar *name,
void *vopts, const void* data);
+static void sharpen_opts_set(signal_user_data_t *ud, const gchar *name,
+ void *vopts, const void* data);
static GhbValue * generic_opt_get(const char *name, const void *opts,
const GhbValue *gval, GhbType type);
@@ -556,6 +582,24 @@ combo_name_map_t combo_name_map[] =
filter_opt_get
},
{
+ "PictureSharpenFilter",
+ &sharpen_opts,
+ small_opts_set,
+ generic_opt_get
+ },
+ {
+ "PictureSharpenPreset",
+ &sharpen_preset_opts,
+ sharpen_opts_set,
+ filter_opt_get
+ },
+ {
+ "PictureSharpenTune",
+ &sharpen_tune_opts,
+ sharpen_opts_set,
+ filter_opt_get
+ },
+ {
"PictureRotate",
&rotate_opts,
small_opts_set,
@@ -2575,6 +2619,21 @@ denoise_opts_set(signal_user_data_t *ud, const gchar *name,
"denoise", opts->filter_id);
}
+static void
+sharpen_opts_set(signal_user_data_t *ud, const gchar *name,
+ void *vopts, const void* data)
+{
+ (void)data; // Silence "unused variable" warning
+
+ filter_opts_t *opts = (filter_opts_t*)vopts;
+ opts->filter_id = ghb_settings_combo_int(ud->settings,
+ "PictureSharpenFilter");
+ filter_opts_set2(ud, name, opts->filter_id, opts->preset);
+
+ ghb_set_custom_filter_tooltip(ud, "PictureSharpenCustom",
+ "sharpen", opts->filter_id);
+}
+
combo_name_map_t*
find_combo_map(const gchar *name)
{
diff --git a/gtk/src/makedeps.py b/gtk/src/makedeps.py
index 3641b79e8..5ff09304e 100644
--- a/gtk/src/makedeps.py
+++ b/gtk/src/makedeps.py
@@ -41,6 +41,15 @@ dep_map = (
DepEntry("PictureDenoisePreset", "PictureDenoiseCustom", "custom", False, True),
DepEntry("PictureDenoisePreset", "PictureDenoiseTune", "custom", True, True),
DepEntry("PictureDenoisePreset", "PictureDenoiseTuneLabel", "custom", True, True),
+
+ DepEntry("PictureSharpenFilter", "PictureSharpenPreset", "off", True, True),
+ DepEntry("PictureSharpenFilter", "PictureSharpenPresetLabel", "off", True, True),
+ DepEntry("PictureSharpenFilter", "PictureSharpenTune", "off", True, True),
+ DepEntry("PictureSharpenFilter", "PictureSharpenTuneLabel", "off", True, True),
+ DepEntry("PictureSharpenFilter", "PictureSharpenCustom", "off", True, True),
+ DepEntry("PictureSharpenPreset", "PictureSharpenCustom", "custom", False, True),
+ DepEntry("PictureSharpenPreset", "PictureSharpenTune", "custom", True, True),
+ DepEntry("PictureSharpenPreset", "PictureSharpenTuneLabel", "custom", True, True),
DepEntry("PictureDetelecine", "PictureDetelecineCustom", "custom", False, True),
DepEntry("PictureWidthEnable", "PictureWidth", "1", False, False),
DepEntry("PictureHeightEnable", "PictureHeight", "1", False, False),