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_16x16.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_16x16 (6.2.4.2.1) 42 * 43 * Description: 44 * Performs a 16x16 block search; estimates motion vector and associated 45 * minimum SAD. Both the input and output motion vectors are represented using 46 * 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 * MB that corresponds to the location of the current macroblock in 55 * 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. For example, if padding extends 4 pixels beyond 61 * frame border, then the value for the left border could be set to 62 * -4. 63 * pSrcCurrBuf - pointer to the current block in the current macroblock 64 * buffer extracted from the original plane (linear array, 256 65 * entries); must be aligned on a 16-byte boundary. The number of 66 * bytes between lines (step) is 16. 67 * pCurrPointPos - position of the current macroblock in the current plane 68 * pSrcPreMV - pointer to predicted motion vector; NULL indicates no 69 * predicted MV 70 * pSrcPreSAD - pointer to SAD associated with the predicted MV (referenced 71 * by pSrcPreMV); may be set to NULL if unavailable. 72 * pMESpec - vendor-specific motion estimation specification structure; 73 * must have been allocated and then initialized using 74 * omxVCM4P2_MEInit prior to calling the block matching function. 75 * 76 * Output Arguments: 77 * 78 * pDstMV - pointer to estimated MV 79 * pDstSAD - pointer to minimum SAD 80 * 81 * Return Value: 82 * 83 * OMX_Sts_NoErr - no error 84 * OMX_Sts_BadArgErr - bad arguments. Returned if one of the following 85 * conditions is true: 86 * - at least one of the following pointers is NULL: pSrcRefBuf, 87 * pRefRect, pSrcCurrBuff, pCurrPointPos, pDstMV, pDstSAD or 88 * pMESpec, or 89 * - pSrcCurrBuf is not 16-byte aligned 90 * 91 */ 92 93OMXResult omxVCM4P2_BlockMatch_Integer_16x16( 94 const OMX_U8 *pSrcRefBuf, 95 OMX_INT refWidth, 96 const OMXRect *pRefRect, 97 const OMX_U8 *pSrcCurrBuf, 98 const OMXVCM4P2Coordinate *pCurrPointPos, 99 const OMXVCMotionVector *pSrcPreMV, 100 const OMX_INT *pSrcPreSAD, 101 void *pMESpec, 102 OMXVCMotionVector *pDstMV, 103 OMX_INT *pDstSAD 104) 105{ 106 107 OMX_U8 BlockSize = 16; 108 109 /* Argument error checks */ 110 armRetArgErrIf(!armIs16ByteAligned(pSrcCurrBuf), OMX_Sts_BadArgErr); 111 112 return ( armVCM4P2_BlockMatch_Integer( 113 pSrcRefBuf, 114 refWidth, 115 pRefRect, 116 pSrcCurrBuf, 117 pCurrPointPos, 118 pSrcPreMV, 119 pSrcPreSAD, 120 pMESpec, 121 pDstMV, 122 pDstSAD, 123 BlockSize) 124 ); 125 126 127} 128 129/* End of file */ 130