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_InterpolateChroma.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 1/8 Pixel interpolation for Chroma Block
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/**
40 * Function:  omxVCM4P10_InterpolateChroma   (6.3.3.2.2)
41 *
42 * Description:
43 * Performs 1/8-pixel interpolation for inter chroma MB.
44 *
45 * Input Arguments:
46 *
47 *   pSrc -Pointer to the source reference frame buffer
48 *   srcStep -Reference frame step in bytes
49 *   dstStep -Destination frame step in bytes; must be a multiple of
50 *            roi.width.
51 *   dx -Fractional part of horizontal motion vector component in 1/8 pixel
52 *            unit; valid in the range [0,7]
53 *   dy -Fractional part of vertical motion vector component in 1/8 pixel
54 *            unit; valid in the range [0,7]
55 *   roi -Dimension of the interpolation region; the parameters roi.width and
56 *            roi.height must be equal to either 2, 4, or 8.
57 *
58 * Output Arguments:
59 *
60 *   pDst -Pointer to the destination frame buffer if roi.width==2,  2-byte
61 *            alignment required if roi.width==4,  4-byte alignment required
62 *            if roi.width==8, 8-byte alignment required
63 *
64 * Return Value:
65 *    If the function runs without error, it returns OMX_Sts_NoErr.
66 *    If one of the following cases occurs, the function returns
67 *              OMX_Sts_BadArgErr:
68 *    pSrc or pDst is NULL.
69 *    srcStep or dstStep < 8.
70 *    dx or dy is out of range [0-7].
71 *    roi.width or roi.height is out of range {2,4,8}.
72 *    roi.width is equal to 2, but pDst is not 2-byte aligned.
73 *    roi.width is equal to 4, but pDst is not 4-byte aligned.
74 *    roi.width is equal to 8, but pDst is not 8 byte aligned.
75 *    srcStep or dstStep is not a multiple of 8.
76 *
77 */
78
79OMXResult omxVCM4P10_InterpolateChroma (
80     const OMX_U8* pSrc,
81     OMX_S32 srcStep,
82     OMX_U8* pDst,
83     OMX_S32 dstStep,
84     OMX_S32 dx,
85     OMX_S32 dy,
86     OMXSize roi
87 )
88{
89    /* check for argument error */
90    armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr)
91    armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr)
92    armRetArgErrIf(srcStep < 8, OMX_Sts_BadArgErr)
93    armRetArgErrIf(dstStep < 8, OMX_Sts_BadArgErr)
94    armRetArgErrIf(dx < 0, OMX_Sts_BadArgErr)
95    armRetArgErrIf(dx > 7, OMX_Sts_BadArgErr)
96    armRetArgErrIf(dy < 0, OMX_Sts_BadArgErr)
97    armRetArgErrIf(dy > 7, OMX_Sts_BadArgErr)
98    armRetArgErrIf((roi.width != 2) && (roi.width != 4) && (roi.width != 8), OMX_Sts_BadArgErr)
99    armRetArgErrIf((roi.height != 2) && (roi.height != 4) && (roi.height != 8), OMX_Sts_BadArgErr)
100    armRetArgErrIf((roi.width == 2) && armNot2ByteAligned(pDst), OMX_Sts_BadArgErr)
101    armRetArgErrIf((roi.width == 4) && armNot4ByteAligned(pDst), OMX_Sts_BadArgErr)
102    armRetArgErrIf((roi.width == 8) && armNot8ByteAligned(pDst), OMX_Sts_BadArgErr)
103    armRetArgErrIf(srcStep & 7, OMX_Sts_BadArgErr)
104    armRetArgErrIf(dstStep & 7, OMX_Sts_BadArgErr)
105
106    return armVCM4P10_Interpolate_Chroma
107        ((OMX_U8*)pSrc, srcStep, pDst, dstStep, roi.width, roi.height, dx, dy);
108}
109
110
111/*****************************************************************************
112 *                              END OF FILE
113 *****************************************************************************/
114
115