1 /*
2  * Copyright (c) 2020 Martin Storsjo
3  *
4  * This file is part of FFmpeg.
5  *
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.
10  *
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.
15  *
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  */
20 
21 #include "libavutil/arm/asm.S"
22 
23 .macro vld1_8 dst, src, incr, aligned
24 .if \aligned
25         vld1.8          {\dst}, [\src, :64], \incr
26 .else
27         vld1.8          {\dst}, [\src], \incr
28 .endif
29 .endm
30 
31 .macro get_pixels suffix, aligned
32 function ff_get_pixels\suffix\()_neon, export=1
33         mov             r3,  #8
34 1:
35         vld1_8          d0,  r1,  r2,  \aligned
36         subs            r3,  r3,  #2
37         vld1_8          d2,  r1,  r2,  \aligned
38         vmovl.u8        q0,  d0
39         vmovl.u8        q1,  d2
40         vst1.16         {q0, q1}, [r0, :128]!
41         bgt             1b
42 
43         bx              lr
44 endfunc
45 .endm
46 
47 get_pixels , aligned=1
48 get_pixels _unaligned, aligned=0
49 
50 .macro diff_pixels suffix, aligned=0
51 function ff_diff_pixels\suffix\()_neon, export=1
52         mov             r12, #8
53 1:
54         vld1_8          d0,  r1,  r3,  \aligned
55         vld1_8          d1,  r2,  r3,  \aligned
56         subs            r12, r12, #2
57         vld1_8          d2,  r1,  r3,  \aligned
58         vsubl.u8        q0,  d0,  d1
59         vld1_8          d3,  r2,  r3,  \aligned
60         vsubl.u8        q1,  d2,  d3
61         vst1.16         {q0, q1}, [r0]!
62         bgt             1b
63 
64         bx              lr
65 endfunc
66 .endm
67 
68 diff_pixels , aligned=1
69 diff_pixels _unaligned, aligned=0
70