1/** 2 * 3 * File Name: omxVCCOMM_Average_16x.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 16x16 or 16x8 blocks 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: omxVCCOMM_Average_16x (6.1.3.1.2) 25 * 26 * Description: 27 * This function calculates the average of two 16x16 or 16x8 blocks. The 28 * result is rounded according to (a+b+1)/2. The block average function can 29 * be used in conjunction with half-pixel interpolation to obtain quarter 30 * pixel motion estimates, as described in [ISO14496-10], subclause 8.4.2.2.1. 31 * 32 * Input Arguments: 33 * 34 * pPred0 - Pointer to the top-left corner of reference block 0 35 * pPred1 - Pointer to the top-left corner of reference block 1 36 * iPredStep0 - Step of reference block 0 37 * iPredStep1 - Step of reference block 1 38 * iDstStep - Step of the destination buffer 39 * iHeight - Height of the blocks 40 * 41 * Output Arguments: 42 * 43 * pDstPred - Pointer to the destination buffer. 16-byte aligned. 44 * 45 * Return Value: 46 * 47 * OMX_Sts_NoErr - no error 48 * OMX_Sts_BadArgErr - bad arguments; returned under any of the following 49 * conditions: 50 * - one or more of the following pointers is NULL: pPred0, pPred1, or 51 * pDstPred. 52 * - pDstPred is not aligned on a 16-byte boundary. 53 * - iPredStep0 <= 0 or iPredStep0 is not a multiple of 16. 54 * - iPredStep1 <= 0 or iPredStep1 is not a multiple of 16. 55 * - iDstStep <= 0 or iDstStep is not a multiple of 16. 56 * - iHeight is not 8 or 16. 57 * 58 */ 59 OMXResult omxVCCOMM_Average_16x ( 60 const OMX_U8* pPred0, 61 const OMX_U8* pPred1, 62 OMX_U32 iPredStep0, 63 OMX_U32 iPredStep1, 64 OMX_U8* pDstPred, 65 OMX_U32 iDstStep, 66 OMX_U32 iHeight 67) 68{ 69 /* check for argument error */ 70 armRetArgErrIf(pPred0 == NULL, OMX_Sts_BadArgErr) 71 armRetArgErrIf(pPred1 == NULL, OMX_Sts_BadArgErr) 72 armRetArgErrIf(pDstPred == NULL, OMX_Sts_BadArgErr) 73 armRetArgErrIf((iHeight != 8) && (iHeight != 16), OMX_Sts_BadArgErr) 74 armRetArgErrIf(armNot16ByteAligned(pDstPred), OMX_Sts_BadArgErr) 75 armRetArgErrIf((iPredStep0 == 0) || (iPredStep0 & 15), OMX_Sts_BadArgErr) 76 armRetArgErrIf((iPredStep1 == 0) || (iPredStep1 & 15), OMX_Sts_BadArgErr) 77 armRetArgErrIf((iDstStep == 0) || (iDstStep & 15), OMX_Sts_BadArgErr) 78 79 return armVCCOMM_Average 80 (pPred0, pPred1, iPredStep0, iPredStep1, pDstPred, iDstStep, 16, iHeight); 81} 82 83/***************************************************************************** 84 * END OF FILE 85 *****************************************************************************/ 86 87