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