diff options
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/avfilter.c | 2 | ||||
-rw-r--r-- | libhb/param.c | 36 |
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) |