1/**
2 *
3 * File Name:  omxVCM4P2_BlockMatch_Integer_8x8.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_8x8   (6.2.4.2.2)
27 *
28 * Description:
29 * Performs an 8x8 block search; estimates motion vector and associated
30 * minimum SAD.  Both the input and output motion vectors are represented
31 * using 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 *            block that corresponds to the location of the current 8x8 block
40 *            in 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.
46 *   pSrcCurrBuf - pointer to the current block in the current macroblock
47 *            buffer extracted from the original plane (linear array, 128
48 *            entries); must be aligned on an 8-byte boundary.  The number of
49 *            bytes between lines (step) is 16 bytes.
50 *   pCurrPointPos - position of the current block in the current plane
51 *   pSrcPreMV - pointer to predicted motion vector; NULL indicates no
52 *            predicted MV
53 *   pSrcPreSAD - pointer to SAD associated with the predicted MV (referenced
54 *            by pSrcPreMV); may be set to NULL if unavailable.
55 *   pMESpec - vendor-specific motion estimation specification structure;
56 *            must have been allocated and then initialized using
57 *            omxVCM4P2_MEInit prior to calling the block matching function.
58 *
59 * Output Arguments:
60 *
61 *   pDstMV - pointer to estimated MV
62 *   pDstSAD - pointer to minimum SAD
63 *
64 * Return Value:
65 *
66 *    OMX_Sts_NoErr - no error
67 *    OMX_Sts_BadArgErr - bad arguments.  Returned if one of the following
68 *              conditions is true:
69 *    -    at least one of the following pointers is NULL: pSrcRefBuf,
70 *              pRefRect, pSrcCurrBuff, pCurrPointPos, pDstMV, pDstSAD or
71 *              pMESpec, or
72 *    -    pSrcCurrBuf is not 8-byte aligned
73 *
74 */
75
76OMXResult omxVCM4P2_BlockMatch_Integer_8x8(
77     const OMX_U8 *pSrcRefBuf,
78     OMX_INT refWidth,
79     const OMXRect *pRefRect,
80     const OMX_U8 *pSrcCurrBuf,
81     const OMXVCM4P2Coordinate *pCurrPointPos,
82     const OMXVCMotionVector *pSrcPreMV,
83     const OMX_INT *pSrcPreSAD,
84     void *pMESpec,
85     OMXVCMotionVector *pDstMV,
86     OMX_INT *pDstSAD
87)
88{
89   OMX_U8 BlockSize = 8;
90
91   /* Argument error checks */
92   armRetArgErrIf(!armIs8ByteAligned(pSrcCurrBuf), OMX_Sts_BadArgErr);
93
94   return ( armVCM4P2_BlockMatch_Integer(
95     pSrcRefBuf,
96     refWidth,
97     pRefRect,
98     pSrcCurrBuf,
99     pCurrPointPos,
100     pSrcPreMV,
101     pSrcPreSAD,
102     pMESpec,
103     pDstMV,
104     pDstSAD,
105     BlockSize)
106     );
107
108}
109
110/* End of file */
111