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_InterpolateHalfVer_Luma.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 4x4 blocks
28 *
29 */
30
31#include "omxtypes.h"
32#include "armOMX.h"
33#include "omxVC.h"
34
35#include "armCOMM.h"
36#include "armVC.h"
37
38
39/**
40 * Function:  omxVCM4P10_InterpolateHalfVer_Luma   (6.3.5.5.2)
41 *
42 * Description:
43 * This function performs interpolation for two vertical 1/2-pel positions -
44 * (0, -1/2) and (0, 1/2) - around a full-pel position.
45 *
46 * Input Arguments:
47 *
48 *   pSrc - Pointer to top-left corner of block used to interpolate in the
49 *            reconstructed frame plane
50 *   iSrcStep - Step of the source buffer.
51 *   iDstStep - Step of the destination (interpolation) buffer; must be a
52 *            multiple of iWidth.
53 *   iWidth - Width of the current block; must be equal to either 4, 8, or 16
54 *   iHeight - Height of the current block; must be equal to either 4, 8, or 16
55 *
56 * Output Arguments:
57 *
58 *   pDstUp -Pointer to the interpolation buffer of the -pel position above
59 *            the current full-pel position (0, -1/2)
60 *                If iWidth==4, 4-byte alignment required.
61 *                If iWidth==8, 8-byte alignment required.
62 *                If iWidth==16, 16-byte alignment required.
63 *   pDstDown -Pointer to the interpolation buffer of the -pel position below
64 *            the current full-pel position (0, 1/2)
65 *                If iWidth==4, 4-byte alignment required.
66 *                If iWidth==8, 8-byte alignment required.
67 *                If iWidth==16, 16-byte alignment required.
68 *
69 * Return Value:
70 *
71 *    OMX_Sts_NoErr - no error
72 *    OMX_Sts_BadArgErr - bad arguments; returned if any of the following
73 *              conditions are true:
74 *    -    at least one of the following pointers is NULL:
75 *            pSrc, pDstUp, or pDstDown
76 *    -    iWidth or iHeight have values other than 4, 8, or 16
77 *    -    iWidth==4 but pDstUp and/or pDstDown is/are not aligned on a 4-byte boundary
78 *    -    iWidth==8 but pDstUp and/or pDstDown is/are not aligned on a 8-byte boundary
79 *    -    iWidth==16 but pDstUp and/or pDstDown is/are not aligned on a 16-byte boundary
80 *
81 */
82 OMXResult omxVCM4P10_InterpolateHalfVer_Luma(
83     const OMX_U8*    pSrc,
84     OMX_U32    iSrcStep,
85     OMX_U8*    pDstUp,
86     OMX_U8*    pDstDown,
87     OMX_U32    iDstStep,
88     OMX_U32    iWidth,
89     OMX_U32    iHeight
90)
91{
92    OMXResult   RetValue;
93
94    /* check for argument error */
95    armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr)
96    armRetArgErrIf(pDstUp == NULL, OMX_Sts_BadArgErr)
97    armRetArgErrIf(pDstDown == NULL, OMX_Sts_BadArgErr)
98    armRetArgErrIf((iWidth == 4) &&
99                   armNot4ByteAligned(pDstUp) &&
100                   armNot4ByteAligned(pDstDown), OMX_Sts_BadArgErr)
101    armRetArgErrIf((iWidth == 8) &&
102                   armNot8ByteAligned(pDstUp) &&
103                   armNot8ByteAligned(pDstDown), OMX_Sts_BadArgErr)
104    armRetArgErrIf((iWidth == 16) &&
105                   armNot16ByteAligned(pDstUp) &&
106                   armNot16ByteAligned(pDstDown), OMX_Sts_BadArgErr)
107
108    armRetArgErrIf((iHeight != 16) && (iHeight != 8)&& (iHeight != 4), OMX_Sts_BadArgErr)
109	armRetArgErrIf((iWidth != 16) && (iWidth != 8)&& (iWidth != 4), OMX_Sts_BadArgErr)
110
111    RetValue = armVCM4P10_InterpolateHalfVer_Luma(
112        pSrc - iSrcStep,
113        iSrcStep,
114        pDstUp,
115        iDstStep,
116        iWidth,
117        iHeight);
118
119    if (RetValue != OMX_Sts_NoErr)
120    {
121        return RetValue;
122    }
123
124    RetValue = armVCM4P10_InterpolateHalfVer_Luma(
125        pSrc,
126        iSrcStep,
127        pDstDown,
128        iDstStep,
129        iWidth,
130        iHeight);
131
132    return RetValue;
133}
134
135/*****************************************************************************
136 *                              END OF FILE
137 *****************************************************************************/
138
139