1/**
2 *
3 * File Name:  omxVCM4P10_Average_4x.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 4x4 or 4x8 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:  omxVCM4P10_Average_4x   (6.3.5.5.3)
25 *
26 * Description:
27 * This function calculates the average of two 4x4, 4x8 blocks.  The result
28 * is rounded according to (a+b+1)/2.
29 *
30 * Input Arguments:
31 *
32 *   pPred0 - Pointer to the top-left corner of reference block 0
33 *   pPred1 - Pointer to the top-left corner of reference block 1
34 *   iPredStep0 - Step of reference block 0; must be a multiple of 4.
35 *   iPredStep1 - Step of reference block 1; must be a multiple of 4.
36 *   iDstStep - Step of the destination buffer; must be a multiple of 4.
37 *   iHeight - Height of the blocks; must be either 4 or 8.
38 *
39 * Output Arguments:
40 *
41 *   pDstPred - Pointer to the destination buffer. 4-byte alignment required.
42 *
43 * Return Value:
44 *
45 *    OMX_Sts_NoErr - no error
46 *    OMX_Sts_BadArgErr - bad arguments; returned if any of the following
47 *              conditions are true:
48 *    -    at least one of the following pointers is NULL:
49 *           pPred0, pPred1, or pDstPred
50 *    -    pDstPred is not aligned on a 4-byte boundary
51 *    -    iPredStep0 <= 0 or iPredStep0 is not a multiple of 4
52 *    -    iPredStep1 <= 0 or iPredStep1 is not a multiple of 4
53 *    -    iDstStep <= 0 or iDstStep is not a multiple of 4
54 *    -    iHeight is not equal to either 4 or 8
55 *
56 */
57 OMXResult omxVCM4P10_Average_4x (
58	 const OMX_U8* 	    pPred0,
59	 const OMX_U8* 	    pPred1,
60	 OMX_U32		iPredStep0,
61	 OMX_U32		iPredStep1,
62	 OMX_U8*		pDstPred,
63	 OMX_U32		iDstStep,
64	 OMX_U32		iHeight
65)
66{
67    /* check for argument error */
68    armRetArgErrIf(pPred0 == NULL, OMX_Sts_BadArgErr)
69    armRetArgErrIf(pPred1 == NULL, OMX_Sts_BadArgErr)
70    armRetArgErrIf(pDstPred == NULL, OMX_Sts_BadArgErr)
71    armRetArgErrIf((iHeight != 4) && (iHeight != 8), OMX_Sts_BadArgErr)
72    armRetArgErrIf((iPredStep0 == 0) || (iPredStep0 & 3), OMX_Sts_BadArgErr)
73    armRetArgErrIf((iPredStep1 == 0) || (iPredStep1 & 3), OMX_Sts_BadArgErr)
74    armRetArgErrIf((iDstStep == 0) || (iDstStep & 3), OMX_Sts_BadArgErr)
75    armRetArgErrIf(armNot4ByteAligned(pDstPred), OMX_Sts_BadArgErr)
76
77    return armVCCOMM_Average
78        (pPred0, pPred1, iPredStep0, iPredStep1, pDstPred, iDstStep, 4, iHeight);
79}
80
81/*****************************************************************************
82 *                              END OF FILE
83 *****************************************************************************/
84
85