1 /** 2 * 3 * File Name: armVCCOMM_SAD.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 * Description: 12 * This function will calculate SAD for NxM blocks 13 * 14 */ 15 16 #include "omxtypes.h" 17 #include "armOMX.h" 18 #include "omxVC.h" 19 20 #include "armCOMM.h" 21 22 /** 23 * Function: armVCCOMM_SAD 24 * 25 * Description: 26 * This function calculate the SAD for NxM blocks. 27 * 28 * Remarks: 29 * 30 * [in] pSrcOrg Pointer to the original block 31 * [in] iStepOrg Step of the original block buffer 32 * [in] pSrcRef Pointer to the reference block 33 * [in] iStepRef Step of the reference block buffer 34 * [in] iHeight Height of the block 35 * [in] iWidth Width of the block 36 * [out] pDstSAD Pointer of result SAD 37 * 38 * Return Value: 39 * Standard OMXResult value. 40 * 41 */ 42 OMXResult armVCCOMM_SAD( 43 const OMX_U8* pSrcOrg, 44 OMX_U32 iStepOrg, 45 const OMX_U8* pSrcRef, 46 OMX_U32 iStepRef, 47 OMX_S32* pDstSAD, 48 OMX_U32 iHeight, 49 OMX_U32 iWidth 50 ) 51 { 52 OMX_INT x, y; 53 54 /* check for argument error */ 55 armRetArgErrIf(pSrcOrg == NULL, OMX_Sts_BadArgErr) 56 armRetArgErrIf(pSrcRef == NULL, OMX_Sts_BadArgErr) 57 armRetArgErrIf(pDstSAD == NULL, OMX_Sts_BadArgErr) 58 59 *pDstSAD = 0; 60 for (y = 0; y < iHeight; y++) 61 { 62 for (x = 0; x < iWidth; x++) 63 { 64 *pDstSAD += armAbs(pSrcOrg [(y * iStepOrg) + x] - 65 pSrcRef [(y * iStepRef) + x]); 66 } 67 } 68 69 return OMX_Sts_NoErr; 70 } 71 72 /***************************************************************************** 73 * END OF FILE 74 *****************************************************************************/ 75 76