⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 omxippp_moments_u8_c3r.c

📁 The OpenMAX DL (Development Layer) APIs contain a comprehensive set of audio, video, signal processi
💻 C
字号:
/** * *  * File Name:  omxIPPP_Moments_U8_C3R.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 three channel source. * */#include "omxtypes.h"#include "armOMX.h"#include "omxIP.h"#include "armCOMM.h"#include "armIP.h"/** * Function:  omxIPPP_Moments_U8_C3R   (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_C3R(     const OMX_U8* pSrc,     OMX_INT srcStep,     OMXSize roiSize,     OMXMomentState* pState     ){    OMX_INT roiWidth    = 3 * roiSize.width;    OMX_INT roiHeight   = roiSize.height;    OMX_INT x, y, mOrd, nOrd;    const OMX_U8 *pSrcTemp = pSrc;    OMX_S64 curMoment0, curMoment1, curMoment2;    OMX_S64 xCentreOfGravity0 = 0, xCentreOfGravity1 = 0, xCentreOfGravity2 = 0;    OMX_S64 yCentreOfGravity0 = 0, yCentreOfGravity1 = 0, yCentreOfGravity2 = 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  = 2;        for(mOrd = 0; mOrd < ARM_IPPP_MOMENTS_MAX_ORDER; mOrd++)    {        for(nOrd = 0; nOrd < ARM_IPPP_MOMENTS_MAX_ORDER; nOrd++)        {            pSrcTemp   = pSrc;            curMoment0 = curMoment1 = curMoment2 = 0;            for(y = 0; y < roiHeight; y++, pSrcTemp += srcStep)            {                for(x = 0; x < roiWidth; x += 3)                {                    curMoment0 += (armIPPP_Power_S64(x/3, mOrd) * armIPPP_Power_S64(y, nOrd) * pSrcTemp[x]);                    curMoment1 += (armIPPP_Power_S64(x/3, mOrd) * armIPPP_Power_S64(y, nOrd) * pSrcTemp[x+1]);                    curMoment2 += (armIPPP_Power_S64(x/3, mOrd) * armIPPP_Power_S64(y, nOrd) * pSrcTemp[x+2]);                }            }            pMomentState->spMoments[0][mOrd][nOrd] = (OMX_S64)curMoment0;            pMomentState->spMoments[1][mOrd][nOrd] = (OMX_S64)curMoment1;            pMomentState->spMoments[2][mOrd][nOrd] = (OMX_S64)curMoment2;        }    }        if(pMomentState->spMoments[0][0][0])    {        xCentreOfGravity0 = armRoundFloatToS64((OMX_F64)pMomentState->spMoments[0][1][0]/pMomentState->spMoments[0][0][0]);        yCentreOfGravity0 = armRoundFloatToS64((OMX_F64)pMomentState->spMoments[0][0][1]/pMomentState->spMoments[0][0][0]);    }        if(pMomentState->spMoments[1][0][0])    {        xCentreOfGravity1 = armRoundFloatToS64((OMX_F64)pMomentState->spMoments[1][1][0]/pMomentState->spMoments[1][0][0]);        yCentreOfGravity1 = armRoundFloatToS64((OMX_F64)pMomentState->spMoments[1][0][1]/pMomentState->spMoments[1][0][0]);    }        if(pMomentState->spMoments[2][0][0])    {        xCentreOfGravity2 = armRoundFloatToS64((OMX_F64)pMomentState->spMoments[2][1][0]/pMomentState->spMoments[2][0][0]);        yCentreOfGravity2 = armRoundFloatToS64((OMX_F64)pMomentState->spMoments[2][0][1]/pMomentState->spMoments[2][0][0]);    }    for(mOrd = 0; mOrd < ARM_IPPP_MOMENTS_MAX_ORDER; mOrd++)    {        for(nOrd = 0; nOrd < ARM_IPPP_MOMENTS_MAX_ORDER; nOrd++)        {            pSrcTemp   = pSrc;            curMoment0 = curMoment1 = curMoment2 = 0;            for(y = 0; y < roiHeight; y++, pSrcTemp += srcStep)            {                for(x = 0; x < roiWidth; x += 3)                {                    curMoment0 += (armIPPP_Power_S64((x/3 - xCentreOfGravity0), mOrd) *                                    armIPPP_Power_S64((y   - yCentreOfGravity0), nOrd) * pSrcTemp[x]);                    curMoment1 += (armIPPP_Power_S64((x/3 - xCentreOfGravity1), mOrd) *                                    armIPPP_Power_S64((y   - yCentreOfGravity1), nOrd) * pSrcTemp[x+1]);                    curMoment2 += (armIPPP_Power_S64((x/3 - xCentreOfGravity2), mOrd) *                                    armIPPP_Power_S64((y   - yCentreOfGravity2), nOrd) * pSrcTemp[x+2]);                }            }            pMomentState->ctMoments[0][mOrd][nOrd] = (OMX_S64)curMoment0;            pMomentState->ctMoments[1][mOrd][nOrd] = (OMX_S64)curMoment1;            pMomentState->ctMoments[2][mOrd][nOrd] = (OMX_S64)curMoment2;        }    }    return OMX_Sts_NoErr;}/* End of file */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -