Home | History | Annotate | Download | only in api
      1 ;//
      2 ;// Copyright (C) 2007-2008 ARM Limited
      3 ;//
      4 ;// Licensed under the Apache License, Version 2.0 (the "License");
      5 ;// you may not use this file except in compliance with the License.
      6 ;// You may obtain a copy of the License at
      7 ;//
      8 ;//      http://www.apache.org/licenses/LICENSE-2.0
      9 ;//
     10 ;// Unless required by applicable law or agreed to in writing, software
     11 ;// distributed under the License is distributed on an "AS IS" BASIS,
     12 ;// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13 ;// See the License for the specific language governing permissions and
     14 ;// limitations under the License.
     15 ;//
     16 ;//
     17 ;//
     18 ;// File Name:  armVCCOMM_s.h
     19 ;// OpenMAX DL: v1.0.2
     20 ;// Revision:   9641
     21 ;// Date:       Thursday, February 7, 2008
     22 ;//
     23 ;//
     24 ;//
     25 ;//
     26 ;// ARM optimized OpenMAX AC header file
     27 ;//
     28 ;// Formula used:
     29 ;// MACRO for calculating median for three values.
     30 
     31 
     32 
     33     IF :LNOT::DEF:ARMVCCOMM_S_H
     34         INCLUDE armCOMM_s.h
     35     M_VARIANTS      CortexA8, ARM1136JS
     36 
     37     IF ARM1136JS :LOR: CortexA8
     38 
     39      ;///*
     40      ;// * Macro: M_MEDIAN3
     41      ;// *
     42      ;// * Description: Finds the median of three numbers
     43      ;// *
     44      ;// * Remarks:
     45      ;// *
     46      ;// * Parameters:
     47      ;// * [in] x     First entry for the list of three numbers.
     48      ;// * [in] y     Second entry for the list of three numbers.
     49      ;// *            Input value may be corrupted at the end of
     50      ;// *            the execution of this macro.
     51      ;// * [in] z     Third entry of the list of three numbers.
     52      ;// *            Input value corrupted at the end of the
     53      ;// *            execution of this macro.
     54      ;// * [in] t     Temporary scratch  register.
     55      ;// * [out]z     Median of the three numbers.
     56      ;// */
     57 
     58      MACRO
     59 
     60      M_MEDIAN3 $x, $y, $z, $t
     61 
     62      SUBS  $t, $y, $z; // if (y < z)
     63      ADDLT $z, $z, $t; //  swap y and z
     64      SUBLT $y, $y, $t;
     65 
     66      ;// Now z' <= y', so there are three cases for the
     67      ;// median value, depending on x.
     68 
     69      ;// 1) x <= z'      <= y'      : median value is z'
     70      ;// 2)      z' <= x <= y'      : median value is x
     71      ;// 3)      z'      <= y' <= x : median value is y'
     72 
     73      CMP   $z, $x;     // if ( x > min(y,z) )
     74      MOVLT $z, $x;     // ans = x
     75 
     76      CMP   $x, $y;     // if ( x > max(y,z) )
     77      MOVGT $z, $y;     // ans = max(y,z)
     78 
     79      MEND
     80     ENDIF
     81 
     82 
     83 
     84     ENDIF ;// ARMACCOMM_S_H
     85 
     86  END
     87