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: omxVCM4P10_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: omxVCM4P10_MEInit (6.3.5.1.2) 41 * 42 * Description: 43 * Initializes the vendor-specific specification structure required for the 44 * omxVCM4P10 motion estimation functions: BlockMatch_Integer and 45 * MotionEstimationMB. Memory for the specification structure *pMESpec must be 46 * allocated prior to calling the function, and should be aligned on a 4-byte 47 * boundary. The number of bytes required for the specification structure can 48 * be determined using the function omxVCM4P10_MEGetBufSize. Following 49 * initialization by this function, the vendor-specific structure *pMESpec 50 * should contain an implementation-specific representation of all motion 51 * estimation parameters received via the structure pMEParams, for example 52 * searchRange16x16, searchRange8x8, etc. 53 * 54 * Input Arguments: 55 * 56 * MEmode - motion estimation mode; available modes are defined by the 57 * enumerated type OMXVCM4P10MEMode 58 * pMEParams - motion estimation parameters 59 * pMESpec - pointer to the uninitialized ME specification structure 60 * 61 * Output Arguments: 62 * 63 * pMESpec - pointer to the initialized ME specification structure 64 * 65 * Return Value: 66 * OMX_Sts_NoErr, if the function runs without error. 67 * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 68 * - pMEParams or pSize is NULL. 69 * - an invalid value was specified for the parameter MEmode 70 * - a negative or zero value was specified for one of the search ranges 71 * (e.g., pMBParams >searchRange8x8, pMEParams->searchRange16x16, etc.) 72 * - either in isolation or in combination, one or more of the enables or 73 * search ranges in the structure *pMEParams were configured such 74 * that the requested behavior fails to comply with [ISO14496-10]. 75 * 76 */ 77 78OMXResult omxVCM4P10_MEInit( 79 OMXVCM4P10MEMode MEMode, 80 const OMXVCM4P10MEParams *pMEParams, 81 void *pMESpec 82 ) 83{ 84 ARMVCM4P10_MESpec *armMESpec = (ARMVCM4P10_MESpec *) pMESpec; 85 86 armRetArgErrIf(!pMEParams, OMX_Sts_BadArgErr); 87 armRetArgErrIf(!pMESpec, OMX_Sts_BadArgErr); 88 armRetArgErrIf((MEMode != OMX_VC_M4P10_FAST_SEARCH) && 89 (MEMode != OMX_VC_M4P10_FULL_SEARCH), OMX_Sts_BadArgErr); 90 armRetArgErrIf((pMEParams->searchRange16x16 <= 0) || 91 (pMEParams->searchRange8x8 <= 0) || 92 (pMEParams->searchRange4x4 <= 0), OMX_Sts_BadArgErr); 93 94 armMESpec->MEParams.blockSplitEnable8x8 = pMEParams->blockSplitEnable8x8; 95 armMESpec->MEParams.blockSplitEnable4x4 = pMEParams->blockSplitEnable4x4; 96 armMESpec->MEParams.halfSearchEnable = pMEParams->halfSearchEnable; 97 armMESpec->MEParams.quarterSearchEnable = pMEParams->quarterSearchEnable; 98 armMESpec->MEParams.intraEnable4x4 = pMEParams->intraEnable4x4; 99 armMESpec->MEParams.searchRange16x16 = pMEParams->searchRange16x16; 100 armMESpec->MEParams.searchRange8x8 = pMEParams->searchRange8x8; 101 armMESpec->MEParams.searchRange4x4 = pMEParams->searchRange4x4; 102 armMESpec->MEMode = MEMode; 103 104 return OMX_Sts_NoErr; 105} 106 107/* End of file */ 108