x86/vf_blend: add sse2 versions of blend_difference and blend_negation

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2015-12-23 23:55:56 -03:00
parent 02f428051a
commit 8dba3fb8fd
2 changed files with 13 additions and 3 deletions

View 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

View 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) {