1/** 2 * 3 * File Name: omxVCM4P2_BlockMatch_Half_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_Half_16x16 (6.2.4.2.3) 27 * 28 * Description: 29 * Performs a 16x16 block match with half-pixel resolution. Returns the 30 * estimated motion vector and associated minimum SAD. This function 31 * estimates the half-pixel motion vector by interpolating the integer 32 * resolution motion vector referenced by the input parameter pSrcDstMV, i.e., 33 * the initial integer MV is generated externally. The input parameters 34 * pSrcRefBuf and pSearchPointRefPos should be shifted by the winning MV of 35 * 16x16 integer search prior to calling BlockMatch_Half_16x16. The function 36 * BlockMatch_Integer_16x16 may be used for integer motion estimation. 37 * 38 * Input Arguments: 39 * 40 * pSrcRefBuf - pointer to the reference Y plane; points to the reference 41 * macroblock that corresponds to the location of the current 42 * macroblock in the current plane. 43 * refWidth - width of the reference plane 44 * pRefRect - reference plane valid region rectangle 45 * pSrcCurrBuf - pointer to the current block in the current macroblock 46 * buffer extracted from the original plane (linear array, 256 47 * entries); must be aligned on a 16-byte boundary. The number of 48 * bytes between lines (step) is 16. 49 * pSearchPointRefPos - position of the starting point for half pixel 50 * search (specified in terms of integer pixel units) in the 51 * reference plane, i.e., the reference position pointed to by the 52 * predicted motion vector. 53 * rndVal - rounding control parameter: 0 - disabled; 1 - enabled. 54 * pSrcDstMV - pointer to the initial MV estimate; typically generated 55 * during a prior 16X16 integer search; specified in terms of 56 * half-pixel units. 57 * 58 * Output Arguments: 59 * 60 * pSrcDstMV - pointer to estimated MV 61 * pDstSAD - pointer to minimum SAD 62 * 63 * Return Value: 64 * 65 * OMX_Sts_NoErr - no error 66 * OMX_Sts_BadArgErr - bad arguments. Returned if one of the following 67 * conditions is true: 68 * - at least one of the following pointers is NULL: pSrcRefBuf, 69 * pRefRect, pSrcCurrBuff, pSearchPointRefPos, pSrcDstMV. 70 * - pSrcCurrBuf is not 16-byte aligned, or 71 * 72 */ 73 74OMXResult omxVCM4P2_BlockMatch_Half_16x16( 75 const OMX_U8 *pSrcRefBuf, 76 OMX_INT refWidth, 77 const OMXRect *pRefRect, 78 const OMX_U8 *pSrcCurrBuf, 79 const OMXVCM4P2Coordinate *pSearchPointRefPos, 80 OMX_INT rndVal, 81 OMXVCMotionVector *pSrcDstMV, 82 OMX_INT *pDstSAD 83) 84{ 85 86 /* For a blocksize of 16x16 */ 87 OMX_U8 BlockSize = 16; 88 89 /* Argument error checks */ 90 armRetArgErrIf(pSrcRefBuf == NULL, OMX_Sts_BadArgErr); 91 armRetArgErrIf(pRefRect == NULL, OMX_Sts_BadArgErr); 92 armRetArgErrIf(pSrcCurrBuf == NULL, OMX_Sts_BadArgErr); 93 armRetArgErrIf(pSearchPointRefPos == NULL, OMX_Sts_BadArgErr); 94 armRetArgErrIf(pSrcDstMV == NULL, OMX_Sts_BadArgErr); 95 armRetArgErrIf(!armIs16ByteAligned(pSrcCurrBuf), OMX_Sts_BadArgErr); 96 97 return (armVCM4P2_BlockMatch_Half( 98 pSrcRefBuf, 99 refWidth, 100 pRefRect, 101 pSrcCurrBuf, 102 pSearchPointRefPos, 103 rndVal, 104 pSrcDstMV, 105 pDstSAD, 106 BlockSize)); 107 108 109} 110 111/* End of file */ 112