On 20.02.2016 22:06, Dan Dennedy wrote:
On Sat, Feb 20, 2016 at 12:04 PM Maksym Veremeyenko <ve...@m1stereo.tv
<mailto:ve...@m1stereo.tv>> wrote:
On 20.02.2016 20:17, Maksym Veremeyenko wrote:
> Hi,
>
> attached patch do some optimization of blending then source alpha
is 0.
please cancel this
OK
i attached updated patch that do optimization for all types of blending.
but i would ask for somebody else to test if no regression happens
before applying.
the goal of using that patch is minimizing pixels color calculations on
a transparent source.
--
Maksym Veremeyenko
From 6b9b12f83d33a153549fcb75e3b4a179f96ac7cf Mon Sep 17 00:00:00 2001
From: Maksym Veremeyenko <ve...@m1.tv>
Date: Sun, 21 Feb 2016 10:06:56 +0200
Subject: [PATCH] blending/compositing optimization of source alpha is 0
---
src/modules/core/composite_line_yuv_sse2_simple.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/src/modules/core/composite_line_yuv_sse2_simple.c
b/src/modules/core/composite_line_yuv_sse2_simple.c
index a68a788..be87ccd 100644
--- a/src/modules/core/composite_line_yuv_sse2_simple.c
+++ b/src/modules/core/composite_line_yuv_sse2_simple.c
@@ -45,6 +45,10 @@ const static unsigned char const2[] =
"movq (%[src_a]), %%xmm2 \n\t" /* load source alpha
*/ \
"punpcklbw %%xmm0, %%xmm2 \n\t" /* unpack alpha 8
8-bits alphas to 8 16-bits values */
+#define SRC_A_ZERO(J) \
+ "ptest %%xmm2,%%xmm2 \n\t" /* check if alpha is
zero */ \
+ "jz "J" \n\t"
+
#define SRC_A_PREMUL \
"pmullw %%xmm1, %%xmm2 \n\t" /* premultiply source
alpha */ \
"psrlw $8, %%xmm2 \n\t"
@@ -116,9 +120,12 @@ static void blend_case7(uint8_t *dest, uint8_t *src, int
width, uint8_t *src_a,
LOAD_WEIGHT
"loop_start7: \n\t"
LOAD_SRC_A
+ SRC_A_ZERO("skip_calc7")
SRC_A_PREMUL
+ SRC_A_ZERO("skip_calc7")
DST_A_CALC
DST_PIX_CALC
+ "skip_calc7: \n\t"
"add $0x08, %[src_a] \n\t"
"add $0x08, %[dest_a] \n\t"
PIX_POINTER_INC
@@ -137,8 +144,11 @@ static void blend_case3(uint8_t *dest, uint8_t *src, int
width, uint8_t *src_a,
LOAD_WEIGHT
"loop_start3: \n\t"
LOAD_SRC_A
+ SRC_A_ZERO("skip_calc3")
SRC_A_PREMUL
+ SRC_A_ZERO("skip_calc3")
DST_PIX_CALC
+ "skip_calc3: \n\t"
"add $0x08, %[src_a] \n\t"
PIX_POINTER_INC
"jnz loop_start3 \n\t"
@@ -155,7 +165,9 @@ static void blend_case2(uint8_t *dest, uint8_t *src, int
width, uint8_t *src_a)
LOAD_CONSTS
"loop_start2: \n\t"
LOAD_SRC_A
+ SRC_A_ZERO("skip_calc2")
DST_PIX_CALC
+ "skip_calc2: \n\t"
"add $0x08, %[src_a] \n\t"
PIX_POINTER_INC
"jnz loop_start2 \n\t"
@@ -210,8 +222,10 @@ static void blend_case6(uint8_t *dest, uint8_t *src, int
width, uint8_t *src_a,
LOAD_CONSTS
"loop_start6: \n\t"
LOAD_SRC_A
+ SRC_A_ZERO("skip_calc6")
DST_A_CALC
DST_PIX_CALC
+ "skip_calc6: \n\t"
"add $0x08, %[src_a] \n\t"
"add $0x08, %[dest_a] \n\t"
PIX_POINTER_INC
--
1.7.1
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Mlt-devel mailing list
Mlt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel