1 ;*****************************************************************************
2 ;* x86-optimized functions for blend filter
4 ;* Copyright (C) 2015 Paul B Mahol
6 ;* This file is part of FFmpeg.
8 ;* FFmpeg is free software; you can redistribute it and/or
9 ;* modify it under the terms of the GNU Lesser General Public
10 ;* License as published by the Free Software Foundation; either
11 ;* version 2.1 of the License, or (at your option) any later version.
13 ;* FFmpeg is distributed in the hope that it will be useful,
14 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 ;* Lesser General Public License for more details.
18 ;* You should have received a copy of the GNU Lesser General Public
19 ;* License along with FFmpeg; if not, write to the Free Software
20 ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 ;******************************************************************************
23 %include "libavutil/x86/x86util.asm"
27 pw_128: times 8 dw 128
28 pw_255: times 8 dw 255
29 pb_127: times 16 db 127
30 pb_128: times 16 db 128
31 pb_255: times 16 db 255
37 cglobal blend_%1, 6, 9, %2, top, top_linesize, bottom, bottom_linesize, dst, dst_linesize, width, end, x
38 mov widthd, dword widthm
40 cglobal blend_%1, 5, 7, %2, top, top_linesize, bottom, bottom_linesize, dst, end, x
41 %define dst_linesizeq r5mp
48 sub endd, dword r7m ; start
53 add topq, top_linesizeq
54 add bottomq, bottom_linesizeq
55 add dstq, dst_linesizeq
68 movu m1, [bottomq + xq]
80 BLEND_SIMPLE addition, addusb
81 BLEND_SIMPLE subtract, subusb
82 BLEND_SIMPLE darken, minub
83 BLEND_SIMPLE lighten, maxub
85 BLEND_INIT difference128, 4
93 movh m1, [bottomq + xq]
104 BLEND_INIT average, 3
111 movh m1, [bottomq + xq]
122 BLEND_INIT addition128, 4
130 movh m1, [bottomq + xq]
141 BLEND_INIT hardmix, 5
150 movu m1, [bottomq + xq]
160 BLEND_INIT phoenix, 4
167 movu m1, [bottomq + xq]
180 BLEND_INIT difference, 3
187 movh m1, [bottomq + xq]
198 BLEND_INIT negation, 5
206 movh m1, [bottomq + xq]