Home | History | Annotate | Download | only in arm
      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 variance caclulation
     27 @*
     28 @* @author
     29 @*  Ittiam
     30 @*
     31 @* @par List of Functions:
     32 @*  - icv_variance_8x4_a9()
     33 @*
     34 @* @remarks
     35 @*  None
     36 @*
     37 @*******************************************************************************
     38 
     39 
     40 @******************************************************************************
     41 @*
     42 @*  @brief computes variance of a 8x4  block
     43 @*
     44 @*
     45 @*  @par   Description
     46 @*   This functions computes variance of a 8x4  block
     47 @*
     48 @* @param[in] pu1_src
     49 @*  UWORD8 pointer to the source
     50 @*
     51 @* @param[in] src_strd
     52 @*  integer source stride
     53 @*
     54 @* @param[in] wd
     55 @*  Width (assumed to be 8)
     56 @*
     57 @* @param[in] ht
     58 @*  Height (assumed to be 4)
     59 @*
     60 @* @returns
     61 @*  variance value in r0
     62 @*
     63 @* @remarks
     64 @*
     65 @******************************************************************************
     66 
     67     .global icv_variance_8x4_a9
     68 
     69 icv_variance_8x4_a9:
     70 
     71     push        {lr}
     72 
     73     @ Load 8x4 source
     74     vld1.8      d0,     [r0],   r1
     75     vld1.8      d1,     [r0],   r1
     76     vld1.8      d2,     [r0],   r1
     77     vld1.8      d3,     [r0],   r1
     78 
     79     @ Calculate Sum(values)
     80     vaddl.u8    q2,     d0,     d1
     81     vaddl.u8    q3,     d2,     d3
     82     vadd.u16    q2,     q2,     q3
     83 
     84     vadd.u16    d4,     d4,     d5
     85     vpadd.u16   d4,     d4,     d4
     86     vpadd.u16   d4,     d4,     d4
     87 
     88     @ Calculate SumOfSquares
     89     vmull.u8    q10,    d0,     d0
     90     vmull.u8    q11,    d1,     d1
     91     vmull.u8    q12,    d2,     d2
     92     vmull.u8    q13,    d3,     d3
     93 
     94     vaddl.u16   q10,    d20,    d21
     95     vaddl.u16   q11,    d22,    d23
     96     vaddl.u16   q12,    d24,    d25
     97     vaddl.u16   q13,    d26,    d27
     98 
     99     vadd.u32    q10,    q10,    q11
    100     vadd.u32    q11,    q12,    q13
    101     vadd.u32    q10,    q10,    q11
    102     vadd.u32    d20,    d20,    d21
    103     vpadd.u32   d20,    d20,    d20
    104 
    105     @ Sum(values)
    106     vmov.u16     r0,    d4[0]
    107 
    108     @ SumOfSquares
    109     vmov.u32     r1,    d20[0]
    110 
    111     @ SquareOfSums
    112     mul         r3,     r0,     r0
    113 
    114     @ SumOfSquares * 8 * 4 - SquareOfSums
    115     rsb         r0,     r3,     r1,     LSL #5
    116 
    117     @ Divide by 32 * 32
    118 
    119     mov         r0,     r0,     ASR #10
    120     pop         {pc}
    121