1//******************************************************************************
2//*
3//* Copyright (C) 2015 The Android Open Source Project
4//*
5//* Licensed under the Apache License, Version 2.0 (the "License");
6//* you may not use this file except in compliance with the License.
7//* You may obtain a copy of the License at:
8//*
9//* http://www.apache.org/licenses/LICENSE-2.0
10//*
11//* Unless required by applicable law or agreed to in writing, software
12//* distributed under the License is distributed on an "AS IS" BASIS,
13//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14//* See the License for the specific language governing permissions and
15//* limitations under the License.
16//*
17//*****************************************************************************
18//* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19//*/
20
21
22//******************************************************************************
23//*
24//*
25//* @brief
26//*  This file contains definitions of routines for SAD caclulation
27//*
28//* @author
29//*  Ittiam
30//*
31//* @par List of Functions:
32//*  - icv_sad_8x4_av8()
33//*
34//* @remarks
35//*  None
36//*
37//*******************************************************************************
38
39
40//******************************************************************************
41//*
42//*  @brief computes distortion (SAD) between 2 8x4  blocks
43//*
44//*
45//*  @par   Description
46//*   This functions computes SAD between 2 8x4 blocks.
47//*
48//* @param[in] pu1_src
49//*  UWORD8 pointer to the source
50//*
51//* @param[out] pu1_ref
52//*  UWORD8 pointer to the reference buffer
53//*
54//* @param[in] src_strd
55//*  integer source stride
56//*
57//* @param[in] ref_strd
58//*  integer reference stride
59//*
60//* @param[in] wd
61//*  Width (assumed to be 8)
62//*
63//* @param[in] ht
64//*  Height (assumed to be 4)
65//*
66//* @returns
67//*     SAD value in r0
68//*
69//* @remarks
70//*
71//******************************************************************************
72
73    .global icv_sad_8x4_av8
74
75icv_sad_8x4_av8:
76
77    // Load 8x4 source
78    ld1     {v0.8b},    [x0],     x2
79    ld1     {v1.8b},    [x0],     x2
80    ld1     {v2.8b},    [x0],     x2
81    ld1     {v3.8b},    [x0],     x2
82
83    // Load 8x4 reference
84    ld1     {v4.8b},    [x1],     x3
85    ld1     {v5.8b},    [x1],     x3
86    ld1     {v6.8b},    [x1],     x3
87    ld1     {v7.8b},    [x1],     x3
88
89    uabdl   v0.8h,      v0.8b,      v4.8b
90    uabal   v0.8h,      v1.8b,      v5.8b
91    uabal   v0.8h,      v2.8b,      v6.8b
92    uabal   v0.8h,      v3.8b,      v7.8b
93
94    addp    v0.8h,      v0.8h,      v0.8h
95    addp    v0.8h,      v0.8h,      v0.8h
96    addp    v0.8h,      v0.8h,      v0.8h
97
98    smov    x0,         v0.8h[0]
99
100    ret
101