📄 omxippp_moments_u8_c1r.c
字号:
/** * * * File Name: omxIPPP_Moments_U8_C1R.c * OpenMAX DL: v1.0.2 * Revision: 10586 * Date: Wednesday, March 5, 2008 * * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. * * * * Description : Image Statistical Routine - Computes the moments of order 0 to 3 * for the given ROI of an image from a single channel source. * */#include "omxtypes.h"#include "armOMX.h"#include "omxIP.h"#include "armCOMM.h"#include "armIP.h"/** * Function: omxIPPP_Moments_U8_C1R (4.3.1.2.4) * * Description: * Computes statistical spatial moments of order 0 to 3 for the ROI of the * image pointed to by pSrc. * * Input Arguments: * * pSrc - pointer to the source ROI * srcStep - distance in bytes between the starts of consecutive lines in * the source image * roiSize - size of the ROI in pixels * * Output Arguments: * * pState - pointer to the state structure * * Return Value: * * OMX_Sts_NoErr - no errors detected * OMX_Sts_BadArgErr - bad arguments detected; at least one of the * following is true: * - pSrc or pState is NULL * - srcStep is less than or equal to zero * - roiSize has a field with zero or negative value. * OMX_StsIPPP_ContextMatchErr - contents of the implementation-specific * structure OMXMomentState are invalid * */OMXResult omxIPPP_Moments_U8_C1R( const OMX_U8* pSrc, OMX_INT srcStep, OMXSize roiSize, OMXMomentState* pState ){ OMX_INT roiWidth = roiSize.width; OMX_INT roiHeight = roiSize.height; const OMX_U8 *pSrcTemp = pSrc; OMX_INT x, y, mOrd, nOrd; OMX_S64 curMoment, centreOfGravityX = 0, centreOfGravityY = 0; ARMIPPP_MomentState *pMomentState = (ARMIPPP_MomentState *)pState; armRetArgErrIf(!pMomentState, OMX_Sts_BadArgErr); armRetArgErrIf(!pSrc, OMX_Sts_BadArgErr); armRetArgErrIf(srcStep <= 0, OMX_Sts_BadArgErr); armRetArgErrIf(roiSize.width <= 0, OMX_Sts_BadArgErr); armRetArgErrIf(roiSize.height <= 0, OMX_Sts_BadArgErr); pMomentState->maxValidChannel = 0; for(mOrd = 0; mOrd < ARM_IPPP_MOMENTS_MAX_ORDER; mOrd++) { for(nOrd = 0; nOrd < ARM_IPPP_MOMENTS_MAX_ORDER; nOrd++) { pSrcTemp = pSrc; curMoment = 0; for(y = 0; y < roiHeight; y++, pSrcTemp += srcStep) { for(x = 0; x < roiWidth; x++) { curMoment += (armIPPP_Power_S64(x, mOrd) * armIPPP_Power_S64(y, nOrd) * pSrcTemp[x]); } } pMomentState->spMoments[0][mOrd][nOrd] = (OMX_S64)curMoment; } } if(pMomentState->spMoments[0][0][0]) { centreOfGravityX = armRoundFloatToS64((OMX_F64)pMomentState->spMoments[0][1][0]/pMomentState->spMoments[0][0][0]); centreOfGravityY = armRoundFloatToS64((OMX_F64)pMomentState->spMoments[0][0][1]/pMomentState->spMoments[0][0][0]); } for(mOrd = 0; mOrd < ARM_IPPP_MOMENTS_MAX_ORDER; mOrd++) { for(nOrd = 0; nOrd < ARM_IPPP_MOMENTS_MAX_ORDER; nOrd++) { pSrcTemp = pSrc; curMoment = 0; for(y = 0; y < roiHeight; y++, pSrcTemp += srcStep) { for(x = 0; x < roiWidth; x++) { curMoment += (armIPPP_Power_S64(x-centreOfGravityX, mOrd) * armIPPP_Power_S64(y-centreOfGravityY, nOrd) * pSrcTemp[x]); } } pMomentState->ctMoments[0][mOrd][nOrd] = (OMX_S64)curMoment; } } return OMX_Sts_NoErr;}/* End of file */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -