1/**
2 *
3 * File Name:  omxVCM4P10_InterpolateChroma.c
4 * OpenMAX DL: v1.0.2
5 * Revision:   9641
6 * Date:       Thursday, February 7, 2008
7 *
8 * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved.
9 *
10 *
11 * Description:
12 * This function will calculate 1/8 Pixel interpolation for Chroma Block
13 *
14 */
15
16#include "omxtypes.h"
17#include "armOMX.h"
18#include "omxVC.h"
19
20#include "armVC.h"
21#include "armCOMM.h"
22
23
24/**
25 * Function:  omxVCM4P10_InterpolateChroma   (6.3.3.2.2)
26 *
27 * Description:
28 * Performs 1/8-pixel interpolation for inter chroma MB.
29 *
30 * Input Arguments:
31 *
32 *   pSrc -Pointer to the source reference frame buffer
33 *   srcStep -Reference frame step in bytes
34 *   dstStep -Destination frame step in bytes; must be a multiple of
35 *            roi.width.
36 *   dx -Fractional part of horizontal motion vector component in 1/8 pixel
37 *            unit; valid in the range [0,7]
38 *   dy -Fractional part of vertical motion vector component in 1/8 pixel
39 *            unit; valid in the range [0,7]
40 *   roi -Dimension of the interpolation region; the parameters roi.width and
41 *            roi.height must be equal to either 2, 4, or 8.
42 *
43 * Output Arguments:
44 *
45 *   pDst -Pointer to the destination frame buffer if roi.width==2,  2-byte
46 *            alignment required if roi.width==4,  4-byte alignment required
47 *            if roi.width==8, 8-byte alignment required
48 *
49 * Return Value:
50 *    If the function runs without error, it returns OMX_Sts_NoErr.
51 *    If one of the following cases occurs, the function returns
52 *              OMX_Sts_BadArgErr:
53 *    pSrc or pDst is NULL.
54 *    srcStep or dstStep < 8.
55 *    dx or dy is out of range [0-7].
56 *    roi.width or roi.height is out of range {2,4,8}.
57 *    roi.width is equal to 2, but pDst is not 2-byte aligned.
58 *    roi.width is equal to 4, but pDst is not 4-byte aligned.
59 *    roi.width is equal to 8, but pDst is not 8 byte aligned.
60 *    srcStep or dstStep is not a multiple of 8.
61 *
62 */
63
64OMXResult omxVCM4P10_InterpolateChroma (
65     const OMX_U8* pSrc,
66     OMX_S32 srcStep,
67     OMX_U8* pDst,
68     OMX_S32 dstStep,
69     OMX_S32 dx,
70     OMX_S32 dy,
71     OMXSize roi
72 )
73{
74    /* check for argument error */
75    armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr)
76    armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr)
77    armRetArgErrIf(srcStep < 8, OMX_Sts_BadArgErr)
78    armRetArgErrIf(dstStep < 8, OMX_Sts_BadArgErr)
79    armRetArgErrIf(dx < 0, OMX_Sts_BadArgErr)
80    armRetArgErrIf(dx > 7, OMX_Sts_BadArgErr)
81    armRetArgErrIf(dy < 0, OMX_Sts_BadArgErr)
82    armRetArgErrIf(dy > 7, OMX_Sts_BadArgErr)
83    armRetArgErrIf((roi.width != 2) && (roi.width != 4) && (roi.width != 8), OMX_Sts_BadArgErr)
84    armRetArgErrIf((roi.height != 2) && (roi.height != 4) && (roi.height != 8), OMX_Sts_BadArgErr)
85    armRetArgErrIf((roi.width == 2) && armNot2ByteAligned(pDst), OMX_Sts_BadArgErr)
86    armRetArgErrIf((roi.width == 4) && armNot4ByteAligned(pDst), OMX_Sts_BadArgErr)
87    armRetArgErrIf((roi.width == 8) && armNot8ByteAligned(pDst), OMX_Sts_BadArgErr)
88    armRetArgErrIf(srcStep & 7, OMX_Sts_BadArgErr)
89    armRetArgErrIf(dstStep & 7, OMX_Sts_BadArgErr)
90
91    return armVCM4P10_Interpolate_Chroma
92        ((OMX_U8*)pSrc, srcStep, pDst, dstStep, roi.width, roi.height, dx, dy);
93}
94
95
96/*****************************************************************************
97 *                              END OF FILE
98 *****************************************************************************/
99
100