omxVCM4P2_BlockMatch_Integer_8x8.c revision 78e52bfac041d71ce53b5b13c2abf78af742b09d
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:  omxVCM4P2_BlockMatch_Integer_8x8.c
20 * OpenMAX DL: v1.0.2
21 * Revision:   9641
22 * Date:       Thursday, February 7, 2008
23 *
24 *
25 *
26 *
27 * Description:
28 * Contains modules for Block matching, a full search algorithm
29 * is implemented
30 *
31 */
32
33#include "omxtypes.h"
34#include "armOMX.h"
35#include "omxVC.h"
36
37#include "armVC.h"
38#include "armCOMM.h"
39
40/**
41 * Function:  omxVCM4P2_BlockMatch_Integer_8x8   (6.2.4.2.2)
42 *
43 * Description:
44 * Performs an 8x8 block search; estimates motion vector and associated
45 * minimum SAD.  Both the input and output motion vectors are represented
46 * using half-pixel units, and therefore a shift left or right by 1 bit may be
47 * required, respectively, to match the input or output MVs with other
48 * functions that either generate output MVs or expect input MVs represented
49 * using integer pixel units.
50 *
51 * Input Arguments:
52 *
53 *   pSrcRefBuf - pointer to the reference Y plane; points to the reference
54 *            block that corresponds to the location of the current 8x8 block
55 *            in the current plane.
56 *   refWidth - width of the reference plane
57 *   pRefRect - pointer to the valid reference plane rectangle; coordinates
58 *            are specified relative to the image origin.  Rectangle
59 *            boundaries may extend beyond image boundaries if the image has
60 *            been padded.
61 *   pSrcCurrBuf - pointer to the current block in the current macroblock
62 *            buffer extracted from the original plane (linear array, 128
63 *            entries); must be aligned on an 8-byte boundary.  The number of
64 *            bytes between lines (step) is 16 bytes.
65 *   pCurrPointPos - position of the current block in the current plane
66 *   pSrcPreMV - pointer to predicted motion vector; NULL indicates no
67 *            predicted MV
68 *   pSrcPreSAD - pointer to SAD associated with the predicted MV (referenced
69 *            by pSrcPreMV); may be set to NULL if unavailable.
70 *   pMESpec - vendor-specific motion estimation specification structure;
71 *            must have been allocated and then initialized using
72 *            omxVCM4P2_MEInit prior to calling the block matching function.
73 *
74 * Output Arguments:
75 *
76 *   pDstMV - pointer to estimated MV
77 *   pDstSAD - pointer to minimum SAD
78 *
79 * Return Value:
80 *
81 *    OMX_Sts_NoErr - no error
82 *    OMX_Sts_BadArgErr - bad arguments.  Returned if one of the following
83 *              conditions is true:
84 *    -    at least one of the following pointers is NULL: pSrcRefBuf,
85 *              pRefRect, pSrcCurrBuff, pCurrPointPos, pDstMV, pDstSAD or
86 *              pMESpec, or
87 *    -    pSrcCurrBuf is not 8-byte aligned
88 *
89 */
90
91OMXResult omxVCM4P2_BlockMatch_Integer_8x8(
92     const OMX_U8 *pSrcRefBuf,
93     OMX_INT refWidth,
94     const OMXRect *pRefRect,
95     const OMX_U8 *pSrcCurrBuf,
96     const OMXVCM4P2Coordinate *pCurrPointPos,
97     const OMXVCMotionVector *pSrcPreMV,
98     const OMX_INT *pSrcPreSAD,
99     void *pMESpec,
100     OMXVCMotionVector *pDstMV,
101     OMX_INT *pDstSAD
102)
103{
104   OMX_U8 BlockSize = 8;
105
106   /* Argument error checks */
107   armRetArgErrIf(!armIs8ByteAligned(pSrcCurrBuf), OMX_Sts_BadArgErr);
108
109   return ( armVCM4P2_BlockMatch_Integer(
110     pSrcRefBuf,
111     refWidth,
112     pRefRect,
113     pSrcCurrBuf,
114     pCurrPointPos,
115     pSrcPreMV,
116     pSrcPreSAD,
117     pMESpec,
118     pDstMV,
119     pDstSAD,
120     BlockSize)
121     );
122
123}
124
125/* End of file */
126