armVCM4P2_CompareMV.c revision 0c1bc742181ded4930842b46e9507372f0b1b963
1/** 2 * 3 * File Name: armVCM4P2_CompareMV.c 4 * OpenMAX DL: v1.0.2 5 * Revision: 9641 6 * Date: Thursday, February 7, 2008 7 * 8 * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. 9 * 10 * 11 * 12 * Description: 13 * Contains module for comparing motion vectors and SAD's to decide 14 * the best MV and SAD 15 * 16 */ 17 18#include "omxtypes.h" 19#include "armOMX.h" 20 21#include "armVC.h" 22#include "armCOMM.h" 23 24/** 25 * Function: armVCM4P2_CompareMV 26 * 27 * Description: 28 * Performs comparision of motion vectors and SAD's to decide the 29 * best MV and SAD 30 * 31 * Remarks: 32 * 33 * Parameters: 34 * [in] mvX x coordinate of the candidate motion vector 35 * [in] mvY y coordinate of the candidate motion vector 36 * [in] candSAD Candidate SAD 37 * [in] bestMVX x coordinate of the best motion vector 38 * [in] bestMVY y coordinate of the best motion vector 39 * [in] bestSAD best SAD 40 * 41 * Return Value: 42 * OMX_INT -- 1 to indicate that the current sad is the best 43 * 0 to indicate that it is NOT the best SAD 44 */ 45 46OMX_INT armVCM4P2_CompareMV ( 47 OMX_S16 mvX, 48 OMX_S16 mvY, 49 OMX_INT candSAD, 50 OMX_S16 bestMVX, 51 OMX_S16 bestMVY, 52 OMX_INT bestSAD 53) 54{ 55 if (candSAD < bestSAD) 56 { 57 return 1; 58 } 59 if (candSAD > bestSAD) 60 { 61 return 0; 62 } 63 /* shorter motion vector */ 64 if ( (mvX * mvX + mvY * mvY) < (bestMVX*bestMVX+bestMVY*bestMVY) ) 65 { 66 return 1; 67 } 68 return 0; 69} 70 71/*End of File*/ 72