]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-10050: [core] chromakey Optimizations broke solid color mode
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 9 Mar 2017 20:15:09 +0000 (14:15 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 9 Mar 2017 20:15:09 +0000 (14:15 -0600)
src/include/switch_core_video.h
src/mod/applications/mod_video_filter/mod_video_filter.c
src/switch_core_video.c

index 4a5be90cb48d339d183d29c04a818c9a1ffaa4bf..11e0558153a7b68d5f503525a2b222c9aba600ea 100644 (file)
@@ -314,6 +314,8 @@ SWITCH_DECLARE(switch_image_t *) switch_img_copy_rect(switch_image_t *img, uint3
 */
 SWITCH_DECLARE(void) switch_img_fill(switch_image_t *img, int x, int y, int w, int h, switch_rgb_color_t *color);
 
+SWITCH_DECLARE(void) switch_img_fill_noalpha(switch_image_t *img, int x, int y, int w, int h, switch_rgb_color_t *color);
+
 /*!\brief Set RGB color with a string
 *
 * Color string should be in #RRGGBB format
index f7a9995c61b09f591e00a60eaa09d0e4b7631d93..070f4add9343092e8e0315a11818dc27d7c5ef44 100644 (file)
@@ -358,7 +358,7 @@ static switch_status_t video_thread_callback(switch_core_session_t *session, swi
 
 
        } else {
-               switch_img_fill(frame->img, 0, 0, img->d_w, img->d_h, &context->bgcolor);
+               switch_img_fill_noalpha(img, 0, 0, img->d_w, img->d_h, &context->bgcolor);
        }
 
        if (context->imgfg) {
index 0f7cc4aa3b7826dc10f6aee52caf07a4d17e7c25..fc2f03c7093c2d00d7bfce3fdcd80d065323888e 100644 (file)
@@ -1362,6 +1362,33 @@ static inline void switch_img_draw_pixel(switch_image_t *img, int x, int y, swit
 #endif
 }
 
+SWITCH_DECLARE(void) switch_img_fill_noalpha(switch_image_t *img, int x, int y, int w, int h, switch_rgb_color_t *color)
+{
+#ifdef SWITCH_HAVE_YUV
+       int i;
+
+       if (img->fmt == SWITCH_IMG_FMT_ARGB) {
+               int max_w = img->d_w;
+               int max_h = img->d_h;
+               int j;
+               switch_rgb_color_t *rgb; 
+
+               for (i = 0; i < max_h; i++) {           
+                       for (j = 0; j < max_w; j++) {
+                               rgb = (switch_rgb_color_t *)(img->planes[SWITCH_PLANE_PACKED] + i * img->stride[SWITCH_PLANE_PACKED] + j * 4);
+
+                               if (rgb->a != 0) {
+                                       continue;
+                               }
+                               
+                               *rgb = *color;
+                       }
+               }
+       }
+
+#endif
+}
+
 SWITCH_DECLARE(void) switch_img_fill(switch_image_t *img, int x, int y, int w, int h, switch_rgb_color_t *color)
 {
 #ifdef SWITCH_HAVE_YUV