omxVCM4P10_SAD_4x.c revision 78e52bfac041d71ce53b5b13c2abf78af742b09d
1/*
2 * Copyright (C) 2007-2008 ARM Limited
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17/**
18 *
19 * File Name:  omxVCM4P10_SAD_4x.c
20 * OpenMAX DL: v1.0.2
21 * Revision:   9641
22 * Date:       Thursday, February 7, 2008
23 *
24 *
25 *
26 * Description:
27 * This function will calculate SAD for 4x8 and 4x4 blocks
28 *
29 */
30
31#include "omxtypes.h"
32#include "armOMX.h"
33#include "omxVC.h"
34
35#include "armVC.h"
36#include "armCOMM.h"
37
38/**
39 * Function:  omxVCM4P10_SAD_4x   (6.3.5.4.1)
40 *
41 * Description:
42 * This function calculates the SAD for 4x8 and 4x4 blocks.
43 *
44 * Input Arguments:
45 *
46 *   pSrcOrg -Pointer to the original block; must be aligned on a 4-byte
47 *            boundary.
48 *   iStepOrg -Step of the original block buffer; must be a multiple of 4.
49 *   pSrcRef -Pointer to the reference block
50 *   iStepRef -Step of the reference block buffer
51 *   iHeight -Height of the block; must be equal to either 4 or 8.
52 *
53 * Output Arguments:
54 *
55 *   pDstSAD -Pointer of result SAD
56 *
57 * Return Value:
58 *    OMX_Sts_NoErr, if the function runs without error.
59 *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
60 *    -    One of more of the following pointers is NULL:
61 *         pSrcOrg, pSrcRef, or pDstSAD
62 *    -    iHeight is not equal to either 4 or 8.
63 *    -    iStepOrg is not a multiple of 4
64 *    -    Any alignment restrictions are violated
65 *
66 */
67OMXResult omxVCM4P10_SAD_4x(
68	const OMX_U8* 	pSrcOrg,
69	OMX_U32 	iStepOrg,
70	const OMX_U8* 	pSrcRef,
71	OMX_U32 	iStepRef,
72	OMX_S32*	pDstSAD,
73	OMX_U32		iHeight
74)
75{
76    /* check for argument error */
77    armRetArgErrIf(pSrcOrg == NULL, OMX_Sts_BadArgErr)
78    armRetArgErrIf(pSrcRef == NULL, OMX_Sts_BadArgErr)
79    armRetArgErrIf(pDstSAD == NULL, OMX_Sts_BadArgErr)
80    armRetArgErrIf((iHeight != 8) && (iHeight != 4), OMX_Sts_BadArgErr)
81    armRetArgErrIf(armNot4ByteAligned(pSrcOrg), OMX_Sts_BadArgErr)
82    armRetArgErrIf((iStepOrg == 0) || (iStepOrg & 3), OMX_Sts_BadArgErr)
83    armRetArgErrIf((iStepRef == 0) || (iStepRef & 3), OMX_Sts_BadArgErr)
84
85    return armVCCOMM_SAD
86        (pSrcOrg, iStepOrg, pSrcRef, iStepRef, pDstSAD, iHeight, 4);
87}
88
89/*****************************************************************************
90 *                              END OF FILE
91 *****************************************************************************/
92
93