1 ;*****************************************************************************
2 ;* x86-optimized functions for v360 filter
4 ;* This file is part of FFmpeg.
6 ;* FFmpeg is free software; you can redistribute it and/or
7 ;* modify it under the terms of the GNU Lesser General Public
8 ;* License as published by the Free Software Foundation; either
9 ;* version 2.1 of the License, or (at your option) any later version.
11 ;* FFmpeg is distributed in the hope that it will be useful,
12 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 ;* Lesser General Public License for more details.
16 ;* You should have received a copy of the GNU Lesser General Public
17 ;* License along with FFmpeg; if not, write to the Free Software
18 ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 ;******************************************************************************
21 %if HAVE_AVX2_EXTERNAL && ARCH_X86_64
23 %include "libavutil/x86/x86util.asm"
27 pb_mask: db 0,4,8,12,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
28 pd_255: times 4 dd 255
32 ; void ff_remap2_8bit_line_avx2(uint8_t *dst, int width, const uint8_t *src, ptrdiff_t in_linesize,
33 ; const uint16_t *u, const uint16_t *v, const int16_t *ker);
36 cglobal remap1_8bit_line, 6, 7, 6, dst, width, src, in_linesize, u, v, x
37 movsxdifnidn widthq, widthd
39 movd xm0, in_linesized
41 VBROADCASTI128 m3, [pb_mask]
45 pmovsxwd m1, [vq + xq * 2]
46 pmovsxwd m2, [uq + xq * 2]
51 vpgatherdd m5, [srcq + m1], m2
53 vextracti128 xm2, m1, 1
63 cglobal remap2_8bit_line, 7, 8, 8, dst, width, src, in_linesize, u, v, ker, x
64 movsxdifnidn widthq, widthd
66 movd xm0, in_linesized
69 vpbroadcastd m6, [pd_255]
72 pmovsxwd m1, [kerq + xq * 8]
73 pmovsxwd m2, [vq + xq * 8]
74 pmovsxwd m3, [uq + xq * 8]
79 vpgatherdd m2, [srcq + m4], m3
85 vextracti128 xm2, m1, 1
87 pextrb [dstq+xq], xm1, 0
88 pextrb [dstq+xq+1], xm2, 0
96 cglobal remap4_8bit_line, 7, 9, 11, dst, width, src, in_linesize, u, v, ker, x, y
97 movsxdifnidn widthq, widthd
100 movd xm0, in_linesized
103 vpbroadcastd m6, [pd_255]
106 pmovsxwd m1, [kerq + yq]
107 pmovsxwd m5, [kerq + yq + 16]
108 pmovsxwd m2, [vq + yq]
109 pmovsxwd m8, [vq + yq + 16]
110 pmovsxwd m3, [uq + yq]
111 pmovsxwd m9, [uq + yq + 16]
118 vpgatherdd m2, [srcq + m4], m3
120 vpgatherdd m4, [srcq + m10], m3
127 vextracti128 xm1, m2, 1
134 pextrb [dstq+xq], xm1, 0