10c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
20c1bc742181ded4930842b46e9507372f0b1b963James Dong *
30c1bc742181ded4930842b46e9507372f0b1b963James Dong * File Name:  omxVCM4P2_MEInit.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 * Initialization modules for the vendor specific Motion Estimation structure.
140c1bc742181ded4930842b46e9507372f0b1b963James Dong *
150c1bc742181ded4930842b46e9507372f0b1b963James Dong */
160c1bc742181ded4930842b46e9507372f0b1b963James Dong
170c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "omxtypes.h"
180c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armOMX.h"
190c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "omxVC.h"
200c1bc742181ded4930842b46e9507372f0b1b963James Dong
210c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armVC.h"
220c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armCOMM.h"
230c1bc742181ded4930842b46e9507372f0b1b963James Dong
240c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
250c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_MEInit   (6.2.4.1.2)
260c1bc742181ded4930842b46e9507372f0b1b963James Dong *
270c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
280c1bc742181ded4930842b46e9507372f0b1b963James Dong * Initializes the vendor-specific specification structure required for the
290c1bc742181ded4930842b46e9507372f0b1b963James Dong * following motion estimation functions:  BlockMatch_Integer_8x8,
300c1bc742181ded4930842b46e9507372f0b1b963James Dong * BlockMatch_Integer_16x16, and MotionEstimationMB. Memory for the
310c1bc742181ded4930842b46e9507372f0b1b963James Dong * specification structure *pMESpec must be allocated prior to calling the
320c1bc742181ded4930842b46e9507372f0b1b963James Dong * function, and should be aligned on a 4-byte boundary.  Following
330c1bc742181ded4930842b46e9507372f0b1b963James Dong * initialization by this function, the vendor-specific structure *pMESpec
340c1bc742181ded4930842b46e9507372f0b1b963James Dong * should contain an implementation-specific representation of all motion
350c1bc742181ded4930842b46e9507372f0b1b963James Dong * estimation parameters received via the structure pMEParams, for example
360c1bc742181ded4930842b46e9507372f0b1b963James Dong * rndVal, searchRange, etc.  The number of bytes required for the
370c1bc742181ded4930842b46e9507372f0b1b963James Dong * specification structure can be determined using the function
380c1bc742181ded4930842b46e9507372f0b1b963James Dong * omxVCM4P2_MEGetBufSize.
390c1bc742181ded4930842b46e9507372f0b1b963James Dong *
400c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
410c1bc742181ded4930842b46e9507372f0b1b963James Dong *
420c1bc742181ded4930842b46e9507372f0b1b963James Dong *   MEmode - motion estimation mode; available modes are defined by the
430c1bc742181ded4930842b46e9507372f0b1b963James Dong *            enumerated type OMXVCM4P2MEMode
440c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMEParams - motion estimation parameters
450c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMESpec - pointer to the uninitialized ME specification structure
460c1bc742181ded4930842b46e9507372f0b1b963James Dong *
470c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
480c1bc742181ded4930842b46e9507372f0b1b963James Dong *
490c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMESpec - pointer to the initialized ME specification structure
500c1bc742181ded4930842b46e9507372f0b1b963James Dong *
510c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
520c1bc742181ded4930842b46e9507372f0b1b963James Dong *
530c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
540c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - one or more of the following is true:
550c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    an invalid value was specified for the parameter MEmode
560c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    a negative or zero value was specified for the
570c1bc742181ded4930842b46e9507372f0b1b963James Dong *         parameter pMEParams->searchRange
580c1bc742181ded4930842b46e9507372f0b1b963James Dong *
590c1bc742181ded4930842b46e9507372f0b1b963James Dong */
600c1bc742181ded4930842b46e9507372f0b1b963James Dong
610c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_MEInit(
620c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCM4P2MEMode MEMode,
630c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCM4P2MEParams *pMEParams,
640c1bc742181ded4930842b46e9507372f0b1b963James Dong    void *pMESpec
650c1bc742181ded4930842b46e9507372f0b1b963James Dong   )
660c1bc742181ded4930842b46e9507372f0b1b963James Dong{
670c1bc742181ded4930842b46e9507372f0b1b963James Dong    ARMVCM4P2_MESpec *armMESpec = (ARMVCM4P2_MESpec *) pMESpec;
680c1bc742181ded4930842b46e9507372f0b1b963James Dong
690c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf(!pMEParams, OMX_Sts_BadArgErr);
700c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf(!pMESpec, OMX_Sts_BadArgErr);
710c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf((MEMode != OMX_VC_M4P2_FAST_SEARCH) &&
720c1bc742181ded4930842b46e9507372f0b1b963James Dong                   (MEMode != OMX_VC_M4P2_FULL_SEARCH), OMX_Sts_BadArgErr);
730c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf(pMEParams->searchRange <= 0, OMX_Sts_BadArgErr);
740c1bc742181ded4930842b46e9507372f0b1b963James Dong
750c1bc742181ded4930842b46e9507372f0b1b963James Dong    armMESpec->MEParams.searchEnable8x8     = pMEParams->searchEnable8x8;
760c1bc742181ded4930842b46e9507372f0b1b963James Dong    armMESpec->MEParams.halfPelSearchEnable = pMEParams->halfPelSearchEnable;
770c1bc742181ded4930842b46e9507372f0b1b963James Dong    armMESpec->MEParams.searchRange         = pMEParams->searchRange;
780c1bc742181ded4930842b46e9507372f0b1b963James Dong    armMESpec->MEParams.rndVal              = pMEParams->rndVal;
790c1bc742181ded4930842b46e9507372f0b1b963James Dong    armMESpec->MEMode                       = MEMode;
800c1bc742181ded4930842b46e9507372f0b1b963James Dong
810c1bc742181ded4930842b46e9507372f0b1b963James Dong    return OMX_Sts_NoErr;
820c1bc742181ded4930842b46e9507372f0b1b963James Dong}
830c1bc742181ded4930842b46e9507372f0b1b963James Dong
840c1bc742181ded4930842b46e9507372f0b1b963James Dong/* End of file */
85