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:  omxVCCOMM_SAD_16x.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 16x16 and 16x8 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:  omxVCCOMM_SAD_16x   (6.1.4.1.4)
40 *
41 * Description:
42 * This function calculates the SAD for 16x16 and 16x8 blocks.
43 *
44 * Input Arguments:
45 *
46 *   pSrcOrg - Pointer to the original block; must be aligned on a 16-byte
47 *             boundary.
48 *   iStepOrg - Step of the original block buffer
49 *   pSrcRef  - Pointer to the reference block
50 *   iStepRef - Step of the reference block buffer
51 *   iHeight  - Height of the block
52 *
53 * Output Arguments:
54 *
55 *   pDstSAD - Pointer of result SAD
56 *
57 * Return Value:
58 *
59 *    OMX_Sts_NoErr - no error
60 *    OMX_Sts_BadArgErr - bad arguments.  Returned if one or more of the
61 *              following conditions is true:
62 *    -    at least one of the following pointers is NULL:
63 *         pSrcOrg, pDstSAD, or pSrcRef
64 *    -    pSrcOrg is not 16-byte aligned.
65 *    -    iStepOrg  <= 0 or iStepOrg is not a multiple of 16
66 *    -    iStepRef <= 0 or iStepRef is not a multiple of 16
67 *    -    iHeight is not 8 or 16
68 *
69 */
70OMXResult omxVCCOMM_SAD_16x(
71			const OMX_U8* 	pSrcOrg,
72			OMX_U32 	iStepOrg,
73			const OMX_U8* 	pSrcRef,
74			OMX_U32 	iStepRef,
75			OMX_S32*	pDstSAD,
76			OMX_U32		iHeight
77)
78{
79    /* check for argument error */
80    armRetArgErrIf(pSrcOrg == NULL, OMX_Sts_BadArgErr)
81    armRetArgErrIf(pSrcRef == NULL, OMX_Sts_BadArgErr)
82    armRetArgErrIf(pDstSAD == NULL, OMX_Sts_BadArgErr)
83    armRetArgErrIf((iHeight != 16) && (iHeight != 8), OMX_Sts_BadArgErr)
84    armRetArgErrIf(armNot16ByteAligned(pSrcOrg), OMX_Sts_BadArgErr)
85    armRetArgErrIf((iStepOrg == 0) || (iStepOrg & 15), OMX_Sts_BadArgErr)
86    armRetArgErrIf((iStepRef == 0) || (iStepRef & 15), OMX_Sts_BadArgErr)
87
88    return armVCCOMM_SAD
89        (pSrcOrg, iStepOrg, pSrcRef, iStepRef, pDstSAD, iHeight, 16);
90}
91
92/*****************************************************************************
93 *                              END OF FILE
94 *****************************************************************************/
95
96