Home | History | Annotate | Download | only in api
      1 ;//
      2 ;//
      3 ;// File Name:  armVCCOMM_s.h
      4 ;// OpenMAX DL: v1.0.2
      5 ;// Revision:   12290
      6 ;// Date:       Wednesday, April 9, 2008
      7 ;//
      8 ;// (c) Copyright 2007-2008 ARM Limited. All Rights Reserved.
      9 ;//
     10 ;//
     11 ;//
     12 ;// ARM optimized OpenMAX AC header file
     13 ;//
     14 ;// Formula used:
     15 ;// MACRO for calculating median for three values.
     16 
     17 
     18 
     19     IF :LNOT::DEF:ARMVCCOMM_S_H
     20         INCLUDE armCOMM_s.h
     21     M_VARIANTS      CortexA8, ARM1136JS
     22 
     23     IF ARM1136JS :LOR: CortexA8
     24 
     25      ;///*
     26      ;// * Macro: M_MEDIAN3
     27      ;// *
     28      ;// * Description: Finds the median of three numbers
     29      ;// *
     30      ;// * Remarks:
     31      ;// *
     32      ;// * Parameters:
     33      ;// * [in] x     First entry for the list of three numbers.
     34      ;// * [in] y     Second entry for the list of three numbers.
     35      ;// *            Input value may be corrupted at the end of
     36      ;// *            the execution of this macro.
     37      ;// * [in] z     Third entry of the list of three numbers.
     38      ;// *            Input value corrupted at the end of the
     39      ;// *            execution of this macro.
     40      ;// * [in] t     Temporary scratch  register.
     41      ;// * [out]z     Median of the three numbers.
     42      ;// */
     43 
     44      MACRO
     45 
     46      M_MEDIAN3 $x, $y, $z, $t
     47 
     48      SUBS  $t, $y, $z; // if (y < z)
     49      ADDLT $z, $z, $t; //  swap y and z
     50      SUBLT $y, $y, $t;
     51 
     52      ;// Now z' <= y', so there are three cases for the
     53      ;// median value, depending on x.
     54 
     55      ;// 1) x <= z'      <= y'      : median value is z'
     56      ;// 2)      z' <= x <= y'      : median value is x
     57      ;// 3)      z'      <= y' <= x : median value is y'
     58 
     59      CMP   $z, $x;     // if ( x > min(y,z) )
     60      MOVLT $z, $x;     // ans = x
     61 
     62      CMP   $x, $y;     // if ( x > max(y,z) )
     63      MOVGT $z, $y;     // ans = max(y,z)
     64 
     65      MEND
     66     ENDIF
     67 
     68 
     69 
     70     ENDIF ;// ARMACCOMM_S_H
     71 
     72  END