MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / comb_detect_init

Function comb_detect_init

libhb/comb_detect.c:1082–1449  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1080}
1081
1082static int comb_detect_init(hb_filter_object_t *filter,
1083 hb_filter_init_t *init)
1084{
1085 filter->private_data = calloc(1, sizeof(struct hb_filter_private_s));
1086 if (filter->private_data == NULL)
1087 {
1088 hb_error("comb_detect: calloc failed");
1089 return -1;
1090 }
1091 hb_filter_private_t *pv = filter->private_data;
1092
1093 hb_buffer_list_clear(&pv->out_list);
1094
1095 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(init->pix_fmt);
1096 pv->depth = desc->comp[0].depth;
1097 pv->bps = pv->depth > 8 ? 2 : 1;
1098 pv->max_value = (1 << pv->depth) - 1;
1099 pv->half_value = (1 << pv->depth) / 2;
1100
1101 pv->gamma_lut = malloc(sizeof(float) * (pv->max_value + 1));
1102 if (pv->gamma_lut == NULL)
1103 {
1104 hb_error("comb_detect: malloc failed");
1105 return -1;
1106 }
1107 build_gamma_lut(pv);
1108
1109 pv->frames = 0;
1110 pv->force_exaustive_check = 1;
1111 pv->comb_heavy = 0;
1112 pv->comb_light = 0;
1113 pv->comb_none = 0;
1114
1115 pv->comb_detect_ready = 0;
1116
1117 pv->mode = MODE_GAMMA | MODE_FILTER;
1118 pv->filter_mode = FILTER_ERODE_DILATE;
1119 pv->spatial_metric = 2;
1120 pv->motion_threshold = 3;
1121 pv->spatial_threshold = 3;
1122 pv->block_threshold = 40;
1123 pv->block_width = 16;
1124 pv->block_height = 16;
1125
1126 if (filter->settings)
1127 {
1128 hb_value_t *dict = filter->settings;
1129
1130 // Get comb detection settings
1131 hb_dict_extract_int(&pv->mode, dict, "mode");
1132 hb_dict_extract_int(&pv->spatial_metric, dict, "spatial-metric");
1133 hb_dict_extract_int(&pv->motion_threshold, dict, "motion-thresh");
1134 hb_dict_extract_int(&pv->spatial_threshold, dict, "spatial-thresh");
1135 hb_dict_extract_int(&pv->filter_mode, dict, "filter-mode");
1136 hb_dict_extract_int(&pv->block_threshold, dict, "block-thresh");
1137 hb_dict_extract_int(&pv->block_width, dict, "block-width");
1138 hb_dict_extract_int(&pv->block_height, dict, "block-height");
1139 }

Callers

nothing calls this directly

Calls 9

hb_errorFunction · 0.85
hb_buffer_list_clearFunction · 0.85
hb_dict_extract_intFunction · 0.85
hb_get_cpu_countFunction · 0.85
hb_image_heightFunction · 0.85
hb_frame_buffer_initFunction · 0.85
taskset_initFunction · 0.85
taskset_thread_argsFunction · 0.85
build_gamma_lutFunction · 0.70

Tested by

no test coverage detected