omxVCM4P10_SADQuar_4x.c revision 0c1bc742181ded4930842b46e9507372f0b1b963
1/**
2 *
3 * File Name:  omxVCM4P10_SADQuar_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 SAD of pSrc with average of two Ref blocks
13 * of 4x8 or 4x4 blocks
14 *
15 */
16
17#include "omxtypes.h"
18#include "armOMX.h"
19#include "omxVC.h"
20
21#include "armVC.h"
22#include "armCOMM.h"
23
24/**
25 * Function:  omxVCM4P10_SADQuar_4x   (6.3.5.4.2)
26 *
27 * Description:
28 * This function calculates the SAD between one block (pSrc) and the average
29 * of the other two (pSrcRef0 and pSrcRef1) for 4x8 or 4x4 blocks.  Rounding
30 * is applied according to the convention (a+b+1)>>1.
31 *
32 * Input Arguments:
33 *
34 *   pSrc - Pointer to the original block; must be aligned on a 4-byte
35 *            boundary.
36 *   pSrcRef0 - Pointer to reference block 0
37 *   pSrcRef1 - Pointer to reference block 1
38 *   iSrcStep - Step of the original block buffer; must be a multiple of 4.
39 *   iRefStep0 - Step of reference block 0
40 *   iRefStep1 - Step of reference block 1
41 *   iHeight - Height of the block; must be equal to either 4 or 8.
42 *
43 * Output Arguments:
44 *
45 *   pDstSAD - Pointer of result SAD
46 *
47 * Return Value:
48 *    OMX_Sts_NoErr, if the function runs without error.
49 *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
50 *    -    iHeight is not equal to either 4 or 8.
51 *    -    One of more of the following pointers is NULL: pSrc, pSrcRef0,
52 *              pSrcRef1, pDstSAD.
53 *    -    iSrcStep is not a multiple of 4
54 *    -    Any alignment restrictions are violated
55 *
56 */
57OMXResult omxVCM4P10_SADQuar_4x(
58	  const OMX_U8* 	pSrc,
59      const OMX_U8* 	pSrcRef0,
60	  const OMX_U8* 	pSrcRef1,
61      OMX_U32 	iSrcStep,
62      OMX_U32	iRefStep0,
63      OMX_U32	iRefStep1,
64      OMX_U32*	pDstSAD,
65      OMX_U32   iHeight
66)
67{
68    /* check for argument error */
69    armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr);
70    armRetArgErrIf(pSrcRef0 == NULL, OMX_Sts_BadArgErr);
71    armRetArgErrIf(pSrcRef1 == NULL, OMX_Sts_BadArgErr);
72    armRetArgErrIf(pDstSAD == NULL, OMX_Sts_BadArgErr);
73    armRetArgErrIf((iHeight != 8) && (iHeight != 4), OMX_Sts_BadArgErr);
74    armRetArgErrIf(armNot4ByteAligned(pSrc), OMX_Sts_BadArgErr);
75    armRetArgErrIf((iSrcStep == 0) || (iSrcStep & 3), OMX_Sts_BadArgErr);
76
77    return armVCM4P10_SADQuar
78        (pSrc, pSrcRef0, pSrcRef1, iSrcStep,
79        iRefStep0, iRefStep1, pDstSAD, iHeight, 4);
80}
81
82/*****************************************************************************
83 *                              END OF FILE
84 *****************************************************************************/
85
86