• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*!
2 * \copy
3 *     Copyright (c)  2013, Cisco Systems
4 *     All rights reserved.
5 *
6 *     Redistribution and use in source and binary forms, with or without
7 *     modification, are permitted provided that the following conditions
8 *     are met:
9 *
10 *        * Redistributions of source code must retain the above copyright
11 *          notice, this list of conditions and the following disclaimer.
12 *
13 *        * Redistributions in binary form must reproduce the above copyright
14 *          notice, this list of conditions and the following disclaimer in
15 *          the documentation and/or other materials provided with the
16 *          distribution.
17 *
18 *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 *     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 *     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 *     FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 *     COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23 *     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 *     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 *     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 *     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28 *     ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 *     POSSIBILITY OF SUCH DAMAGE.
30 *
31 */
32
33#ifdef HAVE_NEON_AARCH64
34#include "arm_arch64_common_macro.S"
35WELS_ASM_AARCH64_FUNC_BEGIN SampleVariance16x16_AArch64_neon
36    SIGN_EXTENSION x1, w1
37    SIGN_EXTENSION x3, w3
38    ld1   {v1.16b}, [x0], x1 //save the ref data (16bytes)
39    ld1   {v0.16b}, [x2], x3 //save the src data (16bytes)
40    uabd  v2.16b, v0.16b, v1.16b
41    umull  v3.8h, v2.8b, v2.8b
42    umull2 v4.8h, v2.16b, v2.16b
43    uaddlp v4.4s, v4.8h
44    uadalp v4.4s, v3.8h //sqr
45    uaddlp v2.8h, v2.16b //sum
46
47    uaddlp v1.8h, v0.16b //sum_cur
48
49    umull  v3.8h, v0.8b, v0.8b
50    umull2 v5.8h, v0.16b, v0.16b
51    uaddlp v3.4s, v3.8h
52    uadalp v3.4s, v5.8h //sqr_cur
53.rept 15
54    ld1   {v5.16b}, [x0], x1 //save the ref data (16bytes)
55    ld1   {v0.16b}, [x2], x3 //save the src data (16bytes)
56
57    uabd  v6.16b, v0.16b, v5.16b
58
59    //v1 save sum_cur
60    uadalp v1.8h, v0.16b
61
62    //v4 save sqr
63    umull  v5.8h, v6.8b, v6.8b
64    umull2 v7.8h, v6.16b, v6.16b
65    uadalp v4.4s, v5.8h //sqr
66    uadalp v4.4s, v7.8h //sqr
67
68    //v2 save sum
69    uadalp v2.8h, v6.16b
70
71    //v3 save sqr_cur
72    umull  v5.8h, v0.8b, v0.8b
73    umull2 v7.8h, v0.16b, v0.16b
74    uadalp v3.4s, v5.8h //sqr_cur
75    uadalp v3.4s, v7.8h //sqr_cur
76.endr
77    uaddlv s2, v2.8h //sum
78    uaddlv s1, v1.8h //sum_cur
79    ins    v2.s[1], v1.s[0] // sum, sum_cur
80    shrn   v2.4h, v2.4s, #8 // sum, sum_cur>>8
81    mul    v2.4h, v2.4h, v2.4h//// sum*sum, sum_cur*sum_cur
82    uaddlv d4, v4.4s //sqr
83    uaddlv d3, v3.4s //sqr_cur
84    ins    v4.s[1], v3.s[0] // sqr, sqr_cur
85    shrn   v4.4h, v4.4s, #8 // sqr, sqr_cur>>8
86    sub    v4.4h, v4.4h, v2.4h
87    st1  {v4.s}[0], [x4]
88WELS_ASM_AARCH64_FUNC_END
89#endif
90