From eb6b180a446dc1cabcf19eef42debca18ef429b8 Mon Sep 17 00:00:00 2001 From: maximd33 Date: Mon, 30 Sep 2019 15:05:55 +0200 Subject: crop/resize and vfr filters used only when needed --- libhb/preset.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/libhb/preset.c b/libhb/preset.c index b7a30013a..3221bbf7d 100644 --- a/libhb/preset.c +++ b/libhb/preset.c @@ -1265,6 +1265,7 @@ int hb_preset_apply_filters(const hb_dict_t *preset, hb_dict_t *job_dict) // Detelecine filter hb_value_t *detel_val = hb_dict_get(preset, "PictureDetelecine"); + int is_detel = 0; if (detel_val != NULL) { const char *custom; @@ -1286,6 +1287,7 @@ int hb_preset_apply_filters(const hb_dict_t *preset, hb_dict_t *job_dict) hb_dict_set(filter_dict, "ID", hb_value_int(HB_FILTER_DETELECINE)); hb_dict_set(filter_dict, "Settings", filter_settings); hb_add_filter2(filter_list, filter_dict); + is_detel = 1; } else { @@ -1619,19 +1621,16 @@ int hb_preset_apply_filters(const hb_dict_t *preset, hb_dict_t *job_dict) hb_value_free(&filter_settings); return -1; } - - filter_dict = hb_dict_init(); - hb_dict_set(filter_dict, "ID", hb_value_int(HB_FILTER_VFR)); - hb_dict_set(filter_dict, "Settings", filter_settings); -#if HB_PROJECT_FEATURE_QSV - if(hb_qsv_preset_is_zero_copy_enabled(job_dict)) + if (is_detel != 0 || fr_mode != 0) { - hb_log("HB_FILTER_VFR filter is disabled"); + filter_dict = hb_dict_init(); + hb_dict_set(filter_dict, "ID", hb_value_int(HB_FILTER_VFR)); + hb_dict_set(filter_dict, "Settings", filter_settings); + hb_add_filter2(filter_list, filter_dict); } else -#endif { - hb_add_filter2(filter_list, filter_dict); + hb_log("Skipping VRF filter"); } return 0; } @@ -2007,16 +2006,16 @@ int hb_preset_apply_title(hb_handle_t *h, int title_index, filter_dict = hb_dict_init(); hb_dict_set(filter_dict, "ID", hb_value_int(HB_FILTER_CROP_SCALE)); hb_dict_set(filter_dict, "Settings", filter_settings); -#if HB_PROJECT_FEATURE_QSV - if(hb_qsv_preset_is_zero_copy_enabled(job_dict)) + if ((srcGeo.width != resultGeo.width) || (srcGeo.height != resultGeo.height) || + (geo.crop[0] != 0) || (geo.crop[1] !=0) || (geo.crop[2] != 0) || (geo.crop[3] != 0)) { - hb_log("HB_FILTER_CROP_SCALE filter is disabled"); + hb_add_filter2(filter_list, filter_dict); } else -#endif { - hb_add_filter2(filter_list, filter_dict); + hb_log("Skipping CROP_SCALE filter"); } + // Audio settings if (hb_preset_job_add_audio(h, title_index, preset, job_dict) != 0) { -- cgit v1.2.3