x86/vf_blend: add sse2 versions of blend_difference and blend_negation
authorJames Almer <jamrial@gmail.com>
Thu, 24 Dec 2015 02:55:56 +0000 (23:55 -0300)
committerJames Almer <jamrial@gmail.com>
Thu, 24 Dec 2015 16:05:27 +0000 (13:05 -0300)
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
libavfilter/x86/vf_blend.asm
libavfilter/x86/vf_blend_init.c

index 5f0271a..730be77 100644 (file)
@@ -176,7 +176,7 @@ BLEND_INIT phoenix, 4
     jl .loop
 BLEND_END
 
-INIT_XMM ssse3
+%macro BLEND_ABS 0
 BLEND_INIT difference, 3
     pxor       m2, m2
 .nextrow:
@@ -188,7 +188,7 @@ BLEND_INIT difference, 3
         punpcklbw       m0, m2
         punpcklbw       m1, m2
         psubw           m0, m1
-        pabsw           m0, m0
+        ABS1            m0, m1
         packuswb        m0, m0
         movh   [dstq + xq], m0
         add             xq, mmsize / 2
@@ -209,7 +209,7 @@ BLEND_INIT negation, 5
         mova            m3, m4
         psubw           m3, m0
         psubw           m3, m1
-        pabsw           m3, m3
+        ABS1            m3, m1
         mova            m0, m4
         psubw           m0, m3
         packuswb        m0, m0
@@ -217,3 +217,9 @@ BLEND_INIT negation, 5
         add             xq, mmsize / 2
     jl .loop
 BLEND_END
+%endmacro
+
+INIT_XMM sse2
+BLEND_ABS
+INIT_XMM ssse3
+BLEND_ABS
index b7d234f..dc29547 100644 (file)
@@ -42,7 +42,9 @@ BLEND_FUNC(or, sse2)
 BLEND_FUNC(phoenix, sse2)
 BLEND_FUNC(subtract, sse2)
 BLEND_FUNC(xor, sse2)
+BLEND_FUNC(difference, sse2)
 BLEND_FUNC(difference, ssse3)
+BLEND_FUNC(negation, sse2)
 BLEND_FUNC(negation, ssse3)
 
 av_cold void ff_blend_init_x86(FilterParams *param, int is_16bit)
@@ -63,6 +65,8 @@ av_cold void ff_blend_init_x86(FilterParams *param, int is_16bit)
         case BLEND_PHOENIX:  param->blend = ff_blend_phoenix_sse2;  break;
         case BLEND_SUBTRACT: param->blend = ff_blend_subtract_sse2; break;
         case BLEND_XOR:      param->blend = ff_blend_xor_sse2;      break;
+        case BLEND_DIFFERENCE: param->blend = ff_blend_difference_sse2; break;
+        case BLEND_NEGATION:   param->blend = ff_blend_negation_sse2;   break;
         }
     }
     if (EXTERNAL_SSSE3(cpu_flags) && param->opacity == 1 && !is_16bit) {