summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2016-03-31 11:57:45 -0700
committerJohn Stebbins <[email protected]>2016-03-31 11:59:11 -0700
commita447656ed0924573ba242d6c872e52e831ad38c1 (patch)
tree3d458bf3ec7dde787e1e8ae360166f5076fb29cd
parent6c56b2bed72bbb5f4d4d5b14307385ef42225b83 (diff)
filters: don't add disabled rotate filter to filter list
add check for settings that cause a filter to be disabled, and disable the filter in such cases before adding to the filter list.
-rw-r--r--libhb/avfilter.c2
-rw-r--r--libhb/param.c36
2 files changed, 33 insertions, 5 deletions
diff --git a/libhb/avfilter.c b/libhb/avfilter.c
index 9aa8a316b..f0d2649ab 100644
--- a/libhb/avfilter.c
+++ b/libhb/avfilter.c
@@ -76,7 +76,7 @@ hb_filter_object_t hb_filter_pad =
};
const char rotate_template[] =
- "angle=^(0|90|180|270)$:hflip=^"HB_BOOL_REG"$";
+ "angle=^(0|90|180|270)$:hflip=^"HB_BOOL_REG"$:disable=^"HB_BOOL_REG"$";
hb_filter_object_t hb_filter_rotate =
{
diff --git a/libhb/param.c b/libhb/param.c
index 6b3e0b16f..cdd06e989 100644
--- a/libhb/param.c
+++ b/libhb/param.c
@@ -553,16 +553,43 @@ generate_deblock_settings(const char * preset, const char * custom)
{
settings = hb_dict_init();
int qp = strtol(preset, NULL, 0);
- if (qp < 5)
- {
- hb_dict_set(settings, "disable", hb_value_bool(1));
- }
hb_dict_set(settings, "qp", hb_value_int(qp));
}
return settings;
}
+static void check_filter_status(int filter_id, hb_value_t *settings)
+{
+ int disable = 0;
+
+ if (settings == NULL)
+ {
+ return;
+ }
+ switch (filter_id)
+ {
+ case HB_FILTER_ROTATE:
+ {
+ int angle = hb_dict_get_int(settings, "angle");
+ int hflip = hb_dict_get_int(settings, "hflip");
+ disable = angle == 0 && hflip == 0;
+ } break;
+ case HB_FILTER_DEBLOCK:
+ {
+ int qp = hb_dict_get_int(settings, "qp");
+ disable = qp < 5;
+ } break;
+ default:
+ {
+ } break;
+ }
+ if (disable)
+ {
+ hb_dict_set(settings, "disable", hb_value_bool(disable));
+ }
+}
+
hb_value_t *
hb_generate_filter_settings(int filter_id, const char *preset, const char *tune,
const char *custom)
@@ -599,6 +626,7 @@ hb_generate_filter_settings(int filter_id, const char *preset, const char *tune,
filter_id);
break;
}
+ check_filter_status(filter_id, settings);
if (settings != NULL &&
hb_validate_filter_settings(filter_id, settings) == 0)