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