From 7b8465915b08b631f1fdfae15847b06407386a44 Mon Sep 17 00:00:00 2001 From: Mike Jerris Date: Fri, 3 Mar 2017 14:58:52 -0600 Subject: [PATCH] FS-10050: [core] chromakey optimization --- src/switch_core_video.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/switch_core_video.c b/src/switch_core_video.c index 94bdc22530..003e4a91b5 100644 --- a/src/switch_core_video.c +++ b/src/switch_core_video.c @@ -346,6 +346,16 @@ SWITCH_DECLARE(void) switch_img_patch_rgb(switch_image_t *IMG, switch_image_t *i switch_img_patch_rgb_noalpha(IMG, img, x, y); return; } + if (IMG->d_w == img->d_w && IMG->d_h == img->d_h) { + ARGBAttenuate(img->planes[SWITCH_PLANE_PACKED], img->stride[SWITCH_PLANE_PACKED], + img->planes[SWITCH_PLANE_PACKED], img->stride[SWITCH_PLANE_PACKED], + img->d_w, img->d_h); + ARGBBlend(img->planes[SWITCH_PLANE_PACKED], img->stride[SWITCH_PLANE_PACKED], + IMG->planes[SWITCH_PLANE_PACKED], IMG->stride[SWITCH_PLANE_PACKED], + IMG->planes[SWITCH_PLANE_PACKED], IMG->stride[SWITCH_PLANE_PACKED], + IMG->d_w, IMG->d_h); + return; + } if (img->fmt == SWITCH_IMG_FMT_ARGB && IMG->fmt == SWITCH_IMG_FMT_ARGB) { int max_w = MIN(img->d_w, IMG->d_w - abs(x));