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