omxVCM4P10_MEInit.c revision 0c1bc742181ded4930842b46e9507372f0b1b963
1/**
2 *
3 * File Name:  omxVCM4P10_MEInit.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 * Initialization modules for the vendor specific Motion Estimation structure.
14 *
15 */
16
17#include "omxtypes.h"
18#include "armOMX.h"
19#include "omxVC.h"
20
21#include "armVC.h"
22#include "armCOMM.h"
23
24/**
25 * Function:  omxVCM4P10_MEInit   (6.3.5.1.2)
26 *
27 * Description:
28 * Initializes the vendor-specific specification structure required for the
29 * omxVCM4P10 motion estimation functions:  BlockMatch_Integer and
30 * MotionEstimationMB. Memory for the specification structure *pMESpec must be
31 * allocated prior to calling the function, and should be aligned on a 4-byte
32 * boundary.  The number of bytes required for the specification structure can
33 * be determined using the function omxVCM4P10_MEGetBufSize. Following
34 * initialization by this function, the vendor-specific structure *pMESpec
35 * should contain an implementation-specific representation of all motion
36 * estimation parameters received via the structure pMEParams, for example
37 * searchRange16x16, searchRange8x8, etc.
38 *
39 * Input Arguments:
40 *
41 *   MEmode - motion estimation mode; available modes are defined by the
42 *            enumerated type OMXVCM4P10MEMode
43 *   pMEParams - motion estimation parameters
44 *   pMESpec - pointer to the uninitialized ME specification structure
45 *
46 * Output Arguments:
47 *
48 *   pMESpec - pointer to the initialized ME specification structure
49 *
50 * Return Value:
51 *    OMX_Sts_NoErr, if the function runs without error.
52 *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
53 *    -    pMEParams or pSize is NULL.
54 *    -    an invalid value was specified for the parameter MEmode
55 *    -    a negative or zero value was specified for one of the search ranges
56 *         (e.g.,  pMBParams >searchRange8x8, pMEParams->searchRange16x16, etc.)
57 *    -    either in isolation or in combination, one or more of the enables or
58 *         search ranges in the structure *pMEParams were configured such
59 *         that the requested behavior fails to comply with [ISO14496-10].
60 *
61 */
62
63OMXResult omxVCM4P10_MEInit(
64        OMXVCM4P10MEMode MEMode,
65        const OMXVCM4P10MEParams *pMEParams,
66        void *pMESpec
67       )
68{
69    ARMVCM4P10_MESpec *armMESpec = (ARMVCM4P10_MESpec *) pMESpec;
70
71    armRetArgErrIf(!pMEParams, OMX_Sts_BadArgErr);
72    armRetArgErrIf(!pMESpec, OMX_Sts_BadArgErr);
73    armRetArgErrIf((MEMode != OMX_VC_M4P10_FAST_SEARCH) &&
74                   (MEMode != OMX_VC_M4P10_FULL_SEARCH), OMX_Sts_BadArgErr);
75    armRetArgErrIf((pMEParams->searchRange16x16 <= 0) ||
76                   (pMEParams->searchRange8x8 <= 0) ||
77                   (pMEParams->searchRange4x4 <= 0), OMX_Sts_BadArgErr);
78
79    armMESpec->MEParams.blockSplitEnable8x8 = pMEParams->blockSplitEnable8x8;
80    armMESpec->MEParams.blockSplitEnable4x4 = pMEParams->blockSplitEnable4x4;
81    armMESpec->MEParams.halfSearchEnable    = pMEParams->halfSearchEnable;
82    armMESpec->MEParams.quarterSearchEnable = pMEParams->quarterSearchEnable;
83    armMESpec->MEParams.intraEnable4x4      = pMEParams->intraEnable4x4;
84    armMESpec->MEParams.searchRange16x16    = pMEParams->searchRange16x16;
85    armMESpec->MEParams.searchRange8x8      = pMEParams->searchRange8x8;
86    armMESpec->MEParams.searchRange4x4      = pMEParams->searchRange4x4;
87    armMESpec->MEMode                       = MEMode;
88
89    return OMX_Sts_NoErr;
90}
91
92/* End of file */
93