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"
28 pw_128: times 8 dw 128
29 pw_255: times 8 dw 255
30 pb_127: times 16 db 127
31 pb_128: times 16 db 128
32 pb_255: times 16 db 255
37 cglobal blend_xor, 9, 11, 2, 0, top, top_linesize, bottom, bottom_linesize, dst, dst_linesize, width, start, end
49 movu m1, [bottomq + x]
55 add topq, top_linesizeq
56 add bottomq, bottom_linesizeq
57 add dstq, dst_linesizeq
62 cglobal blend_or, 9, 11, 2, 0, top, top_linesize, bottom, bottom_linesize, dst, dst_linesize, width, start, end
74 movu m1, [bottomq + x]
80 add topq, top_linesizeq
81 add bottomq, bottom_linesizeq
82 add dstq, dst_linesizeq
87 cglobal blend_and, 9, 11, 2, 0, top, top_linesize, bottom, bottom_linesize, dst, dst_linesize, width, start, end
99 movu m1, [bottomq + x]
105 add topq, top_linesizeq
106 add bottomq, bottom_linesizeq
107 add dstq, dst_linesizeq
112 cglobal blend_addition, 9, 11, 2, 0, top, top_linesize, bottom, bottom_linesize, dst, dst_linesize, width, start, end
124 movu m1, [bottomq + x]
130 add topq, top_linesizeq
131 add bottomq, bottom_linesizeq
132 add dstq, dst_linesizeq
137 cglobal blend_subtract, 9, 11, 2, 0, top, top_linesize, bottom, bottom_linesize, dst, dst_linesize, width, start, end
149 movu m1, [bottomq + x]
155 add topq, top_linesizeq
156 add bottomq, bottom_linesizeq
157 add dstq, dst_linesizeq
162 cglobal blend_difference128, 9, 11, 4, 0, top, top_linesize, bottom, bottom_linesize, dst, dst_linesize, width, start, end
176 movh m1, [bottomq + x]
186 add topq, top_linesizeq
187 add bottomq, bottom_linesizeq
188 add dstq, dst_linesizeq
193 cglobal blend_average, 9, 11, 3, 0, top, top_linesize, bottom, bottom_linesize, dst, dst_linesize, width, start, end
206 movh m1, [bottomq + x]
216 add topq, top_linesizeq
217 add bottomq, bottom_linesizeq
218 add dstq, dst_linesizeq
223 cglobal blend_addition128, 9, 11, 4, 0, top, top_linesize, bottom, bottom_linesize, dst, dst_linesize, width, start, end
237 movh m1, [bottomq + x]
247 add topq, top_linesizeq
248 add bottomq, bottom_linesizeq
249 add dstq, dst_linesizeq
254 cglobal blend_darken, 9, 11, 2, 0, top, top_linesize, bottom, bottom_linesize, dst, dst_linesize, width, start, end
266 movu m1, [bottomq + x]
272 add topq, top_linesizeq
273 add bottomq, bottom_linesizeq
274 add dstq, dst_linesizeq
279 cglobal blend_hardmix, 9, 11, 5, 0, top, top_linesize, bottom, bottom_linesize, dst, dst_linesize, width, start, end
294 movu m1, [bottomq + x]
303 add topq, top_linesizeq
304 add bottomq, bottom_linesizeq
305 add dstq, dst_linesizeq
310 cglobal blend_lighten, 9, 11, 2, 0, top, top_linesize, bottom, bottom_linesize, dst, dst_linesize, width, start, end
322 movu m1, [bottomq + x]
328 add topq, top_linesizeq
329 add bottomq, bottom_linesizeq
330 add dstq, dst_linesizeq
335 cglobal blend_phoenix, 9, 11, 4, 0, top, top_linesize, bottom, bottom_linesize, dst, dst_linesize, width, start, end
348 movu m1, [bottomq + x]
359 add topq, top_linesizeq
360 add bottomq, bottom_linesizeq
361 add dstq, dst_linesizeq
367 cglobal blend_difference, 9, 11, 3, 0, top, top_linesize, bottom, bottom_linesize, dst, dst_linesize, width, start, end
380 movh m1, [bottomq + x]
390 add topq, top_linesizeq
391 add bottomq, bottom_linesizeq
392 add dstq, dst_linesizeq
397 cglobal blend_negation, 9, 11, 5, 0, top, top_linesize, bottom, bottom_linesize, dst, dst_linesize, width, start, end
411 movh m1, [bottomq + x]
425 add topq, top_linesizeq
426 add bottomq, bottom_linesizeq
427 add dstq, dst_linesizeq