summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_InterpolateLuma.c
blob: e2a8163cb8045358208322543f092b20bbfa565d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
 * Copyright (C) 2007-2008 ARM Limited
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
/**
 * 
 * File Name:  omxVCM4P10_InterpolateLuma.c
 * OpenMAX DL: v1.0.2
 * Revision:   9641
 * Date:       Thursday, February 7, 2008
 * 
 * 
 * 
 * Description:
 * This function will calculate Performs quarter-pixel interpolation 
 * 
 */

#include "omxtypes.h"
#include "armOMX.h"
#include "omxVC.h"

#include "armVC.h"
#include "armCOMM.h"

/**
 * Function:  omxVCM4P10_InterpolateLuma   (6.3.3.2.1)
 *
 * Description:
 * Performs quarter-pixel interpolation for inter luma MB. It is assumed that 
 * the frame is already padded when calling this function. 
 *
 * Input Arguments:
 *   
 *   pSrc -Pointer to the source reference frame buffer 
 *   srcStep -reference frame step, in bytes; must be a multiple of roi.width 
 *   dstStep -destination frame step, in bytes; must be a multiple of 
 *            roi.width 
 *   dx -Fractional part of horizontal motion vector component in 1/4 pixel 
 *            unit; valid in the range [0,3] 
 *   dy -Fractional part of vertical motion vector y component in 1/4 pixel 
 *            unit; valid in the range [0,3] 
 *   roi -Dimension of the interpolation region; the parameters roi.width and 
 *            roi.height must be equal to either 4, 8, or 16. 
 *
 * Output Arguments:
 *   
 *   pDst -Pointer to the destination frame buffer if roi.width==4,  4-byte 
 *            alignment required if roi.width==8,  8-byte alignment required 
 *            if roi.width==16, 16-byte alignment required 
 *
 * Return Value:
 *    If the function runs without error, it returns OMX_Sts_NoErr. 
 *    If one of the following cases occurs, the function returns 
 *              OMX_Sts_BadArgErr: 
 *    pSrc or pDst is NULL. 
 *    srcStep or dstStep < roi.width. 
 *    dx or dy is out of range [0,3]. 
 *    roi.width or roi.height is out of range {4, 8, 16}. 
 *    roi.width is equal to 4, but pDst is not 4 byte aligned. 
 *    roi.width is equal to 8 or 16, but pDst is not 8 byte aligned. 
 *    srcStep or dstStep is not a multiple of 8. 
 *
 */

OMXResult omxVCM4P10_InterpolateLuma (
     const OMX_U8* pSrc,
     OMX_S32 srcStep,
     OMX_U8* pDst,
     OMX_S32 dstStep,
     OMX_S32 dx,
     OMX_S32 dy,
     OMXSize roi        
 )
{
    /* check for argument error */
    armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr)
    armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr)
    armRetArgErrIf(srcStep < roi.width, OMX_Sts_BadArgErr)
    armRetArgErrIf(dstStep < roi.width, OMX_Sts_BadArgErr)
    armRetArgErrIf(dx < 0, OMX_Sts_BadArgErr)
    armRetArgErrIf(dx > 3, OMX_Sts_BadArgErr)
    armRetArgErrIf(dy < 0, OMX_Sts_BadArgErr)
    armRetArgErrIf(dy > 3, OMX_Sts_BadArgErr)
    armRetArgErrIf((roi.width != 4) && (roi.width != 8) && (roi.width != 16), OMX_Sts_BadArgErr)
    armRetArgErrIf((roi.height != 4) && (roi.height != 8) && (roi.height != 16), OMX_Sts_BadArgErr)
    armRetArgErrIf((roi.width == 4) && armNot4ByteAligned(pDst), OMX_Sts_BadArgErr)
    armRetArgErrIf((roi.width == 8) && armNot8ByteAligned(pDst), OMX_Sts_BadArgErr)
    armRetArgErrIf((roi.width == 16) && armNot16ByteAligned(pDst), OMX_Sts_BadArgErr)
    armRetArgErrIf(srcStep & 7, OMX_Sts_BadArgErr)
    armRetArgErrIf(dstStep & 7, OMX_Sts_BadArgErr) 

    return armVCM4P10_Interpolate_Luma 
        (pSrc, srcStep, pDst, dstStep, roi.width, roi.height, dx, dy);

}


/*****************************************************************************
 *                              END OF FILE
 *****************************************************************************/