10c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
20c1bc742181ded4930842b46e9507372f0b1b963James Dong *
30c1bc742181ded4930842b46e9507372f0b1b963James Dong * File Name:  omxVCM4P10_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:  omxVCM4P10_MEInit   (6.3.5.1.2)
260c1bc742181ded4930842b46e9507372f0b1b963James Dong *
270c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
280c1bc742181ded4930842b46e9507372f0b1b963James Dong * Initializes the vendor-specific specification structure required for the
290c1bc742181ded4930842b46e9507372f0b1b963James Dong * omxVCM4P10 motion estimation functions:  BlockMatch_Integer and
300c1bc742181ded4930842b46e9507372f0b1b963James Dong * MotionEstimationMB. Memory for the specification structure *pMESpec must be
310c1bc742181ded4930842b46e9507372f0b1b963James Dong * allocated prior to calling the function, and should be aligned on a 4-byte
320c1bc742181ded4930842b46e9507372f0b1b963James Dong * boundary.  The number of bytes required for the specification structure can
330c1bc742181ded4930842b46e9507372f0b1b963James Dong * be determined using the function omxVCM4P10_MEGetBufSize. Following
340c1bc742181ded4930842b46e9507372f0b1b963James Dong * initialization by this function, the vendor-specific structure *pMESpec
350c1bc742181ded4930842b46e9507372f0b1b963James Dong * should contain an implementation-specific representation of all motion
360c1bc742181ded4930842b46e9507372f0b1b963James Dong * estimation parameters received via the structure pMEParams, for example
370c1bc742181ded4930842b46e9507372f0b1b963James Dong * searchRange16x16, searchRange8x8, etc.
380c1bc742181ded4930842b46e9507372f0b1b963James Dong *
390c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
400c1bc742181ded4930842b46e9507372f0b1b963James Dong *
410c1bc742181ded4930842b46e9507372f0b1b963James Dong *   MEmode - motion estimation mode; available modes are defined by the
420c1bc742181ded4930842b46e9507372f0b1b963James Dong *            enumerated type OMXVCM4P10MEMode
430c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMEParams - motion estimation parameters
440c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMESpec - pointer to the uninitialized ME specification structure
450c1bc742181ded4930842b46e9507372f0b1b963James Dong *
460c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
470c1bc742181ded4930842b46e9507372f0b1b963James Dong *
480c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMESpec - pointer to the initialized ME specification structure
490c1bc742181ded4930842b46e9507372f0b1b963James Dong *
500c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
510c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr, if the function runs without error.
520c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
530c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pMEParams or pSize is NULL.
540c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    an invalid value was specified for the parameter MEmode
550c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    a negative or zero value was specified for one of the search ranges
560c1bc742181ded4930842b46e9507372f0b1b963James Dong *         (e.g.,  pMBParams >searchRange8x8, pMEParams->searchRange16x16, etc.)
570c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    either in isolation or in combination, one or more of the enables or
580c1bc742181ded4930842b46e9507372f0b1b963James Dong *         search ranges in the structure *pMEParams were configured such
590c1bc742181ded4930842b46e9507372f0b1b963James Dong *         that the requested behavior fails to comply with [ISO14496-10].
600c1bc742181ded4930842b46e9507372f0b1b963James Dong *
610c1bc742181ded4930842b46e9507372f0b1b963James Dong */
620c1bc742181ded4930842b46e9507372f0b1b963James Dong
630c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_MEInit(
640c1bc742181ded4930842b46e9507372f0b1b963James Dong        OMXVCM4P10MEMode MEMode,
650c1bc742181ded4930842b46e9507372f0b1b963James Dong        const OMXVCM4P10MEParams *pMEParams,
660c1bc742181ded4930842b46e9507372f0b1b963James Dong        void *pMESpec
670c1bc742181ded4930842b46e9507372f0b1b963James Dong       )
680c1bc742181ded4930842b46e9507372f0b1b963James Dong{
690c1bc742181ded4930842b46e9507372f0b1b963James Dong    ARMVCM4P10_MESpec *armMESpec = (ARMVCM4P10_MESpec *) pMESpec;
700c1bc742181ded4930842b46e9507372f0b1b963James Dong
710c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf(!pMEParams, OMX_Sts_BadArgErr);
720c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf(!pMESpec, OMX_Sts_BadArgErr);
730c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf((MEMode != OMX_VC_M4P10_FAST_SEARCH) &&
740c1bc742181ded4930842b46e9507372f0b1b963James Dong                   (MEMode != OMX_VC_M4P10_FULL_SEARCH), OMX_Sts_BadArgErr);
750c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf((pMEParams->searchRange16x16 <= 0) ||
760c1bc742181ded4930842b46e9507372f0b1b963James Dong                   (pMEParams->searchRange8x8 <= 0) ||
770c1bc742181ded4930842b46e9507372f0b1b963James Dong                   (pMEParams->searchRange4x4 <= 0), OMX_Sts_BadArgErr);
780c1bc742181ded4930842b46e9507372f0b1b963James Dong
790c1bc742181ded4930842b46e9507372f0b1b963James Dong    armMESpec->MEParams.blockSplitEnable8x8 = pMEParams->blockSplitEnable8x8;
800c1bc742181ded4930842b46e9507372f0b1b963James Dong    armMESpec->MEParams.blockSplitEnable4x4 = pMEParams->blockSplitEnable4x4;
810c1bc742181ded4930842b46e9507372f0b1b963James Dong    armMESpec->MEParams.halfSearchEnable    = pMEParams->halfSearchEnable;
820c1bc742181ded4930842b46e9507372f0b1b963James Dong    armMESpec->MEParams.quarterSearchEnable = pMEParams->quarterSearchEnable;
830c1bc742181ded4930842b46e9507372f0b1b963James Dong    armMESpec->MEParams.intraEnable4x4      = pMEParams->intraEnable4x4;
840c1bc742181ded4930842b46e9507372f0b1b963James Dong    armMESpec->MEParams.searchRange16x16    = pMEParams->searchRange16x16;
850c1bc742181ded4930842b46e9507372f0b1b963James Dong    armMESpec->MEParams.searchRange8x8      = pMEParams->searchRange8x8;
860c1bc742181ded4930842b46e9507372f0b1b963James Dong    armMESpec->MEParams.searchRange4x4      = pMEParams->searchRange4x4;
870c1bc742181ded4930842b46e9507372f0b1b963James Dong    armMESpec->MEMode                       = MEMode;
880c1bc742181ded4930842b46e9507372f0b1b963James Dong
890c1bc742181ded4930842b46e9507372f0b1b963James Dong    return OMX_Sts_NoErr;
900c1bc742181ded4930842b46e9507372f0b1b963James Dong}
910c1bc742181ded4930842b46e9507372f0b1b963James Dong
920c1bc742181ded4930842b46e9507372f0b1b963James Dong/* End of file */
93