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