10c1bc742181ded4930842b46e9507372f0b1b963James Dong/** 20c1bc742181ded4930842b46e9507372f0b1b963James Dong * 30c1bc742181ded4930842b46e9507372f0b1b963James Dong * File Name: omxVCM4P2_BlockMatch_Integer_16x16.c 40c1bc742181ded4930842b46e9507372f0b1b963James Dong * OpenMAX DL: v1.0.2 50c1bc742181ded4930842b46e9507372f0b1b963James Dong * Revision: 9641 60c1bc742181ded4930842b46e9507372f0b1b963James Dong * Date: Thursday, February 7, 2008 70c1bc742181ded4930842b46e9507372f0b1b963James Dong * 80c1bc742181ded4930842b46e9507372f0b1b963James Dong * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. 90c1bc742181ded4930842b46e9507372f0b1b963James Dong * 100c1bc742181ded4930842b46e9507372f0b1b963James Dong * 110c1bc742181ded4930842b46e9507372f0b1b963James Dong * 120c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description: 130c1bc742181ded4930842b46e9507372f0b1b963James Dong * Contains modules for Block matching, a full search algorithm 140c1bc742181ded4930842b46e9507372f0b1b963James Dong * is implemented 150c1bc742181ded4930842b46e9507372f0b1b963James Dong * 160c1bc742181ded4930842b46e9507372f0b1b963James Dong */ 170c1bc742181ded4930842b46e9507372f0b1b963James Dong 180c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "omxtypes.h" 190c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armOMX.h" 200c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "omxVC.h" 210c1bc742181ded4930842b46e9507372f0b1b963James Dong 220c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armVC.h" 230c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armCOMM.h" 240c1bc742181ded4930842b46e9507372f0b1b963James Dong 250c1bc742181ded4930842b46e9507372f0b1b963James Dong/** 260c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: omxVCM4P2_BlockMatch_Integer_16x16 (6.2.4.2.1) 270c1bc742181ded4930842b46e9507372f0b1b963James Dong * 280c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description: 290c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs a 16x16 block search; estimates motion vector and associated 300c1bc742181ded4930842b46e9507372f0b1b963James Dong * minimum SAD. Both the input and output motion vectors are represented using 310c1bc742181ded4930842b46e9507372f0b1b963James Dong * half-pixel units, and therefore a shift left or right by 1 bit may be 320c1bc742181ded4930842b46e9507372f0b1b963James Dong * required, respectively, to match the input or output MVs with other 330c1bc742181ded4930842b46e9507372f0b1b963James Dong * functions that either generate output MVs or expect input MVs represented 340c1bc742181ded4930842b46e9507372f0b1b963James Dong * using integer pixel units. 350c1bc742181ded4930842b46e9507372f0b1b963James Dong * 360c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments: 370c1bc742181ded4930842b46e9507372f0b1b963James Dong * 380c1bc742181ded4930842b46e9507372f0b1b963James Dong * pSrcRefBuf - pointer to the reference Y plane; points to the reference 390c1bc742181ded4930842b46e9507372f0b1b963James Dong * MB that corresponds to the location of the current macroblock in 400c1bc742181ded4930842b46e9507372f0b1b963James Dong * the current plane. 410c1bc742181ded4930842b46e9507372f0b1b963James Dong * refWidth - width of the reference plane 420c1bc742181ded4930842b46e9507372f0b1b963James Dong * pRefRect - pointer to the valid reference plane rectangle; coordinates 430c1bc742181ded4930842b46e9507372f0b1b963James Dong * are specified relative to the image origin. Rectangle 440c1bc742181ded4930842b46e9507372f0b1b963James Dong * boundaries may extend beyond image boundaries if the image has 450c1bc742181ded4930842b46e9507372f0b1b963James Dong * been padded. For example, if padding extends 4 pixels beyond 460c1bc742181ded4930842b46e9507372f0b1b963James Dong * frame border, then the value for the left border could be set to 470c1bc742181ded4930842b46e9507372f0b1b963James Dong * -4. 480c1bc742181ded4930842b46e9507372f0b1b963James Dong * pSrcCurrBuf - pointer to the current block in the current macroblock 490c1bc742181ded4930842b46e9507372f0b1b963James Dong * buffer extracted from the original plane (linear array, 256 500c1bc742181ded4930842b46e9507372f0b1b963James Dong * entries); must be aligned on a 16-byte boundary. The number of 510c1bc742181ded4930842b46e9507372f0b1b963James Dong * bytes between lines (step) is 16. 520c1bc742181ded4930842b46e9507372f0b1b963James Dong * pCurrPointPos - position of the current macroblock in the current plane 530c1bc742181ded4930842b46e9507372f0b1b963James Dong * pSrcPreMV - pointer to predicted motion vector; NULL indicates no 540c1bc742181ded4930842b46e9507372f0b1b963James Dong * predicted MV 550c1bc742181ded4930842b46e9507372f0b1b963James Dong * pSrcPreSAD - pointer to SAD associated with the predicted MV (referenced 560c1bc742181ded4930842b46e9507372f0b1b963James Dong * by pSrcPreMV); may be set to NULL if unavailable. 570c1bc742181ded4930842b46e9507372f0b1b963James Dong * pMESpec - vendor-specific motion estimation specification structure; 580c1bc742181ded4930842b46e9507372f0b1b963James Dong * must have been allocated and then initialized using 590c1bc742181ded4930842b46e9507372f0b1b963James Dong * omxVCM4P2_MEInit prior to calling the block matching function. 600c1bc742181ded4930842b46e9507372f0b1b963James Dong * 610c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments: 620c1bc742181ded4930842b46e9507372f0b1b963James Dong * 630c1bc742181ded4930842b46e9507372f0b1b963James Dong * pDstMV - pointer to estimated MV 640c1bc742181ded4930842b46e9507372f0b1b963James Dong * pDstSAD - pointer to minimum SAD 650c1bc742181ded4930842b46e9507372f0b1b963James Dong * 660c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value: 670c1bc742181ded4930842b46e9507372f0b1b963James Dong * 680c1bc742181ded4930842b46e9507372f0b1b963James Dong * OMX_Sts_NoErr - no error 690c1bc742181ded4930842b46e9507372f0b1b963James Dong * OMX_Sts_BadArgErr - bad arguments. Returned if one of the following 700c1bc742181ded4930842b46e9507372f0b1b963James Dong * conditions is true: 710c1bc742181ded4930842b46e9507372f0b1b963James Dong * - at least one of the following pointers is NULL: pSrcRefBuf, 720c1bc742181ded4930842b46e9507372f0b1b963James Dong * pRefRect, pSrcCurrBuff, pCurrPointPos, pDstMV, pDstSAD or 730c1bc742181ded4930842b46e9507372f0b1b963James Dong * pMESpec, or 740c1bc742181ded4930842b46e9507372f0b1b963James Dong * - pSrcCurrBuf is not 16-byte aligned 750c1bc742181ded4930842b46e9507372f0b1b963James Dong * 760c1bc742181ded4930842b46e9507372f0b1b963James Dong */ 770c1bc742181ded4930842b46e9507372f0b1b963James Dong 780c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_BlockMatch_Integer_16x16( 790c1bc742181ded4930842b46e9507372f0b1b963James Dong const OMX_U8 *pSrcRefBuf, 800c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_INT refWidth, 810c1bc742181ded4930842b46e9507372f0b1b963James Dong const OMXRect *pRefRect, 820c1bc742181ded4930842b46e9507372f0b1b963James Dong const OMX_U8 *pSrcCurrBuf, 830c1bc742181ded4930842b46e9507372f0b1b963James Dong const OMXVCM4P2Coordinate *pCurrPointPos, 840c1bc742181ded4930842b46e9507372f0b1b963James Dong const OMXVCMotionVector *pSrcPreMV, 850c1bc742181ded4930842b46e9507372f0b1b963James Dong const OMX_INT *pSrcPreSAD, 860c1bc742181ded4930842b46e9507372f0b1b963James Dong void *pMESpec, 870c1bc742181ded4930842b46e9507372f0b1b963James Dong OMXVCMotionVector *pDstMV, 880c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_INT *pDstSAD 890c1bc742181ded4930842b46e9507372f0b1b963James Dong) 900c1bc742181ded4930842b46e9507372f0b1b963James Dong{ 910c1bc742181ded4930842b46e9507372f0b1b963James Dong 920c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_U8 BlockSize = 16; 930c1bc742181ded4930842b46e9507372f0b1b963James Dong 940c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Argument error checks */ 950c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(!armIs16ByteAligned(pSrcCurrBuf), OMX_Sts_BadArgErr); 960c1bc742181ded4930842b46e9507372f0b1b963James Dong 970c1bc742181ded4930842b46e9507372f0b1b963James Dong return ( armVCM4P2_BlockMatch_Integer( 980c1bc742181ded4930842b46e9507372f0b1b963James Dong pSrcRefBuf, 990c1bc742181ded4930842b46e9507372f0b1b963James Dong refWidth, 1000c1bc742181ded4930842b46e9507372f0b1b963James Dong pRefRect, 1010c1bc742181ded4930842b46e9507372f0b1b963James Dong pSrcCurrBuf, 1020c1bc742181ded4930842b46e9507372f0b1b963James Dong pCurrPointPos, 1030c1bc742181ded4930842b46e9507372f0b1b963James Dong pSrcPreMV, 1040c1bc742181ded4930842b46e9507372f0b1b963James Dong pSrcPreSAD, 1050c1bc742181ded4930842b46e9507372f0b1b963James Dong pMESpec, 1060c1bc742181ded4930842b46e9507372f0b1b963James Dong pDstMV, 1070c1bc742181ded4930842b46e9507372f0b1b963James Dong pDstSAD, 1080c1bc742181ded4930842b46e9507372f0b1b963James Dong BlockSize) 1090c1bc742181ded4930842b46e9507372f0b1b963James Dong ); 1100c1bc742181ded4930842b46e9507372f0b1b963James Dong 1110c1bc742181ded4930842b46e9507372f0b1b963James Dong 1120c1bc742181ded4930842b46e9507372f0b1b963James Dong} 1130c1bc742181ded4930842b46e9507372f0b1b963James Dong 1140c1bc742181ded4930842b46e9507372f0b1b963James Dong/* End of file */ 115