]> git.sesse.net Git - ffmpeg/blob - libavfilter/x86/vf_maskedmerge.asm
avformat: Remove FFserver leftovers
[ffmpeg] / libavfilter / x86 / vf_maskedmerge.asm
1 ;*****************************************************************************
2 ;* x86-optimized functions for maskedmerge filter
3 ;*
4 ;* Copyright (C) 2015 Paul B Mahol
5 ;*
6 ;* This file is part of FFmpeg.
7 ;*
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.
12 ;*
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.
17 ;*
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 ;*****************************************************************************
22
23 %include "libavutil/x86/x86util.asm"
24
25 SECTION_RODATA
26
27 pw_128: times 8 dw 128
28 pw_256: times 8 dw 256
29
30 SECTION .text
31
32 INIT_XMM sse2
33 %if ARCH_X86_64
34 cglobal maskedmerge8, 8, 11, 7, bsrc, osrc, msrc, dst, blinesize, olinesize, mlinesize, dlinesize, w, h, x
35     mov         wd, dword wm
36     mov         hd, dword hm
37 %else
38 cglobal maskedmerge8, 5, 7, 7, bsrc, osrc, msrc, dst, blinesize, w, x
39     mov         wd, r8m
40 %define olinesizeq r5mp
41 %define mlinesizeq r6mp
42 %define dlinesizeq r7mp
43 %define hd r9mp
44 %endif
45     mova        m4, [pw_256]
46     mova        m5, [pw_128]
47     pxor        m6, m6
48     add      bsrcq, wq
49     add      osrcq, wq
50     add      msrcq, wq
51     add       dstq, wq
52     neg         wq
53 .nextrow:
54     mov         xq, wq
55
56     .loop:
57         movh            m0, [bsrcq + xq]
58         movh            m1, [osrcq + xq]
59         movh            m3, [msrcq + xq]
60         mova            m2, m4
61         punpcklbw       m0, m6
62         punpcklbw       m1, m6
63         punpcklbw       m3, m6
64         psubw           m2, m3
65         pmullw          m2, m0
66         pmullw          m1, m3
67         paddw           m1, m2
68         paddw           m1, m5
69         psrlw           m1, 8
70         packuswb        m1, m1
71         movh   [dstq + xq], m1
72         add             xq, mmsize / 2
73     jl .loop
74
75     add         bsrcq, blinesizeq
76     add         osrcq, olinesizeq
77     add         msrcq, mlinesizeq
78     add          dstq, dlinesizeq
79     sub         hd, 1
80     jg .nextrow
81 REP_RET