Browse Source

avfilter/x86/vf_blend : reorganize DIFFERENCE macro to reduce line duplication between 8bit and 16 bit version

tags/n4.0
Martin Vignali 7 years ago
parent
commit
8eb0bb1108
1 changed files with 16 additions and 22 deletions
  1. +16
    -22
      libavfilter/x86/vf_blend.asm

+ 16
- 22
libavfilter/x86/vf_blend.asm View File

@@ -295,8 +295,9 @@ BLEND_INIT %1, 4, %3
BLEND_END BLEND_END
%endmacro %endmacro


%macro DIFFERENCE 1-2
BLEND_INIT %1, 5, %2
; %1 name , %2 src (b or w), %3 inter (w or d), %4 (1 if 16bit, not set if 8 bit)
%macro DIFFERENCE 3-4
BLEND_INIT %1, 5, %4
pxor m2, m2 pxor m2, m2
.nextrow: .nextrow:
mov xq, widthq mov xq, widthq
@@ -304,26 +305,19 @@ BLEND_INIT %1, 5, %2
.loop: .loop:
movu m0, [topq + xq] movu m0, [topq + xq]
movu m1, [bottomq + xq] movu m1, [bottomq + xq]
%if %0 == 2 ; 16 bit
punpckhwd m3, m0, m2
punpcklwd m0, m2
punpckhwd m4, m1, m2
punpcklwd m1, m2
psubd m0, m1
psubd m3, m4
punpckh%2%3 m3, m0, m2
punpckl%2%3 m0, m2
punpckh%2%3 m4, m1, m2
punpckl%2%3 m1, m2
psub%3 m0, m1
psub%3 m3, m4
%if %0 == 4; 16 bit
pabsd m0, m0 pabsd m0, m0
pabsd m3, m3 pabsd m3, m3
packusdw m0, m3
%else %else
punpckhbw m3, m0, m2
punpcklbw m0, m2
punpckhbw m4, m1, m2
punpcklbw m1, m2
psubw m0, m1
psubw m3, m4
ABS2 m0, m3, m1, m4 ABS2 m0, m3, m1, m4
packuswb m0, m3
%endif %endif
packus%3%2 m0, m3
mova [dstq + xq], m0 mova [dstq + xq], m0
add xq, mmsize add xq, mmsize
jl .loop jl .loop
@@ -397,7 +391,7 @@ AVERAGE
GRAINMERGE GRAINMERGE
HARDMIX HARDMIX
PHOENIX phoenix, b PHOENIX phoenix, b
DIFFERENCE difference
DIFFERENCE difference, b, w
DIVIDE DIVIDE


BLEND_ABS BLEND_ABS
@@ -411,7 +405,7 @@ BLEND_SIMPLE xor_16, xor, 1
%endif %endif


INIT_XMM ssse3 INIT_XMM ssse3
DIFFERENCE difference
DIFFERENCE difference, b, w
BLEND_ABS BLEND_ABS


INIT_XMM sse4 INIT_XMM sse4
@@ -419,7 +413,7 @@ INIT_XMM sse4
BLEND_SIMPLE darken_16, minuw, 1 BLEND_SIMPLE darken_16, minuw, 1
BLEND_SIMPLE lighten_16, maxuw, 1 BLEND_SIMPLE lighten_16, maxuw, 1
PHOENIX phoenix_16, w, 1 PHOENIX phoenix_16, w, 1
DIFFERENCE difference_16, 1
DIFFERENCE difference_16, w, d, 1
%endif %endif


%if HAVE_AVX2_EXTERNAL %if HAVE_AVX2_EXTERNAL
@@ -439,7 +433,7 @@ GRAINMERGE
HARDMIX HARDMIX
PHOENIX phoenix, b PHOENIX phoenix, b


DIFFERENCE difference
DIFFERENCE difference, b, w
BLEND_ABS BLEND_ABS


%if ARCH_X86_64 %if ARCH_X86_64
@@ -451,6 +445,6 @@ BLEND_SIMPLE or_16, or, 1
BLEND_SIMPLE subtract_16, subusw, 1 BLEND_SIMPLE subtract_16, subusw, 1
BLEND_SIMPLE xor_16, xor, 1 BLEND_SIMPLE xor_16, xor, 1
PHOENIX phoenix_16, w, 1 PHOENIX phoenix_16, w, 1
DIFFERENCE difference_16, 1
DIFFERENCE difference_16, w, d, 1
%endif %endif
%endif %endif

Loading…
Cancel
Save