omxVCCOMM_SAD_8x.c revision 0c1bc742181ded4930842b46e9507372f0b1b963
1/**
2 *
3 * File Name:  omxVCCOMM_SAD_8x.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 8x16, 8x8, 8x4 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:  omxVCCOMM_SAD_8x   (6.1.4.1.5)
25 *
26 * Description:
27 * This function calculates the SAD for 8x16, 8x8, 8x4 blocks.
28 *
29 * Input Arguments:
30 *
31 *   pSrcOrg  - Pointer to the original block; must be aligned on a 8-byte
32 *              boundary.
33 *   iStepOrg - Step of the original block buffer
34 *   pSrcRef  - Pointer to the reference block
35 *   iStepRef - Step of the reference block buffer
36 *   iHeight  - Height of the block
37 *
38 * Output Arguments:
39 *
40 *   pDstSAD -Pointer of result SAD
41 *
42 * Return Value:
43 *
44 *    OMX_Sts_NoErr - no error
45 *    OMX_Sts_BadArgErr - bad arguments.  Returned if one or more of the
46 *              following conditions is true:
47 *    -    at least one of the following pointers is NULL:
48 *         pSrcOrg, pDstSAD, or pSrcRef
49 *    -    pSrcOrg is not 8-byte aligned.
50 *    -    iStepOrg  <= 0 or iStepOrg is not a multiple of 8
51 *    -    iStepRef <= 0 or iStepRef is not a multiple of 8
52 *    -    iHeight is not 4, 8 or 16
53 *
54 */
55OMXResult omxVCCOMM_SAD_8x(
56	const OMX_U8* 	pSrcOrg,
57	OMX_U32 	iStepOrg,
58	const OMX_U8* 	pSrcRef,
59	OMX_U32 	iStepRef,
60	OMX_S32*	pDstSAD,
61	OMX_U32		iHeight
62)
63{
64    /* check for argument error */
65    armRetArgErrIf(pSrcOrg == NULL, OMX_Sts_BadArgErr)
66    armRetArgErrIf(pSrcRef == NULL, OMX_Sts_BadArgErr)
67    armRetArgErrIf(pDstSAD == NULL, OMX_Sts_BadArgErr)
68    armRetArgErrIf((iHeight != 16) && (iHeight != 8) && (iHeight != 4), OMX_Sts_BadArgErr)
69    armRetArgErrIf(armNot8ByteAligned(pSrcOrg), OMX_Sts_BadArgErr)
70    armRetArgErrIf((iStepOrg == 0) || (iStepOrg & 7), OMX_Sts_BadArgErr)
71    armRetArgErrIf((iStepRef == 0) || (iStepRef & 7), OMX_Sts_BadArgErr)
72
73    return armVCCOMM_SAD
74        (pSrcOrg, iStepOrg, pSrcRef, iStepRef, pDstSAD, iHeight, 8);
75}
76
77/*****************************************************************************
78 *                              END OF FILE
79 *****************************************************************************/
80
81