omxVCM4P2_MEInit.c revision 0c1bc742181ded4930842b46e9507372f0b1b963
1/**
2 *
3 * File Name:  omxVCM4P2_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:  omxVCM4P2_MEInit   (6.2.4.1.2)
26 *
27 * Description:
28 * Initializes the vendor-specific specification structure required for the
29 * following motion estimation functions:  BlockMatch_Integer_8x8,
30 * BlockMatch_Integer_16x16, and MotionEstimationMB. Memory for the
31 * specification structure *pMESpec must be allocated prior to calling the
32 * function, and should be aligned on a 4-byte boundary.  Following
33 * initialization by this function, the vendor-specific structure *pMESpec
34 * should contain an implementation-specific representation of all motion
35 * estimation parameters received via the structure pMEParams, for example
36 * rndVal, searchRange, etc.  The number of bytes required for the
37 * specification structure can be determined using the function
38 * omxVCM4P2_MEGetBufSize.
39 *
40 * Input Arguments:
41 *
42 *   MEmode - motion estimation mode; available modes are defined by the
43 *            enumerated type OMXVCM4P2MEMode
44 *   pMEParams - motion estimation parameters
45 *   pMESpec - pointer to the uninitialized ME specification structure
46 *
47 * Output Arguments:
48 *
49 *   pMESpec - pointer to the initialized ME specification structure
50 *
51 * Return Value:
52 *
53 *    OMX_Sts_NoErr - no error
54 *    OMX_Sts_BadArgErr - one or more of the following is true:
55 *    -    an invalid value was specified for the parameter MEmode
56 *    -    a negative or zero value was specified for the
57 *         parameter pMEParams->searchRange
58 *
59 */
60
61OMXResult omxVCM4P2_MEInit(
62    OMXVCM4P2MEMode MEMode,
63    const OMXVCM4P2MEParams *pMEParams,
64    void *pMESpec
65   )
66{
67    ARMVCM4P2_MESpec *armMESpec = (ARMVCM4P2_MESpec *) pMESpec;
68
69    armRetArgErrIf(!pMEParams, OMX_Sts_BadArgErr);
70    armRetArgErrIf(!pMESpec, OMX_Sts_BadArgErr);
71    armRetArgErrIf((MEMode != OMX_VC_M4P2_FAST_SEARCH) &&
72                   (MEMode != OMX_VC_M4P2_FULL_SEARCH), OMX_Sts_BadArgErr);
73    armRetArgErrIf(pMEParams->searchRange <= 0, OMX_Sts_BadArgErr);
74
75    armMESpec->MEParams.searchEnable8x8     = pMEParams->searchEnable8x8;
76    armMESpec->MEParams.halfPelSearchEnable = pMEParams->halfPelSearchEnable;
77    armMESpec->MEParams.searchRange         = pMEParams->searchRange;
78    armMESpec->MEParams.rndVal              = pMEParams->rndVal;
79    armMESpec->MEMode                       = MEMode;
80
81    return OMX_Sts_NoErr;
82}
83
84/* End of file */
85