]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-9742
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 16 Nov 2016 22:05:59 +0000 (16:05 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 16 Nov 2016 22:05:59 +0000 (16:05 -0600)
src/mod/applications/mod_conference/conference_video.c
src/mod/applications/mod_cv/mod_cv.cpp

index 46d14de653643e2338a093d7f61c924ba702e126..5cbbac7683f722e55b1d4e2577978a54cfd20878 100644 (file)
@@ -438,19 +438,18 @@ void conference_video_scale_and_patch(mcu_layer_t *layer, switch_image_t *ximg,
                                                cropsize = 1;
                                        } else {
                                                cropsize = layer->bug_frame.geometry.x - (new_w / 2);
+                                               if (cropsize > img->d_w - new_w) {
+                                                       cropsize = img->d_w - new_w;
+                                               }
                                        }
                                } else {
                                        cropsize = (img->d_w - new_w) / 2;
                                }
 
-                               if (cropsize > img->d_w - new_w) {
-                                       cropsize = img->d_w - new_w;
-                               }
-                               
                                if (cropsize < 1) {
                                        cropsize = 1;
-                               }
-
+                               }                               
+                               
                                if (cropsize) {
                                        switch_img_set_rect(img, cropsize, 0, new_w, new_h);
                                        img_aspect = (double) img->d_w / img->d_h;
@@ -471,15 +470,14 @@ void conference_video_scale_and_patch(mcu_layer_t *layer, switch_image_t *ximg,
                                                cropsize = 1;
                                        } else {
                                                cropsize = layer->bug_frame.geometry.y - (new_h / 2);
+                                               if (cropsize > img->d_h - new_h) {
+                                                       cropsize = img->d_h - new_h;
+                                               }
                                        }
                                } else {
                                        cropsize = (img->d_h - new_h) / 2;
                                }
 
-                               if (cropsize > img->d_h - new_h) {
-                                       cropsize = img->d_h - new_h;
-                               }
-                               
                                if (cropsize < 1) {
                                        cropsize = 1;
                                }
index 9343030cc26215eeb0f24db587fe3a4c09d9109a..bf2aab30d45029061f76d54336d6b4ae32bf700f 100644 (file)
@@ -113,6 +113,7 @@ typedef struct cv_context_s {
     int detect_event;
     int nest_detect_event;
     struct shape shape[MAX_SHAPES];
+       struct shape last_shape[MAX_SHAPES];
     int shape_idx;
     int32_t skip;
     int32_t skip_count;
@@ -599,6 +600,10 @@ void detectAndDraw(cv_context_t *context)
 
     //printf("SCORE: %d %f %d\n", context->detected.simo_count, context->detected.avg, context->detected.last_score);
 
+       for (i = 0; i < context->shape_idx; i++) {
+               context->last_shape[i] = context->shape[i];
+       }
+
     context->shape_idx = 0;
     //memset(context->shape, 0, sizeof(context->shape[0]) * MAX_SHAPES);
 
@@ -724,6 +729,12 @@ static switch_status_t video_thread_callback(switch_core_session_t *session, swi
 
         switch_img_to_raw(frame->img, context->rawImage->imageData, context->rawImage->widthStep, SWITCH_IMG_FMT_RGB24);
         detectAndDraw(context);
+               
+               if (context->detect_event && context->shape_idx &&
+                       abs(context->shape[0].cx - context->last_shape[0].cx) > 200 || abs(context->shape[0].w - context->last_shape[0].w) > 200) {
+                       context->detected.simo_count = 0;
+                       context->detected.simo_miss_count = context->confidence_level;
+               }
 
         if (context->detected.simo_count > context->confidence_level) {
             if (!context->detect_event) {