diff --git a/src/mod/applications/mod_video_filter/mod_video_filter.c b/src/mod/applications/mod_video_filter/mod_video_filter.c index 5c8b08c82f..5a11988ace 100644 --- a/src/mod/applications/mod_video_filter/mod_video_filter.c +++ b/src/mod/applications/mod_video_filter/mod_video_filter.c @@ -108,7 +108,7 @@ static void parse_params(chromakey_context_t *context, int start, int argc, char switch_color_set_rgb(&context->mask[j], list[j]); if (thresh) { - context->thresholds[j] = thresh; + context->thresholds[j] = thresh*thresh; } context->mask_len++; } @@ -121,7 +121,7 @@ static void parse_params(chromakey_context_t *context, int start, int argc, char int j; if (thresh > 0) { - context->threshold = thresh; + context->threshold = thresh * thresh; for (j = 0; j < context->mask_len; j++) { if (!context->thresholds[j]) context->thresholds[j] = context->threshold; diff --git a/src/switch_core_video.c b/src/switch_core_video.c index 401e97997a..052ad98f67 100644 --- a/src/switch_core_video.c +++ b/src/switch_core_video.c @@ -768,13 +768,13 @@ static inline int switch_color_distance(switch_rgb_color_t *c1, switch_rgb_color cg2 = c1->g/2 - c2->g/2; cb2 = c1->b/2 - c2->b/2; - a = sqrt((2*cr*cr) + (4*cg*cg) + (3*cb*cb)); - b = sqrt((2*cr2*cr2) + (4*cg2*cg2) + (3*cb2*cb2)); + a = ((2*cr*cr) + (4*cg*cg) + (3*cb*cb)); + b = ((2*cr2*cr2) + (4*cg2*cg2) + (3*cb2*cb2)); aa = (int)a; - bb = (int)b*5; + bb = (int)b*25; - r = (((bb*2)+(aa))/3)/10; + r = (((bb*4)+(aa))/9)/100; return r;