omxVCM4P10_SADQuar_8x.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_SADQuar_8x.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 of pSrc with average of two Ref blocks
28 * of 8x16 or 8x8 or 8x4
29 *
30 */
31
32#include "omxtypes.h"
33#include "armOMX.h"
34#include "omxVC.h"
35
36#include "armVC.h"
37#include "armCOMM.h"
38
39/**
40 * Function:  omxVCM4P10_SADQuar_8x   (6.3.5.4.3)
41 *
42 * Description:
43 * This function calculates the SAD between one block (pSrc) and the average
44 * of the other two (pSrcRef0 and pSrcRef1) for 8x16, 8x8, or 8x4 blocks.
45 * Rounding is applied according to the convention (a+b+1)>>1.
46 *
47 * Input Arguments:
48 *
49 *   pSrc - Pointer to the original block; must be aligned on an 8-byte
50 *            boundary.
51 *   pSrcRef0 - Pointer to reference block 0
52 *   pSrcRef1 - Pointer to reference block 1
53 *   iSrcStep - Step of the original block buffer; must be a multiple of 8.
54 *   iRefStep0 - Step of reference block 0
55 *   iRefStep1 - Step of reference block 1
56 *   iHeight - Height of the block; must be equal either 4, 8, or 16.
57 *
58 * Output Arguments:
59 *
60 *   pDstSAD - Pointer of result SAD
61 *
62 * Return Value:
63 *    OMX_Sts_NoErr, if the function runs without error.
64 *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
65 *    -    iHeight is not equal to either 4, 8, or 16.
66 *    -    One of more of the following pointers is NULL: pSrc, pSrcRef0,
67 *              pSrcRef1, pDstSAD.
68 *    -    iSrcStep is not a multiple of 8
69 *    -    Any alignment restrictions are violated
70 *
71 */
72OMXResult omxVCM4P10_SADQuar_8x(
73	const OMX_U8* 	pSrc,
74    const OMX_U8* 	pSrcRef0,
75	const OMX_U8* 	pSrcRef1,
76    OMX_U32 	iSrcStep,
77    OMX_U32		iRefStep0,
78    OMX_U32		iRefStep1,
79    OMX_U32*	pDstSAD,
80    OMX_U32     iHeight
81)
82{
83    /* check for argument error */
84    armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr)
85    armRetArgErrIf(pSrcRef0 == NULL, OMX_Sts_BadArgErr)
86    armRetArgErrIf(pSrcRef1 == NULL, OMX_Sts_BadArgErr)
87    armRetArgErrIf(pDstSAD == NULL, OMX_Sts_BadArgErr)
88    armRetArgErrIf((iHeight != 16) && (iHeight != 8) &&
89        (iHeight != 4), OMX_Sts_BadArgErr)
90    armRetArgErrIf(armNot8ByteAligned(pSrc), OMX_Sts_BadArgErr)
91    armRetArgErrIf((iSrcStep == 0) || (iSrcStep & 7), OMX_Sts_BadArgErr)
92
93
94    return armVCM4P10_SADQuar
95        (pSrc, pSrcRef0, pSrcRef1, iSrcStep,
96        iRefStep0, iRefStep1, pDstSAD, iHeight, 8);
97}
98
99/*****************************************************************************
100 *                              END OF FILE
101 *****************************************************************************/
102
103