1 /** 2 * 3 * File Name: armVCCOMM_Average.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 Average of two blocks if size iWidth X iHeight 13 * 14 */ 15 16 #include "omxtypes.h" 17 #include "armOMX.h" 18 #include "omxVC.h" 19 20 #include "armCOMM.h" 21 #include "armVC.h" 22 23 /** 24 * Function: armVCCOMM_Average 25 * 26 * Description: 27 * This function calculates the average of two blocks and stores the result. 28 * 29 * Remarks: 30 * 31 * [in] pPred0 Pointer to the top-left corner of reference block 0 32 * [in] pPred1 Pointer to the top-left corner of reference block 1 33 * [in] iPredStep0 Step of reference block 0 34 * [in] iPredStep1 Step of reference block 1 35 * [in] iDstStep Step of the destination buffer 36 * [in] iWidth Width of the blocks 37 * [in] iHeight Height of the blocks 38 * [out] pDstPred Pointer to the destination buffer 39 * 40 * Return Value: 41 * Standard OMXResult value. 42 * 43 */ 44 OMXResult armVCCOMM_Average ( 45 const OMX_U8* pPred0, 46 const OMX_U8* pPred1, 47 OMX_U32 iPredStep0, 48 OMX_U32 iPredStep1, 49 OMX_U8* pDstPred, 50 OMX_U32 iDstStep, 51 OMX_U32 iWidth, 52 OMX_U32 iHeight 53 ) 54 { 55 OMX_U32 x, y; 56 57 /* check for argument error */ 58 armRetArgErrIf(pPred0 == NULL, OMX_Sts_BadArgErr) 59 armRetArgErrIf(pPred1 == NULL, OMX_Sts_BadArgErr) 60 armRetArgErrIf(pDstPred == NULL, OMX_Sts_BadArgErr) 61 62 for (y = 0; y < iHeight; y++) 63 { 64 for (x = 0; x < iWidth; x++) 65 { 66 pDstPred [y * iDstStep + x] = 67 (OMX_U8)(((OMX_U32)pPred0 [y * iPredStep0 + x] + 68 pPred1 [y * iPredStep1 + x] + 1) >> 1); 69 } 70 } 71 72 return OMX_Sts_NoErr; 73 } 74 75 /***************************************************************************** 76 * END OF FILE 77 *****************************************************************************/ 78 79