omxVCM4P2_MEInit.c revision 78e52bfac041d71ce53b5b13c2abf78af742b09d
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_MEInit.c 20 * OpenMAX DL: v1.0.2 21 * Revision: 9641 22 * Date: Thursday, February 7, 2008 23 * 24 * 25 * 26 * 27 * Description: 28 * Initialization modules for the vendor specific Motion Estimation structure. 29 * 30 */ 31 32#include "omxtypes.h" 33#include "armOMX.h" 34#include "omxVC.h" 35 36#include "armVC.h" 37#include "armCOMM.h" 38 39/** 40 * Function: omxVCM4P2_MEInit (6.2.4.1.2) 41 * 42 * Description: 43 * Initializes the vendor-specific specification structure required for the 44 * following motion estimation functions: BlockMatch_Integer_8x8, 45 * BlockMatch_Integer_16x16, and MotionEstimationMB. Memory for the 46 * specification structure *pMESpec must be allocated prior to calling the 47 * function, and should be aligned on a 4-byte boundary. Following 48 * initialization by this function, the vendor-specific structure *pMESpec 49 * should contain an implementation-specific representation of all motion 50 * estimation parameters received via the structure pMEParams, for example 51 * rndVal, searchRange, etc. The number of bytes required for the 52 * specification structure can be determined using the function 53 * omxVCM4P2_MEGetBufSize. 54 * 55 * Input Arguments: 56 * 57 * MEmode - motion estimation mode; available modes are defined by the 58 * enumerated type OMXVCM4P2MEMode 59 * pMEParams - motion estimation parameters 60 * pMESpec - pointer to the uninitialized ME specification structure 61 * 62 * Output Arguments: 63 * 64 * pMESpec - pointer to the initialized ME specification structure 65 * 66 * Return Value: 67 * 68 * OMX_Sts_NoErr - no error 69 * OMX_Sts_BadArgErr - one or more of the following is true: 70 * - an invalid value was specified for the parameter MEmode 71 * - a negative or zero value was specified for the 72 * parameter pMEParams->searchRange 73 * 74 */ 75 76OMXResult omxVCM4P2_MEInit( 77 OMXVCM4P2MEMode MEMode, 78 const OMXVCM4P2MEParams *pMEParams, 79 void *pMESpec 80 ) 81{ 82 ARMVCM4P2_MESpec *armMESpec = (ARMVCM4P2_MESpec *) pMESpec; 83 84 armRetArgErrIf(!pMEParams, OMX_Sts_BadArgErr); 85 armRetArgErrIf(!pMESpec, OMX_Sts_BadArgErr); 86 armRetArgErrIf((MEMode != OMX_VC_M4P2_FAST_SEARCH) && 87 (MEMode != OMX_VC_M4P2_FULL_SEARCH), OMX_Sts_BadArgErr); 88 armRetArgErrIf(pMEParams->searchRange <= 0, OMX_Sts_BadArgErr); 89 90 armMESpec->MEParams.searchEnable8x8 = pMEParams->searchEnable8x8; 91 armMESpec->MEParams.halfPelSearchEnable = pMEParams->halfPelSearchEnable; 92 armMESpec->MEParams.searchRange = pMEParams->searchRange; 93 armMESpec->MEParams.rndVal = pMEParams->rndVal; 94 armMESpec->MEMode = MEMode; 95 96 return OMX_Sts_NoErr; 97} 98 99/* End of file */ 100